Go to the documentation of this file.
23 data.node_id = node_id;
31 :
Layer(
"Node 301"), node_id_(node_id), interface_(interface), sync_(sync) , state_(Unknown), sdo_(interface, dict, node_id), pdo_(interface){
35 catch(
const std::out_of_range){
40 boost::timed_mutex::scoped_lock lock(
mutex);
45 boost::timed_mutex::scoped_lock lock(
mutex);
56 boost::timed_mutex::scoped_lock lock(
mutex);
69 boost::timed_mutex::scoped_lock lock(
mutex);
77 boost::timed_mutex::scoped_lock lock(
mutex);
85 boost::timed_mutex::scoped_lock lock(
mutex);
95 bool changed =
state_ != s;
116 boost::mutex::scoped_lock cond_lock(
cond_mutex);
119 assert(msg.
dlc == 1);
123 boost::mutex::scoped_lock cond_lock(
cond_mutex);
127 if(
cond.wait_until(cond_lock,abs_time) == boost::cv_status::timeout)
143 boost::mutex::scoped_lock cond_lock(
cond_mutex);
149 if(current_state >
Init){
151 status.
error(
"heartbeat problem");
153 status.
error(
"not operational");
160 if(current_state >
Init){
170 report.
error(
"Mode not operational");
171 report.
add(
"Node state", (
int)
state);
173 report.
error(
"Heartbeat timeout");
184 status.
error(boost::str(boost::format(
"could not reset node '%1%'") % (
int)
node_id_));
199 status.
error(boost::str(boost::format(
"could not start node '%1%'") % (
int)
node_id_));
207 status.
error(boost::str(boost::format(
"could not start node '%1%'") % (
int)
node_id_));
int wait_for(const State &s, const T &timeout)
Node(const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id, const SyncCounterSharedPtr sync=SyncCounterSharedPtr())
virtual void handleRecover(LayerStatus &status)
const can::CommInterfaceSharedPtr interface_
void setHeartbeatInterval()
const void error(const std::string &r)
virtual void handleDiag(LayerReport &report)
void add(const std::string &key, const T &value)
boost::chrono::high_resolution_clock::time_point heartbeat_timeout_
void handleNMT(const can::Frame &msg)
void switchState(const uint8_t &s)
std::shared_ptr< CommInterface > CommInterfaceSharedPtr
virtual void handleRead(LayerStatus &status, const LayerState ¤t_state)
boost::condition_variable cond
boost::chrono::high_resolution_clock::time_point time_point
bool init(const ObjectStorageSharedPtr storage, LayerStatus &status)
std::shared_ptr< SyncCounter > SyncCounterSharedPtr
virtual void handleHalt(LayerStatus &status)
virtual void handleShutdown(LayerStatus &status)
can::SimpleDispatcher< StateListener > state_dispatcher_
ObjectDict::ObjectDictSharedPtr ObjectDictSharedPtr
uint16_t getHeartbeatInterval()
std::array< value_type, 8 > data
const ObjectStorageSharedPtr getStorage()
can::FrameListenerConstSharedPtr nmt_listener_
ObjectStorage::Entry< ObjectStorage::DataType< ObjectDict::DEFTYPE_UNSIGNED16 >::type > heartbeat_
virtual void handleWrite(LayerStatus &status, const LayerState ¤t_state)
std::atomic< LayerState > state
void read(LayerStatus &status)
virtual void handleInit(LayerStatus &status)
const SyncCounterSharedPtr sync_
time_point get_abs_time(const time_duration &timeout)
Frame(uint8_t node_id, const Command &c)
canopen_master
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:26