24 #ifndef _FNET_SHELL_H_ 26 #define _FNET_SHELL_H_ 108 #define FNET_SHELL_QUOTE_SYMBOL '\'' 127 #define FNET_SHELL_ESCAPE_SYMBOL '\\' 135 #define FNET_SHELL_COMMAND_SPLITTER ';' 250 #if defined(__cplusplus) 633 #if defined(__cplusplus) The Shell service is accepting user commnads.
void fnet_shell_help(fnet_shell_desc_t desc)
Prints the command-shell help message.
fnet_bool_t echo
Enable/disable terminal echo flag. When set to FNET_TRUE the echo is enabled, characters received by ...
Stream control structure.
Shell main control structure.
fnet_return_t fnet_shell_script(fnet_shell_desc_t desc, fnet_char_t *script)
Executes the command line script.
const fnet_char_t * name
Command name (null-terminated string).
fnet_char_t * cmd_line_buffer
Command-line buffer.
fnet_char_t * syntax
Syntax of the command (null-terminated string). This field is used by the fnet_shell_help() function...
The Shell service is blocked and ignores user commnads.
const fnet_shell_command_t * cmd_table
The pointer to the command table. The last table element must have all fields set to zero as the end-...
The Shell service finished command execution.
fnet_return_t
General return codes, used by most of API functions.
fnet_index_t min_args
Minimum number of arguments the command accepts.
fnet_return_t fnet_shell_block(fnet_shell_desc_t desc, void(*on_ctrlc)(fnet_shell_desc_t shl_desc, void *cookie), void *cookie)
Blocks the shell to ignore user commands.
void fnet_shell_script_stop(fnet_shell_desc_t desc)
Stops execution of the shell command line.
const fnet_shell_command_t * fnet_shell_get_command_by_name(fnet_shell_desc_t desc, const fnet_char_t *name)
Looks for a shell command by its name.
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
void fnet_shell_unblock(fnet_shell_desc_t desc)
Unblocks the shell to accept user commands.
fnet_size_t cmd_line_buffer_size
Size of the command-line buffer. It defines the maximum length of the entered input-command line...
The Shell service is executing user commnads.
The Shell service is not initialized.
fnet_index_t max_args
Maximum number of arguments the command accepts.
fnet_shell_cmd_function_t cmd_ptr
Pointer to the actual command function defined by the fnet_shell_cmd_function_t type.
fnet_size_t fnet_shell_println(fnet_shell_desc_t desc, const fnet_char_t *format,...)
Prints formatted text to the shell stream and terminates the printed text by the line separator strin...
fnet_serial_stream_t stream
Serial stream assigned to the shell.
void(* fnet_shell_cmd_function_t)(fnet_shell_desc_t desc, fnet_index_t argc, fnet_char_t **argv)
Command callback function prototype.
fnet_int32_t fnet_shell_getchar(fnet_shell_desc_t desc)
Reads character from the shell stream.
fnet_char_t * description
Brief description of the command (null-terminated string). This field is used by the fnet_shell_help...
fnet_size_t fnet_shell_printf(fnet_shell_desc_t desc, const fnet_char_t *format,...)
Prints formatted text to the shell stream.
fnet_shell_state_t
Shell states. Used mainly for debugging purposes.
void fnet_shell_putchar(fnet_shell_desc_t desc, fnet_char_t character)
Writes character to the shell stream.
fnet_bool_t fnet_shell_is_ctrlc(fnet_shell_desc_t desc)
Detects if the [Ctrl]+[c] is received.
fnet_char_t * prompt_str
Shell prompt (null-terminated string).
void * fnet_shell_desc_t
Shell service descriptor.
The Shell service is not initialized.
void fnet_shell_release(fnet_shell_desc_t desc)
Releases the Shell service.
unsigned int fnet_index_t
Unsigned integer type representing the index.
const fnet_shell_t * shell
Shell control structure.
char fnet_char_t
Type representing the charecter.
Shell command control structure.
Input parameters for fnet_shell_init().
fnet_return_t fnet_shell_switch(fnet_shell_desc_t desc, const fnet_shell_t *switch_shell)
Switch to other command line set.
fnet_shell_desc_t fnet_shell_init(fnet_shell_params_t *params)
Initializes the Shell service.