Trident IoT SDK
Loading...
Searching...
No Matches
tr_cli.h File Reference

common CLI utility More...

#include <stdbool.h>
#include "tr_printf.h"
#include "tr_cli_command_parser.h"
#include "tr_cli_buffer.h"
Include dependency graph for tr_cli.h:

Go to the source code of this file.

Data Structures

struct  tr_cli
 Structure which defines the current state of the CLI. More...

Macros

#define TR_CLI_MAX_LINE   120
 Maximum number of bytes to accept in a single line.
#define TR_CLI_HISTORY_LEN   1000
 Maximum number of bytes to retain of history data.
#define TR_CLI_MAX_ARGC   16
 Maximum number of arguments we reserve space for.
#define TR_CLI_PROMPT   "trident> "
 CLI prompt to display after pressing enter.
#define TR_CLI_MAX_PROMPT_LEN   10
 Maximum number of bytes in the prompt.
#define TR_CLI_SERIAL_XLATE   1
 Translate CR -> NL on input and output CR NL on output.
#define TR_CLI_LOCAL_ECHO   1
 Enable or disable local echo.

Functions

void tr_cli_init (const char *prompt, void(*put_char)(char ch))
 Starts up the Embedded CLI subsystem.
bool tr_cli_insert_char (char ch)
 Adds a new character into the buffer.
const char * tr_cli_get_line (void)
 Returns the null terminated internal buffer.
int tr_cli_argc (char ***argv)
 Parses the internal buffer and returns it as an argc/argv combo.
void tr_cli_prompt (void)
 Outputs the CLI prompt.
const char * tr_cli_get_history (int history_pos)
 Retrieves a history command line.
void tr_cli_char_received (char data)
 Passes a received character to the CLI.
void tr_cli_common_printf (const char *pFormat,...)
 Printf function used for printing to terminal.

Detailed Description

common CLI utility


SPDX-License-Identifier: LicenseRef-TridentMSLA SPDX-FileCopyrightText: 2025 Trident IoT, LLC https://www.tridentiot.com