XDK API  3.6.0
Documentation
Files | Data Structures | Typedefs | Functions
CmdLineDebugger

Command Line Debug Interface Header. More...

+ Collaboration diagram for CmdLineDebugger:

Files

file  BCDS_CmdLineDebugger.h
 

Data Structures

struct  CmdLineDbg_Element_S
 Command Line List Element. More...
 

Typedefs

typedef Retcode_T(* CmdLineDbg_Callback_T )(uint32_t argc, const char **argv)
 

Functions

Retcode_T CmdLineDbg_Parse (struct CmdLineDbg_Element_S *list, char *input)
 Basic Command Line Parser. More...
 
Retcode_T CmdLineDbg_RegisterCmd (struct CmdLineDbg_Element_S *list, struct CmdLineDbg_Element_S *cmd)
 Register Command Into List. More...
 
Retcode_T CmdLineDbg_RegisterCmdArray (struct CmdLineDbg_Element_S *list, size_t nElements)
 Convert Command Element Array into Linked List. More...
 

Detailed Description

Declaration of a command "example" and its corresponding callback:

Retcode_T ExampleCommand(const char ** argv, uint32_t argc);
struct CmdLineDbg_Element_S help = {
.callback = ExampleCommand,
.commandString = (char *)"example",
};
// ExampleCommand Callback implementation
Retcode_T ExampleCommand(const char ** argv, uint32_t argc)
{
// ... //
return rc;
}

Parser invocation:

struct CmdLineDbg_Element_S testList[] =
{
{
testCallback,
"TestCommand",
},
{
sudoCallback,
"sudo",
},
{
helpCallback,
"help",
}
};
void Loop(void)
{
// Initialize Command Array
// We already know that there are only three elements in the array
rc = CmdLineDbg_RegisterCmdArray(testList, 3);
char inputBuffer[80]; // Example character buffer
size_t inputStrLen;
while(RETCODE_OK == rc)
{
// GetStringFromPeripheral(inputBuffer, 80);
rc = CmdLineDbg_Parse(testList, inputBuffer);
}
}

Data Structure Documentation

struct CmdLineDbg_Element_S

The CmdLineDbg_Element_S structure defines the basic structure of a command line list element

+ Collaboration diagram for CmdLineDbg_Element_S:

Data Fields

const CmdLineDbg_Callback_T callback
 
const char * commandString
 
struct CmdLineDbg_Element_Snext
 

Field Documentation

const CmdLineDbg_Callback_T callback

callback to execute

const char* commandString

command string for match

struct CmdLineDbg_Element_S* next

next element for linked-listing

Typedef Documentation

typedef Retcode_T(* CmdLineDbg_Callback_T)(uint32_t argc, const char **argv)

Command Line Callback Definition

Parameters
[in]argc: Argument count. The amount of parameters inside the argument vector
[in]argv: Argument vector

Function Documentation

Retcode_T CmdLineDbg_Parse ( struct CmdLineDbg_Element_S list,
char *  input 
)

ComdLineDbg_Parse takes a string inside a input buffer and matches this string against a list of commands registered inside a command list. For a successful match, the corresponding callback is registered

The input buffer must be a C-Style string

Parameters
[in]list- Command List Register
[in]input- Pointer to input buffer
Return values
RETCODE_OKwhen successful
RETCODE_NULL_POINTERwhen any of the input parameter is NULL
RETCODE_CMDLINE_DEBUGGER_COMMAND_NOT_FOUNDwhen the command is not found
Retcode_T CmdLineDbg_RegisterCmd ( struct CmdLineDbg_Element_S list,
struct CmdLineDbg_Element_S cmd 
)

CmdLineDbg_RegisterCmd takes registers a command into the command list

Parameters
[in]list- Command List Register
[in]cmd- Pointer to command to be registered
Return values
RETCODE_OKwhen successful
RETCODE_NULL_POINTERwhen any of the input parameter is NULL
Retcode_T CmdLineDbg_RegisterCmdArray ( struct CmdLineDbg_Element_S list,
size_t  nElements 
)

CmdLineDbg_RegisterCmdArray takes an array of command elements and converts it into a linked list that can be registered

Parameters
[in]list- array to be converted into list
[in]nElements- Amount of elements stored in the array
Return values
RETCODE_OKwhen successful
RETCODE_NULL_POINTERwhen the list pointer is NULL
RETCODE_INVALID_PARAMwhen the amount of elements is equal to 0

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:52 by doxygen 1.8.8