serialMsgManager.h
1 #pragma once
2 #include "../serial/asyncSerialPort.h"
3 #include "messageManager.h"
4 
6 typedef boost::function<void(boost::system::error_code& ec, const std::string& response)> ResponseFunction;
7 
16 {
17 public:
18  explicit SerialMsgManager(std::string port,int baudrate);
19  virtual ~SerialMsgManager();
20  bool startCommunications();
21  bool rebootCommunications();
22 
23 #ifdef TESTING
24  virtual bool isPortOpened(){return mSerialPort->isOpened();};
25  virtual void stopCommunications();
26 
27 #else
28 
32  bool isPortOpened(){return mSerialPort->isOpened();};
33  void stopCommunications();
34 #endif
35 
36 private:
37  boost::shared_ptr<AsyncSerialPort> mSerialPort;
38  boost::system::error_code send(std::string message);
39  void receiveDataHandler(const char* data, int size);
40 };
struct to keep a message from a sender
Definition: defTypes.h:24
Class which manages the logic relative to send/receive messages via serial port This class implements...
Definition: serialMsgManager.h:15
bool isPortOpened()
Definition: serialMsgManager.h:32
bool rebootCommunications()
Method to be called when maximum consecutive errors have been reached.
Class which manages the logic relative to send/receive messages. This class implements all the logic ...
Definition: messageManager.h:117