DreamForce 2013 Hands-On Demo

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

Fork of ThermostatHandsOn by Doug Anson

Revision:
6:510193bc7f26
Parent:
5:20cca9368622
--- a/Thermostat.cpp	Tue Nov 05 21:23:25 2013 +0000
+++ b/Thermostat.cpp	Sun Nov 10 16:35:54 2013 +0000
@@ -348,6 +348,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) {