port of the azure client sample mqtt for the NUCLEO STM32F746ZG platform
Dependencies: F7_Ethernet NTPClient azure_c_shared_utility azure_umqtt_c iothub_client iothub_mqtt_transport mbed-rtos mbed wolfSSL
Fork of iothub_client_sample_mqtt by
Diff: iothub_client_sample_mqtt.c
- Revision:
- 6:02304619a9fa
- Parent:
- 2:65c172c36cf5
- Child:
- 7:02bc67ebbe23
--- a/iothub_client_sample_mqtt.c Fri Apr 08 13:26:20 2016 -0700 +++ b/iothub_client_sample_mqtt.c Sun Apr 24 16:42:15 2016 -0700 @@ -6,22 +6,20 @@ #include "iothub_client.h" #include "iothub_message.h" -#include "threadapi.h" -#include "crt_abstractions.h" +#include "azure_c_shared_utility/threadapi.h" +#include "azure_c_shared_utility/crt_abstractions.h" #include "iothubtransportmqtt.h" -#include "platform.h" +#include "azure_c_shared_utility/platform.h" #ifdef MBED_BUILD_TIMESTAMP #include "certs.h" #endif // MBED_BUILD_TIMESTAMP - -/*String containing Hostname, Device Id & Device Key in the format: */ -/* "HostName=<host_name>;DeviceId=<device_id>;SharedAccessKey=<device_key>" */ static const char* connectionString = "[device connection string]"; static int callbackCounter; static char msgText[1024]; +static char propText[1024]; #define MESSAGE_COUNT 5 static bool continueRunning; @@ -64,7 +62,6 @@ { if (propertyCount > 0) { - (void)printf("ERROR: message incorrectly contains properties!\r\n"); for (size_t index = 0; index < propertyCount; index++) { (void)printf("\tKey: %s Value: %s\r\n", keys[index], values[index]); @@ -146,6 +143,12 @@ else { messages[i].messageTrackingId = i; + MAP_HANDLE propMap = IoTHubMessage_Properties(messages[i].messageHandle); + sprintf_s(propText, sizeof(propText), "PropMsg_%d", i); + if (Map_AddOrUpdate(propMap, "PropName", propText) != MAP_OK) + { + (void)printf("ERROR: Map_AddOrUpdate Failed!\r\n"); + } if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[i].messageHandle, SendConfirmationCallback, &messages[i]) != IOTHUB_CLIENT_OK) {