Open FFBoard
Open source force feedback firmware
StringCommandInterface Class Reference

#include <CommandInterface.h>

Inheritance diagram for StringCommandInterface:
CommandInterface CDC_CommandInterface UART_CommandInterface

Public Member Functions

 StringCommandInterface (uint32_t bufferMaxCapacity=512)
 
bool addBuf (char *Buf, uint32_t *Len)
 
uint32_t bufferCapacity ()
 
bool getNewCommands (std::vector< ParsedCommand > &commands) override
 
const std::string getHelpstring ()
 
- Public Member Functions inherited from CommandInterface
 CommandInterface ()
 
virtual ~CommandInterface ()
 
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 void formatReply (std::string &reply, const std::vector< CommandResult > &results, const bool formatWriteAsRead=false)
 
static std::string formatOriginalCommandFromResult (const ParsedCommand &originalCommand, CommandHandler *commandHandler, const bool formatWriteAsRead=false)
 
static void generateReplyValueString (std::string &replyPart, const CommandReply &reply)
 
static void generateReplyFromCmd (std::string &replyPart, const ParsedCommand &originalCommand)
 
- Static Public Member Functions inherited from CommandInterface
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)
 

Protected Attributes

CmdParser parser
 
- Protected Attributes inherited from CommandInterface
bool parserReady = false
 

Additional Inherited Members

- Static Public Attributes inherited from CommandInterface
static std::vector< CommandInterface * > cmdInterfaces
 

Detailed Description

Helper class for string based interfaces

Definition at line 46 of file CommandInterface.h.

Constructor & Destructor Documentation

◆ StringCommandInterface()

StringCommandInterface::StringCommandInterface ( uint32_t  bufferMaxCapacity = 512)
inline

Definition at line 48 of file CommandInterface.h.

Member Function Documentation

◆ addBuf()

bool StringCommandInterface::addBuf ( char *  Buf,
uint32_t *  Len 
)

Definition at line 105 of file CommandInterface.cpp.

◆ bufferCapacity()

uint32_t StringCommandInterface::bufferCapacity ( )

Definition at line 114 of file CommandInterface.cpp.

◆ formatOriginalCommandFromResult()

std::string StringCommandInterface::formatOriginalCommandFromResult ( const ParsedCommand originalCommand,
CommandHandler commandHandler,
const bool  formatWriteAsRead = false 
)
static

Formats a command string from a reply result

Definition at line 166 of file CommandInterface.cpp.

◆ formatReply()

void StringCommandInterface::formatReply ( std::string &  reply,
const std::vector< CommandResult > &  results,
const bool  formatWriteAsRead = false 
)
static

Definition at line 118 of file CommandInterface.cpp.

◆ generateReplyFromCmd()

void StringCommandInterface::generateReplyFromCmd ( std::string &  replyPart,
const ParsedCommand originalCommand 
)
static

Definition at line 225 of file CommandInterface.cpp.

◆ generateReplyValueString()

void StringCommandInterface::generateReplyValueString ( std::string &  replyPart,
const CommandReply reply 
)
static

Creates the value part of the reply string

Definition at line 210 of file CommandInterface.cpp.

◆ getHelpstring()

const std::string StringCommandInterface::getHelpstring ( )
inlinevirtual

Reimplemented from CommandInterface.

Reimplemented in CDC_CommandInterface, and UART_CommandInterface.

Definition at line 56 of file CommandInterface.h.

◆ getNewCommands()

bool StringCommandInterface::getNewCommands ( std::vector< ParsedCommand > &  commands)
overridevirtual

Implements CommandInterface.

Definition at line 96 of file CommandInterface.cpp.

Member Data Documentation

◆ parser

CmdParser StringCommandInterface::parser
protected

Definition at line 60 of file CommandInterface.h.


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