Jeon byungchul
/
aws-iot-example
this is fork and i will modify for STM32
Fork of AWS-test by
Diff: aws-iot/src/aws_iot_mqtt_client_subscribe.cpp
- Revision:
- 2:db59f45ad3d3
- Parent:
- 0:cd5404401c2f
--- a/aws-iot/src/aws_iot_mqtt_client_subscribe.cpp Wed Apr 12 14:09:46 2017 +0200 +++ b/aws-iot/src/aws_iot_mqtt_client_subscribe.cpp Fri Aug 04 14:06:06 2017 +0900 @@ -81,7 +81,7 @@ } rc = aws_iot_mqtt_internal_init_header(&header, SUBSCRIBE, QOS1, dup, 0); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* write header */ @@ -99,7 +99,7 @@ *pSerializedLen = (uint32_t) (ptr - pTxBuf); - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } /** @@ -128,7 +128,7 @@ curData = pRxBuf; endData = NULL; - decodeRc = FAILURE; + decodeRc = IOT_FAILURE; decodedLen = 0; readBytesLen = 0; @@ -141,19 +141,19 @@ header.byte = aws_iot_mqtt_internal_read_char(&curData); if(SUBACK != header.bits.type) { - FUNC_EXIT_RC(FAILURE); + FUNC_EXIT_RC(IOT_FAILURE); } /* read remaining length */ decodeRc = aws_iot_mqtt_internal_decode_remaining_length_from_buffer(curData, &decodedLen, &readBytesLen); - if(SUCCESS != decodeRc) { + if(IOT_SUCCESS != decodeRc) { FUNC_EXIT_RC(decodeRc); } curData += (readBytesLen); endData = curData + decodedLen; if(endData - curData < 2) { - FUNC_EXIT_RC(FAILURE); + FUNC_EXIT_RC(IOT_FAILURE); } *pPacketId = aws_iot_mqtt_internal_read_uint16_t(&curData); @@ -161,12 +161,12 @@ *pGrantedQoSCount = 0; while(curData < endData) { if(*pGrantedQoSCount > maxExpectedQoSCount) { - FUNC_EXIT_RC(FAILURE); + FUNC_EXIT_RC(IOT_FAILURE); } pGrantedQoSs[(*pGrantedQoSCount)++] = (QoS) aws_iot_mqtt_internal_read_char(&curData); } - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } /* Returns MAX_MESSAGE_HANDLERS value if no free index is available */ @@ -221,7 +221,7 @@ rc = _aws_iot_mqtt_serialize_subscribe(pClient->clientData.writeBuf, pClient->clientData.writeBufSize, 0, txPacketId, 1, &pTopicName, &topicNameLen, &qos, &serializedLen); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } @@ -232,20 +232,20 @@ /* send the subscribe packet */ rc = aws_iot_mqtt_internal_send_packet(pClient, serializedLen, &timer); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* wait for suback */ rc = aws_iot_mqtt_internal_wait_for_read(pClient, SUBACK, &timer); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* Granted QoS can be 0, 1 or 2 */ rc = _aws_iot_mqtt_deserialize_suback(&rxPacketId, 1, &count, grantedQoS, pClient->clientData.readBuf, pClient->clientData.readBufSize); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } @@ -266,7 +266,7 @@ pApplicationHandlerData; pClient->clientData.messageHandlers[indexOfFreeMessageHandler].qos = qos; - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } /** @@ -306,7 +306,7 @@ } rc = aws_iot_mqtt_set_client_state(pClient, clientState, CLIENT_STATE_CONNECTED_SUBSCRIBE_IN_PROGRESS); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } @@ -314,7 +314,7 @@ pApplicationHandler, pApplicationHandlerData); rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_SUBSCRIBE_IN_PROGRESS, clientState); - if(SUCCESS == subRc && SUCCESS != rc) { + if(IOT_SUCCESS == subRc && IOT_SUCCESS != rc) { subRc = rc; } @@ -357,31 +357,31 @@ &(pClient->clientData.messageHandlers[itr].topicName), &(pClient->clientData.messageHandlers[itr].topicNameLen), &(pClient->clientData.messageHandlers[itr].qos), &len); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* send the subscribe packet */ rc = aws_iot_mqtt_internal_send_packet(pClient, len, &timer); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* wait for suback */ rc = aws_iot_mqtt_internal_wait_for_read(pClient, SUBACK, &timer); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } /* Granted QoS can be 0, 1 or 2 */ rc = _aws_iot_mqtt_deserialize_suback(&packetId, 1, &count, grantedQoS, pClient->clientData.readBuf, pClient->clientData.readBufSize); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } } - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } /** @@ -416,7 +416,7 @@ rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_IDLE, CLIENT_STATE_CONNECTED_RESUBSCRIBE_IN_PROGRESS); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } @@ -424,7 +424,7 @@ rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_RESUBSCRIBE_IN_PROGRESS, CLIENT_STATE_CONNECTED_IDLE); - if(SUCCESS == resubRc && SUCCESS != rc) { + if(IOT_SUCCESS == resubRc && IOT_SUCCESS != rc) { resubRc = rc; }