Commit e13e0d1f authored by chen.weican's avatar chen.weican

【修改内容】修改场景设置不防撤防失败的BUG

【提交人】陈伟灿
parent c5f15f21
...@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root) ...@@ -67,7 +67,7 @@ int send_msg_to_module(cJSON *root)
} }
if((msg = cJSON_Print(root))!=NULL){ if((msg = cJSON_Print(root))!=NULL){
debug_log(LOG_INFO_LEVEL,"[lan->module]\n%s\n",msg); //debug_log(LOG_INFO_LEVEL,"[lan->module]\n%s\n",msg);
cJSON_Minify(msg); cJSON_Minify(msg);
kk_send_data_to_sdk(msg); kk_send_data_to_sdk(msg);
......
...@@ -436,21 +436,20 @@ static int kk_get_properties_info_obj(char *deviceCode) ...@@ -436,21 +436,20 @@ static int kk_get_properties_info_obj(char *deviceCode)
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL); sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
propertyStr = (char*)sqlite3_column_text(stmt, DB_IDENTIFITER); propertyStr = (char*)sqlite3_column_text(stmt, DB_IDENTIFITER);
valueType = sqlite3_column_int(stmt, DB_VALUETYPE); valueType = sqlite3_column_int(stmt, DB_VALUETYPE);
valueStr = (char*)sqlite3_column_text(stmt, DB_VALUE); valueStr = (char*)sqlite3_column_text(stmt, DB_VALUE);
if(strstr(propertyStr,".") != NULL){ if(strstr(propertyStr,".") != NULL){
printf("[%s][%d]\n",__FUNCTION__,__LINE__); //printf("[%s][%d]\n",__FUNCTION__,__LINE__);
char *propertiesbuf[DEVICE_PROPERTY_NAME_MAX] = {0}; char *propertiesbuf[DEVICE_PROPERTY_NAME_MAX] = {0};
kk_split(propertyStr,".",propertiesbuf,&num); kk_split(propertyStr,".",propertiesbuf,&num);
if(num == 2){ if(num == 2){
if(strcmp(propertiesbuf[0],pFinal) != 0){ if(strcmp(propertiesbuf[0],pFinal) != 0){
printf("[%s][%d]\n",__FUNCTION__,__LINE__); //printf("[%s][%d]\n",__FUNCTION__,__LINE__);
memcpy(pFinal,propertiesbuf[0],strlen(propertiesbuf[0])); memcpy(pFinal,propertiesbuf[0],strlen(propertiesbuf[0]));
subObj = cJSON_CreateObject(); subObj = cJSON_CreateObject();
} }
printf("[%s][%d]\n",__FUNCTION__,__LINE__); //printf("[%s][%d]\n",__FUNCTION__,__LINE__);
if(strlen(pFinal) > 0 && subObj != NULL){ if(strlen(pFinal) > 0 && subObj != NULL){
if(valueType == KK_TSL_DATA_TYPE_TEXT){ if(valueType == KK_TSL_DATA_TYPE_TEXT){
cJSON_AddStringToObject(subObj, propertiesbuf[1], valueStr); cJSON_AddStringToObject(subObj, propertiesbuf[1], valueStr);
...@@ -467,7 +466,7 @@ static int kk_get_properties_info_obj(char *deviceCode) ...@@ -467,7 +466,7 @@ static int kk_get_properties_info_obj(char *deviceCode)
//printf("---------------------------------------->pFinal:%s,num:%d\n",pFinal,epNumInt); //printf("---------------------------------------->pFinal:%s,num:%d\n",pFinal,epNumInt);
} }
else{ else{
printf("[%s][%d]\n",__FUNCTION__,__LINE__); //printf("[%s][%d]\n",__FUNCTION__,__LINE__);
if(valueType == KK_TSL_DATA_TYPE_TEXT){ if(valueType == KK_TSL_DATA_TYPE_TEXT){
cJSON_AddStringToObject(obj, propertyStr, valueStr); cJSON_AddStringToObject(obj, propertyStr, valueStr);
}else if(valueType == KK_TSL_DATA_TYPE_INT|| }else if(valueType == KK_TSL_DATA_TYPE_INT||
......
...@@ -206,7 +206,11 @@ void *kk_scene_yield(void *args) ...@@ -206,7 +206,11 @@ void *kk_scene_yield(void *args)
INFO_PRINT("[%s][%d] actionDelayInfo->starttime:%ld\n",__FUNCTION__,__LINE__,actionDelayInfo->starttime); INFO_PRINT("[%s][%d] actionDelayInfo->starttime:%ld\n",__FUNCTION__,__LINE__,actionDelayInfo->starttime);
if(current_time >= actionDelayInfo->starttime){ if(current_time >= actionDelayInfo->starttime){
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__); INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
kk_scene_send_action_msg(actionDelayInfo->action); if(strcmp(actionDelayInfo->action->propertyName,"ArmingState") == 0){
kk_service_arming_set(actionDelayInfo->action->propertyValue);
}else{
kk_scene_send_action_msg(actionDelayInfo->action);
}
if(actionDelayInfo == p_delay_action_list){ if(actionDelayInfo == p_delay_action_list){
pTemp = p_delay_action_list; pTemp = p_delay_action_list;
p_delay_action_list = p_delay_action_list->next; p_delay_action_list = p_delay_action_list->next;
...@@ -897,8 +901,9 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -897,8 +901,9 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
cJSON *productType; cJSON *productType;
cJSON *deviceCode; cJSON *deviceCode;
cJSON *epNum; cJSON *epNum;
int ArmingStateFlag = 0;
int iepnum; int iepnum;
char propertyValueStr[64] = {0}; char propertyValueStr[255] = {0};
printf("----->kk_scene_parse_scene_action\r\n"); printf("----->kk_scene_parse_scene_action\r\n");
...@@ -948,6 +953,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -948,6 +953,15 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
propertyValue->valuestring,type->valuestring,idelay); propertyValue->valuestring,type->valuestring,idelay);
} }
else{ else{
memset(propertyValueStr,0x0,sizeof(propertyValueStr));
if(propertyValue->type==cJSON_Number){
snprintf(propertyValueStr,sizeof(propertyValueStr),"%d",propertyValue->valueint);
}else{
memcpy(propertyValueStr,propertyValue->valuestring,strlen(propertyValue->valuestring));
}
if(strcmp(propertyName->valuestring,"ArmingState") == 0){
ArmingStateFlag = 1;
}
deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR); deviceCode = cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR);
if(deviceCode == NULL) return FAIL_RETURN; if(deviceCode == NULL) return FAIL_RETURN;
epNum = cJSON_GetObjectItem(item,MSG_SCENE_EPNUM); epNum = cJSON_GetObjectItem(item,MSG_SCENE_EPNUM);
...@@ -970,23 +984,13 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -970,23 +984,13 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
continue; continue;
} }
if(kk_subDev_check_scene_support(node->fatherDeviceCode) == 1){ 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};
memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode)); memcpy(info.deviceCode,node->deviceCode,strlen(node->deviceCode));
memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr));
memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring)); memcpy(info.propertyName,propertyName->valuestring,strlen(propertyName->valuestring));
if(propertyValue->type==cJSON_Number){
snprintf(propertyValueStr,64,"%d",propertyValue->valueint);
memcpy(info.propertyValue,propertyValueStr,strlen(propertyValueStr));
}else{
memcpy(info.propertyValue,propertyValue->valuestring,strlen(propertyValue->valuestring));
}
info.epNum = iepnum; info.epNum = iepnum;
info.delay = idelay; info.delay = idelay;
...@@ -1006,7 +1010,8 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat ...@@ -1006,7 +1010,8 @@ int kk_scene_parse_scene_action(const cJSON* str,const char *sceneId,int isUpdat
} }
item = item->next; item = item->next;
} }
if(propertySetType){ //场景设置布防不需要下发到网关
if(propertySetType && ArmingStateFlag == 0){
kk_scene_action_info_send(isUpdate); kk_scene_action_info_send(isUpdate);
} }
return SUCCESS_RETURN; return SUCCESS_RETURN;
...@@ -1749,7 +1754,11 @@ static int kk_scene_start_action(const char *deviceCode,const char *propertyName ...@@ -1749,7 +1754,11 @@ static int kk_scene_start_action(const char *deviceCode,const char *propertyName
memcpy(actionInfo->propertyName,propertyName,strlen(propertyName)); memcpy(actionInfo->propertyName,propertyName,strlen(propertyName));
memcpy(actionInfo->propertyValue,valueS,strlen(valueS)); memcpy(actionInfo->propertyValue,valueS,strlen(valueS));
if(delay == 0){ if(delay == 0){
kk_scene_send_action_msg(actionInfo); if(strcmp(propertyName,"ArmingState") == 0){
kk_service_arming_set(valueS);
}else{
kk_scene_send_action_msg(actionInfo);
}
}else{ }else{
INFO_PRINT("[%s][%d]delay:%d\n",__FUNCTION__,__LINE__,delay); INFO_PRINT("[%s][%d]delay:%d\n",__FUNCTION__,__LINE__,delay);
kk_scene_push_action_list(actionInfo,delay); kk_scene_push_action_list(actionInfo,delay);
......
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