218 #define CLI_MAX_TOKENS (20) 320 #if !defined(CLI_DISABLE_LINE_EDIT) && !defined(CLI_DISABLE_HISTORY) 374 #if !defined(CLI_DISABLE_LINE_EDIT) && !defined(CLI_DISABLE_HISTORY) 443 uint8_t
cli_logout(uint8_t len,
char *param[]);
uint16_t line_max
The size of one history line.
Definition: cli.h:341
uint8_t state
Defines the login status.
Definition: cli.h:366
char ** history
The pointers to history_max lines of buffer for input.
Definition: cli.h:335
knock_fptr_t knock
An authentication function pointer.
Definition: cli.h:371
uint8_t(* cli_cmd_handler_t)(uint8_t len, char *param[])
Function pointer type of CLI command handlers.
Definition: cli.h:280
The MiniCLI control block definition.
Definition: cli.h:334
char * cmd
Command string.
Definition: cli.h:313
The MiniCLI control block definition.
Definition: cli.h:365
void cli_task(void)
The top-level function of the actual CLI.
cli_history_t history
The command history record.
Definition: cli.h:375
cmd_t * sub
Sub-commands.
Definition: cli.h:316
int(* getchar_fptr_t)(void)
A function pointer prototype to get a characeter from an input source.
Definition: cli.h:246
cmd_t * cmd
A pointer to the CLI commands.
Definition: cli.h:367
uint8_t cli_logout(uint8_t len, char *param[])
This function implements the logout function.
uint16_t index
When the user types a command and presses enter, index is the index that will be saved in...
Definition: cli.h:342
#define CLI_MAX_TOKENS
Controls the number of tokens to parse in a single command.
Definition: cli.h:218
uint8_t full
Represents whether the number of history commands exceeded history_max if it is 0, history commands are not full, otherwise the commands are full.
Definition: cli.h:346
uint16_t position
When the user presses up/down, position is the history index displayed on the terminal.
Definition: cli.h:344
putchar_fptr_t put
A function pointer to write a characeter to output sink.
Definition: cli.h:370
char echo
Determines if user input should be printed on the screen or not.
Definition: cli.h:368
uint16_t history_max
The maximum number of the lines in history.
Definition: cli.h:340
int(* putchar_fptr_t)(int)
A function pointer prototype to write a character to the output.
Definition: cli.h:259
void cli_init(cli_t *cli)
MiniCLI initialization.
void cli_tokens(uint8_t argc, char *argv[])
Process a tokenized command in array of string pointers format.
void cli_line(char *line)
Process one line of command in plain text format.
cli_cmd_handler_t fptr
The function pointer to call when an input string matches with the command in MiniCLI engine...
Definition: cli.h:315
char * input
used to save the current input before pressing "up" the first time
Definition: cli.h:336
uint8_t(* knock_fptr_t)(char *id, char *pass)
This is the callback function to authenticate the user, if login is enabled and the credentials are n...
Definition: cli.h:268
The MiniCLI command declaration structure.
Definition: cli.h:312
char * parse_token
In cli.c, _cli_do_cmd() will result in the history command to be parsed into tokens, an additional array is required as an input to the #_cli_do_cmd() function to preserve the command history.
Definition: cli.h:337
uint8_t cli_hardcode_login(char *id, char *password)
A sample login function implementation.
char * help
Type '?' to retrieve help message.
Definition: cli.h:314