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

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

#include <master.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 the value of the sub-object by submitting an SDO upload request to the local object dictionary. More...
 
template<class T >
Read () const
 Reads the value of the sub-object by submitting an SDO upload request to the local object dictionary. More...
 
template<class T >
Read (::std::error_code &ec) const
 Reads the value of the sub-object by submitting an SDO upload request to the local object dictionary. More...
 
template<class T >
SubObjectWrite (T &&value)
 Writes a value to the sub-object by submitting an SDO download request to the local object dictionary. More...
 
template<class T >
SubObjectWrite (T &&value, ::std::error_code &ec)
 Writes a value to the sub-object by submitting an SDO download request to the local object dictionary. More...
 
SubObjectWrite (const void *p, ::std::size_t n)
 Writes an OCTET_STRING or DOMAIN value to the sub-object by submitting an SDO download request to the local object dictionary. More...
 
SubObjectWrite (const void *p, ::std::size_t n, ::std::error_code &ec)
 Writes an OCTET_STRING or DOMAIN value to the sub-object by submitting an SDO download request to the local object dictionary. More...
 
void WriteEvent ()
 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 WriteEvent (::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 59 of file master.hpp.

Member Function Documentation

◆ operator=()

template<class T >
SubObject & lely::canopen::BasicMaster::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
Write()

Definition at line 81 of file master.hpp.

◆ operator T()

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

Returns the value of the sub-object by submitting an SDO upload request to the local object dictionary.

Exceptions
lely::canopen::SdoErroron error.
See also
Read()

Definition at line 94 of file master.hpp.

◆ Read() [1/2]

template<class T >
T lely::canopen::BasicMaster::SubObject::Read ( ) const
inline

Reads the value of the sub-object by submitting an SDO upload request to the local object dictionary.

Returns
the result of the SDO request.
Exceptions
lely::canopen::SdoErroron error.
See also
Device::Read(uint16_t idx, uint8_t subidx) const
Device::TpdoRead(uint8_t id, uint16_t idx, uint8_t subidx) const

Definition at line 111 of file master.hpp.

◆ Read() [2/2]

template<class T >
T lely::canopen::BasicMaster::SubObject::Read ( ::std::error_code &  ec) const
inline

Reads the value of the sub-object by submitting an SDO upload request to the local object dictionary.

Parameters
econ error, the SDO abort code is stored in ec.
Returns
the result of the SDO request, or an empty value on error.
See also
Device::Read(uint16_t idx, uint8_t subidx, ::std::error_code& ec) const
Device::TpdoRead(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code& ec) const

Definition at line 129 of file master.hpp.

◆ Write() [1/4]

template<class T >
SubObject & lely::canopen::BasicMaster::SubObject::Write ( T &&  value)
inline

Writes a value to the sub-object by submitting an SDO download request to the local object dictionary.

Parameters
valuethe value to be written.
Returns
*this.
Exceptions
lely::canopen::SdoErroron error.
See also
Device::Write(uint16_t idx, uint8_t subidx, T&& value)
Device::TpdoWrite(uint8_t id, uint16_t idx, uint8_t subidx, T&& value)

Definition at line 149 of file master.hpp.

◆ Write() [2/4]

template<class T >
SubObject & lely::canopen::BasicMaster::SubObject::Write ( T &&  value,
::std::error_code &  ec 
)
inline

Writes a value to the sub-object by submitting an SDO download request to the local object dictionary.

Parameters
valuethe value to be written.
econ error, the SDO abort code is stored in ec.
Returns
*this.
See also
Device::Write(uint16_t idx, uint8_t subidx, T value, ::std::error_code& ec)
Device::Write(uint16_t idx, uint8_t subidx, const T& value, ::std::error_code& ec)
Device::Write(uint16_t idx, uint8_t subidx, const char* value, ::std::error_code& ec)
Device::Write(uint16_t idx, uint8_t subidx, const char16_t* value, ::std::error_code& ec)
Device::TpdoWrite(uint8_t id, uint16_t idx, uint8_t subidx, T&& value, ::std::error_code& ec)

Definition at line 174 of file master.hpp.

◆ Write() [3/4]

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

Writes an OCTET_STRING or DOMAIN value to the sub-object by submitting an SDO download request to the local object dictionary.

Parameters
pa pointer to the bytes to be written.
nthe number of bytes to write.
Returns
*this.
Exceptions
lely::canopen::SdoErroron error.
See also
Device::Write(uint16_t idx, uint8_t subidx, const void* p, ::std::size_t n)

Definition at line 196 of file master.hpp.

◆ Write() [4/4]

SubObject & lely::canopen::BasicMaster::SubObject::Write ( const void *  p,
::std::size_t  n,
::std::error_code &  ec 
)
inline

Writes an OCTET_STRING or DOMAIN value to the sub-object by submitting an SDO download request to the local object dictionary.

Parameters
pa pointer to the bytes to be written.
nthe number of bytes to write.
econ error, the SDO abort code is stored in ec.
Returns
*this.
See also
Device::Write(uint16_t idx, uint8_t subidx, const void* p, ::std::size_t n, ::std::error_code& ec)

Definition at line 214 of file master.hpp.

◆ WriteEvent() [1/2]

void lely::canopen::BasicMaster::SubObject::WriteEvent ( )
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::WriteEvent(uint16_t idx, uint8_t subidx)
Device::TpdoWriteEvent(uint8_t id, uint16_t idx, uint8_t subidx)

Definition at line 230 of file master.hpp.

◆ WriteEvent() [2/2]

void lely::canopen::BasicMaster::SubObject::WriteEvent ( ::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::WriteEvent(uint16_t idx, uint8_t subidx, ::std::error_code& ec)
Device::TpdoWriteEvent(uint8_t id, uint16_t idx, uint8_t subidx, ::std::error_code& ec)

Definition at line 248 of file master.hpp.


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