64 static portBASE_TYPE prvHelpCommand(
char *pcWriteBuffer,
size_t xWriteBufferLen,
const char *pcCommandString );
69 static int8_t prvGetNumberOfParameters(
const char *pcCommandString );
76 "\r\nhelp:\r\n Lists all the registered commands\r\n\r\n",
114 if( pxNewListItem != NULL )
124 pxNewListItem->
pxNext = NULL;
128 pxLastCommandInList->
pxNext = pxNewListItem;
131 pxLastCommandInList = pxNewListItem;
146 const char *pcRegisteredCommandString;
147 size_t xCommandStringLength;
152 if( pxCommand == NULL )
155 for( pxCommand = &xRegisteredCommands; pxCommand != NULL; pxCommand = pxCommand->
pxNext )
158 xCommandStringLength = strlen( pcRegisteredCommandString );
164 if( ( pcCommandInput[ xCommandStringLength ] ==
' ' ) || ( pcCommandInput[ xCommandStringLength ] == 0x00 ) )
166 if( strncmp( pcCommandInput, pcRegisteredCommandString, xCommandStringLength ) == 0 )
186 if( ( pxCommand != NULL ) && ( xReturn ==
pdFALSE ) )
190 strncpy( pcWriteBuffer,
"Incorrect command parameter(s). Enter \"help\" to view a list of available commands.\r\n\r\n", xWriteBufferLen );
193 else if( pxCommand != NULL )
209 strncpy( pcWriteBuffer,
"Command not recognised. Enter 'help' to view a list of available commands.\r\n\r\n", xWriteBufferLen );
219 return cOutputBuffer;
226 const char *pcReturn = NULL;
228 *pxParameterStringLength = 0;
230 while( uxParametersFound < uxWantedParameter )
234 while( ( ( *pcCommandString ) != 0x00 ) && ( ( *pcCommandString ) !=
' ' ) )
240 while( ( ( *pcCommandString ) != 0x00 ) && ( ( *pcCommandString ) ==
' ' ) )
246 if( *pcCommandString != 0x00 )
251 if( uxParametersFound == uxWantedParameter )
254 pcReturn = pcCommandString;
255 while( ( ( *pcCommandString ) != 0x00 ) && ( ( *pcCommandString ) !=
' ' ) )
257 ( *pxParameterStringLength )++;
261 if( *pxParameterStringLength == 0 )
279 static portBASE_TYPE prvHelpCommand(
char *pcWriteBuffer,
size_t xWriteBufferLen,
const char *pcCommandString )
284 ( void ) pcCommandString;
286 if( pxCommand == NULL )
289 pxCommand = &xRegisteredCommands;
295 pxCommand = pxCommand->
pxNext;
297 if( pxCommand == NULL )
312 static int8_t prvGetNumberOfParameters(
const char *pcCommandString )
314 int8_t cParameters = 0;
318 while( *pcCommandString != 0x00 )
320 if( ( *pcCommandString ) ==
' ' )
322 if( xLastCharacterWasSpace !=
pdTRUE )
325 xLastCharacterWasSpace =
pdTRUE;
330 xLastCharacterWasSpace =
pdFALSE;
338 if( xLastCharacterWasSpace ==
pdTRUE )
#define taskEXIT_CRITICAL()
struct xCOMMAND_INPUT_LIST CLI_Definition_List_Item_t
portBASE_TYPE FreeRTOS_CLIRegisterCommand(const CLI_Command_Definition_t *const pxCommandToRegister)
void * pvPortMalloc(size_t xSize) PRIVILEGED_FUNCTION
int8_t cExpectedNumberOfParameters
portBASE_TYPE FreeRTOS_CLIProcessCommand(const char *const pcCommandInput, char *pcWriteBuffer, size_t xWriteBufferLen)
const char *const pcHelpString
#define configCOMMAND_INT_MAX_OUTPUT_SIZE
struct xCOMMAND_INPUT_LIST * pxNext
const pdCOMMAND_LINE_CALLBACK pxCommandInterpreter
const char * FreeRTOS_CLIGetParameter(const char *pcCommandString, unsigned portBASE_TYPE uxWantedParameter, portBASE_TYPE *pxParameterStringLength)
#define taskENTER_CRITICAL()
const CLI_Command_Definition_t * pxCommandLineDefinition
const char *const pcCommand
char * FreeRTOS_CLIGetOutputBuffer(void)