xrocusOS_ADXL355 version
Dependencies: mbed SDFileSystem
Diff: include/CommandParser.h
- Revision:
- 0:c347f602596d
- Child:
- 1:71c9c97c9f3d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/CommandParser.h Sat Apr 20 09:23:39 2019 +0000 @@ -0,0 +1,31 @@ +#ifndef _COMMANDPARSER_H_ +#define _COMMANDPARSER_H_ + +#include "UartReceiver.h" + +typedef struct _command_parser_rule_s { + char* cmdName; + int(*func)(char*); +} CmdParseRule; + +class CommandParser +{ +public: + const static int CmdNameLen = 3; + const static int CmdLen = sizeof(":0 CMD 0000") - 1 /* EOL */; +private: + int deviceID; + UartReceiver *pR; + Serial *pUart; + CmdParseRule *ruleTable; + int ruleTableLen; +private: + CommandParser(void); +public: + CommandParser(UartReceiver *setUartReceiver, int setDeviceID, + CmdParseRule *setRuleTable, int setRuleTableLen); + void run(void); + int parse(char *pStr); + +}; +#endif /* _COMMANDPARSER_H_ */ \ No newline at end of file