Skip to content

Commit 072f8c4

Browse files
committed
1. 修改topic name最大长度为128,与云端后台保持一致
2. 修复编译错误
1 parent 5558c5d commit 072f8c4

File tree

2 files changed

+1
-47
lines changed

2 files changed

+1
-47
lines changed

src/mqtt/include/mqtt_client.h

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extern "C" {
5555
#define MAX_COMMAND_TIMEOUT (5000)
5656

5757
/* 云端保留主题的最大长度 */
58-
#define MAX_SIZE_OF_CLOUD_TOPIC ((MAX_SIZE_OF_DEVICE_NAME) + (MAX_SIZE_OF_PRODUCT_ID) + 64)
58+
#define MAX_SIZE_OF_CLOUD_TOPIC ((MAX_SIZE_OF_DEVICE_NAME) + (MAX_SIZE_OF_PRODUCT_ID) + 64 + 6)
5959

6060
/**
6161
* @brief MQTT Message Type

src/mqtt/src/mqtt_client_subscribe.c

100644100755
Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,9 @@ int qcloud_iot_mqtt_resubscribe(Qcloud_IoT_Client *pClient) {
184184

185185
POINTER_SANITY_CHECK(pClient, QCLOUD_ERR_INVAL);
186186

187-
Timer timer;
188-
uint32_t len = 0;
189187
uint32_t itr = 0;
190188
char *topic = NULL;
191189
SubscribeParams temp_param;
192-
uint16_t packet_id = 0;
193-
194-
ListNode *node = NULL;
195190

196191
if (NULL == pClient) {
197192
IOT_FUNC_EXIT_RC(QCLOUD_ERR_INVAL);
@@ -215,47 +210,6 @@ int qcloud_iot_mqtt_resubscribe(Qcloud_IoT_Client *pClient) {
215210
Log_e("resubscribe failed %d, topic: %s", rc, topic);
216211
IOT_FUNC_EXIT_RC(rc);
217212
}
218-
219-
#if 0
220-
InitTimer(&timer);
221-
countdown_ms(&timer, pClient->command_timeout_ms);
222-
223-
HAL_MutexLock(pClient->lock_write_buf);
224-
packet_id = get_next_packet_id(pClient);
225-
rc = _serialize_subscribe_packet(pClient->write_buf, pClient->write_buf_size, 0, packet_id, 1,
226-
&topic, &(pClient->sub_handles[itr].qos), &len);
227-
if (QCLOUD_ERR_SUCCESS != rc) {
228-
HAL_MutexUnlock(pClient->lock_write_buf);
229-
IOT_FUNC_EXIT_RC(rc);
230-
}
231-
232-
/* 等待 sub ack 列表中添加元素 */
233-
SubTopicHandle sub_handle;
234-
sub_handle.topic_filter = topic;
235-
sub_handle.message_handler = pClient->sub_handles[itr].message_handler;
236-
sub_handle.qos = pClient->sub_handles[itr].qos;
237-
sub_handle.message_handler_data = pClient->sub_handles[itr].message_handler_data;
238-
239-
rc = push_sub_info_to(pClient, len, (unsigned int)packet_id, SUBSCRIBE, &sub_handle, &node);
240-
if (QCLOUD_ERR_SUCCESS != rc) {
241-
Log_e("push publish into to pubInfolist failed!");
242-
HAL_MutexUnlock(pClient->lock_write_buf);
243-
IOT_FUNC_EXIT_RC(rc);
244-
}
245-
246-
// 发送SUBSCRIBE报文
247-
rc = send_mqtt_packet(pClient, len, &timer);
248-
if (QCLOUD_ERR_SUCCESS != rc) {
249-
HAL_MutexLock(pClient->lock_list_sub);
250-
list_remove(pClient->list_sub_wait_ack, node);
251-
HAL_MutexUnlock(pClient->lock_list_sub);
252-
253-
HAL_MutexUnlock(pClient->lock_write_buf);
254-
IOT_FUNC_EXIT_RC(rc);
255-
}
256-
257-
HAL_MutexUnlock(pClient->lock_write_buf);
258-
#endif
259213
}
260214

261215
IOT_FUNC_EXIT_RC(QCLOUD_ERR_SUCCESS);

0 commit comments

Comments
 (0)