ControllerBox directs electromechanical equipment in restaurants to display information.

Dependencies:   TextLCD MbedJSONValue libMotiv picojson mbed-rtos mbed

Fork of Mbed_MotiVControllerBox by Tim Wöstemeier

Revision:
0:2279181caaa1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Controller.cpp	Sat Oct 25 00:11:12 2014 +0000
@@ -0,0 +1,56 @@
+#include <string>
+#include "TextLCD.h"
+#include "Controller.h"
+
+Controller::Controller(TextLCD *lcd):
+    _status(WAITING)
+{
+    _lcd = lcd;
+    //setStatus(WAITING);
+    displayStatus();
+}
+
+Controller::cStatus Controller::getStatus()
+{
+    return _status;
+}
+
+string Controller::statusString()
+{
+    switch(_status) {
+        case READY:
+            return "ready";
+
+        case WAITING:
+            return "waiting";
+
+        case BUSY:
+            return "busy";
+
+        case ERROR:
+            return "error";
+
+        default:
+            return "unknown";
+    }
+}
+
+void Controller::setStatus(cStatus status)
+{
+    _status = status;
+    displayStatus();
+}
+
+void Controller::displayStatus()
+{
+    _lcd->locate(0,0);
+    _lcd->clearLine();
+    _lcd->locate(0,0);
+    _lcd->printf("Status: %s", statusString());
+}
+
+void Controller::displWriteLine(int row, char c)
+{
+    _lcd->locate(0,row);
+    _lcd->printf("%c", c);
+}
\ No newline at end of file