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.
Diff: main.cpp
- Revision:
- 6:c035e0e00f92
- Parent:
- 5:0bec07661dde
- Child:
- 7:b2c9d461ef42
--- a/main.cpp Wed Sep 16 23:13:20 2015 -0700 +++ b/main.cpp Thu Sep 17 00:14:36 2015 -0700 @@ -6,29 +6,34 @@ #include "simplesample_http.h" #include "NTPClient.h" -void setupRealTime(void) +int setupRealTime(void) { - (void)printf("setupRealTime begin\r\n"); - if (EthernetInterface::connect()) - { - (void)printf("Error initializing EthernetInterface.\r\n"); - } - else - { - (void)printf("setupRealTime NTP begin\r\n"); - NTPClient ntp; - if (ntp.setTime("0.pool.ntp.org") != 0) - { - (void)printf("Failed setting time.\r\n"); - } - else - { - (void)printf("set time correctly!\r\n"); - } - (void)printf("setupRealTime NTP end\r\n"); - EthernetInterface::disconnect(); - } - (void)printf("setupRealTime end\r\n"); + (void)printf("setupRealTime begin\r\n"); + if (EthernetInterface::connect()) + { + (void)printf("Error initializing EthernetInterface.\r\n"); + result = __LINE__; + } + else + { + (void)printf("setupRealTime NTP begin\r\n"); + NTPClient ntp; + if (ntp.setTime("0.pool.ntp.org") != 0) + { + (void)printf("Failed setting time.\r\n"); + result = __LINE__; + } + else + { + (void)printf("set time correctly!\r\n"); + result = 0; + } + (void)printf("setupRealTime NTP end\r\n"); + EthernetInterface::disconnect(); + } + (void)printf("setupRealTime end\r\n"); + + return result; } int main(void)