IoTHub raw messaging client sample using MQTT

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed wolfSSL azure_c_shared_utility iothub_client azure_umqtt_c iothub_mqtt_transport

Revision:
14:0d0177062483
Parent:
10:f77bb0044e11
Child:
15:2f2b3dc3ecb4
--- a/iothub_client_sample_mqtt.c	Wed Jun 22 23:58:05 2016 +0000
+++ b/iothub_client_sample_mqtt.c	Fri Jul 01 10:44:12 2016 -0700
@@ -8,8 +8,8 @@
 #include "iothub_message.h"
 #include "azure_c_shared_utility/threadapi.h"
 #include "azure_c_shared_utility/crt_abstractions.h"
+#include "azure_c_shared_utility/platform.h"
 #include "iothubtransportmqtt.h"
-#include "azure_c_shared_utility/platform.h"
 
 #ifdef MBED_BUILD_TIMESTAMP
 #include "certs.h"
@@ -23,10 +23,10 @@
 static int callbackCounter;
 static char msgText[1024];
 static char propText[1024];
+static bool g_continueRunning;
 #define MESSAGE_COUNT 5
-static bool g_continueRunning;
+#define DOWORK_LOOP_NUM     3
 
-DEFINE_ENUM_STRINGS(IOTHUB_CLIENT_CONFIRMATION_RESULT, IOTHUB_CLIENT_CONFIRMATION_RESULT_VALUES);
 
 typedef struct EVENT_INSTANCE_TAG
 {
@@ -169,6 +169,13 @@
 
                     iterator++;
                 } while (g_continueRunning);
+
+                (void)printf("iothub_client_sample_mqtt has gotten quit message, call DoWork %d more time to complete final sending...\r\n", DOWORK_LOOP_NUM);
+                for (size_t index = 0; index < DOWORK_LOOP_NUM; index++)
+                {
+                    IoTHubClient_LL_DoWork(iotHubClientHandle);
+                    ThreadAPI_Sleep(1);
+                }
             }
             IoTHubClient_LL_Destroy(iotHubClientHandle);
         }