43 #include <boost/asio/deadline_timer.hpp> 52 class AliveState:
public std::enable_shared_from_this<AliveState> {
55 AliveState(boost::asio::io_service& a_IOService);
73 void StartStateTimer();
74 void StartProbeTimer();
83 ALIVESTATE_PROBING = 0,
85 ALIVESTATE_REPROBING = 2,
87 E_ALIVESTATE m_eAliveState;
90 std::function<void()> m_SendProbeCallback;
91 std::function<void()> m_ChangeBaudrateCallback;
94 boost::asio::deadline_timer m_StateTimer;
95 boost::asio::deadline_timer m_ProbeTimer;
96 void OnStateTimeout();
97 void OnProbeTimeout();
100 bool m_bFrameWasReceived;
104 #endif // ALIVE_STATE_H AliveState(boost::asio::io_service &a_IOService)
The constructor of AliveState objects.
bool IsAlive() const
Query whether the related serialport is currently considered alive.
void SetSendProbeCallback(std::function< void()> a_SendProbeCallback)
Register callback method for sending a probe request via HDLC.
~AliveState()
The destructor of AliveState objects.
bool OnFrameReceived()
Indicate that a HDLC frame was received via the related serial port.
void Stop()
Stop all activities.
void SetChangeBaudrateCallback(std::function< void()> a_ChangeBaudrateCallback)
Register callback method for changing the baud rate of the related serial port.
void Start()
Start all activities.