fix cmdid judgement in dev model sample ex

This commit is contained in:
ethan.du 2020-06-18 14:00:12 +08:00
parent 7c841d4138
commit a3455f74b1
2 changed files with 2 additions and 3 deletions

View File

@ -79,7 +79,7 @@ static void _init_command_input_template(){
}
static void _input_parse_config(const char *cmd_id, const char *input){
if(0 == strncmp(cmd_id, "set_temp_correction", strlen("set_temp_correction")))
if((strlen(cmd_id) == strlen("set_temp_correction")) && (0 == strncmp(cmd_id, "set_temp_correction", strlen("set_temp_correction"))))
{
char *set_temp_correction_temp_correction = NULL;
set_temp_correction_temp_correction = LITE_json_value_of((char *)"temp_correction", (char *)input);
@ -109,7 +109,6 @@ static void _init_command_output_template(){
cmd_output_set_temp_correction_effect_temp_correction.value.dm_node = &node_cmd_output_set_temp_correction_effect_temp_correction;
}
//用实际设备四元组替换
#define UIOT_MY_PRODUCT_SN "PRODUCT_SN"

View File

@ -214,7 +214,7 @@ class input_json_parse:
def get_input_config(self):
input_config = ""
input_config += " if(0 == strncmp(cmd_id, \"{}\", strlen(\"{}\")))\n".format(self.cmd_id, self.cmd_id)
input_config += " if((strlen(cmd_id) == strlen(\"{}\")) && (0 == strncmp(cmd_id, \"{}\", strlen(\"{}\"))))\n".format(self.cmd_id, self.cmd_id, self.cmd_id)
input_config += " {\n"
input_config += " char *{} = NULL;\n".format(self.cmd_id + "_" + self.input["Identifier"])
input_config += " {} = LITE_json_value_of((char *)\"{}\", (char *)input);\n".format(self.cmd_id + "_" + self.input["Identifier"], self.input["Identifier"])