7 #ifndef COMMUNICATION_H 8 #define COMMUNICATION_H 109 unsigned int timeout = 100000);
128 const std::vector<std::string>& options,
131 unsigned int timeout = 100000);
161 unsigned int timeout = 100000);
179 std::unordered_map<std::string, std::shared_ptr<Command>>
commands;
180 std::unordered_map<unsigned char, std::shared_ptr<SensorGroup>>
sensorGroups;
186 std::condition_variable
cv;
195 #endif // COMMUNICATION_H Header file for the CommunicationConfig class.
std::unordered_map< std::string, std::shared_ptr< Command > > commands
void startCommunication()
Start reading the serial input buffer and start parsing threads.
bool registerSensorGroups(const std::string &cmdName, unsigned int timeout=100000)
Register all predefined sensor groups on the serial device.
boost::function< void(SensorGroup *)> responseCallback
Header file for the Command class.
Header file for the ReadingThread class.
void enableRawCommunication()
Enables the transmission of raw messages to the serial device.
void sendRawMessage(const std::string &msg)
Method to send a string directly to the serial device.
The ThreadDispatcher class coordinates other communication threads and handles start up and shut down...
void stopCommunication()
Stop reading the serial input buffer and shutdown parsing threads.
void connect()
Tries to setup a connection to a serial devive with a certain device-tag and specified baudrate...
std::condition_variable cv
SensorGroupThread * sensorGroupThread
The ReadingThread class implements threadded polling of the serial input buffer.
The Parameter::ParameterMap class provides a map functionality for Parameter::Parameter objects conta...
bool sendCommand(const std::string &command, const Parameter::ParameterMap &inputParams, Parameter::ParameterMap &outputParams, unsigned int timeout=100000)
Send a command to the servial device.
void registerErrorCallback(debugCallbackPtr error)
Register a callback to handle transmission/communication errors.
Header file for the ThreadDispatcher class.
void disconnect()
Terminates a connection to a serial devive with a certain device-tag.
void configSerialInterface()
Configures the serial connection setup with the provided parameters.
void enableDebugMessages(debugCallbackPtr debug)
Enable pass through of every line in the input buffer.
ReadingThread * rxPolling
void registerTextCallback(debugCallbackPtr text)
Register a callback to handle plain text messages from the serial device.
void registerSensorGroupCallback(const unsigned char &grpNumber, responseCallback cbPtr)
Register a callback to handle sensor group messages from the serial device.
The Communication class provides access to microcontroller communication.
Header file for the SerialInterface class.
~Communication()
Communication default destructor.
boost::function< void(const std::string &)> debugCallbackPtr
CommunicationConfig comCfg
The CommunicationConfig class parses config files and provides configuration parameters to a Communca...
ThreadDispatcher * dispatcher
std::shared_ptr< SerialInterfaceParams > serialParams
std::shared_ptr< Syntax > syntax
std::unordered_map< unsigned char, std::shared_ptr< SensorGroup > > sensorGroups
Header file for the Parameter::Parameter, Parameter::GenericParameter and Parameter::ParameterMap cla...
The SensorGroupThread class implements functionality to extract the group identifier of an incoming s...
Communication(const std::string &configPath)
Communication constructor.
bool rawCommunicationEnabled