26 namespace canopen_schunk {
29 : m_period_time_ms(100),
57 LOGGING_TRACE (CanOpen,
"Time passed since last heartbeat from node " <<
58 it->first <<
": " << time_passed.
toMSec() <<
"ms" <<
endl);
71 boost::this_thread::sleep(boost::posix_time::milliseconds(
m_period_time_ms));
73 catch(boost::thread_interrupted&)
106 LOGGING_WARNING(CanOpen,
"start() called although HeartbeatMonitor thread is already running. Start request will be ignored." <<
endl);
119 for (std::map<uint8_t, icl_core::TimeStamp>::iterator it =
m_timestamp_record.begin();
boost::function< void()> m_error_function
void workerFunction()
Thread worker function for the Heartbeat monitor. This function will regularly check for missing hear...
void stop()
stops thread execution
std::map< uint8_t, icl_core::TimeStamp > m_timestamp_record
ThreadStream & endl(ThreadStream &stream)
void start()
starts thread execution
#define LOGGING_WARNING(streamname, arg)
void addHeartbeat(const uint8_t node_id)
Incoming heartbeats will trigger this function to update the most recent heartbeat time...
uint16_t m_period_time_ms
Cycle period of the monitor thread.
boost::thread m_thread
monitor thread handle
void registerErrorCallback(const boost::function< void()> &f)
This function will be called as soon as one node is missing a heartbeat message. Probably this functi...
void reset()
Resets the heartbeat monitor. This will make the monitor forget about all past heartbeats and start f...
#define LOGGING_TRACE_C(streamname, classname, arg)
#define LOGGING_TRACE(streamname, arg)
#define LOGGING_ERROR_C(streamname, classname, arg)