Commit 96e4d3ac authored by whmaizmy's avatar whmaizmy

【修改内容】修改属性上报导致死机的问题

【提交人】陈伟灿
parent fc689d49
...@@ -180,9 +180,13 @@ int dm_mgr_init(void) ...@@ -180,9 +180,13 @@ int dm_mgr_init(void)
/*----------to do************************ */ /*----------to do************************ */
//HAL_GetProductKey(product_key); //HAL_GetProductKey(product_key);
//HAL_GetDeviceName(device_name); //HAL_GetDeviceName(device_name);
memset(product_key,0x0,sizeof(product_key));
memset(device_name,0x0,sizeof(device_name));
memcpy(product_key,"a1OYuSBt23u",strlen("a1OYuSBt23u"));
memcpy(device_name,"aIqEbWno8yDdsjCX15iq",strlen("aIqEbWno8yDdsjCX15iq"));
//_dm_mgr_legacy_thing_created(IOTX_DM_LOCAL_NODE_DEVID); //_dm_mgr_legacy_thing_created(IOTX_DM_LOCAL_NODE_DEVID);
res = dm_mgr_device_create(KK_DM_DEVICE_SUBDEV,product_key,product_key,device_secret,&devId); res = dm_mgr_device_create(KK_DM_DEVICE_SUBDEV,product_key,device_name,device_secret,&devId);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
goto ERROR; goto ERROR;
} }
......
...@@ -28,7 +28,7 @@ void mid_cb(void* data, int len){ ...@@ -28,7 +28,7 @@ void mid_cb(void* data, int len){
{ {
topic = cJSON_GetObjectItem(json, "topic"); topic = cJSON_GetObjectItem(json, "topic");
payload = cJSON_GetObjectItem(json, "payload"); payload = cJSON_GetObjectItem(json, "payload");
kk_tsl_service_property_set(topic->valuestring, payload->valuestring); kk_tsl_service_property_set(topic->valuestring, payload->valuestring,strlen(payload->valuestring),NULL);
} }
kk_ipc_send(IPC_MID2PLAT, data, len); kk_ipc_send(IPC_MID2PLAT, data, len);
} }
......
...@@ -716,6 +716,9 @@ int kk_tsl_service_property_set(const char *topic, const char *payload, unsigned ...@@ -716,6 +716,9 @@ int kk_tsl_service_property_set(const char *topic, const char *payload, unsigned
dm_msg_response(&request, &response, "{}", strlen("{}"), NULL); dm_msg_response(&request, &response, "{}", strlen("{}"), NULL);
kk_tsl_post_property(devid,NULL);
return SUCCESS_RETURN; return SUCCESS_RETURN;
} }
...@@ -809,7 +812,8 @@ static int _kk_tsl_post_property_add(_IN_ void *handle, _IN_ char *identifier, _ ...@@ -809,7 +812,8 @@ static int _kk_tsl_post_property_add(_IN_ void *handle, _IN_ char *identifier, _
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
return FAIL_RETURN; return FAIL_RETURN;
} }
res = kk_tsl_assemble_property(dapi_property->devid, identifier, identifier_len, dapi_property->lite);
res = kk_tsl_assemble_property(node->dev_shadow, identifier, identifier_len, dapi_property->lite);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
return FAIL_RETURN; return FAIL_RETURN;
} }
...@@ -899,12 +903,12 @@ int kk_tsl_post_property_end(_IN_ void **handle) ...@@ -899,12 +903,12 @@ int kk_tsl_post_property_end(_IN_ void **handle)
int kk_tsl_post_property(int devId, const char *property_identifier) int kk_tsl_post_property(int devId, const char *property_identifier)
{ {
int res = 0, devid = 0, msgid = 0, property_identifier_len = 0, post_property_reply = 0; int res = 0, msgid = 0, property_identifier_len = 0, post_property_reply = 0;
void *property_handle = NULL; void *property_handle = NULL;
kk_tsl_api_ctx_t *kk_tsl_api_ctx = _kk_tsl_api_get_ctx(); kk_tsl_api_ctx_t *kk_tsl_api_ctx = _kk_tsl_api_get_ctx();
_kk_tsl_api_lock(); _kk_tsl_api_lock();
res = kk_tsl_post_property_start(devid, &property_handle); res = kk_tsl_post_property_start(devId, &property_handle);
if (res != SUCCESS_RETURN) { if (res != SUCCESS_RETURN) {
_kk_tsl_api_lock(); _kk_tsl_api_lock();
return FAIL_RETURN; return FAIL_RETURN;
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#define KK_TSL_KEY_ITEM "item" #define KK_TSL_KEY_ITEM "item"
#define KK_MSG_KEY_DELIMITER '.' #define KK_MSG_KEY_DELIMITER '.'
#define KK_URI_SERVICE_DELIMITER '/' #define KK_URI_SERVICE_DELIMITER '/'
#define KK_URI_OFFSET 1 #define KK_URI_OFFSET 0
//Special Service And Event //Special Service And Event
#define KK_TSL_SPECIAL_SERVICE_SET_IDENTIFIER "set" #define KK_TSL_SPECIAL_SERVICE_SET_IDENTIFIER "set"
......
...@@ -1479,6 +1479,7 @@ int kk_tsl_assemble_property(_IN_ kk_tsl_t *shadow, _IN_ char *identifier, _IN_ ...@@ -1479,6 +1479,7 @@ int kk_tsl_assemble_property(_IN_ kk_tsl_t *shadow, _IN_ char *identifier, _IN_
for (index = 0; index < shadow->property_number; index++) { for (index = 0; index < shadow->property_number; index++) {
property = shadow->properties + index; property = shadow->properties + index;
if ((strlen(property->identifier) == identifier_len) && if ((strlen(property->identifier) == identifier_len) &&
(memcmp(property->identifier, identifier, identifier_len) == 0)) { (memcmp(property->identifier, identifier, identifier_len) == 0)) {
/* dm_log_debug("Property Found: %.*s",identifier_len,identifier); */ /* dm_log_debug("Property Found: %.*s",identifier_len,identifier); */
......
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