Commit e3f9bf9d authored by 陈伟灿's avatar 陈伟灿

Merge branch 'cwc' into 'master'

【修改内容】修改空调网关因没有内机导致同步死机的BUG

See merge request chenweican/k-sdk!175
parents 4f152160 3057a861
...@@ -94,7 +94,7 @@ void *kk_findccu_handle(void *data) ...@@ -94,7 +94,7 @@ void *kk_findccu_handle(void *data)
WARNING_PRINT("read error....\n"); WARNING_PRINT("read error....\n");
}else{ }else{
DEBUG_PRINT("findccu recmsg: %s\n", recvline); DEBUG_PRINT("findccu recmsg: %s\n", recvline);
DEBUG_PRINT("findccu frome ip: %s\n", inet_ntoa(presaddr.sin_addr)); WARNING_PRINT("findccu from ip: %s\n", inet_ntoa(presaddr.sin_addr));
pStart = strstr(recvline, "!"); pStart = strstr(recvline, "!");
pEnd = strstr(recvline, "$"); pEnd = strstr(recvline, "$");
......
...@@ -208,32 +208,11 @@ int main(int argc, char* argv[]) ...@@ -208,32 +208,11 @@ int main(int argc, char* argv[])
int ret = 0; int ret = 0;
struct sigaction sa; struct sigaction sa;
//#ifdef CONFIG_8197_PLATFORM
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
signal(SIGALRM, SIG_IGN); signal(SIGALRM, SIG_IGN);
signal(SIGSTOP, SIG_IGN); signal(SIGSTOP, SIG_IGN);
//#else
/* setup alarm signal handler */
//#ifdef CONFIG_NX5_PLATFORM
//for(int i=1;i<32;i++){
//signal(i, handler);
//}
//#endif
//#endif
//signal(SIGPIPE, SIG_IGN);
openlog("kk_lan",LOG_CONS|LOG_PID,LOG_USER); openlog("kk_lan",LOG_CONS|LOG_PID,LOG_USER);
//if(prg_run_singleton(argv[0])<0){
//debug_log(LOG_CRITICAL_LEVEL,"[%s]run singleton fail!\n",argv[0]);
//return -1;
//}
kk_lan_pid_init(); kk_lan_pid_init();
kk_lan_ccuid_init(); kk_lan_ccuid_init();
......
...@@ -1508,16 +1508,13 @@ int kk_create_syncinfo_to_sdk(cJSON *payload,int push) ...@@ -1508,16 +1508,13 @@ int kk_create_syncinfo_to_sdk(cJSON *payload,int push)
cJSON_AddItemToObject(root, "air_box_devices", air_box_devices); cJSON_AddItemToObject(root, "air_box_devices", air_box_devices);
alarms = cJSON_CreateArray(); alarms = cJSON_CreateArray();
cJSON_AddItemToObject(root, "alarms", alarms); cJSON_AddItemToObject(root, "alarms", alarms);
cJSON *shortcut_panel_configs=cJSON_CreateArray();
cJSON_AddItemToObject(root, "shortcut_panel_configs", shortcut_panel_configs);
ccu_link_status = cJSON_CreateObject(); ccu_link_status = cJSON_CreateObject();
link_arg = cJSON_CreateObject(); link_arg = cJSON_CreateObject();
cJSON_AddItemToObject(ccu_link_status, "link_arg", link_arg); cJSON_AddItemToObject(ccu_link_status, "link_arg", link_arg);
cJSON_AddStringToObject(ccu_link_status, "link_type", "broadband_net"); cJSON_AddStringToObject(ccu_link_status, "link_type", "broadband_net");
cJSON_AddItemToObject(root, "ccu_link_status", ccu_link_status); cJSON_AddItemToObject(root, "ccu_link_status", ccu_link_status);
printf("[%s][%d]\n",__FUNCTION__,__LINE__);
cnwise_music_controllers = cJSON_CreateArray(); cnwise_music_controllers = cJSON_CreateArray();
cJSON_AddItemToObject(root, "cnwise_music_controllers", cnwise_music_controllers); cJSON_AddItemToObject(root, "cnwise_music_controllers", cnwise_music_controllers);
code_lib_controllers = cJSON_CreateArray(); code_lib_controllers = cJSON_CreateArray();
......
...@@ -85,6 +85,8 @@ typedef struct { ...@@ -85,6 +85,8 @@ typedef struct {
#define KK_THING_SERVICE_ADDSCENC_REPLY "/thing/service/addScene_reply" #define KK_THING_SERVICE_ADDSCENC_REPLY "/thing/service/addScene_reply"
#define KK_THING_SERVICE_DELETESCENC "/thing/service/deleteScene" #define KK_THING_SERVICE_DELETESCENC "/thing/service/deleteScene"
#define KK_THING_SERVICE_DELETESCENC_REPLY "/thing/service/deleteScene_reply" #define KK_THING_SERVICE_DELETESCENC_REPLY "/thing/service/deleteScene_reply"
#define KK_THING_SERVICE_ENABLESCENC "/thing/service/enableScene"
#define KK_THING_SERVICE_ENABLESCENC_REPLY "/thing/service/enableScene_reply"
#define KK_THING_SERVICE_UPDATESCENC "/thing/service/updateScene" #define KK_THING_SERVICE_UPDATESCENC "/thing/service/updateScene"
#define KK_THING_SERVICE_UPDATESCENC_REPLY "/thing/service/updateScene_reply" #define KK_THING_SERVICE_UPDATESCENC_REPLY "/thing/service/updateScene_reply"
#define KK_THING_SERVICE_PROPERTY_GET_REPLY "/thing/service/property/get_reply" #define KK_THING_SERVICE_PROPERTY_GET_REPLY "/thing/service/property/get_reply"
......
...@@ -1454,6 +1454,28 @@ static int kk_service_updateScene_handle(cJSON *param,cJSON *msgId) ...@@ -1454,6 +1454,28 @@ static int kk_service_updateScene_handle(cJSON *param,cJSON *msgId)
return res; return res;
} }
/************************************************************ /************************************************************
*功能描述:使能场景处理
*输入参数:params:云端下发数据,包含场景名称,场景类型,场景使能,场景Id等
msgId:消息Id
*输出参数:无
*返 回 值: 0:成功;其他:失败
*其他说明:
*************************************************************/
static int kk_service_enableScene_handle(cJSON *param,cJSON *msgId)
{
int res = 0;
kk_tsl_t *pSceneShadow = NULL;
if(param == NULL || msgId == NULL){
return INVALID_PARAMETER;
}
cJSON *sceneId = cJSON_GetObjectItem(param,MSG_SCENE_SCENEID);
if(sceneId == NULL) return FAIL_RETURN;
cJSON* enable = cJSON_GetObjectItem(param, MSG_SCENE_ENABLE);
if(enable == NULL) return FAIL_RETURN;
kk_scene_update_scene_enable(enable->valueint,sceneId->valuestring);
return res;
}
/************************************************************
*功能描述:删除场景处理 *功能描述:删除场景处理
*输入参数:params:云端下发数据,包含场景Id等 *输入参数:params:云端下发数据,包含场景Id等
msgId:消息Id msgId:消息Id
...@@ -2105,6 +2127,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data) ...@@ -2105,6 +2127,13 @@ static void _iotx_linkkit_event_callback(iotx_dm_event_types_t type, char *data)
kk_service_updateScene_handle(paramStr,msgId); kk_service_updateScene_handle(paramStr,msgId);
kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_UPDATESCENC_REPLY); kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_UPDATESCENC_REPLY);
} }
else if(strcmp(typeJson->valuestring,KK_THING_SERVICE_ENABLESCENC) == 0){
INFO_PRINT(" enable scene \n");
cJSON *paramStr = cJSON_GetObjectItem(payload, MSG_PARAMS_STR);
cJSON *msgId = cJSON_GetObjectItem(payload, MSG_COMMON_MSGID);
kk_service_enableScene_handle(paramStr,msgId);
kk_service_common_reply(info_root,msgId,KK_THING_SERVICE_ENABLESCENC_REPLY);
}
else if(strcmp(typeJson->valuestring,KK_THING_SERVICE_DELETESCENC) == 0){ else if(strcmp(typeJson->valuestring,KK_THING_SERVICE_DELETESCENC) == 0){
INFO_PRINT("delete scene \n"); INFO_PRINT("delete scene \n");
cJSON *paramStr = cJSON_GetObjectItem(payload, MSG_PARAMS_STR); cJSON *paramStr = cJSON_GetObjectItem(payload, MSG_PARAMS_STR);
......
...@@ -51,7 +51,7 @@ static int kk_service_get_reply(char *deviceCode,char *productCode,char *msgId,d ...@@ -51,7 +51,7 @@ static int kk_service_get_reply(char *deviceCode,char *productCode,char *msgId,d
cJSON_AddNumberToObject(paramInfo, "data", (double)param1); cJSON_AddNumberToObject(paramInfo, "data", (double)param1);
}else if(strcmp(type,"ChildLockState") == 0){ }else if(strcmp(type,"ChildLockState") == 0){
cJSON_AddNumberToObject(paramInfo, "ChildLockState", (int)param1); cJSON_AddNumberToObject(paramInfo, "ChildLockState", (int)param1);
}else if(strcmp(type,"PowerDownSave") == 0){ }else if(strcmp(type,"PowerMemory") == 0){
cJSON_AddNumberToObject(paramInfo, "PowerMemory", (int)param1); cJSON_AddNumberToObject(paramInfo, "PowerMemory", (int)param1);
cJSON_AddNumberToObject(paramInfo, "Mode", (int)1); cJSON_AddNumberToObject(paramInfo, "Mode", (int)1);
}else if(strcmp(type,"Screensaver") == 0){ }else if(strcmp(type,"Screensaver") == 0){
...@@ -351,12 +351,12 @@ static int kk_property_WaterValveArgs_handle(char *deviceCode,int epNum,char *ms ...@@ -351,12 +351,12 @@ static int kk_property_WaterValveArgs_handle(char *deviceCode,int epNum,char *ms
mutiDev = kk_check_muti_device(node); mutiDev = kk_check_muti_device(node);
if(mutiDev){ if(mutiDev){
memset(propertiesTmp,0x0,sizeof(propertiesTmp)); memset(propertiesTmp,0x0,sizeof(propertiesTmp));
sprintf(propertiesTmp,"PowerDownSave_%d",epNum); sprintf(propertiesTmp,"PowerMemory_%d",epNum);
kk_property_db_get_value(deviceCode,propertiesTmp,&PowerDownSave); kk_property_db_get_value(deviceCode,propertiesTmp,&PowerDownSave);
}else{ }else{
kk_property_db_get_value(deviceCode,"PowerDownSave",&PowerDownSave); kk_property_db_get_value(deviceCode,"PowerMemory",&PowerDownSave);
} }
kk_service_get_reply(deviceCode,node->productCode,msgid,PowerDownSave,1,-1,epNum,"PowerDownSave"); kk_service_get_reply(deviceCode,node->productCode,msgid,PowerDownSave,1,-1,epNum,"PowerMemory");
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
static int kk_property_Screensaver_handle(char *deviceCode,int epNum,char *msgid) static int kk_property_Screensaver_handle(char *deviceCode,int epNum,char *msgid)
......
...@@ -712,6 +712,7 @@ static int _kk_air_switch_handle(char* deviceCode, char *sceneId, char *property ...@@ -712,6 +712,7 @@ static int _kk_air_switch_handle(char* deviceCode, char *sceneId, char *property
int kk_subDev_set_action_by_productType(const char *productType,const char *roomId,const char *sceneId,const char *propertyName,const char *propertyValue,const char *type,int delay) int kk_subDev_set_action_by_productType(const char *productType,const char *roomId,const char *sceneId,const char *propertyName,const char *propertyValue,const char *type,int delay)
{ {
int res = 0; int res = 0;
int devIsExsit = 0;
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
char *sqlCmd = NULL; char *sqlCmd = NULL;
char *pDeviceCode = NULL; char *pDeviceCode = NULL;
...@@ -747,8 +748,10 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room ...@@ -747,8 +748,10 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
INFO_PRINT("typeArray[k]:%s\n",typeArray[k]); INFO_PRINT("typeArray[k]:%s\n",typeArray[k]);
sqlCmd = sqlite3_mprintf(searchCmd,typeArray[k]); //curtain type sqlCmd = sqlite3_mprintf(searchCmd,typeArray[k]); //curtain type
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL); sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
devIsExsit = 0;
//INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt)); //INFO_PRINT("total_column = %d\n", sqlite3_column_count(stmt));
while(sqlite3_step(stmt) == SQLITE_ROW){ while(sqlite3_step(stmt) == SQLITE_ROW){
pDeviceCode = (char*)sqlite3_column_text(stmt, DB_SUB_DEVICECODE); pDeviceCode = (char*)sqlite3_column_text(stmt, DB_SUB_DEVICECODE);
res = dm_mgr_get_device_by_devicecode(pDeviceCode,&node); res = dm_mgr_get_device_by_devicecode(pDeviceCode,&node);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
...@@ -804,6 +807,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room ...@@ -804,6 +807,7 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
continue; continue;
} }
info.delay = delay; info.delay = delay;
devIsExsit = 1;
kk_scene_action_add(node->fatherDeviceCode,sceneId,info); kk_scene_action_add(node->fatherDeviceCode,sceneId,info);
res = kk_scene_insert_scene_action(type,node->deviceCode,info.epNum, res = kk_scene_insert_scene_action(type,node->deviceCode,info.epNum,
property->identifier,propertyValue,info.delay,sceneId,node->fatherDeviceCode); property->identifier,propertyValue,info.delay,sceneId,node->fatherDeviceCode);
...@@ -815,6 +819,15 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room ...@@ -815,6 +819,15 @@ int kk_subDev_set_action_by_productType(const char *productType,const char *room
} }
} }
} }
if(devIsExsit == 0){//设置场景,但是又没有对应的设备需要插入一条无效action用于记录propertyName,同步需要
res = kk_scene_insert_scene_action(type,"",1,
propertyName,propertyValue,delay,sceneId,"");
if(res != SUCCESS_RETURN){
INFO_PRINT("kk_subDev_set_action_by_productType fail!!!\n");
//return res;
continue;
}
}
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
sqlite3_free(sqlCmd); sqlite3_free(sqlCmd);
} }
......
...@@ -482,12 +482,12 @@ static cJSON *kk_get_indoor_properties_info(char *deviceCode) ...@@ -482,12 +482,12 @@ static cJSON *kk_get_indoor_properties_info(char *deviceCode)
} }
} }
cJSON_AddItemToArray(eps,propertyItem); cJSON_AddItemToArray(eps,propertyItem);
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
} }
cJSON_AddItemToObject(obj, "eps", eps); cJSON_AddItemToObject(obj, "eps", eps);
cJSON_AddNumberToObject(obj, "EpTotal", count); cJSON_AddNumberToObject(obj, "EpTotal", count);
cJSON_AddNumberToObject(obj, "CombineDeviceFlag", 1); cJSON_AddNumberToObject(obj, "CombineDeviceFlag", 1);
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
return obj; return obj;
} }
static cJSON *kk_get_subfreshair_properties_info(char *deviceCode) static cJSON *kk_get_subfreshair_properties_info(char *deviceCode)
...@@ -675,15 +675,13 @@ static int kk_get_panelConfig_info(cJSON *decvies,char *deviceCode) ...@@ -675,15 +675,13 @@ static int kk_get_panelConfig_info(cJSON *decvies,char *deviceCode)
} }
cJSON *panelConfig = NULL; cJSON *panelConfig = NULL;
sqlCmd = sqlite3_mprintf("select * from QuickPanelScene WHERE deviceCode = '%s' ",deviceCode); sqlCmd = sqlite3_mprintf("select * from QuickPanelScene WHERE deviceCode = '%s' ",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){
if(mFlag == 0){ if(mFlag == 0){
mFlag = 1; mFlag = 1;
panelConfig = cJSON_CreateArray(); panelConfig = cJSON_CreateArray();
} }
cJSON *item = cJSON_CreateObject(); cJSON *item = cJSON_CreateObject();
cJSON *action= cJSON_CreateObject(); cJSON *action= cJSON_CreateObject();
...@@ -706,7 +704,6 @@ static int kk_get_panelConfig_info(cJSON *decvies,char *deviceCode) ...@@ -706,7 +704,6 @@ static int kk_get_panelConfig_info(cJSON *decvies,char *deviceCode)
cJSON_AddStringToObject(item, "buttonId", buttonId); cJSON_AddStringToObject(item, "buttonId", buttonId);
cJSON_AddItemToArray(panelConfig, item); cJSON_AddItemToArray(panelConfig, item);
} }
if(mFlag == 1){ if(mFlag == 1){
cJSON_AddItemToObject(decvies, "panelConfig",panelConfig ); cJSON_AddItemToObject(decvies, "panelConfig",panelConfig );
} }
...@@ -770,14 +767,13 @@ static int kk_get_sub_devices_info(cJSON *gwdevicesItem,char *deviceCode) ...@@ -770,14 +767,13 @@ static int kk_get_sub_devices_info(cJSON *gwdevicesItem,char *deviceCode)
subProductCode = (char*)sqlite3_column_text(stmt, DB_SUB_PRODUCTCODE); subProductCode = (char*)sqlite3_column_text(stmt, DB_SUB_PRODUCTCODE);
subVersion = (char*)sqlite3_column_text(stmt, DB_SUB_VERSION); subVersion = (char*)sqlite3_column_text(stmt, DB_SUB_VERSION);
subIsline = (char*)sqlite3_column_text(stmt, DB_SUB_ONLINE); subIsline = (char*)sqlite3_column_text(stmt, DB_SUB_ONLINE);
subproductType = (char*)sqlite3_column_text(stmt, DB_SUB_PRODUCTTYPE); subproductType = (char*)sqlite3_column_text(stmt, DB_SUB_PRODUCTTYPE);
cJSON_AddStringToObject(subdevicesItem, KK_SYNC_DEVICECODE_STR, subDeviceCode); cJSON_AddStringToObject(subdevicesItem, KK_SYNC_DEVICECODE_STR, subDeviceCode);
cJSON_AddStringToObject(subdevicesItem, KK_SYNC_VERSION_STR, subVersion); cJSON_AddStringToObject(subdevicesItem, KK_SYNC_VERSION_STR, subVersion);
_kk_deviceCode_switchto_mac(subDeviceCode,macaddr); _kk_deviceCode_switchto_mac(subDeviceCode,macaddr);
cJSON_AddStringToObject(subdevicesItem, KK_SYNC_MAC_STR, macaddr); cJSON_AddStringToObject(subdevicesItem, KK_SYNC_MAC_STR, macaddr);
cJSON_AddNumberToObject(subdevicesItem, KK_SYNC_ONLINE_STR, (strcmp(subIsline,"0")==0)?1:0); cJSON_AddNumberToObject(subdevicesItem, KK_SYNC_ONLINE_STR, (strcmp(subIsline,"0")==0)?1:0);
kk_get_panelConfig_info(subdevicesItem,subDeviceCode); kk_get_panelConfig_info(subdevicesItem,subDeviceCode);
cJSON_AddStringToObject(subdevicesItem, KK_SYNC_PRODUCTCODE_STR, subProductCode); cJSON_AddStringToObject(subdevicesItem, KK_SYNC_PRODUCTCODE_STR, subProductCode);
......
...@@ -1165,6 +1165,13 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC ...@@ -1165,6 +1165,13 @@ static int kk_subDevice_property_handle(cJSON *info,cJSON *payload,char *deviceC
} }
static int _kk_subDevice_online_to_app(cJSON *info,cJSON *payload) static int _kk_subDevice_online_to_app(cJSON *info,cJSON *payload)
{ {
char ccuid[32] = {0};
HAL_Get_ccuid(ccuid);
cJSON *param = cJSON_GetObjectItem(payload, "params");
if(param == NULL){
return -1;
}
cJSON_AddStringToObject(param, "ccuCode", ccuid);
char *payload11=cJSON_Print(payload); char *payload11=cJSON_Print(payload);
char *infff=cJSON_Print(info); char *infff=cJSON_Print(info);
printf("------------------------payload11:%s\n",payload11); printf("------------------------payload11:%s\n",payload11);
......
...@@ -533,12 +533,12 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac ...@@ -533,12 +533,12 @@ int kk_scene_action_add(const char *gwdeviceCode,const char *sceneId,kk_scene_ac
cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYNAME,ptr->actionInfo->info.propertyName); cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYNAME,ptr->actionInfo->info.propertyName);
if(strstr(ptr->actionInfo->info.propertyValue,"{")!=NULL &&strstr(ptr->actionInfo->info.propertyValue,"}")!=NULL ){ if(strstr(ptr->actionInfo->info.propertyValue,"{")!=NULL &&strstr(ptr->actionInfo->info.propertyValue,"}")!=NULL ){
prtyObj = cJSON_Parse(ptr->actionInfo->info.propertyValue); //prtyObj = cJSON_Parse(ptr->actionInfo->info.propertyValue);
if(prtyObj != NULL){ //if(prtyObj != NULL){
cJSON_AddItemToObject(info, MSG_SCENE_PROPERTYVALUE, prtyObj); //cJSON_AddItemToObject(info, MSG_SCENE_PROPERTYVALUE, prtyObj);
}else{ //}else{
cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYVALUE,ptr->actionInfo->info.propertyValue); cJSON_AddStringToObject(info,MSG_SCENE_PROPERTYVALUE,ptr->actionInfo->info.propertyValue);
} //}
}else{ }else{
//开启/关闭取反操作 //开启/关闭取反操作
if(strcmp(ptr->actionInfo->info.propertyName,"PowerSwitch") == 0 && strcmp(ptr->actionInfo->info.propertyValue,"2") == 0){ if(strcmp(ptr->actionInfo->info.propertyName,"PowerSwitch") == 0 && strcmp(ptr->actionInfo->info.propertyValue,"2") == 0){
...@@ -1164,6 +1164,23 @@ static int _kk_scene_LightStripSpecialAction_handle(cJSON* propertyValue,char *d ...@@ -1164,6 +1164,23 @@ static int _kk_scene_LightStripSpecialAction_handle(cJSON* propertyValue,char *d
kk_scene_action_add(fatherDeviceCode,sceneId,info); kk_scene_action_add(fatherDeviceCode,sceneId,info);
} }
memset(&info,0x0,sizeof(kk_scene_action_detail_t)); memset(&info,0x0,sizeof(kk_scene_action_detail_t));
cJSON * WhiteBrightness = cJSON_GetObjectItem(propertyValue,"WhiteBrightness");
if(WhiteBrightness != NULL && WhiteBrightness->type==cJSON_Number){
sprintf(info.propertyValue,"%d",WhiteBrightness->valueint);
memcpy(info.propertyName,"WhiteBrightness",strlen("WhiteBrightness"));
memcpy(info.deviceCode,deviceCode,strlen(deviceCode));
info.epNum = ep;
info.delay = idelay;
kk_scene_action_add(fatherDeviceCode,sceneId,info);
}else if(WhiteBrightness != NULL && WhiteBrightness->type==cJSON_String){
memcpy(info.propertyValue,WhiteBrightness->valuestring,strlen(WhiteBrightness->valuestring));
memcpy(info.propertyName,"WhiteBrightness",strlen("WhiteBrightness"));
memcpy(info.deviceCode,deviceCode,strlen(deviceCode));
info.epNum = ep;
info.delay = idelay;
kk_scene_action_add(fatherDeviceCode,sceneId,info);
}
memset(&info,0x0,sizeof(kk_scene_action_detail_t));
cJSON * RGBColor = cJSON_GetObjectItem(propertyValue,"RGBColor"); cJSON * RGBColor = cJSON_GetObjectItem(propertyValue,"RGBColor");
if(RGBColor != NULL && RGBColor->type==cJSON_String){//"RGBColor":"[115,114,253]" if(RGBColor != NULL && RGBColor->type==cJSON_String){//"RGBColor":"[115,114,253]"
cJSON *rgb = cJSON_CreateObject(); cJSON *rgb = cJSON_CreateObject();
......
{ {
"productCode":"3137", "productCode":"3137",
"operateType":"514", "operateType":"512",
"channel":1, "channel":1,
"syn_type":1, "syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS", "syn_opcode":"DIMMABLE_LIGHT_STATUS",
......
{ {
"productCode":"3172", "productCode":"3172",
"operateType":"507", "operateType":"506",
"channel":1, "channel":1,
"syn_type":1, "syn_type":1,
"syn_opcode":"DIMMABLE_LIGHT_STATUS", "syn_opcode":"DIMMABLE_LIGHT_STATUS",
......
...@@ -70,12 +70,57 @@ ...@@ -70,12 +70,57 @@
} }
}, },
"name": "亮度" "name": "亮度"
},
{
"identifier": "FadeTime",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
} }
], ],
"identifier": "get", "identifier": "get",
"inputData": [ "inputData": [
"PowerSwitch", "PowerSwitch",
"Brightness" "Brightness",
"FadeTime",
"LowBrightness",
"HighBrightness"
], ],
"method": "thing.service.property.get", "method": "thing.service.property.get",
"name": "get", "name": "get",
...@@ -127,6 +172,51 @@ ...@@ -127,6 +172,51 @@
"step": "1" "step": "1"
} }
} }
},
{
"identifier": "FadeTime",
"accessMode": "rw",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"accessMode": "rw",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"accessMode": "rw",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
} }
], ],
"events": [ "events": [
...@@ -156,6 +246,48 @@ ...@@ -156,6 +246,48 @@
} }
}, },
"name": "亮度" "name": "亮度"
},
{
"identifier": "FadeTime",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "50",
"unit": "1/10s",
"unitName": "1/10秒",
"step": "10"
}
},
"name": "渐变时间"
},
{
"identifier": "LowBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "10",
"max": "90",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最低亮度"
},
{
"identifier": "HighBrightness",
"dataType": {
"type": "int",
"specs": {
"min": "20",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "1"
}
},
"name": "最高亮度"
} }
], ],
"identifier": "property", "identifier": "property",
......
This diff is collapsed.
...@@ -47,9 +47,11 @@ ...@@ -47,9 +47,11 @@
"dataType": { "dataType": {
"type": "enum", "type": "enum",
"specs": { "specs": {
"0": "自动",
"2": "低档", "2": "低档",
"3": "中档", "3": "中档",
"4": "高档" "4": "高档",
"6": "未知"
} }
} }
}, },
......
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3108.json", "schema": "https://iot-ap.ikonke.com/model/product_3108.json",
"productType": "On/Off Output", "productType": "On/Off Output",
"version": "1.0", "version": "1.1",
"profile": { "profile": {
"heartbeat": "300", "heartbeat": "300",
"productCode": "3108", "productCode": "3108",
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"name": "电源开关" "name": "电源开关"
}, },
{ {
"identifier": "PowerDownSave", "identifier": "PowerMemory",
"dataType": { "dataType": {
"specs": { "specs": {
"0": "关闭", "0": "关闭",
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
"name": "电源开关" "name": "电源开关"
}, },
{ {
"identifier": "PowerDownSave", "identifier": "PowerMemory",
"dataType": { "dataType": {
"specs": { "specs": {
"0": "关闭", "0": "关闭",
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
"identifier": "get", "identifier": "get",
"inputData": [ "inputData": [
"PowerSwitch", "PowerSwitch",
"PowerDownSave" "PowerMemory"
], ],
"method": "thing.service.property.get", "method": "thing.service.property.get",
"name": "get", "name": "get",
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
"required": true "required": true
}, },
{ {
"identifier": "PowerDownSave", "identifier": "PowerMemory",
"dataType": { "dataType": {
"specs": { "specs": {
"0": "关闭", "0": "关闭",
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
"name": "电源开关" "name": "电源开关"
}, },
{ {
"identifier": "PowerDownSave", "identifier": "PowerMemory",
"dataType": { "dataType": {
"specs": { "specs": {
"0": "关闭", "0": "关闭",
......
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