Co-processor Remote Procedure Call

This module includes functions that allow a Host processor to execute remote procedure calls on a co-processor over spinel.

Functions

void otCliAppendResult (otError aError)
 Append an error code to the output buffer.
 
void otCliSetUserCommandError (otError aError)
 This method sets the user command error.
 
otError otCRPCHandleCommand (void *aContext, uint8_t aArgsLength, char *aArgs[], uint8_t aCommandsLength, const otCliCommand aCommands[])
 Call the corresponding handler for a command.
 
void otCliOutputBytes (const uint8_t *aBytes, uint8_t aLength)
 Output a byte array as hex to the output buffer.
 
void otCliOutputCommands (const otCliCommand aCommands[], size_t aCommandsLength)
 Write all command names in aCommands to the output buffer.
 
int otCliOutputFormatV (const char *aFormat, va_list aArguments)
 Write formatted output to the output buffer.
 
void otCliOutputFormat (const char *aFmt,...)
 Write formatted string to the output buffer.
 
int otCliOutputIp6Address (const otIp6Address *aAddress)
 Write an IPv6 address to the output buffer.
 
otError otCRPCProcessCmd (uint8_t aArgsLength, char *aArgs[], char *aOutput, size_t aOutputMaxLen)
 Process a command line.
 
void otCRPCProcessCmdLine (const char *aString, char *aOutput, size_t aOutputMaxLen)
 Process a command-line string.
 
void otCRPCProcessHelp (void *aContext, uint8_t aArgsLength, char *aArgs[])
 Output all available CRPC built-in commands and user commands.
 
void otCRPCSetUserCommands (const otCliCommand *aUserCommands, uint8_t aLength, void *aContext)
 Set a user command table.
 
char * otCRPCGetStaticOutputBuffer (void)
 
size_t otCRPCGetStaticOutputBufferSize (void)

Detailed Description

This module includes functions that allow a Host processor to execute remote procedure calls on a co-processor over spinel.

Function Documentation

◆ otCliAppendResult()

void otCliAppendResult ( otError  aError)

Append an error code to the output buffer.

Parameters
[in]aError

◆ otCliOutputBytes()

void otCliOutputBytes ( const uint8_t *  aBytes,
uint8_t  aLength 
)

Output a byte array as hex to the output buffer.

Parameters
[in]aBytesBytes to output
[in]aLengthNumber of bytes

◆ otCliOutputCommands()

void otCliOutputCommands ( const otCliCommand  aCommands[],
size_t  aCommandsLength 
)

Write all command names in aCommands to the output buffer.

Parameters
[in]aCommandsan array of commands
[in]aCommandsLengthlength of aCommands

◆ otCliOutputFormat()

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

Write formatted string to the output buffer.

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

◆ otCliOutputFormatV()

int otCliOutputFormatV ( const char *  aFormat,
va_list  aArguments 
)

Write formatted output to the output buffer.

Parameters
[in]aFormatA pointer to the format string.
[in]aArgumentsA variable list of arguments for format.
Returns
The number of bytes placed in the output buffer.

◆ otCliOutputIp6Address()

int otCliOutputIp6Address ( const otIp6Address aAddress)

Write an IPv6 address to the output buffer.

Parameters
[in]aAddressA pointer to the IPv6 address.
Returns
The number of bytes placed in the output queue.
Return values
-1Driver is broken.

◆ otCliSetUserCommandError()

void otCliSetUserCommandError ( otError  aError)

This method sets the user command error.

Parameters
[in]aErrorAn error

◆ otCRPCHandleCommand()

otError otCRPCHandleCommand ( void *  aContext,
uint8_t  aArgsLength,
char *  aArgs[],
uint8_t  aCommandsLength,
const otCliCommand  aCommands[] 
)

Call the corresponding handler for a command.

This function will look through aCommands to find a command that matches aArgs[0]. If found, the handler function for the command will be called with the remaining args passed to it.

Parameters
[in]aContexta context
[in]aArgsLengthnumber of args
[in]aArgslist of args
[in]aCommandsLengthnumber of commands in aCommands
[in]aCommandslist of commands
Return values

◆ otCRPCProcessCmd()

otError otCRPCProcessCmd ( uint8_t  aArgsLength,
char *  aArgs[],
char *  aOutput,
size_t  aOutputMaxLen 
)

Process a command line.

Parameters
[in]aArgsLengthThe number of elements in aArgs.
[in]aArgsAn array of arguments.
[out]aOutputThe execution result.
[in]aOutputMaxLenThe output buffer size.
Return values
OT_ERROR_INVALID_ARGSThe command is supported but invalid arguments provided.
OT_ERROR_NONEThe command is successfully process.
OT_ERROR_NOT_IMPLEMENTEDThe command is not supported.

◆ otCRPCProcessCmdLine()

void otCRPCProcessCmdLine ( const char *  aString,
char *  aOutput,
size_t  aOutputMaxLen 
)

Process a command-line string.

Parameters
[in]aStringA NULL-terminated input string.
[out]aOutputThe execution result.
[in]aOutputMaxLenThe output buffer size.

◆ otCRPCProcessHelp()

void otCRPCProcessHelp ( void *  aContext,
uint8_t  aArgsLength,
char *  aArgs[] 
)

Output all available CRPC built-in commands and user commands.

Parameters
aContext
aArgsLength
aArgs

◆ otCRPCSetUserCommands()

void otCRPCSetUserCommands ( 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.