Trident IoT SDK
 
Loading...
Searching...
No Matches
tr_cli.h
Go to the documentation of this file.
1
10#ifndef TR_CLI_H
11#define TR_CLI_H
12
13#include <stdbool.h>
14#include "tr_printf.h"
16#include "tr_cli_buffer.h"
17
18#ifndef TR_CLI_MAX_LINE
22#define TR_CLI_MAX_LINE 120
23#endif
24
25#ifndef TR_CLI_HISTORY_LEN
30#define TR_CLI_HISTORY_LEN 1000
31#endif
32
33#ifndef TR_CLI_MAX_ARGC
37#define TR_CLI_MAX_ARGC 16
38#endif
39
40#ifndef TR_CLI_PROMPT
44#define TR_CLI_PROMPT "trident> "
45#endif
46
47#ifndef TR_CLI_MAX_PROMPT_LEN
51#define TR_CLI_MAX_PROMPT_LEN 10
52#endif
53
54#ifndef TR_CLI_SERIAL_XLATE
59#define TR_CLI_SERIAL_XLATE 1
60#endif
61
62#ifndef TR_CLI_LOCAL_ECHO
66#define TR_CLI_LOCAL_ECHO 1
67#endif
68
76struct tr_cli
77{
83
84#if TR_CLI_HISTORY_LEN
88 char history[TR_CLI_HISTORY_LEN];
89
93 bool searching;
94
98 int history_pos;
99#endif
100
104 int len;
105
110
114 bool done;
115
119 void (*put_char)(char ch);
120
124 void *cb_data;
125
128
133
135
137};
138
142void tr_cli_init(const char *prompt,
143 void ( *put_char )(char ch));
144
150bool tr_cli_insert_char(char ch);
151
156const char *tr_cli_get_line(void);
157
162int tr_cli_argc(char ***argv);
163
169void tr_cli_prompt(void);
170
177const char *tr_cli_get_history(int history_pos);
178
183void tr_cli_char_received(char data);
184
192void tr_cli_common_printf(const char *pFormat,
193 ...);
194
195#endif // TR_CLI_H
Definition tr_cli.h:77
int len
Definition tr_cli.h:104
bool have_csi
Definition tr_cli.h:127
char * argv[TR_CLI_MAX_ARGC]
Definition tr_cli.h:134
void * cb_data
Definition tr_cli.h:124
bool have_escape
Definition tr_cli.h:126
char buffer[TR_CLI_MAX_LINE]
Definition tr_cli.h:82
void(* put_char)(char ch)
Definition tr_cli.h:119
bool done
Definition tr_cli.h:114
char prompt[TR_CLI_MAX_PROMPT_LEN]
Definition tr_cli.h:136
int cursor
Definition tr_cli.h:109
int counter
Definition tr_cli.h:132
bool tr_cli_insert_char(char ch)
#define TR_CLI_MAX_PROMPT_LEN
Definition tr_cli.h:51
void tr_cli_init(const char *prompt, void(*put_char)(char ch))
int tr_cli_argc(char ***argv)
#define TR_CLI_HISTORY_LEN
Definition tr_cli.h:30
void tr_cli_common_printf(const char *pFormat,...)
const char * tr_cli_get_history(int history_pos)
const char * tr_cli_get_line(void)
#define TR_CLI_MAX_LINE
Definition tr_cli.h:22
void tr_cli_prompt(void)
#define TR_CLI_MAX_ARGC
Definition tr_cli.h:37
void tr_cli_char_received(char data)
code for buffering bytes to be sent to the CLI utility
common CLI utility for parsing incoming commands
A simple printf utility for debug prints and cli support. Required for remote CLI to function properl...