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:
- 24:8e6112373e4e
- Parent:
- 23:ff89811f3fa3
- Child:
- 31:3f7731d8c71a
--- a/remote_monitoring.c Thu Dec 17 18:24:03 2015 -0800
+++ b/remote_monitoring.c Fri Jan 15 15:49:57 2016 -0800
@@ -38,9 +38,9 @@
DECLARE_MODEL(Thermostat,
/* Event data (temperature, external temperature and humidity) */
- WITH_DATA(double, Temperature),
- WITH_DATA(double, ExternalTemperature),
- WITH_DATA(double, Humidity),
+ 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 */
@@ -51,22 +51,22 @@
WITH_DATA(ascii_char_ptr_no_quotes, Commands),
/* Commands implemented by the device */
- WITH_ACTION(SetTemperature, double, temperature),
- WITH_ACTION(SetHumidity, double, humidity)
+ WITH_ACTION(SetTemperature, int, temperature),
+ WITH_ACTION(SetHumidity, int, humidity)
);
END_NAMESPACE(Contoso);
-EXECUTE_COMMAND_RESULT SetTemperature(Thermostat* thermostat, double temperature)
+EXECUTE_COMMAND_RESULT SetTemperature(Thermostat* thermostat, int temperature)
{
- (void)printf("Received temperature %.02fs\r\n", temperature);
+ (void)printf("Received temperature %d\r\n", temperature);
thermostat->Temperature = temperature;
return EXECUTE_COMMAND_SUCCESS;
}
-EXECUTE_COMMAND_RESULT SetHumidity(Thermostat* thermostat, double humidity)
+EXECUTE_COMMAND_RESULT SetHumidity(Thermostat* thermostat, int humidity)
{
- (void)printf("Received humidity %.02fs\r\n", humidity);
+ (void)printf("Received humidity %d\r\n", humidity);
thermostat->Humidity = humidity;
return EXECUTE_COMMAND_SUCCESS;
}
@@ -223,9 +223,9 @@
STRING_delete(commandsMetadata);
}
- thermostat->Temperature = 50.0;
- thermostat->ExternalTemperature = 55.0;
- thermostat->Humidity = 50.0;
+ thermostat->Temperature = 50;
+ thermostat->ExternalTemperature = 55;
+ thermostat->Humidity = 50;
thermostat->DeviceId = (char*)deviceId;
while (1)
@@ -233,7 +233,7 @@
unsigned char*buffer;
size_t bufferSize;
- (void)printf("Sending sensor value Temperature = %02f, Humidity = %02f\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)
{
