Skip to content

Commit 792569b

Browse files
committed
More error checking.
1 parent 8a2138e commit 792569b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

beacon.c

+30
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ void beacon_init (struct audio_s *pmodem, struct misc_config_s *pconfig, struct
172172
* If a serious error is found, set type to BEACON_IGNORE and that
173173
* table entry should be ignored later on.
174174
*/
175+
176+
// TODO: Better checking.
177+
// We should really have a table for which keywords are are required,
178+
// optional, or not allowed for each beacon type. Options which
179+
// are not applicable are often silently ignored, causing confusion.
180+
175181
for (j=0; j<g_misc_config_p->num_beacons; j++) {
176182
int chan = g_misc_config_p->beacon[j].sendto_chan;
177183

@@ -207,6 +213,18 @@ void beacon_init (struct audio_s *pmodem, struct misc_config_s *pconfig, struct
207213
g_misc_config_p->beacon[j].btype = BEACON_IGNORE;
208214
continue;
209215
}
216+
217+
/* INFO and INFOCMD are only for Custom Beacon. */
218+
219+
if (g_misc_config_p->beacon[j].custom_info != NULL || g_misc_config_p->beacon[j].custom_infocmd != NULL) {
220+
text_color_set(DW_COLOR_ERROR);
221+
dw_printf ("Config file, line %d: INFO or INFOCMD are allowed only for custom beacon.\n", g_misc_config_p->beacon[j].lineno);
222+
dw_printf ("INFO and INFOCMD allow you to specify contents of the Information field so it\n");
223+
dw_printf ("so it would not make sense to use these with other beacon types which construct\n");
224+
dw_printf ("the Information field. Perhaps you want to use COMMENT or COMMENTCMD option.\n");
225+
//g_misc_config_p->beacon[j].btype = BEACON_IGNORE;
226+
continue;
227+
}
210228
break;
211229

212230
case BEACON_TRACKER:
@@ -232,6 +250,18 @@ void beacon_init (struct audio_s *pmodem, struct misc_config_s *pconfig, struct
232250

233251
}
234252
}
253+
254+
/* INFO and INFOCMD are only for Custom Beacon. */
255+
256+
if (g_misc_config_p->beacon[j].custom_info != NULL || g_misc_config_p->beacon[j].custom_infocmd != NULL) {
257+
text_color_set(DW_COLOR_ERROR);
258+
dw_printf ("Config file, line %d: INFO or INFOCMD are allowed only for custom beacon.\n", g_misc_config_p->beacon[j].lineno);
259+
dw_printf ("INFO and INFOCMD allow you to specify contents of the Information field so it\n");
260+
dw_printf ("so it would not make sense to use these with other beacon types which construct\n");
261+
dw_printf ("the Information field. Perhaps you want to use COMMENT or COMMENTCMD option.\n");
262+
//g_misc_config_p->beacon[j].btype = BEACON_IGNORE;
263+
continue;
264+
}
235265
break;
236266

237267
case BEACON_CUSTOM:

0 commit comments

Comments
 (0)