Lely core libraries 2.3.4
lely::canopen::DriverBase Class Referenceabstract

The abstract driver interface for a remote CANopen node. More...

#include <driver.hpp>

Inheritance diagram for lely::canopen::DriverBase:

Public Member Functions

virtual ev::Executor GetExecutor () const noexcept=0
 Returns the executor used to execute event handlers for this driver, including SDO confirmation functions.
 
virtual uint8_t netid () const noexcept=0
 Returns the network-ID.
 
virtual uint8_t id () const noexcept=0
 Returns the node-ID.
 
virtual void OnCanState (io::CanState new_state, io::CanState old_state) noexcept=0
 The function invoked when a CAN bus state change is detected. More...
 
virtual void OnCanError (io::CanError error) noexcept=0
 The function invoked when an error is detected on the CAN bus. More...
 
virtual void OnCommand (NmtCommand cs) noexcept=0
 The function invoked when an NMT state change occurs on the master. More...
 
virtual void OnHeartbeat (bool occurred) noexcept=0
 The function invoked when a heartbeat timeout event occurs or is resolved for the remote node. More...
 
virtual void OnState (NmtState st) noexcept=0
 The function invoked when an NMT state change or boot-up event is detected for the remote node by the heartbeat protocol. More...
 
virtual void OnSync (uint8_t cnt, const time_point &t) noexcept=0
 The function invoked when a SYNC message is sent/received by the master. More...
 
virtual void OnSyncError (uint16_t eec, uint8_t er) noexcept=0
 The function invoked when the data length of a received SYNC message does not match. More...
 
virtual void OnTime (const ::std::chrono::system_clock::time_point &abs_time) noexcept=0
 The function invoked when a TIME message is received by the master. More...
 
virtual void OnEmcy (uint16_t eec, uint8_t er, uint8_t msef[5]) noexcept=0
 The function invoked when an EMCY message is received from the remote node. More...
 
virtual void OnNodeGuarding (bool occurred) noexcept=0
 The function invoked when a node guarding timeout event occurs or is resolved for the remote node. More...
 
virtual void OnBoot (NmtState st, char es, const ::std::string &what) noexcept=0
 The function invoked when the NMT 'boot slave' process completes for the remote node. More...
 
virtual void OnConfig (::std::function< void(::std::error_code ec)> res) noexcept=0
 The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' process of the remote node. More...
 
virtual void OnDeconfig (::std::function< void(::std::error_code ec)> res) noexcept=0
 The function invoked by BasicMaster::AsyncDeconfig() to start the deconfiguration process. More...
 

Detailed Description

The abstract driver interface for a remote CANopen node.

Definition at line 36 of file driver.hpp.

Member Function Documentation

◆ OnCanState()

virtual void lely::canopen::DriverBase::OnCanState ( io::CanState  new_state,
io::CanState  old_state 
)
pure virtualnoexcept

The function invoked when a CAN bus state change is detected.

See also
BasicMaster::OnCanState()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnCanError()

virtual void lely::canopen::DriverBase::OnCanError ( io::CanError  error)
pure virtualnoexcept

The function invoked when an error is detected on the CAN bus.

See also
BasicMaster::OnCanError()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnCommand()

virtual void lely::canopen::DriverBase::OnCommand ( NmtCommand  cs)
pure virtualnoexcept

The function invoked when an NMT state change occurs on the master.

Parameters
csthe NMT command specifier.
See also
BasicMaster::OnCommand()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnHeartbeat()

virtual void lely::canopen::DriverBase::OnHeartbeat ( bool  occurred)
pure virtualnoexcept

The function invoked when a heartbeat timeout event occurs or is resolved for the remote node.

Note that depending on the value of object 1029:01 (Error behavior object) in the object dictionary of the master, the occurrence of a heartbeat timeout event MAY trigger an NMT state transition on the master. If so, this function is called after the state change completes.

Parameters
occurredtrue if the heartbeat timeout event occurred, false if it was resolved.
See also
BasicMaster::OnHeartbeat()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnState()

virtual void lely::canopen::DriverBase::OnState ( NmtState  st)
pure virtualnoexcept

The function invoked when an NMT state change or boot-up event is detected for the remote node by the heartbeat protocol.

Parameters
stthe state of the remote node. Note that the NMT sub-states NmtState::RESET_NODE and NmtState::RESET_COMM are never reported for remote nodes.
See also
BasicMaster::OnState()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnSync()

virtual void lely::canopen::DriverBase::OnSync ( uint8_t  cnt,
const time_point &  t 
)
pure virtualnoexcept

The function invoked when a SYNC message is sent/received by the master.

Note that this function is called after all PDOs are processed/sent.

Parameters
cntthe counter (in the range [1..240]), or 0 if the SYNC message is empty.
tthe time at which the SYNC message was sent/received.
See also
BasicMaster::OnSync()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnSyncError()

virtual void lely::canopen::DriverBase::OnSyncError ( uint16_t  eec,
uint8_t  er 
)
pure virtualnoexcept

The function invoked when the data length of a received SYNC message does not match.

Parameters
eecthe emergency error code (0x8240).
erthe error register (0x10).
See also
BasicMaster::OnSyncError()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnTime()

virtual void lely::canopen::DriverBase::OnTime ( const ::std::chrono::system_clock::time_point &  abs_time)
pure virtualnoexcept

The function invoked when a TIME message is received by the master.

Parameters
abs_timea time point representing the received time stamp.
See also
BasicMaster::OnTime()

Implemented in lely::canopen::BasicLogicalDriver< BasicDriver >, and lely::canopen::BasicDriver.

◆ OnEmcy()

virtual void lely::canopen::DriverBase::OnEmcy ( uint16_t  eec,
uint8_t  er,
uint8_t  msef[5] 
)
pure virtualnoexcept

The function invoked when an EMCY message is received from the remote node.

Parameters
eecthe emergency error code.
erthe error register.
msefthe manufacturer-specific error code.
See also
BasicMaster::OnEmcy()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnNodeGuarding()

virtual void lely::canopen::DriverBase::OnNodeGuarding ( bool  occurred)
pure virtualnoexcept

The function invoked when a node guarding timeout event occurs or is resolved for the remote node.

Note that depending on the value of object 1029:01 (Error behavior object) in the object dictionary of the master, the occurrence of a node guarding event MAY trigger an NMT state transition on the master. If so, this function is called after the state change completes.

Parameters
occurredtrue if the node guarding event occurred, false if it was resolved.
See also
BasicMaster::OnNodeGuarding()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnBoot()

virtual void lely::canopen::DriverBase::OnBoot ( NmtState  st,
char  es,
const ::std::string &  what 
)
pure virtualnoexcept

The function invoked when the NMT 'boot slave' process completes for the remote node.

Parameters
stthe state of the remote node (including the toggle bit (NmtState::TOGGLE) if node guarding is enabled).
esthe error status (in the range ['A'..'O'], or 0 on success):
  • 'A': The CANopen device is not listed in object 1F81.
  • 'B': No response received for upload request of object 1000.
  • 'C': Value of object 1000 from CANopen device is different to value in object 1F84 (Device type).
  • 'D': Value of object 1018:01 from CANopen device is different to value in object 1F85 (Vendor-ID).
  • 'E': Heartbeat event. No heartbeat message received from CANopen device.
  • 'F': Node guarding event. No confirmation for guarding request received from CANopen device.
  • 'G': Objects for program download are not configured or inconsistent.
  • 'H': Software update is required, but not allowed because of configuration or current status.
  • 'I': Software update is required, but program download failed.
  • 'J': Configuration download failed.
  • 'K': Heartbeat event during start error control service. No heartbeat message received from CANopen device during start error control service.
  • 'L': NMT slave was initially operational. (CANopen manager may resume operation with other CANopen devices)
  • 'M': Value of object 1018:02 from CANopen device is different to value in object 1F86 (Product code).
  • 'N': Value of object 1018:03 from CANopen device is different to value in object 1F87 (Revision number).
  • 'O': Value of object 1018:04 from CANopen device is different to value in object 1F88 (Serial number).
whatif es is non-zero, contains a string explaining the error.
See also
BasicMaster::OnBoot()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnConfig()

virtual void lely::canopen::DriverBase::OnConfig ( ::std::function< void(::std::error_code ec)>  res)
pure virtualnoexcept

The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' process of the remote node.

The 'boot slave' process is halted until the result of the 'update configuration' step is communicated to the master.

Note that OnConfig() MUST be a non-blocking function; the configuration update MUST be executed asynchronously or run in a different thread.

Parameters
resthe function to invoke on completion of the 'update configuration' step. The argument to res is the result: 0 on success, or an SDO abort code on error.
See also
BasicMaster::OnConfig()

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.

◆ OnDeconfig()

virtual void lely::canopen::DriverBase::OnDeconfig ( ::std::function< void(::std::error_code ec)>  res)
pure virtualnoexcept

The function invoked by BasicMaster::AsyncDeconfig() to start the deconfiguration process.

The process does not complete until the result is communicated to the master.

Note that OnDeconfig() MUST be a non-blocking function; the deconfiguration process MUST be executed asynchronously or run in a different thread.

Parameters
resthe function to invoke when the deconfiguration process completes. The argument to res is the result: 0 on success, or an error code on failure.

Implemented in lely::canopen::BasicDriver, and lely::canopen::BasicLogicalDriver< BasicDriver >.


The documentation for this class was generated from the following file: