Merge pull request #31 from ucloud/bugfix_fix_shadow_userdata

bugfix fix shadow userdata
This commit is contained in:
ethanDu1 2020-05-14 13:47:17 +08:00 committed by GitHub
commit 46e3cf6a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -45,7 +45,6 @@ void* IOT_Shadow_Construct(const char *product_sn, const char *device_sn, void *
UIoT_Client *mqtt_client = (UIoT_Client *)ch_signal;
mqtt_client->event_handler.context = shadow_client;
shadow_client->product_sn = product_sn;
shadow_client->device_sn = device_sn;
shadow_client->mqtt = mqtt_client;

View File

@ -285,6 +285,7 @@ int uiot_shadow_subscribe_topic(UIoT_Shadow *pShadow, char *topicFilter, OnMessa
SubscribeParams subscribe_params = DEFAULT_SUB_PARAMS;
subscribe_params.on_message_handler = on_message_handler;
subscribe_params.user_data = pShadow;
subscribe_params.qos = QOS1;
ret = IOT_MQTT_Subscribe(mqtt_client, topic_name, &subscribe_params);
@ -637,8 +638,7 @@ void topic_request_result_handler(void *pClient, MQTTMessage *message, void *pUs
POINTER_VALID_CHECK_RTN(pClient);
POINTER_VALID_CHECK_RTN(message);
UIoT_Client *mqtt_client = (UIoT_Client *)pClient;
UIoT_Shadow *shadow_client = (UIoT_Shadow*)mqtt_client->event_handler.context;
UIoT_Shadow *shadow_client = (UIoT_Shadow*)pUserdata;
const char *topic = message->topic;
size_t topic_len = message->topic_len;
@ -738,8 +738,7 @@ void topic_sync_handler(void *pClient, MQTTMessage *message, void *pUserdata)
POINTER_VALID_CHECK_RTN(pClient);
POINTER_VALID_CHECK_RTN(message);
UIoT_Client *mqtt_client = (UIoT_Client *)pClient;
UIoT_Shadow *shadow_client = (UIoT_Shadow*)mqtt_client->event_handler.context;
UIoT_Shadow *shadow_client = (UIoT_Shadow*)pUserdata;
const char *topic = message->topic;
size_t topic_len = message->topic_len;