|
Lely core libraries
1.9.2
|
The CANopen device description. More...
#include <device.hpp>

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, 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::IsCanopenType< 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::IsCanopenType< 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::IsCanopenBasic< 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::IsCanopenBasic< 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::IsCanopenArray< 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::IsCanopenArray< 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... | |
Protected Member Functions | |
| CODev * | dev () 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 |
| Returns the type of a sub-object. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenType< 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::IsCanopenType< T >::value, T >::type | Get (uint16_t idx, uint8_t subidx, ::std::error_code &ec) const |
| Reads the value of a sub-object. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenBasic< 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::IsCanopenBasic< T >::value >::type | Set (uint16_t idx, uint8_t subidx, T value, ::std::error_code &ec) |
| Writes a CANopen basic value to a sub-object. More... | |
| template<class T > | |
| typename ::std::enable_if< detail::IsCanopenArray< 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::IsCanopenArray< T >::value >::type | Set (uint16_t idx, uint8_t subidx, const T &value, ::std::error_code &ec) |
| 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) |
| 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) |
| 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) |
| Writes an OCTET_STRING or DOMAIN value to a sub-object. More... | |
The CANopen device description.
This class manages the object dictionary and device setttings such as the network-ID and node-ID.
Definition at line 42 of file device.hpp.
| lely::canopen::Device::Device | ( | const ::std::string & | dcf_txt, |
| const ::std::string & | dcf_bin = "", |
||
| uint8_t | id = 0xff, |
||
| BasicLockable * | mutex = nullptr |
||
| ) |
Creates a new CANopen device description.
| dcf_txt | the path of the text EDS or DCF containing the device description. |
| dcf_bin | the 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. |
| id | the node-ID (in the range [1..127, 255]). If id is 255 (unconfigured), the node-ID is obtained from the DCF. |
| mutex | an (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 78 of file device.cpp.
| typename ::std::enable_if<detail::IsCanopenType<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.
| idx | the object index. |
| subidx | the object sub-index |
| lely::canopen::SdoError | on error. |
| typename ::std::enable_if<detail::IsCanopenType<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.
| idx | the object index. |
| subidx | the object sub-index |
| ec | on error, the SDO abort code is stored in ec. |
| typename ::std::enable_if<detail::IsCanopenBasic<T>::value>::type lely::canopen::Device::Write | ( | uint16_t | idx, |
| uint8_t | subidx, | ||
| T | 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| lely::canopen::SdoError | on error. |
| typename ::std::enable_if<detail::IsCanopenBasic<T>::value>::type lely::canopen::Device::Write | ( | uint16_t | idx, |
| uint8_t | subidx, | ||
| T | 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| ec | on error, the SDO abort code is stored in ec. |
| typename ::std::enable_if<detail::IsCanopenArray<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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| lely::canopen::SdoError | on error. |
| typename ::std::enable_if<detail::IsCanopenArray<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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| ec | on error, the SDO abort code is stored in ec. |
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) string to be written. |
| lely::canopen::SdoError | on error. |
Definition at line 328 of file device.cpp.
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) string to be written. |
| ec | on error, the SDO abort code is stored in ec. |
Definition at line 335 of file device.cpp.
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) UCS-2 string to be written. |
| lely::canopen::SdoError | on error. |
Definition at line 341 of file device.cpp.
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) UCS-2 string to be written. |
| ec | on error, the SDO abort code is stored in ec. |
Definition at line 348 of file device.cpp.
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| p | a pointer to the bytes to be written. |
| n | the number of bytes to write. |
| lely::canopen::SdoError | on error. |
Definition at line 365 of file device.cpp.
| 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.
| idx | the object index. |
| subidx | the object sub-index |
| p | a pointer to the bytes to be written. |
| n | the number of bytes to write. |
| ec | on error, the SDO abort code is stored in ec. |
Definition at line 372 of file device.cpp.
|
protected |
Returns the type of a sub-object.
| idx | the object index. |
| subidx | the object sub-index |
std::type_info object representing the type, or typeid(void) if unknown.| lely::canopen::SdoError | if the sub-object does not exist. |
Definition at line 392 of file device.cpp.
|
protected |
Returns the type of a sub-object.
| idx | the object index. |
| subidx | the object sub-index |
| ec | if the sub-object does not exist, the SDO abort code is stored in ec. |
std::type_info object representing the type, or typeid(void) if unknown. Definition at line 400 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | the value to be written. |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) string to be written. |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
Definition at line 664 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) string to be written. |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
Definition at line 671 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) UCS-2 string to be written. |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
Definition at line 677 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| value | a pointer to the (null-terminated) UCS-2 string to be written. |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
Definition at line 684 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| p | a pointer to the bytes to be written. |
| n | the number of bytes to write. |
| lely::canopen::SdoError | if the sub-object does not exist or the type does not match. |
Definition at line 690 of file device.cpp.
|
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.
| idx | the object index. |
| subidx | the object sub-index |
| p | a pointer to the bytes to be written. |
| n | the number of bytes to write. |
| ec | if the sub-object does not exist or the type does not match, the SDO abort code is stored in ec. |
Definition at line 697 of file device.cpp.