|
Lely core libraries
1.9.2
|
The Client-SDO queue. More...
#include <sdo.hpp>
Data Structures | |
| class | DownloadRequest |
| An SDO download request. More... | |
| struct | Impl_ |
| The internal implementation of the Client-SDO queue. More... | |
| class | UploadRequest |
| An SDO upload request. More... | |
Public Types | |
| using | duration = ::std::chrono::milliseconds |
| The type used to represent an SDO timeout duration. | |
| using | DownloadSignature = void(uint16_t idx, uint8_t subidx, ::std::error_code ec) |
| The signature of the callback function invoked on completion of an SDO download request. More... | |
| template<class T > | |
| using | UploadSignature = void(uint16_t idx, uint8_t subidx, ::std::error_code ec, T value) |
| The signature of the callback function invoked on completion of an SDO upload request. 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::IsCanopenType< T >::value >::type | SubmitDownload (DownloadRequest< T > &req) |
| Queues an SDO download request. | |
| template<class T , class F , class U = typename ::std::decay<T>::type> | |
| typename ::std::enable_if< detail::IsCanopenType< typename ::std::decay< U >::type >::value >::type | SubmitDownload (uint16_t idx, uint8_t subidx, T &&value, aio::ExecutorBase &exec, F &&con, const duration &timeout) |
| Queues an SDO download request. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenType< T >::value, ::std::size_t >::type | CancelDownload (DownloadRequest< T > &req, SdoErrc ac) |
| Aborts an SDO download request. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenType< T >::value >::type | SubmitUpload (UploadRequest< T > &req) |
| Queues an SDO upload request. | |
| template<class T , class F > | |
| typename ::std::enable_if< detail::IsCanopenType< T >::value >::type | SubmitUpload (uint16_t idx, uint8_t subidx, aio::ExecutorBase &exec, F &&con, const duration &timeout) |
| Queues an SDO upload request. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenType< T >::value, ::std::size_t >::type | CancelUpload (UploadRequest< T > &req, SdoErrc ac) |
| Aborts an SDO upload request. More... | |
| ::std::size_t | Cancel (SdoErrc ac) |
| Aborts the ongoing and all pending SDO requests. More... | |
| template<class T , class U = typename ::std::decay<T>::type> | |
| typename ::std::enable_if< detail::IsCanopenType< U >::value, aio::Future<::std::error_code > >::type | AsyncDownload (aio::LoopBase &loop, aio::ExecutorBase &exec, int16_t idx, uint8_t subidx, T &&value, const duration &timeout) |
| Queues an asynchronous SDO download request and returns a future. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenType< T >::value, aio::Future<::std::tuple<::std::error_code, T > > >::type | AsyncUpload (aio::LoopBase &loop, aio::ExecutorBase &exec, int16_t idx, uint8_t subidx, const duration &timeout) |
| Queues an asynchronous SDO upload request and returns a future. More... | |
| using lely::canopen::Sdo::DownloadSignature = void(uint16_t idx, uint8_t subidx, ::std::error_code ec) |
The signature of the callback function invoked on completion of an SDO download request.
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().
| idx | the object index. |
| subidx | the object sub-index. |
| ec | the SDO abort code (0 on success). |
| using lely::canopen::Sdo::UploadSignature = void(uint16_t idx, uint8_t subidx, ::std::error_code ec, T value) |
The signature of the callback function invoked on completion of an SDO upload request.
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().
| 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. |
| 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.
| net | a pointer to a CAN network interface (from <lely/can/net.hpp>). |
| id | the node-ID of the SDO server (in the range [1..127]). |
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).
| net | a pointer to a CAN network interface (from <lely/can/net.hpp>). |
| dev | a pointer to a CANopen device (from <lely/co/dev.hpp>). |
| num | the SDO number (in the range [1..128]). |
|
explicit |
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.
| sdo | a pointer to a CANopen Client-SDO service (from <lely/co/csdo.hpp>). |
|
default |
Destructs the Client-SDO queue.
Any ongoing or pending SDO requests are terminated with abort code SdoErrc::DATA_CTL.
|
inline |
Queues an SDO download request.
This function writes a value to a sub-object in a remote object dictionary.
| idx | the object index. |
| subidx | the object sub-index. |
| value | the value to be written. |
| exec | the executor used to execute the confirmation function. |
| 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. |
|
inline |
|
inline |
Queues an SDO upload request.
This function reads the value of a sub-object in a remote object dictionary.
| idx | the object index. |
| subidx | the object sub-index. |
| exec | the executor used to execute the confirmation function. |
| 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. |
|
inline |
| std::size_t lely::canopen::Sdo::Cancel | ( | SdoErrc | ac | ) |
|
inline |
Queues an asynchronous SDO download request and returns a future.
| loop | the event loop used to create the future. |
| exec | the executor used to create the future. The executor SHOULD be based on loop. |
| 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. |
|
inline |
Queues an asynchronous SDO upload request and returns a future.
| loop | the event loop used to create the future. |
| exec | the executor used to create the future. The executor SHOULD be based on loop. |
| 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. |