Commit 807f44b4 authored by chen.weican's avatar chen.weican

【修改内容】z3端支持二级identify的数据解析和上报

【提交人】陈伟灿
parent 9957d53d
......@@ -40,11 +40,32 @@ cJSON *kk_topo_change_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJS
error_return:
return rpc_cJSON_CreateNull();
}
int kk_tsl_utils_memtok(_IN_ char *input, _IN_ char delimiter, _IN_ int index, _OU_ int *offset)
{
int item_index = 0;
int count = 0;
int input_len = 0;
if (input == NULL || offset == NULL) {
return -1;
}
input_len = strlen(input);
for (item_index = 0; item_index < input_len; item_index++) {
if (input[item_index] == delimiter && (item_index + 1) < input_len) {
count++;
if (count == index) {
*offset = item_index;
return 0;
}
}
}
return -1;
}
cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
{
sub_dev_node_t *node = NULL;
int res = 0;
int res = 0,rev = 0;
rpc_nwk_info_s info;
EmberStatus status;
int index = 0;
......@@ -52,8 +73,11 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
int num;
uint8_t findFlag = 0xff;
cJSON *propertyItem = NULL;
cJSON *propertyItem1 = NULL;
EmberEUI64 eui64;
EmberNodeId nodeId = EMBER_AF_PLUGIN_DEVICE_TABLE_NULL_NODE_ID;
int startIdx = 0;
char tmp_Identity[64] = {0};
UTIL_LOG_INFO("\n********************kk tsl property operation********************\n");
if(params == NULL){
......@@ -69,19 +93,53 @@ cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJ
num = kk_get_tsl_num();
for(index = 0; index < num; index++){
propertyItem = rpc_cJSON_GetObjectItem(params, g_tsl_zigbee_map[index].Identity);
if(propertyItem != NULL){
findFlag = 1;
break;
rev = kk_tsl_utils_memtok(g_tsl_zigbee_map[index].Identity,".",1,&startIdx);
if(!rev){
memset(tmp_Identity,0x0,sizeof(tmp_Identity));
memcpy(tmp_Identity, g_tsl_zigbee_map[index].Identity, startIdx);
propertyItem1 = rpc_cJSON_GetObjectItem(params,tmp_Identity);
if(propertyItem1 != NULL){
propertyItem = rpc_cJSON_GetObjectItem(propertyItem1,g_tsl_zigbee_map[index].Identity+startIdx+1);
if(propertyItem != NULL){
findFlag = 1;
break;
}
}
}
else{
propertyItem = rpc_cJSON_GetObjectItem(params, g_tsl_zigbee_map[index].Identity);
if(propertyItem != NULL){
findFlag = 1;
break;
}
}
}
if(findFlag==0xff){
num = kk_get_tsl_glb_num();
for(index = 0; index < num; index++){
propertyItem = rpc_cJSON_GetObjectItem(params, g_tsl_zigbee_map_glb[index].map.Identity);
if(propertyItem != NULL){
findFlag = 2;
break;
rev = kk_tsl_utils_memtok(g_tsl_zigbee_map_glb[index].map.Identity,".",1,&startIdx);
if(!rev){
memset(tmp_Identity,0x0,sizeof(tmp_Identity));
memcpy(tmp_Identity, g_tsl_zigbee_map_glb[index].map.Identity, startIdx);
propertyItem1 = rpc_cJSON_GetObjectItem(params,tmp_Identity);
if(propertyItem1 != NULL){
propertyItem = rpc_cJSON_GetObjectItem(propertyItem1,g_tsl_zigbee_map_glb[index].map.Identity+startIdx+1);
if(propertyItem != NULL){
findFlag = 2;
break;
}
}
}
else{
propertyItem = rpc_cJSON_GetObjectItem(params, g_tsl_zigbee_map_glb[index].map.Identity);
if(propertyItem != NULL){
findFlag = 2;
break;
}
}
}
}
......
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