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@0:caa8884fe136, 2015-09-15 (annotated)
- Committer:
- AzureIoTClient
- Date:
- Tue Sep 15 22:47:10 2015 -0700
- Revision:
- 0:caa8884fe136
- Child:
- 2:fc3132155be8
New release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AzureIoTClient | 0:caa8884fe136 | 1 | // Copyright (c) Microsoft. All rights reserved. |
AzureIoTClient | 0:caa8884fe136 | 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
AzureIoTClient | 0:caa8884fe136 | 3 | |
AzureIoTClient | 0:caa8884fe136 | 4 | #include <stdio.h> |
AzureIoTClient | 0:caa8884fe136 | 5 | #include "EthernetInterface.h" |
AzureIoTClient | 0:caa8884fe136 | 6 | #include "mbed/logging.h" |
AzureIoTClient | 0:caa8884fe136 | 7 | #include "mbed/mbedtime.h" |
AzureIoTClient | 0:caa8884fe136 | 8 | #include "simplesample_amqp.h" |
AzureIoTClient | 0:caa8884fe136 | 9 | |
AzureIoTClient | 0:caa8884fe136 | 10 | int main(void) |
AzureIoTClient | 0:caa8884fe136 | 11 | { |
AzureIoTClient | 0:caa8884fe136 | 12 | (void)printf("Initializing mbed specific things...\r\n"); |
AzureIoTClient | 0:caa8884fe136 | 13 | |
AzureIoTClient | 0:caa8884fe136 | 14 | mbed_log_init(); |
AzureIoTClient | 0:caa8884fe136 | 15 | mbedtime_init(); |
AzureIoTClient | 0:caa8884fe136 | 16 | |
AzureIoTClient | 0:caa8884fe136 | 17 | EthernetInterface eth; |
AzureIoTClient | 0:caa8884fe136 | 18 | if (eth.init() || eth.connect()) |
AzureIoTClient | 0:caa8884fe136 | 19 | { |
AzureIoTClient | 0:caa8884fe136 | 20 | (void)printf("Error initializing EthernetInterface.\r\n"); |
AzureIoTClient | 0:caa8884fe136 | 21 | return -1; |
AzureIoTClient | 0:caa8884fe136 | 22 | } |
AzureIoTClient | 0:caa8884fe136 | 23 | |
AzureIoTClient | 0:caa8884fe136 | 24 | simplesample_amqp_run(); |
AzureIoTClient | 0:caa8884fe136 | 25 | } |