Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Support Forum Contact / Enquiries

FreeRTOS_CLIGetParameter()

FreeRTOS_CLI.h

const uint8_t *FreeRTOS_CLIGetParameter( const int8_t *pcCommandString, 
                                         uint8_t ucWantedParameter, 
                                         uint8_t *pucParameterStringLength )		
		

FreeRTOS+CLI is an extensible framework that allows the application writer to define and register their own command line input commands. Functions that implement the behaviour of a user defined command have to use a particular interface, which is described on a separate page.

Some commands take parameters. For example, a file system "copy" command needs the name of the source file and the name of the destination file. This page describes a helper function called FreeRTOS_CLIGetParameter() that is provided by FreeRTOS+CLI to make input parameter parsing easy.

FreeRTOS_CLIGetParameter() takes the full command string and the position of the requested parameter as inputs, and produces a pointer to the start of the requested parameter and the length of the parameter string in bytes as outputs.

Parameters:

pcCommandString   A pointer to the entire command string, as entered by the user.
ucWantedParameter   The position of the parameter being requested within the command string. For example, if the input command was "copy [source_file] [destination_file]", set ucWantedParameter to 1 to request the name and length of the source_file parameter. Set ucWantedParameter to 2 to request the name and length of the destination_file parameter.
pucParameterStringLength   The string length of the parameter being requested is returned in *pucParameterStringLength. For example, if the parameter text was "filename.txt", then *pucParameterStringLength will be set to 12, as there are 12 characters in the string.

Returns:

A pointer to the start of the parameter being requested is returned. For example, if the full command string is "copy file1.txt file2.txt", and ucWantedParameter is 2, FreeRTOS_CLIGetParameter() will return a pointer to the 'f' of "file2.txt".


Examples

An example is provided on the Implementing A Command page.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.