Theme Editor: Added (I think) all of the tags to the device configuration window
[kugel-rb.git] / uisimulator / common / fmradio.c
blobcef9abf94e7e48fb1ce8ba708e0c18b3880e7ca0
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include <stdbool.h>
22 #include <stdlib.h>
23 #include "config.h"
24 #include "debug.h"
25 #include "tuner.h"
27 #if CONFIG_TUNER
29 static int frequency = 0;
30 static bool mono = false;
32 static bool powered = false;
34 void tuner_init(void)
38 int tuner_set(int setting, int value)
40 switch(setting)
42 case RADIO_SLEEP:
43 break;
45 case RADIO_FREQUENCY:
46 frequency = value;
47 break;
49 case RADIO_SCAN_FREQUENCY:
50 frequency = value;
51 break;
53 case RADIO_MUTE:
54 break;
56 case RADIO_FORCE_MONO:
57 mono = (value != 0);
58 break;
60 default:
61 return -1;
64 return 1;
67 int tuner_get(int setting)
69 int val = 0;
71 switch(setting)
73 case RADIO_PRESENT:
74 val = 1; /* true */
75 break;
77 case RADIO_TUNED:
78 if(frequency == 99500000)
79 val = 1;
80 break;
82 case RADIO_STEREO:
83 if(frequency == 99500000)
84 val = mono?0:1;
85 break;
87 case RADIO_ALL: /* debug query */
88 break;
90 return val;
93 bool tuner_power(bool status)
95 bool oldstatus = powered;
96 powered = status;
97 return oldstatus;
100 #ifdef HAVE_RDS_CAP
101 char* tuner_get_rds_info(int setting)
103 char *text = NULL;
105 switch(setting)
107 case RADIO_RDS_NAME:
108 text = "Rockbox Radio";
109 break;
111 case RADIO_RDS_TEXT:
112 text = "http://www.rockbox.org" ;
113 break;
115 return text;
117 #endif
118 #endif