|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Classes | |
| class | Console |
| struct | SubCommand |
| struct | Command |
| class | ICommandRegistry |
| class | SerialCmd |
| class | CommandRegistry |
| struct | SlotParseResult |
| Slot parsing helpers for secure-element commands. More... | |
Typedefs | |
| using | CommandHandler = void (*)(const char* args) |
| using | TextChangeCallback = void (*)(const char* field, const char* value) |
| using | TimeChangeCallback = void (*)() |
Enumerations | |
| enum class | EscState : uint8_t { NONE , ESC , BRACKET } |
| Escape-sequence parser state for ANSI key handling. More... | |
Functions | |
| ICommandRegistry & | getCommandRegistry () |
| Returns singleton command-registry interface. | |
| void | parseSubCommand (const char *args, const char *&name, size_t &name_len, const char *&rest) |
| Splits args into "<sub-command> <rest>". | |
| bool | subCommandEquals (const char *token, size_t token_len, const char *word) |
| Case-insensitive compare of an unterminated token against a word. | |
| void | printSubCommandHelp (const char *parent, const SubCommand *table) |
| Prints a sub-command summary block. | |
| void | dispatchSubCommand (const char *parent, const char *args, const SubCommand *table) |
| Routes a sub-command line to its handler. | |
| static void | historyAdd (const char *cmd) |
| General-purpose helper functions. | |
| static const char * | historyGet (size_t idx) |
| Returns a history entry by reverse index (0 = newest). | |
| static void | redrawLine (const char *newContent, size_t &bufferPos) |
| Clears the current console line and redraws it with new content. | |
| static SlotParseResult | parseSlotArg (const char *args, uint16_t maxSlot, const char *slotTypeName) |
| Parses a slot number from a string argument. | |
| static hal::ISecureElement * | getSecureElementWithCheck () |
| Secure-element access helpers. | |
| static void | printHexDump (const uint8_t *data, size_t len, size_t maxBytes) |
| NVS utility helpers used by command handlers. | |
| static const char * | getNvsTypeName (nvs_type_t type) |
| Returns a human-readable name for an NVS type value. | |
| static nvs_type_t | findNvsKeyType (const char *ns, const char *key) |
| Finds the stored NVS type of a key by namespace iteration. | |
| static void | printNvsValue (nvs_handle_t nvs, const char *key, nvs_type_t type) |
| Prints an NVS value according to its stored type. | |
| static bool | getCurrentTime (struct timeval &tv, struct tm &tm) |
| Date/time parsing and validation helpers. | |
| static bool | setSystemTime (struct tm *tm) |
| Sets system time from a populated local tm structure. | |
| static void | cmdHelp (const char *args) |
| System command handlers. | |
| static void | cmdPing (const char *args) |
| Replies with a liveness check response. | |
| static void | cmdStatus (const char *args) |
| Prints runtime status information for the device. | |
| static void | cmdCpu (const char *args) |
| static void | printHeapRegion (const char *label, uint32_t caps) |
| Prints heap and PSRAM usage statistics. | |
| static void | cmdMemInfo (const char *args) |
| static void | cmdMem (const char *args) |
| static void | cmdReboot (const char *args) |
| Reboots the device after flushing serial output. | |
| static void | cmdBootloader (const char *args) |
| Reboots the device into USB download (bootloader) mode. | |
| static void | cmdShipMode (const char *args) |
| Enters ship mode (disconnects the battery via BATFET). | |
| static void | cmdPaste (const char *args) |
| static void | cmdErrorLog (const char *args) |
| Displays the error log or clears it when CLEAR is passed. | |
| static void | cmdNvsClear (const char *args) |
| NVS command handlers. | |
| static void | cmdNvsList (const char *args) |
| Lists NVS entries, optionally filtered by namespace. | |
| static void | cmdNvsRead (const char *args) |
| Reads and prints a single NVS key value. | |
| static void | cmdNvsDel (const char *args) |
| Deletes an NVS key or an entire namespace. | |
| static void | cmdGetTime (const char *args) |
| Date/time command handlers. | |
| static void | cmdGetDate (const char *args) |
| Prints the current local date. | |
| static void | cmdSetTime (const char *args) |
| Updates the system clock time component. | |
| static void | cmdSetDate (const char *args) |
| Updates the system clock date component. | |
| static void | cmdSetName (const char *args) |
| Display text command handlers. | |
| static void | cmdSetInfo (const char *args) |
| Sets the first info line through the text callback. | |
| static void | cmdSetInfo2 (const char *args) |
| Sets the second info line through the text callback. | |
| static void | cmdPinReset (const char *args) |
| Authentication command handlers for secure serial mode. | |
| static void | cmdPinStatus (const char *args) |
| Prints the current badge PIN status snapshot. | |
| static void | cmdPinChange (const char *args) |
| Changes the badge PIN after verifying the current one. | |
| static void | cmdPinDuress (const char *args) |
| Arms the duress / self-destruct PIN. | |
| static void | cmdPinDuressClear (const char *args) |
| Disarms the duress / self-destruct PIN. | |
| static void | cmdTr01Status (const char *args) |
| TROPIC01 secure-element maintenance and diagnostic handlers. | |
| static void | cmdTr01Info (const char *args) |
| Prints secure-element chip and firmware information. | |
| static void | cmdTr01Session (const char *args) |
| Starts a secure-element session, restarting it if already active. | |
| static void | cmdTr01Slots (const char *args) |
| Prints usage information for ECC and R-Memory slots. | |
| static void | cmdTr01RmemRead (const char *args) |
| Reads and dumps one secure-element R-Memory slot. | |
| static void | cmdTr01EccDel (const char *args) |
| Deletes one ECC key slot. | |
| static void | cmdTr01RmemDel (const char *args) |
| Erases one R-Memory slot. | |
| static void | cmdTr01Resync (const char *args) |
| Restarts the secure-element session to resynchronize state. | |
| static void | cmdTr01CacheRebuild (const char *args) |
| Rebuilds the Tropic slot cache and prints per-slot diagnostics. | |
| static void | cmdTr01Cleanup (const char *args) |
| Cleans up slot metadata inconsistencies and rebuilds cache state. | |
| static void | cmdTr01Wipe (const char *args) |
| Performs a destructive secure-element factory wipe after confirmation. | |
| static const char * | wifiSecurityName (hal::WifiSecurity sec) |
| static const char * | wifiStateName (hal::WifiState st) |
| static const char * | wifiModeName (hal::WifiMode m) |
| static uint8_t | wifiDedupAndSort (hal::WifiScanResult *results, uint8_t count) |
| Deduplicates scan results by SSID (keeping strongest RSSI) and sorts the survivors descending by RSSI in place. | |
| static void | cmdWifiScan (const char *args) |
| WIFI_SCAN - scan and print networks (deduplicated, sorted by RSSI). | |
| static void | cmdWifiStatus (const char *args) |
| WIFI_STATUS - show runtime state and saved configuration. | |
| static void | cmdWifiOn (const char *args) |
| WIFI_ON [sta|ap|sta_ap] - enable WiFi radio. | |
| static void | cmdWifiOff (const char *args) |
| WIFI_OFF - disconnect and disable WiFi radio. | |
| static void | cmdWifiConnect (const char *args) |
| WIFI_CONNECT <ssid> <password> - connect and persist credentials. | |
| static void | cmdWifiTimeout (const char *args) |
| WIFI_TIMEOUT [ms] - get or set the connect timeout. | |
| static void | cmdWifiForget (const char *args) |
| WIFI_FORGET - disable WiFi and erase the saved configuration. | |
| static int | findModuleIndex (const char *name) |
| Module management serial command handlers. | |
| static void | cmdModuleList (const char *args) |
| MODULE LIST - list registered modules with state and errors. | |
| static void | cmdModuleEnable (const char *args) |
| MODULE ENABLE <name> - enable a module by name (persistent). | |
| static void | cmdModuleDisable (const char *args) |
| MODULE DISABLE <name> - disable a module by name (persistent). | |
| static void | cmdNvs (const char *args) |
| static void | cmdPin (const char *args) |
| static void | cmdTr01 (const char *args) |
| static void | cmdWifi (const char *args) |
| static void | cmdModule (const char *args) |
Variables | |
| constexpr size_t | kSubCommandHeadBufSize = 80 |
| Buffer size for the "<name> <args>" column built during HELP rendering. | |
| static constexpr size_t | MAX_COMMANDS = 64 |
| Maximum number of commands that can be registered. | |
| static bool | s_initialized = false |
| static constexpr size_t | HISTORY_MAX = 10 |
| Internal constants used by serial command processing. | |
| static constexpr size_t | HEX_DUMP_WIDTH = 16 |
| static constexpr size_t | NVS_KEY_MAX_LEN = 15 |
| static constexpr size_t | NVS_NAMESPACE_MAX_LEN = 15 |
| static constexpr int | YEAR_MIN = 2020 |
| static constexpr int | YEAR_MAX = 2100 |
| static constexpr uint32_t | WIPE_PROGRESS_INTERVAL = 64 |
| static char | s_cmdBuffer [SerialCmd::CMD_BUFFER_SIZE] = {} |
| Global static state for line editing and command dispatch. | |
| static size_t | s_cmdBufferPos = 0 |
| static bool | s_initialized = false |
| static char | s_historyBuffer [HISTORY_MAX][SerialCmd::CMD_BUFFER_SIZE] |
| Command history ring buffer allocated in PSRAM. | |
| static size_t | s_historyCount = 0 |
| static size_t | s_historyHead = 0 |
| static size_t | s_historyPos = 0 |
| static EscState | s_escState = EscState::NONE |
| static TextChangeCallback | s_textCallback = nullptr |
| Optional callbacks injected by higher-level modules. | |
| static TimeChangeCallback | s_timeCallback = nullptr |
| static bool | s_authenticated = false |
| Session authentication flags and timeout baseline. | |
| static uint64_t | s_authTimestamp = 0 |
| static constexpr uint32_t | WIFI_SCAN_POLL_MS = 100 |
| WiFi serial command handlers. | |
| static constexpr uint8_t | WIFI_MAX_SCAN_RESULTS = hal::IWifiController::MAX_SCAN_RESULTS |
| static const SubCommand | kNvsSubs [] |
| Sub-command tables and dispatchers for grouped commands. | |
| static const SubCommand | kPinSubs [] |
| static const SubCommand | kTr01Subs [] |
| static const SubCommand | kWifiSubs [] |
| static const SubCommand | kModuleSubs [] |
Console I/O Implementation Wraps cdc_log console functions
| using cdc::serial::CommandHandler = void (*)(const char* args) |
Command handler function type
| args | Arguments after command name (trimmed, null-terminated) |
Definition at line 12 of file ICommandRegistry.h.
| using cdc::serial::TextChangeCallback = void (*)(const char* field, const char* value) |
Callbacks for external notifications
Definition at line 11 of file SerialCmd.h.
| using cdc::serial::TimeChangeCallback = void (*)() |
Definition at line 12 of file SerialCmd.h.
|
strong |
Escape-sequence parser state for ANSI key handling.
| Enumerator | |
|---|---|
| NONE | |
| ESC | |
| BRACKET | |
Definition at line 75 of file SerialCmd.cpp.
|
static |
Reboots the device into USB download (bootloader) mode.
| args | Unused command arguments. |
Definition at line 601 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), cdc::serial::Console::printf(), and cdc::ui::rebootIntoBootloader().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 452 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), cdc::core::CpuStats::loadOverWindow(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Displays the error log or clears it when CLEAR is passed.
| args | Optional action argument. |
Definition at line 644 of file SerialCmd.cpp.
References error_log_clear(), error_log_dump(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Prints the current local date.
| args | Unused command arguments. |
Definition at line 842 of file SerialCmd.cpp.
References getCurrentTime(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Date/time command handlers.
Prints the current local time.
| args | Unused command arguments. |
Definition at line 827 of file SerialCmd.cpp.
References getCurrentTime(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
System command handlers.
Prints the registered command overview.
| args | Unused command arguments. |
Definition at line 425 of file SerialCmd.cpp.
References getCommandRegistry(), and cdc::serial::ICommandRegistry::showHelp().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 554 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 482 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), cdc::serial::Console::printf(), and printHeapRegion().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 2424 of file SerialCmd.cpp.
References dispatchSubCommand(), and kModuleSubs.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
MODULE DISABLE <name> - disable a module by name (persistent).
| args | Module name. |
Definition at line 2332 of file SerialCmd.cpp.
References findModuleIndex(), cdc::core::IService::getState(), cdc::core::ModuleRegistry::instance(), cdc::core::UsbManager::instance(), cdc::core::UsbManager::needsReplug(), cdc::serial::Console::printf(), and cdc::core::STARTED.
|
static |
MODULE ENABLE <name> - enable a module by name (persistent).
| args | Module name. |
Definition at line 2283 of file SerialCmd.cpp.
References findModuleIndex(), cdc::core::Generic, cdc::core::ModuleRegistry::instance(), cdc::core::UsbManager::instance(), cdc::core::UsbManager::needsReplug(), cdc::serial::Console::printf(), cdc::core::SlotError, and cdc::core::UsbBudgetFull.
|
static |
MODULE LIST - list registered modules with state and errors.
| args | Unused command arguments. |
Definition at line 2259 of file SerialCmd.cpp.
References cdc::core::IService::getName(), cdc::core::ModuleRegistry::instance(), and cdc::serial::Console::printf().
|
static |
Definition at line 2378 of file SerialCmd.cpp.
References dispatchSubCommand(), and kNvsSubs.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
NVS command handlers.
Erases all NVS data after explicit confirmation.
| args | Confirmation argument (YES required). |
Definition at line 661 of file SerialCmd.cpp.
References cdc::serial::Console::printf(), and cdc::core::wipeNvs().
|
static |
Deletes an NVS key or an entire namespace.
| args | Arguments in the form <namespace> [key]. |
Definition at line 773 of file SerialCmd.cpp.
References NVS_KEY_MAX_LEN, NVS_NAMESPACE_MAX_LEN, and cdc::serial::Console::printf().
|
static |
Lists NVS entries, optionally filtered by namespace.
| args | Optional namespace filter. |
Definition at line 685 of file SerialCmd.cpp.
References getNvsTypeName(), NVS_NAMESPACE_MAX_LEN, and cdc::serial::Console::printf().
|
static |
Reads and prints a single NVS key value.
| args | Arguments in the form <namespace> <key>. |
Definition at line 737 of file SerialCmd.cpp.
References findNvsKeyType(), NVS_KEY_MAX_LEN, NVS_NAMESPACE_MAX_LEN, cdc::serial::Console::printf(), and printNvsValue().
|
static |
Definition at line 625 of file SerialCmd.cpp.
References cdc::ui::T9InputView::appendRaw(), cdc::ui::ViewStack::current(), cdc::ui::IView::getName(), cdc::ui::ViewStack::instance(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 2388 of file SerialCmd.cpp.
References dispatchSubCommand(), and kPinSubs.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Changes the badge PIN after verifying the current one.
| args | "<currentPin> <newPin>" - both must be 4..8 digits. |
Definition at line 1096 of file SerialCmd.cpp.
References cdc::core::PinManager::BADGE_PIN_MAX, cdc::core::PinManager::BADGE_PIN_MIN, cdc::core::PinManager::instance(), and cdc::serial::Console::printf().
|
static |
Arms the duress / self-destruct PIN.
Entering the duress PIN at the lock screen wipes all data and reboots. The duress PIN must be 4-8 digits and differ from the badge PIN.
| args | "<duressPin>". |
Definition at line 1164 of file SerialCmd.cpp.
References cdc::core::PinManager::BADGE_PIN_MAX, cdc::core::PinManager::BADGE_PIN_MIN, cdc::core::PinManager::instance(), and cdc::serial::Console::printf().
|
static |
Disarms the duress / self-destruct PIN.
| args | Unused command arguments. |
Definition at line 1193 of file SerialCmd.cpp.
References cdc::core::PinManager::clearDuressPin(), cdc::core::PinManager::instance(), and cdc::serial::Console::printf().
|
static |
Replies with a liveness check response.
| args | Unused command arguments. |
Definition at line 434 of file SerialCmd.cpp.
References cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Authentication command handlers for secure serial mode.
PIN state inspection and maintenance handlers.
Resets badge PIN retry counters for debugging.
| args | Unused command arguments. |
Definition at line 1072 of file SerialCmd.cpp.
References cdc::core::PinManager::instance(), cdc::serial::Console::printf(), and cdc::core::PinManager::resetBadgeRetries().
|
static |
Prints the current badge PIN status snapshot.
| args | Unused command arguments. |
Definition at line 1083 of file SerialCmd.cpp.
References cdc::core::PinManager::instance(), and cdc::serial::Console::printf().
|
static |
Reboots the device after flushing serial output.
| args | Unused command arguments. |
Definition at line 589 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Updates the system clock date component.
| args | Date string in format DD.MM.YYYY. |
Definition at line 895 of file SerialCmd.cpp.
References getCurrentTime(), cdc::serial::Console::printf(), s_timeCallback, setSystemTime(), YEAR_MAX, and YEAR_MIN.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Sets the first info line through the text callback.
| args | New info text. |
Definition at line 977 of file SerialCmd.cpp.
References cdc::serial::Console::printf(), and s_textCallback.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Sets the second info line through the text callback.
| args | New secondary info text. |
Definition at line 989 of file SerialCmd.cpp.
References cdc::serial::Console::printf(), and s_textCallback.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Display text command handlers.
Sets the lock-screen name text through the text callback.
| args | New name string. |
Definition at line 965 of file SerialCmd.cpp.
References cdc::serial::Console::printf(), and s_textCallback.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Updates the system clock time component.
| args | Time string in format HH:MM:SS. |
Definition at line 857 of file SerialCmd.cpp.
References getCurrentTime(), cdc::serial::Console::printf(), s_timeCallback, and setSystemTime().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Enters ship mode (disconnects the battery via BATFET).
| args | Unused command arguments. |
Definition at line 612 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), cdc::hal::getPowerManagerInstance(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Prints runtime status information for the device.
| args | Unused command arguments. |
Definition at line 443 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), and cdc::serial::Console::printf().
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 2404 of file SerialCmd.cpp.
References dispatchSubCommand(), and kTr01Subs.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Rebuilds the Tropic slot cache and prints per-slot diagnostics.
| args | Unused command arguments. |
Definition at line 1404 of file SerialCmd.cpp.
References cdc::core::TropicStorage::instance(), and cdc::serial::Console::printf().
|
static |
Cleans up slot metadata inconsistencies and rebuilds cache state.
| args | Unused command arguments. |
Definition at line 1434 of file SerialCmd.cpp.
References cdc::core::TropicStorage::instance(), and cdc::serial::Console::printf().
|
static |
Deletes one ECC key slot.
| args | ECC slot number argument. |
Definition at line 1336 of file SerialCmd.cpp.
References cdc::hal::ISecureElement::ECC_SLOT_COUNT, getSecureElementWithCheck(), cdc::hal::OK, parseSlotArg(), and cdc::serial::Console::printf().
|
static |
Prints secure-element chip and firmware information.
| args | Unused command arguments. |
Definition at line 1220 of file SerialCmd.cpp.
References getSecureElementWithCheck(), and cdc::serial::Console::printf().
|
static |
Restarts the secure-element session to resynchronize state.
| args | Unused command arguments. |
Definition at line 1382 of file SerialCmd.cpp.
References getSecureElementWithCheck(), and cdc::serial::Console::printf().
|
static |
Erases one R-Memory slot.
| args | R-Memory slot number argument. |
Definition at line 1359 of file SerialCmd.cpp.
References getSecureElementWithCheck(), cdc::hal::OK, parseSlotArg(), cdc::serial::Console::printf(), and cdc::hal::ISecureElement::RMEM_SLOT_COUNT.
|
static |
Reads and dumps one secure-element R-Memory slot.
| args | Slot number argument. |
Definition at line 1308 of file SerialCmd.cpp.
References getSecureElementWithCheck(), cdc::hal::OK, parseSlotArg(), cdc::serial::Console::printf(), printHexDump(), and cdc::hal::ISecureElement::RMEM_SLOT_COUNT.
|
static |
Starts a secure-element session, restarting it if already active.
| args | Unused command arguments. |
Definition at line 1255 of file SerialCmd.cpp.
References getSecureElementWithCheck(), and cdc::serial::Console::printf().
|
static |
Prints usage information for ECC and R-Memory slots.
| args | Unused command arguments. |
Definition at line 1276 of file SerialCmd.cpp.
References cdc::hal::ISecureElement::ECC_SLOT_COUNT, cdc::core::TropicSlotMap::SlotRange::end, cdc::core::TropicSlotMap::forEachRange(), getSecureElementWithCheck(), cdc::core::TropicSlotMap::instance(), cdc::core::TropicSlotMap::SlotRange::moduleName, cdc::serial::Console::printf(), cdc::core::TropicSlotMap::RMEM, and cdc::core::TropicSlotMap::SlotRange::start.
|
static |
TROPIC01 secure-element maintenance and diagnostic handlers.
Prints secure-element session status.
| args | Unused command arguments. |
Definition at line 1207 of file SerialCmd.cpp.
References getSecureElementWithCheck(), and cdc::serial::Console::printf().
|
static |
Performs a destructive secure-element factory wipe after confirmation.
| args | Confirmation argument (CONFIRM required). |
Definition at line 1449 of file SerialCmd.cpp.
References cdc::serial::Console::flush(), getSecureElementWithCheck(), cdc::serial::Console::printf(), WIPE_PROGRESS_INTERVAL, and cdc::core::wipeTropic().
|
static |
Definition at line 2416 of file SerialCmd.cpp.
References dispatchSubCommand(), and kWifiSubs.
Referenced by cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
WIFI_CONNECT <ssid> <password> - connect and persist credentials.
Definition at line 2141 of file SerialCmd.cpp.
References cdc::hal::getWifiControllerInstance(), cdc::ui::WifiHandlers::instance(), and cdc::serial::Console::printf().
|
static |
WIFI_FORGET - disable WiFi and erase the saved configuration.
Definition at line 2223 of file SerialCmd.cpp.
References cdc::ui::WifiHandlers::instance(), and cdc::serial::Console::printf().
|
static |
WIFI_OFF - disconnect and disable WiFi radio.
Definition at line 2122 of file SerialCmd.cpp.
References cdc::hal::getWifiControllerInstance(), cdc::ui::WifiHandlers::instance(), cdc::serial::Console::printf(), and cdc::ui::WifiHandlers::setUserEnabled().
|
static |
WIFI_ON [sta|ap|sta_ap] - enable WiFi radio.
In STA modes, auto-reconnects via WifiHandlers when saved credentials exist.
Definition at line 2073 of file SerialCmd.cpp.
References cdc::hal::AP, cdc::hal::getWifiControllerInstance(), cdc::ui::WifiHandlers::instance(), cdc::serial::Console::printf(), cdc::hal::STA, cdc::hal::STA_AP, and wifiModeName().
|
static |
WIFI_SCAN - scan and print networks (deduplicated, sorted by RSSI).
Definition at line 1962 of file SerialCmd.cpp.
References cdc::hal::AP, cdc::hal::getWifiControllerInstance(), cdc::serial::Console::printf(), cdc::hal::STA, WIFI_MAX_SCAN_RESULTS, WIFI_SCAN_POLL_MS, cdc::ui::WIFI_SCAN_TIMEOUT_MS, wifiDedupAndSort(), and wifiSecurityName().
|
static |
WIFI_STATUS - show runtime state and saved configuration.
Definition at line 2020 of file SerialCmd.cpp.
References cdc::hal::getWifiControllerInstance(), cdc::ui::WifiHandlers::instance(), cdc::serial::Console::printf(), wifiModeName(), wifiSecurityName(), and wifiStateName().
|
static |
WIFI_TIMEOUT [ms] - get or set the connect timeout.
Definition at line 2194 of file SerialCmd.cpp.
References cdc::ui::WifiHandlers::instance(), cdc::serial::Console::printf(), cdc::ui::WIFI_CONNECT_TIMEOUT_MAX_MS, and cdc::ui::WIFI_CONNECT_TIMEOUT_MIN_MS.
|
inline |
Routes a sub-command line to its handler.
Empty args or the keyword "HELP" trigger the auto-generated help screen. Unknown keywords print an error followed by the same help screen.
| parent | Parent command name, only used for help/error output. |
| args | Arguments received by the top-level handler. |
| table | Null-terminated SubCommand array. |
Definition at line 73 of file SubCommand.h.
References cdc::serial::SubCommand::name, parseSubCommand(), cdc::serial::Console::printf(), printSubCommandHelp(), and subCommandEquals().
Referenced by cdc::mod_gpg::cmd_gpg(), cdc::mod_password::cmd_password(), cdc::mod_2fa::cmd_totp(), cmdModule(), cmdNvs(), cmdPin(), cmdTr01(), cdc::mod_vcard::cmdVcard(), and cmdWifi().
|
static |
Module management serial command handlers.
Finds a registered module index by name (case-insensitive).
| name | Module name to look up. |
Definition at line 2242 of file SerialCmd.cpp.
References cdc::core::IService::getName(), cdc::core::ModuleRegistry::instance(), and name.
Referenced by cmdModuleDisable(), and cmdModuleEnable().
|
static |
Finds the stored NVS type of a key by namespace iteration.
| ns | NVS namespace name. |
| key | Key name to inspect. |
Definition at line 267 of file SerialCmd.cpp.
Referenced by cmdNvsRead().
| ICommandRegistry & cdc::serial::getCommandRegistry | ( | ) |
Returns singleton command-registry interface.
Definition at line 245 of file CommandRegistry.cpp.
Referenced by cmdHelp(), cdc::mod_vcard::cmdVcardSet(), cdc::serial::SerialCmd::getRegistry(), cdc::serial::SerialCmd::init(), cdc::ui::registerBackupSerialCommand(), cdc::serial::SerialCmd::registerBuiltinCommands(), cdc::mod_2fa::registerCommands(), cdc::mod_gpg::registerCommands(), cdc::mod_password::registerCommands(), cdc::plugin_manager::registerGpioSerialCommands(), cdc::plugin_manager::registerPluginSerialCommands(), cdc::mod_vcard::registerSerialCommands(), and cdc::mod_vcard::vcard_session_clear().
|
static |
Date/time parsing and validation helpers.
Retrieves the current time as timeval and local tm.
| tv | Output timeval. |
| tm | Caller-owned output tm populated via localtime_r. |
Definition at line 400 of file SerialCmd.cpp.
Referenced by cmdGetDate(), cmdGetTime(), cmdSetDate(), and cmdSetTime().
|
static |
Returns a human-readable name for an NVS type value.
| type | NVS value type. |
Definition at line 245 of file SerialCmd.cpp.
Referenced by cmdNvsList().
|
static |
Secure-element access helpers.
Returns the secure element instance after availability validation.
Definition at line 208 of file SerialCmd.cpp.
References cdc::hal::getSecureElementInstance(), and cdc::serial::Console::printf().
Referenced by cmdTr01EccDel(), cmdTr01Info(), cmdTr01Resync(), cmdTr01RmemDel(), cmdTr01RmemRead(), cmdTr01Session(), cmdTr01Slots(), cmdTr01Status(), and cmdTr01Wipe().
|
static |
General-purpose helper functions.
Adds a command line to the history ring buffer.
| Plugin command channel | Command string to store. |
Definition at line 111 of file SerialCmd.cpp.
References cdc::serial::SerialCmd::CMD_BUFFER_SIZE, HISTORY_MAX, s_historyBuffer, s_historyCount, and s_historyHead.
|
static |
Returns a history entry by reverse index (0 = newest).
| idx | Reverse history index. |
Definition at line 128 of file SerialCmd.cpp.
References HISTORY_MAX, s_historyBuffer, s_historyCount, and s_historyHead.
|
static |
Parses a slot number from a string argument.
| args | Input string containing the slot number. |
| maxSlot | Maximum valid slot value (exclusive). |
| slotTypeName | Name for error messages (for example, "ECC slot" or "R-Memory slot"). |
Definition at line 174 of file SerialCmd.cpp.
References cdc::serial::Console::printf(), cdc::serial::SlotParseResult::valid, and cdc::serial::SlotParseResult::value.
Referenced by cmdTr01EccDel(), cmdTr01RmemDel(), and cmdTr01RmemRead().
|
inline |
Splits args into "<sub-command> <rest>".
| args | Raw argument string passed to the dispatcher. |
| name | Output: pointer to first character of the sub-command keyword. |
| name_len | Output: length of the keyword (0 if none present). |
| rest | Output: pointer to the remaining args (whitespace skipped). |
Definition at line 20 of file SubCommand.h.
References name.
Referenced by dispatchSubCommand().
|
static |
Prints heap and PSRAM usage statistics.
| args | Unused command arguments. |
Prints detailed per-task stack watermarks plus heap fragmentation. Heavier than cmdMem; only relevant for diagnostics.
Definition at line 469 of file SerialCmd.cpp.
References cdc::serial::Console::printf().
Referenced by cmdMemInfo().
|
static |
NVS utility helpers used by command handlers.
Prints a bounded hex dump of binary data.
| data | Input binary buffer. |
| len | Total data length. |
| maxBytes | Maximum number of bytes to print. |
Definition at line 227 of file SerialCmd.cpp.
References HEX_DUMP_WIDTH, and cdc::serial::Console::printf().
Referenced by cmdTr01RmemRead(), and printNvsValue().
|
static |
Prints an NVS value according to its stored type.
| NVS (plugin-namespaced) | Open NVS handle. |
| key | Key name. |
| type | Value type of the key. |
Definition at line 293 of file SerialCmd.cpp.
References LOG_E, cdc::serial::Console::printf(), printHexDump(), and TAG.
Referenced by cmdNvsRead().
|
inline |
Prints a sub-command summary block.
| parent | Top-level command name (e.g. "NVS"). |
| table | Null-terminated SubCommand array. |
Definition at line 47 of file SubCommand.h.
References kSubCommandHeadBufSize, cdc::serial::SubCommand::name, and cdc::serial::Console::printf().
Referenced by dispatchSubCommand().
|
static |
Clears the current console line and redraws it with new content.
| newContent | Replacement line content. |
| bufferPos | In/out cursor position updated to new content length. |
Definition at line 140 of file SerialCmd.cpp.
References cdc::serial::SerialCmd::CMD_BUFFER_SIZE, cdc::serial::Console::print(), and s_cmdBuffer.
|
static |
Sets system time from a populated local tm structure.
| tm | Input date/time structure. |
Definition at line 410 of file SerialCmd.cpp.
Referenced by cmdSetDate(), and cmdSetTime().
|
inline |
Case-insensitive compare of an unterminated token against a word.
Definition at line 36 of file SubCommand.h.
Referenced by dispatchSubCommand().
|
static |
Deduplicates scan results by SSID (keeping strongest RSSI) and sorts the survivors descending by RSSI in place.
Definition at line 1928 of file SerialCmd.cpp.
Referenced by cmdWifiScan().
|
static |
Definition at line 1914 of file SerialCmd.cpp.
References cdc::hal::AP, cdc::hal::OFF, cdc::hal::STA, and cdc::hal::STA_AP.
Referenced by cmdWifiOn(), and cmdWifiStatus().
|
static |
Definition at line 1891 of file SerialCmd.cpp.
References cdc::hal::OPEN, cdc::hal::WEP, cdc::hal::WPA2_ENTERPRISE, cdc::hal::WPA2_PSK, cdc::hal::WPA3_PSK, and cdc::hal::WPA_PSK.
Referenced by cmdWifiScan(), and cmdWifiStatus().
|
static |
Definition at line 1903 of file SerialCmd.cpp.
References cdc::hal::CONNECTED, cdc::hal::CONNECTING, cdc::hal::CONNECTION_FAILED, cdc::hal::DISCONNECTED, and cdc::hal::GOT_IP.
Referenced by cmdWifiStatus().
|
staticconstexpr |
Definition at line 49 of file SerialCmd.cpp.
Referenced by printHexDump().
|
staticconstexpr |
Internal constants used by serial command processing.
Definition at line 48 of file SerialCmd.cpp.
Referenced by historyAdd(), and historyGet().
|
static |
Definition at line 2418 of file SerialCmd.cpp.
Referenced by cmdModule(), and cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Sub-command tables and dispatchers for grouped commands.
Definition at line 2371 of file SerialCmd.cpp.
Referenced by cmdNvs(), and cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 2380 of file SerialCmd.cpp.
Referenced by cmdPin(), and cdc::serial::SerialCmd::registerBuiltinCommands().
|
constexpr |
Buffer size for the "<name> <args>" column built during HELP rendering.
Definition at line 29 of file ICommandRegistry.h.
Referenced by printSubCommandHelp(), and cdc::serial::CommandRegistry::showHelp().
|
static |
Definition at line 2390 of file SerialCmd.cpp.
Referenced by cmdTr01(), and cdc::serial::SerialCmd::registerBuiltinCommands().
|
static |
Definition at line 2406 of file SerialCmd.cpp.
Referenced by cmdWifi(), and cdc::serial::SerialCmd::registerBuiltinCommands().
|
staticconstexpr |
Maximum number of commands that can be registered.
Definition at line 22 of file CommandRegistry.cpp.
Referenced by cdc::serial::CommandRegistry::registerCommand().
|
staticconstexpr |
Definition at line 50 of file SerialCmd.cpp.
Referenced by cmdNvsDel(), and cmdNvsRead().
|
staticconstexpr |
Definition at line 51 of file SerialCmd.cpp.
Referenced by cmdNvsDel(), cmdNvsList(), and cmdNvsRead().
|
static |
Session authentication flags and timeout baseline.
Definition at line 87 of file SerialCmd.cpp.
Referenced by cdc::serial::SerialCmd::authenticate(), cdc::serial::SerialCmd::isAuthenticated(), cdc::serial::SerialCmd::logout(), and cdc::serial::SerialCmd::touchAuthSession().
|
static |
Definition at line 88 of file SerialCmd.cpp.
Referenced by cdc::serial::SerialCmd::authenticate(), cdc::serial::SerialCmd::isAuthenticated(), cdc::serial::SerialCmd::logout(), and cdc::serial::SerialCmd::touchAuthSession().
|
static |
Global static state for line editing and command dispatch.
Definition at line 60 of file SerialCmd.cpp.
Referenced by redrawLine().
|
static |
Definition at line 61 of file SerialCmd.cpp.
|
static |
Definition at line 76 of file SerialCmd.cpp.
|
static |
Command history ring buffer allocated in PSRAM.
Definition at line 67 of file SerialCmd.cpp.
Referenced by historyAdd(), and historyGet().
|
static |
Definition at line 68 of file SerialCmd.cpp.
Referenced by historyAdd(), and historyGet().
|
static |
Definition at line 69 of file SerialCmd.cpp.
Referenced by historyAdd(), and historyGet().
|
static |
Definition at line 70 of file SerialCmd.cpp.
|
static |
Definition at line 13 of file Console.cpp.
Referenced by cdc::serial::Console::init(), and cdc::serial::SerialCmd::init().
|
static |
Definition at line 62 of file SerialCmd.cpp.
|
static |
Optional callbacks injected by higher-level modules.
Definition at line 81 of file SerialCmd.cpp.
Referenced by cmdSetInfo(), cmdSetInfo2(), cmdSetName(), and cdc::serial::SerialCmd::setTextCallback().
|
static |
Definition at line 82 of file SerialCmd.cpp.
Referenced by cmdSetDate(), cmdSetTime(), and cdc::serial::SerialCmd::setTimeCallback().
|
staticconstexpr |
Definition at line 1889 of file SerialCmd.cpp.
Referenced by cmdWifiScan().
|
staticconstexpr |
WiFi serial command handlers.
Thin wrappers around cdc::ui::WifiHandlers for credential storage and connection lifecycle, plus cdc::hal::IWifiController for runtime state (scan, mode, IP/MAC/RSSI).
Definition at line 1888 of file SerialCmd.cpp.
Referenced by cmdWifiScan().
|
staticconstexpr |
Definition at line 54 of file SerialCmd.cpp.
Referenced by cmdTr01Wipe().
|
staticconstexpr |
Definition at line 53 of file SerialCmd.cpp.
Referenced by cmdSetDate().
|
staticconstexpr |
Definition at line 52 of file SerialCmd.cpp.
Referenced by cmdSetDate().