canopen.h
Go to the documentation of this file.
1 #ifndef H_CANOPEN
2 #define H_CANOPEN
3 
7 #include "exceptions.h"
8 #include "layer.h"
9 #include "objdict.h"
10 #include "timer.h"
11 #include <stdexcept>
12 #include <boost/thread/condition_variable.hpp>
13 #include <boost/chrono/system_clocks.hpp>
14 #include <boost/lexical_cast.hpp>
15 
16 namespace canopen{
17 
19 typedef boost::chrono::high_resolution_clock::duration time_duration;
20 inline time_point get_abs_time(const time_duration& timeout) { return boost::chrono::high_resolution_clock::now() + timeout; }
21 inline time_point get_abs_time() { return boost::chrono::high_resolution_clock::now(); }
22 
23 
24 template<typename T> struct FrameOverlay: public can::Frame{
25  T &data;
26  FrameOverlay(const Header &h) : can::Frame(h,sizeof(T)), data(* (T*) can::Frame::c_array()) {
27  can::Frame::data.fill(0);
28  }
29  FrameOverlay(const can::Frame &f) : can::Frame(f), data(* (T*) can::Frame::c_array()) { }
30 };
31 
32 class SDOClient{
33 
35 
36  boost::timed_mutex mutex;
37 
39  bool processFrame(const can::Frame & msg);
40 
42  size_t offset;
43  size_t total;
44  bool done;
47 
48  void transmitAndWait(const canopen::ObjectDict::Entry &entry, const String &data, String *result);
49  void abort(uint32_t reason);
50 
52 protected:
53  void read(const canopen::ObjectDict::Entry &entry, String &data);
54  void write(const canopen::ObjectDict::Entry &entry, const String &data);
55 public:
57 
58  void init();
59 
60  SDOClient(const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id)
61  : interface_(interface),
62  storage_(std::make_shared<ObjectStorage>(dict, node_id,
63  std::bind(&SDOClient::read, this, std::placeholders::_1, std::placeholders::_2),
64  std::bind(&SDOClient::write, this, std::placeholders::_1, std::placeholders::_2))
65  ),
66  reader_(false, 1)
67  {
68  }
69 };
70 
71 class PDOMapper{
72  boost::mutex mutex_;
73 
74  class Buffer{
75  public:
76  bool read(uint8_t* b, const size_t len);
77  void write(const uint8_t* b, const size_t len);
78  void read(const canopen::ObjectDict::Entry &entry, String &data);
79  void write(const canopen::ObjectDict::Entry &, const String &data);
80  void clean() { dirty = false; }
81  const size_t size;
82  Buffer(const size_t sz) : size(sz), dirty(false), empty(true), buffer(sz) {}
83 
84  private:
85  boost::mutex mutex;
86  bool dirty;
87  bool empty;
88  std::vector<char> buffer;
89  };
90  typedef std::shared_ptr<Buffer> BufferSharedPtr;
91 
92  class PDO {
93  protected:
94  void parse_and_set_mapping(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index, const bool &read, const bool &write);
97  std::vector<BufferSharedPtr>buffers;
98  };
99 
100  struct TPDO: public PDO{
101  typedef std::shared_ptr<TPDO> TPDOSharedPtr;
102  void sync();
103  static TPDOSharedPtr create(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index){
104  TPDOSharedPtr tpdo(new TPDO(interface));
105  if(!tpdo->init(storage, com_index, map_index))
106  tpdo.reset();
107  return tpdo;
108  }
109  private:
110  TPDO(const can::CommInterfaceSharedPtr interface) : interface_(interface){}
111  bool init(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index);
113  boost::mutex mutex;
114  };
115 
116  struct RPDO : public PDO{
117  void sync(LayerStatus &status);
118  typedef std::shared_ptr<RPDO> RPDOSharedPtr;
119  static RPDOSharedPtr create(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index){
120  RPDOSharedPtr rpdo(new RPDO(interface));
121  if(!rpdo->init(storage, com_index, map_index))
122  rpdo.reset();
123  return rpdo;
124  }
125  private:
126  bool init(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index);
127  RPDO(const can::CommInterfaceSharedPtr interface) : interface_(interface), timeout(-1) {}
128  boost::mutex mutex;
130 
132  void handleFrame(const can::Frame & msg);
133  int timeout;
134  };
135 
136  std::unordered_set<RPDO::RPDOSharedPtr> rpdos_;
137  std::unordered_set<TPDO::TPDOSharedPtr> tpdos_;
138 
140 
141 public:
142  PDOMapper(const can::CommInterfaceSharedPtr interface);
143  void read(LayerStatus &status);
144  bool write();
145  bool init(const ObjectStorageSharedPtr storage, LayerStatus &status);
146 };
147 
148 class EMCYHandler : public Layer {
149  std::atomic<bool> has_error_;
153  void handleEMCY(const can::Frame & msg);
155 
156  virtual void handleDiag(LayerReport &report);
157 
158  virtual void handleInit(LayerStatus &status);
159  virtual void handleRecover(LayerStatus &status);
160  virtual void handleRead(LayerStatus &status, const LayerState &current_state);
161  virtual void handleWrite(LayerStatus &status, const LayerState &current_state);
162  virtual void handleHalt(LayerStatus &status);
163  virtual void handleShutdown(LayerStatus &status);
164 
165 public:
166  EMCYHandler(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr storage);
167  void resetErrors(LayerStatus &status);
168 };
169 
172  const uint16_t period_ms_;
173  const uint8_t overflow_;
174  SyncProperties(const can::Header &h, const uint16_t &p, const uint8_t &o) : header_(h), period_ms_(p), overflow_(o) {}
175  bool operator==(const SyncProperties &p) const { return p.header_.key() == header_.key() && p.overflow_ == overflow_ && p.period_ms_ == period_ms_; }
176 
177 };
178 
179 class SyncCounter {
180 public:
183  virtual void addNode(void * const ptr) = 0;
184  virtual void removeNode(void * const ptr) = 0;
185  virtual ~SyncCounter() {}
186 };
187 typedef std::shared_ptr<SyncCounter> SyncCounterSharedPtr;
188 
189 class Node : public Layer{
190 public:
191  enum State{
192  Unknown = 255, BootUp = 0, Stopped = 4, Operational = 5 , PreOperational = 127
193  };
194  const uint8_t node_id_;
195  Node(const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id, const SyncCounterSharedPtr sync = SyncCounterSharedPtr());
196 
197  const State getState();
198  void enterState(const State &s);
199 
201 
202  bool start();
203  bool stop();
204  bool reset();
205  bool reset_com();
206  bool prepare();
207 
208  using StateFunc = std::function<void(const State&)>;
209  using StateDelegate [[deprecated("use StateFunc instead")]] = can::DelegateHelper<StateFunc>;
210 
213 
215  return state_dispatcher_.createListener(s);
216  }
217 
218  template<typename T> T get(const ObjectDict::Key& k){
219  return getStorage()->entry<T>(k).get();
220  }
221 
222 private:
223  virtual void handleDiag(LayerReport &report);
224 
225  virtual void handleInit(LayerStatus &status);
226  virtual void handleRecover(LayerStatus &status);
227  virtual void handleRead(LayerStatus &status, const LayerState &current_state);
228  virtual void handleWrite(LayerStatus &status, const LayerState &current_state);
229  virtual void handleHalt(LayerStatus &status);
230  virtual void handleShutdown(LayerStatus &status);
231 
232  template<typename T> int wait_for(const State &s, const T &timeout);
233 
234  boost::timed_mutex mutex;
235  boost::mutex cond_mutex;
236  boost::condition_variable cond;
237 
241 
243 
245 
246  void handleNMT(const can::Frame & msg);
247  void switchState(const uint8_t &s);
248 
252 
254  uint16_t getHeartbeatInterval() { return heartbeat_.valid()?heartbeat_.get_cached() : 0; }
255  void setHeartbeatInterval() { if(heartbeat_.valid()) heartbeat_.set(heartbeat_.desc().value().get<uint16_t>()); }
256  bool checkHeartbeat();
257 };
258 typedef std::shared_ptr<Node> NodeSharedPtr;
259 
260 template<typename T> class Chain{
261 public:
262  typedef std::shared_ptr<T> MemberSharedPtr;
263  void call(void (T::*func)(void)){
264  typename std::vector<MemberSharedPtr>::iterator it = elements.begin();
265  while(it != elements.end()){
266  ((**it).*func)();
267  ++it;
268  }
269  }
270  template<typename V> void call(void (T::*func)(const V&), const std::vector<V> &vs){
271  typename std::vector<MemberSharedPtr>::iterator it = elements.begin();
272  typename std::vector<V>::const_iterator it_v = vs.begin();
273  while(it_v != vs.end() && it != elements.end()){
274  ((**it).*func)(*it_v);
275  ++it; ++it_v;
276  }
277  }
278  template<typename V> void call(void (T::*func)(V&), std::vector<V> &vs){
279  vs.resize(elements.size());
280 
281  typename std::vector<MemberSharedPtr>::iterator it = elements.begin();
282  typename std::vector<V>::iterator it_v = vs.begin();
283  while(it_v != vs.end() && it != elements.end()){
284  ((**it).*func)(*it_v);
285  ++it; ++it_v;
286  }
287  }
289  elements.push_back(t);
290  }
291 protected:
292  std::vector<MemberSharedPtr> elements;
293 };
294 
295 template<typename T> class NodeChain: public Chain<T>{
296 public:
297  const std::vector<typename Chain<T>::MemberSharedPtr>& getElements() { return Chain<T>::elements; }
298  void start() { this->call(&T::start); }
299  void stop() { this->call(&T::stop); }
300  void reset() { this->call(&T::reset); }
301  void reset_com() { this->call(&T::reset_com); }
302  void prepare() { this->call(&T::prepare); }
303 };
304 
305 class SyncLayer: public Layer, public SyncCounter{
306 public:
307  SyncLayer(const SyncProperties &p) : Layer("Sync layer"), SyncCounter(p) {}
308 };
309 typedef std::shared_ptr<SyncLayer> SyncLayerSharedPtr;
310 
311 class Master{
312  Master(const Master&) = delete; // prevent copies
313  Master& operator=(const Master&) = delete;
314 public:
315  Master() = default;
316  virtual SyncLayerSharedPtr getSync(const SyncProperties &properties) = 0;
317  virtual ~Master() {}
318 
319  typedef std::shared_ptr<Master> MasterSharedPtr;
320  class Allocator {
321  public:
322  virtual MasterSharedPtr allocate(const std::string &name, can::CommInterfaceSharedPtr interface) = 0;
323  virtual ~Allocator() {}
324  };
325 };
327 
328 using can::Settings;
329 
330 } // canopen
331 #endif // !H_CANOPEN
canopen::PDOMapper::Buffer::clean
void clean()
Definition: canopen.h:80
canopen::EMCYHandler::handleDiag
virtual void handleDiag(LayerReport &report)
Definition: emcy.cpp:79
canopen::FrameOverlay::FrameOverlay
FrameOverlay(const Header &h)
Definition: canopen.h:26
canopen::Node::stop
bool stop()
Definition: node.cpp:84
canopen::Node::wait_for
int wait_for(const State &s, const T &timeout)
Definition: node.cpp:122
canopen::Chain::elements
std::vector< MemberSharedPtr > elements
Definition: canopen.h:292
canopen::SyncLayer::SyncLayer
SyncLayer(const SyncProperties &p)
Definition: canopen.h:307
canopen::SyncProperties::overflow_
const uint8_t overflow_
Definition: canopen.h:173
canopen::Node::get
T get(const ObjectDict::Key &k)
Definition: canopen.h:218
canopen::PDOMapper::Buffer::read
bool read(uint8_t *b, const size_t len)
Definition: pdo.cpp:340
canopen::ObjectDict::Entry
Definition: objdict.h:164
canopen::PDOMapper::RPDO::listener_
can::FrameListenerConstSharedPtr listener_
Definition: canopen.h:131
exceptions.h
canopen::EMCYHandler::handleInit
virtual void handleInit(LayerStatus &status)
Definition: emcy.cpp:119
can::Frame
objdict.h
canopen::SyncProperties::SyncProperties
SyncProperties(const can::Header &h, const uint16_t &p, const uint8_t &o)
Definition: canopen.h:174
canopen::Node::checkHeartbeat
bool checkHeartbeat()
Definition: node.cpp:141
canopen::Node::Unknown
@ Unknown
Definition: canopen.h:192
canopen::Node::Node
Node(const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id, const SyncCounterSharedPtr sync=SyncCounterSharedPtr())
Definition: node.cpp:30
canopen::Node::handleRecover
virtual void handleRecover(LayerStatus &status)
Definition: node.cpp:202
canopen::Node::sdo_
SDOClient sdo_
Definition: canopen.h:250
canopen::Node::interface_
const can::CommInterfaceSharedPtr interface_
Definition: canopen.h:238
dispatcher.h
canopen::Chain::call
void call(void(T::*func)(const V &), const std::vector< V > &vs)
Definition: canopen.h:270
canopen::EMCYHandler::resetErrors
void resetErrors(LayerStatus &status)
Definition: emcy.cpp:132
canopen::NodeChain::start
void start()
Definition: canopen.h:298
canopen::Node::reset_com
bool reset_com()
Definition: node.cpp:44
canopen::PDOMapper::RPDO::mutex
boost::mutex mutex
Definition: canopen.h:128
canopen::Node::setHeartbeatInterval
void setHeartbeatInterval()
Definition: canopen.h:255
canopen::FrameOverlay::FrameOverlay
FrameOverlay(const can::Frame &f)
Definition: canopen.h:29
canopen::EMCYHandler::storage_
const ObjectStorageSharedPtr storage_
Definition: canopen.h:154
canopen::PDOMapper::TPDO::TPDOSharedPtr
std::shared_ptr< TPDO > TPDOSharedPtr
Definition: canopen.h:101
canopen::SyncCounter::addNode
virtual void addNode(void *const ptr)=0
can::Settings
canopen::Chain::call
void call(void(T::*func)(void))
Definition: canopen.h:263
canopen::Node::handleDiag
virtual void handleDiag(LayerReport &report)
Definition: node.cpp:167
canopen::PDOMapper::Buffer::size
const size_t size
Definition: canopen.h:81
canopen::PDOMapper::TPDO
Definition: canopen.h:100
canopen::SDOClient::processFrame
bool processFrame(const can::Frame &msg)
Definition: sdo.cpp:298
canopen::PDOMapper::PDO::frame
can::Frame frame
Definition: canopen.h:95
canopen::Node::heartbeat_timeout_
boost::chrono::high_resolution_clock::time_point heartbeat_timeout_
Definition: canopen.h:253
canopen::Node::addStateListener
StateListenerConstSharedPtr addStateListener(const StateFunc &s)
Definition: canopen.h:214
layer.h
reader.h
canopen::SyncProperties
Definition: canopen.h:170
canopen::PDOMapper::BufferSharedPtr
std::shared_ptr< Buffer > BufferSharedPtr
Definition: canopen.h:90
canopen::SyncProperties::period_ms_
const uint16_t period_ms_
Definition: canopen.h:172
canopen::PDOMapper::rpdos_
std::unordered_set< RPDO::RPDOSharedPtr > rpdos_
Definition: canopen.h:136
canopen::Node::handleNMT
void handleNMT(const can::Frame &msg)
Definition: node.cpp:115
canopen::Layer::LayerState
LayerState
Definition: layer.h:65
canopen::Node::BootUp
@ BootUp
Definition: canopen.h:192
canopen::SyncProperties::operator==
bool operator==(const SyncProperties &p) const
Definition: canopen.h:175
canopen::Node::switchState
void switchState(const uint8_t &s)
Definition: node.cpp:94
canopen::SDOClient::client_id
can::Header client_id
Definition: canopen.h:34
canopen::Node::start
bool start()
Definition: node.cpp:76
canopen::Chain
Definition: canopen.h:260
canopen::EMCYHandler::handleShutdown
virtual void handleShutdown(LayerStatus &status)
Definition: emcy.cpp:140
can::CommInterfaceSharedPtr
std::shared_ptr< CommInterface > CommInterfaceSharedPtr
canopen::Node::handleRead
virtual void handleRead(LayerStatus &status, const LayerState &current_state)
Definition: node.cpp:148
canopen::SDOClient::buffer
String buffer
Definition: canopen.h:41
can::DelegateHelper
canopen::Node::cond
boost::condition_variable cond
Definition: canopen.h:236
canopen::time_point
boost::chrono::high_resolution_clock::time_point time_point
Definition: canopen.h:18
canopen::PDOMapper::RPDO::sync
void sync(LayerStatus &status)
Definition: pdo.cpp:282
can::Frame::Frame
Frame()
canopen::SDOClient::mutex
boost::timed_mutex mutex
Definition: canopen.h:36
canopen::SDOClient
Definition: canopen.h:32
canopen::PDOMapper::RPDO
Definition: canopen.h:116
canopen::EMCYHandler::handleRead
virtual void handleRead(LayerStatus &status, const LayerState &current_state)
Definition: emcy.cpp:68
canopen::PDOMapper::RPDO::RPDOSharedPtr
std::shared_ptr< RPDO > RPDOSharedPtr
Definition: canopen.h:118
canopen::SDOClient::reader_
can::BufferedReader reader_
Definition: canopen.h:38
canopen::EMCYHandler::error_register_
ObjectStorage::Entry< uint8_t > error_register_
Definition: canopen.h:150
canopen::PDOMapper
Definition: canopen.h:71
canopen::PDOMapper::init
bool init(const ObjectStorageSharedPtr storage, LayerStatus &status)
Definition: pdo.cpp:175
canopen::Master::getSync
virtual SyncLayerSharedPtr getSync(const SyncProperties &properties)=0
can::Listener::ListenerConstSharedPtr
std::shared_ptr< const Listener > ListenerConstSharedPtr
canopen::time_duration
boost::chrono::high_resolution_clock::duration time_duration
Definition: canopen.h:19
canopen::Node::cond_mutex
boost::mutex cond_mutex
Definition: canopen.h:235
canopen::NodeChain::reset
void reset()
Definition: canopen.h:300
canopen::PDOMapper::RPDO::RPDO
RPDO(const can::CommInterfaceSharedPtr interface)
Definition: canopen.h:127
canopen::FrameOverlay::data
T & data
Definition: canopen.h:25
canopen::Node::pdo_
PDOMapper pdo_
Definition: canopen.h:251
canopen::Node::node_id_
const uint8_t node_id_
Definition: canopen.h:194
canopen::PDOMapper::TPDO::interface_
const can::CommInterfaceSharedPtr interface_
Definition: canopen.h:112
canopen::SDOClient::interface_
const can::CommInterfaceSharedPtr interface_
Definition: canopen.h:51
canopen::PDOMapper::PDO
Definition: canopen.h:92
canopen::PDOMapper::mutex_
boost::mutex mutex_
Definition: canopen.h:72
canopen::SDOClient::read
void read(const canopen::ObjectDict::Entry &entry, String &data)
Definition: sdo.cpp:436
canopen::Master::MasterSharedPtr
std::shared_ptr< Master > MasterSharedPtr
Definition: canopen.h:319
canopen::SDOClient::last_msg
can::Frame last_msg
Definition: canopen.h:45
can::SimpleDispatcher
canopen::PDOMapper::Buffer::Buffer
Buffer(const size_t sz)
Definition: canopen.h:82
canopen::Node::StateFunc
std::function< void(const State &)> StateFunc
Definition: canopen.h:208
canopen::SyncCounterSharedPtr
std::shared_ptr< SyncCounter > SyncCounterSharedPtr
Definition: canopen.h:187
canopen::Node::handleHalt
virtual void handleHalt(LayerStatus &status)
Definition: node.cpp:216
canopen::Chain::add
void add(MemberSharedPtr t)
Definition: canopen.h:288
canopen::Node::PreOperational
@ PreOperational
Definition: canopen.h:192
canopen::PDOMapper::PDO::parse_and_set_mapping
void parse_and_set_mapping(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index, const bool &read, const bool &write)
Definition: pdo.cpp:86
timer.h
canopen::PDOMapper::RPDO::timeout
int timeout
Definition: canopen.h:133
canopen::Node::handleShutdown
virtual void handleShutdown(LayerStatus &status)
Definition: node.cpp:210
canopen::Node::StateListener
can::Listener< const StateFunc, const State & > StateListener
Definition: canopen.h:211
canopen::SDOClient::abort
void abort(uint32_t reason)
Definition: sdo.cpp:292
canopen::SyncLayer
Definition: canopen.h:305
canopen::Node::state_dispatcher_
can::SimpleDispatcher< StateListener > state_dispatcher_
Definition: canopen.h:244
canopen::FrameOverlay
Definition: canopen.h:24
canopen::Node::prepare
bool prepare()
Definition: node.cpp:68
canopen::SyncCounter::properties
const SyncProperties properties
Definition: canopen.h:181
canopen::PDOMapper::TPDO::mutex
boost::mutex mutex
Definition: canopen.h:113
canopen::ObjectDictSharedPtr
ObjectDict::ObjectDictSharedPtr ObjectDictSharedPtr
Definition: objdict.h:235
canopen::Node::getHeartbeatInterval
uint16_t getHeartbeatInterval()
Definition: canopen.h:254
canopen::EMCYHandler::handleHalt
virtual void handleHalt(LayerStatus &status)
Definition: emcy.cpp:142
can::Frame::data
std::array< value_type, 8 > data
canopen::Node
Definition: canopen.h:189
canopen::Node::getStorage
const ObjectStorageSharedPtr getStorage()
Definition: canopen.h:200
can::Header::key
unsigned int key() const
canopen::Node::nmt_listener_
can::FrameListenerConstSharedPtr nmt_listener_
Definition: canopen.h:240
canopen::Master::Allocator
Definition: canopen.h:320
canopen::SDOClient::offset
size_t offset
Definition: canopen.h:42
canopen::PDOMapper::TPDO::sync
void sync()
Definition: pdo.cpp:255
canopen::PDOMapper::TPDO::create
static TPDOSharedPtr create(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index)
Definition: canopen.h:103
canopen::NodeChain
Definition: canopen.h:295
canopen::NodeChain::reset_com
void reset_com()
Definition: canopen.h:301
canopen::PDOMapper::RPDO::interface_
const can::CommInterfaceSharedPtr interface_
Definition: canopen.h:129
canopen::EMCYHandler
Definition: canopen.h:148
canopen::NodeChain::prepare
void prepare()
Definition: canopen.h:302
can::Frame::c_array
value_type * c_array()
can::Listener
canopen::EMCYHandler::EMCYHandler
EMCYHandler(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr storage)
Definition: emcy.cpp:49
canopen::Node::heartbeat_
ObjectStorage::Entry< ObjectStorage::DataType< ObjectDict::DEFTYPE_UNSIGNED16 >::type > heartbeat_
Definition: canopen.h:242
canopen::EMCYHandler::num_errors_
ObjectStorage::Entry< uint8_t > num_errors_
Definition: canopen.h:151
canopen::PDOMapper::Buffer::write
void write(const uint8_t *b, const size_t len)
Definition: pdo.cpp:352
canopen::Master
Definition: canopen.h:311
can
canopen::PDOMapper::Buffer::dirty
bool dirty
Definition: canopen.h:86
canopen::SDOClient::SDOClient
SDOClient(const can::CommInterfaceSharedPtr interface, const ObjectDictSharedPtr dict, uint8_t node_id)
Definition: canopen.h:60
canopen
Definition: bcm_sync.h:8
canopen::PDOMapper::PDOMapper
PDOMapper(const can::CommInterfaceSharedPtr interface)
Definition: pdo.cpp:171
canopen::SDOClient::done
bool done
Definition: canopen.h:44
canopen::EMCYHandler::handleWrite
virtual void handleWrite(LayerStatus &status, const LayerState &current_state)
Definition: emcy.cpp:75
canopen::PDOMapper::tpdos_
std::unordered_set< TPDO::TPDOSharedPtr > tpdos_
Definition: canopen.h:137
can::BufferedReader
can::Header
canopen::Node::handleWrite
virtual void handleWrite(LayerStatus &status, const LayerState &current_state)
Definition: node.cpp:159
canopen::PDOMapper::RPDO::init
bool init(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index)
Definition: pdo.cpp:212
canopen::EMCYHandler::has_error_
std::atomic< bool > has_error_
Definition: canopen.h:149
canopen::PDOMapper::Buffer::buffer
std::vector< char > buffer
Definition: canopen.h:88
canopen::SDOClient::current_entry
const canopen::ObjectDict::Entry * current_entry
Definition: canopen.h:46
canopen::PDOMapper::read
void read(LayerStatus &status)
Definition: pdo.cpp:326
canopen::Master::~Master
virtual ~Master()
Definition: canopen.h:317
canopen::Node::State
State
Definition: canopen.h:191
canopen::NodeChain::stop
void stop()
Definition: canopen.h:299
canopen::Master::Master
Master()=default
canopen::ObjectDict::Key
Definition: objdict.h:122
canopen::EMCYHandler::emcy_listener_
can::FrameListenerConstSharedPtr emcy_listener_
Definition: canopen.h:152
canopen::MasterSharedPtr
Master::MasterSharedPtr MasterSharedPtr
Definition: canopen.h:326
canopen::SyncProperties::header_
const can::Header header_
Definition: canopen.h:171
can::Header::Header
Header()
canopen::PDOMapper::Buffer::mutex
boost::mutex mutex
Definition: canopen.h:85
canopen::SyncCounter::removeNode
virtual void removeNode(void *const ptr)=0
canopen::PDOMapper::write
bool write()
Definition: pdo.cpp:332
canopen::Node::Stopped
@ Stopped
Definition: canopen.h:192
canopen::Node::handleInit
virtual void handleInit(LayerStatus &status)
Definition: node.cpp:176
canopen::ObjectStorage::Entry< uint8_t >
can::FrameListenerConstSharedPtr
CommInterface::FrameListenerConstSharedPtr FrameListenerConstSharedPtr
canopen::NodeSharedPtr
std::shared_ptr< Node > NodeSharedPtr
Definition: canopen.h:258
canopen::Node::sync_
const SyncCounterSharedPtr sync_
Definition: canopen.h:239
canopen::PDOMapper::Buffer
Definition: canopen.h:74
canopen::PDOMapper::Buffer::empty
bool empty
Definition: canopen.h:87
canopen::PDOMapper::RPDO::create
static RPDOSharedPtr create(const can::CommInterfaceSharedPtr interface, const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index)
Definition: canopen.h:119
canopen::NodeChain::getElements
const std::vector< typename Chain< T >::MemberSharedPtr > & getElements()
Definition: canopen.h:297
canopen::Node::reset
bool reset()
Definition: node.cpp:55
canopen::get_abs_time
time_point get_abs_time(const time_duration &timeout)
Definition: canopen.h:20
canopen::ObjectStorage
Definition: objdict.h:278
canopen::SyncCounter::SyncCounter
SyncCounter(const SyncProperties &p)
Definition: canopen.h:182
canopen::PDOMapper::TPDO::TPDO
TPDO(const can::CommInterfaceSharedPtr interface)
Definition: canopen.h:110
canopen::SDOClient::transmitAndWait
void transmitAndWait(const canopen::ObjectDict::Entry &entry, const String &data, String *result)
Definition: sdo.cpp:398
canopen::String
Definition: objdict.h:44
canopen::EMCYHandler::handleRecover
virtual void handleRecover(LayerStatus &status)
Definition: emcy.cpp:137
canopen::Node::getState
const State getState()
Definition: node.cpp:39
canopen::Master::Allocator::allocate
virtual MasterSharedPtr allocate(const std::string &name, can::CommInterfaceSharedPtr interface)=0
canopen::SDOClient::storage_
const ObjectStorageSharedPtr storage_
Definition: canopen.h:56
canopen::Node::state_
State state_
Definition: canopen.h:249
canopen::Node::enterState
void enterState(const State &s)
canopen::Chain::call
void call(void(T::*func)(V &), std::vector< V > &vs)
Definition: canopen.h:278
canopen::SyncCounter
Definition: canopen.h:179
canopen::SDOClient::write
void write(const canopen::ObjectDict::Entry &entry, const String &data)
Definition: sdo.cpp:444
canopen::EMCYHandler::handleEMCY
void handleEMCY(const can::Frame &msg)
Definition: emcy.cpp:43
canopen::Node::mutex
boost::timed_mutex mutex
Definition: canopen.h:234
canopen::PDOMapper::TPDO::init
bool init(const ObjectStorageSharedPtr &storage, const uint16_t &com_index, const uint16_t &map_index)
Definition: pdo.cpp:233
canopen::PDOMapper::PDO::buffers
std::vector< BufferSharedPtr > buffers
Definition: canopen.h:97
canopen::PDOMapper::interface_
const can::CommInterfaceSharedPtr interface_
Definition: canopen.h:139
canopen::Chain::MemberSharedPtr
std::shared_ptr< T > MemberSharedPtr
Definition: canopen.h:262
canopen::SyncLayerSharedPtr
std::shared_ptr< SyncLayer > SyncLayerSharedPtr
Definition: canopen.h:309
interface.h
canopen::Layer
Definition: layer.h:63
canopen::Master::Allocator::~Allocator
virtual ~Allocator()
Definition: canopen.h:323
canopen::Node::Operational
@ Operational
Definition: canopen.h:192
canopen::SyncCounter::~SyncCounter
virtual ~SyncCounter()
Definition: canopen.h:185
canopen::LayerStatus
Definition: layer.h:12
canopen::PDOMapper::RPDO::handleFrame
void handleFrame(const can::Frame &msg)
Definition: pdo.cpp:298
canopen::SDOClient::total
size_t total
Definition: canopen.h:43
canopen::SDOClient::init
void init()
Definition: sdo.cpp:373
canopen::ObjectStorageSharedPtr
ObjectStorage::ObjectStorageSharedPtr ObjectStorageSharedPtr
Definition: objdict.h:537
canopen::Node::StateListenerConstSharedPtr
StateListener::ListenerConstSharedPtr StateListenerConstSharedPtr
Definition: canopen.h:212
canopen::Master::operator=
Master & operator=(const Master &)=delete
canopen::LayerReport
Definition: layer.h:48
canopen::PDOMapper::PDO::transmission_type
uint8_t transmission_type
Definition: canopen.h:96


canopen_master
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:26