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

【修改内容】恢复子设备删除功能

【提交人】陈伟灿
parent e6ffee28
......@@ -5,6 +5,44 @@
//emberAfAppPrintln("[tsl report:Gloabl] OnOff~~~~~~~~~");
//cJSON *rpc_Control(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
cJSON *kk_topo_change_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac)
{
int res = 0;
cJSON *changeTypeStr = NULL;
uint8_t eui64[EUI64_SIZE];
uint16_t nodeId = 0;
UTIL_LOG_INFO("\n********************kk_topo_change_operation********************\n");
if(params == NULL){
set_json_error_type(ctx,JRPC_INVALID_PARAMS,MSG_INVALID_PARAMS);
goto error_return;
}else{
changeTypeStr = rpc_cJSON_GetObjectItem(params, MSG_TOPO_CHANGE_TYPE_STR);
if(changeTypeStr != NULL && changeTypeStr->valueint == 1){
cJSON *deviceArray = rpc_cJSON_GetObjectItem(params, MSG_TOPO_CHANGE_DEVICES_STR);
if(deviceArray == NULL){
goto error_return;
}
cJSON * item = deviceArray->child;
while(item != NULL){
char *deviceCode = rpc_cJSON_GetObjectItem(item,MSG_DEVICE_CODE_STR)->valuestring;
rpc_get_mac(deviceCode,eui64);
nodeId = emberAfDeviceTableGetNodeIdFromEui64(eui64);
kk_zdo_leave_request(nodeId,true,false);
item = item->next;
}
}
}
return rpc_cJSON_CreateNumber(res);
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;
......
......@@ -2,6 +2,8 @@
#define __KK_TSL_PROPERTY_SET_H
#include "kk_test.h"
cJSON *kk_topo_change_operation(jrpc_context * ctx, cJSON *params, cJSON *id,cJSON *mac);
cJSON *kk_tsl_property_operation(jrpc_context * ctx, cJSON * params, cJSON *id,cJSON *mac);
......
......@@ -16,8 +16,9 @@
#define KK_REPORT_DEVICE_JOINED_TYPE "/thing/topo/add"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_DEVICE_LEFT_TYPE "/thing/topo/delete"
#define KK_REPORT_ATTRIBUTE_TYPE "/thing/event/property/post"
#define KK_DEVICE_TOPO_CHANGE_TYPE "/thing/topo/change"
#define KK_IPC_VERSION "1.0"
#define KK_REPORT_DEVICE_JOINED_METHOD "thing.topo.add"
......@@ -30,6 +31,8 @@
#define TEST_PRODUCT_CODE "24"
#define GW2CCU_PROTOCOL "tcp"
#define MSG_TOPO_CHANGE_TYPE_STR "changeType"
#define MSG_TOPO_CHANGE_DEVICES_STR "devices"
......@@ -47,7 +50,8 @@ int kk_sendData2CCU(char* data, int len);
#define RPC_KK_TEST_FUNCTION_TABLE \
{(rpc_function*)kk_tsl_property_operation,"/thing/service/property/set"},\
{(rpc_function*)kk_tsl_property_operation,KK_READ_ATTRIBUTE_METHOD}
{(rpc_function*)kk_tsl_property_operation,KK_READ_ATTRIBUTE_METHOD},\
{(rpc_function*)kk_topo_change_operation,KK_DEVICE_TOPO_CHANGE_TYPE}
......
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