Dreamforce 2013 MiniHack Thermostat Challenge - remotes

Dependencies:   C12832_lcd EthernetInterface-ansond-patched HTTPClient-thermostat-remotes LM75B MMA7660 SocketIO WebSocketClient-ThermostatDemo mbed-rtos mbed picojson

Fork of df-2013-minihack-thermostat-complete by MBED_DEMOS

Revision:
6:33f71cf9a04f
Parent:
0:26c48388f725
--- a/ThermostatSocketIO.cpp	Mon Nov 11 20:29:32 2013 +0000
+++ b/ThermostatSocketIO.cpp	Mon Nov 11 22:46:25 2013 +0000
@@ -6,6 +6,9 @@
 // message counter
 int counter = 1;
 
+extern char *lcd_locations[10];
+extern int location_index;
+
 // constructor
 ThermostatSocketIO::ThermostatSocketIO(char *devname) : SocketIO(DEFAULT_URL) {
     this->device_name = devname;
@@ -75,13 +78,13 @@
    // create the message name
    if (counter == 1) {
         // create the JSON to just register the device
-        sprintf(buffer,"[\"%s\",{\"battery\": %d, \"city\": \"Austin\", \"country\": \"US\", \"device_id\": \"%s\", \"lat\": %4.6f, \"long\": %4.6f, \"status\": \"%s\", \"temp\": %4.1f, \"switch\": %d}]", 
-               device_name, (int)bat, this->device_name, latitude, longitude, t_status, temp, errorState);
+        sprintf(buffer,"[\"%s\",{\"battery\": %d, \"city\": \"%s\", \"country\": \"US\", \"device_id\": \"%s\", \"lat\": %4.6f, \"long\": %4.6f, \"status\": \"%s\", \"temp\": %4.1f, \"switch\": %d}]", 
+               device_name, (int)bat, lcd_locations[location_index], this->device_name, latitude, longitude, t_status, temp, errorState);
    }
    else {
         // create the JSON
-        sprintf(buffer,"[{\"battery\": %d, \"city\": \"Austin\", \"country\": \"US\", \"device_id\": \"%s\", \"lat\": %4.6f, \"long\": %4.6f, \"status\": \"%s\", \"temp\": %4.1f, \"switch\": %d}]",
-          (int)bat, this->device_name, latitude, longitude, t_status, temp, errorState);
+        sprintf(buffer,"[{\"battery\": %d, \"city\": \"%s\", \"country\": \"US\", \"device_id\": \"%s\", \"lat\": %4.6f, \"long\": %4.6f, \"status\": \"%s\", \"temp\": %4.1f, \"switch\": %d}]",
+          (int)bat, lcd_locations[location_index], this->device_name, latitude, longitude, t_status, temp, errorState);
    }
    
    // return the JSON