Files | Data Structures | Typedefs | Functions

Command Line Debug Interface Header. More...

+ Collaboration diagram for CmdLineDebugger:


file  BCDS_CmdLineDebugger.h

Data Structures

struct  CmdLineDbg_Element_S
 Command Line List Element. More...


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


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[] =
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

[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

[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_T CmdLineDbg_RegisterCmd ( struct CmdLineDbg_Element_S list,
struct CmdLineDbg_Element_S cmd 

CmdLineDbg_RegisterCmd takes registers a command into the command list

[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

[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

This documentation file has been automatically generated on Fri Oct 4 2019 03:47:39 by doxygen 1.8.8