3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
Diff: commander.h
- Revision:
- 6:98fe30430194
- Parent:
- 3:843b830ee8bd
- Child:
- 8:e1da2ae62885
diff -r 6ef2d954fca3 -r 98fe30430194 commander.h --- a/commander.h Mon Nov 16 01:26:41 2015 +0000 +++ b/commander.h Mon Nov 16 05:10:17 2015 +0000 @@ -1,27 +1,29 @@ -#include "mbed.h" +// +// commander.h +// Created by Chandan Siyag on 14/11/2015. + #include "globals.h" -#ifndef COMMANDER_INCLUDED -#define COMMANDER_INCLUDED +#ifndef _commander_h_ +#define _commander_h_ -enum Type { INVALID = -1, QUERY = 0, SET, REPLY }; -enum CObject { MBED = 0, COLOUR_SENSOR, SERVOS, BEAM_SENSOR }; -typedef struct { - char inputString[80]; - char outputString[80]; - - char commandType[1]; - char commandObject[20]; - char commandString[59]; - - Type typeEnum; - CObject objectEnum; -} Command; - +class Commander { +public: + Commander(); + + CommandTypeRaw typeRaw; + char typeChar; + std::string object; + std::string command; + + void decodeCommand(CommandTypeRaw type); + std::string description(); + + virtual ~Commander(); + +private: + void readCommandObject(); +}; -Type listenForCommand(); -void recieveCommand(Command *cmd, Type type); -void decodeCommand(Command *cmd); - -#endif +#endif \ No newline at end of file