Lely core libraries
2.3.4
|
The base class for drivers for logical devices on remote CANopen nodes. More...
#include <logical_driver.hpp>
Data Structures | |
class | RpdoMapped |
class | TpdoMapped |
Public Member Functions | |
ev::Executor | GetExecutor () const noexcept final |
Returns the executor used to execute event handlers for this driver, including SDO confirmation functions. | |
uint8_t | netid () const noexcept final |
Returns the network-ID. | |
uint8_t | id () const noexcept final |
Returns the node-ID. | |
int | Number () const noexcept final |
Returns the number of the logical device on the remote node. | |
uint32_t | DeviceType () const noexcept |
Returns the device type of the logical device on the remote node. | |
int | Profile () const noexcept |
Returns the device profile number of the logical device on the remote node, or 0 if the device does not follow a standardized profile. | |
bool | IsReady () const |
Returns true if the remote node is ready (i.e., the NMT boot slave process has successfully completed and no subsequent boot-up event has been received) and false if not. More... | |
void | Error () |
Indicates the occurrence of an error event on the remote node and triggers the error handling process. More... | |
template<class F > | |
void | SubmitWait (const time_point &t, F &&f) |
Submits a wait operation. More... | |
template<class F > | |
void | SubmitWait (const duration &d, F &&f) |
Submits a wait operation. More... | |
SdoFuture< void > | AsyncWait (const time_point &t) |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
SdoFuture< void > | AsyncWait (const duration &d) |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
template<class T , class F > | |
void | SubmitRead (uint16_t idx, uint8_t subidx, F &&con) |
Equivalent to SubmitRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitRead (uint16_t idx, uint8_t subidx, F &&con, ::std::error_code &ec) |
Equivalent to SubmitRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitRead (uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitRead (uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous read (SDO upload) operation. More... | |
template<class T , class F > | |
void | SubmitBlockRead (uint16_t idx, uint8_t subidx, F &&con) |
Equivalent to SubmitBlockRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockRead (uint16_t idx, uint8_t subidx, F &&con, ::std::error_code &ec) |
Equivalent to SubmitBlockRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockRead (uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitBlockRead(uint16_t idx, uint8_t subidx, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitBlockRead (uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous read (SDO block upload) operation. More... | |
template<class T , class F > | |
void | SubmitWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con) |
Equivalent to SubmitWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, ::std::error_code &ec) |
Equivalent to SubmitWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous write (SDO download) operation. More... | |
template<class T , class F > | |
void | SubmitBlockWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con) |
Equivalent to SubmitBlockWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, ::std::error_code &ec) |
Equivalent to SubmitBlockWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitBlockWrite(uint16_t idx, uint8_t subidx, T&& value, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitBlockWrite (uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous write (SDO block download) operation. More... | |
template<class T > | |
SdoFuture< T > | AsyncRead (uint16_t idx, uint8_t subidx) |
Equivalent to AsyncRead(uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T > | |
SdoFuture< T > | AsyncRead (uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous read (SDO upload) operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
template<class T > | |
SdoFuture< T > | AsyncBlockRead (uint16_t idx, uint8_t subidx) |
Equivalent to AsyncBlockRead(uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T > | |
SdoFuture< T > | AsyncBlockRead (uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous read (SDO block upload) operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
template<class T > | |
SdoFuture< void > | AsyncWrite (uint16_t idx, uint8_t subidx, T &&value) |
Equivalent to AsyncWrite(uint16_t idx, uint8_t subidx, T&& value, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T > | |
SdoFuture< void > | AsyncWrite (uint16_t idx, uint8_t subidx, T &&value, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous write (SDO download) operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
template<class T > | |
SdoFuture< void > | AsyncBlockWrite (uint16_t idx, uint8_t subidx, T &&value) |
Equivalent to AsyncBlockWrite(uint16_t idx, uint8_t subidx, T&& value, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout(). | |
template<class T > | |
SdoFuture< void > | AsyncBlockWrite (uint16_t idx, uint8_t subidx, T &&value, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous write (SDO block download) operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
template<class F , class... Args> | |
void | Post (F &&f, Args &&... args) |
Schedules the specified Callable object for execution by the executor for this driver. More... | |
Data Fields | |
BasicMaster & | master |
A reference to the master with which driver is registered. | |
BasicDriver & | driver |
A reference to the driver with which this logical device driver is registered. | |
TpdoEventMutex & | tpdo_event_mutex |
Protected Member Functions | |
void | OnCanState (io::CanState, io::CanState) noexcept override |
The function invoked when a CAN bus state change is detected. More... | |
void | OnCanError (io::CanError) noexcept override |
The function invoked when an error is detected on the CAN bus. More... | |
void | OnCommand (NmtCommand) noexcept override |
The function invoked when an NMT state change occurs on the master. More... | |
void | OnHeartbeat (bool) noexcept override |
The function invoked when a heartbeat timeout event occurs or is resolved for the remote node. More... | |
void | OnState (NmtState) noexcept override |
The function invoked when an NMT state change or boot-up event is detected for the remote node by the heartbeat protocol. More... | |
void | OnSync (uint8_t, const time_point &) noexcept override |
The function invoked when a SYNC message is sent/received by the master. More... | |
void | OnSyncError (uint16_t, uint8_t) noexcept override |
The function invoked when the data length of a received SYNC message does not match. More... | |
void | OnTime (const ::std::chrono::system_clock::time_point &) noexcept override |
The function invoked when a TIME message is received by the master. More... | |
void | OnEmcy (uint16_t, uint8_t, uint8_t[5]) noexcept override |
The function invoked when an EMCY message is received from the remote node. More... | |
void | OnNodeGuarding (bool) noexcept override |
The function invoked when a node guarding timeout event occurs or is resolved for the remote node. More... | |
void | OnBoot (NmtState, char, const ::std::string &) noexcept override |
The function invoked when the NMT 'boot slave' process completes for the remote node. More... | |
void | OnConfig (::std::function< void(::std::error_code ec)> res) noexcept override |
The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' process of the remote node. More... | |
void | OnDeconfig (::std::function< void(::std::error_code ec)> res) noexcept override |
The function invoked by BasicMaster::AsyncDeconfig() to start the deconfiguration process. More... | |
uint16_t | ObjectIndex (uint16_t idx) const noexcept |
Converts an object index, if it is part of the standardized profile area, from the first logical device to the actual logical device. More... | |
The base class for drivers for logical devices on remote CANopen nodes.
Definition at line 39 of file logical_driver.hpp.
|
inline |
Returns true if the remote node is ready (i.e., the NMT boot slave
process has successfully completed and no subsequent boot-up event has been received) and false if not.
Definition at line 92 of file logical_driver.hpp.
|
inline |
Indicates the occurrence of an error event on the remote node and triggers the error handling process.
Definition at line 103 of file logical_driver.hpp.
|
inline |
Submits a wait operation.
The completion task is submitted for execution once the specified absolute timeout expires.
t | the absolute expiration time of the wait operation. |
f | the function to be called on completion of the wait operation. |
Definition at line 116 of file logical_driver.hpp.
|
inline |
Submits a wait operation.
The completion task is submitted for execution once the specified relative timeout expires.
d | the relative expiration time of the wait operation. |
f | the function to be called on completion of the wait operation. |
Definition at line 129 of file logical_driver.hpp.
|
inline |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled).
t | the absolute expiration time of the wait operation. |
Definition at line 142 of file logical_driver.hpp.
|
inline |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled).
d | the relative expiration time of the wait operation. |
Definition at line 155 of file logical_driver.hpp.
|
inline |
Queues an asynchronous read (SDO upload) operation.
This function reads the value of a sub-object in a remote object dictionary.
idx | the object index. |
subidx | the object sub-index. |
con | the confirmation function to be called on completion of the SDO request. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 213 of file logical_driver.hpp.
|
inline |
Queues an asynchronous read (SDO block upload) operation.
This function reads the value of a sub-object in a remote object dictionary using SDO block transfer. SDO block transfer is more effecient than segmented transfer for large values, but may not be supported by the remote server. If not, the operation will most likely fail with the SdoErrc::NO_CS abort code.
idx | the object index. |
subidx | the object sub-index. |
con | the confirmation function to be called on completion of the SDO request. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 280 of file logical_driver.hpp.
|
inline |
Queues an asynchronous write (SDO download) operation.
This function writes a value to a sub-object in a remote object dictionary.
idx | the object index. |
subidx | the object sub-index. |
value | the value to be written. |
con | the confirmation function to be called on completion of the SDO request. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 345 of file logical_driver.hpp.
|
inline |
Queues an asynchronous write (SDO block download) operation.
This function writes a value to a sub-object in a remote object dictionary using SDO block transfer. SDO block transfer is more effecient than segmented transfer for large values, but may not be supported by the remote server. If not, the operation will most likely fail with the SdoErrc::NO_CS abort code.
idx | the object index. |
subidx | the object sub-index. |
value | the value to be written. |
con | the confirmation function to be called on completion of the SDO request. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 414 of file logical_driver.hpp.
|
inline |
Queues an asynchronous read (SDO upload) operation and creates a future which becomes ready once the request completes (or is canceled).
idx | the object index. |
subidx | the object sub-index. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
Definition at line 449 of file logical_driver.hpp.
|
inline |
Queues an asynchronous read (SDO block upload) operation and creates a future which becomes ready once the request completes (or is canceled).
This function uses SDO block transfer, which is more effecient than segmented transfer for large values, but may not be supported by the remote server. If not, the operation will most likely fail with the SdoErrc::NO_CS abort code.
idx | the object index. |
subidx | the object sub-index. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
Definition at line 486 of file logical_driver.hpp.
|
inline |
Queues an asynchronous write (SDO download) operation and creates a future which becomes ready once the request completes (or is canceled).
idx | the object index. |
subidx | the object sub-index. |
value | the value to be written. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
Definition at line 520 of file logical_driver.hpp.
|
inline |
Queues an asynchronous write (SDO block download) operation and creates a future which becomes ready once the request completes (or is canceled).
This function uses SDO block transfer, which is more effecient than segmented transfer for large values, but may not be supported by the remote server. If not, the operation will most likely fail with the SdoErrc::NO_CS abort code.
idx | the object index. |
subidx | the object sub-index. |
value | the value to be written. |
timeout | the SDO timeout. If, after the request is initiated, the timeout expires before receiving a response from the server, the client aborts the transfer with abort code SdoErrc::TIMEOUT. |
Definition at line 559 of file logical_driver.hpp.
|
inline |
Schedules the specified Callable object for execution by the executor for this driver.
Definition at line 573 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when a CAN bus state change is detected.
Implements lely::canopen::DriverBase.
Definition at line 627 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when an error is detected on the CAN bus.
Implements lely::canopen::DriverBase.
Definition at line 631 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when an NMT state change occurs on the master.
cs | the NMT command specifier. |
Implements lely::canopen::DriverBase.
Definition at line 637 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
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.
occurred | true if the heartbeat timeout event occurred, false if it was resolved. |
Implements lely::canopen::DriverBase.
Definition at line 641 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when an NMT state change or boot-up event is detected for the remote node by the heartbeat protocol.
st | the state of the remote node. Note that the NMT sub-states NmtState::RESET_NODE and NmtState::RESET_COMM are never reported for remote nodes. |
Implements lely::canopen::DriverBase.
Definition at line 644 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
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.
cnt | the counter (in the range [1..240]), or 0 if the SYNC message is empty. |
t | the time at which the SYNC message was sent/received. |
Implements lely::canopen::DriverBase.
Definition at line 647 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when the data length of a received SYNC message does not match.
eec | the emergency error code (0x8240). |
er | the error register (0x10). |
Implements lely::canopen::DriverBase.
Definition at line 650 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when a TIME message is received by the master.
abs_time | a time point representing the received time stamp. |
Implements lely::canopen::DriverBase.
Definition at line 653 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when an EMCY message is received from the remote node.
eec | the emergency error code. |
er | the error register. |
msef | the manufacturer-specific error code. |
Implements lely::canopen::DriverBase.
Definition at line 657 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
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.
occurred | true if the node guarding event occurred, false if it was resolved. |
Implements lely::canopen::DriverBase.
Definition at line 662 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
The function invoked when the NMT 'boot slave' process completes for the remote node.
st | the state of the remote node (including the toggle bit (NmtState::TOGGLE) if node guarding is enabled). |
es | the error status (in the range ['A'..'O'], or 0 on success):
|
what | if es is non-zero, contains a string explaining the error. |
Implements lely::canopen::DriverBase.
Definition at line 665 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
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.
res | the 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. |
Implements lely::canopen::DriverBase.
Definition at line 669 of file logical_driver.hpp.
|
inlineoverrideprotectedvirtualnoexcept |
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.
res | the function to invoke when the deconfiguration process completes. The argument to res is the result: 0 on success, or an error code on failure. |
Implements lely::canopen::DriverBase.
Definition at line 674 of file logical_driver.hpp.
|
inlineprotectednoexcept |
Converts an object index, if it is part of the standardized profile area, from the first logical device to the actual logical device.
This allows the driver to treat index 6000..67FF as the profile area, even if Number() != 1
.
Definition at line 686 of file logical_driver.hpp.
TpdoEventMutex& lely::canopen::BasicLogicalDriver< BasicDriver >::tpdo_event_mutex |
Definition at line 623 of file logical_driver.hpp.