Merge pull request #36 from ucloud/bugfix_fix_cmd_id_judgement

fix cmdid judgement in dev model sample ex
This commit is contained in:
ethanDu1 2020-06-18 14:02:36 +08:00 committed by GitHub
commit 77d61eeaa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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){ 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; char *set_temp_correction_temp_correction = NULL;
set_temp_correction_temp_correction = LITE_json_value_of((char *)"temp_correction", (char *)input); 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; 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" #define UIOT_MY_PRODUCT_SN "PRODUCT_SN"

View File

@ -214,7 +214,7 @@ class input_json_parse:
def get_input_config(self): def get_input_config(self):
input_config = "" 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 += " {\n"
input_config += " char *{} = NULL;\n".format(self.cmd_id + "_" + self.input["Identifier"]) 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"]) input_config += " {} = LITE_json_value_of((char *)\"{}\", (char *)input);\n".format(self.cmd_id + "_" + self.input["Identifier"], self.input["Identifier"])