xrocusOS_ADXL355 version

Dependencies:   mbed SDFileSystem

Committer:
Inscape_ao
Date:
Sat Apr 20 09:23:39 2019 +0000
Revision:
0:c347f602596d
Child:
1:71c9c97c9f3d
create UartReceiver, CommandParser

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Inscape_ao 0:c347f602596d 1 #ifndef _COMMANDPARSER_H_
Inscape_ao 0:c347f602596d 2 #define _COMMANDPARSER_H_
Inscape_ao 0:c347f602596d 3
Inscape_ao 0:c347f602596d 4 #include "UartReceiver.h"
Inscape_ao 0:c347f602596d 5
Inscape_ao 0:c347f602596d 6 typedef struct _command_parser_rule_s {
Inscape_ao 0:c347f602596d 7 char* cmdName;
Inscape_ao 0:c347f602596d 8 int(*func)(char*);
Inscape_ao 0:c347f602596d 9 } CmdParseRule;
Inscape_ao 0:c347f602596d 10
Inscape_ao 0:c347f602596d 11 class CommandParser
Inscape_ao 0:c347f602596d 12 {
Inscape_ao 0:c347f602596d 13 public:
Inscape_ao 0:c347f602596d 14 const static int CmdNameLen = 3;
Inscape_ao 0:c347f602596d 15 const static int CmdLen = sizeof(":0 CMD 0000") - 1 /* EOL */;
Inscape_ao 0:c347f602596d 16 private:
Inscape_ao 0:c347f602596d 17 int deviceID;
Inscape_ao 0:c347f602596d 18 UartReceiver *pR;
Inscape_ao 0:c347f602596d 19 Serial *pUart;
Inscape_ao 0:c347f602596d 20 CmdParseRule *ruleTable;
Inscape_ao 0:c347f602596d 21 int ruleTableLen;
Inscape_ao 0:c347f602596d 22 private:
Inscape_ao 0:c347f602596d 23 CommandParser(void);
Inscape_ao 0:c347f602596d 24 public:
Inscape_ao 0:c347f602596d 25 CommandParser(UartReceiver *setUartReceiver, int setDeviceID,
Inscape_ao 0:c347f602596d 26 CmdParseRule *setRuleTable, int setRuleTableLen);
Inscape_ao 0:c347f602596d 27 void run(void);
Inscape_ao 0:c347f602596d 28 int parse(char *pStr);
Inscape_ao 0:c347f602596d 29
Inscape_ao 0:c347f602596d 30 };
Inscape_ao 0:c347f602596d 31 #endif /* _COMMANDPARSER_H_ */