diff options
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -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; +} |