22 #ifndef LELY_COAPP_DEVICE_HPP_ 23 #define LELY_COAPP_DEVICE_HPP_ 61 Device(const ::std::string& dcf_txt, const ::std::string& dcf_bin =
"",
68 uint8_t
netid()
const noexcept;
71 uint8_t
id()
const noexcept;
86 typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type
Read(
87 uint16_t idx, uint8_t subidx)
const;
101 typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type
Read(
102 uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const;
116 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
Write(
117 uint16_t idx, uint8_t subidx, T value);
130 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
Write(
131 uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec);
145 typename ::std::enable_if<detail::is_canopen_array<T>::value>::type
Write(
146 uint16_t idx, uint8_t subidx,
const T& value);
159 typename ::std::enable_if<detail::is_canopen_array<T>::value>::type
Write(
160 uint16_t idx, uint8_t subidx,
const T& value, ::std::error_code& ec);
173 void Write(uint16_t idx, uint8_t subidx,
const char* value);
185 void Write(uint16_t idx, uint8_t subidx,
const char* value,
186 ::std::error_code& ec);
200 void Write(uint16_t idx, uint8_t subidx,
const char16_t* value);
213 void Write(uint16_t idx, uint8_t subidx,
const char16_t* value,
214 ::std::error_code& ec);
228 void Write(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n);
241 void Write(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n,
242 ::std::error_code& ec);
255 void WriteEvent(uint16_t idx, uint8_t subidx);
268 void WriteEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec) noexcept;
288 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
289 RpdoRead(uint8_t
id, uint16_t idx, uint8_t subidx)
const;
308 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
309 RpdoRead(uint8_t
id, uint16_t idx, uint8_t subidx,
310 ::std::error_code& ec)
const;
331 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
332 TpdoRead(uint8_t
id, uint16_t idx, uint8_t subidx)
const;
352 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
353 TpdoRead(uint8_t
id, uint16_t idx, uint8_t subidx,
354 ::std::error_code& ec)
const;
373 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
TpdoWrite(
374 uint8_t
id, uint16_t idx, uint8_t subidx, T value);
392 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
TpdoWrite(
393 uint8_t
id, uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec);
426 ::std::error_code& ec) noexcept;
435 void OnWrite(::std::function<
void(uint16_t, uint8_t)> on_write);
446 ::std::function<
void(uint8_t, uint16_t, uint8_t)> on_rpdo_write);
465 const ::std::type_info&
Type(uint16_t idx, uint8_t subidx)
const;
478 const ::std::type_info&
Type(uint16_t idx, uint8_t subidx,
479 ::std::error_code& ec)
const noexcept;
495 typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type
Get(
496 uint16_t idx, uint8_t subidx)
const;
511 typename ::std::enable_if<detail::is_canopen_type<T>::value, T>::type
Get(
512 uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const noexcept;
527 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
Set(
528 uint16_t idx, uint8_t subidx, T value);
542 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
Set(
543 uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec) noexcept;
558 typename ::std::enable_if<detail::is_canopen_array<T>::value>::type
Set(
559 uint16_t idx, uint8_t subidx,
const T& value);
573 typename ::std::enable_if<detail::is_canopen_array<T>::value>::type
Set(
574 uint16_t idx, uint8_t subidx,
const T& value,
575 ::std::error_code& ec) noexcept;
589 void Set(uint16_t idx, uint8_t subidx,
const char* value);
602 void Set(uint16_t idx, uint8_t subidx,
const char* value,
603 ::std::error_code& ec) noexcept;
618 void Set(uint16_t idx, uint8_t subidx,
const char16_t* value);
632 void Set(uint16_t idx, uint8_t subidx,
const char16_t* value,
633 ::std::error_code& ec) noexcept;
648 void Set(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n);
662 void Set(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n,
663 ::std::error_code& ec) noexcept;
678 const char*
GetUploadFile(uint16_t idx, uint8_t subidx)
const;
694 ::std::error_code& ec)
const noexcept;
709 void SetUploadFile(uint16_t idx, uint8_t subidx,
const char* filename);
724 void SetUploadFile(uint16_t idx, uint8_t subidx,
const char* filename,
725 ::std::error_code& ec) noexcept;
756 ::std::error_code& ec)
const noexcept;
771 void SetDownloadFile(uint16_t idx, uint8_t subidx,
const char* filename);
786 void SetDownloadFile(uint16_t idx, uint8_t subidx,
const char* filename,
787 ::std::error_code& ec) noexcept;
799 void SetEvent(uint16_t idx, uint8_t subidx);
814 void SetEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec) noexcept;
835 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
836 RpdoGet(uint8_t
id, uint16_t idx, uint8_t subidx)
const;
857 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
858 RpdoGet(uint8_t
id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const 881 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
882 TpdoGet(uint8_t
id, uint16_t idx, uint8_t subidx)
const;
904 typename ::std::enable_if<detail::is_canopen_basic<T>::value, T>::type
905 TpdoGet(uint8_t
id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const 926 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
TpdoSet(
927 uint8_t
id, uint16_t idx, uint8_t subidx, T value);
946 typename ::std::enable_if<detail::is_canopen_basic<T>::value>::type
TpdoSet(
947 uint8_t
id, uint16_t idx, uint8_t subidx, T value,
948 ::std::error_code& ec) noexcept;
965 void TpdoSetEvent(uint8_t
id, uint16_t idx, uint8_t subidx);
981 void TpdoSetEvent(uint8_t
id, uint16_t idx, uint8_t subidx,
982 ::std::error_code& ec) noexcept;
1010 OnWrite(uint16_t , uint8_t ) noexcept {}
1025 OnRpdoWrite(uint8_t , uint16_t , uint8_t ) noexcept {}
1029 ::std::unique_ptr<Impl_> impl_;
1036 #endif // LELY_COAPP_DEVICE_HPP_ 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 s...
void UpdateRpdoMapping()
Updates the mapping from remote TPDO-mapped sub-objects to local RPDO-mapped sub-objects.
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-mapp...
This header file is part of the utilities library; it contains the C++ mutual exclusion helper classe...
void UpdateTpdoMapping()
Updates the mapping from remote RPDO-mapped sub-objects to local TPDO-mapped sub-objects.
This header file is part of the C++ CANopen application library; it contains the SDO error declaratio...
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.
An opaque CANopen device type.
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.
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...
uint8_t netid() const noexcept
Returns the network-ID.
void SetUploadFile(uint16_t idx, uint8_t subidx, const char *filename)
Sets the value of the UploadFile attribute of a sub-object, if present.
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.
An abstract interface conforming to the BasicLockable concept.
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...
const ::std::type_info & Type(uint16_t idx, uint8_t subidx) const
Returns the type of a sub-object.
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...
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...
This header file is part of the C++ CANopen application library; it contains the CANopen type traits...
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.
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.
The internal implementation of the CANopen device description.
const char * GetUploadFile(uint16_t idx, uint8_t subidx) const
Returns the value of the UploadFile attribute of a sub-object, if present.
CODev * dev() const noexcept
Returns a pointer to the internal CANopen device from <lely/co/dev.hpp>.
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 ...
const char * GetDownloadFile(uint16_t idx, uint8_t subidx) const
Returns the value of the DownloadFile attribute of a sub-object, if present.
The CANopen device description.
uint8_t id() const noexcept
Returns the node-ID.
void SetDownloadFile(uint16_t idx, uint8_t subidx, const char *filename)
Sets the value of the DownloadFile attribute of a sub-object, if present.
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.
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...
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 s...