#include <HeartBeatMonitor.h>
Public Types | |
typedef boost::shared_ptr < const HeartBeatMonitor > | ConstPtr |
Shared pointer to a const HeartBeatMonitor. | |
typedef boost::shared_ptr < HeartBeatMonitor > | Ptr |
Shared pointer to a HeartBeatMonitor. | |
Public Member Functions | |
void | addHeartbeat (const uint8_t node_id) |
Incoming heartbeats will trigger this function to update the most recent heartbeat time. | |
uint16_t | getHeartBeatCycleTime () const |
The HeartbeatMonitor checks for missing heartbeat messages with this cycle time. If the last heartbeat message for one node was received more than one cycle ago, the error function will be triggered. So basically, this cycle time should be greater than the smallest heartbeat time. | |
HeartBeatMonitor () | |
void | registerErrorCallback (const boost::function< void()> &f) |
This function will be called as soon as one node is missing a heartbeat message. Probably this function should turn off / stop all devices. | |
void | reset () |
Resets the heartbeat monitor. This will make the monitor forget about all past heartbeats and start from scratch. | |
void | setHeartBeatCycleTime (const uint16_t heartbeat_cycle_time_ms) |
The HeartbeatMonitor checks for missing heartbeat messages with this cycle time. If the last heartbeat message for one node was received more than one cycle ago, the error function will be triggered. So basically, this cycle time should be greater than the smallest heartbeat time. | |
~HeartBeatMonitor () | |
Private Member Functions | |
void | start () |
starts thread execution | |
void | stop () |
stops thread execution | |
void | workerFunction () |
Thread worker function for the Heartbeat monitor. This function will regularly check for missing heartbeat messages. If a heartbeat message is missing, m_error_function will be called. | |
Private Attributes | |
boost::function< void()> | m_error_function |
uint16_t | m_period_time_ms |
Cycle period of the monitor thread. | |
bool | m_running |
boost::thread | m_thread |
monitor thread handle | |
std::map< uint8_t, icl_core::TimeStamp > | m_timestamp_record |
Definition at line 34 of file HeartBeatMonitor.h.
typedef boost::shared_ptr<const HeartBeatMonitor> icl_hardware::canopen_schunk::HeartBeatMonitor::ConstPtr |
Shared pointer to a const HeartBeatMonitor.
Definition at line 40 of file HeartBeatMonitor.h.
typedef boost::shared_ptr<HeartBeatMonitor> icl_hardware::canopen_schunk::HeartBeatMonitor::Ptr |
Shared pointer to a HeartBeatMonitor.
Definition at line 38 of file HeartBeatMonitor.h.
Definition at line 28 of file HeartBeatMonitor.cpp.
Definition at line 35 of file HeartBeatMonitor.cpp.
void icl_hardware::canopen_schunk::HeartBeatMonitor::addHeartbeat | ( | const uint8_t | node_id | ) |
Incoming heartbeats will trigger this function to update the most recent heartbeat time.
node_id | Node-ID the heartbeat message belonged to. |
Definition at line 81 of file HeartBeatMonitor.cpp.
uint16_t icl_hardware::canopen_schunk::HeartBeatMonitor::getHeartBeatCycleTime | ( | ) | const [inline] |
The HeartbeatMonitor checks for missing heartbeat messages with this cycle time. If the last heartbeat message for one node was received more than one cycle ago, the error function will be triggered. So basically, this cycle time should be greater than the smallest heartbeat time.
Definition at line 69 of file HeartBeatMonitor.h.
void icl_hardware::canopen_schunk::HeartBeatMonitor::registerErrorCallback | ( | const boost::function< void()> & | f | ) |
This function will be called as soon as one node is missing a heartbeat message. Probably this function should turn off / stop all devices.
Definition at line 41 of file HeartBeatMonitor.cpp.
Resets the heartbeat monitor. This will make the monitor forget about all past heartbeats and start from scratch.
Definition at line 110 of file HeartBeatMonitor.cpp.
void icl_hardware::canopen_schunk::HeartBeatMonitor::setHeartBeatCycleTime | ( | const uint16_t | heartbeat_cycle_time_ms | ) | [inline] |
The HeartbeatMonitor checks for missing heartbeat messages with this cycle time. If the last heartbeat message for one node was received more than one cycle ago, the error function will be triggered. So basically, this cycle time should be greater than the smallest heartbeat time.
heartbeat_cycle_time_ms | The cycle time in milliseconds |
Definition at line 79 of file HeartBeatMonitor.h.
void icl_hardware::canopen_schunk::HeartBeatMonitor::start | ( | ) | [private] |
starts thread execution
Definition at line 97 of file HeartBeatMonitor.cpp.
void icl_hardware::canopen_schunk::HeartBeatMonitor::stop | ( | ) | [private] |
stops thread execution
Definition at line 91 of file HeartBeatMonitor.cpp.
void icl_hardware::canopen_schunk::HeartBeatMonitor::workerFunction | ( | ) | [private] |
Thread worker function for the Heartbeat monitor. This function will regularly check for missing heartbeat messages. If a heartbeat message is missing, m_error_function will be called.
Definition at line 47 of file HeartBeatMonitor.cpp.
boost::function<void()> icl_hardware::canopen_schunk::HeartBeatMonitor::m_error_function [private] |
Definition at line 110 of file HeartBeatMonitor.h.
Cycle period of the monitor thread.
Definition at line 105 of file HeartBeatMonitor.h.
bool icl_hardware::canopen_schunk::HeartBeatMonitor::m_running [private] |
Definition at line 112 of file HeartBeatMonitor.h.
boost::thread icl_hardware::canopen_schunk::HeartBeatMonitor::m_thread [private] |
monitor thread handle
Definition at line 108 of file HeartBeatMonitor.h.
std::map<uint8_t, icl_core::TimeStamp> icl_hardware::canopen_schunk::HeartBeatMonitor::m_timestamp_record [private] |
Definition at line 102 of file HeartBeatMonitor.h.