Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: azure_c_shared_utility EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed azure_uamqp_c serializer wolfSSL
Diff: remote_monitoring.c
- Revision:
- 23:ff89811f3fa3
- Parent:
- 22:afe08a0ed332
- Child:
- 24:8e6112373e4e
--- a/remote_monitoring.c Fri Nov 13 16:08:20 2015 -0800
+++ b/remote_monitoring.c Thu Dec 17 18:24:03 2015 -0800
@@ -1,7 +1,11 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#ifndef WINCE
#include "iothubtransportamqp.h"
+#else
+#include "iothubtransporthttp.h"
+#endif
#include "schemalib.h"
#include "iothub_client.h"
#include "serializer.h"
@@ -12,6 +16,7 @@
#include "certs.h"
#endif // MBED_BUILD_TIMESTAMP
+
static const char* deviceId = "[Device Id]";
static const char* deviceKey = "[Device Key]";
static const char* hubName = "[IoTHub Name]";
@@ -111,9 +116,11 @@
}
else
{
+ EXECUTE_COMMAND_RESULT executeCommandResult;
+
memcpy(temp, buffer, size);
temp[size] = '\0';
- EXECUTE_COMMAND_RESULT executeCommandResult = EXECUTE_COMMAND(userContextCallback, temp);
+ executeCommandResult = EXECUTE_COMMAND(userContextCallback, temp);
result =
(executeCommandResult == EXECUTE_COMMAND_ERROR) ? IOTHUBMESSAGE_ABANDONED :
(executeCommandResult == EXECUTE_COMMAND_SUCCESS) ? IOTHUBMESSAGE_ACCEPTED :
@@ -133,14 +140,18 @@
else
{
IOTHUB_CLIENT_CONFIG config;
+ IOTHUB_CLIENT_HANDLE iotHubClientHandle;
config.deviceId = deviceId;
config.deviceKey = deviceKey;
config.iotHubName = hubName;
config.iotHubSuffix = hubSuffix;
+#ifndef WINCE
config.protocol = AMQP_Protocol;
-
- IOTHUB_CLIENT_HANDLE iotHubClientHandle = IoTHubClient_Create(&config);
+#else
+ config.protocol = HTTP_Protocol;
+#endif
+ iotHubClientHandle = IoTHubClient_Create(&config);
if (iotHubClientHandle == NULL)
{
(void)printf("Failed on IoTHubClient_CreateFromConnectionString\r\n");
