diff options
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 39 |
1 files changed, 37 insertions, 2 deletions
@@ -116,6 +116,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_atten_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) { @@ -351,6 +352,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,"attenuator") || !strcmp(id_me,"att")) { + id_code = 109; } else { id_code = 9999; } @@ -476,6 +479,7 @@ static int Parser_find_commands(int commands[], int command_depth) {88,107|optional}, /* calibration:all - 100 */ {88,37}, /* calibration:frequency - 101 */ {23,57,108}, /* diag:eprom:reset - 102 */ + {23,109,16|optional}, /* diag:attenuator:state - 103 */ }; @@ -1044,7 +1048,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_atten_103(&response,channel,parameter,units,command_type); + break; case 9999: // was only whitespace, ignore break; @@ -3267,7 +3273,7 @@ static int Parse_chan_list(int channel,char *parameter,int *primary_selected, in } n = atoi(digits->str); - g_string_free (digits, TRUE); + g_string_free (digits, TRUE); if (error_num) { return error_num; @@ -4029,3 +4035,32 @@ static int Go_cal_interval_101(gchar** response, int channel, char *parameter,ch return ThisShouldntHappen; } + + +static int Go_atten_103(gchar** response, int channel, char *parameter,char *units,int command_type) +{ + int on_off, status; + + switch (command_type) { + case command_withparam: + if (status=process_on_off (parameter, &on_off)) { + return status; + } + globals.Flags.attenuators_enabled = on_off; + + return OK; + break; + + case query_simple: + return query_int (response, globals.Flags.attenuators_enabled); + break; + + default: + return SyntaxError; + break; + } + + return ThisShouldntHappen; +} + + |