cmd handler stuff
This commit is contained in:
parent
cdc47dfd4f
commit
dabf838bbe
@ -42,6 +42,17 @@ bool clearCmd() {
|
|||||||
// returns 1 to toggle to config mode
|
// returns 1 to toggle to config mode
|
||||||
// returns 2 to toggle back to default mode
|
// returns 2 to toggle back to default mode
|
||||||
int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
|
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 GOODBYE_MSG[] = "Good bye\n\r";
|
||||||
const static uint8_t OK_MSG[] = "OK\n\r";
|
const static uint8_t OK_MSG[] = "OK\n\r";
|
||||||
const static uint8_t FAILED_MSG[] = "Failed\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")) {
|
if (0 == strcmp(cmd, "quit")) {
|
||||||
messageToSend = GOODBYE_MSG;
|
messageToSend = GOODBYE_MSG;
|
||||||
retCode = -1;
|
retCode = -1;
|
||||||
|
} else if (0 == strcmp(cmd, "help")) {
|
||||||
|
messageToSend = HELP_MSG;
|
||||||
|
retCode = -1;
|
||||||
} else if (0 == strcmp(cmd, "enable")) {
|
} else if (0 == strcmp(cmd, "enable")) {
|
||||||
coloredMsg(LOG_YELLOW, "cec, enable config mode");
|
coloredMsg(LOG_YELLOW, "cec, enable config mode");
|
||||||
configMode = true;
|
configMode = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user