Open FFBoard
Open source force feedback firmware
CanAnalogBase Class Reference

#include <CanAnalog.h>

Inheritance diagram for CanAnalogBase:
AnalogSource CanHandler CommandHandler ChoosableClass PersistentStorage CanAnalog< AMOUNT >

Public Types

enum class  CanAnalog_commands : uint32_t { canid , amount , maxAmount }
 

Public Member Functions

 CanAnalogBase (uint8_t maxAxes=8)
 
virtual ~CanAnalogBase ()
 
const ClassIdentifier getInfo ()
 
void restoreFlash ()
 
void saveFlash ()
 
std::string getHelpstring ()
 
void setupCanPort ()
 
void setAxisNum (uint8_t num)
 
CommandStatus command (const ParsedCommand &cmd, std::vector< CommandReply > &replies)
 
void canRxPendCallback (CANPort *port, CAN_rx_msg &msg) override
 
- Public Member Functions inherited from AnalogSource
 AnalogSource ()
 
virtual ~AnalogSource ()
 
const ClassType getClassType () override
 returns the used classchooser selection id of this instance More...
 
virtual std::vector< int32_t > * getAxes ()
 
- Public Member Functions inherited from ChoosableClass
virtual ~ChoosableClass ()
 
uint16_t getSelectionID ()
 
- Public Member Functions inherited from PersistentStorage
 PersistentStorage ()
 
virtual ~PersistentStorage ()
 
void restoreFlashDelayed ()
 
- Public Member Functions inherited from CanHandler
 CanHandler ()
 
virtual ~CanHandler ()
 
virtual void canErrorCallback (CANPort *port, uint32_t errcode)
 
virtual void canRxFullCallback (CANPort *port, uint32_t fifo)
 
virtual void canTxCpltCallback (CANPort *port, uint32_t mailbox)
 
virtual void canTxAbortCallback (CANPort *port, uint32_t mailbox)
 
- Public Member Functions inherited from CommandHandler
virtual const ClassType getClassType ()
 
 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 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 Attributes

static ClassIdentifier info
 
- Static Public Attributes inherited from AnalogSource
static ClassIdentifier info
 
static const std::vector< class_entry< AnalogSource > > all_analogsources
 
- Static Public Attributes inherited from ChoosableClass
static ClassIdentifier info
 
- Static Public Attributes inherited from CommandHandler
static bool logEnabled = true
 

Private Attributes

uint32_t canId = 110
 
int32_t filterId = -1
 
CANPortport = &canport
 
uint8_t axes = 1
 
const uint8_t maxAxes
 
uint8_t packets = 1
 

Additional Inherited Members

- Static Public Member Functions inherited from AnalogSource
static bool isCreatable ()
 
- Static Public Member Functions inherited from ChoosableClass
static bool isCreatable ()
 
- Static Public Member Functions inherited from PersistentStorage
static std::vector< PersistentStorage * > & getFlashHandlers ()
 
static void restoreFlashStartupCb ()
 
- Static Public Member Functions inherited from CanHandler
static std::vector< CanHandler * > & getCANHandlers ()
 
- 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)
 
- Public Attributes inherited from AnalogSource
std::vector< int32_t > buf
 
- 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 ChoosableClass
uint16_t selectionId
 Should only be written by ClassChooser during creation. More...
 
- Protected Attributes inherited from PersistentStorage
bool restoreDelayedFlag = false
 
- Protected Attributes inherited from CommandHandler
bool commandsEnabled = true
 
std::vector< CmdHandlerCommanddefregisteredCommands
 
CmdHandlerInfo cmdHandlerInfo
 
- Static Protected Attributes inherited from PersistentStorage
static bool startupComplete = false
 

Detailed Description

Definition at line 22 of file CanAnalog.h.

Member Enumeration Documentation

◆ CanAnalog_commands

enum class CanAnalogBase::CanAnalog_commands : uint32_t
strong
Enumerator
canid 
amount 
maxAmount 

Definition at line 24 of file CanAnalog.h.

Constructor & Destructor Documentation

◆ CanAnalogBase()

CanAnalogBase::CanAnalogBase ( uint8_t  maxAxes = 8)

Definition at line 20 of file CanAnalog.cpp.

◆ ~CanAnalogBase()

CanAnalogBase::~CanAnalogBase ( )
virtual

Definition at line 45 of file CanAnalog.cpp.

Member Function Documentation

◆ canRxPendCallback()

void CanAnalogBase::canRxPendCallback ( CANPort port,
CAN_rx_msg msg 
)
overridevirtual

New message received in fifo number

Reimplemented from CanHandler.

Definition at line 108 of file CanAnalog.cpp.

◆ command()

CommandStatus CanAnalogBase::command ( const ParsedCommand cmd,
std::vector< CommandReply > &  replies 
)
virtual
Parameters
[in]cmdThe parsed command to be executed.
[out]repliesA 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.

Definition at line 77 of file CanAnalog.cpp.

◆ getHelpstring()

std::string CanAnalogBase::getHelpstring ( )
inlinevirtual

Returns a description of this class

Reimplemented from CommandHandler.

Definition at line 37 of file CanAnalog.h.

◆ getInfo()

const ClassIdentifier CanAnalogBase::getInfo ( )
virtual

Implements AnalogSource.

Definition at line 16 of file CanAnalog.cpp.

◆ restoreFlash()

void CanAnalogBase::restoreFlash ( )
virtual

Should be implemented to restore settings. This is not automatically called and should be called when appropriate.

Reimplemented from PersistentStorage.

Definition at line 58 of file CanAnalog.cpp.

◆ saveFlash()

void CanAnalogBase::saveFlash ( )
virtual

Called when the user uses the "save" command and presses the save button in the configurator Automatically called by the command parser thread for every class that inherits from PersistentStorage

Reimplemented from PersistentStorage.

Definition at line 50 of file CanAnalog.cpp.

◆ setAxisNum()

void CanAnalogBase::setAxisNum ( uint8_t  num)

Definition at line 68 of file CanAnalog.cpp.

◆ setupCanPort()

void CanAnalogBase::setupCanPort ( )

Definition at line 31 of file CanAnalog.cpp.

Member Data Documentation

◆ axes

uint8_t CanAnalogBase::axes = 1
private

Definition at line 51 of file CanAnalog.h.

◆ canId

uint32_t CanAnalogBase::canId = 110
private

Definition at line 48 of file CanAnalog.h.

◆ filterId

int32_t CanAnalogBase::filterId = -1
private

Definition at line 49 of file CanAnalog.h.

◆ info

ClassIdentifier CanAnalogBase::info
static
Initial value:
= {
.name = "CAN Analog" ,
.id=CLSID_ANALOG_CAN,
}

Definition at line 32 of file CanAnalog.h.

◆ maxAxes

const uint8_t CanAnalogBase::maxAxes
private

Definition at line 52 of file CanAnalog.h.

◆ packets

uint8_t CanAnalogBase::packets = 1
private

Definition at line 53 of file CanAnalog.h.

◆ port

CANPort* CanAnalogBase::port = &canport
private

Definition at line 50 of file CanAnalog.h.


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