threaddispatcher.h
Go to the documentation of this file.
1 
7 #ifndef THREADDISPATCHER_H
8 #define THREADDISPATCHER_H
9 
10 #include <string>
11 #include <queue>
17 
18 class ReadingThread;
19 class SensorGroupThread;
20 
26 typedef boost::function<void(const std::string&)> debugCallbackPtr;
27 
35 {
36 public:
41  ThreadDispatcher(const std::shared_ptr<Syntax>& syntax);
45  void startThread();
49  void stopThread();
66  void setReadingThread(ReadingThread* rxThread);
71  void setSensorGroupThread(SensorGroupThread* grpThread);
76  void setCommunicationCondVar(std::condition_variable* condVar);
101  void dequeueResponse(std::string& response);
106  void dequeueSensorGroupMessage(std::string& response);
111  const bool IsResponseQueueEmpty() const;
116  const bool IsMessageQueueEmpty() const;
121  void setCommunicationWakeUp(bool wakeUp);
122 
123 private:
124 
134  std::shared_ptr<Syntax> syntax;
135  std::queue<std::string> commandResponse;
136  std::condition_variable* comCV;
137  std::queue<std::string> sensorGroupMessage;
143  void workerFunction();
145 };
146 
147 #endif // THREADDISPATCHER_H
Header file for the CommunicationConfig class.
const bool IsResponseQueueEmpty() const
Is there a response in the response queue?
Header file for the SensorGroupThread class.
Header file for the CommunicationThread class.
Header file for the ReadingThread class.
The ThreadDispatcher class coordinates other communication threads and handles start up and shut down...
std::condition_variable * comCV
ReadingThread * readingThread
debugCallbackPtr error
The ReadingThread class implements threadded polling of the serial input buffer.
Definition: readingthread.h:31
debugCallbackPtr text
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.
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.
SensorGroupThread * sensorGroupThread
void startThread()
Start dispatching thread, SensorGroupThread and ReadingThread.
The CommunicationThread class is the abstract base class of all thread objects used in the communicat...
const bool IsMessageQueueEmpty() const
Is there a message in the message queue?
Header file for the SerialInterface class.
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.
void setCommunicationWakeUp(bool wakeUp)
Set wether there is a command response thread waiting or not.
void workerFunction()
Worker function, responsible for dispatching the correct thread and observing incoming messages from ...
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.
debugCallbackPtr debug
void registerTextCallback(debugCallbackPtr text)
Register a callback to handle plain text messages from the serial device.


pses_ucbridge
Author(s): Sebastian Ehmes
autogenerated on Sat Oct 28 2017 19:16:13