Lely core libraries
2.3.4
|
The CANopen master. More...
#include <master.hpp>
Data Structures | |
class | ConstObject |
An accessor providing read-only access to a CANopen object in a local object dictionary. More... | |
class | ConstSubObject |
An accessor providing read-only access to a CANopen sub-object in a local object dictionary. More... | |
struct | Impl_ |
The internal implementation of the CANopen master. More... | |
class | Object |
A mutator providing read/write access to a CANopen object in a local object dictionary. More... | |
class | RpdoMapped |
An accessor providing read-only access to TPDO-mapped objects in a remote object dictionary. More... | |
class | SubObject |
A mutator providing read/write access to a CANopen sub-object in a local object dictionary. More... | |
class | TpdoEventMutex |
class | TpdoMapped |
A mutator providing read/write access to TPDO-mapped objects in a remote object dictionary. More... | |
Public Types | |
template<class T > | |
using | ReadSignature = void(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code ec, T value) |
The signature of the callback function invoked on completion of an asynchronous read (SDO upload) operation from a remote object dictionary. More... | |
using | WriteSignature = void(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code ec) |
The signature of the callback function invoked on completion of an asynchronous write (SDO download) operation to a remote object dictionary. More... | |
Public Member Functions | |
BasicMaster (ev_exec_t *exec, io::TimerBase &timer, io::CanChannelBase &chan, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff) | |
Creates a new CANopen master. More... | |
BasicMaster (io::TimerBase &timer, io::CanChannelBase &chan, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff) | |
Creates a new CANopen master. | |
Object | operator[] (::std::ptrdiff_t idx) noexcept |
Returns a mutator object that provides read/write access to the specified CANopen object in the local object dictionary. More... | |
ConstObject | operator[] (::std::ptrdiff_t idx) const noexcept |
Returns an accessor object that provides read-only access to the specified CANopen object in the local object dictionary. More... | |
RpdoMapped | RpdoMapped (uint8_t id) const noexcept |
Returns an accessor object that provides read-only access to RPDO-mapped objects in the remote object dictionary of the specified node. More... | |
TpdoMapped | TpdoMapped (uint8_t id) noexcept |
Returns a mutator object that provides read/write access to TPDO-mapped objects in the remote object dictionary of the specified node. More... | |
bool | Boot (uint8_t id) |
Requests the NMT 'boot slave' process for the specified node. More... | |
bool | IsReady (uint8_t id) 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... | |
ev::Future< void > | AsyncDeconfig (uint8_t id) |
Queues the DriverBase::OnDeconfig() method for the driver with the specified node-ID and creates a future which becomes ready once the deconfiguration process completes. More... | |
ev::Future<::std::size_t, void > | AsyncDeconfig () |
Queues the DriverBase::OnDeconfig() method for all registered drivers and creates a future which becomes ready once all deconfiguration processes complete. More... | |
void | Error (uint8_t id) |
Indicates the occurrence of an error event on a remote node and triggers the error handling process (see Fig. More... | |
void | Command (NmtCommand cs, uint8_t id=0) |
Issues an NMT command to a slave. More... | |
void | RpdoRtr (int num=0) noexcept |
void | TpdoEvent (int num=0) noexcept |
template<class T > | |
void | DamMpdoEvent (int num, uint8_t id, uint16_t idx, uint8_t subidx, T value) |
::std::chrono::milliseconds | GetTimeout () const |
Returns the SDO timeout used during the NMT 'boot slave' and 'check configuration' processes. More... | |
void | SetTimeout (const ::std::chrono::milliseconds &timeout) |
Sets the SDO timeout used during the NMT 'boot slave' and 'check configuration' processes. More... | |
template<class T > | |
void | SubmitRead (uint8_t id, SdoUploadRequest< T > &req) |
Equivalent to SubmitRead(uint8_t id, SdoUploadRequest<T>& req, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T > | |
void | SubmitRead (uint8_t id, SdoUploadRequest< T > &req, ::std::error_code &ec) |
Queues an asynchronous read (SDO upload) operation. More... | |
template<class T , class F > | |
void | SubmitRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con) |
Equivalent to SubmitRead(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con, ::std::error_code &ec) |
Equivalent to SubmitRead(ev_exec_t* exec, uint8_t id, 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 GetTimeout(). | |
template<class T , class F > | |
void | SubmitRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitRead(ev_exec_t* exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con) |
Equivalent to SubmitBlockRead(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitBlockRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con, ::std::error_code &ec) |
Equivalent to SubmitBlockRead(ev_exec_t* exec, uint8_t id, 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 GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitBlockRead(ev_exec_t* exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, 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 | SubmitUpload (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, F &&con, bool block, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous SDO upload operation. More... | |
template<class T > | |
void | SubmitWrite (uint8_t id, SdoDownloadRequest< T > &req) |
Equivalent to SubmitWrite(uint8_t id, SdoDownloadRequest<T>& req, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T > | |
void | SubmitWrite (uint8_t id, SdoDownloadRequest< T > &req, ::std::error_code &ec) |
Queues an asynchronous write (SDO download) operation. More... | |
template<class T , class F > | |
void | SubmitWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con) |
Equivalent to SubmitWrite(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, T&& value, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con, ::std::error_code &ec) |
Equivalent to SubmitWrite(ev_exec_t* exec, uint8_t id, 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 GetTimeout(). | |
template<class T , class F > | |
void | SubmitWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitWrite(ev_exec_t* exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con) |
Equivalent to SubmitBlockWrite(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, T&& value, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class T , class F > | |
void | SubmitBlockWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con, ::std::error_code &ec) |
Equivalent to SubmitBlockWrite(ev_exec_t* exec, uint8_t id, 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 GetTimeout(). | |
template<class T , class F > | |
void | SubmitBlockWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitBlockWrite(ev_exec_t* exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, 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 , class F > | |
void | SubmitDownload (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, F &&con, bool block, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues an asynchronous SDO download operation. More... | |
void | SubmitWriteDcf (uint8_t id, SdoDownloadDcfRequest &req) |
Equivalent to SubmitWriteDcf(uint8_t id, SdoDownloadDcfRequest& req, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
void | SubmitWriteDcf (uint8_t id, SdoDownloadDcfRequest &req, ::std::error_code &ec) |
Queues an asynchronous write (SDO download) operation. More... | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F &&con) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F &&con, ::std::error_code &ec) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by GetTimeout(). | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues a series of asynchronous write (SDO download) operations. More... | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const char *path, F &&con) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const char* path, F&& con, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const char *path, F &&con, ::std::error_code &ec) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const char* path, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it uses the SDO timeout given by GetTimeout(). | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const char *path, F &&con, const ::std::chrono::milliseconds &timeout) |
Equivalent to SubmitWriteDcf(ev_exec_t* exec, uint8_t id, const char* path, F&& con, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error. | |
template<class F > | |
void | SubmitWriteDcf (ev_exec_t *exec, uint8_t id, const char *path, F &&con, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec) |
Queues a series of asynchronous write (SDO download) operations. More... | |
template<class T > | |
SdoFuture< T > | AsyncRead (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx) |
Equivalent to AsyncRead(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
template<class T > | |
SdoFuture< T > | AsyncRead (ev_exec_t *exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx) |
Equivalent to AsyncBlockRead(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
template<class T > | |
SdoFuture< T > | AsyncBlockRead (ev_exec_t *exec, uint8_t id, 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< T > | AsyncUpload (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, bool block, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous SDO upload operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
template<class T > | |
SdoFuture< void > | AsyncWrite (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value) |
Equivalent to AsyncWrite(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, T&& value, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
template<class T > | |
SdoFuture< void > | AsyncWrite (ev_exec_t *exec, uint8_t id, 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 (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value) |
Equivalent to AsyncBlockWrite(ev_exec_t* exec, uint8_t id, uint16_t idx, uint8_t subidx, T&& value, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
template<class T > | |
SdoFuture< void > | AsyncBlockWrite (ev_exec_t *exec, uint8_t id, 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 T > | |
SdoFuture< void > | AsyncDownload (ev_exec_t *exec, uint8_t id, uint16_t idx, uint8_t subidx, T &&value, bool block, const ::std::chrono::milliseconds &timeout) |
Queues an asynchronous SDO download operation and creates a future which becomes ready once the request completes (or is canceled). More... | |
SdoFuture< void > | AsyncWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end) |
Equivalent to AsyncWriteDcf(ev_exec_t* exec, uint8_t id, const uint8_t* begin, const uint8_t* end, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
SdoFuture< void > | AsyncWriteDcf (ev_exec_t *exec, uint8_t id, const uint8_t *begin, const uint8_t *end, const ::std::chrono::milliseconds &timeout) |
Queues a series of asynchronous write (SDO download) operations, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs). More... | |
SdoFuture< void > | AsyncWriteDcf (ev_exec_t *exec, uint8_t id, const char *path) |
Equivalent to AsyncWriteDcf(ev_exec_t* exec, uint8_t id, const char* path, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by GetTimeout(). | |
SdoFuture< void > | AsyncWriteDcf (ev_exec_t *exec, uint8_t id, const char *path, const ::std::chrono::milliseconds &timeout) |
Queues a series of asynchronous write (SDO download) operations, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs). More... | |
void | Insert (DriverBase &driver) |
Registers a driver for a remote CANopen node. More... | |
void | Erase (DriverBase &driver) |
Unregisters a driver for a remote CANopen node. More... | |
void | OnCanState (::std::function< void(io::CanState, io::CanState)> on_can_state) |
void | OnCanError (::std::function< void(io::CanError)> on_can_error) |
void | OnRpdoWrite (::std::function< void(uint8_t, uint16_t, uint8_t)> on_rpdo_write) |
void | OnCommand (::std::function< void(NmtCommand)> on_command) |
void | OnHeartbeat (::std::function< void(uint8_t, bool)> on_heartbeat) |
void | OnState (::std::function< void(uint8_t, NmtState)> on_state) |
void | OnSync (::std::function< void(uint8_t, const time_point &)> on_sync) |
void | OnSyncError (::std::function< void(uint16_t, uint8_t)> on_sync_error) |
void | OnTime (::std::function< void(const ::std::chrono::system_clock::time_point &)> on_time) |
void | OnEmcy (::std::function< void(uint8_t, uint16_t, uint8_t, uint8_t[5])> on_emcy) |
void | OnNodeGuarding (::std::function< void(uint8_t, bool)> on_node_guarding) |
Registers the function invoked when a node guarding timeout event occurs or is resolved. More... | |
void | OnBoot (::std::function< void(uint8_t, NmtState, char, const ::std::string &)> on_boot) |
Registers the function invoked when the NMT 'boot slave' process completes. More... | |
![]() | |
Node (ev_exec_t *exec, io::TimerBase &timer, io::CanChannelBase &chan, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff) | |
Creates a new CANopen node. More... | |
Node (io::TimerBase &timer, io::CanChannelBase &chan, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff) | |
Creates a new CANopen node. | |
ev::Executor | GetExecutor () const noexcept |
Returns the executor used to process I/O and CANopen events. | |
io::ContextBase | GetContext () const noexcept |
Returns the underlying I/O context with which this context is registered. | |
io::Clock | GetClock () const noexcept |
Returns the clock used by the timer. | |
void | SubmitWait (const time_point &t, io_tqueue_wait &wait) |
Submits a wait operation. More... | |
void | SubmitWait (const duration &d, io_tqueue_wait &wait) |
Submits a wait operation. More... | |
template<class F > | |
void | SubmitWait (const time_point &t, ev_exec_t *exec, F &&f) |
Submits a wait operation. More... | |
template<class F > | |
void | SubmitWait (const duration &d, ev_exec_t *exec, F &&f) |
Submits a wait operation. More... | |
template<class F > | |
typename ::std::enable_if<!::std::is_base_of< io_tqueue_wait, typename ::std::decay< F >::type >::value >::type | SubmitWait (const time_point &t, F &&f) |
Equivalent to SubmitWait(t, nullptr, f) . | |
template<class F > | |
typename ::std::enable_if<!::std::is_base_of< io_tqueue_wait, typename ::std::decay< F >::type >::value >::type | SubmitWait (const duration &d, F &&f) |
Equivalent to SubmitWait(d, nullptr, f) . | |
ev::Future< void, ::std::exception_ptr > | AsyncWait (ev_exec_t *exec, const time_point &t, io_tqueue_wait **pwait=nullptr) |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
ev::Future< void, ::std::exception_ptr > | AsyncWait (ev_exec_t *exec, const duration &d, io_tqueue_wait **pwait=nullptr) |
Submits an asynchronous wait operation and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
ev::Future< void, ::std::exception_ptr > | AsyncWait (const time_point &t, io_tqueue_wait **pwait=nullptr) |
Equivalent to AsyncWait(nullptr, t, pwait) . | |
ev::Future< void, ::std::exception_ptr > | AsyncWait (const duration &d, io_tqueue_wait **pwait=nullptr) |
Equivalent to AsyncWait(nullptr, d, pwait) . | |
bool | CancelWait (io_tqueue_wait &wait) noexcept |
Cancels the specified wait operation if it is pending. More... | |
bool | AbortWait (io_tqueue_wait &wait) noexcept |
Aborts the specified wait operation if it is pending. More... | |
ev::Future< void, ::std::exception_ptr > | AsyncSwitchBitrate (io::CanControllerBase &ctrl, int bitrate, ::std::chrono::milliseconds delay) |
Stops the specified CAN controller and submits asynchronous operations to wait for the delay period, set the new bit rate, wait for the delay period again, and restart the CAN controller. More... | |
void | OnCanState (::std::function< void(io::CanState, io::CanState)> on_can_state) |
Registers the function to be invoked when a CAN bus state change is detected. More... | |
void | OnCanError (::std::function< void(io::CanError)> on_can_error) |
Registers the function to be invoked when an error is detected on the CAN bus. More... | |
void | Reset () |
(Re)starts the node. More... | |
void | ConfigHeartbeat (uint8_t id, const ::std::chrono::milliseconds &ms, ::std::error_code &ec) |
Configures heartbeat consumption for the specified node by updating CANopen object 1016 (Consumer heartbeat time). More... | |
void | ConfigHeartbeat (uint8_t id, const ::std::chrono::milliseconds &ms) |
Configures heartbeat consumption for the specified node by updating CANopen object 1016 (Consumer heartbeat time). More... | |
void | OnCommand (::std::function< void(NmtCommand)> on_command) |
Registers the function to be invoked when an NMT command is received from the master. More... | |
void | OnHeartbeat (::std::function< void(uint8_t, bool)> on_heartbeat) |
Registers the function to be invoked when a heartbeat timeout event occurs or is resolved. More... | |
void | OnState (::std::function< void(uint8_t, NmtState)> on_state) |
Registers the function to be invoked when an NMT state change or boot-up event is detected for a remote node by the heartbeat protocol. More... | |
void | OnRpdo (::std::function< void(int, ::std::error_code, const void *, ::std::size_t)> on_rpdo) |
Registers the function to be invoked when a Receive-PDO is processed. More... | |
void | OnRpdoError (::std::function< void(int, uint16_t, uint8_t)> on_rpdo_error) |
Registers the function to be invoked when a Receive-PDO length mismatch or timeout error occurs. More... | |
void | OnTpdo (::std::function< void(int, ::std::error_code, const void *, ::std::size_t)> on_tpdo) |
Registers the function to be invoked after a Transmit-PDO is sent or an error occurs. More... | |
void | OnSync (::std::function< void(uint8_t, const time_point &)> on_sync) |
Registers the function to be invoked when a SYNC message is sent/received. More... | |
void | OnSyncError (::std::function< void(uint16_t, uint8_t)> on_sync_error) |
Registers the function to be invoked when the data length of a received SYNC message does not match. More... | |
void | OnTime (::std::function< void(const ::std::chrono::system_clock::time_point &)> on_time) |
Registers the function to be invoked when a TIME message is received. More... | |
void | OnEmcy (::std::function< void(uint8_t, uint16_t, uint8_t, uint8_t[5])> on_emcy) |
Registers the function to be invoked when an EMCY message is received. More... | |
void | OnSwitchBitrate (::std::function< void(int, ::std::chrono::milliseconds)> on_switch_bitrate) |
Registers the function to be invoked when the LSS master activates the bit rate of all CANopen devices in the network. More... | |
![]() | |
CanNet (ev_exec_t *exec, io_timer_t *timer, io_can_chan_t *chan, ::std::size_t txlen=0, int txtimeo=0) | |
CanNet (io_timer_t *timer, io_can_chan_t *chan, ::std::size_t txlen=0, int txtimeo=0) | |
virtual | ~CanNet () |
void | start () noexcept |
ContextBase | get_ctx () const noexcept |
ev::Executor | get_executor () const noexcept |
Clock | get_clock () const noexcept |
![]() | |
Device (const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff, util::BasicLockable *mutex=nullptr) | |
Creates a new CANopen device description. More... | |
uint8_t | netid () const noexcept |
Returns the network-ID. | |
uint8_t | id () const noexcept |
Returns the node-ID. | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value, T >::type | Read (uint16_t idx, uint8_t subidx) const |
Submits an SDO upload request to the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value, T >::type | Read (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const |
Submits an SDO upload request to the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value >::type | Write (uint16_t idx, uint8_t subidx, const T &value) |
Submits an SDO download request to the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value >::type | Write (uint16_t idx, uint8_t subidx, const T &value, ::std::error_code &ec) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const char *value) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const char *value, ::std::error_code &ec) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const char16_t *value) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const char16_t *value, ::std::error_code &ec) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const void *p, ::std::size_t n) |
Submits an SDO download request to the local object dictionary. More... | |
void | Write (uint16_t idx, uint8_t subidx, const void *p, ::std::size_t n, ::std::error_code &ec) |
Submits an SDO download request to the local object dictionary. More... | |
void | WriteDcf (const uint8_t *begin, const uint8_t *end) |
Submits a series of SDO download requests to the local object dictionary. More... | |
void | WriteDcf (const uint8_t *begin, const uint8_t *end, ::std::error_code &ec) |
Submits a series of SDO download requests to the local object dictionary. More... | |
void | WriteDcf (const char *path) |
Submits a series of SDO download requests to the local object dictionary. More... | |
void | WriteDcf (const char *path, ::std::error_code &ec) |
Submits a series of SDO download requests to the local object dictionary. More... | |
void | WriteEvent (uint16_t idx, uint8_t subidx) |
Checks if the specified sub-object in the local object dictionary can be mapped into a PDO and, if so, triggers the transmission of every event-driven, asynchronous Transmit-PDO into which the sub-object is mapped. More... | |
void | WriteEvent (uint16_t idx, uint8_t subidx, ::std::error_code &ec) noexcept |
Checks if the specified sub-object in the local object dictionary can be mapped into a PDO and, if so, triggers the transmission of every event-driven, asynchronous Transmit-PDO into which the sub-object is mapped. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | RpdoRead (uint8_t id, uint16_t idx, uint8_t subidx) const |
Reads the value of a sub-object in a remote object dictionary by submitting an SDO upload request to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | RpdoRead (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) const |
Reads the value of a sub-object in a remote object dictionary by submitting an SDO upload request to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | TpdoRead (uint8_t id, uint16_t idx, uint8_t subidx) const |
Submits an SDO upload request to a TPDO-mapped sub-object in the local object dictionary, which reads the value that will be written to an RPDO-mapped sub-object in a remote object dictionary by a Transmit-PDO. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | TpdoRead (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) const |
Submits an SDO upload request to a TPDO-mapped sub-object in the local object dictionary, which reads the value that will be written to an RPDO-mapped sub-object in a remote object dictionary by a Transmit-PDO. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value >::type | TpdoWrite (uint8_t id, uint16_t idx, uint8_t subidx, T value) |
Writes a value to a sub-object in a remote object dictionary by submitting an SDO download request to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value >::type | TpdoWrite (uint8_t id, uint16_t idx, uint8_t subidx, T value, ::std::error_code &ec) |
Writes a value to a sub-object in a remote object dictionary by submitting an SDO download request to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
void | TpdoWriteEvent (uint8_t id, uint16_t idx, uint8_t subidx) |
Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary. More... | |
void | TpdoWriteEvent (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) noexcept |
Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary. More... | |
Data Fields | |
TpdoEventMutex | tpdo_event_mutex |
Protected Member Functions | |
void | OnCanState (io::CanState new_state, io::CanState old_state) noexcept override |
The default implementation invokes lely::canopen::Node::OnCanState() and notifies each registered driver. More... | |
void | OnCanError (io::CanError error) noexcept override |
The default implementation notifies all registered drivers. More... | |
void | OnRpdoWrite (uint8_t id, uint16_t idx, uint8_t subidx) noexcept override |
The default implementation notifies the driver registered for node id. More... | |
void | OnCommand (NmtCommand cs) noexcept override |
The default implementation notifies all registered drivers. More... | |
void | OnHeartbeat (uint8_t id, bool occurred) noexcept override |
The default implementation notifies the driver registered for node id. More... | |
void | OnState (uint8_t id, NmtState st) noexcept override |
The default implementation notifies the driver registered for node id. More... | |
void | OnSync (uint8_t cnt, const time_point &t) noexcept override |
The default implementation notifies all registered drivers. More... | |
void | OnSyncError (uint16_t eec, uint8_t er) noexcept override |
The default implementation notifies all registered drivers. More... | |
void | OnTime (const ::std::chrono::system_clock::time_point &abs_time) noexcept override |
The default implementation notifies all registered drivers. More... | |
void | OnEmcy (uint8_t id, uint16_t eec, uint8_t er, uint8_t msef[5]) noexcept override |
The default implementation notifies the driver registered for node id. More... | |
virtual void | OnNodeGuarding (uint8_t id, bool occurred) noexcept |
The function invoked when a node guarding timeout event occurs or is resolved. More... | |
virtual void | OnBoot (uint8_t id, NmtState st, char es, const ::std::string &what) noexcept |
The function invoked when the NMT 'boot slave' process completes. More... | |
void | IsReady (uint8_t id, bool ready) noexcept |
Marks a remote note as ready or not ready. More... | |
virtual void | OnConfig (uint8_t id) noexcept |
The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' process. More... | |
void | ConfigResult (uint8_t id, ::std::error_code ec) noexcept |
Reports the result of the 'update configuration' step to the NMT service. More... | |
bool | IsConfig (uint8_t id) const |
Returns true if the remote node is configuring (i.e., the 'update configuration' step of the NMT 'boot slave' is reached but not yet completed) and false if not. More... | |
Sdo * | GetSdo (uint8_t id) |
Returns a pointer to the default client-SDO service for the given node. More... | |
void | CancelSdo (uint8_t id=0) |
Aborts any ongoing or pending SDO requests for the specified slave. More... | |
![]() | |
__can_net * | net () const noexcept |
Returns a pointer to the internal CAN network interface from <lely/can/net.h>. | |
void | SetTime () |
Updates the CAN network time. | |
__co_nmt * | nmt () const noexcept |
Returns a pointer to the internal CANopen NMT master/slave service from <lely/co/nmt.hpp>. | |
void | RpdoRtr (int num=0) noexcept |
Requests the transmission of a PDO by sending a CAN frame with the RTR (Remote Transmission Request) bit set. More... | |
void | TpdoEvent (int num=0) noexcept |
Triggers the transmission of an acyclic or event-driven PDO. More... | |
![]() | |
void | lock () final |
Blocks until a lock can be obtained for the current execution agent (thread, process, task). More... | |
void | unlock () final |
Releases the lock held by the execution agent. Throws no exceptions. | |
void | set_time () |
Updates the CAN network time. More... | |
virtual void | on_read_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a new CAN frame read error occurs, or when a read operation completes successfully after one or more errors. More... | |
virtual void | on_queue_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a CAN frame is dropped because the transmit queue is full, or when a frame is successfully queued after one or more errors. More... | |
virtual void | on_write_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a new CAN frame write error occurs, or when a write operation completes successfully after one or more errors. More... | |
virtual void | on_can_state (CanState new_state, CanState old_state) noexcept |
The function invoked when a CAN bus state change is detected. More... | |
virtual void | on_can_error (CanError error) noexcept |
The function invoked when an error is detected on the CAN bus. More... | |
![]() | |
__co_dev * | dev () const noexcept |
Returns a pointer to the internal CANopen device from <lely/co/dev.hpp>. | |
const ::std::type_info & | Type (uint16_t idx, uint8_t subidx) const |
Returns the type of a sub-object. More... | |
const ::std::type_info & | Type (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Returns the type of a sub-object. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value, T >::type | Get (uint16_t idx, uint8_t subidx) const |
Reads the value of a sub-object. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value, T >::type | Get (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Reads the value of a sub-object. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value >::type | Set (uint16_t idx, uint8_t subidx, const T &value) |
Writes a CANopen value to a sub-object. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen< T >::value >::type | Set (uint16_t idx, uint8_t subidx, const T &value, ::std::error_code &ec) noexcept |
Writes a CANopen value to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const char *value) |
Writes a VISIBLE_STRING to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const char *value, ::std::error_code &ec) noexcept |
Writes a VISIBLE_STRING to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const char16_t *value) |
Writes a UNICODE_STRING to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const char16_t *value, ::std::error_code &ec) noexcept |
Writes a UNICODE_STRING to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const void *p, ::std::size_t n) |
Writes an OCTET_STRING or DOMAIN value to a sub-object. More... | |
void | Set (uint16_t idx, uint8_t subidx, const void *p, ::std::size_t n, ::std::error_code &ec) noexcept |
Writes an OCTET_STRING or DOMAIN value to a sub-object. More... | |
const char * | GetUploadFile (uint16_t idx, uint8_t subidx) const |
Returns the value of the UploadFile attribute of a sub-object, if present. More... | |
const char * | GetUploadFile (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Returns the value of the UploadFile attribute of a sub-object, if present. More... | |
void | SetUploadFile (uint16_t idx, uint8_t subidx, const char *filename) |
Sets the value of the UploadFile attribute of a sub-object, if present. More... | |
void | SetUploadFile (uint16_t idx, uint8_t subidx, const char *filename, ::std::error_code &ec) noexcept |
Sets the value of the UploadFile attribute of a sub-object, if present. More... | |
const char * | GetDownloadFile (uint16_t idx, uint8_t subidx) const |
Returns the value of the DownloadFile attribute of a sub-object, if present. More... | |
const char * | GetDownloadFile (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Returns the value of the DownloadFile attribute of a sub-object, if present. More... | |
void | SetDownloadFile (uint16_t idx, uint8_t subidx, const char *filename) |
Sets the value of the DownloadFile attribute of a sub-object, if present. More... | |
void | SetDownloadFile (uint16_t idx, uint8_t subidx, const char *filename, ::std::error_code &ec) noexcept |
Sets the value of the DownloadFile attribute of a sub-object, if present. More... | |
void | SetEvent (uint16_t idx, uint8_t subidx) |
Checks if the specified sub-object in the local object dictionary can be mapped into a PDO and, if so, triggers the transmission of every event-driven, asynchronous Transmit-PDO into which the sub-object is mapped. More... | |
void | SetEvent (uint16_t idx, uint8_t subidx, ::std::error_code &ec) noexcept |
Checks if the specified sub-object in the local object dictionary can be mapped into a PDO and, if so, triggers the transmission of every event-driven, asynchronous Transmit-PDO into which the sub-object is mapped. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | RpdoGet (uint8_t id, uint16_t idx, uint8_t subidx) const |
Reads the value of a sub-object in a remote object dictionary by reading the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | RpdoGet (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Reads the value of a sub-object in a remote object dictionary by reading the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | TpdoGet (uint8_t id, uint16_t idx, uint8_t subidx) const |
Reads the value of a TPDO-mapped sub-object in the local object dictionary that will be written to an RPDO-mapped sub-object in a remote object dictionary by a Transmit-PDO. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value, T >::type | TpdoGet (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) const noexcept |
Reads the value of a TPDO-mapped sub-object in the local object dictionary that will be written to an RPDO-mapped sub-object in a remote object dictionary by a Transmit-PDO. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value >::type | TpdoSet (uint8_t id, uint16_t idx, uint8_t subidx, T value) |
Writes a value to a sub-object in a remote object dictionary by writing to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
template<class T > | |
typename ::std::enable_if< is_canopen_basic< T >::value >::type | TpdoSet (uint8_t id, uint16_t idx, uint8_t subidx, T value, ::std::error_code &ec) noexcept |
Writes a value to a sub-object in a remote object dictionary by writing to the corresponding PDO-mapped sub-object in the local object dictionary. More... | |
void | TpdoSetEvent (uint8_t id, uint16_t idx, uint8_t subidx) |
Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary. More... | |
void | TpdoSetEvent (uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code &ec) noexcept |
Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary. More... | |
void | UpdateRpdoMapping () |
Updates the mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects. More... | |
void | UpdateTpdoMapping () |
Updates the mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects. More... | |
void | RpdoWrite (uint8_t id, uint16_t idx, uint8_t subidx) |
Invokes OnRpdoWrite() as if a value was written to an RPDO-mapped object in the local object dictionary. More... | |
The CANopen master.
The master implements a CANopen node. Handling events for remote CANopen slaves is delegated to drivers (see lely::canopen::DriverBase and lely::canopen::BasicDriver), one of which can be registered for each node-ID.
For derived classes, the master behaves as an AssociativeContainer for drivers.
Definition at line 50 of file master.hpp.
using lely::canopen::BasicMaster::ReadSignature = void(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code ec, T value) |
The signature of the callback function invoked on completion of an asynchronous read (SDO upload) operation from a remote object dictionary.
Note that the callback function SHOULD NOT throw exceptions. Since it is invoked from C, any exception that is thrown cannot be caught and will result in a call to std::terminate()
.
id | the node-ID (in the range[1..127]). |
idx | the object index. |
subidx | the object sub-index. |
ec | the SDO abort code (0 on success). |
value | the value received from the SDO server. |
Definition at line 550 of file master.hpp.
using lely::canopen::BasicMaster::WriteSignature = void(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code ec) |
The signature of the callback function invoked on completion of an asynchronous write (SDO download) operation to a remote object dictionary.
Note that the callback function SHOULD NOT throw exceptions. Since it is invoked from C, any exception that is thrown cannot be caught and will result in a call to std::terminate()
.
id | the node-ID (in the range[1..127]). |
idx | the object index. |
subidx | the object sub-index. |
ec | the SDO abort code (0 on success). |
Definition at line 565 of file master.hpp.
|
explicit |
Creates a new CANopen master.
After creation, the master is in the NMT 'Initialisation' state and does not yet create any services or perform any communication. Call Reset() to start the boot-up process.
exec | the executor used to process I/O and CANopen events. If exec is a null pointer, the CAN channel executor is used. |
timer | the timer used for CANopen events. This timer MUST NOT be used for any other purpose. |
chan | a CAN channel. This channel MUST NOT be used for any other purpose. |
dcf_txt | the path of the text EDS or DCF containing the device description. |
dcf_bin | the path of the (binary) concise DCF containing the values of (some of) the objets in the object dictionary. If dcf_bin is empty, no concise DCF is loaded. |
id | the node-ID (in the range [1..127, 255]). If id is 255 (unconfigured), the node-ID is obtained from the DCF. |
Definition at line 81 of file master.cpp.
|
inlinenoexcept |
Returns a mutator object that provides read/write access to the specified CANopen object in the local object dictionary.
Note that this function succeeds even if the object does not exist.
idx | the object index. |
Definition at line 611 of file master.hpp.
|
inlinenoexcept |
Returns an accessor object that provides read-only access to the specified CANopen object in the local object dictionary.
Note that this function succeeds even if the object does not exist.
idx | the object index. |
Definition at line 626 of file master.hpp.
|
inlinenoexcept |
Returns an accessor object that provides read-only access to RPDO-mapped objects in the remote object dictionary of the specified node.
Note that this function succeeds even if no RPDO-mapped objects exist.
id | the node-ID. |
Definition at line 641 of file master.hpp.
|
inlinenoexcept |
Returns a mutator object that provides read/write access to TPDO-mapped objects in the remote object dictionary of the specified node.
Note that this function succeeds even if no TPDO-mapped objects exist.
id | the node-ID. |
Definition at line 656 of file master.hpp.
bool lely::canopen::BasicMaster::Boot | ( | uint8_t | id | ) |
Requests the NMT 'boot slave' process for the specified node.
OnBoot() is invoked once the boot-up process completes.
Definition at line 91 of file master.cpp.
bool lely::canopen::BasicMaster::IsReady | ( | uint8_t | id | ) | 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.
Invoking AsyncDeconfig() will also mark a node as not ready.
If this function returns true, the default client-SDO service is available for the given node.
Definition at line 117 of file master.cpp.
ev::Future< void > lely::canopen::BasicMaster::AsyncDeconfig | ( | uint8_t | id | ) |
Queues the DriverBase::OnDeconfig() method for the driver with the specified node-ID and creates a future which becomes ready once the deconfiguration process completes.
Definition at line 125 of file master.cpp.
ev::Future<::std::size_t, void > lely::canopen::BasicMaster::AsyncDeconfig | ( | ) |
Queues the DriverBase::OnDeconfig() method for all registered drivers and creates a future which becomes ready once all deconfiguration processes complete.
Definition at line 135 of file master.cpp.
void lely::canopen::BasicMaster::Error | ( | uint8_t | id | ) |
Indicates the occurrence of an error event on a remote node and triggers the error handling process (see Fig.
12 in CiA 302-2 v4.1.0). Note that depending on the value of objects 1F80 (NMT startup) and 1F81 (NMT slave assignment), the occurrence of an error event MAY trigger an NMT state transition of the entire network, including the master.
id | the node-ID (in the range[1..127]). |
Definition at line 150 of file master.cpp.
void lely::canopen::BasicMaster::Command | ( | NmtCommand | cs, |
uint8_t | id = 0 |
||
) |
Issues an NMT command to a slave.
cs | the NMT command specifier. |
id | the node-ID (0 for all nodes, [1..127] for a specific slave). |
Definition at line 164 of file master.cpp.
|
noexcept |
Definition at line 172 of file master.cpp.
|
noexcept |
Definition at line 179 of file master.cpp.
|
inline |
Definition at line 741 of file master.hpp.
std::chrono::milliseconds lely::canopen::BasicMaster::GetTimeout | ( | ) | const |
Returns the SDO timeout used during the NMT 'boot slave' and 'check configuration' processes.
Definition at line 186 of file master.cpp.
void lely::canopen::BasicMaster::SetTimeout | ( | const ::std::chrono::milliseconds & | timeout | ) |
Sets the SDO timeout used during the NMT 'boot slave' and 'check configuration' processes.
Definition at line 193 of file master.cpp.
|
inline |
Queues an asynchronous read (SDO upload) operation.
id | the node-ID (in the range[1..127]). |
req | the SDO upload request. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 786 of file master.hpp.
|
inline |
Queues an asynchronous read (SDO upload) operation.
This function reads the value of a sub-object in a remote object dictionary.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 857 of file master.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.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 928 of file master.hpp.
|
inline |
Queues an asynchronous SDO upload operation.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
idx | the object index. |
subidx | the object sub-index. |
con | the confirmation function to be called on completion of the SDO request. |
block | a flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO. |
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 955 of file master.hpp.
|
inline |
Queues an asynchronous write (SDO download) operation.
id | the node-ID (in the range[1..127]). |
req | the SDO download request. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 994 of file master.hpp.
|
inline |
Queues an asynchronous write (SDO download) operation.
This function writes a value to a sub-object in a remote object dictionary.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1068 of file master.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.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1141 of file master.hpp.
|
inline |
Queues an asynchronous SDO download operation.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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. |
block | a flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO. |
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 1170 of file master.hpp.
void lely::canopen::BasicMaster::SubmitWriteDcf | ( | uint8_t | id, |
SdoDownloadDcfRequest & | req, | ||
::std::error_code & | ec | ||
) |
Queues an asynchronous write (SDO download) operation.
id | the node-ID (in the range[1..127]). |
req | the SDO download request. |
ec | the error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available. |
Definition at line 207 of file master.cpp.
|
inline |
Queues a series of asynchronous write (SDO download) operations.
This function writes each entry in the specified concise DCF to a sub-object in a remote object dictionary.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
con | the confirmation function to be called when all SDO download requests are successfully completed, or when an error occurs. |
timeout | the SDO timeout. If, after a single 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 1268 of file master.hpp.
|
inline |
Queues a series of asynchronous write (SDO download) operations.
This function writes each entry in the specified concise DCF to a sub-object in a remote object dictionary.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
path | the path of the concise DCF. |
con | the confirmation function to be called when all SDO download requests are successfully completed, or when an error occurs. |
timeout | the SDO timeout. If, after a single 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 1341 of file master.hpp.
|
inline |
Queues an asynchronous read (SDO upload) operation and creates a future which becomes ready once the request completes (or is canceled).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1385 of file master.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.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1423 of file master.hpp.
|
inline |
Queues an asynchronous SDO upload operation and creates a future which becomes ready once the request completes (or is canceled).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
idx | the object index. |
subidx | the object sub-index. |
block | a flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO. |
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 1448 of file master.hpp.
|
inline |
Queues an asynchronous write (SDO download) operation and creates a future which becomes ready once the request completes (or is canceled).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1495 of file master.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.
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
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 1536 of file master.hpp.
|
inline |
Queues an asynchronous SDO download operation and creates a future which becomes ready once the request completes (or is canceled).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
idx | the object index. |
subidx | the object sub-index. |
value | the value to be written. |
block | a flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO. |
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 1562 of file master.hpp.
SdoFuture< void > lely::canopen::BasicMaster::AsyncWriteDcf | ( | ev_exec_t * | exec, |
uint8_t | id, | ||
const uint8_t * | begin, | ||
const uint8_t * | end, | ||
const ::std::chrono::milliseconds & | timeout | ||
) |
Queues a series of asynchronous write (SDO download) operations, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
timeout | the SDO timeout. If, after a single 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 222 of file master.cpp.
SdoFuture< void > lely::canopen::BasicMaster::AsyncWriteDcf | ( | ev_exec_t * | exec, |
uint8_t | id, | ||
const char * | path, | ||
const ::std::chrono::milliseconds & | timeout | ||
) |
Queues a series of asynchronous write (SDO download) operations, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs).
exec | the executor used to execute the completion task. |
id | the node-ID (in the range[1..127]). |
path | the path to a concise DCF. |
timeout | the SDO timeout. If, after a single 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 240 of file master.cpp.
void lely::canopen::BasicMaster::Insert | ( | DriverBase & | driver | ) |
Registers a driver for a remote CANopen node.
If an event occurs for that node, or for the entire CANopen network, the corresponding method of the driver will be invoked.
std::out_of_range | if the node-ID is invalid or already registered. |
Definition at line 257 of file master.cpp.
void lely::canopen::BasicMaster::Erase | ( | DriverBase & | driver | ) |
Unregisters a driver for a remote CANopen node.
Definition at line 274 of file master.cpp.
|
inline |
Definition at line 1661 of file master.hpp.
|
inline |
Definition at line 1667 of file master.hpp.
|
inline |
Definition at line 1673 of file master.hpp.
|
inline |
Definition at line 1679 of file master.hpp.
|
inline |
Definition at line 1685 of file master.hpp.
|
inline |
Definition at line 1691 of file master.hpp.
|
inline |
Definition at line 1697 of file master.hpp.
|
inline |
Definition at line 1703 of file master.hpp.
|
inline |
Definition at line 1709 of file master.hpp.
|
inline |
Definition at line 1716 of file master.hpp.
void lely::canopen::BasicMaster::OnNodeGuarding | ( | ::std::function< void(uint8_t, bool)> | on_node_guarding | ) |
Registers the function invoked when a node guarding timeout event occurs or is resolved.
Only a single function can be registered at any one time. If on_node_guarding contains a callable function target, a copy of the target is invoked after OnNodeGuarding(uint8_t, bool) completes.
Definition at line 286 of file master.cpp.
void lely::canopen::BasicMaster::OnBoot | ( | ::std::function< void(uint8_t, NmtState, char, const ::std::string &)> | on_boot | ) |
Registers the function invoked when the NMT 'boot slave' process completes.
Only a single function can be registered at any one time. If on_boot contains a callable function target, a copy of the target is invoked after OnBoot(uint8_t, NmtState, char, const ::std::string&) completes.
Definition at line 293 of file master.cpp.
|
overrideprotectedvirtualnoexcept |
The default implementation invokes lely::canopen::Node::OnCanState() and notifies each registered driver.
Reimplemented from lely::canopen::Node.
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 301 of file master.cpp.
|
overrideprotectedvirtualnoexcept |
The default implementation notifies all registered drivers.
Reimplemented from lely::canopen::Node.
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 310 of file master.cpp.
|
overrideprotectedvirtualnoexcept |
The default implementation notifies the driver registered for node id.
Reimplemented from lely::canopen::Device.
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 318 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies all registered drivers.
Unless the master enters the pre-operational or operational state, all ongoing and pending SDO requests are aborted.
Definition at line 327 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies the driver registered for node id.
Definition at line 338 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies the driver registered for node id.
If a boot-up event (st == NmtState::BOOTUP
) is detected, any ongoing or pending SDO requests for the slave are aborted. This is necessary because the master MAY need the Client-SDO service for the NMT 'boot slave' process.
Definition at line 347 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies all registered drivers.
Definition at line 362 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies all registered drivers.
Definition at line 370 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies all registered drivers.
Definition at line 378 of file master.cpp.
|
overrideprotectednoexcept |
The default implementation notifies the driver registered for node id.
Definition at line 387 of file master.cpp.
|
protectedvirtualnoexcept |
The function invoked when a node guarding timeout event occurs or is resolved.
Note that depending on the value of object 1029:01 (Error behavior object), the occurrence of a node guarding event MAY trigger an NMT state transition. If so, this function is called after the state change completes.
The default implementation notifies the driver registered for node id.
id | the node-ID (in the range [1..127]). |
occurred | true if the node guarding event occurred, false if it was resolved. |
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 397 of file master.cpp.
|
protectedvirtualnoexcept |
The function invoked when the NMT 'boot slave' process completes.
The default implementation notifies the driver registered for node id.
id | the node-ID (in the range [1..127]). |
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. |
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 406 of file master.cpp.
|
protectednoexcept |
Marks a remote note as ready or not ready.
Definition at line 416 of file master.cpp.
|
protectedvirtualnoexcept |
The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' process.
The 'boot slave' process is halted until the result of the 'update configuration' step is communicated to the NMT service with ConfigResult().
The default implementation delegates the configuration update to the driver, if one is registered for node id. If not, a successful result is communicated to the NMT service.
Reimplemented in lely::canopen::AsyncMaster.
Definition at line 421 of file master.cpp.
|
protectednoexcept |
Reports the result of the 'update configuration' step to the NMT service.
id | the node-ID (in the range [1..127]). |
ec | the SDO abort code (0 on success). |
Definition at line 443 of file master.cpp.
|
protected |
Returns true if the remote node is configuring (i.e., the 'update configuration' step of the NMT 'boot slave' is reached but not yet completed) and false if not.
If this function returns true, the default client-SDO service is available for the given node.
Definition at line 462 of file master.cpp.
|
protected |
Returns a pointer to the default client-SDO service for the given node.
If the master is not in the pre-operational or operational state, or if the master needs the client-SDO to boot the node, a null pointer is returned.
Definition at line 473 of file master.cpp.
|
protected |
Aborts any ongoing or pending SDO requests for the specified slave.
id | the node-ID (0 for all nodes, [1..127] for a specific slave). |
Definition at line 494 of file master.cpp.
TpdoEventMutex lely::canopen::BasicMaster::tpdo_event_mutex |
Definition at line 1740 of file master.hpp.