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

The CANopen device description. More...

#include <device.hpp>

Inheritance diagram for lely::canopen::Device:

Data Structures

struct  Impl_
 The internal implementation of the CANopen device description. More...
 

Public Member Functions

 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< detail::is_canopen_type< 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< detail::is_canopen_type< 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< detail::is_canopen_basic< T >::value >::type Write (uint16_t idx, uint8_t subidx, T value)
 Submits an SDO download request to the local object dictionary. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_basic< T >::value >::type Write (uint16_t idx, uint8_t subidx, T value, ::std::error_code &ec)
 Submits an SDO download request to the local object dictionary. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_array< 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< detail::is_canopen_array< 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 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< detail::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< detail::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< detail::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< detail::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< detail::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< detail::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...
 

Protected Member Functions

CODevdev () 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< detail::is_canopen_type< 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< detail::is_canopen_type< 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< detail::is_canopen_basic< T >::value >::type Set (uint16_t idx, uint8_t subidx, T value)
 Writes a CANopen basic value to a sub-object. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_basic< T >::value >::type Set (uint16_t idx, uint8_t subidx, T value, ::std::error_code &ec) noexcept
 Writes a CANopen basic value to a sub-object. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_array< T >::value >::type Set (uint16_t idx, uint8_t subidx, const T &value)
 Writes a CANopen array value to a sub-object. More...
 
template<class T >
typename ::std::enable_if< detail::is_canopen_array< T >::value >::type Set (uint16_t idx, uint8_t subidx, const T &value, ::std::error_code &ec) noexcept
 Writes a CANopen array 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< detail::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< detail::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< detail::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< detail::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< detail::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< detail::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...
 

Detailed Description

The CANopen device description.

This class manages the object dictionary and device setttings such as the network-ID and node-ID.

Definition at line 45 of file device.hpp.

Constructor & Destructor Documentation

◆ Device()

lely::canopen::Device::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.

Parameters
dcf_txtthe path of the text EDS or DCF containing the device description.
dcf_binthe 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.
idthe node-ID (in the range [1..127, 255]). If id is 255 (unconfigured), the node-ID is obtained from the DCF.
mutexan (optional) pointer to the mutex to be locked while the internal device description is accessed. The mutex MUST be unlocked when any member function is invoked.

Definition at line 147 of file device.cpp.

Member Function Documentation

◆ Read() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type lely::canopen::Device::Read ( uint16_t  idx,
uint8_t  subidx 
) const

Submits an SDO upload request to the local object dictionary.

This function reads the value of a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
Returns
the result of the SDO request.
Exceptions
lely::canopen::SdoErroron error.

◆ Read() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type lely::canopen::Device::Read ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const

Submits an SDO upload request to the local object dictionary.

This function reads the value of a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
econ error, the SDO abort code is stored in ec.
Returns
the result of the SDO request, or an empty value on error.

◆ Write() [1/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
value 
)

Submits an SDO download request to the local object dictionary.

This function writes a CANopen basic value to a sub-object while honoring all access and range checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErroron error.

◆ Write() [2/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
value,
::std::error_code &  ec 
)

Submits an SDO download request to the local object dictionary.

This function writes a CANopen basic value to a sub-object while honoring all access and range checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
econ error, the SDO abort code is stored in ec.

◆ Write() [3/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_array<T>::value>::type lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const T &  value 
)

Submits an SDO download request to the local object dictionary.

This function writes a CANopen array value to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErroron error.

◆ Write() [4/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_array<T>::value>::type lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const T &  value,
::std::error_code &  ec 
)

Submits an SDO download request to the local object dictionary.

This function writes a CANopen array value to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
econ error, the SDO abort code is stored in ec.

◆ Write() [5/10]

void lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const char *  value 
)

Submits an SDO download request to the local object dictionary.

This function writes a VISIBLE_STRING to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) string to be written.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 407 of file device.cpp.

◆ Write() [6/10]

void lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const char *  value,
::std::error_code &  ec 
)

Submits an SDO download request to the local object dictionary.

This function writes a VISIBLE_STRING to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) string to be written.
econ error, the SDO abort code is stored in ec.

Definition at line 414 of file device.cpp.

◆ Write() [7/10]

void lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const char16_t *  value 
)

Submits an SDO download request to the local object dictionary.

This function writes a UNICODE_STRING to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) UCS-2 string to be written.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 420 of file device.cpp.

◆ Write() [8/10]

void lely::canopen::Device::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.

This function writes a UNICODE_STRING to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) UCS-2 string to be written.
econ error, the SDO abort code is stored in ec.

Definition at line 427 of file device.cpp.

◆ Write() [9/10]

void lely::canopen::Device::Write ( uint16_t  idx,
uint8_t  subidx,
const void *  p,
::std::size_t  n 
)

Submits an SDO download request to the local object dictionary.

This function writes an OCTET_STRING or DOMAIN value to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
pa pointer to the bytes to be written.
nthe number of bytes to write.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 448 of file device.cpp.

◆ Write() [10/10]

void lely::canopen::Device::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.

This function writes an OCTET_STRING or DOMAIN value to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
idxthe object index.
subidxthe object sub-index.
pa pointer to the bytes to be written.
nthe number of bytes to write.
econ error, the SDO abort code is stored in ec.

Definition at line 455 of file device.cpp.

◆ WriteEvent() [1/2]

void lely::canopen::Device::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.

Parameters
idxthe object index.
subidxthe object sub-index.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.

Definition at line 474 of file device.cpp.

◆ WriteEvent() [2/2]

void lely::canopen::Device::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.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.

Definition at line 481 of file device.cpp.

◆ RpdoRead() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Returns
the result of the SDO request.
Exceptions
lely::canopen::SdoErroron error.
Precondition
a valid mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects has been generated with UpdateRpdoMapping().

◆ RpdoRead() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
econ error, the SDO abort code is stored in ec.
Returns
the result of the SDO request, or an empty value on error.
Precondition
a valid mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects has been generated with UpdateRpdoMapping().

◆ TpdoRead() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Returns
the result of the SDO request.
Exceptions
lely::canopen::SdoErroron error.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoRead() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
econ error, the SDO abort code is stored in ec.
Returns
the result of the SDO request, or an empty value on error.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoWrite() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::TpdoWrite ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErroron error.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoWrite() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::TpdoWrite ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
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.

This function honors all access checks of the local object dictionary and executes any registered callback function.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
valuethe value to be written.
econ error, the SDO abort code is stored in ec.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoWriteEvent() [1/2]

void lely::canopen::Device::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.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

Definition at line 695 of file device.cpp.

◆ TpdoWriteEvent() [2/2]

void lely::canopen::Device::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.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

Definition at line 702 of file device.cpp.

◆ Type() [1/2]

const ::std::type_info & lely::canopen::Device::Type ( uint16_t  idx,
uint8_t  subidx 
) const
protected

Returns the type of a sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
Returns
a reference to an std::type_info object representing the type, or typeid(void) if unknown.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.

Definition at line 728 of file device.cpp.

◆ Type() [2/2]

const ::std::type_info & lely::canopen::Device::Type ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

Returns the type of a sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.
Returns
a reference to an std::type_info object representing the type, or typeid(void) if unknown.

Definition at line 736 of file device.cpp.

◆ Get() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type lely::canopen::Device::Get ( uint16_t  idx,
uint8_t  subidx 
) const
protected

Reads the value of a sub-object.

This function reads the value directly from the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
Returns
a copy of the value of the sub-object.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

◆ Get() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type lely::canopen::Device::Get ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

Reads the value of a sub-object.

This function reads the value directly from the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.
Returns
a copy of the value of the sub-object, or an empty value on error.

◆ Set() [1/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
value 
)
protected

Writes a CANopen basic value to a sub-object.

This function writes the value directly to the object dictionary and bypasses any access and range checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

◆ Set() [2/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
value,
::std::error_code &  ec 
)
protectednoexcept

Writes a CANopen basic value to a sub-object.

This function writes the value directly to the object dictionary and bypasses any access and range checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.

◆ Set() [3/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_array<T>::value>::type lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const T &  value 
)
protected

Writes a CANopen array value to a sub-object.

This function writes the array directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

◆ Set() [4/10]

template<class T >
typename ::std::enable_if<detail::is_canopen_array<T>::value>::type lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const T &  value,
::std::error_code &  ec 
)
protectednoexcept

Writes a CANopen array value to a sub-object.

This function writes the array directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuethe value to be written.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.

◆ Set() [5/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const char *  value 
)
protected

Writes a VISIBLE_STRING to a sub-object.

This function writes the string directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) string to be written.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

Definition at line 1008 of file device.cpp.

◆ Set() [6/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const char *  value,
::std::error_code &  ec 
)
protectednoexcept

Writes a VISIBLE_STRING to a sub-object.

This function writes the string directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) string to be written.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.

Definition at line 1015 of file device.cpp.

◆ Set() [7/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const char16_t *  value 
)
protected

Writes a UNICODE_STRING to a sub-object.

This function writes the string directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) UCS-2 string to be written.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

Definition at line 1021 of file device.cpp.

◆ Set() [8/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const char16_t *  value,
::std::error_code &  ec 
)
protectednoexcept

Writes a UNICODE_STRING to a sub-object.

This function writes the string directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
valuea pointer to the (null-terminated) UCS-2 string to be written.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.

Definition at line 1028 of file device.cpp.

◆ Set() [9/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const void *  p,
::std::size_t  n 
)
protected

Writes an OCTET_STRING or DOMAIN value to a sub-object.

This function writes the bytes directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
pa pointer to the bytes to be written.
nthe number of bytes to write.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.

Definition at line 1034 of file device.cpp.

◆ Set() [10/10]

void lely::canopen::Device::Set ( uint16_t  idx,
uint8_t  subidx,
const void *  p,
::std::size_t  n,
::std::error_code &  ec 
)
protectednoexcept

Writes an OCTET_STRING or DOMAIN value to a sub-object.

This function writes the bytes directly to the object dictionary and bypasses any access checks or registered callback functions.

Parameters
idxthe object index.
subidxthe object sub-index.
pa pointer to the bytes to be written.
nthe number of bytes to write.
ecif the sub-object does not exist or the type does not match, the SDO abort code is stored in ec.

Definition at line 1041 of file device.cpp.

◆ GetUploadFile() [1/2]

const char * lely::canopen::Device::GetUploadFile ( uint16_t  idx,
uint8_t  subidx 
) const
protected

Returns the value of the UploadFile attribute of a sub-object, if present.

The returned value is valid until the next call to SetUploadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
Returns
a pointer to the UploadFile string, or nullptr if the UploadFile attribute does not exist.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.

Definition at line 1047 of file device.cpp.

◆ GetUploadFile() [2/2]

const char * lely::canopen::Device::GetUploadFile ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

Returns the value of the UploadFile attribute of a sub-object, if present.

The returned value is valid until the next call to SetUploadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.
Returns
a pointer to the UploadFile string, or nullptr on error or if the UploadFile attribute does not exist.

Definition at line 1055 of file device.cpp.

◆ SetUploadFile() [1/2]

void lely::canopen::Device::SetUploadFile ( uint16_t  idx,
uint8_t  subidx,
const char *  filename 
)
protected

Sets the value of the UploadFile attribute of a sub-object, if present.

This operation invalidates any value returned by a previous call to GetUploadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
filenamea pointer to the string to be copied to the UploadFile attribute.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or does not have the UploadFile attribute.

Definition at line 1074 of file device.cpp.

◆ SetUploadFile() [2/2]

void lely::canopen::Device::SetUploadFile ( uint16_t  idx,
uint8_t  subidx,
const char *  filename,
::std::error_code &  ec 
)
protectednoexcept

Sets the value of the UploadFile attribute of a sub-object, if present.

This operation invalidates any value returned by a previous call to GetUploadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
filenamea pointer to the string to be copied to the UploadFile attribute.
ecif the sub-object does not exist or does not have the UploadFile attribute, the SDO abort code is stored in ec.

Definition at line 1081 of file device.cpp.

◆ GetDownloadFile() [1/2]

const char * lely::canopen::Device::GetDownloadFile ( uint16_t  idx,
uint8_t  subidx 
) const
protected

Returns the value of the DownloadFile attribute of a sub-object, if present.

The returned value is valid until the next call to SetDownloadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
Returns
a pointer to the DownloadFile string, or nullptr if the DownloadFile attribute does not exist.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.

Definition at line 1105 of file device.cpp.

◆ GetDownloadFile() [2/2]

const char * lely::canopen::Device::GetDownloadFile ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

Returns the value of the DownloadFile attribute of a sub-object, if present.

The returned value is valid until the next call to SetDownloadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.
Returns
a pointer to the DownloadFile string, or nullptr on error or if the DownloadFile attribute does not exist.

Definition at line 1113 of file device.cpp.

◆ SetDownloadFile() [1/2]

void lely::canopen::Device::SetDownloadFile ( uint16_t  idx,
uint8_t  subidx,
const char *  filename 
)
protected

Sets the value of the DownloadFile attribute of a sub-object, if present.

This operation invalidates any value returned by a previous call to GetDownloadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
filenamea pointer to the string to be copied to the DownloadFile attribute.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or does not have the DownloadFile attribute.

Definition at line 1132 of file device.cpp.

◆ SetDownloadFile() [2/2]

void lely::canopen::Device::SetDownloadFile ( uint16_t  idx,
uint8_t  subidx,
const char *  filename,
::std::error_code &  ec 
)
protectednoexcept

Sets the value of the DownloadFile attribute of a sub-object, if present.

This operation invalidates any value returned by a previous call to GetDownloadFile() for the same sub-object.

Parameters
idxthe object index.
subidxthe object sub-index.
filenamea pointer to the string to be copied to the DownloadFile attribute.
ecif the sub-object does not exist or does not have the DownloadFile attribute, the SDO abort code is stored in ec.

Definition at line 1139 of file device.cpp.

◆ SetEvent() [1/2]

void lely::canopen::Device::SetEvent ( uint16_t  idx,
uint8_t  subidx 
)
protected

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.

Parameters
idxthe object index.
subidxthe object sub-index.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist.

Definition at line 1163 of file device.cpp.

◆ SetEvent() [2/2]

void lely::canopen::Device::SetEvent ( uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
)
protectednoexcept

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.

Parameters
idxthe object index.
subidxthe object sub-index.
ecif the sub-object does not exist, the SDO abort code is stored in ec.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 1170 of file device.cpp.

◆ RpdoGet() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::RpdoGet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx 
) const
protected

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.

This function reads the value directly from the local object dictionary and bypasses any access checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Returns
a copy of the value of the PDO-mapped sub-object.
Exceptions
lely::canopen::SdoErrorif the PDO-mapped sub-object does not exist or the type does not match.
Precondition
a valid mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects has been generated with UpdateRpdoMapping().

◆ RpdoGet() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::RpdoGet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

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.

This function reads the value directly from the local object dictionary and bypasses any access checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
ecif the PDO-mapped sub-object does not exist or the type does not match, the SDO abort code is stored in ec.
Returns
a copy of the value of the PDO-mapped sub-object, or an empty value on error.
Precondition
a valid mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects has been generated with UpdateRpdoMapping().

◆ TpdoGet() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::TpdoGet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx 
) const
protected

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.

This function reads the value directly from the local object dictionary and bypasses any access checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Returns
a copy of the value of the PDO-mapped sub-object.
Exceptions
lely::canopen::SdoErrorif the PDO-mapped sub-object does not exist or the type does not match.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoGet() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type lely::canopen::Device::TpdoGet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
) const
protectednoexcept

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.

This function reads the value directly from the local object dictionary and bypasses any access checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
ecif the PDO-mapped sub-object does not exist or the type does not match, the SDO abort code is stored in ec.
Returns
a copy of the value of the PDO-mapped sub-object, or an empty value on error.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoSet() [1/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::TpdoSet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
value 
)
protected

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.

This function writes the value directly to the local object dictionary and bypasses any access and range checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
valuethe value to be written.
Exceptions
lely::canopen::SdoErrorif the PDO-mapped sub-object does not exist or the type does not match.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoSet() [2/2]

template<class T >
typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type lely::canopen::Device::TpdoSet ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
value,
::std::error_code &  ec 
)
protectednoexcept

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.

This function writes the value directly to the local object dictionary and bypasses any access and range checks or registered callback functions.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
valuethe value to be written.
ecif the PDO-mapped sub-object does not exist or the type does not match, the SDO abort code is stored in ec.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

◆ TpdoSetEvent() [1/2]

void lely::canopen::Device::TpdoSetEvent ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx 
)
protected

Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
Exceptions
lely::canopen::SdoErrorif the PDO-mapped sub-object does not exist.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

Definition at line 1384 of file device.cpp.

◆ TpdoSetEvent() [2/2]

void lely::canopen::Device::TpdoSetEvent ( uint8_t  id,
uint16_t  idx,
uint8_t  subidx,
::std::error_code &  ec 
)
protectednoexcept

Triggers the transmission of every event-driven, asynchronous Transmit-PDO which is mapped into the specified sub-object in a remote object dictionary.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.
ecif the PDO-mapped sub-object does not exist, the SDO abort code is stored in ec.
Precondition
a valid mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects has been generated with UpdateTpdoMapping().

Definition at line 1391 of file device.cpp.

◆ UpdateRpdoMapping()

void lely::canopen::Device::UpdateRpdoMapping ( )
protected

Updates the mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects.

The mapping is constructed from the RPDO communication and mapping parameters, and the Lely-specific objects 5800..59FF (Remote TPDO number and node-ID) and 5A00..5BFF (Remote TPDO mapping).

Definition at line 1399 of file device.cpp.

◆ UpdateTpdoMapping()

void lely::canopen::Device::UpdateTpdoMapping ( )
protected

Updates the mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects.

The mapping is constructed from the TPDO communication and mapping parameters, and the Lely-specific objects 5C00..5DFF (Remote RPDO number and node-ID) and 5E00..5FFF (Remote RPDO mapping).

Definition at line 1458 of file device.cpp.


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