abstract_node.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
5 #ifndef UAVCAN_NODE_ABSTRACT_NODE_HPP_INCLUDED
6 #define UAVCAN_NODE_ABSTRACT_NODE_HPP_INCLUDED
7 
11 
12 namespace uavcan
13 {
20 {
21 public:
22  virtual ~INode() { }
23  virtual IPoolAllocator& getAllocator() = 0;
24  virtual Scheduler& getScheduler() = 0;
25  virtual const Scheduler& getScheduler() const = 0;
26  virtual void registerInternalFailure(const char* msg) = 0;
27 
28  Dispatcher& getDispatcher() { return getScheduler().getDispatcher(); }
29  const Dispatcher& getDispatcher() const { return getScheduler().getDispatcher(); }
30 
31  ISystemClock& getSystemClock() { return getScheduler().getSystemClock(); }
32  MonotonicTime getMonotonicTime() const { return getScheduler().getMonotonicTime(); }
33  UtcTime getUtcTime() const { return getScheduler().getUtcTime(); }
34 
39  NodeID getNodeID() const { return getScheduler().getDispatcher().getNodeID(); }
40 
48  bool setNodeID(NodeID nid)
49  {
50  return getScheduler().getDispatcher().setNodeID(nid);
51  }
52 
57  bool isPassiveMode() const { return getScheduler().getDispatcher().isPassiveMode(); }
58 
63  int spin(MonotonicTime deadline)
64  {
65  return getScheduler().spin(deadline);
66  }
67 
74  int spin(MonotonicDuration duration)
75  {
76  return getScheduler().spin(getMonotonicTime() + duration);
77  }
78 
86  int spinOnce()
87  {
88  return getScheduler().spinOnce();
89  }
90 
109  int injectTxFrame(const CanFrame& frame, MonotonicTime tx_deadline, uint8_t iface_mask,
110  CanIOFlags flags = 0)
111  {
112  return getDispatcher().getCanIOManager().send(frame, tx_deadline, MonotonicTime(), iface_mask, flags);
113  }
114 
115 #if !UAVCAN_TINY
116 
120  void removeRxFrameListener() { getDispatcher().removeRxFrameListener(); }
121  void installRxFrameListener(IRxFrameListener* lst) { getDispatcher().installRxFrameListener(lst); }
122 #endif
123 };
124 
125 }
126 
127 #endif // UAVCAN_NODE_ABSTRACT_NODE_HPP_INCLUDED
uavcan::INode::spinOnce
int spinOnce()
Definition: abstract_node.hpp:86
uavcan::INode::getMonotonicTime
MonotonicTime getMonotonicTime() const
Definition: abstract_node.hpp:32
uavcan::INode::setNodeID
bool setNodeID(NodeID nid)
Definition: abstract_node.hpp:48
uavcan::INode::getDispatcher
const Dispatcher & getDispatcher() const
Definition: abstract_node.hpp:29
uavcan::UtcTime
Implicitly convertible to/from uavcan.Timestamp.
Definition: time.hpp:191
uavcan::IRxFrameListener
Definition: dispatcher.hpp:65
uavcan::NodeID
Definition: transfer.hpp:112
dynamic_memory.hpp
uavcan::INode::getDispatcher
Dispatcher & getDispatcher()
Definition: abstract_node.hpp:28
uavcan::INode::getSystemClock
ISystemClock & getSystemClock()
Definition: abstract_node.hpp:31
uavcan::INode::~INode
virtual ~INode()
Definition: abstract_node.hpp:22
uavcan::CanFrame
Definition: libuavcan/libuavcan/include/uavcan/driver/can.hpp:24
uavcan::MonotonicDuration
Definition: time.hpp:182
scheduler.hpp
uavcan::INode::isPassiveMode
bool isPassiveMode() const
Definition: abstract_node.hpp:57
uavcan::INode::spin
int spin(MonotonicTime deadline)
Definition: abstract_node.hpp:63
uavcan::Dispatcher
Definition: dispatcher.hpp:80
uavcan::uint8_t
std::uint8_t uint8_t
Definition: std.hpp:24
uavcan::INode::injectTxFrame
int injectTxFrame(const CanFrame &frame, MonotonicTime tx_deadline, uint8_t iface_mask, CanIOFlags flags=0)
Definition: abstract_node.hpp:109
uavcan::IPoolAllocator
Definition: dynamic_memory.hpp:21
uavcan::INode::getUtcTime
UtcTime getUtcTime() const
Definition: abstract_node.hpp:33
uavcan::Scheduler
Definition: scheduler.hpp:63
UAVCAN_EXPORT
#define UAVCAN_EXPORT
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:108
uavcan::INode
Definition: abstract_node.hpp:19
uavcan::INode::installRxFrameListener
void installRxFrameListener(IRxFrameListener *lst)
Definition: abstract_node.hpp:121
uavcan::INode::spin
int spin(MonotonicDuration duration)
Definition: abstract_node.hpp:74
build_config.hpp
frame
uavcan::CanFrame frame
Definition: can.cpp:78
uavcan::INode::getNodeID
NodeID getNodeID() const
Definition: abstract_node.hpp:39
uavcan::INode::removeRxFrameListener
void removeRxFrameListener()
Definition: abstract_node.hpp:120
uavcan::CanIOFlags
uint16_t CanIOFlags
Definition: libuavcan/libuavcan/include/uavcan/driver/can.hpp:140
uavcan::MonotonicTime
Definition: time.hpp:184
uavcan
Definition: libuavcan/libuavcan/include/uavcan/build_config.hpp:204
uavcan::ISystemClock
Definition: system_clock.hpp:19


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02