Open FFBoard
Open source force feedback firmware
CommandInterface Class Referenceabstract

#include <CommandInterface.h>

Inheritance diagram for CommandInterface:
HID_CommandInterface StringCommandInterface CDC_CommandInterface UART_CommandInterface

Public Member Functions

 CommandInterface ()
 
virtual ~CommandInterface ()
 
virtual const std::string getHelpstring ()
 
virtual bool getNewCommands (std::vector< ParsedCommand > &commands)=0
 
virtual bool hasNewCommands ()
 
virtual void sendReplies (const std::vector< CommandResult > &results, CommandInterface *originalInterface)=0
 
virtual void sendReplyAsync (std::vector< CommandReply > &reply, CommandHandler *handler, uint32_t cmdId, CMDtype type)
 
virtual bool readyToSend ()
 
virtual void batchDone ()
 

Static Public Member Functions

static CommandResult makeCommandReply (const std::vector< CommandReply > &reply, CommandHandler *handler, uint32_t cmdId, CMDtype type=CMDtype::get, CommandInterface *originalInterface=nullptr)
 
static void broadcastCommandReplyAsync (const std::vector< CommandReply > &reply, CommandHandler *handler, uint32_t cmdId, CMDtype type=CMDtype::get)
 

Static Public Attributes

static std::vector< CommandInterface * > cmdInterfaces
 

Protected Attributes

bool parserReady = false
 

Detailed Description

Different command interface implementations

Definition at line 24 of file CommandInterface.h.

Constructor & Destructor Documentation

◆ CommandInterface()

CommandInterface::CommandInterface ( )

Definition at line 18 of file CommandInterface.cpp.

◆ ~CommandInterface()

CommandInterface::~CommandInterface ( )
virtual

Definition at line 22 of file CommandInterface.cpp.

Member Function Documentation

◆ batchDone()

void CommandInterface::batchDone ( )
virtual

Command thread signals that all commands in this batch are done

Reimplemented in CDC_CommandInterface, and UART_CommandInterface.

Definition at line 85 of file CommandInterface.cpp.

◆ broadcastCommandReplyAsync()

void CommandInterface::broadcastCommandReplyAsync ( const std::vector< CommandReply > &  reply,
CommandHandler handler,
uint32_t  cmdId,
CMDtype  type = CMDtype::get 
)
static

Broadcasts an unrequested reply to all command interfaces

Definition at line 30 of file CommandInterface.cpp.

◆ getHelpstring()

virtual const std::string CommandInterface::getHelpstring ( )
inlinevirtual

◆ getNewCommands()

virtual bool CommandInterface::getNewCommands ( std::vector< ParsedCommand > &  commands)
pure virtual

◆ hasNewCommands()

bool CommandInterface::hasNewCommands ( )
virtual

Command thread requests new commands Return true if any are ready, false otherwise If true it will request the vector of parsed commands

Definition at line 70 of file CommandInterface.cpp.

◆ makeCommandReply()

CommandResult CommandInterface::makeCommandReply ( const std::vector< CommandReply > &  reply,
CommandHandler handler,
uint32_t  cmdId,
CMDtype  type = CMDtype::get,
CommandInterface originalInterface = nullptr 
)
static

Definition at line 47 of file CommandInterface.cpp.

◆ readyToSend()

bool CommandInterface::readyToSend ( )
virtual

Returns true if it can send replies. False if the command thread should wait until previous replies are processed

Reimplemented in UART_CommandInterface, HID_CommandInterface, and CDC_CommandInterface.

Definition at line 78 of file CommandInterface.cpp.

◆ sendReplies()

virtual void CommandInterface::sendReplies ( const std::vector< CommandResult > &  results,
CommandInterface originalInterface 
)
pure virtual

◆ sendReplyAsync()

void CommandInterface::sendReplyAsync ( std::vector< CommandReply > &  reply,
CommandHandler handler,
uint32_t  cmdId,
CMDtype  type 
)
virtual

Sends an unrequested reply to this specific interface

Definition at line 42 of file CommandInterface.cpp.

Member Data Documentation

◆ cmdInterfaces

std::vector< CommandInterface * > CommandInterface::cmdInterfaces
static

Definition at line 26 of file CommandInterface.h.

◆ parserReady

bool CommandInterface::parserReady = false
protected

Definition at line 40 of file CommandInterface.h.


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