Open FFBoard
Open source force feedback firmware
CDC_CommandInterface Class Reference

#include <CommandInterface.h>

Inheritance diagram for CDC_CommandInterface:
StringCommandInterface cpp_freertos::Thread CommandInterface

Public Member Functions

 CDC_CommandInterface ()
 
virtual ~CDC_CommandInterface ()
 
void Run ()
 
void sendReplies (const std::vector< CommandResult > &results, CommandInterface *originalInterface) override
 
const std::string getHelpstring ()
 
bool readyToSend () override
 
void batchDone () override
 
- Public Member Functions inherited from StringCommandInterface
 StringCommandInterface (uint32_t bufferMaxCapacity=512)
 
bool addBuf (char *Buf, uint32_t *Len)
 
uint32_t bufferCapacity ()
 
bool getNewCommands (std::vector< ParsedCommand > &commands) override
 
- Public Member Functions inherited from CommandInterface
 CommandInterface ()
 
virtual ~CommandInterface ()
 
virtual bool hasNewCommands ()
 
virtual void sendReplyAsync (std::vector< CommandReply > &reply, CommandHandler *handler, uint32_t cmdId, CMDtype type)
 
- Public Member Functions inherited from cpp_freertos::Thread
 Thread (const std::string Name, uint16_t StackDepth, UBaseType_t Priority)
 
 Thread (const char *Name, uint16_t StackDepth, UBaseType_t Priority)
 
 Thread (uint16_t StackDepth, UBaseType_t Priority)
 
bool Start ()
 
virtual ~Thread ()
 
TaskHandle_t GetHandle ()
 
void Suspend ()
 
void Resume ()
 
void ResumeFromISR ()
 
void Notify ()
 
void NotifyFromISR ()
 
uint32_t WaitForNotification (TickType_t Timeout=portMAX_DELAY)
 
UBaseType_t GetPriority ()
 
UBaseType_t GetPriorityFromISR ()
 
void SetPriority (UBaseType_t NewPriority)
 
std::string GetName ()
 
char * GetName ()
 

Private Attributes

bool enableBroadcastFromOtherInterfaces = true
 
uint32_t lastSendTime = 0
 
const uint32_t parserTimeout = 500
 
std::vector< CommandResultresultsBuffer
 
bool nextFormat = false
 
std::string sendBuffer
 
uint32_t bufferLength = 0
 
const uint32_t maxSendBuffer = 1024
 

Additional Inherited Members

- Static Public Member Functions inherited from StringCommandInterface
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)
 
- Static Public Member Functions inherited from cpp_freertos::Thread
static void Yield ()
 
static void StartScheduler ()
 
static void EndScheduler ()
 
- Static Public Attributes inherited from CommandInterface
static std::vector< CommandInterface * > cmdInterfaces
 
- Protected Member Functions inherited from cpp_freertos::Thread
virtual void Cleanup ()
 
void Delay (const TickType_t Delay)
 
void DelayUntil (const TickType_t Period)
 
void ResetDelayUntil ()
 
bool Wait (ConditionVariable &Cv, Mutex &CvLock, TickType_t Timeout=portMAX_DELAY)
 
- Protected Attributes inherited from StringCommandInterface
CmdParser parser
 
- Protected Attributes inherited from CommandInterface
bool parserReady = false
 

Detailed Description

Definition at line 65 of file CommandInterface.h.

Constructor & Destructor Documentation

◆ CDC_CommandInterface()

CDC_CommandInterface::CDC_CommandInterface ( )

Definition at line 243 of file CommandInterface.cpp.

◆ ~CDC_CommandInterface()

CDC_CommandInterface::~CDC_CommandInterface ( )
virtual

Definition at line 248 of file CommandInterface.cpp.

Member Function Documentation

◆ batchDone()

void CDC_CommandInterface::batchDone ( )
overridevirtual

Command thread signals that all commands in this batch are done

Reimplemented from CommandInterface.

Definition at line 297 of file CommandInterface.cpp.

◆ getHelpstring()

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

Reimplemented from StringCommandInterface.

Definition at line 73 of file CommandInterface.h.

◆ readyToSend()

bool CDC_CommandInterface::readyToSend ( )
overridevirtual

Ready to send if there is no data in the backup buffer of the cdc port

Reimplemented from CommandInterface.

Definition at line 307 of file CommandInterface.cpp.

◆ Run()

void CDC_CommandInterface::Run ( )
virtual

Implementation of your actual thread code. You must override this function.

Note
If INCLUDE_vTaskDelete is defined, then you may return from your Run method. This will cause the task to be deleted from FreeRTOS, however you are still responsible to delete the task object. If this is not defined, then retuning from your Run() method will result in an assert.

Implements cpp_freertos::Thread.

Definition at line 253 of file CommandInterface.cpp.

◆ sendReplies()

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

Implements CommandInterface.

Definition at line 269 of file CommandInterface.cpp.

Member Data Documentation

◆ bufferLength

uint32_t CDC_CommandInterface::bufferLength = 0
private

Definition at line 85 of file CommandInterface.h.

◆ enableBroadcastFromOtherInterfaces

bool CDC_CommandInterface::enableBroadcastFromOtherInterfaces = true
private

Definition at line 78 of file CommandInterface.h.

◆ lastSendTime

uint32_t CDC_CommandInterface::lastSendTime = 0
private

Definition at line 79 of file CommandInterface.h.

◆ maxSendBuffer

const uint32_t CDC_CommandInterface::maxSendBuffer = 1024
private

Definition at line 86 of file CommandInterface.h.

◆ nextFormat

bool CDC_CommandInterface::nextFormat = false
private

Definition at line 83 of file CommandInterface.h.

◆ parserTimeout

const uint32_t CDC_CommandInterface::parserTimeout = 500
private

Definition at line 80 of file CommandInterface.h.

◆ resultsBuffer

std::vector<CommandResult> CDC_CommandInterface::resultsBuffer
private

Definition at line 82 of file CommandInterface.h.

◆ sendBuffer

std::string CDC_CommandInterface::sendBuffer
private

Definition at line 84 of file CommandInterface.h.


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