A simple IoTHub sample using AMQP as transport
Dependencies: EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed azure_c_shared_utility serializer wolfSSL azure_uamqp_c
This sample showcases the usage of Azure IoT client libraries with the AMQP transport for sending/receiving raw messages from an IoT Hub.
main.cpp@21:b8b8782d412f, 2016-01-26 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Tue Jan 26 17:55:59 2016 -0800
- Revision:
- 21:b8b8782d412f
- Parent:
- 16:b2c6de619743
- Child:
- 25:9cb9b0c15218
v1.0.0-preview.9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzureIoTClient | 16:b2c6de619743 | 1 | // Copyright (c) Microsoft. All rights reserved. |
AzureIoTClient | 16:b2c6de619743 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
AzureIoTClient | 16:b2c6de619743 | 3 | |
AzureIoTClient | 16:b2c6de619743 | 4 | #include <stdio.h> |
AzureIoTClient | 16:b2c6de619743 | 5 | #include "EthernetInterface.h" |
AzureIoTClient | 16:b2c6de619743 | 6 | #include "mbed/logging.h" |
AzureIoTClient | 16:b2c6de619743 | 7 | #include "mbed/mbedtime.h" |
AzureIoTClient | 16:b2c6de619743 | 8 | #include "simplesample_amqp.h" |
AzureIoTClient | 16:b2c6de619743 | 9 | #include "NTPClient.h" |
AzureIoTClient | 21:b8b8782d412f | 10 | #include "azureiot_common/platform.h" |
AzureIoTClient | 16:b2c6de619743 | 11 | |
AzureIoTClient | 16:b2c6de619743 | 12 | |
AzureIoTClient | 16:b2c6de619743 | 13 | int main(void) |
AzureIoTClient | 16:b2c6de619743 | 14 | { |
AzureIoTClient | 21:b8b8782d412f | 15 | int result; |
AzureIoTClient | 16:b2c6de619743 | 16 | (void)printf("Initializing mbed specific things...\r\n"); |
AzureIoTClient | 16:b2c6de619743 | 17 | |
AzureIoTClient | 16:b2c6de619743 | 18 | /* These are needed in order to initialize the time provider for Proton-C */ |
AzureIoTClient | 16:b2c6de619743 | 19 | mbed_log_init(); |
AzureIoTClient | 16:b2c6de619743 | 20 | mbedtime_init(); |
AzureIoTClient | 16:b2c6de619743 | 21 | |
AzureIoTClient | 21:b8b8782d412f | 22 | if ((result = platform_init()) != 0) |
AzureIoTClient | 16:b2c6de619743 | 23 | { |
AzureIoTClient | 21:b8b8782d412f | 24 | (void)printf("Error initializing the platform: %d\r\n",result); |
AzureIoTClient | 16:b2c6de619743 | 25 | return -1; |
AzureIoTClient | 16:b2c6de619743 | 26 | } |
AzureIoTClient | 16:b2c6de619743 | 27 | |
AzureIoTClient | 16:b2c6de619743 | 28 | simplesample_amqp_run(); |
AzureIoTClient | 16:b2c6de619743 | 29 | |
AzureIoTClient | 21:b8b8782d412f | 30 | platform_deinit(); |
AzureIoTClient | 16:b2c6de619743 | 31 | return 0; |
AzureIoTClient | 16:b2c6de619743 | 32 | } |