Command Line Interface
This module includes functions that control the Thread stack's execution.
Summary
Typedefs |
|
|---|---|
otCliCommand
|
typedefstruct otCliCommand
Represents a user provided CLI command entry. |
otCliInterpreter
|
typedefstruct otCliInterpreter
Opaque type for a CLI interpreter. |
otCliOutputCallback)(void *aContext, const char *aFormat, va_list aArguments)
|
typedefint(*
Pointer is called to notify about CLI interpreter output. |
Functions |
|
|---|---|
otCliAppendResult(otError aError)
|
void
Write a given error code as the result of previous command to the static CLI interpreter output.
|
otCliGetStaticInterpreter(void)
|
Gets the pointer to the static CLI interpreter.
|
otCliInit(otInstance *aInstance, otCliOutputCallback aCallback, void *aContext)
|
void
Initialize the static CLI interpreter.
|
otCliInputLine(char *aLine)
|
void
Feeds input to the static CLI interpreter.
|
otCliInterpreterFinalize(otCliInterpreter *aInterpreter)
|
void
Finalizes the CLI interpreter.
|
otCliInterpreterGetSize(void)
|
size_t
Gets the size of the CLI interpreter object.
|
otCliInterpreterInit(void *aBuffer, size_t aSize, otInstance *aInstance, otCliOutputCallback aCallback, void *aContext)
|
Initializes a CLI interpreter.
|
otCliInterpreterInputLine(otCliInterpreter *aInterpreter, char *aLine)
|
void
Feeds input to the CLI interpreter.
|
otCliInterpreterSetPromptConfig(otCliInterpreter *aInterpreter, bool aEnable)
|
void
Configures whether or not the CLI interpreter outputs the prompt string.
|
otCliOutputBytes(const uint8_t *aBytes, uint8_t aLength)
|
void
Write a number of bytes to the static CLI interpreter output as a hex string.
|
otCliOutputFormat(const char *aFmt, ...)
|
void
Write formatted string to the static CLI interpreter output.
|
otCliPlatLogv(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
|
void
Callback to write the OpenThread Log to the static CLI interpreter output.
|
otCliSetUserCommands(const otCliCommand *aUserCommands, uint8_t aLength, void *aContext)
|
Set a user command table on the static CLI interpreter.
|
otCliVendorSetUserCommands(void)
|
void
Callback to allow vendor specific commands to be added to the user command table.
|
Structs |
|
|---|---|
| otCliCommand |
Represents a user provided CLI command entry. |
Typedefs
otCliOutputCallback
int(* otCliOutputCallback)(void *aContext, const char *aFormat, va_list aArguments)
Pointer is called to notify about CLI interpreter output.
| Details | |||||||
|---|---|---|---|---|---|---|---|
| Parameters |
|
||||||
| Returns |
Number of bytes written by the callback.
|
Functions
otCliAppendResult
void otCliAppendResult( otError aError )
Write a given error code as the result of previous command to the static CLI interpreter output.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
This is intended for use by user-provided CLI command handlers.
If the aError is OT_ERROR_PENDING nothing will be outputted.
| Details | |||
|---|---|---|---|
| Parameters |
|
otCliGetStaticInterpreter
otCliInterpreter * otCliGetStaticInterpreter( void )
Gets the pointer to the static CLI interpreter.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
| Details | |
|---|---|
| Returns |
A pointer to the static CLI interpreter.
|
otCliInit
void otCliInit( otInstance *aInstance, otCliOutputCallback aCallback, void *aContext )
Initialize the static CLI interpreter.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
| Details | |||||||
|---|---|---|---|---|---|---|---|
| Parameters |
|
otCliInputLine
void otCliInputLine( char *aLine )
Feeds input to the static CLI interpreter.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
| Details | |||
|---|---|---|---|
| Parameters |
|
otCliInterpreterFinalize
void otCliInterpreterFinalize( otCliInterpreter *aInterpreter )
Finalizes the CLI interpreter.
| Details | |||
|---|---|---|---|
| Parameters |
|
otCliInterpreterGetSize
size_t otCliInterpreterGetSize( void )
Gets the size of the CLI interpreter object.
| Details | |
|---|---|
| Returns |
The size of the CLI interpreter object in bytes.
|
otCliInterpreterInit
otCliInterpreter * otCliInterpreterInit( void *aBuffer, size_t aSize, otInstance *aInstance, otCliOutputCallback aCallback, void *aContext )
Initializes a CLI interpreter.
| Details | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Parameters |
|
||||||||||
| Returns |
A pointer to the initialized CLI interpreter, or
NULL if aSize is too small. |
otCliInterpreterInputLine
void otCliInterpreterInputLine( otCliInterpreter *aInterpreter, char *aLine )
Feeds input to the CLI interpreter.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
|
otCliInterpreterSetPromptConfig
void otCliInterpreterSetPromptConfig( otCliInterpreter *aInterpreter, bool aEnable )
Configures whether or not the CLI interpreter outputs the prompt string.
Requires OPENTHREAD_CONFIG_CLI_PROMPT_ENABLE.
It is enabled by default.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
|
otCliOutputBytes
void otCliOutputBytes( const uint8_t *aBytes, uint8_t aLength )
Write a number of bytes to the static CLI interpreter output as a hex string.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
This is intended for use by user-provided CLI command handlers.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
|
otCliOutputFormat
void otCliOutputFormat( const char *aFmt, ... )
Write formatted string to the static CLI interpreter output.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
This is intended for use by user-provided CLI command handlers.
| Details | |||||
|---|---|---|---|---|---|
| Parameters |
|
otCliPlatLogv
void otCliPlatLogv( otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs )
Callback to write the OpenThread Log to the static CLI interpreter output.
| Details | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| Parameters |
|
otCliSetUserCommands
otError otCliSetUserCommands( const otCliCommand *aUserCommands, uint8_t aLength, void *aContext )
Set a user command table on the static CLI interpreter.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
| Details | |||||||
|---|---|---|---|---|---|---|---|
| Parameters |
|
||||||
| Return Values |
|
otCliVendorSetUserCommands
void otCliVendorSetUserCommands( void )
Callback to allow vendor specific commands to be added to the user command table.
Available when OPENTHREAD_CONFIG_CLI_VENDOR_COMMANDS_ENABLE is enabled and OPENTHREAD_CONFIG_CLI_MAX_USER_CMD_ENTRIES is greater than 1.
Requires OPENTHREAD_CONFIG_CLI_STATIC_INTERPRETER_ENABLE.
Resources
OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.