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

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

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