22 #ifndef LELY_COAPP_NODE_HPP_ 23 #define LELY_COAPP_NODE_HPP_ 68 return static_cast<NmtState>(
static_cast<int>(lhs) & static_cast<int>(rhs));
73 return static_cast<NmtState>(
static_cast<int>(lhs) | static_cast<int>(rhs));
78 return static_cast<NmtState>(
static_cast<int>(lhs) ^ static_cast<int>(rhs));
83 return static_cast<NmtState>(~static_cast<
int>(lhs));
88 return lhs = lhs & rhs;
93 return lhs = lhs | rhs;
98 return lhs = lhs ^ rhs;
111 using time_point = ::std::chrono::steady_clock::time_point;
128 Node(aio::TimerBase& timer, aio::CanBusBase& bus,
129 const ::std::string& dcf_txt, const ::std::string& dcf_bin =
"",
133 Node& operator=(
const Node&) =
delete;
146 virtual void lock()
final override;
147 virtual void unlock()
final override;
154 void OnCanState(CanState new_state, CanState old_state) noexcept
override;
171 void Error(uint16_t eec, uint8_t er,
const uint8_t msef[5] =
nullptr);
190 #ifndef DOXYGEN_SHOULD_SKIP_THIS 258 OnRpdo(
int num, ::std::error_code ec,
const void* p,
259 ::std::size_t n) noexcept {
305 OnTpdo(
int num, ::std::error_code ec,
const void* p,
306 ::std::size_t n) noexcept {
322 OnSync(uint8_t cnt,
const time_point& t) noexcept {
347 OnTime(const ::std::chrono::system_clock::time_point& abs_time) noexcept {
360 OnEmcy(uint8_t
id, uint16_t eec, uint8_t er, uint8_t msef[5]) noexcept {
369 ::std::unique_ptr<Impl_> impl_;
376 #endif // LELY_COAPP_NODE_HPP_ virtual void OnState(uint8_t id, NmtState st) noexcept
The function invoked when an NMT state change or boot-up event is detected for a remote node by the h...
virtual void OnTpdo(int num, ::std::error_code ec, const void *p, ::std::size_t n) noexcept
The function invoked after a Transmit-PDO is sent or an error occurs.
virtual void OnSyncError(uint16_t eec, uint8_t er) noexcept
The function invoked when the data length of a received SYNC message does not match.
This header file is part of the C++ CANopen application library; it contains the CANopen device descr...
virtual void OnTime(const ::std::chrono::system_clock::time_point &abs_time) noexcept
The function invoked when a TIME message is received.
NmtCommand
The NMT command specifiers.
CONMT * nmt() const noexcept
Returns a pointer to the internal CANopen NMT master/slave service from <lely/co/nmt.hpp>.
virtual void unlock() final override
Releases the lock held by the execution agent. Throws no exceptions.
virtual void OnSync(uint8_t cnt, const time_point &t) noexcept
The function invoked when a SYNC message is sent/received.
void OnCanState(CanState new_state, CanState old_state) noexcept override
Implements the default behavior for a CAN bus state change.
Node(aio::TimerBase &timer, aio::CanBusBase &bus, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff)
Creates a new CANopen node.
virtual void OnHeartbeat(uint8_t id, bool occurred) noexcept
The function invoked when a heartbeat timeout event occurs or is resolved.
The mask to get/set the toggle bit from an NMT state.
This header file is part of the C++ CANopen application library; it contains the I/O context declarat...
virtual void OnCommand(NmtCommand cs) noexcept
The function invoked when an NMT command is received from the master.
An abstract interface conforming to the BasicLockable concept.
void Reset()
(Re)starts the node.
virtual void OnRpdo(int num, ::std::error_code ec, const void *p, ::std::size_t n) noexcept
The function invoked when a Receive-PDO is processed.
void RpdoRtr(int num=0)
Requests the transmission of a PDO.
An opaque CANopen NMT master/slave service type.
virtual void lock() final override
Blocks until a lock can be obtained for the current execution agent (thread, process, task).
The CANopen device description.
Global namespace for the Lely Industries N.V. libraries.
virtual void OnEmcy(uint8_t id, uint16_t eec, uint8_t er, uint8_t msef[5]) noexcept
The function invoked when an EMCY message is received.
The base class for CANopen nodes.
virtual void OnRpdoError(int num, uint16_t eec, uint8_t er) noexcept
The function invoked when a Receive-PDO length mismatch or timeout error occurs.
void TpdoEvent(int num=0)
Triggers the transmission of an event-driven (asynchronous) PDO.