/* ** =================================================================== ** Method : CLS1_ParseCommand (component Shell) ** Description : ** Parses a shell command. Use 'help' to get a list of ** supported commands. ** Parameters : ** NAME - DESCRIPTION ** * cmd - Pointer to command string ** * handled - Pointer to variable to indicate if ** the command has been handled. The caller ** passes this variable to the command scanner ** to find out if the passed command has been ** handled. The variable is initialized by the ** caller. ** * io - Pointer to I/O callbacks ** Returns : ** --- - Error code ** =================================================================== */ uint8_t CLS1_ParseCommand(const uint8_t *cmd, bool *handled, CLS1_ConstStdIOType *io) { if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "CLS1 help")==0) { CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)CLS1_DASH_LINE, io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)"TWR-KV58F220M", io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)CLS1_DASH_LINE, io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendHelpStr((unsigned char*)"CLS1", (const unsigned char*)"Group of CLS1 commands\r\n", io->stdOut); CLS1_SendHelpStr((unsigned char*)" help|status", (const unsigned char*)"Print help or status information\r\n", io->stdOut); #if CLS1_ECHO_ENABLED CLS1_SendHelpStr((unsigned char*)" echo (on|off)", (const unsigned char*)"Turn echo on or off\r\n", io->stdOut); #endif *handled = TRUE; return ERR_OK; #if CLS1_ECHO_ENABLED } else if ((UTIL1_strcmp((char*)cmd, "CLS1 echo on")==0)) { *handled = TRUE; CLS1_EchoEnabled = TRUE; return ERR_OK; } else if ((UTIL1_strcmp((char*)cmd, "CLS1 echo off")==0)) { *handled = TRUE; CLS1_EchoEnabled = FALSE; return ERR_OK; #endif } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "CLS1 status")==0)) { *handled = TRUE; return CLS1_PrintStatus(io); } return ERR_OK; /* no error */ }
/* ** =================================================================== ** Method : CLS1_ParseCommand (component Shell) ** Description : ** Parses a shell command. Use 'help' to get a list of ** supported commands. ** Parameters : ** NAME - DESCRIPTION ** * cmd - Pointer to command string ** * handled - Pointer to variable to indicate if ** the command has been handled. The caller ** passes this variable to the command scanner ** to find out if the passed command has been ** handled. The variable is initialized by the ** caller. ** * io - Pointer to I/O callbacks ** Returns : ** --- - Error code ** =================================================================== */ uint8_t CLS1_ParseCommand(const uint8_t *cmd, bool *handled, CLS1_ConstStdIOType *io) { if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "CLS1 help")==0) { CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)CLS1_DASH_LINE, io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)"FRDM-KL25Z Master INTRO", io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendStr((unsigned char*)CLS1_DASH_LINE, io->stdOut); CLS1_SendStr((unsigned char*)"\r\n", io->stdOut); CLS1_SendHelpStr((unsigned char*)"CLS1", (const unsigned char*)"Group of CLS1 commands\r\n", io->stdOut); CLS1_SendHelpStr((unsigned char*)" help|status", (const unsigned char*)"Print help or status information\r\n", io->stdOut); *handled = TRUE; return ERR_OK; } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "CLS1 status")==0)) { *handled = TRUE; return CLS1_PrintStatus(io); } return ERR_OK; /* no error */ }