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<is_canopen<T>::value, T>::type
Read(
87 uint16_t idx, uint8_t subidx)
const;
101 typename ::std::enable_if<is_canopen<T>::value, T>::type
Read(
102 uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const;
116 typename ::std::enable_if<is_canopen<T>::value>::type
Write(uint16_t idx,
131 typename ::std::enable_if<is_canopen<T>::value>::type
Write(
132 uint16_t idx, uint8_t subidx,
const T& value, ::std::error_code& ec);
145 void Write(uint16_t idx, uint8_t subidx,
const char* value);
157 void Write(uint16_t idx, uint8_t subidx,
const char* value,
158 ::std::error_code& ec);
172 void Write(uint16_t idx, uint8_t subidx,
const char16_t* value);
185 void Write(uint16_t idx, uint8_t subidx,
const char16_t* value,
186 ::std::error_code& ec);
200 void Write(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n);
213 void Write(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n,
214 ::std::error_code& ec);
229 void WriteDcf(
const uint8_t* begin,
const uint8_t* end);
243 void WriteDcf(
const uint8_t* begin,
const uint8_t* end,
244 ::std::error_code& ec);
267 void WriteDcf(
const char* path, ::std::error_code& ec);
280 void WriteEvent(uint16_t idx, uint8_t subidx);
293 void WriteEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec) noexcept;
313 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
RpdoRead(
314 uint8_t
id, uint16_t idx, uint8_t subidx)
const;
333 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
RpdoRead(
334 uint8_t
id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const;
355 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
TpdoRead(
356 uint8_t
id, uint16_t idx, uint8_t subidx)
const;
376 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
TpdoRead(
377 uint8_t
id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const;
396 typename ::std::enable_if<is_canopen_basic<T>::value>::type
TpdoWrite(
397 uint8_t
id, uint16_t idx, uint8_t subidx, T value);
415 typename ::std::enable_if<is_canopen_basic<T>::value>::type
TpdoWrite(
416 uint8_t
id, uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec);
449 ::std::error_code& ec) noexcept;
458 void OnWrite(::std::function<
void(uint16_t, uint8_t)> on_write);
469 ::std::function<
void(uint8_t, uint16_t, uint8_t)> on_rpdo_write);
488 const ::std::type_info&
Type(uint16_t idx, uint8_t subidx)
const;
501 const ::std::type_info&
Type(uint16_t idx, uint8_t subidx,
502 ::std::error_code& ec)
const noexcept;
518 typename ::std::enable_if<is_canopen<T>::value, T>::type
Get(
519 uint16_t idx, uint8_t subidx)
const;
534 typename ::std::enable_if<is_canopen<T>::value, T>::type
Get(
535 uint16_t idx, uint8_t subidx, ::std::error_code& ec)
const noexcept;
550 typename ::std::enable_if<is_canopen<T>::value>::type
Set(uint16_t idx,
566 typename ::std::enable_if<is_canopen<T>::value>::type
Set(
567 uint16_t idx, uint8_t subidx,
const T& value,
568 ::std::error_code& ec) noexcept;
582 void Set(uint16_t idx, uint8_t subidx,
const char* value);
595 void Set(uint16_t idx, uint8_t subidx,
const char* value,
596 ::std::error_code& ec) noexcept;
611 void Set(uint16_t idx, uint8_t subidx,
const char16_t* value);
625 void Set(uint16_t idx, uint8_t subidx,
const char16_t* value,
626 ::std::error_code& ec) noexcept;
641 void Set(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n);
655 void Set(uint16_t idx, uint8_t subidx,
const void* p, ::std::size_t n,
656 ::std::error_code& ec) noexcept;
671 const char*
GetUploadFile(uint16_t idx, uint8_t subidx)
const;
687 ::std::error_code& ec)
const noexcept;
702 void SetUploadFile(uint16_t idx, uint8_t subidx,
const char* filename);
717 void SetUploadFile(uint16_t idx, uint8_t subidx,
const char* filename,
718 ::std::error_code& ec) noexcept;
749 ::std::error_code& ec)
const noexcept;
764 void SetDownloadFile(uint16_t idx, uint8_t subidx,
const char* filename);
779 void SetDownloadFile(uint16_t idx, uint8_t subidx,
const char* filename,
780 ::std::error_code& ec) noexcept;
792 void SetEvent(uint16_t idx, uint8_t subidx);
807 void SetEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec) noexcept;
828 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
RpdoGet(
829 uint8_t
id, uint16_t idx, uint8_t subidx)
const;
850 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
RpdoGet(
851 uint8_t
id, uint16_t idx, uint8_t subidx,
852 ::std::error_code& ec)
const noexcept;
874 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
TpdoGet(
875 uint8_t
id, uint16_t idx, uint8_t subidx)
const;
897 typename ::std::enable_if<is_canopen_basic<T>::value, T>::type
TpdoGet(
898 uint8_t
id, uint16_t idx, uint8_t subidx,
899 ::std::error_code& ec)
const noexcept;
919 typename ::std::enable_if<is_canopen_basic<T>::value>::type
TpdoSet(
920 uint8_t
id, uint16_t idx, uint8_t subidx, T value);
939 typename ::std::enable_if<is_canopen_basic<T>::value>::type
TpdoSet(
940 uint8_t
id, uint16_t idx, uint8_t subidx, T value,
941 ::std::error_code& ec) noexcept;
958 void TpdoSetEvent(uint8_t
id, uint16_t idx, uint8_t subidx);
974 void TpdoSetEvent(uint8_t
id, uint16_t idx, uint8_t subidx,
975 ::std::error_code& ec) noexcept;
1003 OnWrite(uint16_t , uint8_t ) noexcept {}
1019 OnRpdoWrite(uint8_t , uint16_t , uint8_t ) noexcept {}
1029 void RpdoWrite(uint8_t
id, uint16_t idx, uint8_t subidx);
1033 ::std::unique_ptr<Impl_> impl_;
1040 #endif // LELY_COAPP_DEVICE_HPP_