Lely core libraries  2.2.5
lely::canopen::Sdo Class Reference

A Client-SDO queue. More...

#include <sdo.hpp>

Data Structures

struct  Impl_
 The internal implementation of the Client-SDO queue. More...
 

Public Member Functions

 Sdo ()
 Default-constructs an invalid Client-SDO queue.
 
 Sdo (CANNet *net, uint8_t id)
 Constructs a Client-SDO queue for a Client-SDO from the predefined connection set (the default SDO). More...
 
 Sdo (CANNet *net, CODev *dev, uint8_t num)
 Constructs a Client-SDO queue for a pre-configured Client-SDO. More...
 
 Sdo (COCSDO *sdo)
 Constructs a Client-SDO queue from an existing Client-SDO service. More...
 
 ~Sdo ()
 Destructs the Client-SDO queue. More...
 
 operator bool () const noexcept
 Checks whether *this is a valid Client-SDO queue.
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value >::type SubmitDownload (SdoDownloadRequest< T > &req)
 Queues an SDO download request.
 
template<class T , class F , class U = typename ::std::decay<T>::type>
typename ::std::enable_if< detail::is_canopen_type< U >::value >::type SubmitDownload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, T &&value, F &&con, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO download request. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value, bool >::type CancelDownload (SdoDownloadRequest< T > &req, SdoErrc ac)
 Cancels an SDO download request. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value, bool >::type AbortDownload (SdoDownloadRequest< T > &req)
 Aborts an SDO download request. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value >::type SubmitUpload (SdoUploadRequest< T > &req)
 Queues an SDO upload request.
 
template<class T , class F >
typename ::std::enable_if< detail::is_canopen_type< T >::value >::type SubmitUpload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, F &&con, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO upload request. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value, bool >::type CancelUpload (SdoUploadRequest< T > &req, SdoErrc ac)
 Cancels an SDO upload request. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value, bool >::type AbortUpload (SdoUploadRequest< T > &req)
 Aborts an SDO upload request. More...
 
template<class T , class U = typename ::std::decay<T>::type>
typename ::std::enable_if< detail::is_canopen_type< U >::value, SdoFuture< void > >::type AsyncDownload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, T &&value, const ::std::chrono::milliseconds &timeout={})
 Queues an asynchronous SDO download request and creates a future which becomes ready once the request completes (or is canceled). More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_type< T >::value, SdoFuture< T > >::type AsyncUpload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds &timeout={})
 Queues an asynchronous SDO upload request and creates a future which becomes ready once the request completes (or is canceled). More...
 
void Submit (detail::SdoRequestBase &req)
 Queues an LSS request.
 
bool Cancel (detail::SdoRequestBase &req, SdoErrc ac)
 Cancels a pending SDO request. More...
 
::std::size_t CancelAll (SdoErrc ac)
 Cancels all pending SDO requests and stops the ongoing request, if any. More...
 
bool Abort (detail::SdoRequestBase &req)
 Aborts a pending SDO request. More...
 
::std::size_t AbortAll ()
 Aborts all pending SDO requests. More...
 

Detailed Description

A Client-SDO queue.

Definition at line 407 of file sdo.hpp.

Constructor & Destructor Documentation

◆ Sdo() [1/3]

lely::canopen::Sdo::Sdo ( CANNet net,
uint8_t  id 
)

Constructs a Client-SDO queue for a Client-SDO from the predefined connection set (the default SDO).

In general, only a CANopen master is allowed to use the default SDO.

Parameters
neta pointer to a CAN network interface (from <lely/can/net.hpp>).
idthe node-ID of the SDO server (in the range [1..127]).

Definition at line 290 of file sdo.cpp.

◆ Sdo() [2/3]

lely::canopen::Sdo::Sdo ( CANNet net,
CODev dev,
uint8_t  num 
)

Constructs a Client-SDO queue for a pre-configured Client-SDO.

The SDO client parameter record MUST exist in the object dictionary (object 1280 to 12FF).

Parameters
neta pointer to a CAN network interface (from <lely/can/net.hpp>).
deva pointer to a CANopen device (from <lely/co/dev.hpp>).
numthe SDO number (in the range [1..128]).

Definition at line 292 of file sdo.cpp.

◆ Sdo() [3/3]

lely::canopen::Sdo::Sdo ( COCSDO sdo)

Constructs a Client-SDO queue from an existing Client-SDO service.

It is the responsibility of the caller to ensure that the SDO service remains available during the lifetime of the queue.

Parameters
sdoa pointer to a CANopen Client-SDO service (from <lely/co/csdo.hpp>).

Definition at line 295 of file sdo.cpp.

◆ ~Sdo()

lely::canopen::Sdo::~Sdo ( )
default

Destructs the Client-SDO queue.

Any ongoing or pending SDO requests are terminated with abort code SdoErrc::DATA_CTL.

Member Function Documentation

◆ SubmitDownload()

template<class T , class F , class U = typename ::std::decay<T>::type>
typename ::std::enable_if<detail::is_canopen_type<U>::value>::type lely::canopen::Sdo::SubmitDownload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
T &&  value,
F &&  con,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an SDO download request.

This function writes a value to a sub-object in a remote object dictionary.

Parameters
execthe executor used to execute the completion task.
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
conthe confirmation function to be called on completion of the SDO request.
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.

Definition at line 494 of file sdo.hpp.

◆ CancelDownload()

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, bool>::type lely::canopen::Sdo::CancelDownload ( SdoDownloadRequest< T > &  req,
SdoErrc  ac 
)
inline

Cancels an SDO download request.

See also
Cancel()

Definition at line 504 of file sdo.hpp.

◆ AbortDownload()

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, bool>::type lely::canopen::Sdo::AbortDownload ( SdoDownloadRequest< T > &  req)
inline

Aborts an SDO download request.

See also
Abort()

Definition at line 511 of file sdo.hpp.

◆ SubmitUpload()

template<class T , class F >
typename ::std::enable_if<detail::is_canopen_type<T>::value>::type lely::canopen::Sdo::SubmitUpload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
F &&  con,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an SDO upload request.

This function reads the value of a sub-object in a remote object dictionary.

Parameters
execthe executor used to execute the completion task.
idxthe object index.
subidxthe object sub-index.
conthe confirmation function to be called on completion of the SDO request.
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.

Definition at line 538 of file sdo.hpp.

◆ CancelUpload()

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, bool>::type lely::canopen::Sdo::CancelUpload ( SdoUploadRequest< T > &  req,
SdoErrc  ac 
)
inline

Cancels an SDO upload request.

See also
Cancel()

Definition at line 547 of file sdo.hpp.

◆ AbortUpload()

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, bool>::type lely::canopen::Sdo::AbortUpload ( SdoUploadRequest< T > &  req)
inline

Aborts an SDO upload request.

See also
Abort()

Definition at line 554 of file sdo.hpp.

◆ AsyncDownload()

template<class T , class U = typename ::std::decay<T>::type>
typename ::std::enable_if<detail::is_canopen_type<U>::value, SdoFuture<void> >::type lely::canopen::Sdo::AsyncDownload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
T &&  value,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an asynchronous SDO download request and creates a future which becomes ready once the request completes (or is canceled).

Parameters
execthe executor used to execute the completion task.
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.
Returns
a future which holds the SDO abort code on failure.

Definition at line 576 of file sdo.hpp.

◆ AsyncUpload()

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, SdoFuture<T> >::type lely::canopen::Sdo::AsyncUpload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an asynchronous SDO upload request and creates a future which becomes ready once the request completes (or is canceled).

Parameters
execthe executor used to execute the completion task.
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.
Returns
a future which holds the received value on success and the SDO abort code on failure.

Definition at line 611 of file sdo.hpp.

◆ Cancel()

bool lely::canopen::Sdo::Cancel ( detail::SdoRequestBase req,
SdoErrc  ac 
)

Cancels a pending SDO request.

Parameters
reqthe request to be aborted.
acthe SDO abort code.
Returns
true if the request was canceled, and false if it is ongoing or already completed.

Definition at line 307 of file sdo.cpp.

◆ CancelAll()

std::size_t lely::canopen::Sdo::CancelAll ( SdoErrc  ac)

Cancels all pending SDO requests and stops the ongoing request, if any.

Parameters
acthe SDO abort code.
Returns
the number of canceled requests.

Definition at line 312 of file sdo.cpp.

◆ Abort()

bool lely::canopen::Sdo::Abort ( detail::SdoRequestBase req)

Aborts a pending SDO request.

The completion task is not submitted for execution.

Returns
true if the request was aborted, and false if it is ongoing or already completed.

Definition at line 317 of file sdo.cpp.

◆ AbortAll()

std::size_t lely::canopen::Sdo::AbortAll ( )

Aborts all pending SDO requests.

The completion tasks of aborted requests are not submitted for execution.

Returns
the number of aborted requests.

Definition at line 322 of file sdo.cpp.


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