Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: iothub_client EthernetInterface iothub_http_transport mbed-rtos mbed wolfSSL azure_c_shared_utility NTPClient
Diff: iothub_client_sample_http.c
- Revision:
- 76:e9a30712b6d7
- Parent:
- 68:a8c0f61d8478
- Child:
- 77:d4c04296120e
diff -r 667a8090a76b -r e9a30712b6d7 iothub_client_sample_http.c
--- a/iothub_client_sample_http.c Fri Aug 11 14:03:56 2017 -0700
+++ b/iothub_client_sample_http.c Fri Aug 25 11:24:21 2017 -0700
@@ -52,6 +52,8 @@
MAP_HANDLE mapProperties;
const char* messageId;
const char* correlationId;
+ const char* contentType;
+ const char* contentEncoding;
// Message properties
if ((messageId = IoTHubMessage_GetMessageId(message)) == NULL)
@@ -64,6 +66,18 @@
correlationId = "<null>";
}
+ // TODO: re-enable after IoTHubClient nuget package has been released (ewertons)
+ //if ((contentType = IoTHubMessage_GetContentTypeSystemProperty(message)) == NULL)
+ //{
+ contentType = "<null>";
+ //}
+
+ // TODO: re-enable after IoTHubClient nuget package has been released (ewertons)
+ //if ((contentEncoding = IoTHubMessage_GetContentEncodingSystemProperty(message)) == NULL)
+ //{
+ contentEncoding = "<null>";
+ //}
+
// Message content
if (IoTHubMessage_GetByteArray(message, (const unsigned char**)&buffer, &size) != IOTHUB_MESSAGE_OK)
{
@@ -71,7 +85,8 @@
}
else
{
- (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Data: <<<%.*s>>> & Size=%d\r\n", *counter, messageId, correlationId, (int)size, buffer, (int)size);
+ (void)printf("Received Message [%d]\r\n Message ID: %s\r\n Correlation ID: %s\r\n Content-Type: %s\r\n Content-Encoding: %s\r\n Data: <<<%.*s>>> & Size=%d\r\n",
+ *counter, messageId, correlationId, contentType, contentEncoding, (int)size, buffer, (int)size);
if (size == (strlen("quit") * sizeof(char)) && memcmp(buffer, "quit", size) == 0)
{
g_continueRunning = false;
@@ -208,6 +223,10 @@
(void)printf("ERROR: Map_AddOrUpdate Failed!\r\n");
}
+ // TODO: re-enable after IoTHubClient nuget package has been released (ewertons)
+ //(void)IoTHubMessage_SetContentTypeSystemProperty(messages[iterator].messageHandle, "application/json");
+ //(void)IoTHubMessage_SetContentEncodingSystemProperty(messages[iterator].messageHandle, "utf-8");
+
if (IoTHubClient_LL_SendEventAsync(iotHubClientHandle, messages[iterator].messageHandle, SendConfirmationCallback, &messages[iterator]) != IOTHUB_CLIENT_OK)
{
(void)printf("ERROR: IoTHubClient_LL_SendEventAsync..........FAILED!\r\n");
