Lely core libraries 2.3.4
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< is_canopen< 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< is_canopen< 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< is_canopen< 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< is_canopen< 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 WriteDcf (const uint8_t *begin, const uint8_t *end)
 Submits a series of SDO download requests to the local object dictionary. More...
 
void WriteDcf (const uint8_t *begin, const uint8_t *end, ::std::error_code &ec)
 Submits a series of SDO download requests to the local object dictionary. More...
 
void WriteDcf (const char *path)
 Submits a series of SDO download requests to the local object dictionary. More...
 
void WriteDcf (const char *path, ::std::error_code &ec)
 Submits a series of SDO download requests 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< 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< 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< 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< 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< 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< 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

__co_devdev () 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< is_canopen< 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< is_canopen< 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< is_canopen< T >::value >::type Set (uint16_t idx, uint8_t subidx, const T &value)
 Writes a CANopen value to a sub-object. More...
 
template<class T >
typename::std::enable_if< is_canopen< T >::value >::type Set (uint16_t idx, uint8_t subidx, const T &value, ::std::error_code &ec) noexcept
 Writes a CANopen 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< 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< 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< 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< 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< 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< 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...
 
void RpdoWrite (uint8_t id, uint16_t idx, uint8_t subidx)
 Invokes OnRpdoWrite() as if a value was written to an RPDO-mapped object in the local object dictionary. 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 178 of file device.cpp.

Member Function Documentation

◆ Read() [1/2]

template<class T >
typename::std::enable_if< is_canopen< 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.

Definition at line 231 of file device.cpp.

◆ Read() [2/2]

template<class T >
typename::std::enable_if< is_canopen< 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.

Definition at line 240 of file device.cpp.

◆ Write() [1/8]

template<class T >
typename::std::enable_if< is_canopen< 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 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.

Definition at line 262 of file device.cpp.

◆ Write() [2/8]

template<class T >
typename::std::enable_if< is_canopen< 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 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.

Definition at line 270 of file device.cpp.

◆ Write() [3/8]

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 448 of file device.cpp.

◆ Write() [4/8]

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 455 of file device.cpp.

◆ Write() [5/8]

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 461 of file device.cpp.

◆ Write() [6/8]

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 468 of file device.cpp.

◆ Write() [7/8]

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 496 of file device.cpp.

◆ Write() [8/8]

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 503 of file device.cpp.

◆ WriteDcf() [1/4]

void lely::canopen::Device::WriteDcf ( const uint8_t *  begin,
const uint8_t *  end 
)

Submits a series of SDO download requests to the local object dictionary.

This functions writes each entry in the specified concise DCF to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
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.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 522 of file device.cpp.

◆ WriteDcf() [2/4]

void lely::canopen::Device::WriteDcf ( const uint8_t *  begin,
const uint8_t *  end,
::std::error_code &  ec 
)

Submits a series of SDO download requests to the local object dictionary.

This functions writes each entry in the specified concise DCF to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
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.
econ error, the SDO abort code is stored in ec.

Definition at line 529 of file device.cpp.

◆ WriteDcf() [3/4]

void lely::canopen::Device::WriteDcf ( const char *  path)

Submits a series of SDO download requests to the local object dictionary.

This functions writes each entry in the specified concise DCF to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
paththe path of the concise DCF.
Exceptions
lely::canopen::SdoErroron error.

Definition at line 548 of file device.cpp.

◆ WriteDcf() [4/4]

void lely::canopen::Device::WriteDcf ( const char *  path,
::std::error_code &  ec 
)

Submits a series of SDO download requests to the local object dictionary.

This functions writes each entry in the specified concise DCF to a sub-object while honoring all access checks and executing any registered callback function.

Parameters
paththe path of the concise DCF.
econ error, the SDO abort code is stored in ec.

Definition at line 556 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 575 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 582 of file device.cpp.

◆ RpdoRead() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 591 of file device.cpp.

◆ RpdoRead() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 600 of file device.cpp.

◆ TpdoRead() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 613 of file device.cpp.

◆ TpdoRead() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 622 of file device.cpp.

◆ TpdoWrite() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 635 of file device.cpp.

◆ TpdoWrite() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 643 of file device.cpp.

◆ 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 796 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 803 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 833 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 841 of file device.cpp.

◆ Get() [1/2]

template<class T >
typename::std::enable_if< is_canopen< 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.

Definition at line 904 of file device.cpp.

◆ Get() [2/2]

template<class T >
typename::std::enable_if< is_canopen< 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.

Definition at line 913 of file device.cpp.

◆ Set() [1/8]

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

Writes a CANopen value to a sub-object.

This function writes the value 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.

Definition at line 943 of file device.cpp.

◆ Set() [2/8]

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

Writes a CANopen value to a sub-object.

This function writes the value 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.

Definition at line 951 of file device.cpp.

◆ Set() [3/8]

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 1144 of file device.cpp.

◆ Set() [4/8]

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 1151 of file device.cpp.

◆ Set() [5/8]

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 1157 of file device.cpp.

◆ Set() [6/8]

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 1164 of file device.cpp.

◆ Set() [7/8]

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 1202 of file device.cpp.

◆ Set() [8/8]

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 1209 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 1235 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 1243 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 1262 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 1269 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 1293 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 1301 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 1320 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 1327 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 1353 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 1360 of file device.cpp.

◆ RpdoGet() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1383 of file device.cpp.

◆ RpdoGet() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1392 of file device.cpp.

◆ TpdoGet() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1402 of file device.cpp.

◆ TpdoGet() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1411 of file device.cpp.

◆ TpdoSet() [1/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1421 of file device.cpp.

◆ TpdoSet() [2/2]

template<class T >
typename::std::enable_if< 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().

Definition at line 1429 of file device.cpp.

◆ 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 1579 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 1586 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 1594 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 1714 of file device.cpp.

◆ RpdoWrite()

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

Invokes OnRpdoWrite() as if a value was written to an RPDO-mapped object in the local object dictionary.

Parameters
idthe node-ID.
idxthe remote object index.
subidxthe remote object sub-index.

Definition at line 1776 of file device.cpp.


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