Lely core libraries 2.3.4
lely::canopen::LoopDriver Class Reference

A CANopen driver running its own dedicated event loop in a separate thread. More...

#include <loop_driver.hpp>

Inheritance diagram for lely::canopen::LoopDriver:
Collaboration diagram for lely::canopen::LoopDriver:

Data Structures

struct  Impl_
 The internal implementation of lely::canopen::LoopDriver. More...
 

Public Member Functions

 LoopDriver (AsyncMaster &master, uint8_t id)
 Creates a new CANopen driver and starts a new event loop in a separate thread to execute event handlers (and SDO confirmation functions). More...
 
 ~LoopDriver ()
 Stops the event loop and terminates the thread in which it was running before destroying the driver. More...
 
ev::LoopGetLoop () noexcept
 Returns a reference to the dedicated event loop of the driver.
 
ev::Executor GetStrand () const noexcept
 Returns the strand executor associated with the event loop of the driver.
 
void Join ()
 Stops the dedicated event loop of the driver and waits until the thread running the event loop finishes its execution. More...
 
ev::Future< void, void > AsyncStoppped () noexcept
 Returns a future which becomes ready once the dedicated event loop of the driver is stopped and the thread is (about to be) terminated.
 
template<class F , class... Args>
void Defer (F &&f, Args &&... args)
 Schedules the specified Callable object for execution by the event loop for this driver. More...
 
template<class T >
Wait (SdoFuture< T > f)
 Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver. More...
 
template<class T >
typename::std::enable_if<!::std::is_void< T >::value, T >::type Wait (SdoFuture< T > f, ::std::error_code &ec)
 Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver. More...
 
void Wait (SdoFuture< void > f, ::std::error_code &ec)
 Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver. More...
 
void USleep (uint_least64_t usec)
 Runs the event loop for usec microseconds. More...
 
void USleep (uint_least64_t usec, ::std::error_code &ec)
 Runs the event loop for usec microseconds. More...
 
template<class T >
RunRead (uint16_t idx, uint8_t subidx)
 Equivalent to RunRead(uint16_t idx, uint8_t subidx, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error.
 
template<class T >
RunRead (uint16_t idx, uint8_t subidx, ::std::error_code &ec)
 Equivalent to RunRead(uint16_t idx, uint8_t subidx, 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 >
RunRead (uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds &timeout)
 Equivalent to RunRead(uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error.
 
template<class T >
RunRead (uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec)
 Queues an asynchronous read (SDO upload) operation and runs the event loop until the operation is complete. More...
 
template<class T >
void RunWrite (uint16_t idx, uint8_t subidx, T &&value)
 Equivalent to RunWrite(uint16_t idx, uint8_t subidx, T&& value, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error.
 
template<class T >
void RunWrite (uint16_t idx, uint8_t subidx, T &&value, ::std::error_code &ec)
 Equivalent to RunWrite(uint16_t idx, uint8_t subidx, T&& value, 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 >
void RunWrite (uint16_t idx, uint8_t subidx, T &&value, const ::std::chrono::milliseconds &timeout)
 Equivalent to RunWrite(uint16_t idx, uint8_t subidx, T&& value, const ::std::chrono::milliseconds& timeout, ::std::error_code& ec), except that it throws lely::canopen::SdoError on error.
 
template<class T >
void RunWrite (uint16_t idx, uint8_t subidx, T &&value, const ::std::chrono::milliseconds &timeout, ::std::error_code &ec)
 Queues an asynchronous write (SDO download) operation and runs the event loop until the operation is complete. More...
 
- Public Member Functions inherited from lely::canopen::BasicDriver
 BasicDriver (ev_exec_t *exec, BasicMaster &master, uint8_t id)
 Creates a new driver for a remote CANopen node and registers it with the master. More...
 
 BasicDriver (BasicMaster &master, uint8_t id)
 Creates a new driver for a remote CANopen node and registers it with the master.
 
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.
 
void ConfigHeartbeat (const ::std::chrono::milliseconds &ms, ::std::error_code &ec)
 Configures heartbeat consumption by updating CANopen object 1016 (Consumer heartbeat time). More...
 
void ConfigHeartbeat (const ::std::chrono::milliseconds &ms)
 Configures heartbeat consumption by updating CANopen object 1016 (Consumer heartbeat time). More...
 
bool Boot ()
 Requests the NMT 'boot slave' process for the remote node. More...
 
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 T >
void DamMpdoEvent (int num, uint16_t idx, uint8_t subidx, T value)
 Triggers the transmission of a destination address mode multiplex PDO (DAM-MPDO). 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 F >
void SubmitWriteDcf (const uint8_t *begin, const uint8_t *end, F &&con)
 Equivalent to SubmitWriteDcf(const uint8_t* begin, const uint8_t* end, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout().
 
template<class F >
void SubmitWriteDcf (const uint8_t *begin, const uint8_t *end, F &&con, ::std::error_code &ec)
 Equivalent to SubmitWriteDcf(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 lely::canopen::BasicMaster::GetTimeout().
 
template<class F >
void SubmitWriteDcf (const uint8_t *begin, const uint8_t *end, F &&con, const ::std::chrono::milliseconds &timeout)
 Equivalent to SubmitWriteDcf(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 (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 (const char *path, F &&con)
 Equivalent to SubmitWriteDcf(const char* path, F&& con, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout().
 
template<class F >
void SubmitWriteDcf (const char *path, F &&con, ::std::error_code &ec)
 Equivalent to SubmitWriteDcf(const char* path, 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 F >
void SubmitWriteDcf (const char *path, F &&con, const ::std::chrono::milliseconds &timeout)
 Equivalent to SubmitWriteDcf(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 (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 (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...
 
SdoFuture< void > AsyncWriteDcf (const uint8_t *begin, const uint8_t *end)
 Equivalent to AsyncWriteDcf(const uint8_t* begin, const uint8_t* end, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout().
 
SdoFuture< void > AsyncWriteDcf (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 (const char *path)
 Equivalent to AsyncWriteDcf(const char* path, const ::std::chrono::milliseconds& timeout), except that it uses the SDO timeout given by lely::canopen::BasicMaster::GetTimeout().
 
SdoFuture< void > AsyncWriteDcf (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 (LogicalDriverBase &driver)
 Registers a logical device driver for the remote node. More...
 
void Erase (LogicalDriverBase &driver)
 Unregisters a logical device driver for the remote node. 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...
 

Additional Inherited Members

- Data Fields inherited from lely::canopen::BasicDriver
BasicMastermaster
 A reference to the master with which this driver is registered.
 
class BasicMaster::RpdoMapped rpdo_mapped
 An accessor providing read-only access to RPDO-mapped objects in the remote object dictionary. More...
 
class BasicMaster::TpdoMapped tpdo_mapped
 A mutator providing read/write access to TPDO-mapped objects in the remote object dictionary. More...
 
TpdoEventMutextpdo_event_mutex
 
- Protected Member Functions inherited from lely::canopen::BasicDriver
void OnCanState (io::CanState new_state, io::CanState old_state) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnCanError (io::CanError error) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnRpdoWrite (uint16_t idx, uint8_t subidx) noexcept override
 The default implementation notifies all registered logical device drivers, unless the object index is part of the standardized profile area of a logical device (6000..9FFF). More...
 
void OnCommand (NmtCommand cs) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnHeartbeat (bool occurred) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnState (NmtState st) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnSync (uint8_t cnt, const time_point &t) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnSyncError (uint16_t eec, uint8_t er) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnTime (const ::std::chrono::system_clock::time_point &abs_time) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnEmcy (uint16_t eec, uint8_t er, uint8_t msef[5]) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnNodeGuarding (bool occurred) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnBoot (NmtState st, char es, const ::std::string &what) noexcept override
 The default implementation notifies all registered logical device drivers. More...
 
void OnConfig (::std::function< void(::std::error_code ec)> res) noexcept override
 The default implementation invokes AsyncConfig() to start the configuration process for all registered logical device drivers. More...
 
void OnDeconfig (::std::function< void(::std::error_code ec)> res) noexcept override
 The default implementation invokes AsyncDeconfig() to start the deconfiguration process for all registered logical device drivers. More...
 
SdoFuture< void > AsyncConfig (int num=0)
 Invokes LogicalDriverBase::AsyncConfig() for the specified logical device driver. More...
 
SdoFuture< void > AsyncDeconfig (int num=0)
 Invokes LogicalDriverBase::AsyncDeconfig() for the specified logical device driver. More...
 

Detailed Description

A CANopen driver running its own dedicated event loop in a separate thread.

Definition at line 51 of file loop_driver.hpp.

Constructor & Destructor Documentation

◆ LoopDriver()

lely::canopen::LoopDriver::LoopDriver ( AsyncMaster master,
uint8_t  id 
)
explicit

Creates a new CANopen driver and starts a new event loop in a separate thread to execute event handlers (and SDO confirmation functions).

Parameters
mastera reference to a CANopen master.
idthe node-ID of the remote node (in the range [1..127]).
Exceptions
std::out_of_rangeif the node-ID is invalid or already registered.

Definition at line 77 of file loop_driver.cpp.

◆ ~LoopDriver()

lely::canopen::LoopDriver::~LoopDriver ( )
default

Stops the event loop and terminates the thread in which it was running before destroying the driver.

See also
AsyncStopped()

Member Function Documentation

◆ Join()

void lely::canopen::LoopDriver::Join ( )

Stops the dedicated event loop of the driver and waits until the thread running the event loop finishes its execution.

If logical drivers have been registered, this function SHOULD be invoked before those drivers are destroyed. Otherwise pending tasks for those drivers may remain on the event loop.

This function can be called more than once and from multiple threads, but only the first invocation waits for the thread to finish.

Definition at line 84 of file loop_driver.cpp.

◆ Defer()

template<class F , class... Args>
void lely::canopen::LoopDriver::Defer ( F &&  f,
Args &&...  args 
)
inline

Schedules the specified Callable object for execution by the event loop for this driver.

See also
GetStrand().

Definition at line 110 of file loop_driver.hpp.

◆ Wait() [1/3]

template<class T >
T lely::canopen::LoopDriver::Wait ( SdoFuture< T >  f)
inline

Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver.

This function MUST only be called from tasks running on that event loop.

Returns
the value stored in the future on success.
Exceptions
theexception stored in the future on failure.
See also
GetLoop().

Definition at line 128 of file loop_driver.hpp.

◆ Wait() [2/3]

template<class T >
typename::std::enable_if<!::std::is_void< T >::value, T >::type lely::canopen::LoopDriver::Wait ( SdoFuture< T >  f,
::std::error_code &  ec 
)
inline

Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver.

The error code (0 on success) is stored in ec.

This function MUST only be called from tasks running on that event loop.

Returns
the value stored in the future on success, or an empty value on error.
See also
GetLoop().

Definition at line 151 of file loop_driver.hpp.

◆ Wait() [3/3]

void lely::canopen::LoopDriver::Wait ( SdoFuture< void >  f,
::std::error_code &  ec 
)

Waits for the specified future to become ready by running pending tasks on the dedicated event loop of the driver.

The error code (0 on success) is stored in ec.

This function MUST only be called from tasks running on that event loop.

Exceptions
theexception stored in the future on failure.
See also
GetLoop().

Definition at line 94 of file loop_driver.cpp.

◆ USleep() [1/2]

void lely::canopen::LoopDriver::USleep ( uint_least64_t  usec)

Runs the event loop for usec microseconds.

This function is equivalent to Wait(AsyncWait(::std::chrono::microseconds(usec))).

Definition at line 106 of file loop_driver.cpp.

◆ USleep() [2/2]

void lely::canopen::LoopDriver::USleep ( uint_least64_t  usec,
::std::error_code &  ec 
)

Runs the event loop for usec microseconds.

This function is equivalent to Wait(AsyncWait(::std::chrono::microseconds(usec)), ec).

Definition at line 113 of file loop_driver.cpp.

◆ RunRead()

template<class T >
T lely::canopen::LoopDriver::RunRead ( uint16_t  idx,
uint8_t  subidx,
const ::std::chrono::milliseconds &  timeout,
::std::error_code &  ec 
)
inline

Queues an asynchronous read (SDO upload) operation and runs the event loop until the operation is complete.

Parameters
idxthe object index.
subidxthe object sub-index.
timeoutthe 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.
ecthe error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available.
Returns
the received value.

Definition at line 240 of file loop_driver.hpp.

◆ RunWrite()

template<class T >
void lely::canopen::LoopDriver::RunWrite ( uint16_t  idx,
uint8_t  subidx,
T &&  value,
const ::std::chrono::milliseconds &  timeout,
::std::error_code &  ec 
)
inline

Queues an asynchronous write (SDO download) operation and runs the event loop until the operation is complete.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
timeoutthe 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.
ecthe error code (0 on success). ec == SdoErrc::NO_SDO if no client-SDO is available.

Definition at line 296 of file loop_driver.hpp.


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