|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <ICommandRegistry.h>
Public Types | |
| using | LineInterceptor = bool (*)(const char* line) |
| using | ByteInterceptor = void (*)(uint8_t byte) |
Public Member Functions | |
| virtual | ~ICommandRegistry ()=default |
| virtual bool | registerCommand (const Command &cmd)=0 |
| virtual void | unregisterModule (const char *moduleName)=0 |
| virtual bool | processCommand (const char *line)=0 |
| virtual void | showHelp ()=0 |
| virtual size_t | getCommandCount () const =0 |
| virtual void | setAuthProvider (bool(*authCheck)())=0 |
| virtual void | setOnCommandExecuted (void(*callback)())=0 |
| virtual void | setLineInterceptor (LineInterceptor interceptor) |
| virtual void | setByteInterceptor (ByteInterceptor interceptor) |
| virtual ByteInterceptor | getByteInterceptor () const |
Command Registry Interface
Modules register their commands here. The registry handles:
Definition at line 51 of file ICommandRegistry.h.
| using cdc::serial::ICommandRegistry::ByteInterceptor = void (*)(uint8_t byte) |
Byte interceptor for binary streaming modes (e.g. raw plugin upload).
While installed, every byte received from serial is passed directly to the handler instead of being echoed, accumulated in the line buffer or dispatched as a command. The interceptor decides when to remove itself (typically once the expected payload size has been received) by calling setByteInterceptor(nullptr).
Definition at line 119 of file ICommandRegistry.h.
| using cdc::serial::ICommandRegistry::LineInterceptor = bool (*)(const char* line) |
Line interceptor for multiline input modes (e.g., vCard paste). When set, called before normal command dispatch. Return true to consume the line, false for normal processing.
Definition at line 102 of file ICommandRegistry.h.
|
virtualdefault |
|
inlinevirtual |
Reimplemented in cdc::serial::CommandRegistry.
Definition at line 126 of file ICommandRegistry.h.
|
pure virtual |
Get number of registered commands
Implemented in cdc::serial::CommandRegistry.
|
pure virtual |
Process a command line
| line | Full command line (command + arguments) |
Implemented in cdc::serial::CommandRegistry.
|
pure virtual |
Register a command
| Plugin command channel | Command definition |
Implemented in cdc::serial::CommandRegistry.
Referenced by cdc::ui::registerBackupSerialCommand().
|
pure virtual |
Set authentication provider callback
| authCheck | Function that returns true if session is authenticated |
Implemented in cdc::serial::CommandRegistry.
Referenced by cdc::serial::SerialCmd::init().
|
inlinevirtual |
Set or clear the byte interceptor. While set, line-based parsing is fully bypassed.
Reimplemented in cdc::serial::CommandRegistry.
Definition at line 125 of file ICommandRegistry.h.
|
inlinevirtual |
Set or clear the line interceptor
| interceptor | Callback, or nullptr to clear |
Reimplemented in cdc::serial::CommandRegistry.
Definition at line 108 of file ICommandRegistry.h.
Referenced by cdc::mod_vcard::cmdVcardSet(), and cdc::mod_vcard::vcard_session_clear().
|
pure virtual |
Set callback for successful command execution Used to reset auth timer when FEATURE_SECURE_SERIAL is enabled
Implemented in cdc::serial::CommandRegistry.
Referenced by cdc::serial::SerialCmd::init().
|
pure virtual |
Show help for all commands
Implemented in cdc::serial::CommandRegistry.
Referenced by cdc::serial::cmdHelp().
|
pure virtual |
Unregister all commands from a module
| moduleName | Module name used in registration |
Implemented in cdc::serial::CommandRegistry.