cmd handler stuff
This commit is contained in:
parent
ab3a6ac5ac
commit
0a2e630231
@ -82,7 +82,7 @@ const static cmd_t COMMANDS[] = {
|
|||||||
// returns -1 to close the connection
|
// returns -1 to close the connection
|
||||||
// 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 *cmdLine, bool resetConfigMode) {
|
||||||
const static uint8_t HELP_MSG[] = \
|
const static uint8_t HELP_MSG[] = \
|
||||||
"Usage\n\r" \
|
"Usage\n\r" \
|
||||||
"\n\r" \
|
"\n\r" \
|
||||||
@ -104,7 +104,8 @@ int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int8_t retCode = 0;
|
int8_t retCode = 0;
|
||||||
coloredMsg(LOG_YELLOW, "cec, cmd is %s", cmd);
|
char *cmd = strtok(cmdLine, ' ');
|
||||||
|
coloredMsg(LOG_YELLOW, "cec, cmdLine is %s, cmd is %s", cmdLine);
|
||||||
if (0 == strcmp(cmd, "quit")) {
|
if (0 == strcmp(cmd, "quit")) {
|
||||||
messageToSend = GOODBYE_MSG;
|
messageToSend = GOODBYE_MSG;
|
||||||
retCode = -1;
|
retCode = -1;
|
||||||
@ -146,7 +147,6 @@ int8_t cmdExecuteCommand(uint8_t *cmd, bool resetConfigMode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (messageToSend) {
|
if (messageToSend) {
|
||||||
send(CMD_SOCK, messageToSend, strlen(messageToSend));
|
send(CMD_SOCK, messageToSend, strlen(messageToSend));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user