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_;
An opaque CANopen NMT master/slave service type.
An abstract interface conforming to the BasicLockable concept.
The CANopen device description.
The base class for CANopen nodes.
void Reset()
(Re)starts the node.
void OnCanState(CanState new_state, CanState old_state) noexcept override
Implements the default behavior for a CAN bus state change.
virtual void OnTime(const ::std::chrono::system_clock::time_point &abs_time) noexcept
The function invoked when a TIME message is received.
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.
virtual void OnCommand(NmtCommand cs) noexcept
The function invoked when an NMT command is received from the master.
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.
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.
void TpdoEvent(int num=0)
Triggers the transmission of an event-driven (asynchronous) PDO.
CONMT * nmt() const noexcept
Returns a pointer to the internal CANopen NMT master/slave service from <lely/co/nmt....
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.
virtual void OnSync(uint8_t cnt, const time_point &t) noexcept
The function invoked when a SYNC message is sent/received.
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.
virtual void OnHeartbeat(uint8_t id, bool occurred) noexcept
The function invoked when a heartbeat timeout event occurs or is resolved.
void RpdoRtr(int num=0)
Requests the transmission of a PDO.
virtual void unlock() final override
Releases the lock held by the execution agent. Throws no exceptions.
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 lock() final override
Blocks until a lock can be obtained for the current execution agent (thread, process,...
This header file is part of the C++ CANopen application library; it contains the CANopen device descr...
This header file is part of the C++ CANopen application library; it contains the I/O context declarat...
@ TOGGLE
The mask to get/set the toggle bit from an NMT state.
NmtCommand
The NMT command specifiers.
@ ENTER_PREOP
Enter pre-operational.
@ RESET_COMM
Reset communication.
Global namespace for the Lely Industries N.V. libraries.