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

Files at this revision

API Documentation at this revision

Comitter:
TimWoo
Date:
Tue Jan 06 23:02:11 2015 +0000
Parent:
5:e22a1ae893d2
Child:
8:d21d3b67fbb2
Commit message:
Converted libModbus to lib

Changed in this revision

EthernetInterface.lib Show annotated file Show diff for this revision Revisions of this file
libMotiv.lib Show annotated file Show diff for this revision Revisions of this file
libMotiv/Controller.cpp Show diff for this revision Revisions of this file
libMotiv/Controller.h Show diff for this revision Revisions of this file
libMotiv/Device.cpp Show diff for this revision Revisions of this file
libMotiv/Device.h Show diff for this revision Revisions of this file
libMotiv/Flower.cpp Show diff for this revision Revisions of this file
libMotiv/Flower.h Show diff for this revision Revisions of this file
libMotiv/MotiVAPI.cpp Show diff for this revision Revisions of this file
libMotiv/MotiVAPI.h Show diff for this revision Revisions of this file
libMotiv/Table.cpp Show diff for this revision Revisions of this file
libMotiv/Table.h Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
--- a/EthernetInterface.lib	Tue Jan 06 22:18:27 2015 +0000
+++ b/EthernetInterface.lib	Tue Jan 06 23:02:11 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/TimWoo/code/EthernetInterface/#537740f2a4c6
+http://mbed.org/users/mbed_official/code/EthernetInterface/#d1ccbed7687a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libMotiv.lib	Tue Jan 06 23:02:11 2015 +0000
@@ -0,0 +1,1 @@
+libMotiv#14bf6c650b55
--- a/libMotiv/Controller.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,308 +0,0 @@
-#include <string>
-#include <stdlib.h>
-#include "TextLCD.h"
-#include "Controller.h"
-#include "Device.h"
-#include "Table.h"
-#include "Flower.h"
-#include "picojson.h"
-#include "MotiVAPI.h"
-#include "EthernetInterface.h"
-#include "HTTPClient.h"
-
-#include <exception>
-#include <iostream>
-#include <sstream>
-
-//Flower commands
-//        fRESET = 0,
-//        fPETAL_SPD = 1,
-//        fBLINK_SPD = 2,
-//        fBLINK_PERIOD = 3,
-//        fLED_INTENSITY = 4,
-//        fPETAL_POS = 10,
-//        fLED_TABLE_FREE = 20,
-//        fLED_TABLE_RES = 21,
-//        fLED_FOOD = 22,
-//        fLED_DRINK = 23,
-//        fLED_SERVICE = 24,
-//        fLED_CLR = 29,
-////        Flower version 2 commands n/a for now.
-////        fPISTIL_SPD = 3,
-////        fPETAL1_POS = 11,
-////        fPETAL2_POS = 12,
-////        fPETAL3_POS = 13,
-////        fPETAL4_POS = 14,
-////        fPETAL5_POS = 15,
-////        fPETAL6_POS = 16,
-////        fPISTIL_POS_FOOD = 30,
-////        fPISTIL_POS_DRINKS = 31,
-////        fPISTIL_POS_SERVICE = 32
-//        fTABLE_FREE = 50,
-//        fTABLE_ACTIVE = 51,
-//        fTABLE_RES = 52,
-//        fTABLE_END = 53,
-//        fFOOD_ORDERED = 54,
-//        fDRINKS_ORDERED = 55,
-//        fSERVICE_REQ = 56,
-//        fPETALS_CLOSE = 60,
-//        fLAMP_ACT = 100,
-//        fDEMO1 = 101,
-//        fDEMO2 = 102
-//Flower commands v2
-//Functie Waarde(n) Doel
-//
-//Primaire functies
-//
-//0* 0 Reset (Zet alle waarden terug naar default)
-//1* 0 – 100 Zet bewegingssnelheid van de bladeren (0 langzaam, 100 snel)
-//2 0 – 100 Zet knippersnelheid van de verlichting (in %)
-//3 0 – 255 Zet knipperlengte van de verlichting (in sec)
-//4 0 – 100 Zet de lichtintensiteit van de LEDstrip (0 – 100 %)
-//5 0 – 100 Zet bewegingssnelheid van de stampers (Niet beschikbaar in bloem versie 1)
-//6 0 – 255 Zet tijd
-//10* 0 – 100 Zet de positie van de bloembladeren (0 dicht, 100 open)
-//11 – 18 0 – 100 Zet de positie van (max. 8) individuele bloembladeren (0 dicht, 100 open) (Niet beschikbaar in bloem versie 1)
-//20* 0 … 1 Zet led “tafel vrij”
-//21* 0 … 1 Zet led “tafel gereserveerd”
-//22* 0 … 1 Zet led F(ood)
-//23* 0 … 1 Zet led D(rink)
-//24* 0 … 1 Zet led S(ervice)
-//29 0 … 1 Zet led verlichting (standaard wit)
-//30 0 – 100 Zet hoogte van stamper F(ood) (Niet beschikbaar in bloem versie 1)
-//31 0 – 100 Zet hoogte van stamper D(rink) (Niet beschikbaar in bloem versie 1)
-//32 0 – 100 Zet hoogte van stamper S(ervice) (Niet beschikbaar in bloem versie 1)
-//Complexe functies
-//50* 1 Zet bloem naar stand “Tafel vrij” (Gesloten groen)
-//51* 1 Zet bloem naar stand “Tafel in gebruik” (Open groen)
-//52* 1 Zet bloem naar stand “Tafel gereserveerd” (Gesloten rood)
-//53* 1 Zet bloem naar stand “Zittingstijd om” (Open rood)
-//54* 0 – 100 Zet bloem naar stand “Eten besteld” met x% bestelstatus
-//55* 0 – 100 Zet bloem naar stand “Drank besteld” met x% bestelstatus
-//56* 0 – 100 Zet bloem naar stand “Bediening gevraagd” met x% bestelstatus
-//60 1 Bloem sluit al naar gelang de ingestelde tijd
-//61 1 Zet bloem naar status “zittingstijd om”. (“Gereserveerd rood knipperen”)
-//100 1 Lampfunctie (Bloem opent een klein beetje en fungeert als lamp)
-//101 1 Demostand 1 (Bloem gaat continu open en dicht en alle leds wisselen)
-//102 0 – 100 Demostand 2 (Bloem opent naar stand X en statusleds wisselen)
-
-//#include "MotiVAPI.h"
-
-
-
-
-
-//Test endpoint: http://demo.motiv.jvanbaarsen.com/demo/test
-using namespace std;
-
-
-void debug_build_number()
-{
-    printf("\r\n\r\nBuild ");
-    printf(__DATE__);
-    printf(" - ");
-    printf(__TIME__);
-    printf("\r\n\r\n");
-}
-
-Controller::Controller()
-{}
-
-Controller::Controller(TextLCD *lcd/*, EthernetInterface *eth*/)
-    :   initialized(false),
-        lcd(lcd),
-        status(WAITING)
-{
-    debug_build_number(); //show build info
-    printf("Controller constructor\r\n");
-
-    mAPI = new MotiVAPI("http://core.motiv.jvanbaarsen.com/v1/"); //Initialize API
-
-    setStatus(WAITING);
-    displayStatus();
-}
-
-void Controller::init()
-{
-    initialized = true;
-    mAPI->init();
-    
-    initTables();
-}
-
-void Controller::printDesc(int c)
-{
-//    string desc = flower->getCommandDesc(c);
-//    lcdWriteLine(2, desc);
-}
-
-Controller::cStatus Controller::getStatus()
-{
-    return this->status;
-}
-
-string Controller::statusString()
-{
-    switch(status) {
-        case READY:
-            return "ready";
-
-        case WAITING:
-            return "waiting";
-
-        case BUSY:
-            return "busy";
-
-        case ERROR:
-            return "error";
-
-        case INIT:
-            return "intializing";
-
-        default:
-            return "unknown";
-    }
-}
-
-void Controller::setStatus(cStatus status)
-{
-    this->status = status;
-    displayStatus();
-}
-
-void Controller::displayStatus()
-{
-    printf("Controller::displayStatus()\r\n");
-    this->lcd->locate(0,0);
-    this->lcd->clearLine();
-    this->lcd->locate(0,0);
-    this->lcd->printf("Status: %s", statusString());
-}
-
-
-void Controller::lcdWriteLine(int row, string str)
-{
-    this->lcd->locate(0,row);
-    this->lcd->clearLine();
-    this->lcd->locate(0,row);
-    this->lcd->printf("%s", str);
-}
-
-//void Controller::nextCommand()
-//{
-//    std::vector<MCommand>::iterator it;
-//    it = commandList->begin();
-//    it = commandList->insert(it, commandList->back());
-//    it = commandList->begin();
-//    commandList->pop_back();
-//    it = commandList->begin();
-//    MCommand command = *it;
-//    printDesc(command->getCmd());
-//}
-
-void Controller::prevCommand()
-{
-
-}
-
-void Controller::sendCommandDem()
-{
-
-}
-
-void Controller::printCommandList()
-{
-    if(!initialized)
-    {
-        printf("Error: Controller must be initialized before calling %s!\r\n", __PRETTY_FUNCTION__);
-        return;
-    }
-    printf("\r\nCommand list printing\r\n\r\n");
-    if(commandList.size()) {
-        printf("The command list contains %d commands\r\n", commandList.size());
-        for(std::vector<MCommand>::iterator it = commandList.begin(); it != commandList.end(); ++it) {
-            /* std::cout << *it; ... */
-            it->print();
-        }
-    } else {
-        printf("Command list empty\r\n");
-    }
-}
-
-void Controller::initTables()
-{
-    printf("initTables\r\n");
-    picojson::array allTables = mAPI->getTablesAll().get("tables").get<picojson::array>();
-    printf("get first table\r\n");
-    picojson::value table = (picojson::value)allTables.begin();
-    int tableId = table.get("id");
-    printf("First table id is %d\r\n", tableId);
-    //for (picojson::array::iterator iter = list.begin(); iter != list.end(); ++iter) {
-//        printf("menu item value =%s\r\n", (*iter).get("v").get<string>().c_str());
-//    }
-}
-
-
-void Controller::testRequest()
-{
-    mAPI->getTablesAll();
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//Controller::Controller(TextLCD *lcd):
-//    status(WAITING),
-//    lcd(lcd)
-//{
-//    debug_build_number();
-//    printf("Controller constructor\r\n");
-////    this->lcd = lcd;
-//    //setStatus(WAITING);
-////    mAPI = new MotiVAPI("http://core.motiv.jvanbaarsen.com/v1/");
-//    displayStatus();
-////    devices.push_back(new <Device>Flower(1));
-////    devices.append(new Flower(2));
-////    devices.append(new Flower(3));
-//
-////    tables.append(new Table(1));
-////    tables.append(new Table(2));
-////    tables.append(new Table(3));
-//
-//    //tables stores Tables
-//    //Tables can be updated with information
-//    //Tables can be asked for commands to send
-//    //Tables will check changes between new info (this API update) and old info (previous API update)
-//    //Tables can use the Flower interface to build commands
-//
-//
-//    //Would like to have:
-//    //Sending commands in different thread than receiving api update
-//    //Commands then put into shared object commandQueue (FIFO)
-//
-////    initTables();
-//
-////    Test
-////    Table table(1);
-////    Table table2(2);
-////    vector<MCommand> insertVector;
-////    insertVector = table.update(1,0,0,0);
-////    printf("Updated first table\r\n");
-////    commandList.insert(commandList.begin(), insertVector.begin(), insertVector.end());
-////    printCommandList();
-////    insertVector = table2.update(2,0,0,0);
-////    printf("Updated second table\r\n");
-////    commandList.insert(commandList.begin(), insertVector.begin(), insertVector.end());
-//}
\ No newline at end of file
--- a/libMotiv/Controller.h	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-#ifndef MOTIV_CONTROLLER_H
-#define MOTIV_CONTROLLER_H
-
-//Controller
-#include <string>
-#include "mbed.h"
-#include "MotiVAPI.h"
-#include "Device.h"
-#include "Flower.h"
-#include "Table.h"
-#include "picojson.h"
-#include "EthernetInterface.h"
-#include "HTTPClient.h"
-#include <stdlib.h>
-#include <vector>
-
-class Controller {
-public:
-    enum cStatus {
-        READY,
-        WAITING,
-        BUSY,
-        ERROR,
-        INIT
-    };
-    Controller();
-    Controller(TextLCD *lcd);
-//    Controller(TextLCD *lcd, EthernetInterface *eth);
-    Controller& operator=(const Controller& c);
-    
-    
-    void init();
-    void testRequest();
-    cStatus getStatus();
-    string statusString();
-    void setStatus(cStatus);
-    void displayStatus();
-    
-    void lcdWriteLine(int row, string str);
-    void printDesc(int c);
-    
-    //DEMO PURPOSES
-    void nextCommand(); 
-    void prevCommand();
-    void sendCommandDem();
-    
-    //DEBUG
-    void printCommandList();
-    
-    /**
-        sendCommand() gets the first command from the command list and sends the command to the devices.
-    */
-    void sendCommand();
-    
-    TextLCD *lcd;
-    MotiVAPI *mAPI;
-    
-    
-    
-    bool connectAPI();
-    
-private:
-    bool initialized;
-    cStatus status;
-    void initTables();
-    
-    HTTPClient httpClient;
-    string endpoint;
-//    std::vector<Device*> devices;
-    vector <Table>tables;
-    vector <MCommand> commandList;
-};
-
-#endif
\ No newline at end of file
--- a/libMotiv/Device.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#include "Device.h"
-#include <stdlib.h>
-
-
-
-using namespace std;
-
-//MCommand
-MCommand::MCommand()
-    :id(0),
-     cmd(0),
-     val(0) {
-         printf("MCommand default constructor\r\n");
-         }
-
-MCommand::MCommand(char id, char cmd, char val)
-    :id(id),
-     cmd(cmd),
-     val(val)
-{
-    printf("MCommand::MCommand(%d, %d, %d)\r\n", id, cmd, val);
-}
-
-MCommand::~MCommand()
-{
-
-}
-
-MCommand& MCommand::operator=(const MCommand& mc)
-{
-    id = mc.id;
-    cmd = mc.cmd;
-    val = mc.val;
-    return *this;
-}
-
-char MCommand::getId()
-{
-    return id;
-}
-
-char MCommand::getCmd()
-{
-    return cmd;
-}
-
-char MCommand::getVal()
-{
-    return val;
-}
-
-void MCommand::print()
-{
-    printf(" This command's values are: id=%d, cmd=%d, val=%d\r\n", this->id, this->cmd, this->val);
-}
-
-
-//Device
-Device::Device()
-    :id(0) {
-        printf("Device default constructor\r\n");
-        }
-
-Device::Device(int id)
-    :id(id) {
-        printf("Device constructor override (int id)\r\n");
-        }
-
-Device::~Device()
-{
-
-}
-
-Device::Device(const Device& d)
-{
-    id = d.id;
-}
-
-Device& Device::operator=(const Device& d)
-{
-    id = d.id;
-    return *this;
-}
-
-int Device::getId() const
-{
-    return id;
-}
-
-MCommand Device::buildCommand(char cmd, char value)
-{
-    printf("Device::buildCommand(%d, %d) Device::id = %d\r\n", cmd, value, this->id);
-    MCommand retCmd(this->id, cmd, value);
-    printf("Command initialized\r\n");
-//    rc.id = id;
-//    printf("id set");
-//    rc.cmd = cmd;
-//    printf("cmd set");
-//    rc.val = value;
-//    printf("val set");
-//    rc.delim = DELIMITER;
-    printf("Command = %d, %d, %d\r\n", retCmd.getId(), retCmd.getCmd(), retCmd.getVal());
-    return retCmd;
-}
\ No newline at end of file
--- a/libMotiv/Device.h	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#ifndef MOTIV_DEVICE_H
-#define MOTIV_DEVICE_H
-
-#include <string>
-
-#define DELIMITER ';'
-
-//a default constructor that takes no arguments
-//a copy constructor ex: book(const &book b);
-//an overloaded assignment operato
-
-class MCommand
-{
-    public:
-    
-    MCommand();
-    MCommand(char id, char cmd, char val);
-    ~MCommand();
-    
-    MCommand& operator=(const MCommand& mc);
-    
-    char getId(), getCmd(), getVal();
-    void print();
-    
-    private:
-    char id, cmd, val;
-};
-
-
-
-class Device
-{
-public:
-    Device();
-    Device(int id);
-    ~Device();
-
-    Device(const Device& d);
-    Device& operator=(const Device& d);
-    
-    int getId() const;
-
-//private: 
-//    struct mCommand { //3 chars to be sent to the hardware
-//        char id; //device id
-//        char cmd; //command number
-//        char val; //command specific value
-//        char delim; //delimiter
-//    };
-    /**
-        mCommand buildCommand(int,int);
-    */
-    MCommand buildCommand(char cmd, char value);
-    
-protected:
-    
-    int id;
-
-private:
-
-
-};
-
-#endif
\ No newline at end of file
--- a/libMotiv/Flower.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-#include "Flower.h"
-#include <string>
-//#include <cstdlib>
-
-
-Flower::Flower()
-    :Device(0) {}
-
-Flower::Flower(int id)
-    :Device(id) {}
-
-Flower::~Flower()
-{
-
-}
-
-Flower::Flower(const Flower& f)
-{
-    id = f.getId();
-}
-
-Flower& Flower::operator=(const Flower& f)
-{
-    id = f.getId();
-    return *this;
-}
-
-void Flower::setLed(int state)
-{}
-
-//This can be in config file later on
-//Also, functions with a variable value should be settable
-
-std::string Flower::getCommandDesc(int c)
-{
-    switch(c) {
-        case fRESET:
-            return "reset";
-            break;
-        case fPETAL_SPD:
-            return "set petal speed";
-            break;
-        case fBLINK_SPD:
-            return "set blink speed";
-            break;
-//        fBLINK_PERIOD = 3,
-//        fLED_INTENSITY = 4,
-//        fPETAL_POS = 10,
-//        fLED_TABLE_FREE = 20,
-//        fLED_TABLE_RES = 21,
-//        fLED_FOOD = 22,
-//        fLED_DRINK = 23,
-//        fLED_SERVICE = 24,
-//        fLED_CLR = 29
-            /*        Flower version 2 commands n/a for now.
-            //        fPISTIL_SPD = 3,
-            //        fPETAL1_POS = 11,
-            //        fPETAL2_POS = 12,
-            //        fPETAL3_POS = 13,
-            //        fPETAL4_POS = 14,
-            //        fPETAL5_POS = 15,
-            //        fPETAL6_POS = 16,
-            //        fPISTIL_POS_FOOD = 30,
-            //        fPISTIL_POS_DRINKS = 31,
-            //        fPISTIL_POS_SERVICE = 32 */
-        case fTABLE_FREE:
-            return "table free";
-            break;
-        case fTABLE_ACTIVE:
-            return "table active";
-            break;
-        case fTABLE_RES:
-            return "table reserved";
-            break;
-//        fTABLE_END = 53,
-        case fFOOD_ORDERED:
-            return "food ordered";
-            break;
-            //fDRINKS_ORDERED = 55,
-//        fSERVICE_REQ = 56,
-//        fPETALS_CLOSE = 60,
-//        fLAMP_ACT = 100,
-        case fDEMO1:
-            return "demo program 1";
-            break;
-//        fDEMO2 = 102
-    }
-}
\ No newline at end of file
--- a/libMotiv/Flower.h	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-Flower commands v2
-Functie Waarde(n) Doel
-
-Primaire functies
-
-0* 0 Reset (Zet alle waarden terug naar default)
-1* 0 – 100 Zet bewegingssnelheid van de bladeren (0 langzaam, 100 snel)
-2 0 – 100 Zet knippersnelheid van de verlichting (in %)
-3 0 – 255 Zet knipperlengte van de verlichting (in sec)
-4 0 – 100 Zet de lichtintensiteit van de LEDstrip (0 – 100 %)
-5 0 – 100 Zet bewegingssnelheid van de stampers (Niet beschikbaar in bloem versie 1)
-6 0 – 255 Zet tijd
-10* 0 – 100 Zet de positie van de bloembladeren (0 dicht, 100 open)
-11 – 18 0 – 100 Zet de positie van (max. 8) individuele bloembladeren (0 dicht, 100 open) (Niet beschikbaar in bloem versie 1)
-20* 0 … 1 Zet led “tafel vrij”
-21* 0 … 1 Zet led “tafel gereserveerd”
-22* 0 … 1 Zet led F(ood)
-23* 0 … 1 Zet led D(rink)
-24* 0 … 1 Zet led S(ervice)
-29 0 … 1 Zet led verlichting (standaard wit)
-30 0 – 100 Zet hoogte van stamper F(ood) (Niet beschikbaar in bloem versie 1)
-31 0 – 100 Zet hoogte van stamper D(rink) (Niet beschikbaar in bloem versie 1)
-32 0 – 100 Zet hoogte van stamper S(ervice) (Niet beschikbaar in bloem versie 1)
-Complexe functies
-50* 1 Zet bloem naar stand “Tafel vrij” (Gesloten groen)
-51* 1 Zet bloem naar stand “Tafel in gebruik” (Open groen)
-52* 1 Zet bloem naar stand “Tafel gereserveerd” (Gesloten rood)
-53* 1 Zet bloem naar stand “Zittingstijd om” (Open rood)
-54* 0 – 100 Zet bloem naar stand “Eten besteld” met x% bestelstatus
-55* 0 – 100 Zet bloem naar stand “Drank besteld” met x% bestelstatus
-56* 0 – 100 Zet bloem naar stand “Bediening gevraagd” met x% bestelstatus
-60 1 Bloem sluit al naar gelang de ingestelde tijd
-61 1 Zet bloem naar status “zittingstijd om”. (“Gereserveerd rood knipperen”)
-100 1 Lampfunctie (Bloem opent een klein beetje en fungeert als lamp)
-101 1 Demostand 1 (Bloem gaat continu open en dicht en alle leds wisselen)
-102 0 – 100 Demostand 2 (Bloem opent naar stand X en statusleds wisselen)
-
-*/
-
-
-#ifndef MOTIV_FLOWER_H
-#define MOTIV_FLOWER_H
-
-#include "Device.h"
-#include <string>
-
-class Flower : public Device
-{
-public:
-    Flower();
-    Flower(int id);
-    ~Flower();
-
-    Flower(const Flower& f);
-    Flower& operator=(const Flower& f);
-    
-    enum fCOMMANDS {
-        fRESET = 0,
-        fPETAL_SPD = 1,
-        fBLINK_SPD = 2,
-        fBLINK_PERIOD = 3,
-        fLED_INTENSITY = 4,
-        fPETAL_POS = 10,
-        fLED_TABLE_FREE = 20,
-        fLED_TABLE_RES = 21,
-        fLED_FOOD = 22,
-        fLED_DRINK = 23,
-        fLED_SERVICE = 24,
-        fLED_CLR = 29,
-//        Flower version 2 commands n/a for now.
-//        fPISTIL_SPD = 3,
-//        fPETAL1_POS = 11,
-//        fPETAL2_POS = 12,
-//        fPETAL3_POS = 13,
-//        fPETAL4_POS = 14,
-//        fPETAL5_POS = 15,
-//        fPETAL6_POS = 16,
-//        fPISTIL_POS_FOOD = 30,
-//        fPISTIL_POS_DRINKS = 31,
-//        fPISTIL_POS_SERVICE = 32
-        fTABLE_FREE = 50,
-        fTABLE_ACTIVE = 51,
-        fTABLE_RES = 52,
-        fTABLE_END = 53,
-        fFOOD_ORDERED = 54,
-        fDRINKS_ORDERED = 55,
-        fSERVICE_REQ = 56,
-        fPETALS_CLOSE = 60,
-        fLAMP_ACT = 100,
-        fDEMO1 = 101,
-        fDEMO2 = 102
-    };
-private:
-
-
-public:
-    void setLed(int state); //Set THE LED to state. 0=off, 1=on
-    std::string getCommandDesc(int c);
-    
-    
-};
-
-#endif
\ No newline at end of file
--- a/libMotiv/MotiVAPI.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-#include "MotiVAPI.h"
-#include "EthernetInterface.h"
-#include "HTTPClient.h"
-#include "picojson.h"
-#include "MbedJSONValue.h"
-#include <string.h>
-#include <sstream>
-
-MotiVAPI::MotiVAPI(std::string url)
-    :   endpoint(url),
-        initialized(false)
-{
-    printf("MotiVAPI constructor\r\n");
-}
-
-MotiVAPI::~MotiVAPI()
-{
-
-}
-
-
-MotiVAPI& MotiVAPI::operator=(const MotiVAPI& rhs)
-{
-    this->endpoint = rhs.endpoint;
-    this->httpClient = rhs.httpClient;
-    return *this;
-}
-
-void MotiVAPI::init()
-{
-    initialized = true;
-}
-
-bool MotiVAPI::connectAPI()
-{
-    return false;
-}
-
-picojson::value MotiVAPI::getTable(int id)
-{
-    picojson::value jsonReply;
-    std::ostringstream stream;
-    stream << "/tables/" << id;
-    std::string request = stream.str();
-    return getAPIData(request);
-}
-
-picojson::value MotiVAPI::getTablesAll()
-{
-    printf("MotiVAPI::getTablesAll()\r\n");
-    picojson::value jsonReply;
-    return getAPIData("/tables");
-}
-
-picojson::value MotiVAPI::getAPIData(string request)
-{
-    printf("MotiVAPI::getAPIData(string request)\r\n");
-    string url = endpoint + request;
-
-    char curl[96];
-    strncpy(curl, url.c_str(), sizeof(curl));
-    curl[sizeof(curl) - 1] = '\0';
-    char httpResult[512];
-    int ret = httpClient.get(curl, httpResult, 2048);
-    if (!ret) {
-        printf("Page fetched successfully - read %d characters\r\n", strlen(httpResult));
-        printf("Result: %s\r\n", httpResult);
-    } else {
-        printf("Error - ret = %d - HTTP return code = %d\n", ret, httpClient.getHTTPResponseCode());
-    }
-
-    printf("Parse json\r\n");
-    picojson::value jsonVal;
-    printf("no more malloccing\r\n");
-    char *json = httpResult + '\0';
-    printf("sum string copying");
-//    strcpy(json, httpResult);
-    string err = picojson::parse(jsonVal, json, json + strlen(json));
-    printf("res error? %s\r\n", err.c_str());
-
-    return jsonVal;
-}
-
-
-
-//
-//
-//        //GET data
-//    printf("\nTrying to fetch page...\r\n");
-//    int ret = http.get("http://core.motiv.jvanbaarsen.com/v1/tables/7", str, 128);
-//    if (!ret)
-//    {
-//      printf("Page fetched successfully - read %d characters\r\n", strlen(str));
-//      printf("Result: %s\r\n", str);
-//      c.lcdWriteLine(1, str);
-//    }
-//    else
-//    {
-//      printf("Error - ret = %d - HTTP return code = %d\n", ret, http.getHTTPResponseCode());
-//    }
-//
-//    picojson::value jsonVal;
-//    char *json = (char*) malloc(strlen(str)+1);
-//    strcpy(json, str);
-//    string err = picojson::parse(jsonVal, json, json + strlen(json));
-//    printf("res error? %s\r\n", err.c_str());
-//
-//    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);
-//    printf("Code: %s\r\n", code);
--- a/libMotiv/MotiVAPI.h	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#ifndef MOTIV_API_H
-#define MOTIV_API_H
-#include "HTTPClient.h"
-#include "picojson.h"
-#include "EthernetInterface.h"
-#include <string>
-
-using namespace std;
-
-class MotiVAPI
-{
-    public:
-    MotiVAPI();
-    MotiVAPI(string url);
-    ~MotiVAPI();
-    
-    MotiVAPI(const MotiVAPI&);
-    MotiVAPI& operator=(const MotiVAPI&);
-    
-    void init();
-    
-    picojson::value getTable(int id);
-    picojson::value getTablesAll();
-    
-    
-    
-    bool connectAPI();
-    
-    private:
-    //Add network connection
-    
-    string endpoint;
-    bool initialized;
-    picojson::value getAPIData(string request);
-    HTTPClient httpClient;
-};
-
-#endif
\ No newline at end of file
--- a/libMotiv/Table.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-#include "Table.h"
-#include "Flower.h"
-#include "Device.h"
-#include "stdlib.h"
-#include <vector>
-//Flower commands
-//        fRESET = 0,
-//        fPETAL_SPD = 1,
-//        fBLINK_SPD = 2,
-//        fBLINK_PERIOD = 3,
-//        fLED_INTENSITY = 4,
-//        fPETAL_POS = 10,
-//        fLED_TABLE_FREE = 20,
-//        fLED_TABLE_RES = 21,
-//        fLED_FOOD = 22,
-//        fLED_DRINK = 23,
-//        fLED_SERVICE = 24,
-//        fLED_CLR = 29,
-////        Flower version 2 commands n/a for now.
-////        fPISTIL_SPD = 3,
-////        fPETAL1_POS = 11,
-////        fPETAL2_POS = 12,
-////        fPETAL3_POS = 13,
-////        fPETAL4_POS = 14,
-////        fPETAL5_POS = 15,
-////        fPETAL6_POS = 16,
-////        fPISTIL_POS_FOOD = 30,
-////        fPISTIL_POS_DRINKS = 31,
-////        fPISTIL_POS_SERVICE = 32
-//        fTABLE_FREE = 50,
-//        fTABLE_ACTIVE = 51,
-//        fTABLE_RES = 52,
-//        fTABLE_END = 53,
-//        fFOOD_ORDERED = 54,
-//        fDRINKS_ORDERED = 55,
-//        fSERVICE_REQ = 56,
-//        fPETALS_CLOSE = 60,
-//        fLAMP_ACT = 100,
-//        fDEMO1 = 101,
-//        fDEMO2 = 102
-//Flower commands v2
-//Functie Waarde(n) Doel
-//
-//Primaire functies
-//
-//0* 0 Reset (Zet alle waarden terug naar default)
-//1* 0 – 100 Zet bewegingssnelheid van de bladeren (0 langzaam, 100 snel)
-//2 0 – 100 Zet knippersnelheid van de verlichting (in %)
-//3 0 – 255 Zet knipperlengte van de verlichting (in sec)
-//4 0 – 100 Zet de lichtintensiteit van de LEDstrip (0 – 100 %)
-//5 0 – 100 Zet bewegingssnelheid van de stampers (Niet beschikbaar in bloem versie 1)
-//6 0 – 255 Zet tijd
-//10* 0 – 100 Zet de positie van de bloembladeren (0 dicht, 100 open)
-//11 – 18 0 – 100 Zet de positie van (max. 8) individuele bloembladeren (0 dicht, 100 open) (Niet beschikbaar in bloem versie 1)
-//20* 0 … 1 Zet led “tafel vrij”
-//21* 0 … 1 Zet led “tafel gereserveerd”
-//22* 0 … 1 Zet led F(ood)
-//23* 0 … 1 Zet led D(rink)
-//24* 0 … 1 Zet led S(ervice)
-//29 0 … 1 Zet led verlichting (standaard wit)
-//30 0 – 100 Zet hoogte van stamper F(ood) (Niet beschikbaar in bloem versie 1)
-//31 0 – 100 Zet hoogte van stamper D(rink) (Niet beschikbaar in bloem versie 1)
-//32 0 – 100 Zet hoogte van stamper S(ervice) (Niet beschikbaar in bloem versie 1)
-//Complexe functies
-//50* 1 Zet bloem naar stand “Tafel vrij” (Gesloten groen)
-//51* 1 Zet bloem naar stand “Tafel in gebruik” (Open groen)
-//52* 1 Zet bloem naar stand “Tafel gereserveerd” (Gesloten rood)
-//53* 1 Zet bloem naar stand “Zittingstijd om” (Open rood)
-//54* 0 – 100 Zet bloem naar stand “Eten besteld” met x% bestelstatus
-//55* 0 – 100 Zet bloem naar stand “Drank besteld” met x% bestelstatus
-//56* 0 – 100 Zet bloem naar stand “Bediening gevraagd” met x% bestelstatus
-//60 1 Bloem sluit al naar gelang de ingestelde tijd
-//61 1 Zet bloem naar status “zittingstijd om”. (“Gereserveerd rood knipperen”)
-//100 1 Lampfunctie (Bloem opent een klein beetje en fungeert als lamp)
-//101 1 Demostand 1 (Bloem gaat continu open en dicht en alle leds wisselen)
-//102 0 – 100 Demostand 2 (Bloem opent naar stand X en statusleds wisselen)
-
-using namespace std;
-
-Table::Table()
-    :   id(0),
-        status(0),
-        fStatus(0),
-        dStatus(0),
-        sStatus(0),
-        statusPrev(0),
-        fStatusPrev(0),
-        dStatusPrev(0),
-        sStatusPrev(0)  { printf("Table default constructor\r\n"); }
-
-Table::Table(int id)
-    :   id(id),
-        status(0),
-        fStatus(0),
-        dStatus(0),
-        sStatus(0),
-        statusPrev(0),
-        fStatusPrev(0),
-        dStatusPrev(0),
-        sStatusPrev(0),
-        mFlower(id)
-{
-    printf("Table constructor override(int id)\r\n");
-    }
-
-Table::~Table() {}
-
-Table& Table::operator=(const Table& tbl)
-{
-    id = tbl.id;
-    status = tbl.status;
-    fStatus = tbl.fStatus;
-    dStatus = tbl.dStatus;
-    sStatus = tbl.sStatus;
-    statusPrev = tbl.statusPrev;
-    fStatusPrev = tbl.fStatusPrev;
-    dStatusPrev = tbl.dStatusPrev;
-    sStatusPrev = tbl.sStatusPrev;
-    return *this;
-}
-
-vector<MCommand> Table::update(int dinnerStatus, int foodStatus, int drinkStatus, int serviceStatus)
-{
-    printf("update table\r\n");
-    //current info is now previous info
-    statusPrev = status;
-    fStatusPrev = fStatus;
-    dStatusPrev = dStatus;
-    sStatusPrev = sStatus;
-
-
-    //new info from API is current info
-    status = dinnerStatus;
-    fStatus = foodStatus;
-    dStatus = drinkStatus;
-    sStatus = serviceStatus;
-
-    printf("dinnerStatus = %d\r\nstatus = %d\r\nstatusPrev = %d\r\n", dinnerStatus, status, statusPrev);
-    //make and "send" the commands to control the devices to the controller
-    return prepareCommands();
-}
-
-int Table::getId()
-{
-    return this->id;
-}
-
-vector<MCommand> Table::prepareCommands()
-{
-    vector<MCommand> commandList;
-    printf("prepareCommands()\r\n");
-    //Decide what commands to retrieve from the flower
-    if(status != statusPrev) { //dinner status has changed since last update
-        if(status == 0) { //Table free
-            printf("status == 0\r\n");
-            commandList.push_back(mFlower.buildCommand(Flower::fPETAL_POS, 0));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_TABLE_FREE, 1));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_FOOD, 0));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_DRINK, 0));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_SERVICE, 0));
-        } else if(status == 1) { //Table reserved
-            printf("status == 1\r\n");
-//            commandList.push_back(mFlower.buildCommand(Flower::fPETAL_POS, 0));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_TABLE_RES, 1)); //For now assume that table reserved is only called after table free
-//            MCommand leCmd = mFlower.buildCommand(Flower::fLED_TABLE_RES, 1);
-            printf("Command in prepCommands");
-//            leCmd.print();
-//            vector<MCommand> cmdLst;
-//            cmdLst.push_back(leCmd);
-            printf("pushed_back?\r\n");
-//            std::vector<MCommand>::iterator it = commandList.begin();
-//            printf("leDeux command: ");
-//            it->print();
-//            commandList.push_back(mFlower.buildCommand(Flower::fLED_FOOD, 0));
-//            commandList.push_back(mFlower.buildCommand(Flower::fLED_DRINK, 0));
-//            commandList.push_back(mFlower.buildCommand(Flower::fLED_SERVICE, 0));
-        } else if(status >= 2) { //Table occupied
-            printf("status == 2\r\n");
-            commandList.push_back(mFlower.buildCommand(Flower::fPETAL_POS, 0));
-            commandList.push_back(mFlower.buildCommand(Flower::fLED_CLR, 1));
-        }
-        printf("dinnerStatus commands done\r\n");
-    }
-    if(fStatus != fStatusPrev) {
-        printf("foodStatus commands done\r\n");        
-    }
-    if(dStatus != dStatusPrev) {
-        printf("drinksStatus commands done\r\n");
-    }
-    if(sStatus != sStatusPrev) {
-        printf("serviceStatus commands done\r\n");
-    }
-    printf("all commands done\r\n");
-    return commandList;
-}
\ No newline at end of file
--- a/libMotiv/Table.h	Tue Jan 06 22:18:27 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#ifndef MOTIV_TABLE_H
-#define MOTIV_TABLE_H
-
-#include "Device.h"
-#include "Flower.h"
-#include <stdlib.h>
-#include <vector>
-
-using namespace std;
-
-class Table {
-    public:
-    Table();
-    Table(int id);
-    ~Table();
-    
-    
-    Table& operator=(const Table& tbl);
-    
-    int getId();
-    
-    vector<MCommand> update(int dinnerStatus,int foodStatus,int drinkStatus,int serviceStatus);
-    int getNextCommand();
-    
-    
-    private:
-    int id, status, fStatus, dStatus, sStatus;
-    int statusPrev, fStatusPrev, dStatusPrev, sStatusPrev;
-    
-    Flower mFlower;
-    
-    //"table":{"id":7,"code":"vrij","food":0,"service":0,"drink":0,"dinner_status":0}
-    
-    vector<MCommand> prepareCommands();
-    
-    };
-    
-#endif
\ No newline at end of file
--- a/main.cpp	Tue Jan 06 22:18:27 2015 +0000
+++ b/main.cpp	Tue Jan 06 23:02:11 2015 +0000
@@ -60,9 +60,9 @@
     eth.init();
     eth.connect();
     printf("int main()\r\n");
-    c.init();
+//    c.init();
     c.printCommandList();
-    c.testRequest();
+//    c.testRequest();
 //    setup();
 //
 //    pc.printf("Entering loop\r\n");
--- a/mbed-rtos.lib	Tue Jan 06 22:18:27 2015 +0000
+++ b/mbed-rtos.lib	Tue Jan 06 23:02:11 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed-rtos/#13a25134ac60
+http://mbed.org/users/mbed_official/code/mbed-rtos/#28712e303960