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.cpp
- Revision:
- 2:db59f45ad3d3
- Parent:
- 0:cd5404401c2f
--- a/aws-iot/src/aws_iot_mqtt_client.cpp Wed Apr 12 14:09:46 2017 +0200 +++ b/aws-iot/src/aws_iot_mqtt_client.cpp Fri Aug 04 14:06:06 2017 +0900 @@ -62,7 +62,7 @@ #ifdef _ENABLE_THREAD_SUPPORT_ IoT_Error_t aws_iot_mqtt_client_lock_mutex(AWS_IoT_Client *pClient, IoT_Mutex_t *pMutex) { FUNC_ENTRY; - IoT_Error_t threadRc = FAILURE; + IoT_Error_t threadRc = IOT_FAILURE; if(NULL == pClient || NULL == pMutex){ FUNC_EXIT_RC(NULL_VALUE_ERROR); @@ -75,11 +75,11 @@ /* Should never return Error because the above request blocks until lock is obtained */ } - if(SUCCESS != threadRc) { + if(IOT_SUCCESS != threadRc) { FUNC_EXIT_RC(threadRc); } - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } IoT_Error_t aws_iot_mqtt_client_unlock_mutex(AWS_IoT_Client *pClient, IoT_Mutex_t *pMutex) { @@ -95,7 +95,7 @@ ClientState newState) { IoT_Error_t rc; #ifdef _ENABLE_THREAD_SUPPORT_ - IoT_Error_t threadRc = FAILURE; + IoT_Error_t threadRc = IOT_FAILURE; #endif FUNC_ENTRY; @@ -105,20 +105,20 @@ #ifdef _ENABLE_THREAD_SUPPORT_ rc = aws_iot_mqtt_client_lock_mutex(pClient, &(pClient->clientData.state_change_mutex)); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { return rc; } #endif if(expectedCurrentState == aws_iot_mqtt_get_client_state(pClient)) { pClient->clientStatus.clientState = newState; - rc = SUCCESS; + rc = IOT_SUCCESS; } else { rc = MQTT_UNEXPECTED_CLIENT_STATE_ERROR; } #ifdef _ENABLE_THREAD_SUPPORT_ threadRc = aws_iot_mqtt_client_unlock_mutex(pClient, &(pClient->clientData.state_change_mutex)); - if(SUCCESS == rc && SUCCESS != threadRc) { + if(IOT_SUCCESS == rc && IOT_SUCCESS != threadRc) { rc = threadRc; } #endif @@ -149,7 +149,7 @@ pClient->clientData.options.keepAliveIntervalInSec = pNewConnectParams->keepAliveIntervalInSec; pClient->clientData.options.isCleanSession = pNewConnectParams->isCleanSession; - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } IoT_Error_t aws_iot_mqtt_init(AWS_IoT_Client *pClient, IoT_Client_Init_Params *pInitParams) { @@ -183,22 +183,22 @@ /* Initialize default connection options */ rc = aws_iot_mqtt_set_connect_params(pClient, &default_options); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } #ifdef _ENABLE_THREAD_SUPPORT_ pClient->clientData.isBlockOnThreadLockEnabled = pInitParams->isBlockOnThreadLockEnabled; rc = aws_iot_thread_mutex_init(&(pClient->clientData.state_change_mutex)); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } rc = aws_iot_thread_mutex_init(&(pClient->clientData.tls_read_mutex)); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } rc = aws_iot_thread_mutex_init(&(pClient->clientData.tls_write_mutex)); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { FUNC_EXIT_RC(rc); } #endif @@ -210,7 +210,7 @@ pInitParams->pDevicePrivateKeyLocation, pInitParams->pHostURL, pInitParams->port, pInitParams->tlsHandshakeTimeout_ms, pInitParams->isSSLHostnameVerify); - if(SUCCESS != rc) { + if(IOT_SUCCESS != rc) { pClient->clientStatus.clientState = CLIENT_STATE_INVALID; FUNC_EXIT_RC(rc); } @@ -220,7 +220,7 @@ pClient->clientStatus.clientState = CLIENT_STATE_INITIALIZED; - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } uint16_t aws_iot_mqtt_get_next_packet_id(AWS_IoT_Client *pClient) { @@ -281,7 +281,7 @@ FUNC_EXIT_RC(NULL_VALUE_ERROR); } pClient->clientStatus.isAutoReconnectEnabled = newStatus; - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } IoT_Error_t aws_iot_mqtt_set_disconnect_handler(AWS_IoT_Client *pClient, iot_disconnect_handler pDisconnectHandler, @@ -293,7 +293,7 @@ pClient->clientData.disconnectHandler = pDisconnectHandler; pClient->clientData.disconnectHandlerData = pDisconnectHandlerData; - FUNC_EXIT_RC(SUCCESS); + FUNC_EXIT_RC(IOT_SUCCESS); } uint32_t aws_iot_mqtt_get_network_disconnected_count(AWS_IoT_Client *pClient) {