Temperature sensor anomaly IoTHub sample
Dependencies: C12832 EthernetInterface LM75B NTPClient iothub_client iothub_http_transport mbed-rtos mbed serializer wolfSSL azure_c_shared_utility
This sample showcases the usage of Azure IoT client libraries to build an application sample that uploads temperature data and reacts to an alert for a temperature anomaly sent by a cloud service.
Diff: main.cpp
- Revision:
- 7:f263af2427d4
- Parent:
- 6:315d04ac34d3
- Child:
- 9:0aae2d7a398b
--- a/main.cpp Thu Sep 17 00:28:08 2015 -0700 +++ b/main.cpp Tue Sep 22 20:40:52 2015 -0700 @@ -194,11 +194,11 @@ } /*this functiuon "links" IoTHub to the serialization library*/ -static IOTHUBMESSAGE_DISPOSITION_RESULT IoTHubNotification(IOTHUB_MESSAGE_HANDLE notificationMessage, void* userContextCallback) +static IOTHUBMESSAGE_DISPOSITION_RESULT IoTHubMessage(IOTHUB_MESSAGE_HANDLE message, void* userContextCallback) { const unsigned char* buffer; size_t size; - if (IoTHubMessage_GetByteArray(notificationMessage, &buffer, &size) != IOTHUB_MESSAGE_OK) + if (IoTHubMessage_GetByteArray(message, &buffer, &size) != IOTHUB_MESSAGE_OK) { (void)printf("unable to IoTHubMessage_GetByteArray\r\n"); } @@ -320,7 +320,7 @@ { /* Setup IoTHub client configuration */ - IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, IoTHubTransportHttp_ProvideTransportInterface); + IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol); if (iotHubClientHandle == NULL) { @@ -341,10 +341,10 @@ } else { - IOTHUB_CLIENT_RESULT setNotificationResult = IoTHubClient_LL_SetNotificationCallback(iotHubClientHandle, IoTHubNotification, frdmDevice); - if (setNotificationResult != IOTHUB_CLIENT_OK) + IOTHUB_CLIENT_RESULT setMessageResult = IoTHubClient_LL_SetMessageCallback(iotHubClientHandle, IoTHubMessage, frdmDevice); + if (setMessageResult != IOTHUB_CLIENT_OK) { - (void)printf("unable to IoTHubClient_SetNotificationCallback\r\n"); + (void)printf("unable to IoTHubClient_SetMessageCallback\r\n"); } else {