Open FFBoard
Open source force feedback firmware
SystemCommands Class Reference

#include <SystemCommands.h>

Inheritance diagram for SystemCommands:
CommandHandler

Public Member Functions

 SystemCommands ()
 
virtual ~SystemCommands ()
 
const ClassIdentifier getInfo ()
 Command handlers always have class infos. Works well with ChoosableClass. More...
 
void registerCommands ()
 
CommandStatus internalCommand (const ParsedCommand &cmd, std::vector< CommandReply > &replies)
 
const ClassType getClassType ()
 
- Public Member Functions inherited from CommandHandler
 CommandHandler (const char *clsname, uint16_t clsid, uint8_t instance=0)
 
virtual ~CommandHandler ()
 
virtual bool hasCommands ()
 
virtual void setCommandsEnabled (bool enable)
 
virtual CommandStatus command (const ParsedCommand &cmd, std::vector< CommandReply > &replies)
 
void registerCommands ()
 
virtual std::string getHelpstring ()
 
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 CmdHandlerInfogetCommandHandlerInfo ()
 
virtual bool isValidCommandId (uint32_t cmdid, uint32_t ignoredFlags=0, uint32_t requiredFlag=0)
 
virtual CmdHandlerCommanddefgetCommandFromName (const std::string &cmd, uint32_t ignoredFlags=0)
 
virtual CmdHandlerCommanddefgetCommandFromId (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 void replyFlashDump (std::vector< CommandReply > &replies)
 
static void replyErrors (std::vector< CommandReply > &replies)
 
- Static Public Member Functions inherited from CommandHandler
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 CommandHandlergetHandlerFromHandlerId (const uint16_t cmdhandlerID)
 
static CommandHandlergetHandlerFromId (const uint16_t id, const uint8_t instance=0xFF)
 
static CommandHandlergetHandlerFromClassName (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)
 

Static Public Attributes

static ClassIdentifier info
 
static bool debugMode = false
 
static bool errorPrintingEnabled = true
 
static SystemCommandssystemCommandsInstance = nullptr
 
- Static Public Attributes inherited from CommandHandler
static bool logEnabled = true
 

Additional Inherited Members

- Protected Member Functions inherited from CommandHandler
void setInstance (uint8_t instance)
 
virtual void addCommandHandler ()
 
virtual void removeCommandHandler ()
 
- Static Protected Member Functions inherited from CommandHandler
static std::vector< uint16_t > & getCommandHandlerIds ()
 
- Protected Attributes inherited from CommandHandler
bool commandsEnabled = true
 
std::vector< CmdHandlerCommanddefregisteredCommands
 
CmdHandlerInfo cmdHandlerInfo
 

Detailed Description

Definition at line 17 of file SystemCommands.h.

Constructor & Destructor Documentation

◆ SystemCommands()

SystemCommands::SystemCommands ( )

Definition at line 35 of file SystemCommands.cpp.

◆ ~SystemCommands()

SystemCommands::~SystemCommands ( )
virtual

Definition at line 42 of file SystemCommands.cpp.

Member Function Documentation

◆ getClassType()

const ClassType SystemCommands::getClassType ( )
inlinevirtual

Type of this class. Mainclass, motordriver... Should be implemented by the parent class so it is not in the info struct

Reimplemented from CommandHandler.

Definition at line 29 of file SystemCommands.h.

◆ getInfo()

const ClassIdentifier SystemCommands::getInfo ( )
virtual

Command handlers always have class infos. Works well with ChoosableClass.

Implements CommandHandler.

Definition at line 31 of file SystemCommands.cpp.

◆ internalCommand()

CommandStatus SystemCommands::internalCommand ( const ParsedCommand cmd,
std::vector< CommandReply > &  replies 
)
virtual

Some standard commands most classes will need

Reimplemented from CommandHandler.

◆ registerCommands()

void SystemCommands::registerCommands ( )

Definition at line 47 of file SystemCommands.cpp.

◆ replyErrors()

void SystemCommands::replyErrors ( std::vector< CommandReply > &  replies)
static

Definition at line 321 of file SystemCommands.cpp.

◆ replyFlashDump()

void SystemCommands::replyFlashDump ( std::vector< CommandReply > &  replies)
static

Definition at line 301 of file SystemCommands.cpp.

Member Data Documentation

◆ debugMode

bool SystemCommands::debugMode = false
static

Definition at line 34 of file SystemCommands.h.

◆ errorPrintingEnabled

bool SystemCommands::errorPrintingEnabled = true
static

Definition at line 36 of file SystemCommands.h.

◆ info

ClassIdentifier SystemCommands::info
static
Initial value:
= {
.name = "System Commands" ,
.id = CLSID_SYSTEM,
}

Definition at line 23 of file SystemCommands.h.

◆ systemCommandsInstance

SystemCommands * SystemCommands::systemCommandsInstance = nullptr
static

Definition at line 37 of file SystemCommands.h.


The documentation for this class was generated from the following files: