Command Line Interface

This module includes functions that control the Thread stack's execution.

Classes

struct  otCliCommand
 This structure represents a CLI command.

Typedefs

typedef int(* otCliOutputCallback) (void *aContext, const char *aFormat, va_list aArguments)
 This function pointer is called to notify about Console output.
 
typedef struct otCliCommand otCliCommand

Functions

void otCliInit (otInstance *aInstance, otCliOutputCallback aCallback, void *aContext)
 Initialize the CLI module.
 
void otCliInputLine (char *aBuf)
 This method is called to feed in a console input line.
 
void otCliSetUserCommands (const otCliCommand *aUserCommands, uint8_t aLength, void *aContext)
 Set a user command table.
 
void otCliSetUserCommandError (otError aError)
 This method sets the user command error.
 
void otCliOutputBytes (const uint8_t *aBytes, uint8_t aLength)
 Write a number of bytes to the CLI console as a hex string.
 
void otCliOutputFormat (const char *aFmt,...)
 Write formatted string to the CLI console.
 
void otCliAppendResult (otError aError)
 Write error code to the CLI console.
 
void otCliPlatLogv (otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, va_list aArgs)
 Callback to write the OpenThread Log to the CLI console.
 
void otCliPlatLogLine (otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aLogLine)
 Function to write the OpenThread Log to the CLI console.

Detailed Description

This module includes functions that control the Thread stack's execution.

Typedef Documentation

◆ otCliOutputCallback

typedef int(* otCliOutputCallback) (void *aContext, const char *aFormat, va_list aArguments)

This function pointer is called to notify about Console output.

Parameters
[in]aBufA pointer to a buffer with an output.
[in]aBufLengthA length of the output data stored in the buffer.
[out]aContextA user context pointer.
Returns
Number of bytes written by the callback.

Function Documentation

◆ otCliAppendResult()

void otCliAppendResult ( otError  aError)

Write error code to the CLI console.

If the aError is OT_ERROR_PENDING nothing will be outputted.

Parameters
[in]aErrorError code value.

◆ otCliInit()

void otCliInit ( otInstance aInstance,
otCliOutputCallback  aCallback,
void *  aContext 
)

Initialize the CLI module.

Parameters
[in]aInstanceThe OpenThread instance structure.
[in]aCallbackA callback method called to process CLI output.
[in]aContextA user context pointer.

◆ otCliInputLine()

void otCliInputLine ( char *  aBuf)

This method is called to feed in a console input line.

Parameters
[in]aBufA pointer to a null-terminated string.

◆ otCliOutputBytes()

void otCliOutputBytes ( const uint8_t *  aBytes,
uint8_t  aLength 
)

Write a number of bytes to the CLI console as a hex string.

Parameters
[in]aBytesA pointer to data which should be printed.
[in]aLengthaBytes length.

◆ otCliOutputFormat()

void otCliOutputFormat ( const char *  aFmt,
  ... 
)

Write formatted string to the CLI console.

Parameters
[in]aFmtA pointer to the format string.
[in]...A matching list of arguments.

◆ otCliPlatLogLine()

void otCliPlatLogLine ( otLogLevel  aLogLevel,
otLogRegion  aLogRegion,
const char *  aLogLine 
)

Function to write the OpenThread Log to the CLI console.

Parameters
[in]aLogLevelThe log level.
[in]aLogRegionThe log region.
[in]aLogLineA pointer to the log line string.

◆ otCliPlatLogv()

void otCliPlatLogv ( otLogLevel  aLogLevel,
otLogRegion  aLogRegion,
const char *  aFormat,
va_list  aArgs 
)

Callback to write the OpenThread Log to the CLI console.

Parameters
[in]aLogLevelThe log level.
[in]aLogRegionThe log region.
[in]aFormatA pointer to the format string.
[in]aArgsva_list matching aFormat.

◆ otCliSetUserCommandError()

void otCliSetUserCommandError ( otError  aError)

This method sets the user command error.

Parameters
[in]aErrorAn error

◆ otCliSetUserCommands()

void otCliSetUserCommands ( const otCliCommand aUserCommands,
uint8_t  aLength,
void *  aContext 
)

Set a user command table.

Parameters
[in]aUserCommandsA pointer to an array with user commands.
[in]aLengthaUserCommands length.
[in]aContextThe context passed to the handler.