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:
5:e22a1ae893d2
Parent:
3:21c8adb97c8f
Child:
6:32e6f0048bf1
Child:
7:dd5bf173b5e6
--- a/main.cpp	Sun Dec 07 13:18:27 2014 +0000
+++ b/main.cpp	Tue Jan 06 22:18:27 2015 +0000
@@ -2,9 +2,9 @@
 //the library "TextLCD.h" was slightly altered to work with the GDM2004D LCD
 #include "TextLCD/TextLCD.h"
 #include "Controller.h"
+#include "picojson.h"
 #include "EthernetInterface.h"
-#include "HTTPClient.h"
-#include "picojson.h"
+//#include "HTTPClient.h"
 //#include "SDFileSystem.h" Needed if config files are going to be implemented
 #include <string>
 
@@ -27,9 +27,9 @@
 Serial rfd(p9, p10); //tx, rx
 
 //TODO: Should be the responsibility of Controller
-EthernetInterface eth;
+EthernetInterface eth; //Doeesn't want to initialize in the objects Controller->mAPI
 HTTPClient http;
-char str[512];
+char str[1024];
 
 //Storage
 //SD card
@@ -42,7 +42,7 @@
 
 
 //Controller mainly directs the program. It directs data and also controls the lcd output.
-Controller c(&lcd);
+Controller c(&lcd/*, &eth*/);
 
 /**********************
     Declare functions
@@ -57,20 +57,17 @@
 *****************/
 int main()
 {
-    printf("\r\n\r\nBuild  ");
-    printf(__DATE__);
-    printf(" - ");
-    printf(__TIME__);
-    printf("\r\n\r\n");
-    setup();
-    c.lcd->cls();
-    //the LCD is cleared using function .cls()
-    lcd.cls();
-
+    eth.init();
+    eth.connect();
+    printf("int main()\r\n");
+    c.init();
     c.printCommandList();
-    pc.printf("Entering loop\r\n");
-
-    //the endless loop keeps mbed in low power mode
+    c.testRequest();
+//    setup();
+//
+//    pc.printf("Entering loop\r\n");
+//
+//    //the endless loop keeps mbed in low power mode
 //    runProgram();
 }
 
@@ -84,28 +81,18 @@
     c.setStatus(Controller::INIT);
     rfd.baud(9600);
 
-    //Initialize Ethernet
-//    eth.init();
-//    eth.connect();
     wait_ms(200);
 }
 
 void runProgram()
 {
 
-    c.lcd->locate(0,0);
-    c.displayStatus();
-//    c.printDesc(1);
-//    string ip = eth.getIPAddress();
-//    string mStr = "IP: " + ip + "\r\n";
-//    c.lcdWriteLine(3, mStr);
-//    pc.printf("%s", ip);
-////
 //
-//
+
+
 //        //GET data
 //    printf("\nTrying to fetch page...\r\n");
-//    int ret = http.get("http://core.motiv.jvanbaarsen.com/v1/tables/7", str, 128);
+//    int ret = http.get("http://core.motiv.jvanbaarsen.com/v1/tables", str, 128);
 //    if (!ret)
 //    {
 //      printf("Page fetched successfully - read %d characters\r\n", strlen(str));
@@ -126,17 +113,16 @@
 //    string code = jsonVal.get("table").get("code").get<string>();
 //    
 //    
-////    int dinner_stat = json["table"];
-////    string code = table["code"];
-////    
-////    printf("The status of the dinner is: %d\r\n", dinner_stat);
+//    int dinner_stat = json["table"];
+//    string code = table["code"];
+//    
+//    printf("The status of the dinner is: %d\r\n", dinner_stat);
 //    printf("Code: %s\r\n", code); 
     
     c.setStatus(Controller::READY);
     pc.printf("Controller ready\r\n");
     
     c.printCommandList();
-
     //Reset flower
     rfd.putc(2);
     rfd.putc(0);