diff --git a/samples/dev_model/dev_model_sample_ex.c b/samples/dev_model/dev_model_sample_ex.c index 5f14beb..c4752db 100644 --- a/samples/dev_model/dev_model_sample_ex.c +++ b/samples/dev_model/dev_model_sample_ex.c @@ -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" diff --git a/tools/codegen.py b/tools/codegen.py index 7a7ea7a..65cf083 100644 --- a/tools/codegen.py +++ b/tools/codegen.py @@ -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"])