68 if (data.find(
syntax->cmdErrorPrefix) == 0)
71 error(
"UC board reported the following command error:\n"+data);
73 else if (data.find(
syntax->genErrorPrefix) == 0)
76 error(
"UC board reported the following error:\n"+data);
78 else if (data.find(
syntax->textMsgPrefix) == 0)
83 else if (data.find(
syntax->channelGrpMsgPrefix) == 0)
88 else if (data.find(
syntax->answerOnCmdPrefix) == 0)
119 this->
comCV = condVar;
const bool IsResponseQueueEmpty() const
Is there a response in the response queue?
void registerErrorCallback(errorCallbackPtr error)
Register an error function pointer to handle errors during communication.
bool rawCommunicationEnabled
std::condition_variable * comCV
ReadingThread * readingThread
void sleep()
Locks the current worker thread until wakeUp() is called.
The ReadingThread class implements threadded polling of the serial input buffer.
void enableDebugMessages(debugCallbackPtr debug)
Enable pass through of every line in the input buffer.
std::queue< std::string > sensorGroupMessage
void registerErrorCallback(debugCallbackPtr error)
Register a callback to handle transmission/communication errors.
Header file for the ThreadDispatcher class.
void setCommunicationCondVar(std::condition_variable *condVar)
Register the condition variable of the Communication object in order to wakeup a waiting command resp...
void setReadingThread(ReadingThread *rxThread)
Register ReadingThread with the thread dispatcher.
void stopThread()
Stop parsing incoming sensor group messages.
SensorGroupThread * sensorGroupThread
void startThread()
Start dispatching thread, SensorGroupThread and ReadingThread.
void startThread()
Start the polling of the serial input buffer..
void registerErrorCallback(errorCallbackPtr error)
Register an error callback that can be called to treat occuing communication and parsing errors...
void stopThread()
Stop the polling of the serial input buffer..
const bool IsMessageQueueEmpty() const
Is there a message in the message queue?
std::queue< std::string > commandResponse
void stopThread()
Stop dispatching thread, SensorGroupThread and ReadingThread.
void wakeUp()
Unlocks the current worker thread.
ThreadDispatcher(const std::shared_ptr< Syntax > &syntax)
ThreadDispatcher constructor.
boost::function< void(const std::string &)> debugCallbackPtr
void setSensorGroupThread(SensorGroupThread *grpThread)
Register SensorGroupThread with the thread dispatcher.
const bool isQueueEmpty() const
Is a new line availible?
void setCommunicationWakeUp(bool wakeUp)
Set wether there is a command response thread waiting or not.
std::string getData()
Get retrieved data vom the serial input buffer.
void workerFunction()
Worker function, responsible for dispatching the correct thread and observing incoming messages from ...
void startThread()
Start parsing incoming sensor group messages.
void enableRawCommunication()
Enables the transmission of raw messages to the serial device.
void dequeueResponse(std::string &response)
Pop a received command response from the response queue.
std::shared_ptr< Syntax > syntax
The SensorGroupThread class implements functionality to extract the group identifier of an incoming s...
void dequeueSensorGroupMessage(std::string &response)
Pop a received sensor group message from the message queue.
void registerTextCallback(debugCallbackPtr text)
Register a callback to handle plain text messages from the serial device.