A simple IoTHub sample using HTTP as transport
Dependencies: EthernetInterface NTPClient iothub_client iothub_http_transport mbed-rtos mbed wolfSSL serializer azure_c_shared_utility
This sample showcases the usage of Azure IoT client libraries with the HTTP transport for sending/receiving raw messages from an IoT Hub.
main.cpp@23:39fcc72c3963, 2016-01-28 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Thu Jan 28 13:53:16 2016 -0800
- Revision:
- 23:39fcc72c3963
- Parent:
- 22:3acb69edee6b
- Child:
- 28:44b1d44d0d3b
v1.0.0-preview.9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzureIoTClient | 17:3abbcd6aac9f | 1 | // Copyright (c) Microsoft. All rights reserved. |
AzureIoTClient | 17:3abbcd6aac9f | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
AzureIoTClient | 17:3abbcd6aac9f | 3 | |
AzureIoTClient | 17:3abbcd6aac9f | 4 | #include <stdio.h> |
AzureIoTClient | 17:3abbcd6aac9f | 5 | #include "EthernetInterface.h" |
AzureIoTClient | 17:3abbcd6aac9f | 6 | #include "simplesample_http.h" |
AzureIoTClient | 17:3abbcd6aac9f | 7 | #include "NTPClient.h" |
AzureIoTClient | 22:3acb69edee6b | 8 | #include "azureiot_common/platform.h" |
AzureIoTClient | 17:3abbcd6aac9f | 9 | |
AzureIoTClient | 17:3abbcd6aac9f | 10 | int main(void) |
AzureIoTClient | 17:3abbcd6aac9f | 11 | { |
AzureIoTClient | 22:3acb69edee6b | 12 | int result; |
AzureIoTClient | 22:3acb69edee6b | 13 | (void)printf("Initializing mbed specific things...\r\n"); |
AzureIoTClient | 17:3abbcd6aac9f | 14 | |
AzureIoTClient | 22:3acb69edee6b | 15 | if ((result = platform_init()) != 0) |
AzureIoTClient | 17:3abbcd6aac9f | 16 | { |
AzureIoTClient | 22:3acb69edee6b | 17 | (void)printf("Error initializing the platform: %d\r\n",result); |
AzureIoTClient | 17:3abbcd6aac9f | 18 | return -1; |
AzureIoTClient | 17:3abbcd6aac9f | 19 | } |
AzureIoTClient | 17:3abbcd6aac9f | 20 | |
AzureIoTClient | 17:3abbcd6aac9f | 21 | simplesample_http_run(); |
AzureIoTClient | 17:3abbcd6aac9f | 22 | |
AzureIoTClient | 22:3acb69edee6b | 23 | platform_deinit(); |
AzureIoTClient | 22:3acb69edee6b | 24 | |
AzureIoTClient | 17:3abbcd6aac9f | 25 | return 0; |
AzureIoTClient | 17:3abbcd6aac9f | 26 | } |