IoTHub raw messaging client sample using AMQP

Dependencies:   iothub_client EthernetInterface NTPClient iothub_amqp_transport azure_c_shared_utility mbed-rtos mbed azure_uamqp_c wolfSSL

This sample showcases the usage of Azure IoT client libraries with the AMQP transport for sending/receiving raw messages from an IoT Hub.

Revision:
48:ecd0964514f8
Parent:
47:d87920c7f211
Child:
55:f977ade69f2c
diff -r d87920c7f211 -r ecd0964514f8 iothub_client_sample_amqp.c
--- a/iothub_client_sample_amqp.c	Fri Jul 01 10:43:40 2016 -0700
+++ b/iothub_client_sample_amqp.c	Mon Jul 18 16:45:37 2016 -0700
@@ -31,7 +31,7 @@
 typedef struct EVENT_INSTANCE_TAG
 {
     IOTHUB_MESSAGE_HANDLE messageHandle;
-    int messageTrackingId;  // For tracking the messages within the user callback.
+    size_t messageTrackingId;  // For tracking the messages within the user callback.
 } EVENT_INSTANCE;
 
 static IOTHUBMESSAGE_DISPOSITION_RESULT ReceiveMessageCallback(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback)
@@ -69,7 +69,7 @@
     }
     else if (contentType == IOTHUBMESSAGE_STRING)
     {
-        if ((buffer = IoTHubMessage_GetString(message)) != NULL && (size = strlen(buffer)) > 0)
+        if ((buffer = (const unsigned char*)IoTHubMessage_GetString(message)) != NULL && (size = strlen((const char*)buffer)) > 0)
         {
             (void)printf("Received Message [%d] (message-id: %s, correlation-id: %s) with STRING Data: <<<%.*s>>> & Size=%d\r\n", *counter, messageId, correlationId, (int)size, buffer, (int)size);
 
@@ -121,7 +121,7 @@
 static void SendConfirmationCallback(IOTHUB_CLIENT_CONFIRMATION_RESULT result, void* userContextCallback)
 {
     EVENT_INSTANCE* eventInstance = (EVENT_INSTANCE*)userContextCallback;
-    (void)printf("Confirmation[%d] received for message tracking id = %d with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));
+    (void)printf("Confirmation[%d] received for message tracking id = %zu with result = %s\r\n", callbackCounter, eventInstance->messageTrackingId, ENUM_TO_STRING(IOTHUB_CLIENT_CONFIRMATION_RESULT, result));
     /* Some device specific action code goes here... */
     callbackCounter++;
     IoTHubMessage_Destroy(eventInstance->messageHandle);
@@ -190,7 +190,7 @@
                             messages[iterator].messageTrackingId = iterator;
 
                             MAP_HANDLE propMap = IoTHubMessage_Properties(messages[iterator].messageHandle);
-                            sprintf_s(propText, sizeof(propText), "PropMsg_%d", iterator);
+                            (void)sprintf_s(propText, sizeof(propText), "PropMsg_%zu", iterator);
                             if (Map_AddOrUpdate(propMap, "PropName", propText) != MAP_OK)
                             {
                                 (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n");