Command Line Interface

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

Summary

Typedefs

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

Functions

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

Typedefs

otCliOutputCallback

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

This function pointer is called to notify about Console output.

Details
Parameters
[in] aBuf
A pointer to a buffer with an output.
[in] aBufLength
A length of the output data stored in the buffer.
[out] aContext
A user context pointer.
Returns
Number of bytes written by the callback.

Functions

otCliAppendResult

void otCliAppendResult(
  otError aError
)

Write error code to the CLI console.

If the aError is OT_ERROR_PENDING nothing will be outputted.

Details
Parameters
[in] aError
Error code value.

otCliInit

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

Initialize the CLI module.

Details
Parameters
[in] aInstance
The OpenThread instance structure.
[in] aCallback
A callback method called to process CLI output.
[in] aContext
A user context pointer.

otCliInputLine

void otCliInputLine(
  char *aBuf
)

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

Details
Parameters
[in] aBuf
A 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.

Details
Parameters
[in] aBytes
A pointer to data which should be printed.
[in] aLength
aBytes length.

otCliOutputFormat

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

Write formatted string to the CLI console.

Details
Parameters
[in] aFmt
A 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.

Details
Parameters
[in] aLogLevel
The log level.
[in] aLogRegion
The log region.
[in] aLogLine
A 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.

Details
Parameters
[in] aLogLevel
The log level.
[in] aLogRegion
The log region.
[in] aFormat
A pointer to the format string.
[in] aArgs
va_list matching aFormat.

otCliSetUserCommands

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

Set a user command table.

Details
Parameters
[in] aUserCommands
A pointer to an array with user commands.
[in] aLength
aUserCommands length.
[in] aContext
The context passed to the handler.

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.