..
Dependencies: FP
Diff: MQTTSNClient.h
- Revision:
- 6:1957f23ac496
- Parent:
- 5:7fb937012f6c
--- a/MQTTSNClient.h Tue Jan 15 17:12:08 2019 +0000 +++ b/MQTTSNClient.h Wed Mar 27 11:05:25 2019 +0000 @@ -689,10 +689,12 @@ int rc = FAILURE; Timer timer = Timer(command_timeout_ms); int len = 0; - - if (!isconnected) +/* + if (!isconnected) { + printf("hello 01"); goto exit; - + } +*/ bool freeHandler = false; for (int i = 0; i < MAX_MESSAGE_HANDLERS; ++i) { @@ -703,23 +705,32 @@ } } if (!freeHandler) - { // No message handler free + { + printf("hello 02"); + // No message handler free rc = MAX_SUBSCRIPTIONS_EXCEEDED; goto exit; } len = MQTTSNSerialize_subscribe(sendbuf, MAX_PACKET_SIZE, 0, qos, packetid.getNext(), &topicFilter); - if (len <= 0) + if (len <= 0) { + printf("hello 03"); goto exit; - if ((rc = sendPacket(len, timer)) != SUCCESS) // send the subscribe packet + } + + if ((rc = sendPacket(len, timer)) != SUCCESS) { // send the subscribe packet + printf("hello 04"); goto exit; // there was a problem + } if (waitfor(MQTTSN_SUBACK, timer) == MQTTSN_SUBACK) // wait for suback { unsigned short mypacketid; unsigned char suback_rc; - if (MQTTSNDeserialize_suback((int*)&grantedQoS, &topicFilter.data.id, &mypacketid, &suback_rc, readbuf, MAX_PACKET_SIZE) != 1) + if (MQTTSNDeserialize_suback((int*)&grantedQoS, &topicFilter.data.id, &mypacketid, &suback_rc, readbuf, MAX_PACKET_SIZE) != 1) { + printf("hello 06"); rc = FAILURE; + } else rc = suback_rc; if (suback_rc == MQTTSN_RC_ACCEPTED) @@ -736,8 +747,10 @@ } } } - else + else { + printf("hello 07"); rc = FAILURE; + } exit: if (rc != SUCCESS) @@ -832,8 +845,10 @@ Timer timer = Timer(command_timeout_ms); int len = 0; +/* if (!isconnected) goto exit; +*/ #if MQTTSNCLIENT_QOS1 || MQTTSNCLIENT_QOS2 if (qos == QOS1 || qos == QOS2)