22 #ifndef LELY_COCPP_SLAVE_HPP_ 23 #define LELY_COCPP_SLAVE_HPP_ 49 BasicSlave(aio::TimerBase& timer, aio::CanBusBase& bus,
50 const ::std::string& dcf_txt, const ::std::string& dcf_bin =
"",
86 Set(::std::forward<T>(value));
113 const ::std::type_info&
115 return slave_->
Type(idx_, subidx_);
130 const ::std::type_info&
131 Type(::std::error_code& ec)
const {
132 return slave_->
Type(idx_, subidx_, ec);
148 return slave_->
Get<T>(idx_, subidx_);
165 Get(::std::error_code& ec)
const {
166 return slave_->
Get<T>(idx_, subidx_, ec);
182 slave_->
Set(idx_, subidx_, ::std::forward<T>(value));
200 Set(T&& value, ::std::error_code& ec) {
201 slave_->
Set(idx_, subidx_, ::std::forward<T>(value), ec);
217 Set(
const void* p, ::std::size_t n) {
218 slave_->
Set(idx_, subidx_, p, n);
233 Set(
const void* p, ::std::size_t n, ::std::error_code& ec) {
234 slave_->
Set(idx_, subidx_, p, n, ec);
239 : slave_(slave), idx_(idx), subidx_(subidx) {}
278 const ::std::type_info&
280 return slave_->
Type(idx_, subidx_);
295 const ::std::type_info&
296 Type(::std::error_code& ec)
const {
297 return slave_->
Type(idx_, subidx_, ec);
313 return slave_->
Get<T>(idx_, subidx_);
330 Get(::std::error_code& ec)
const {
331 return slave_->
Get<T>(idx_, subidx_, ec);
336 : slave_(slave), idx_(idx), subidx_(subidx) {}
410 : slave_(slave), idx_(idx) {}
455 ::std::error_code(uint16_t idx, uint8_t subidx, T& new_val, T old_val),
456 ::std::error_code(uint16_t idx, uint8_t subidx, T& new_val)>::type;
495 typename ::std::enable_if<detail::IsCanopenType<T>::value>::type
OnRead(
496 uint16_t idx, uint8_t subidx, ::std::function<OnReadSignature<T>> ind);
510 typename ::std::enable_if<detail::IsCanopenType<T>::value>::type
OnRead(
511 uint16_t idx, uint8_t subidx, ::std::function<OnReadSignature<T>> ind,
512 ::std::error_code& ec);
528 typename ::std::enable_if<detail::IsCanopenType<T>::value>::type
OnWrite(
529 uint16_t idx, uint8_t subidx, ::std::function<OnWriteSignature<T>> ind);
544 typename ::std::enable_if<detail::IsCanopenType<T>::value>::type
OnWrite(
545 uint16_t idx, uint8_t subidx, ::std::function<OnWriteSignature<T>> ind,
546 ::std::error_code& ec);
548 #ifndef DOXYGEN_SHOULD_SKIP_THIS 567 ::std::unique_ptr<Impl_> impl_;
574 #endif // LELY_COCPP_SLAVE_HPP_ void Set(const void *p, ::std::size_t n)
Writes an OCTET_STRING or DOMAIN value to the sub-object.
BasicSlave(aio::TimerBase &timer, aio::CanBusBase &bus, const ::std::string &dcf_txt, const ::std::string &dcf_bin="", uint8_t id=0xff)
Creates a new CANopen slave.
void Set(T &&value)
Writes a value to the sub-object.
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.
ConstObject operator[](uint16_t idx) const
Returns an accessor object that provides read-only access to the specified CANopen object in the loca...
ConstSubObject operator[](uint8_t subidx) const
Returns an accessor object that provides read-only access to the specified CANopen sub-object in the ...
const ::std::type_info & Type() const
Returns the type of the sub-object.
ConstSubObject operator[](uint8_t subidx) const
Returns an accessor object that provides read-only access to the specified CANopen sub-object in the ...
An accessor providing read-only access to a CANopen sub-object in a local object dictionary.
Object operator[](uint16_t idx)
Returns a mutator object that provides read/write access to the specified CANopen object in the local...
const ::std::type_info & Type() const
Returns the type of the sub-object.
SubObject & operator=(T &&value)
Sets the value of the sub-object.
void Set(const void *p, ::std::size_t n, ::std::error_code &ec)
Writes an OCTET_STRING or DOMAIN value to the sub-object.
T Get() const
Reads the value of the sub-object.
SubObject operator[](uint8_t subidx)
Returns a mutator object that provides read/write access to the specified CANopen sub-object in the l...
::std::error_code(uint16_t idx, uint8_t subdx, T &value) OnReadSignature
The signature of the callback function invoked on read (SDO upload) access to the local object dictio...
void Set(T &&value, ::std::error_code &ec)
Writes a value to the sub-object.
T Get(::std::error_code &ec) const
Reads the value of the sub-object.
const ::std::type_info & Type(uint16_t idx, uint8_t subidx) const
Returns the type of a sub-object.
If T is one of the CANopen basic types, provides the member constant value equal to true...
The base class for CANopen slaves.
typename ::std::conditional< detail::IsCanopenBasic< T >::value, ::std::error_code(uint16_t idx, uint8_t subidx, T &new_val, T old_val), ::std::error_code(uint16_t idx, uint8_t subidx, T &new_val)>::type OnWriteSignature
The signature of the callback function invoked on write (SDO download) access to the local object dic...
const ::std::type_info & Type(::std::error_code &ec) const
Returns the type of the sub-object.
virtual void OnLifeGuarding(bool occurred) noexcept
The function invoked when a life guarding event occurs or is resolved.
typename ::std::enable_if< detail::IsCanopenType< T >::value >::type OnWrite(uint16_t idx, uint8_t subidx, ::std::function< OnWriteSignature< T >> ind)
Registers a callback function to be invoked on write (SDO download) access to the specified CANopen s...
A mutator providing read/write access to a CANopen object in a local object dictionary.
This header file is part of the C++ CANopen application library; it contains the CANopen node declara...
T Get(::std::error_code &ec) const
Reads the value of the sub-object.
typename ::std::enable_if< detail::IsCanopenType< T >::value >::type OnRead(uint16_t idx, uint8_t subidx, ::std::function< OnReadSignature< T >> ind)
Registers a callback function to be invoked on read (SDO upload) access to the specified CANopen sub-...
An accessor providing read-only access to a CANopen object in a local object dictionary.
T Get() const
Reads the value of the sub-object.
Global namespace for the Lely Industries N.V. libraries.
The base class for CANopen nodes.
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.
const ::std::type_info & Type(::std::error_code &ec) const
Returns the type of the sub-object.
A mutator providing read/write access to a CANopen sub-object in a local object dictionary.