cmd handler stuff

This commit is contained in:
Wolfgang Hottgenroth 2020-11-16 15:16:06 +01:00
parent cdc47dfd4f
commit dabf838bbe
Signed by: wn
GPG Key ID: 6C1E5E531E0D5D7F

View File

@ -42,6 +42,17 @@ bool clearCmd() {
// returns 1 to toggle to config mode
// returns 2 to toggle back to default mode
int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
const static uint8_t HELP_MSG[] = \
"Usage\n\r" \
"\n\r" \
"help ................................. Show this help page\n\r" \
"quit ................................. Terminate the console session\n\r" \
"enable ............................... Enable configuration mode\n\r" \
"disable .............................. Disable configuration mode\n\r" \
"clear ................................ Clears the global Meterbus\n\r" \
" statistics\n\r" \
" Required configuration mode\n\r" \
;
const static uint8_t GOODBYE_MSG[] = "Good bye\n\r";
const static uint8_t OK_MSG[] = "OK\n\r";
const static uint8_t FAILED_MSG[] = "Failed\n\r";
@ -59,6 +70,9 @@ int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
if (0 == strcmp(cmd, "quit")) {
messageToSend = GOODBYE_MSG;
retCode = -1;
} else if (0 == strcmp(cmd, "help")) {
messageToSend = HELP_MSG;
retCode = -1;
} else if (0 == strcmp(cmd, "enable")) {
coloredMsg(LOG_YELLOW, "cec, enable config mode");
configMode = true;