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

Files at this revision

API Documentation at this revision

Comitter:
ansond
Date:
Sun Nov 10 16:30:11 2013 +0000
Parent:
2:340477adb161
Child:
4:9f93fef46652
Commit message:
updates

Changed in this revision

HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
Thermostat.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/HTTPClient.lib	Fri Nov 08 20:10:52 2013 +0000
+++ b/HTTPClient.lib	Sun Nov 10 16:30:11 2013 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/HTTPClient/#be61104f4e91
+http://mbed.org/users/ansond/code/HTTPClient-thermostat-minihack-complete/#a7c41773ffd8
--- 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) {