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

Merge branch 'cwc' into 'master'

【修改内容】1,修改物模型;2,其他问题修改

See merge request chenweican/k-sdk!204
parents 38f01a95 282f3062
...@@ -204,6 +204,7 @@ char * g_filerToCloudTable[] = ...@@ -204,6 +204,7 @@ char * g_filerToCloudTable[] =
(char *){"/thing/service/clientReport_reply"}, (char *){"/thing/service/clientReport_reply"},
(char *){"/thing/service/clientOnlinePush"}, (char *){"/thing/service/clientOnlinePush"},
(char *){"/thing/service/getClientInfo_reply"}, (char *){"/thing/service/getClientInfo_reply"},
(char *){"/thing/topo/change_reply"},
}; };
/************************************************************ /************************************************************
*功能描述:过滤不需要下发给网关的消息 *功能描述:过滤不需要下发给网关的消息
......
...@@ -1023,7 +1023,7 @@ void KK_Data_FromMid(void* str,int len, char* chalMark) ...@@ -1023,7 +1023,7 @@ void KK_Data_FromMid(void* str,int len, char* chalMark)
}else{ }else{
kk_lan_property_post_deal(deviceCode->valuestring,payload); kk_lan_property_post_deal(deviceCode->valuestring,payload);
} }
}else if(strstr(msgtype->valuestring,"/thing/topo/delete")!= NULL){ }else if(strstr(msgtype->valuestring,"/thing/topo/change_reply")!= NULL){
INFO_PRINT("topo delete handle!!!"); INFO_PRINT("topo delete handle!!!");
kk_lan_device_delete_notify(payload); kk_lan_device_delete_notify(payload);
}else if(strstr(msgtype->valuestring,"/thing/status/online")!= NULL){ }else if(strstr(msgtype->valuestring,"/thing/status/online")!= NULL){
......
...@@ -424,7 +424,41 @@ int dm_mgr_get_device_by_devicecode(_IN_ char deviceCode[DEVICE_CODE_MAXLEN], _O ...@@ -424,7 +424,41 @@ int dm_mgr_get_device_by_devicecode(_IN_ char deviceCode[DEVICE_CODE_MAXLEN], _O
ERROR_PRINT("Device Not Found, deviceCode: %s\n", deviceCode); ERROR_PRINT("Device Not Found, deviceCode: %s\n", deviceCode);
return FAIL_RETURN; return FAIL_RETURN;
} }
char * g_TNBTable[] =
{
(char *){"3052"},
(char *){"3084"},
(char *){"3119"},
(char *){"3132"},
};
int kk_check_TNBDev(const char* productCode)
{
int i = 0,num = 0;
num = sizeof(g_TNBTable)/sizeof(char *);
for(i =0; i < num; i++){
if(strcmp(productCode,g_TNBTable[i]) == 0){
return 1;
}
}
return 0;
}
int dm_mgr_get_sensorNum(void)
{
dm_mgr_ctx *ctx = _dm_mgr_get_ctx();
dm_mgr_dev_node_t *search_node = NULL;
int num = 0;
list_for_each_entry(search_node, &ctx->dev_list, linked_list, dm_mgr_dev_node_t) {
if ((strlen(search_node->productType) == strlen("sensor")) &&
(memcmp(search_node->productType, "sensor", strlen("sensor")) == 0)) {
if(kk_check_TNBDev((const char*)search_node->productCode) == 1){
continue;
}
num++;
}
}
return num;
}
int dm_mgr_get_deviceNum_by_productType(_IN_ char *productType) int dm_mgr_get_deviceNum_by_productType(_IN_ char *productType)
{ {
dm_mgr_ctx *ctx = _dm_mgr_get_ctx(); dm_mgr_ctx *ctx = _dm_mgr_get_ctx();
......
...@@ -130,4 +130,6 @@ int kk_get_pid(char *productId); ...@@ -130,4 +130,6 @@ int kk_get_pid(char *productId);
int dm_mgr_ccu_heartbeat_cloud(_IN_ int devid); int dm_mgr_ccu_heartbeat_cloud(_IN_ int devid);
cJSON *dm_mgr_get_ccu_info(void); cJSON *dm_mgr_get_ccu_info(void);
int kk_is_mutiEp_device(const char *deviceCode); int kk_is_mutiEp_device(const char *deviceCode);
int dm_mgr_get_sensorNum(void);
int kk_check_TNBDev(const char* productCode);
#endif #endif
...@@ -60,6 +60,7 @@ typedef struct { ...@@ -60,6 +60,7 @@ typedef struct {
#define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete" #define KK_THING_TOPO_DELETE_MSG "/thing/topo/delete"
#define KK_THING_TOPO_BATCH_DELETE_MSG "/thing/topo/batch_delete" #define KK_THING_TOPO_BATCH_DELETE_MSG "/thing/topo/batch_delete"
#define KK_THING_TOPO_CHANGE_MSG "/thing/topo/change" #define KK_THING_TOPO_CHANGE_MSG "/thing/topo/change"
#define KK_THING_TOPO_CHANGE_MSG_REPLY "/thing/topo/change_reply"
#define KK_THING_SERVICE_REBOOT "/thing/service/reboot" #define KK_THING_SERVICE_REBOOT "/thing/service/reboot"
#define KK_THING_SERVICE_ADDROOM "/thing/service/addRoom" #define KK_THING_SERVICE_ADDROOM "/thing/service/addRoom"
#define KK_THING_SERVICE_ADDROOM_REPLY "/thing/service/addRoom_reply" #define KK_THING_SERVICE_ADDROOM_REPLY "/thing/service/addRoom_reply"
......
...@@ -375,7 +375,7 @@ static int kk_topo_delete_report(cJSON *paramStr) ...@@ -375,7 +375,7 @@ static int kk_topo_delete_report(cJSON *paramStr)
return FAIL_RETURN; return FAIL_RETURN;
} }
cJSON *info = cJSON_CreateObject(); cJSON *info = cJSON_CreateObject();
cJSON_AddStringToObject(info, MSG_TYPE_STR, KK_THING_TOPO_DELETE_MSG); cJSON_AddStringToObject(info, MSG_TYPE_STR, KK_THING_TOPO_CHANGE_MSG_REPLY);
cJSON_AddStringToObject(info, MSG_DEVICE_CODE_STR, node->deviceCode); cJSON_AddStringToObject(info, MSG_DEVICE_CODE_STR, node->deviceCode);
cJSON_AddStringToObject(info, MSG_PRODUCT_CODE_STR, node->productCode); cJSON_AddStringToObject(info, MSG_PRODUCT_CODE_STR, node->productCode);
char *infff=cJSON_Print(info); char *infff=cJSON_Print(info);
...@@ -389,7 +389,7 @@ static int kk_topo_delete_report(cJSON *paramStr) ...@@ -389,7 +389,7 @@ static int kk_topo_delete_report(cJSON *paramStr)
cJSON_AddStringToObject(paramsInfo, "productCode", productCode); cJSON_AddStringToObject(paramsInfo, "productCode", productCode);
cJSON_AddItemToObject(payload, "params", paramsInfo); cJSON_AddItemToObject(payload, "params", paramsInfo);
cJSON_AddStringToObject(payload, "time", curTime); cJSON_AddStringToObject(payload, "time", curTime);
cJSON_AddStringToObject(payload, "method", "thing.topo.delete"); cJSON_AddStringToObject(payload, "method", "thing.topo.change_reply");
char *payload11=cJSON_Print(payload); char *payload11=cJSON_Print(payload);
kk_sendData2app(infff,payload11,0); kk_sendData2app(infff,payload11,0);
free(payload11); free(payload11);
...@@ -415,7 +415,7 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf) ...@@ -415,7 +415,7 @@ int kk_topo_delete_handle(cJSON *payload,cJSON *buf)
} }
cJSON *paramStr = cJSON_GetObjectItem(payload, MSG_PARAMS_STR); cJSON *paramStr = cJSON_GetObjectItem(payload, MSG_PARAMS_STR);
cJSON *state = cJSON_GetObjectItem(paramStr, MSG_TOPO_CHANGE_TYPE_STR); cJSON *state = cJSON_GetObjectItem(paramStr, MSG_TOPO_CHANGE_TYPE_STR);
//kk_topo_delete_report(paramStr);//主动报topo delete kk_topo_delete_report(paramStr);//主动报topo delete
if(state != NULL && state->valueint == 1){ if(state != NULL && state->valueint == 1){
cJSON *deviceArray = cJSON_GetObjectItem(paramStr, MSG_TOPO_CHANGE_DEVICES_STR); cJSON *deviceArray = cJSON_GetObjectItem(paramStr, MSG_TOPO_CHANGE_DEVICES_STR);
if(deviceArray == NULL){ if(deviceArray == NULL){
...@@ -1706,7 +1706,7 @@ static int kk_service_getGuardSensors_handle(cJSON *param,cJSON *msgId) ...@@ -1706,7 +1706,7 @@ static int kk_service_getGuardSensors_handle(cJSON *param,cJSON *msgId)
cJSON_AddStringToObject(payload, "msgId", msgId->valuestring); cJSON_AddStringToObject(payload, "msgId", msgId->valuestring);
cJSON_AddStringToObject(payload, "method", "thing.service.getGuardSensors_reply"); cJSON_AddStringToObject(payload, "method", "thing.service.getGuardSensors_reply");
cJSON *paramArray = cJSON_CreateArray(); cJSON *paramArray = cJSON_CreateArray();
num = dm_mgr_get_deviceNum_by_productType("sensor"); num = dm_mgr_get_sensorNum();
pList = (SensorType_t*)malloc(sizeof(SensorType_t)*num); pList = (SensorType_t*)malloc(sizeof(SensorType_t)*num);
if(pList == NULL){ if(pList == NULL){
ERROR_PRINT("MALLOC ERROR!!!"); ERROR_PRINT("MALLOC ERROR!!!");
......
...@@ -237,6 +237,9 @@ static int kk_property_sendtogw_handle(cJSON *payload,cJSON *info_root,char *dev ...@@ -237,6 +237,9 @@ static int kk_property_sendtogw_handle(cJSON *payload,cJSON *info_root,char *dev
cJSON * rootData=cJSON_CreateObject(); cJSON * rootData=cJSON_CreateObject();
dm_mgr_dev_node_t *node = NULL; dm_mgr_dev_node_t *node = NULL;
res = dm_mgr_get_device_by_devicecode(deviceCode,&node); res = dm_mgr_get_device_by_devicecode(deviceCode,&node);
if(res != SUCCESS_RETURN){
return res;
}
char *info_rootS=cJSON_Print(info_root); char *info_rootS=cJSON_Print(info_root);
char *payloadS = cJSON_Print(payload); char *payloadS = cJSON_Print(payload);
cJSON_AddItemToObject(rootData,MSG_INFO_STR, cJSON_Parse(info_rootS)); cJSON_AddItemToObject(rootData,MSG_INFO_STR, cJSON_Parse(info_rootS));
......
...@@ -1158,6 +1158,9 @@ int kk_subDev_getSensors_reply(SensorType_t*list) ...@@ -1158,6 +1158,9 @@ int kk_subDev_getSensors_reply(SensorType_t*list)
ERROR_PRINT("ERROR res:%d\n",rc); ERROR_PRINT("ERROR res:%d\n",rc);
continue; continue;
} }
if(kk_check_TNBDev((const char*)node->productCode) == 1){//过滤环境检测设备
continue;
}
//printf("pDeviceCode:%s\n",pDeviceCode); //printf("pDeviceCode:%s\n",pDeviceCode);
kk_property_db_get_value(pDeviceCode,"SensorType",&currentValue); kk_property_db_get_value(pDeviceCode,"SensorType",&currentValue);
//printf("currentValue:%d\n",currentValue); //printf("currentValue:%d\n",currentValue);
...@@ -1227,8 +1230,7 @@ static int _kk_check_screenDev_exist(const char* sId) ...@@ -1227,8 +1230,7 @@ static int _kk_check_screenDev_exist(const char* sId)
//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){
serialId = (char*)sqlite3_column_text(stmt, DB_SCREEN_SERIALID); serialId = (char*)sqlite3_column_text(stmt, DB_SCREEN_SERIALID);
if(!strcmp(sId,serialId)) if(!strcmp(sId,serialId)){
{
isExist = 1; isExist = 1;
break; break;
} }
......
...@@ -56,6 +56,7 @@ int kk_LockUser_insert_db(char *keyId,char *keyType,char*keyRole,char *keyName,c ...@@ -56,6 +56,7 @@ int kk_LockUser_insert_db(char *keyId,char *keyType,char*keyRole,char *keyName,c
int kk_get_LockUser_list(LockKeyInfo_t *list,const char *deviceCode); int kk_get_LockUser_list(LockKeyInfo_t *list,const char *deviceCode);
int kk_delete_LockUser_info(const char *deviceCode); int kk_delete_LockUser_info(const char *deviceCode);
int kk_delete_LockUser_info_byId(const char *id); int kk_delete_LockUser_info_byId(const char *id);
enum{ enum{
DB_SUB_IDX = 0, DB_SUB_IDX = 0,
DB_SUB_ONLINE, DB_SUB_ONLINE,
......
...@@ -360,17 +360,17 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){ ...@@ -360,17 +360,17 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
if(current_data->data_value.type != KK_TSL_DATA_TYPE_STRUCT){ if(current_data->data_value.type != KK_TSL_DATA_TYPE_STRUCT){
if(current_data->data_value.type == KK_TSL_DATA_TYPE_INT){ if(current_data->data_value.type == KK_TSL_DATA_TYPE_INT){
value = propertyItem_1->valueint; value = propertyItem_1->valueint;
if(value < current_data->data_value.mix ||value > current_data->data_value.max ){ //if(value < current_data->data_value.mix ||value > current_data->data_value.max ){
ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,current_data->data_value.mix,current_data->data_value.max); //ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,current_data->data_value.mix,current_data->data_value.max);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
} }
else if(current_data->data_value.type == KK_TSL_DATA_TYPE_TEXT){ else if(current_data->data_value.type == KK_TSL_DATA_TYPE_TEXT){
if(strlen(propertyItem_1->valuestring) > current_data->data_value.length ){ //if(strlen(propertyItem_1->valuestring) > current_data->data_value.length ){
ERROR_PRINT("ERROR !!!strlen(propertyItem_1->valuestring):%d,current_data->data_value.length:%d\n",strlen(propertyItem_1->valuestring),current_data->data_value.length); //ERROR_PRINT("ERROR !!!strlen(propertyItem_1->valuestring):%d,current_data->data_value.length:%d\n",strlen(propertyItem_1->valuestring),current_data->data_value.length);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
} }
} }
else{ else{
...@@ -387,17 +387,17 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){ ...@@ -387,17 +387,17 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
} }
if(current_data_1->data_value.type == KK_TSL_DATA_TYPE_INT){ if(current_data_1->data_value.type == KK_TSL_DATA_TYPE_INT){
value = propertyItem_2->valueint; value = propertyItem_2->valueint;
if(value < current_data_1->data_value.mix ||value > current_data_1->data_value.max ){ //if(value < current_data_1->data_value.mix ||value > current_data_1->data_value.max ){
ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,current_data_1->data_value.mix,current_data_1->data_value.max); //ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,current_data_1->data_value.mix,current_data_1->data_value.max);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
} }
else if(current_data_1->data_value.type == KK_TSL_DATA_TYPE_TEXT){ else if(current_data_1->data_value.type == KK_TSL_DATA_TYPE_TEXT){
if(strlen(propertyItem_2->valuestring) > current_data_1->data_value.length ){ //if(strlen(propertyItem_2->valuestring) > current_data_1->data_value.length ){
ERROR_PRINT("ERROR !!!strlen(propertyItem_2->valuestring):%d,propertyItem_2->data_value.length:%d\n",strlen(propertyItem_2->valuestring),current_data_1->data_value.length); //ERROR_PRINT("ERROR !!!strlen(propertyItem_2->valuestring):%d,propertyItem_2->data_value.length:%d\n",strlen(propertyItem_2->valuestring),current_data_1->data_value.length);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
} }
} }
...@@ -408,29 +408,29 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){ ...@@ -408,29 +408,29 @@ static int kk_property_set_data_check(cJSON * payload,const char *deviceCode){
} }
else if(property->data_value.type == KK_TSL_DATA_TYPE_INT){ else if(property->data_value.type == KK_TSL_DATA_TYPE_INT){
value = propertyItem->valueint; value = propertyItem->valueint;
if(value < property->data_value.mix ||value > property->data_value.max ){ //if(value < property->data_value.mix ||value > property->data_value.max ){
ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,property->data_value.mix,property->data_value.max); //ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,property->data_value.mix,property->data_value.max);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
INFO_PRINT("-----------------KK_TSL_DATA_TYPE_INT-------------------\n"); INFO_PRINT("-----------------KK_TSL_DATA_TYPE_INT-------------------\n");
cJSON_AddNumberToObject(params,property->identifier,propertyItem->valueint); cJSON_AddNumberToObject(params,property->identifier,propertyItem->valueint);
cJSON_DeleteItemFromObject(params, propertiesbuf[0]); cJSON_DeleteItemFromObject(params, propertiesbuf[0]);
} }
else if(property->data_value.type == KK_TSL_DATA_TYPE_FLOAT || property->data_value.type == KK_TSL_DATA_TYPE_DOUBLE){ else if(property->data_value.type == KK_TSL_DATA_TYPE_FLOAT || property->data_value.type == KK_TSL_DATA_TYPE_DOUBLE){
value = propertyItem->valuedouble; value = propertyItem->valuedouble;
if(value < property->data_value.mix ||value > property->data_value.max ){ //if(value < property->data_value.mix ||value > property->data_value.max ){
ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,property->data_value.mix,property->data_value.max); //ERROR_PRINT("ERROR !!!value:%d,mix:%d,max:%d\n",value,property->data_value.mix,property->data_value.max);
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
INFO_PRINT("-----------------KK_TSL_DATA_TYPE_DOUBLE-------------------\n"); INFO_PRINT("-----------------KK_TSL_DATA_TYPE_DOUBLE-------------------\n");
cJSON_AddNumberToObject(params,property->identifier,propertyItem->valuedouble); cJSON_AddNumberToObject(params,property->identifier,propertyItem->valuedouble);
cJSON_DeleteItemFromObject(params, propertiesbuf[0]); cJSON_DeleteItemFromObject(params, propertiesbuf[0]);
} }
else if(property->data_value.type == KK_TSL_DATA_TYPE_TEXT){ else if(property->data_value.type == KK_TSL_DATA_TYPE_TEXT){
if(strlen(propertyItem->valuestring) > property->data_value.length ){ //if(strlen(propertyItem->valuestring) > property->data_value.length ){
ERROR_PRINT("ERROR !!!strlen(propertyItem->valuestring):%d,property->data_value.length:%d\n",strlen(propertyItem->valuestring),property->data_value.length ); //ERROR_PRINT("ERROR !!!strlen(propertyItem->valuestring):%d,property->data_value.length:%d\n",strlen(propertyItem->valuestring),property->data_value.length );
return INVALID_PARAMETER; //return INVALID_PARAMETER;
} //}
INFO_PRINT("-----------------KK_TSL_DATA_TYPE_TEXT-------------------\n"); INFO_PRINT("-----------------KK_TSL_DATA_TYPE_TEXT-------------------\n");
cJSON_AddStringToObject(params,property->identifier,propertyItem->valuestring); cJSON_AddStringToObject(params,property->identifier,propertyItem->valuestring);
cJSON_DeleteItemFromObject(params, propertiesbuf[0]); cJSON_DeleteItemFromObject(params, propertiesbuf[0]);
...@@ -915,9 +915,7 @@ void mid_cb(void* data, int len){ ...@@ -915,9 +915,7 @@ void mid_cb(void* data, int len){
json=cJSON_Parse(data); json=cJSON_Parse(data);
if (!json) { if (!json) {
ERROR_PRINT("Error before: [%s]\n","cJSON_Parse"); ERROR_PRINT("Error before: [%s]\n","cJSON_Parse");
} }else{
else
{
info_root = cJSON_GetObjectItem(json, MSG_INFO_STR); info_root = cJSON_GetObjectItem(json, MSG_INFO_STR);
if (info_root == NULL){ if (info_root == NULL){
ERROR_PRINT(" params [%s] can't find \n",MSG_INFO_STR); ERROR_PRINT(" params [%s] can't find \n",MSG_INFO_STR);
...@@ -992,38 +990,17 @@ void mid_cb(void* data, int len){ ...@@ -992,38 +990,17 @@ void mid_cb(void* data, int len){
ERROR_PRINT("\n\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n"); ERROR_PRINT("\n\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n");
// //
}else{ }else{
cJSON * rootData=cJSON_CreateObject();
#if 0 char *info_rootS=cJSON_Print(info_root);
if(strcmp(gw_node->productType,KK_DM_AIR_SWITCH_GATEWAY_TYPE) == 0){ char *payloadS = cJSON_Print(payload);
res = _kk_handle_airswitch_property(gw_node->fatherDeviceCode,info_root,payload);//空开epnum 传的是数组,无语 cJSON_AddItemToObject(rootData,MSG_INFO_STR, cJSON_Parse(info_rootS));
if(res != 0){ cJSON_AddItemToObject(rootData,MSG_PAYLOAD_STR, cJSON_Parse(payloadS));
cJSON * rootData=cJSON_CreateObject(); char *pnewout=cJSON_Print(rootData);
char *info_rootS=cJSON_Print(info_root); kk_sendData2gw(pnewout, strlen(pnewout), node->fatherDeviceCode);//send to sub device
char *payloadS = cJSON_Print(payload); cJSON_Delete(rootData);
cJSON_AddItemToObject(rootData,MSG_INFO_STR, cJSON_Parse(info_rootS)); free(info_rootS);
cJSON_AddItemToObject(rootData,MSG_PAYLOAD_STR, cJSON_Parse(payloadS)); free(payloadS);
char *pnewout=cJSON_Print(rootData); free(pnewout);
kk_sendData2gw(pnewout, strlen(pnewout), gw_node->fatherDeviceCode);//send to sub device
cJSON_Delete(rootData);
free(info_rootS);
free(payloadS);
free(pnewout);
}
}else
#endif
{
cJSON * rootData=cJSON_CreateObject();
char *info_rootS=cJSON_Print(info_root);
char *payloadS = cJSON_Print(payload);
cJSON_AddItemToObject(rootData,MSG_INFO_STR, cJSON_Parse(info_rootS));
cJSON_AddItemToObject(rootData,MSG_PAYLOAD_STR, cJSON_Parse(payloadS));
char *pnewout=cJSON_Print(rootData);
kk_sendData2gw(pnewout, strlen(pnewout), node->fatherDeviceCode);//send to sub device
cJSON_Delete(rootData);
free(info_rootS);
free(payloadS);
free(pnewout);
}
} }
} }
else{ else{
...@@ -1059,7 +1036,6 @@ void mid2p_cb(void* data, int len, char* chalMark){ ...@@ -1059,7 +1036,6 @@ void mid2p_cb(void* data, int len, char* chalMark){
ERROR_PRINT("mid2p_cb malloc buf failed "); ERROR_PRINT("mid2p_cb malloc buf failed ");
return; return;
} }
memcpy(buf, data, len); memcpy(buf, data, len);
queue_msg->data = buf; queue_msg->data = buf;
memset(queue_msg->chalMark, 0, sizeof(queue_msg->chalMark)); memset(queue_msg->chalMark, 0, sizeof(queue_msg->chalMark));
......
...@@ -12,156 +12,8 @@ ...@@ -12,156 +12,8 @@
#include "kk_mutictrl_handle.h" #include "kk_mutictrl_handle.h"
#include "kk_scene_handle.h" #include "kk_scene_handle.h"
mutictrl_timestamp_t g_mc_stamp = {0}; mutictrl_timestamp_t g_mc_stamp = {0};
static int _kk_check_virtual_device(char *sceneId)
{
int res = 0;
char *sqlCmd = NULL;
char *pdeviceCode = NULL;
dm_mgr_dev_node_t *node = NULL;
sqlite3_stmt *stmt;
kk_scene_ctx_t *ctx = _kk_scene_get_ctx();
sqlCmd = sqlite3_mprintf("select * from SceneActionInfo WHERE sceneId= '%s' and type = '%s'",sceneId,"action/thing/group");//actice判断设备是否移入待分配
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){
pdeviceCode = (char*)sqlite3_column_text(stmt,DB_SCENEACTION_DEVICECODE);
res = dm_mgr_get_device_by_devicecode((char*)pdeviceCode, &node);
if(strcmp(node->productCode,"5004") == 0){
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
return 1;
}
}
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
return 0;
}
int _kk_virtual_mutictrl_ctrl(char *sceneId,int val,char *deviceCode,int ep)
{
char *sqlCmd = NULL;
sqlite3_stmt *stmt;
char *pdeviceCode = NULL;
int res = 0;
int epNum = 0;
dm_mgr_dev_node_t *node = NULL;
kk_scene_ctx_t *ctx = _kk_scene_get_ctx();
if(_kk_check_virtual_device(sceneId) == 0){
return 0;
}
sqlCmd = sqlite3_mprintf("select * from SceneActionInfo WHERE sceneId= '%s' and type = '%s'",sceneId,"action/thing/group");//actice判断设备是否移入待分配
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){
pdeviceCode = (char*)sqlite3_column_text(stmt,DB_SCENEACTION_DEVICECODE);
epNum = sqlite3_column_int(stmt, DB_SCENEACTION_EPNUM);
if(strcmp(pdeviceCode,deviceCode) == 0 && ep == epNum){
continue;
}
res = dm_mgr_get_device_by_devicecode((char*)pdeviceCode, &node);
cJSON *param = cJSON_CreateObject();
if(kk_is_mutiEp_device(pdeviceCode) == 1){
if(epNum == 1){
cJSON_AddNumberToObject(param, "PowerSwitch_1", val);
}else if(epNum == 2){
cJSON_AddNumberToObject(param, "PowerSwitch_2", val);
}else if(epNum == 3){
cJSON_AddNumberToObject(param, "PowerSwitch_3", val);
}else if(epNum == 4){
cJSON_AddNumberToObject(param, "PowerSwitch_4", val);
}else{
cJSON_Delete(param);
continue;
}
}else{
cJSON_AddNumberToObject(param, "PowerSwitch", val);
}
char *paramstr=cJSON_Print(param);
kk_msg_execute_property_set(node->productCode,node->deviceCode,paramstr,node->fatherDeviceCode);
free(paramstr);
cJSON_Delete(param);
}
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
return SUCCESS_RETURN;
}
void split(char *src,const char *separator,char **dest,int *num);
int kk_virtual_mutictrl_check(const char*deviceCode,cJSON *param)
{
char *sqlCmd = NULL;
sqlite3_stmt *stmt;
char *type = NULL;
char *sceneId = NULL;
int res = 0,idx = 0;
dm_mgr_dev_node_t *node = NULL;
kk_tsl_data_t *property = NULL;
cJSON *propertyItem = NULL;
int value = -1;
char scene_id_bak[64][16] = {0};
int i = 0,count = 0;
int repeat = 0;
int ep = 0,epNum = 0;
char *propertiesbuf[64] = {0};
char propertiesTmp[64] = {0};
int num = 0;
kk_scene_ctx_t *ctx = _kk_scene_get_ctx();
res = dm_mgr_get_device_by_devicecode((char*)deviceCode, &node);
for(idx = 0; idx < node->dev_shadow->property_number; idx++){
property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx);
if(property == NULL || strstr(property->identifier,"PowerSwitch") == NULL){
continue;
}
propertyItem = cJSON_GetObjectItem(param, property->identifier);
if(propertyItem != NULL){
if(strstr(property->identifier,"_") != NULL){
memset(propertiesTmp,0x0,sizeof(propertiesTmp));
memcpy(propertiesTmp,property->identifier,strlen(property->identifier));
split(propertiesTmp,"_",propertiesbuf,&num);
if(num == 2){
ep = atoi(propertiesbuf[1]);
}else{
ep = 1;
}
}else{
ep = 1;
}
value = propertyItem->valueint;
break;
}
}
if(value == -1){
return FAIL_RETURN;
}
sqlCmd = sqlite3_mprintf("select * from SceneActionInfo WHERE deviceCode= '%s' and active = '%d'",deviceCode,1);//actice判断设备是否移入待分配
sqlite3_prepare_v2(ctx->pDb, sqlCmd, strlen(sqlCmd), &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW){
repeat = 0;
type = (char*)sqlite3_column_text(stmt,DB_SCENEACTION_TYPE);
epNum = sqlite3_column_int(stmt, DB_SCENEACTION_EPNUM);
if(strcmp(type,"action/thing/group") != 0 || epNum != ep){
continue;
}
sceneId = (char*)sqlite3_column_text(stmt,DB_SCENEACTION_SCENEID);
for(i = 0; i < count; i++){//检测同个设备在同个场景中设置不同的动作,只需rebuild一次
if(strcmp(scene_id_bak[i],sceneId) == 0){
repeat = 1;
break;
}
}
if(repeat){
continue;
}
_kk_virtual_mutictrl_ctrl(sceneId,value,(char*)deviceCode,ep);
if(count < 64){
memcpy(scene_id_bak[count],sceneId,strlen(sceneId));
count++;
}
}
sqlite3_free(sqlCmd);
sqlite3_finalize(stmt);
return SUCCESS_RETURN;
}
#if 1 #if 1
void split(char *src,const char *separator,char **dest,int *num);
char * g_manualMutiCtrlDev[] = char * g_manualMutiCtrlDev[] =
{ {
(char *){"3062"}, (char *){"3062"},
...@@ -178,9 +30,14 @@ char * g_manualMutiCtrlDev[] = ...@@ -178,9 +30,14 @@ char * g_manualMutiCtrlDev[] =
static int _kk_check_manualMutiCtrlDev(const char* deviceCode) static int _kk_check_manualMutiCtrlDev(const char* deviceCode)
{ {
int i = 0,num = 0; int i = 0,num = 0;
int res = 0;
dm_mgr_dev_node_t *node = NULL; dm_mgr_dev_node_t *node = NULL;
num = sizeof(g_manualMutiCtrlDev)/sizeof(char *); num = sizeof(g_manualMutiCtrlDev)/sizeof(char *);
dm_mgr_get_device_by_devicecode((char*)deviceCode, &node); res = dm_mgr_get_device_by_devicecode((char*)deviceCode, &node);
if(res != SUCCESS_RETURN){
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
return -1;
}
for(i =0; i < num; i++){ for(i =0; i < num; i++){
if(strcmp(node->productCode,g_manualMutiCtrlDev[i]) == 0) if(strcmp(node->productCode,g_manualMutiCtrlDev[i]) == 0)
{ {
...@@ -232,7 +89,15 @@ static int _kk_manual_mutictrl_set(cJSON *param,char *setDeviceCode,int ep,char* ...@@ -232,7 +89,15 @@ static int _kk_manual_mutictrl_set(cJSON *param,char *setDeviceCode,int ep,char*
int offflag = 0; int offflag = 0;
cJSON *propertyItem = NULL; cJSON *propertyItem = NULL;
res = dm_mgr_get_device_by_devicecode((char*)srcDeviceCode, &node); res = dm_mgr_get_device_by_devicecode((char*)srcDeviceCode, &node);
if(res != SUCCESS_RETURN){
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
return -1;
}
res = dm_mgr_get_device_by_devicecode((char*)setDeviceCode, &setDevnode); res = dm_mgr_get_device_by_devicecode((char*)setDeviceCode, &setDevnode);
if(res != SUCCESS_RETURN){
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
return -1;
}
for(idx = 0; idx < node->dev_shadow->property_number; idx++){ for(idx = 0; idx < node->dev_shadow->property_number; idx++){
offflag = 0; offflag = 0;
...@@ -338,6 +203,9 @@ static int _kk_manual_mutictrl_ctrl(char *sceneId,char *deviceCode,int ep,cJSON ...@@ -338,6 +203,9 @@ static int _kk_manual_mutictrl_ctrl(char *sceneId,char *deviceCode,int ep,cJSON
dm_mgr_dev_node_t *node = NULL; dm_mgr_dev_node_t *node = NULL;
kk_scene_ctx_t *ctx = _kk_scene_get_ctx(); kk_scene_ctx_t *ctx = _kk_scene_get_ctx();
isManualDev = _kk_check_manualMutiCtrlDev((const char*)deviceCode);//上报的设备是否是需要手动触发多控设备 isManualDev = _kk_check_manualMutiCtrlDev((const char*)deviceCode);//上报的设备是否是需要手动触发多控设备
if(isManualDev == -1){
return -1;
}
memset(g_mc_stamp.sceneId,0x0,sizeof(g_mc_stamp.sceneId)); memset(g_mc_stamp.sceneId,0x0,sizeof(g_mc_stamp.sceneId));
memcpy(g_mc_stamp.sceneId,sceneId,strlen(sceneId)); memcpy(g_mc_stamp.sceneId,sceneId,strlen(sceneId));
g_mc_stamp.timestamp = HAL_Uptimes(); g_mc_stamp.timestamp = HAL_Uptimes();
...@@ -394,6 +262,10 @@ int kk_manual_mutictrl_execute(const char*deviceCode,cJSON *param) ...@@ -394,6 +262,10 @@ int kk_manual_mutictrl_execute(const char*deviceCode,cJSON *param)
kk_scene_ctx_t *ctx = _kk_scene_get_ctx(); kk_scene_ctx_t *ctx = _kk_scene_get_ctx();
res = dm_mgr_get_device_by_devicecode((char*)deviceCode, &node); res = dm_mgr_get_device_by_devicecode((char*)deviceCode, &node);
if(res != SUCCESS_RETURN){
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
return -1;
}
for(idx = 0; idx < node->dev_shadow->property_number; idx++){//解析当前设备上报的epnum for(idx = 0; idx < node->dev_shadow->property_number; idx++){//解析当前设备上报的epnum
property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx); property = (kk_tsl_data_t *)(node->dev_shadow->properties + idx);
propertyItem = cJSON_GetObjectItem(param, property->identifier); propertyItem = cJSON_GetObjectItem(param, property->identifier);
...@@ -431,10 +303,10 @@ int kk_manual_mutictrl_execute(const char*deviceCode,cJSON *param) ...@@ -431,10 +303,10 @@ int kk_manual_mutictrl_execute(const char*deviceCode,cJSON *param)
INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__); INFO_PRINT("[%s][%d]\n",__FUNCTION__,__LINE__);
return -1; return -1;
} }
if(strcmp(sceneId,g_mc_stamp.sceneId) == 0 && HAL_Uptimes() - g_mc_stamp.timestamp <= 2 ){ //if(strcmp(sceneId,g_mc_stamp.sceneId) == 0 && HAL_Uptimes() - g_mc_stamp.timestamp <= 2 ){
INFO_PRINT("muti ctrl alread exexute !!!\n"); //INFO_PRINT("muti ctrl alread exexute !!!\n");
//return -1; //return -1;
} //}
INFO_PRINT("sceneId:%s\n",sceneId); INFO_PRINT("sceneId:%s\n",sceneId);
_kk_manual_mutictrl_ctrl(sceneId,(char*)deviceCode,ep,param,isMutiEp); _kk_manual_mutictrl_ctrl(sceneId,(char*)deviceCode,ep,param,isMutiEp);
......
...@@ -99,21 +99,7 @@ ...@@ -99,21 +99,7 @@
], ],
"events": [ "events": [
{ {
"outputData": [ "outputData": [],
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"accessMode": "r",
"required": true,
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
}
],
"identifier": "sosAlarm", "identifier": "sosAlarm",
"method": "thing.event.sosAlarm.post", "method": "thing.event.sosAlarm.post",
"name": "sosAlarm", "name": "sosAlarm",
......
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3016.json", "schema": "https://iot-ap.ikonke.com/model/product_3016.json",
"productType": "sensor", "productType": "sensor",
"version": "1.0", "version": "1.2",
"profile": { "profile": {
"heartbeat": "1200", "heartbeat": "1200",
"productCode": "3016", "productCode": "3016",
"productName": "铂金系列.紧急呼叫按钮Z3S(KONKE)", "productName": "铂金系列.紧急呼叫按钮Z3S(KONKE)",
"sleepTime": "30000" "sleepTime": "30000"
}, },
"services": [ "services": [
{ {
"outputData": [ "outputData": [
{
"identifier": "SosState", ],
"name": "紧急按钮告警状态", "identifier": "set",
"dataType": { "inputData": [
"type": "enum", {
"specs": { "identifier": "SosState",
"0": "没有报警", "name": "紧急按钮告警状态",
"1": "报警" "dataType": {
} "type": "enum",
} "specs": {
}, "0": "没有报警",
{ "1": "报警"
"identifier": "Battery", }
"name": "电池电量", }
"dataType": { }
"type": "double", ],
"specs": { "method": "thing.service.property.set",
"min": "0", "name": "set",
"max": "100", "required": true,
"unit": "%", "callType": "async",
"unitName": "百分比", "desc": "属性设置"
"step": "0.01" },
} {
} "outputData": [
} {
], "identifier": "SosState",
"identifier": "get", "name": "紧急按钮告警状态",
"inputData": [ "dataType": {
"Battery" "type": "enum",
], "specs": {
"method": "thing.service.property.get", "0": "没有报警",
"name": "get", "1": "报警"
"required": true, }
"callType": "async", }
"desc": "属性获取" },
} {
], "identifier": "Battery",
"properties": [ "name": "电池电量",
{ "dataType": {
"identifier": "SosState", "type": "double",
"name": "紧急按钮告警状态", "specs": {
"accessMode": "r", "min": "0",
"required": true, "max": "100",
"dataType": { "unit": "%",
"type": "enum", "unitName": "百分比",
"specs": { "step": "0.01"
"0": "没有报警", }
"1": "报警" }
} }
} ],
}, "identifier": "get",
{ "inputData": [
"identifier": "Battery", "SosState",
"name": "电池电量", "Battery"
"accessMode": "r", ],
"required": false, "method": "thing.service.property.get",
"dataType": { "name": "get",
"type": "double", "required": true,
"specs": { "callType": "async",
"min": "0", "desc": "属性获取"
"max": "100", }
"unit": "%", ],
"unitName": "百分比", "properties": [
"step": "0.01" {
} "identifier": "SosState",
} "name": "紧急按钮告警状态",
}, "accessMode": "r",
{ "required": true,
"identifier": "SensorType", "dataType": {
"name": "安防等级", "type": "enum",
"accessMode": "rw", "specs": {
"required": true, "0": "没有报警",
"dataType": { "1": "报警"
"type": "enum", }
"specs": { }
"0": "在家安防", },
"1": "室外安防", {
"2": "24小时警戒", "identifier": "Battery",
"3": "无警戒" "name": "电池电量",
} "accessMode": "r",
} "required": true,
} "dataType": {
], "type": "double",
"events": [ "specs": {
{ "min": "0",
"outputData": [ "max": "100",
{ "unit": "%",
"identifier": "Battery", "unitName": "百分比",
"name": "电池电量", "step": "0.01"
"dataType": { }
"type": "double", }
"specs": { }
"min": "0", ],
"max": "100", "events": [
"unit": "%", {
"unitName": "百分比", "outputData": [
"step": "0.01" {
} "identifier": "Battery",
} "name": "电池电量",
} "dataType": {
], "type": "double",
"identifier": "property", "specs": {
"method": "thing.event.property.post", "min": "0",
"name": "property", "max": "100",
"type": "info", "unit": "%",
"required": true, "unitName": "百分比",
"desc": "属性上报" "step": "0.01"
}, }
{ }
"outputData": [ }
{ ],
"identifier": "SosState", "identifier": "property",
"name": "紧急按钮告警状态", "method": "thing.event.property.post",
"accessMode": "r", "name": "property",
"required": true, "type": "info",
"dataType": { "required": true,
"type": "enum", "desc": "属性上报"
"specs": { },
"0": "没有报警", {
"1": "报警" "outputData": [],
} "identifier": "sosAlarm",
} "method": "thing.event.sosAlarm.post",
} "name": "sosAlarm",
], "type": "alarm",
"identifier": "sosAlarm", "required": true,
"method": "thing.event.sosAlarm.post", "desc": "紧急按钮告警"
"name": "sosAlarm", },
"type": "alarm", {
"required": true, "outputData": [],
"desc": "紧急按钮告警" "identifier": "clearSosAlarm",
}, "method": "thing.event.clearSosAlarm.post",
{ "name": "clearSosAlarm",
"outputData": [ "type": "alarm",
{ "required": true,
"identifier": "Battery", "desc": "紧急按钮告警解除"
"name": "电池电量", },
"dataType": { {
"type": "double", "outputData": [
"specs": { {
"min": "0", "identifier": "Battery",
"max": "100", "name": "电池电量",
"unit": "%", "dataType": {
"unitName": "百分比", "type": "double",
"step": "0.01" "specs": {
} "min": "0",
} "max": "100",
} "unit": "%",
], "unitName": "百分比",
"identifier": "BatteryAlarm", "step": "0.01"
"method": "thing.event.BatteryAlarm.post", }
"name": "BatteryAlarm", }
"type": "alert", }
"required": true, ],
"desc": "低电量告警" "identifier": "BatteryAlarm",
} "method": "thing.event.BatteryAlarm.post",
] "name": "BatteryAlarm",
} "type": "alert",
"required": true,
"desc": "低电量告警"
}
]
}
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3052.json", "schema": "https://iot-ap.ikonke.com/model/product_3052.json",
"productType": "sensor", "productType": "sensor",
"version": "1.1", "version": "1.2",
"profile": { "profile": {
"heartbeat": "1200", "heartbeat": "1200",
"productCode": "3052", "productCode": "3052",
"productName": "邦德系列.环境传感器(KONKE)", "productName": "邦德系列.环境传感器(KONKE)",
"sleepTime": "1200" "sleepTime": "1200"
}, },
"services": [ "services": [
{ {
"outputData": [ "outputData": [
{ {
"identifier": "Temperature", "identifier": "Temperature",
"name": "当前温度", "name": "当前温度",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "-40", "min": "-40",
"max": "100", "max": "100",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Humidity", "identifier": "Humidity",
"name": "当前湿度", "name": "当前湿度",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "100", "max": "100",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Illuminance", "identifier": "Illuminance",
"name": "当前光照度检测值", "name": "当前光照度检测值",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "5000", "max": "5000",
"unit": "Lux", "unit": "Lux",
"unitName": "照度", "unitName": "照度",
"step": "1.0" "step": "1.0"
} }
} }
}, },
{ {
"identifier": "IlluminanceLevel", "identifier": "IlluminanceLevel",
"name": "当前光照度等级", "name": "当前光照度等级",
"dataType": { "dataType": {
"type": "enum", "type": "enum",
"specs": { "specs": {
"0": "黑夜", "1": "黑夜",
"1": "昏暗", "2": "昏暗",
"2": "正常", "3": "正常",
"3": "明亮", "4": "明亮",
"4": "刺眼" "5": "刺眼"
} }
} }
}, },
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0.0", "min": "0.0",
"max": "100.0", "max": "100.0",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
} }
], ],
"identifier": "get", "identifier": "get",
"inputData": [ "inputData": [
"Temperature", "Temperature",
"Humidity", "Humidity",
"Illuminance", "Illuminance",
"IlluminanceLevel", "IlluminanceLevel",
"Battery" "Battery"
], ],
"method": "thing.service.property.get", "method": "thing.service.property.get",
"name": "get", "name": "get",
"required": true, "required": true,
"callType": "async", "callType": "async",
"desc": "属性获取" "desc": "属性获取"
} }
], ],
"properties": [ "properties": [
{ {
"identifier": "Temperature", "identifier": "Temperature",
"name": "当前温度", "name": "当前温度",
"accessMode": "r", "accessMode": "r",
"required": false, "required": false,
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "-40", "min": "-40",
"max": "100", "max": "100",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Humidity", "identifier": "Humidity",
"name": "当前湿度", "name": "当前湿度",
"accessMode": "r", "accessMode": "r",
"required": false, "required": false,
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "100", "max": "100",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Illuminance", "identifier": "Illuminance",
"name": "当前光照度检测值", "name": "当前光照度检测值",
"accessMode": "r", "accessMode": "r",
"required": true, "required": true,
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "65535", "max": "65535",
"unit": "Lux", "unit": "Lux",
"unitName": "照度", "unitName": "照度",
"step": "1.0" "step": "1.0"
} }
} }
}, },
{ {
"identifier": "IlluminanceLevel", "identifier": "IlluminanceLevel",
"name": "当前光照度等级", "name": "当前光照度等级",
"accessMode": "r", "accessMode": "r",
"required": true, "required": true,
"dataType": { "dataType": {
"type": "enum", "type": "enum",
"specs": { "specs": {
"0": "黑夜", "1": "黑夜",
"1": "昏暗", "2": "昏暗",
"2": "正常", "3": "正常",
"3": "明亮", "4": "明亮",
"4": "刺眼" "5": "刺眼"
} }
} }
}, },
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
"accessMode": "r", "accessMode": "r",
"required": true, "required": true,
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0.0", "min": "0.0",
"max": "100.0", "max": "100.0",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "SensorType", "identifier": "SensorType",
"name": "安防等级", "name": "安防等级",
"accessMode": "rw", "accessMode": "rw",
"required": true, "required": true,
"dataType": { "dataType": {
"type": "enum", "type": "enum",
"specs": { "specs": {
"0": "在家安防", "0": "在家安防",
"1": "室外安防", "1": "室外安防",
"2": "24小时警戒", "2": "24小时警戒",
"3": "无警戒" "3": "无警戒"
} }
} }
} }
], ],
"events": [ "events": [
{ {
"outputData": [ "outputData": [
{ {
"identifier": "Temperature", "identifier": "Temperature",
"name": "当前温度", "name": "当前温度",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "-40", "min": "-40",
"max": "100", "max": "100",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Humidity", "identifier": "Humidity",
"name": "当前湿度", "name": "当前湿度",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "100", "max": "100",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
}, },
{ {
"identifier": "Illuminance", "identifier": "Illuminance",
"name": "当前光照度检测值", "name": "当前光照度检测值",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0", "min": "0",
"max": "65535", "max": "65535",
"unit": "Lux", "unit": "Lux",
"unitName": "照度", "unitName": "照度",
"step": "1.0" "step": "1.0"
} }
} }
}, },
{ {
"identifier": "IlluminanceLevel", "identifier": "IlluminanceLevel",
"name": "当前光照度等级", "name": "当前光照度等级",
"dataType": { "dataType": {
"type": "enum", "type": "enum",
"specs": { "specs": {
"0": "黑夜", "1": "黑夜",
"1": "昏暗", "2": "昏暗",
"2": "正常", "3": "正常",
"3": "明亮", "4": "明亮",
"4": "刺眼" "5": "刺眼"
} }
} }
}, },
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0.0", "min": "0.0",
"max": "100.0", "max": "100.0",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
} }
], ],
"identifier": "property", "identifier": "property",
"method": "thing.event.property.post", "method": "thing.event.property.post",
"name": "property", "name": "property",
"type": "info", "type": "info",
"required": true, "required": true,
"desc": "属性上报" "desc": "属性上报"
}, },
{ {
"outputData": [ "outputData": [
{ {
"identifier": "Battery", "identifier": "Battery",
"name": "电池电量", "name": "电池电量",
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "0.0", "min": "0.0",
"max": "100.0", "max": "100.0",
"unit": "%", "unit": "%",
"unitName": "百分比", "unitName": "百分比",
"step": "0.01" "step": "0.01"
} }
} }
} }
], ],
"identifier": "BatteryAlarm", "identifier": "BatteryAlarm",
"method": "thing.event.BatteryAlarm.post", "method": "thing.event.BatteryAlarm.post",
"name": "BatteryAlarm", "name": "BatteryAlarm",
"type": "alert", "type": "alert",
"required": true, "required": true,
"desc": "低电量告警" "desc": "低电量告警"
} }
] ]
} }
\ No newline at end of file
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3054.json", "schema": "https://iot-ap.ikonke.com/model/product_3054.json",
"productType": "sensor", "productType": "sensor",
"version": "1.1", "version": "1.2",
"profile": { "profile": {
"heartbeat": "1200", "heartbeat": "1200",
"productCode": "3054", "productCode": "3054",
"productName": "邦德系列.SOS按钮(KONKE)", "productName": "邦德系列.SOS按钮(KONKE)",
"sleepTime": "30000" "sleepTime": "30000"
}, },
"services": [ "services": [
{ {
"outputData": [ "outputData": [
{
"identifier": "SosState", ],
"name": "紧急按钮告警状态", "identifier": "set",
"dataType": { "inputData": [
"type": "enum", {
"specs": { "identifier": "SosState",
"0": "没有报警", "name": "紧急按钮告警状态",
"1": "报警" "dataType": {
} "type": "enum",
} "specs": {
}, "0": "没有报警",
{ "1": "报警"
"identifier": "Battery", }
"name": "电池电量", }
"dataType": { }
"type": "double", ],
"specs": { "method": "thing.service.property.set",
"min": "0", "name": "set",
"max": "100", "required": true,
"unit": "%", "callType": "async",
"unitName": "百分比", "desc": "属性设置"
"step": "0.01" },
} {
} "outputData": [
} {
], "identifier": "SosState",
"identifier": "get", "name": "紧急按钮告警状态",
"inputData": [ "dataType": {
"Battery" "type": "enum",
], "specs": {
"method": "thing.service.property.get", "0": "没有报警",
"name": "get", "1": "报警"
"required": true, }
"callType": "async", }
"desc": "属性获取" },
} {
], "identifier": "Battery",
"properties": [ "name": "电池电量",
{ "dataType": {
"identifier": "SosState", "type": "double",
"name": "紧急按钮告警状态", "specs": {
"accessMode": "r", "min": "0",
"required": true, "max": "100",
"dataType": { "unit": "%",
"type": "enum", "unitName": "百分比",
"specs": { "step": "0.01"
"0": "没有报警", }
"1": "报警" }
} }
} ],
}, "identifier": "get",
{ "inputData": [
"identifier": "Battery", "SosState",
"name": "电池电量", "Battery"
"accessMode": "r", ],
"required": false, "method": "thing.service.property.get",
"dataType": { "name": "get",
"type": "double", "required": true,
"specs": { "callType": "async",
"min": "0", "desc": "属性获取"
"max": "100", }
"unit": "%", ],
"unitName": "百分比", "properties": [
"step": "0.01" {
} "identifier": "SosState",
} "name": "紧急按钮告警状态",
}, "accessMode": "r",
{ "required": true,
"identifier": "SensorType", "dataType": {
"name": "安防等级", "type": "enum",
"accessMode": "rw", "specs": {
"required": true, "0": "没有报警",
"dataType": { "1": "报警"
"type": "enum", }
"specs": { }
"0": "在家安防", },
"1": "室外安防", {
"2": "24小时警戒", "identifier": "Battery",
"3": "无警戒" "name": "电池电量",
} "accessMode": "r",
} "required": false,
} "dataType": {
], "type": "double",
"events": [ "specs": {
{ "min": "0",
"outputData": [ "max": "100",
{ "unit": "%",
"identifier": "Battery", "unitName": "百分比",
"name": "电池电量", "step": "0.01"
"dataType": { }
"type": "double", }
"specs": { },
"min": "0", {
"max": "100", "identifier": "SensorType",
"unit": "%", "name": "安防等级",
"unitName": "百分比", "accessMode": "rw",
"step": "0.01" "required": true,
} "dataType": {
} "type": "enum",
} "specs": {
], "0": "在家安防",
"identifier": "property", "1": "室外安防",
"method": "thing.event.property.post", "2": "24小时警戒",
"name": "property", "3": "无警戒"
"type": "info", }
"required": true, }
"desc": "属性上报" }
}, ],
{ "events": [
"outputData": [ {
{ "outputData": [
"identifier": "SosState", {
"name": "紧急按钮告警状态", "identifier": "Battery",
"accessMode": "r", "name": "电池电量",
"required": true, "dataType": {
"dataType": { "type": "double",
"type": "enum", "specs": {
"specs": { "min": "0",
"0": "没有报警", "max": "100",
"1": "报警" "unit": "%",
} "unitName": "百分比",
} "step": "0.01"
} }
], }
"identifier": "sosAlarm", }
"method": "thing.event.sosAlarm.post", ],
"name": "sosAlarm", "identifier": "property",
"type": "alarm", "method": "thing.event.property.post",
"required": true, "name": "property",
"desc": "紧急按钮告警" "type": "info",
}, "required": true,
{ "desc": "属性上报"
"outputData": [ },
{ {
"identifier": "Battery", "outputData": [],
"name": "电池电量", "identifier": "sosAlarm",
"dataType": { "method": "thing.event.sosAlarm.post",
"type": "double", "name": "sosAlarm",
"specs": { "type": "alarm",
"min": "0", "required": true,
"max": "100", "desc": "紧急按钮告警"
"unit": "%", },
"unitName": "百分比", {
"step": "0.01" "outputData": [],
} "identifier": "clearSosAlarm",
} "method": "thing.event.clearSosAlarm.post",
} "name": "clearSosAlarm",
], "type": "alarm",
"identifier": "BatteryAlarm", "required": true,
"method": "thing.event.BatteryAlarm.post", "desc": "紧急按钮告警解除"
"name": "BatteryAlarm", },
"type": "alert", {
"required": true, "outputData": [
"desc": "低电量告警" {
} "identifier": "Battery",
] "name": "电池电量",
"dataType": {
"type": "double",
"specs": {
"min": "0",
"max": "100",
"unit": "%",
"unitName": "百分比",
"step": "0.01"
}
}
}
],
"identifier": "BatteryAlarm",
"method": "thing.event.BatteryAlarm.post",
"name": "BatteryAlarm",
"type": "alert",
"required": true,
"desc": "低电量告警"
}
]
} }
\ No newline at end of file
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "20", "min": "16",
"max": "30", "max": "30",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
...@@ -499,7 +499,7 @@ ...@@ -499,7 +499,7 @@
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "20", "min": "16",
"max": "30", "max": "30",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
...@@ -850,7 +850,7 @@ ...@@ -850,7 +850,7 @@
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "20", "min": "16",
"max": "30", "max": "30",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
...@@ -1221,7 +1221,7 @@ ...@@ -1221,7 +1221,7 @@
"dataType": { "dataType": {
"type": "double", "type": "double",
"specs": { "specs": {
"min": "20", "min": "16",
"max": "30", "max": "30",
"unit": "°C", "unit": "°C",
"unitName": "摄氏度", "unitName": "摄氏度",
......
{ {
"schema": "https://iot-ap.ikonke.com/model/product_3124.json", "schema": "https://iot-ap.ikonke.com/model/product_3124.json",
"productType": "sensor", "productType": "sensor",
"version": "1.1", "version": "1.2",
"profile": { "profile": {
"heartbeat": "300", "heartbeat": "300",
"productCode": "3124", "productCode": "3124",
"productName": "肖邦系列.零火线SOS紧急呼叫面板Z3S(KONKE)" "productName": "肖邦系列.零火线SOS紧急呼叫面板Z3S(KONKE)"
}, },
"services": [ "services": [
{
"outputData": [
],
"identifier": "set",
"inputData": [
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
}
],
"method": "thing.service.property.set",
"name": "set",
"required": true,
"callType": "async",
"desc": "属性设置"
},
{ {
"outputData": [ "outputData": [
{ {
...@@ -75,27 +99,22 @@ ...@@ -75,27 +99,22 @@
], ],
"events": [ "events": [
{ {
"outputData": [ "outputData": [],
{
"identifier": "SosState",
"name": "紧急按钮告警状态",
"accessMode": "r",
"required": true,
"dataType": {
"type": "enum",
"specs": {
"0": "没有报警",
"1": "报警"
}
}
}
],
"identifier": "sosAlarm", "identifier": "sosAlarm",
"method": "thing.event.sosAlarm.post", "method": "thing.event.sosAlarm.post",
"name": "sosAlarm", "name": "sosAlarm",
"type": "alarm", "type": "alarm",
"required": true, "required": true,
"desc": "紧急按钮告警" "desc": "紧急按钮告警"
},
{
"outputData": [],
"identifier": "clearSosAlarm",
"method": "thing.event.clearSosAlarm.post",
"name": "clearSosAlarm",
"type": "alarm",
"required": true,
"desc": "紧急按钮告警解除"
} }
] ]
} }
\ No newline at end of file
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