Lely core libraries  2.3.4
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 (__can_net *net, uint8_t id)
 Constructs a Client-SDO queue for a Client-SDO from the predefined connection set (the default SDO). More...
 
 Sdo (__can_net *net, __co_dev *dev, uint8_t num)
 Constructs a Client-SDO queue for a pre-configured Client-SDO. More...
 
 Sdo (__co_csdo *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< is_canopen< 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< is_canopen< U >::value >::type SubmitDownload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, T &&value, F &&con, bool block=false, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO download request. More...
 
template<class T >
typename ::std::enable_if< is_canopen< T >::value, bool >::type CancelDownload (SdoDownloadRequest< T > &req, SdoErrc ac)
 Cancels an SDO download request. More...
 
template<class T >
typename ::std::enable_if< is_canopen< T >::value, bool >::type AbortDownload (SdoDownloadRequest< T > &req)
 Aborts an SDO download request. More...
 
void SubmitDownloadDcf (SdoDownloadDcfRequest &req)
 Queues an SDO download DCF request.
 
template<class F >
void SubmitDownloadDcf (ev_exec_t *exec, const uint8_t *begin, const uint8_t *end, F &&con, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO download DCF request. More...
 
template<class F >
void SubmitDownloadDcf (ev_exec_t *exec, const char *path, F &&con, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO download DCF request. More...
 
bool CancelDownloadDcf (SdoDownloadDcfRequest &req, SdoErrc ac)
 Cancels an SDO download request. More...
 
bool AbortDownloadDcf (SdoDownloadDcfRequest &req)
 Aborts an SDO download DCF request. More...
 
template<class T >
typename ::std::enable_if< is_canopen< T >::value >::type SubmitUpload (SdoUploadRequest< T > &req)
 Queues an SDO upload request.
 
template<class T , class F >
typename ::std::enable_if< is_canopen< T >::value >::type SubmitUpload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, F &&con, bool block=false, const ::std::chrono::milliseconds &timeout={})
 Queues an SDO upload request. More...
 
template<class T >
typename ::std::enable_if< is_canopen< T >::value, bool >::type CancelUpload (SdoUploadRequest< T > &req, SdoErrc ac)
 Cancels an SDO upload request. More...
 
template<class T >
typename ::std::enable_if< is_canopen< 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< is_canopen< U >::value, SdoFuture< void > >::type AsyncDownload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, T &&value, bool block=false, 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...
 
SdoFuture< void > AsyncDownloadDcf (ev_exec_t *exec, const uint8_t *begin, const uint8_t *end, const ::std::chrono::milliseconds &timeout={})
 Queues a series asynchronous SDO download requests, 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 > AsyncDownloadDcf (ev_exec_t *exec, const char *path, const ::std::chrono::milliseconds &timeout={})
 Queues a series asynchronous SDO download requests, 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...
 
template<class T >
typename ::std::enable_if< is_canopen< T >::value, SdoFuture< T > >::type AsyncUpload (ev_exec_t *exec, uint16_t idx, uint8_t subidx, bool block=false, 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 588 of file sdo.hpp.

Constructor & Destructor Documentation

◆ Sdo() [1/3]

lely::canopen::Sdo::Sdo ( __can_net 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 370 of file sdo.cpp.

◆ Sdo() [2/3]

lely::canopen::Sdo::Sdo ( __can_net net,
__co_dev 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.h>).
deva pointer to a CANopen device (from <lely/co/dev.h>).
numthe SDO number (in the range [1..128]).

Definition at line 372 of file sdo.cpp.

◆ Sdo() [3/3]

lely::canopen::Sdo::Sdo ( __co_csdo 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.h>).

Definition at line 375 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<is_canopen<U>::value>::type lely::canopen::Sdo::SubmitDownload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
T &&  value,
F &&  con,
bool  block = false,
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.
blocka flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO.
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 681 of file sdo.hpp.

◆ CancelDownload()

template<class T >
typename ::std::enable_if<is_canopen<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 692 of file sdo.hpp.

◆ AbortDownload()

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

Aborts an SDO download request.

See also
Abort()

Definition at line 699 of file sdo.hpp.

◆ SubmitDownloadDcf() [1/2]

template<class F >
void lely::canopen::Sdo::SubmitDownloadDcf ( ev_exec_t exec,
const uint8_t *  begin,
const uint8_t *  end,
F &&  con,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an SDO download DCF request.

This function writes each entry in the specified concise DCF to a sub-object in a remote object dictionary.

Parameters
execthe executor used to execute the completion task.
begina pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0).
enda pointer to one past the last byte in the concise DCF. At most end - begin bytes are read.
conthe confirmation function to be called when all SDO download requests are successfully completed, or when an error occurs.
timeoutthe 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 728 of file sdo.hpp.

◆ SubmitDownloadDcf() [2/2]

template<class F >
void lely::canopen::Sdo::SubmitDownloadDcf ( ev_exec_t exec,
const char *  path,
F &&  con,
const ::std::chrono::milliseconds &  timeout = {} 
)
inline

Queues an SDO download DCF request.

This function writes each entry in the specified concise DCF to a sub-object in a remote object dictionary.

Parameters
execthe executor used to execute the completion task.
paththe path of the concise DCF.
conthe confirmation function to be called when all SDO download requests are successfully completed, or when an error occurs.
timeoutthe 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 750 of file sdo.hpp.

◆ CancelDownloadDcf()

bool lely::canopen::Sdo::CancelDownloadDcf ( SdoDownloadDcfRequest req,
SdoErrc  ac 
)
inline

Cancels an SDO download request.

See also
Cancel()

Definition at line 758 of file sdo.hpp.

◆ AbortDownloadDcf()

bool lely::canopen::Sdo::AbortDownloadDcf ( SdoDownloadDcfRequest req)
inline

Aborts an SDO download DCF request.

See also
Abort()

Definition at line 764 of file sdo.hpp.

◆ SubmitUpload()

template<class T , class F >
typename ::std::enable_if<is_canopen<T>::value>::type lely::canopen::Sdo::SubmitUpload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
F &&  con,
bool  block = false,
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.
blocka flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO.
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 793 of file sdo.hpp.

◆ CancelUpload()

template<class T >
typename ::std::enable_if<is_canopen<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 803 of file sdo.hpp.

◆ AbortUpload()

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

Aborts an SDO upload request.

See also
Abort()

Definition at line 810 of file sdo.hpp.

◆ AsyncDownload()

template<class T , class U = typename ::std::decay<T>::type>
typename ::std::enable_if<is_canopen<U>::value, SdoFuture<void> >::type lely::canopen::Sdo::AsyncDownload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
T &&  value,
bool  block = false,
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.
blocka flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO.
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 833 of file sdo.hpp.

◆ AsyncDownloadDcf() [1/2]

SdoFuture< void > lely::canopen::Sdo::AsyncDownloadDcf ( ev_exec_t exec,
const uint8_t *  begin,
const uint8_t *  end,
const ::std::chrono::milliseconds &  timeout = {} 
)

Queues a series asynchronous SDO download requests, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs).

Parameters
execthe executor used to execute the completion task.
begina pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0).
enda pointer to one past the last byte in the concise DCF. At most end - begin bytes are read.
timeoutthe 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.
Returns
a future which holds the SDO abort code on failure.

Definition at line 389 of file sdo.cpp.

◆ AsyncDownloadDcf() [2/2]

SdoFuture< void > lely::canopen::Sdo::AsyncDownloadDcf ( ev_exec_t exec,
const char *  path,
const ::std::chrono::milliseconds &  timeout = {} 
)

Queues a series asynchronous SDO download requests, corresponding to the entries in the specified concise DCF, and creates a future which becomes ready once all requests complete (or an error occurs).

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

Definition at line 407 of file sdo.cpp.

◆ AsyncUpload()

template<class T >
typename ::std::enable_if<is_canopen<T>::value, SdoFuture<T> >::type lely::canopen::Sdo::AsyncUpload ( ev_exec_t exec,
uint16_t  idx,
uint8_t  subidx,
bool  block = false,
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.
blocka flag specifying whether the request should use a block SDO instead of a segmented (or expedited) SDO.
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 909 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 430 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 435 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 440 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 445 of file sdo.cpp.


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