/*! * \brief Parses a command * \param cmd Command string to be parsed * \param handled Sets this variable to TRUE if command was handled * \param io I/O stream to be used for input/output * \return Error code, ERR_OK if everything was fine */ uint8_t TRACE_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) { if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace help")==0) { TRACE_PrintHelp(io); *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace status")==0) { TRACE_PrintStatus(io); *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace shell")==0) { traceChannel = TRACE_TO_SHELL; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace none")==0) { traceChannel = TRACE_TO_NONE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel on")==0) { traceAccel = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel off")==0) { traceAccel = FALSE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"magnetometer on")==0) { traceMagnetometer = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"magnetometer off")==0) { traceMagnetometer = FALSE; *handled = TRUE; } return ERR_OK; }
/*! * \brief Parses a command * \param cmd Command string to be parsed * \param handled Sets this variable to TRUE if command was handled * \param io I/O stream to be used for input/output * \return Error code, ERR_OK if everything was fine */ uint8_t TRACE_ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) { if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace help")==0) { TRACE_PrintHelp(io); *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0 || UTIL1_strcmp((char*)cmd, (char*)"trace status")==0) { TRACE_PrintStatus(io); *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace shell")==0) { traceChannel = TRACE_TO_SHELL; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace none")==0) { traceChannel = TRACE_TO_NONE; *handled = TRUE; #if PL_HAS_MOTOR } else if (UTIL1_strcmp((char*)cmd, (char*)"trace motor on")==0) { traceMotor = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace motor off")==0) { traceMotor = FALSE; *handled = TRUE; #endif #if PL_HAS_MOTOR_TACHO } else if (UTIL1_strcmp((char*)cmd, (char*)"trace tacho on")==0) { traceTacho = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace tacho off")==0) { traceTacho = FALSE; *handled = TRUE; #endif #if PL_HAS_QUADRATURE } else if (UTIL1_strcmp((char*)cmd, (char*)"trace quad on")==0) { traceQuad = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace quad off")==0) { traceQuad = FALSE; *handled = TRUE; #endif #if PL_HAS_ACCEL } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel on")==0) { traceAccel = TRUE; *handled = TRUE; } else if (UTIL1_strcmp((char*)cmd, (char*)"trace accel off")==0) { traceAccel = FALSE; *handled = TRUE; #endif } return ERR_OK; }