First version
Dependencies: mbed EthernetInterface mbed-rto
Interpreter.h@81:56e9873f29df, 2018-05-16 (annotated)
- Committer:
- albireo987
- Date:
- Wed May 16 12:22:43 2018 +0000
- Revision:
- 81:56e9873f29df
- Parent:
- 77:6477a4fefa70
definitieve demo versie
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
KlaasGovaerts | 3:0d013b7e4dea | 1 | #include "rtos.h" |
KlaasGovaerts | 5:9903a0906a72 | 2 | #include "TCPlistener.h" |
KlaasGovaerts | 3:0d013b7e4dea | 3 | |
KlaasGovaerts | 18:5ee34e60a31d | 4 | #ifndef INTERPRETER_H |
KlaasGovaerts | 18:5ee34e60a31d | 5 | #define INTERPRETER_H |
KlaasGovaerts | 75:31c15986b85e | 6 | |
KlaasGovaerts | 75:31c15986b85e | 7 | /** |
KlaasGovaerts | 75:31c15986b85e | 8 | * Class used to interpret text commands. |
KlaasGovaerts | 75:31c15986b85e | 9 | */ |
KlaasGovaerts | 18:5ee34e60a31d | 10 | class Interpreter{ |
KlaasGovaerts | 3:0d013b7e4dea | 11 | private: |
KlaasGovaerts | 75:31c15986b85e | 12 | /** |
KlaasGovaerts | 75:31c15986b85e | 13 | * Convert a direction such as left, right, up, down to the corresponding number (0, 1, 2 or 3). |
KlaasGovaerts | 75:31c15986b85e | 14 | * Invalid directions (or ignore) will return 4. |
KlaasGovaerts | 75:31c15986b85e | 15 | * @param command A character array representing the direction. |
KlaasGovaerts | 75:31c15986b85e | 16 | */ |
KlaasGovaerts | 3:0d013b7e4dea | 17 | int directionToNumber(char* direction); |
KlaasGovaerts | 30:915f6cb7ffa5 | 18 | Queue<int,8>* queue; |
KlaasGovaerts | 24:bf62c46acb3e | 19 | int LED[8]; |
KlaasGovaerts | 3:0d013b7e4dea | 20 | public: |
KlaasGovaerts | 75:31c15986b85e | 21 | |
KlaasGovaerts | 75:31c15986b85e | 22 | /** |
KlaasGovaerts | 77:6477a4fefa70 | 23 | * @param queue A pointer to the queue where the results will be written. |
KlaasGovaerts | 75:31c15986b85e | 24 | */ |
KlaasGovaerts | 30:915f6cb7ffa5 | 25 | Interpreter(Queue<int,8>* queue); |
KlaasGovaerts | 75:31c15986b85e | 26 | |
KlaasGovaerts | 75:31c15986b85e | 27 | /** |
KlaasGovaerts | 75:31c15986b85e | 28 | * Interprets a text command, and push the result on the queue. |
KlaasGovaerts | 75:31c15986b85e | 29 | * Syntax: |
KlaasGovaerts | 75:31c15986b85e | 30 | * The number of the LED |
KlaasGovaerts | 75:31c15986b85e | 31 | * Dash (-) |
KlaasGovaerts | 75:31c15986b85e | 32 | * The orientation (left,right,up,down or ignore). |
KlaasGovaerts | 75:31c15986b85e | 33 | * Multiple LEDS can be set up in one command, by using a whitespace. |
KlaasGovaerts | 75:31c15986b85e | 34 | * Example: 0-left 1-right 2-up |
KlaasGovaerts | 75:31c15986b85e | 35 | * @param command A character array representing the command. |
KlaasGovaerts | 75:31c15986b85e | 36 | */ |
KlaasGovaerts | 15:ffd311730575 | 37 | void executeCommand(char* command); |
KlaasGovaerts | 3:0d013b7e4dea | 38 | }; |
KlaasGovaerts | 3:0d013b7e4dea | 39 | #endif |