Trident IoT SDK
Loading...
Searching...
No Matches
command-parser

CLI command parsing utilities for processing command arguments. More...

Collaboration diagram for command-parser:

Macros

#define TR_ARGUMENT_PARSER_MAX_ARGS   (15)
 Maximum number of arguments that can be parsed from a command line.

Functions

void tr_cli_parse_command (const tr_command_s *cmd_table, int argc, char **argv)
 Parses a command and executes the appropriate handler.
uint8_t tr_cli_get_option (int argc, char *argv[], char *opt_string, char **ret_arg)
 Gets an option from the command line arguments.
uint64_t tr_dec_or_hex_string_to_int (const char *number_string)
 Converts a decimal or hexadecimal string to an integer.

Detailed Description

CLI command parsing utilities for processing command arguments.

Macro Definition Documentation

◆ TR_ARGUMENT_PARSER_MAX_ARGS

#define TR_ARGUMENT_PARSER_MAX_ARGS   (15)

Maximum number of arguments that can be parsed from a command line.

Function Documentation

◆ tr_cli_get_option()

uint8_t tr_cli_get_option ( int argc,
char * argv[],
char * opt_string,
char ** ret_arg )

Gets an option from the command line arguments.

Parameters
[in]argcNumber of arguments in the command line.
[in]argvArray of argument strings.
[in]opt_stringString containing the option characters to look for.
[out]ret_argPointer to store the option argument if found.
Returns
1 if the option was found, 0 otherwise.

◆ tr_cli_parse_command()

void tr_cli_parse_command ( const tr_command_s * cmd_table,
int argc,
char ** argv )

Parses a command and executes the appropriate handler.

Parameters
[in]cmd_tablePointer to the command table containing available commands.
[in]argcNumber of arguments in the command line.
[in]argvArray of argument strings.

◆ tr_dec_or_hex_string_to_int()

uint64_t tr_dec_or_hex_string_to_int ( const char * number_string)

Converts a decimal or hexadecimal string to an integer.

Parameters
[in]number_stringString containing the number to convert.
Returns
The converted integer value.