![]() |
Open FFBoard
Open source force feedback firmware
|
#include <FFBoardMain.h>
Public Member Functions | |
virtual const ClassIdentifier | getInfo () |
const ClassType | getClassType () override |
returns the used classchooser selection id of this instance More... | |
FFBoardMain () | |
virtual | ~FFBoardMain () |
virtual void | usbInit () |
virtual void | update () |
virtual void | cdcRcv (char *Buf, uint32_t *Len) |
virtual void | cdcRcvReady (uint8_t itf) |
virtual void | usbSuspend () |
virtual void | usbResume () |
virtual CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
virtual std::string | getHelpstring () |
![]() | |
virtual | ~ChoosableClass () |
uint16_t | getSelectionID () |
![]() | |
CommandHandler (const char *clsname, uint16_t clsid, uint8_t instance=0) | |
virtual | ~CommandHandler () |
virtual bool | hasCommands () |
virtual void | setCommandsEnabled (bool enable) |
void | registerCommands () |
virtual CommandStatus | internalCommand (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
virtual std::string | getCommandsHelpstring () |
virtual std::string | getCsvHelpstring () |
virtual uint8_t | getCommandHandlerInstance () |
void | broadcastCommandReply (CommandReply reply, uint32_t cmdId, CMDtype type) |
void | sendCommandReplyAsync (CommandReply reply, uint32_t cmdId, CMDtype type, CommandInterface *interface=nullptr) |
virtual uint16_t | getCommandHandlerID () |
virtual CmdHandlerInfo * | getCommandHandlerInfo () |
virtual bool | isValidCommandId (uint32_t cmdid, uint32_t ignoredFlags=0, uint32_t requiredFlag=0) |
virtual CmdHandlerCommanddef * | getCommandFromName (const std::string &cmd, uint32_t ignoredFlags=0) |
virtual CmdHandlerCommanddef * | getCommandFromId (const uint32_t id, uint32_t ignoredFlags=0) |
template<typename ID > | |
void | registerCommand (const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0) |
Static Public Member Functions | |
static bool | isCreatable () |
![]() | |
static bool | isCreatable () |
![]() | |
static void | logSerial (std::string string) |
Send a log formatted sequence. More... | |
static void | logSerialDebug (std::string string) |
Send a log formatted sequence if debug is on. More... | |
static bool | logsEnabled () |
static void | setLogsEnabled (bool enabled) |
static uint32_t | getClassIdFromName (const char *name) |
static const char * | getClassNameFromId (const uint32_t id) |
static CommandHandler * | getHandlerFromHandlerId (const uint16_t cmdhandlerID) |
static CommandHandler * | getHandlerFromId (const uint16_t id, const uint8_t instance=0xFF) |
static CommandHandler * | getHandlerFromClassName (const char *name, const uint8_t instance=0xFF) |
static std::vector< CommandHandler * > | getHandlersFromClassName (const char *name) |
static std::vector< CommandHandler * > | getHandlersFromId (const uint16_t id) |
static bool | isInHandlerList (CommandHandler *handler) |
static std::string | getAllHelpstrings () |
static std::vector< CommandHandler * > & | getCommandHandlers () |
template<typename TVal > | |
static CommandStatus | handleGetSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value) |
template<typename TVal , class cls , class cls1 > | |
static CommandStatus | handleGetSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, void(cls1::*setfunc)(TVal), cls *obj) |
template<typename TVal , class cls , class cls1 , class cls2 > | |
static CommandStatus | handleGetFuncSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal(cls1::*getfunc)(), void(cls2::*setfunc)(TVal), cls *obj) |
template<typename TVal , class cls , class cls1 > | |
static CommandStatus | handleGetFuncSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, TVal(cls1::*getfunc)(), cls *obj) |
Public Attributes | |
std::unique_ptr< FFBoardMainCommandThread > | commandThread |
std::unique_ptr< CDC_CommandInterface > | cdcCmdInterface = std::make_unique<CDC_CommandInterface>() |
ErrorPrinter | errorPrinter |
SystemCommands | systemCommands |
System command handler. More... | |
std::unique_ptr< UART_CommandInterface > | uartCmdInterface = std::make_unique<UART_CommandInterface>(115200) |
Static Public Attributes | |
static ClassIdentifier | info ={.name = "Basic (Failsafe)" ,.id=0} |
![]() | |
static ClassIdentifier | info |
![]() | |
static bool | logEnabled = true |
Protected Attributes | |
std::unique_ptr< USBdevice > | usbdev |
![]() | |
uint16_t | selectionId |
Should only be written by ClassChooser during creation. More... | |
![]() | |
bool | commandsEnabled = true |
std::vector< CmdHandlerCommanddef > | registeredCommands |
CmdHandlerInfo | cmdHandlerInfo |
Static Protected Attributes | |
static char | cdcbuf [] |
Additional Inherited Members | |
![]() | |
void | setInstance (uint8_t instance) |
virtual void | addCommandHandler () |
virtual void | removeCommandHandler () |
![]() | |
static std::vector< uint16_t > & | getCommandHandlerIds () |
Definition at line 32 of file FFBoardMain.h.
FFBoardMain::FFBoardMain | ( | ) |
Definition at line 21 of file FFBoardMain.cpp.
|
virtual |
Definition at line 94 of file FFBoardMain.cpp.
|
virtual |
Called when data is received on the CDC port
Reimplemented in TMCDebugBridge, and CanBridge.
Definition at line 32 of file FFBoardMain.cpp.
|
virtual |
Called by the CDC serial port when data is ready
Definition at line 40 of file FFBoardMain.cpp.
|
virtual |
[in] | cmd | The parsed command to be executed. |
[out] | replies | A vector to return one or multiple reply objects into. Replies to the interface will be generated based on the reply objects. A string reply may not contain start, end and separation markers: [,],| Other characters are allowed. |
Reimplemented from CommandHandler.
Reimplemented in CanBridge, CANInputMain, CustomMain, FFBHIDMain, MidiMain, and TMCDebugBridge.
Definition at line 49 of file FFBoardMain.cpp.
|
inlineoverridevirtual |
returns the used classchooser selection id of this instance
Type of this class. Mainclass, motordriver... Should be implemented by the parent class so it is not in the info struct
Reimplemented from ChoosableClass.
Definition at line 37 of file FFBoardMain.h.
|
virtual |
Returns a description of this class
Reimplemented from CommandHandler.
Reimplemented in CanBridge, CANInputMain, CustomMain, FFBHIDMain, MidiMain, and TMCDebugBridge.
Definition at line 90 of file FFBoardMain.cpp.
|
virtual |
Implements ChoosableClass.
Reimplemented in CANInputMain, CustomMain, FFBHIDExt, FFBJoystick, FFBWheel, MidiMain, TMCDebugBridge, CanBridge, and FFBHIDMain.
Definition at line 25 of file FFBoardMain.cpp.
|
inlinestatic |
Definition at line 36 of file FFBoardMain.h.
|
virtual |
Called in the default thread with no delay Can be reimplemented by custom main classes but should not block
Reimplemented in CanBridge, and MidiMain.
Definition at line 71 of file FFBoardMain.cpp.
|
virtual |
Called during the startup Should initialize a USBdevice and call registerUsb()
Reimplemented in MidiMain, CANInputMain, FFBHIDExt, FFBJoystick, FFBWheel, and FFBHIDMain.
Definition at line 61 of file FFBoardMain.cpp.
|
virtual |
Called when the usb port is connected
Reimplemented in FFBHIDMain.
Definition at line 85 of file FFBoardMain.cpp.
|
virtual |
Called when the usb port is disconnected
Reimplemented in FFBHIDMain.
Definition at line 78 of file FFBoardMain.cpp.
|
staticprotected |
Definition at line 67 of file FFBoardMain.h.
std::unique_ptr<CDC_CommandInterface> FFBoardMain::cdcCmdInterface = std::make_unique<CDC_CommandInterface>() |
Definition at line 57 of file FFBoardMain.h.
std::unique_ptr<FFBoardMainCommandThread> FFBoardMain::commandThread |
Definition at line 56 of file FFBoardMain.h.
ErrorPrinter FFBoardMain::errorPrinter |
Definition at line 58 of file FFBoardMain.h.
|
static |
Definition at line 34 of file FFBoardMain.h.
SystemCommands FFBoardMain::systemCommands |
System command handler.
Definition at line 59 of file FFBoardMain.h.
std::unique_ptr<UART_CommandInterface> FFBoardMain::uartCmdInterface = std::make_unique<UART_CommandInterface>(115200) |
Definition at line 62 of file FFBoardMain.h.
|
protected |
Definition at line 66 of file FFBoardMain.h.