diff options
-rw-r--r-- | error_utils.c | 6 | ||||
-rw-r--r-- | parser.c | 35 |
2 files changed, 39 insertions, 2 deletions
diff --git a/error_utils.c b/error_utils.c index a9cd2ae..4481205 100644 --- a/error_utils.c +++ b/error_utils.c @@ -143,9 +143,13 @@ void queue_error_and_display_on_LCD(int error_num) void queue_and_broadcast_sensor_alarm(int error_num) // FIXME - implement { -// not part of this project, but left in for coder's reference. Can be deleted for now + gchar* response = NULL; + queue_error_and_get_text(&response, error_num); + LCD_display_extended_message (response, TRUE, TRUE); + g_free (response); } + /*----------------------------------------------------------------------------------------------------------*/ void Error_Remove_From_Queue(void) { @@ -117,6 +117,7 @@ static int Go_avrq_ampl(gchar** response, int channel, char *parameter,char *uni static int Go_cal_100(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_cal_interval_101(gchar** response, int channel, char *parameter,char *units,int command_type); static int Go_eprom_reset_102(gchar** response, int channel, char *parameter,char *units,int command_type); +static int Go_broadcast_103(gchar** response, int channel, char *parameter,char *units,int command_type); static int Parser_id_word(char *id_me, int *channel, int *with_id_code) { @@ -350,6 +351,8 @@ static int Parser_id_word(char *id_me, int *channel, int *with_id_code) id_code = 107; } else if (!strcmp(id_me,"reset") || !strcmp(id_me,"res")) { id_code = 108; + } else if (!strcmp(id_me,"broadcast") ) { //FIXME + id_code = 109; } else { id_code = 9999; } @@ -474,7 +477,8 @@ static int Parser_find_commands(int commands[], int command_depth) {23,106,88,93}, /* diag:slew:calib:point - 99 */ {88,107|optional}, /* calibration:all - 100 */ {88,37}, /* calibration:frequency - 101 */ - {23,57,108} /* diag:eprom:reset - 102 */ + {23,57,108}, /* diag:eprom:reset - 102 */ + {109} /* broadcast - 103 */ }; @@ -1051,6 +1055,9 @@ void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer case 102: error_num=Go_eprom_reset_102(&response,channel,parameter,units,command_type); break; + case 103: + error_num=Go_broadcast_103(&response,channel,parameter,units,command_type); + break; case 9999: // was only whitespace, ignore @@ -4178,3 +4185,29 @@ static int Go_cal_interval_101(gchar** response, int channel, char *parameter,ch } +static int Go_broadcast_103(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + gchar *broadcast_str = NULL; + + switch (command_type) { + case command_withparam: + broadcast_str = g_strdup_printf ("broadcast msg: %s\r\n> ", parameter); + g_printf ("%s", broadcast_str); + g_free (broadcast_str); + return OK; + break; + + case command_param_units: + broadcast_str = g_strdup_printf ("broadcast msg: %s %s\r\n> ", parameter, units); + g_printf ("%s", broadcast_str); + g_free (broadcast_str); + return OK; + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} |