Azure IoT / Mbed 2 deprecated remote_monitoring

Dependencies:   azure_c_shared_utility EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed azure_uamqp_c serializer wolfSSL

Revision:
31:3f7731d8c71a
Parent:
24:8e6112373e4e
Child:
36:c5f21f14d53f
--- a/remote_monitoring.c	Fri Jan 29 23:46:46 2016 +0000
+++ b/remote_monitoring.c	Thu Feb 04 11:31:34 2016 -0800
@@ -38,21 +38,21 @@
 DECLARE_MODEL(Thermostat,
 
     /* Event data (temperature, external temperature and humidity) */
-	WITH_DATA(int, Temperature),
-	WITH_DATA(int, ExternalTemperature),
-	WITH_DATA(int, Humidity),
-	WITH_DATA(ascii_char_ptr, DeviceId),
+    WITH_DATA(int, Temperature),
+    WITH_DATA(int, ExternalTemperature),
+    WITH_DATA(int, Humidity),
+    WITH_DATA(ascii_char_ptr, DeviceId),
 
-	/* Device Info - This is command metadata + some extra fields */
-	WITH_DATA(ascii_char_ptr, ObjectType),
-	WITH_DATA(_Bool, IsSimulatedDevice),
-	WITH_DATA(ascii_char_ptr, Version),
-	WITH_DATA(DeviceProperties, DeviceProperties),
+    /* Device Info - This is command metadata + some extra fields */
+    WITH_DATA(ascii_char_ptr, ObjectType),
+    WITH_DATA(_Bool, IsSimulatedDevice),
+    WITH_DATA(ascii_char_ptr, Version),
+    WITH_DATA(DeviceProperties, DeviceProperties),
     WITH_DATA(ascii_char_ptr_no_quotes, Commands),
 
     /* Commands implemented by the device */
     WITH_ACTION(SetTemperature, int, temperature),
-	WITH_ACTION(SetHumidity, int, humidity)
+    WITH_ACTION(SetHumidity, int, humidity)
 );
 
 END_NAMESPACE(Contoso);
@@ -60,15 +60,15 @@
 EXECUTE_COMMAND_RESULT SetTemperature(Thermostat* thermostat, int temperature)
 {
     (void)printf("Received temperature %d\r\n", temperature);
-	thermostat->Temperature = temperature;
+    thermostat->Temperature = temperature;
     return EXECUTE_COMMAND_SUCCESS;
 }
 
 EXECUTE_COMMAND_RESULT SetHumidity(Thermostat* thermostat, int humidity)
 {
-	(void)printf("Received humidity %d\r\n", humidity);
-	thermostat->Humidity = humidity;
-	return EXECUTE_COMMAND_SUCCESS;
+    (void)printf("Received humidity %d\r\n", humidity);
+    thermostat->Humidity = humidity;
+    return EXECUTE_COMMAND_SUCCESS;
 }
 
 static void sendMessage(IOTHUB_CLIENT_HANDLE iotHubClientHandle, const unsigned char* buffer, size_t size)
@@ -116,7 +116,7 @@
         }
         else
         {
-			EXECUTE_COMMAND_RESULT executeCommandResult;
+            EXECUTE_COMMAND_RESULT executeCommandResult;
 
             memcpy(temp, buffer, size);
             temp[size] = '\0';
@@ -139,19 +139,19 @@
     }
     else
     {
-		IOTHUB_CLIENT_CONFIG config;
-		IOTHUB_CLIENT_HANDLE iotHubClientHandle;
+        IOTHUB_CLIENT_CONFIG config;
+        IOTHUB_CLIENT_HANDLE iotHubClientHandle;
 
-		config.deviceId = deviceId;
-		config.deviceKey = deviceKey;
-		config.iotHubName = hubName;
-		config.iotHubSuffix = hubSuffix;
+        config.deviceId = deviceId;
+        config.deviceKey = deviceKey;
+        config.iotHubName = hubName;
+        config.iotHubSuffix = hubSuffix;
 #ifndef WINCE
-		config.protocol = AMQP_Protocol;
+        config.protocol = AMQP_Protocol;
 #else
-		config.protocol = HTTP_Protocol;
+        config.protocol = HTTP_Protocol;
 #endif
-		iotHubClientHandle = IoTHubClient_Create(&config);
+        iotHubClientHandle = IoTHubClient_Create(&config);
         if (iotHubClientHandle == NULL)
         {
             (void)printf("Failed on IoTHubClient_CreateFromConnectionString\r\n");
@@ -185,9 +185,9 @@
                     /* send the device info upon startup so that the cloud app knows
                     what commands are available and the fact that the device is up */
                     thermostat->ObjectType = "DeviceInfo";
-					thermostat->IsSimulatedDevice = false;
-					thermostat->Version = "1.0";
-					thermostat->DeviceProperties.HubEnabledState = true;
+                    thermostat->IsSimulatedDevice = false;
+                    thermostat->Version = "1.0";
+                    thermostat->DeviceProperties.HubEnabledState = true;
                     thermostat->DeviceProperties.DeviceID = (char*)deviceId;
 
                     commandsMetadata = STRING_new();
@@ -223,17 +223,17 @@
                         STRING_delete(commandsMetadata);
                     }
 
-					thermostat->Temperature = 50;
-					thermostat->ExternalTemperature = 55;
-					thermostat->Humidity = 50;
-					thermostat->DeviceId = (char*)deviceId;
+                    thermostat->Temperature = 50;
+                    thermostat->ExternalTemperature = 55;
+                    thermostat->Humidity = 50;
+                    thermostat->DeviceId = (char*)deviceId;
 
                     while (1)
                     {
                         unsigned char*buffer;
                         size_t bufferSize;
 
-						(void)printf("Sending sensor value Temperature = %d, Humidity = %d\r\n", thermostat->Temperature, thermostat->Humidity);
+                        (void)printf("Sending sensor value Temperature = %d, Humidity = %d\r\n", thermostat->Temperature, thermostat->Humidity);
 
                         if (SERIALIZE(&buffer, &bufferSize, thermostat->DeviceId, thermostat->Temperature, thermostat->Humidity, thermostat->ExternalTemperature) != IOT_AGENT_OK)
                         {