Dreamforce 2013 MiniHack Thermostat Challenge - completed code

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

Revision:
3:9f70d34d3660
Parent:
1:3faa003ad6e6
--- a/Thermostat.cpp	Fri Nov 08 20:10:52 2013 +0000
+++ b/Thermostat.cpp	Sun Nov 10 16:30:11 2013 +0000
@@ -363,6 +363,29 @@
         
         // announce our position
         this->updateCoordinates();
+        
+        // if not connected... reconnect
+        if (!socketio.is_connected()){
+            // announce
+            this->display("Re-connecting...");
+            this->display_lcd("Re-connecting...");
+            
+            // re-connect
+            if (this->connectWebSocketService()) {
+                // announce
+                this->display("Reconnect success");
+                this->display_lcd("Reconnect: SUCCESS");
+                this->turnRGBLEDGreen();
+                this->resetAllLEDs();
+            }
+            else {
+                // announce
+                this->display("Reconnect failure");
+                this->display_lcd("Reconnect: FAILED");
+                this->gracefullyDisconnect();
+                this->turnRGBLEDRed();
+            }
+        }
                 
         // check and react to the joystick button press
         if (joystick_pressed) {