summaryrefslogtreecommitdiff
path: root/uisimulator
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-02-11 23:16:39 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-02-11 23:16:39 -0500
commit523ef4edbdccf8198fbb7787afba2fe3f46f1ca8 (patch)
tree3238ca1502c92ce2078ff58a6f2a2589eaa68a95 /uisimulator
parentfc9695eb47732e1c189e2f033dbd55e5c346e8c4 (diff)
downloadrockbox-523ef4edbdccf8198fbb7787afba2fe3f46f1ca8.tar.gz
rockbox-523ef4edbdccf8198fbb7787afba2fe3f46f1ca8.zip
Fix warnings and errors from fc9695e
* fmradio.c needs an implementation of tuner_get_rds_info() for the sim (kill all the sims). * Some macro bitflags shouldn't be seen unless HAVE_RDS_CAP is defined. Change-Id: Idd00c94ca2fc43cf32f9223aa4530d5a02fb3454
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/fmradio.c56
1 files changed, 43 insertions, 13 deletions
diff --git a/uisimulator/common/fmradio.c b/uisimulator/common/fmradio.c
index 6f6b0f914f..a18db819f2 100644
--- a/uisimulator/common/fmradio.c
+++ b/uisimulator/common/fmradio.c
@@ -23,6 +23,11 @@
23#include "config.h" 23#include "config.h"
24#include "debug.h" 24#include "debug.h"
25#include "tuner.h" 25#include "tuner.h"
26#ifdef HAVE_RDS_CAP
27#include <strlcpy.h>
28#include "system.h"
29#include "rds.h"
30#endif
26 31
27#if CONFIG_TUNER 32#if CONFIG_TUNER
28 33
@@ -124,21 +129,46 @@ bool tuner_power(bool status)
124} 129}
125 130
126#ifdef HAVE_RDS_CAP 131#ifdef HAVE_RDS_CAP
127char* tuner_get_rds_info(int setting) 132size_t tuner_get_rds_info(int setting, void *dst, size_t dstsize)
128{ 133{
129 char *text = NULL; 134 /* TODO: integrate this into tuner_get/set */
130 135 static const unsigned char info_id_tbl[] =
131 switch(setting)
132 { 136 {
133 case RADIO_RDS_NAME: 137 [RADIO_RDS_NAME] = RDS_INFO_PS,
134 text = "Rockbox Radio"; 138 [RADIO_RDS_TEXT] = RDS_INFO_RT,
135 break; 139 [RADIO_RDS_PROGRAM_INFO] = RDS_INFO_PI,
140 [RADIO_RDS_CURRENT_TIME] = RDS_INFO_CT,
141 };
136 142
137 case RADIO_RDS_TEXT: 143 if ((unsigned int)setting >= ARRAYLEN(info_id_tbl))
138 text = "http://www.rockbox.org" ; 144 return 0;
139 break; 145
146 switch (info_id_tbl[setting])
147 {
148 case RDS_INFO_PI:
149 if (dstsize >= sizeof (uint16_t)) {
150 *(uint16_t *)dst = 0;
151 }
152 dstsize = sizeof (uint16_t);
153 break;
154 case RDS_INFO_PS:
155 dstsize = strlcpy(dst, "Rockbox Radio", dstsize);
156 break;
157 case RDS_INFO_RT:
158 dstsize = strlcpy(dst, "http://www.rockbox.org", dstsize);
159 break;
160 case RDS_INFO_CT:
161 if (dstsize >= sizeof (time_t)) {
162 *(time_t *)dst = 0;
163 }
164 dstsize = sizeof (time_t);
165 break;
166
167 default:
168 dstsize = 0;
140 } 169 }
141 return text; 170
171 return dstsize;
142} 172}
143#endif 173#endif /* HAVE_RDS_CAP */
144#endif 174#endif /* CONFIG_TUNER */