|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <SerialCmd.h>
Static Public Member Functions | |
| static void | init () |
| Public SerialCmd interface implementation. | |
| static bool | process () |
| Processes one pending input character from the serial console. | |
| static ICommandRegistry & | getRegistry () |
| Returns the shared command registry instance. | |
| static void | setTextCallback (TextChangeCallback callback) |
| Sets the callback used by text-setting commands. | |
| static void | setTimeCallback (TimeChangeCallback callback) |
| Sets the callback invoked after successful date/time updates. | |
| static bool | isAuthenticated () |
| Returns whether the serial session is currently authenticated. | |
| static bool | authenticate (const char *pin) |
| Attempts to authenticate the serial session with a PIN. | |
| static void | logout () |
| Logs out the current serial session. | |
| static void | touchAuthSession () |
| Keeps the auth session alive during a long-running serial activity. | |
| static void | registerBuiltinCommands () |
| Registers all built-in serial commands. | |
Static Public Attributes | |
| static constexpr size_t | CMD_BUFFER_SIZE = 256 |
| static constexpr uint32_t | AUTH_TIMEOUT_MS = 5 * 60 * 1000 |
Serial Command Processor
Main entry point for serial command handling. Handles:
Definition at line 23 of file SerialCmd.h.
|
static |
Attempts to authenticate the serial session with a PIN.
Authenticate with PIN
| pin | Candidate PIN string. |
Definition at line 1787 of file SerialCmd.cpp.
References cdc::core::PinManager::instance(), LOG_I, log_set_level(), LOG_W, cdc::serial::s_authenticated, cdc::serial::s_authTimestamp, and TAG.
|
static |
Returns the shared command registry instance.
Get command registry for module registration
Definition at line 1738 of file SerialCmd.cpp.
References cdc::serial::getCommandRegistry().
|
static |
Public SerialCmd interface implementation.
Initialize serial command system
Initializes the serial console and registers built-in commands.
Definition at line 1496 of file SerialCmd.cpp.
References cdc::serial::getCommandRegistry(), cdc::serial::Console::init(), isAuthenticated(), LOG_I, log_register_authgate_hook(), log_set_level(), cdc::serial::Console::printf(), registerBuiltinCommands(), cdc::serial::s_initialized, cdc::serial::ICommandRegistry::setAuthProvider(), cdc::serial::ICommandRegistry::setOnCommandExecuted(), cdc::serial::Console::showPrompt(), and TAG.
Referenced by initSerialCommandInterface().
|
static |
Returns whether the serial session is currently authenticated.
Check if currently authenticated
Definition at line 1762 of file SerialCmd.cpp.
References AUTH_TIMEOUT_MS, LOG_I, log_set_level(), cdc::serial::s_authenticated, cdc::serial::s_authTimestamp, and TAG.
Referenced by init().
|
static |
Logs out the current serial session.
Logout (clear authentication)
Definition at line 1833 of file SerialCmd.cpp.
References LOG_I, log_set_level(), cdc::serial::s_authenticated, cdc::serial::s_authTimestamp, and TAG.
|
static |
Processes one pending input character from the serial console.
Process one character from input Call this regularly from main loop
Definition at line 1716 of file SerialCmd.cpp.
References cdc::serial::Console::getchar().
Referenced by runMainLoopIteration().
|
static |
Registers all built-in serial commands.
Register built-in system commands (HELP, PING, STATUS, etc.)
Definition at line 2429 of file SerialCmd.cpp.
References cdc::serial::cmdBootloader(), cdc::serial::cmdCpu(), cdc::serial::cmdErrorLog(), cdc::serial::cmdGetDate(), cdc::serial::cmdGetTime(), cdc::serial::cmdHelp(), cdc::serial::cmdMem(), cdc::serial::cmdMemInfo(), cdc::serial::cmdModule(), cdc::serial::cmdNvs(), cdc::serial::cmdPaste(), cdc::serial::cmdPin(), cdc::serial::cmdPing(), cdc::serial::cmdReboot(), cdc::serial::cmdSetDate(), cdc::serial::cmdSetInfo(), cdc::serial::cmdSetInfo2(), cdc::serial::cmdSetName(), cdc::serial::cmdSetTime(), cdc::serial::cmdShipMode(), cdc::serial::cmdStatus(), cdc::serial::cmdTr01(), cdc::serial::cmdWifi(), cdc::serial::getCommandRegistry(), cdc::serial::kModuleSubs, cdc::serial::kNvsSubs, cdc::serial::kPinSubs, cdc::serial::kTr01Subs, and cdc::serial::kWifiSubs.
Referenced by init().
|
static |
Sets the callback used by text-setting commands.
Set callback for text changes (name, info, info2)
| callback | Callback receiving field key and new value. |
Definition at line 1746 of file SerialCmd.cpp.
References cdc::serial::s_textCallback.
Referenced by cdc::ui::ui_init().
|
static |
Sets the callback invoked after successful date/time updates.
Set callback for time changes
| callback | Callback triggered on time change. |
Definition at line 1754 of file SerialCmd.cpp.
References cdc::serial::s_timeCallback.
Referenced by cdc::ui::ui_init().
|
static |
Keeps the auth session alive during a long-running serial activity.
Refresh the authentication-timeout timestamp so a long-running serial activity (binary upload, multi-line paste) can keep the session alive without having to execute periodic dummy commands.
Definition at line 1822 of file SerialCmd.cpp.
References cdc::serial::s_authenticated, and cdc::serial::s_authTimestamp.
|
staticconstexpr |
Definition at line 26 of file SerialCmd.h.
Referenced by isAuthenticated().
|
staticconstexpr |
Definition at line 25 of file SerialCmd.h.
Referenced by cdc::serial::historyAdd(), and cdc::serial::redrawLine().