Commit 97359dde authored by chen.weican's avatar chen.weican

【修改内容】修改设置场景导致网关死机bug

【提交人】陈伟灿
parent 717a02b9
...@@ -526,10 +526,10 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac ...@@ -526,10 +526,10 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac
cJSON_AddStringToObject(info,MSG_DEVICE_CODE_STR,ptr->actionInfo->info.deviceCode); cJSON_AddStringToObject(info,MSG_DEVICE_CODE_STR,ptr->actionInfo->info.deviceCode);
cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYNAME,ptr->actionInfo->info.propertyName); cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYNAME,ptr->actionInfo->info.propertyName);
if((prtyObj = cJSON_Parse(ptr->actionInfo->info.propertyValue))==NULL){ if(strstr(ptr->actionInfo->info.propertyValue,"{")!=NULL &&strstr(ptr->actionInfo->info.propertyValue,"}")!=NULL ){
cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYVALUE,ptr->actionInfo->info.propertyValue);
}else{
cJSON_AddItemToObject(info, MSG_SCENE_PROPERTYVALUE, prtyObj); cJSON_AddItemToObject(info, MSG_SCENE_PROPERTYVALUE, prtyObj);
}else{
cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYVALUE,ptr->actionInfo->info.propertyValue);
} }
cJSON_AddNumberToObject(info,MSG_SCENE_DELAY,ptr->actionInfo->info.delay); cJSON_AddNumberToObject(info,MSG_SCENE_DELAY,ptr->actionInfo->info.delay);
...@@ -910,7 +910,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -910,7 +910,7 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
cJSON *epNum; cJSON *epNum;
int ArmingStateFlag = 0; int ArmingStateFlag = 0;
int iepnum; int iepnum;
char propertyValueStr[255] = {0}; char propertyValueStr[DEVICE_PROPERTY_VALUE_MAX] = {0};
printf("----->kk_scene_parse_scene_action\r\n"); printf("----->kk_scene_parse_scene_action\r\n");
...@@ -1006,12 +1006,12 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1006,12 +1006,12 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
if(kk_subDev_check_scene_support(node->fatherDeviceCode) == 1 && ArmingStateFlag == 0){ if(kk_subDev_check_scene_support(node->fatherDeviceCode) == 1 && ArmingStateFlag == 0){
kk_scene_action_detail_t info = {0}; kk_scene_action_detail_t info = {0};
memset(propertyValueStr,0,sizeof(propertyValueStr));
memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode)); memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode));
memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring)); memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring));
if(propertyValue->type==cJSON_Number){ if(propertyValue->type==cJSON_Number){
memset(propertyValueStr,0,sizeof(propertyValueStr));
snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",propertyValue->valueint); snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",propertyValue->valueint);
}else if(propertyValue->type==cJSON_String){ }else if(propertyValue->type==cJSON_String){
snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",propertyValue->valuestring); snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",propertyValue->valuestring);
...@@ -1020,7 +1020,6 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1020,7 +1020,6 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",str); snprintf(propertyValueStr,sizeof(propertyValueStr),"%s",str);
free(str); free(str);
} }
memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr)); memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr));
info.epNum = iepnum; info.epNum = iepnum;
info.delay = idelay; info.delay = idelay;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment