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@22:3acb69edee6b, 2016-01-26 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Tue Jan 26 17:56:04 2016 -0800
- Revision:
- 22:3acb69edee6b
- Parent:
- 17:3abbcd6aac9f
- Child:
- 23:39fcc72c3963
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 | /* These are needed in order to initialize the time provider for Proton-C */ |
AzureIoTClient | 22:3acb69edee6b | 16 | mbed_log_init(); |
AzureIoTClient | 22:3acb69edee6b | 17 | mbedtime_init(); |
AzureIoTClient | 22:3acb69edee6b | 18 | |
AzureIoTClient | 22:3acb69edee6b | 19 | if ((result = platform_init()) != 0) |
AzureIoTClient | 17:3abbcd6aac9f | 20 | { |
AzureIoTClient | 22:3acb69edee6b | 21 | (void)printf("Error initializing the platform: %d\r\n",result); |
AzureIoTClient | 17:3abbcd6aac9f | 22 | return -1; |
AzureIoTClient | 17:3abbcd6aac9f | 23 | } |
AzureIoTClient | 17:3abbcd6aac9f | 24 | |
AzureIoTClient | 17:3abbcd6aac9f | 25 | simplesample_http_run(); |
AzureIoTClient | 17:3abbcd6aac9f | 26 | |
AzureIoTClient | 22:3acb69edee6b | 27 | platform_deinit(); |
AzureIoTClient | 22:3acb69edee6b | 28 | |
AzureIoTClient | 17:3abbcd6aac9f | 29 | return 0; |
AzureIoTClient | 17:3abbcd6aac9f | 30 | } |