UART Command Parser Time Manager Data Store for SD Card for stm32l476 [it's not Licensed as BSD/GPLx]
Dependencies: mbed SDFileSystem
Diff: include/CommandParser.h
- Revision:
- 1:71c9c97c9f3d
- Parent:
- 0:c347f602596d
- Child:
- 2:a694440145e9
diff -r c347f602596d -r 71c9c97c9f3d include/CommandParser.h --- a/include/CommandParser.h Sat Apr 20 09:23:39 2019 +0000 +++ b/include/CommandParser.h Sun Apr 21 02:50:19 2019 +0000 @@ -3,9 +3,11 @@ #include "UartReceiver.h" +class CommandParser; + typedef struct _command_parser_rule_s { char* cmdName; - int(*func)(char*); + int(*func)(CommandParser*, char*); } CmdParseRule; class CommandParser @@ -13,6 +15,14 @@ public: const static int CmdNameLen = 3; const static int CmdLen = sizeof(":0 CMD 0000") - 1 /* EOL */; + class CmdReply + { + public: + const static int Success = 0; + const static int InvalidFmt = 1; + const static int InvalidCmd = 2; + const static int InvalidLen = 3; + }; private: int deviceID; UartReceiver *pR; @@ -26,6 +36,8 @@ CmdParseRule *setRuleTable, int setRuleTableLen); void run(void); int parse(char *pStr); - + int getDeviceID(void); + void reply(bool ack = true, int replyCode = 0); + void reply(bool ack, char *replyStr); }; #endif /* _COMMANDPARSER_H_ */ \ No newline at end of file