SmartSnippets DA1459x SDK
Files | Data Structures | Macros | Typedefs | Functions

Command Line Interface. More...

Files

file  cli.h
 Declarations for CLI service.
 

Data Structures

struct  cli_command_t
 

Macros

#define CLI_TASK_PRIORITY   (OS_TASK_PRIORITY_NORMAL)
 CLI task priority.
 

Typedefs

typedef void * cli_t
 
typedef void(* cli_handler_t) (int argc, const char *argv[], void *user_data)
 

Functions

void cli_init (void)
 
cli_t cli_register (uint32_t notif_mask, const cli_command_t cmd_handler[], cli_handler_t def_handler)
 
void cli_handle_notified (cli_t cli)
 

Detailed Description

Command Line Interface.

Typedef Documentation

◆ cli_handler_t

typedef void(* cli_handler_t) (int argc, const char *argv[], void *user_data)

Command handler

argv[0] is always a command name

Parameters
[in]argcnumber of arguments
[in]argvarray of arguments
[in]user_datauser data passed from command

◆ cli_t

typedef void* cli_t

CLI instance

Function Documentation

◆ cli_handle_notified()

void cli_handle_notified ( cli_t  cli)

Handle notification from CLI

This function shall be called when application task is notified from CLI task to process pending entry.

Entry received from adapter will be split into tokens internally and matched against handlers provided on registration.

Parameters
[in]cliCLI instance
See also
cli_register

◆ cli_init()

void cli_init ( void  )

Initialize CLI

This function initializes CLI internal structures and shall be called before CLI is used and after console_init().

◆ cli_register()

cli_t cli_register ( uint32_t  notif_mask,
const cli_command_t  cmd_handler[],
cli_handler_t  def_handler 
)

Register command handlers for current task

This functions registers command handlers to be evaluated for matching CLI input.

Once full line of text is entered, CLI task notifies registered task using notif_mask and task shall then call cli_handle_notified() to process entry.

Warning
CLI stores only pointer to cmd_handler and application should guarantee that this pointer is valid for entire adapter lifetime.
Note
Only one task can register handlers in current implementation.
Parameters
[in]notif_maskbit mask for task notification
[in]cmd_handlerpredefined commands handlers
[in]def_handlerdefault command handler
Returns
CLI instance
See also
cli_handle_notified