70 #define CMDLINE_RETCODE_COMMAND_BUSY 2 71 #define CMDLINE_RETCODE_EXCUTING_CONTINUE 1
72 #define CMDLINE_RETCODE_SUCCESS 0
73 #define CMDLINE_RETCODE_FAIL -1
74 #define CMDLINE_RETCODE_INVALID_PARAMETERS -2
75 #define CMDLINE_RETCODE_COMMAND_NOT_IMPLEMENTED -3
76 #define CMDLINE_RETCODE_COMMAND_CB_MISSING -4
77 #define CMDLINE_RETCODE_COMMAND_NOT_FOUND -5
131 #if defined(__GNUC__) 132 void cmd_printf(
const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
141 #if defined(__GNUC__) 142 void cmd_vprintf(
const char *fmt, va_list ap) __attribute__((__format__(__printf__, 1, 0)));
221 typedef void (*input_passthrough_func_t)(uint8_t c);
222 void cmd_input_passthrough_func(input_passthrough_func_t passthrough_fnc);
bool cmd_parameter_float(int argc, char *argv[], const char *key, float *value)
find command parameter by key and return value (next parameter) in float.
uint8_t cmd_history_size(uint8_t max)
Configure command history size (default 32)
bool cmd_parameter_val(int argc, char *argv[], const char *key, char **value)
find command parameter by key and return value (next parameter).
void cmd_mutex_lock(void)
Retrieve output mutex lock This can be used to retrieve the output mutex when multiple cmd_printf/cmd...
void cmd_ready(int retcode)
Command ready function for special cases.
void cmd_output(void)
Refresh output.
void cmd_init_screen(void)
Initialize screen.
void cmd_ctrl_func(void(*sohf)(uint8_t c))
Configure function, which will be called when Ctrl+A is pressed.
void cmd_alias_add(const char *alias, const char *value)
Add alias to interpreter.
char * cmd_parameter_last(int argc, char *argv[])
Get last command line parameter as string.
void cmd_vprintf(const char *fmt, va_list ap)
command line print function This function should be used when user want to print something to the con...
void cmd_add(const char *name, cmd_run_cb *callback, const char *info, const char *man)
Add command to intepreter.
int( cmd_run_cb)(int argc, char *argv[])
Callback called when your command is run.
void( cmd_ready_cb_f)(int)
typedef for ready cb function
int cmd_parameter_index(int argc, char *argv[], const char *key)
find command parameter index by key.
void cmd_set_ready_cb(cmd_ready_cb_f *cb)
Configure cb which will be called after commands are executed or cmd_ready is called.
void( cmd_print_t)(const char *, va_list)
typedef for print functions
bool cmd_echo_state(void)
Get echo state.
void cmd_exe(char *str)
Command executer.
void cmd_printf(const char *fmt,...)
command line print function This function should be used when user want to print something to the con...
void cmd_mutex_unlock(void)
Release output mutex lock This can be used to release the output mutex once it has been retrieved wit...
void cmd_variable_add(char *variable, char *value)
Add Variable to interpreter.
void cmd_echo_on(void)
Echo on.
bool cmd_parameter_timestamp(int argc, char *argv[], const char *key, int64_t *value)
find command parameter by key and return value (next parameter) in int64.
void cmd_next(int retcode)
execute next command if any
void cmd_char_input(int16_t u_data)
Enter character to console.
void default_cmd_response_out(const char *fmt, va_list ap)
default cmd response function, use stdout
void cmd_request_screen_size(void)
Request screen size from host Response are stored to variables: COLUMNS and LINES - as integer values...
void cmd_reset(void)
Reset cmdline to default values detach external commands, delete all variables and aliases...
bool cmd_parameter_bool(int argc, char *argv[], const char *key, bool *value)
find command parameter by key.
void cmd_mutex_release_func(void(*mutex_release_f)(void))
Configure mutex wait function By default, cmd_printf calls may not be thread safe, depending on the implementation of the used output.
void cmd_delete(const char *name)
delete command from intepreter
void cmd_out_func(cmd_print_t *outf)
Reconfigure default cmdline out function (cmd_printf)
bool cmd_parameter_int(int argc, char *argv[], const char *key, int32_t *value)
find command parameter by key and return value (next parameter) in integer.
void cmd_free(void)
Free cmd class.
void cmd_variable_add_int(char *variable, int value)
Add integer variable to interpreter.
void cmd_init(cmd_print_t *outf)
Initialize cmdline class.
void cmd_mutex_wait_func(void(*mutex_wait_f)(void))
Configure mutex wait function By default, cmd_printf calls may not be thread safe, depending on the implementation of the used output.
void cmd_echo_off(void)
Echo off.
bool cmd_has_option(int argc, char *argv[], const char *key)
check if command option is present.