Lely core libraries 2.3.4
lely::canopen::BasicSlave::SubObject Class Reference

A mutator providing read/write access to a CANopen sub-object in a local object dictionary. More...

#include <slave.hpp>

Public Member Functions

template<class T >
SubObjectoperator= (T &&value)
 Sets the value of the sub-object. More...
 
template<class T >
 operator T () const
 Returns a copy of the value of the sub-object. More...
 
const ::std::type_info & Type () const
 Returns the type of the sub-object. More...
 
const ::std::type_info & Type (::std::error_code &ec) const noexcept
 Returns the type of the sub-object. More...
 
template<class T >
Get () const
 Reads the value of the sub-object. More...
 
template<class T >
Get (::std::error_code &ec) const noexcept
 Reads the value of the sub-object. More...
 
template<class T >
SubObjectSet (T &&value)
 Writes a value to the sub-object. More...
 
template<class T >
SubObjectSet (T &&value, ::std::error_code &ec) noexcept
 Writes a value to the sub-object. More...
 
SubObjectSet (const void *p, ::std::size_t n)
 Writes an OCTET_STRING or DOMAIN value to the sub-object. More...
 
SubObjectSet (const void *p, ::std::size_t n, ::std::error_code &ec) noexcept
 Writes an OCTET_STRING or DOMAIN value to the sub-object. More...
 
void SetEvent ()
 Checks if the sub-object can be mapped into a PDO and, if so, triggers the transmission of every acyclic or event-driven Transmit-PDO into which the sub-object is mapped. More...
 
void SetEvent (::std::error_code &ec) noexcept
 Checks if the sub-object can be mapped into a PDO and, if so, triggers the transmission of every acyclic or event-driven Transmit-PDO into which the sub-object is mapped. More...
 

Detailed Description

A mutator providing read/write access to a CANopen sub-object in a local object dictionary.

Definition at line 88 of file slave.hpp.

Member Function Documentation

◆ operator=()

template<class T >
SubObject & lely::canopen::BasicSlave::SubObject::operator= ( T &&  value)
inline

Sets the value of the sub-object.

Parameters
valuethe value to be written.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.
See also
Set()

Definition at line 110 of file slave.hpp.

◆ operator T()

template<class T >
lely::canopen::BasicSlave::SubObject::operator T ( ) const
inline

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.
See also
Get()

Definition at line 123 of file slave.hpp.

◆ Type() [1/2]

const ::std::type_info & lely::canopen::BasicSlave::SubObject::Type ( ) const
inline

Returns the type of the sub-object.

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.
See also
Device::Type(uint16_t idx, uint8_t subidx) const

Definition at line 138 of file slave.hpp.

◆ Type() [2/2]

const ::std::type_info & lely::canopen::BasicSlave::SubObject::Type ( ::std::error_code &  ec) const
inlinenoexcept

Returns the type of the sub-object.

Parameters
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.
See also
Device::Type(uint16_t idx, uint8_t subidx, ::std::error_code& ec) const

Definition at line 154 of file slave.hpp.

◆ Get() [1/2]

template<class T >
T lely::canopen::BasicSlave::SubObject::Get ( ) const
inline

Reads the value of the sub-object.

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.
See also
Device::Get(uint16_t idx, uint8_t subidx) const
Device::TpdoGet(uint8_t id, uint16_t idx, uint8_t subidx) const

Definition at line 171 of file slave.hpp.

◆ Get() [2/2]

template<class T >
T lely::canopen::BasicSlave::SubObject::Get ( ::std::error_code &  ec) const
inlinenoexcept

Reads the value of the sub-object.

Parameters
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.
See also
Device::Get(uint16_t idx, uint8_t subidx, ::std::error_code& ec) const
Device::TpdoGet(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code& ec) const

Definition at line 190 of file slave.hpp.

◆ Set() [1/4]

template<class T >
SubObject & lely::canopen::BasicSlave::SubObject::Set ( T &&  value)
inline

Writes a value to the sub-object.

Parameters
valuethe value to be written.
Returns
*this.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.
See also
Device::Set(uint16_t idx, uint8_t subidx, T&& value)
Device::TpdoSet(uint8_t id, uint16_t idx, uint8_t subidx, T&& value)

Definition at line 210 of file slave.hpp.

◆ Set() [2/4]

template<class T >
SubObject & lely::canopen::BasicSlave::SubObject::Set ( T &&  value,
::std::error_code &  ec 
)
inlinenoexcept

Writes a value to the sub-object.

Parameters
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.
Returns
*this.
See also
Device::Set(uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec)
Device::Set(uint16_t idx, uint8_t subidx, const T& value, ::std::error_code& ec)
Device::Set(uint16_t idx, uint8_t subidx, const char* value, ::std::error_code& ec)
Device::Set(uint16_t idx, uint8_t subidx, const char16_t* value, ::std::error_code& ec)
Device::TpdoSet(uint8_t id, uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec)

Definition at line 235 of file slave.hpp.

◆ Set() [3/4]

SubObject & lely::canopen::BasicSlave::SubObject::Set ( const void *  p,
::std::size_t  n 
)
inline

Writes an OCTET_STRING or DOMAIN value to the sub-object.

Parameters
pa pointer to the bytes to be written.
nthe number of bytes to write.
Returns
*this.
Exceptions
lely::canopen::SdoErrorif the sub-object does not exist or the type does not match.
See also
Device::Set(uint16_t idx, uint8_t subidx, const void* p, ::std::size_t n)

Definition at line 257 of file slave.hpp.

◆ Set() [4/4]

SubObject & lely::canopen::BasicSlave::SubObject::Set ( const void *  p,
::std::size_t  n,
::std::error_code &  ec 
)
inlinenoexcept

Writes an OCTET_STRING or DOMAIN value to the sub-object.

Parameters
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 ac.
Returns
*this.
See also
Device::Set(uint16_t idx, uint8_t subidx, const void* p, ::std::size_t n, ::std::error_code& ec)

Definition at line 275 of file slave.hpp.

◆ SetEvent() [1/2]

void lely::canopen::BasicSlave::SubObject::SetEvent ( )
inline

Checks if the sub-object can be mapped into a PDO and, if so, triggers the transmission of every acyclic or event-driven Transmit-PDO into which the sub-object is mapped.

Exceptions
lely::canopen::SdoErroron error.
See also
Device::SetEvent(uint16_t idx, uint8_t subidx)
Device::TpdoSetEvent(uint8_t id, uint16_t idx, uint8_t subidx)

Definition at line 291 of file slave.hpp.

◆ SetEvent() [2/2]

void lely::canopen::BasicSlave::SubObject::SetEvent ( ::std::error_code &  ec)
inlinenoexcept

Checks if the sub-object can be mapped into a PDO and, if so, triggers the transmission of every acyclic or event-driven Transmit-PDO into which the sub-object is mapped.

Parameters
econ error, the SDO abort code is stored in ec.
See also
Device::SetEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec)
Device::TpdoSetEvent(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)

Definition at line 309 of file slave.hpp.


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