Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TextLCD MbedJSONValue libMotiv picojson mbed-rtos mbed
Fork of Mbed_MotiVControllerBox by
library/Controller.h@2:ad4509a9d051, 2014-12-02 (annotated)
- Committer:
- TimWoo
- Date:
- Tue Dec 02 20:51:18 2014 +0000
- Revision:
- 2:ad4509a9d051
- Parent:
- 1:d54aed10ddf3
Messy sandbox, need to tidy up into the classes
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TimWoo | 0:2279181caaa1 | 1 | #ifndef MOTIV_CONTROLLER_H |
| TimWoo | 0:2279181caaa1 | 2 | #define MOTIV_CONTROLLER_H |
| TimWoo | 0:2279181caaa1 | 3 | |
| TimWoo | 0:2279181caaa1 | 4 | //Controller |
| TimWoo | 0:2279181caaa1 | 5 | #include <string> |
| TimWoo | 0:2279181caaa1 | 6 | #include "mbed.h" |
| TimWoo | 1:d54aed10ddf3 | 7 | #include "MotiVAPI.h" |
| TimWoo | 1:d54aed10ddf3 | 8 | #include "Device.h" |
| TimWoo | 1:d54aed10ddf3 | 9 | #include "Flower.h" |
| TimWoo | 1:d54aed10ddf3 | 10 | #include "Table.h" |
| TimWoo | 1:d54aed10ddf3 | 11 | #include <stdlib.h> |
| TimWoo | 1:d54aed10ddf3 | 12 | #include <vector> |
| TimWoo | 0:2279181caaa1 | 13 | |
| TimWoo | 0:2279181caaa1 | 14 | class Controller { |
| TimWoo | 0:2279181caaa1 | 15 | public: |
| TimWoo | 0:2279181caaa1 | 16 | enum cStatus { |
| TimWoo | 0:2279181caaa1 | 17 | READY, |
| TimWoo | 0:2279181caaa1 | 18 | WAITING, |
| TimWoo | 0:2279181caaa1 | 19 | BUSY, |
| TimWoo | 1:d54aed10ddf3 | 20 | ERROR, |
| TimWoo | 1:d54aed10ddf3 | 21 | INIT |
| TimWoo | 0:2279181caaa1 | 22 | }; |
| TimWoo | 0:2279181caaa1 | 23 | Controller(TextLCD *lcd); |
| TimWoo | 0:2279181caaa1 | 24 | cStatus getStatus(); |
| TimWoo | 0:2279181caaa1 | 25 | string statusString(); |
| TimWoo | 0:2279181caaa1 | 26 | void setStatus(cStatus); |
| TimWoo | 0:2279181caaa1 | 27 | void displayStatus(); |
| TimWoo | 0:2279181caaa1 | 28 | |
| TimWoo | 1:d54aed10ddf3 | 29 | void lcdWriteLine(int row, string str); |
| TimWoo | 1:d54aed10ddf3 | 30 | void printDesc(int c); |
| TimWoo | 1:d54aed10ddf3 | 31 | |
| TimWoo | 1:d54aed10ddf3 | 32 | //DEMO PURPOSES |
| TimWoo | 1:d54aed10ddf3 | 33 | void nextCommand(); |
| TimWoo | 1:d54aed10ddf3 | 34 | void prevCommand(); |
| TimWoo | 1:d54aed10ddf3 | 35 | void sendCommandDem(); |
| TimWoo | 0:2279181caaa1 | 36 | |
| TimWoo | 1:d54aed10ddf3 | 37 | /** |
| TimWoo | 1:d54aed10ddf3 | 38 | sendCommand() gets the first command from the command list and sends the command to the devices. |
| TimWoo | 1:d54aed10ddf3 | 39 | */ |
| TimWoo | 1:d54aed10ddf3 | 40 | void sendCommand(); |
| TimWoo | 1:d54aed10ddf3 | 41 | |
| TimWoo | 1:d54aed10ddf3 | 42 | TextLCD *lcd; |
| TimWoo | 1:d54aed10ddf3 | 43 | // MotiVAPI *mapi; |
| TimWoo | 0:2279181caaa1 | 44 | |
| TimWoo | 0:2279181caaa1 | 45 | private: |
| TimWoo | 1:d54aed10ddf3 | 46 | cStatus status; |
| TimWoo | 1:d54aed10ddf3 | 47 | |
| TimWoo | 1:d54aed10ddf3 | 48 | Flower* flower; |
| TimWoo | 1:d54aed10ddf3 | 49 | // std::vector<Device*> devices; |
| TimWoo | 1:d54aed10ddf3 | 50 | // vector <Table>tables |
| TimWoo | 1:d54aed10ddf3 | 51 | vector <Device::mCommand>commandList; |
| TimWoo | 0:2279181caaa1 | 52 | }; |
| TimWoo | 0:2279181caaa1 | 53 | |
| TimWoo | 0:2279181caaa1 | 54 | #endif |
