this is fork and i will modify for STM32

Fork of AWS-test by Pierre-Marie Ancèle

Revision:
2:db59f45ad3d3
Parent:
0:cd5404401c2f
--- a/aws-iot/src/aws_iot_mqtt_client_yield.cpp	Wed Apr 12 14:09:46 2017 +0200
+++ b/aws-iot/src/aws_iot_mqtt_client_yield.cpp	Fri Aug 04 14:06:06 2017 +0900
@@ -56,7 +56,7 @@
 	FUNC_ENTRY;
 
 	rc = aws_iot_mqtt_disconnect(pClient);
-	if(rc != SUCCESS) {
+	if(rc != IOT_SUCCESS) {
 		// If the aws_iot_mqtt_internal_send_packet prevents us from sending a disconnect packet then we have to clean the stack
 		_aws_iot_mqtt_force_client_disconnect(pClient);
 	}
@@ -92,7 +92,7 @@
 		if(NETWORK_RECONNECTED == rc) {
 			rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_IDLE,
 											   CLIENT_STATE_CONNECTED_YIELD_IN_PROGRESS);
-			if(SUCCESS != rc) {
+			if(IOT_SUCCESS != rc) {
 				FUNC_EXIT_RC(rc);
 			}
 			FUNC_EXIT_RC(NETWORK_RECONNECTED);
@@ -109,7 +109,7 @@
 }
 
 static IoT_Error_t _aws_iot_mqtt_keep_alive(AWS_IoT_Client *pClient) {
-	IoT_Error_t rc = SUCCESS;
+	IoT_Error_t rc = IOT_SUCCESS;
 	TimerAWS timer;
 	size_t serialized_len;
 
@@ -120,11 +120,11 @@
 	}
 
 	if(0 == pClient->clientData.keepAliveInterval) {
-		FUNC_EXIT_RC(SUCCESS);
+		FUNC_EXIT_RC(IOT_SUCCESS);
 	}
 
 	if(!has_timer_expired(&pClient->pingTimer)) {
-		FUNC_EXIT_RC(SUCCESS);
+		FUNC_EXIT_RC(IOT_SUCCESS);
 	}
 
 	if(pClient->clientStatus.isPingOutstanding) {
@@ -139,13 +139,13 @@
 	serialized_len = 0;
 	rc = aws_iot_mqtt_internal_serialize_zero(pClient->clientData.writeBuf, pClient->clientData.writeBufSize,
 											  PINGREQ, &serialized_len);
-	if(SUCCESS != rc) {
+	if(IOT_SUCCESS != rc) {
 		FUNC_EXIT_RC(rc);
 	}
 
 	/* send the ping packet */
 	rc = aws_iot_mqtt_internal_send_packet(pClient, serialized_len, &timer);
-	if(SUCCESS != rc) {
+	if(IOT_SUCCESS != rc) {
 		//If sending a PING fails we can no longer determine if we are connected.  In this case we decide we are disconnected and begin reconnection attempts
 		rc = _aws_iot_mqtt_handle_disconnect(pClient);
 		FUNC_EXIT_RC(rc);
@@ -155,7 +155,7 @@
 	/* start a timer to wait for PINGRESP from server */
 	countdown_sec(&pClient->pingTimer, pClient->clientData.keepAliveInterval);
 
-	FUNC_EXIT_RC(SUCCESS);
+	FUNC_EXIT_RC(IOT_SUCCESS);
 }
 
 /**
@@ -178,7 +178,7 @@
  *         iot_is_mqtt_connected can be called to confirm.
  */
 static IoT_Error_t _aws_iot_mqtt_internal_yield(AWS_IoT_Client *pClient, uint32_t timeout_ms) {
-	IoT_Error_t yieldRc = SUCCESS;
+	IoT_Error_t yieldRc = IOT_SUCCESS;
 
 	uint8_t packet_type;
 	ClientState clientState;
@@ -203,7 +203,7 @@
 		}
 
 		yieldRc = aws_iot_mqtt_internal_cycle_read(pClient, &timer, &packet_type);
-		if(SUCCESS == yieldRc) {
+		if(IOT_SUCCESS == yieldRc) {
 			yieldRc = _aws_iot_mqtt_keep_alive(pClient);
 		} else {
 			// SSL read and write errors are terminal, connection must be closed and retried
@@ -218,7 +218,7 @@
 			if(1 == pClient->clientStatus.isAutoReconnectEnabled) {
 				yieldRc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_DISCONNECTED_ERROR,
 														CLIENT_STATE_PENDING_RECONNECT);
-				if(SUCCESS != yieldRc) {
+				if(IOT_SUCCESS != yieldRc) {
 					FUNC_EXIT_RC(yieldRc);
 				}
 
@@ -231,7 +231,7 @@
 			} else {
 				break;
 			}
-		} else if(SUCCESS != yieldRc) {
+		} else if(IOT_SUCCESS != yieldRc) {
 			break;
 		}
 	} while(!has_timer_expired(&timer));
@@ -287,7 +287,7 @@
 
 		rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_IDLE,
 										   CLIENT_STATE_CONNECTED_YIELD_IN_PROGRESS);
-		if(SUCCESS != rc) {
+		if(IOT_SUCCESS != rc) {
 			FUNC_EXIT_RC(rc);
 		}
 	}
@@ -297,7 +297,7 @@
 	if(NETWORK_DISCONNECTED_ERROR != yieldRc && NETWORK_ATTEMPTING_RECONNECT != yieldRc) {
 		rc = aws_iot_mqtt_set_client_state(pClient, CLIENT_STATE_CONNECTED_YIELD_IN_PROGRESS,
 										   CLIENT_STATE_CONNECTED_IDLE);
-		if(SUCCESS == yieldRc && SUCCESS != rc) {
+		if(IOT_SUCCESS == yieldRc && IOT_SUCCESS != rc) {
 			yieldRc = rc;
 		}
 	}