Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Functions | Variables
lampda::logic::cli Namespace Reference

Handle the serial command line interface. More...

Classes

struct  Command
 

Functions

constexpr Command make_command (const char *name, const char *desc, void(*handler)(const common::cli::ParsedCommand &))
 
constexpr Command make_command_args (const char *name, const char *usage, const uint8_t minArgs, const uint8_t maxArgs, const char *desc, void(*handler)(const common::cli::ParsedCommand &))
 
const char * boolToString (bool b)
 
template<size_t N>
void handleCommand (const common::cli::ParsedCommand &command, const Command(&commandsToParse)[N], const char *calledCommand=nullptr)
 Parse a command and handle its effects.
 
constexpr bool has_duplicate_hash (const Command *arr, size_t count)
 Check for command duplication.
 
template<size_t N>
void help_hook_base (const Command(&commandsToParse)[N], const char *command=nullptr)
 Check for command uniqueness.
 
void setup ()
 Call once on system start.
 
void handleSerialEvents ()
 Handle the user command line inputs.
 

Variables

constexpr Command _main_commands_s []
 Define the CLI commands here.
 
constexpr Command _sys_commands_s []
 special commands to interact with the low level system
 
constexpr Command _act_commands_s []
 special commands to interact with the low level system
 
constexpr Command _set_commands_s []
 special commands to set system values
 

Detailed Description

Handle the serial command line interface.

Function Documentation

◆ help_hook_base()

template<size_t N>
void lampda::logic::cli::help_hook_base ( const Command(&)  commandsToParse[N],
const char *  command = nullptr 
)

Check for command uniqueness.

Check for command uniqueness Check for command uniqueness Check for command uniqueness hook that can read the other commands and print them out

Variable Documentation

◆ _act_commands_s

constexpr Command lampda::logic::cli::_act_commands_s[]
constexpr
Initial value:
= {
make_command_args("h", "", 0, common::cli::ParsedCommand::maxArgumentCount, "This page", handles::cmd_act_help),
make_command("shutdown", "force shutdown the system", handles::cmd_shutdown),
make_command("buttonTogg", "change the button pin number for the next boot", handles::cmd_buttontoggle),
make_command("format", "format the whole file system (dangerous)", handles::cmd_format),
make_command("dfu", "clear this program from memory, enter update mode", handles::cmd_dfu),
}

special commands to interact with the low level system

◆ _main_commands_s

constexpr Command lampda::logic::cli::_main_commands_s[]
constexpr
Initial value:
= {
make_command("h", "this page", handles::cmd_help),
make_command("sum", "system summary", handles::cmd_summary),
make_command("v", "hardware & software version", handles::cmd_version),
make_command("t", "return the lamp type", handles::cmd_type),
make_command("id", "return the board serial number", handles::cmd_id),
make_command_args("set",
"<subcommand> [<arg>...]",
0,
common::cli::ParsedCommand::maxArgumentCount,
"Set system characteristics",
handles::cmd_set),
make_command_args("sys",
"<subcommand> [<arg>...]",
0,
common::cli::ParsedCommand::maxArgumentCount,
"Read system informations",
handles::cmd_sys),
make_command_args("act",
"<subcommand> [<arg>...]",
0,
common::cli::ParsedCommand::maxArgumentCount,
"High level immediate actions (dangerous)",
handles::cmd_act),
}

Define the CLI commands here.

◆ _sys_commands_s

constexpr Command lampda::logic::cli::_sys_commands_s[]
constexpr
Initial value:
= {
make_command_args("h", "", 0, common::cli::ParsedCommand::maxArgumentCount, "This page", handles::cmd_sys_help),
make_command("alerts", "show all raised alerts", handles::cmd_alerts),
make_command("stats", "display the system use statistics", handles::cmd_stats),
make_command("tasks", "display a debug of task usages", handles::cmd_tasks),
make_command("time", "show current time", handles::cmd_time),
make_command("ble", "debug bluetooth informations", handles::cmd_ble),
make_command("pd", "display the connected PD capabilities", handles::cmd_powerdelivery),
make_command("bat", " battery info/levels", handles::cmd_bat),
make_command("states", "state machine states", handles::cmd_states),
make_command("serial", "show serial infos", handles::cmd_serial),
make_command("cinfo", "charger infos", handles::cmd_cinfo),
make_command("adc", "values from the charger ADC", handles::cmd_adc),
make_command("i2c", "start an i2c presence check", handles::cmd_i2c),
}

special commands to interact with the low level system