NAP
Public Member Functions | Public Attributes | List of all members
SDOArgument Class Referenceabstract

#include <sdo.h>

Public Member Functions

 SDOArgument (uint16 index, uint16 subIndex, bool single)
 
 SDOArgument (uint16 index, uint16 subIndex, const std::string &name, bool single)
 
virtual ~SDOArgument ()=default
 
virtual bool init (utility::ErrorState &errorState)
 
virtual int getSize ()=0
 
virtual void * getData ()=0
 
const std::string & getDescription () const
 
uint16 getIndex () const
 
uint16 getSubIndex () const
 
bool singleSubIndex () const
 
- Public Member Functions inherited from Resource
 Resource ()
 
- Public Member Functions inherited from Object
 Object ()
 
virtual ~Object ()
 
virtual void onDestroy ()
 
 Object (Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 

Public Attributes

bool mSingle = true
 Property: 'Single' Only read / write a single subindex. Complete access to index otherwise. More...
 
std::string mDescription
 Property: 'Description' optional description. More...
 
std::string mIndexStr
 Property: 'Index' index as string, for example: '0x8011'. Converted to number on init(). More...
 
std::string mSubIndexStr
 Property: 'SubIndex' sub index as string, for example: '0x03'. Converted to number on init(). More...
 
int mBase = 16
 Property: 'Base' the number base used for conversion on init, defaults to 16 (hex). More...
 
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)
 

Description

Base class of all SDO (Service Data Object) objects. Groups together useful SDO information such as the SDO index, subindex and description. This requires the slave to have a mailbox and to support the "CANopen over EtherCAT" (CoE) protocol. Derive from this class to create your own SDO read & write objects.

Inheritance diagram for SDOArgument:
[legend]
Collaboration diagram for SDOArgument:
[legend]

Constructor & Destructor Documentation

◆ SDOArgument() [1/2]

SDOArgument ( uint16  index,
uint16  subIndex,
bool  single 
)
Parameters
indexobject index
subIndexobject sub index
singleonly read / write a single sub index or complete access

◆ SDOArgument() [2/2]

SDOArgument ( uint16  index,
uint16  subIndex,
const std::string &  name,
bool  single 
)
Parameters
indexobject index
subIndexobject sub index
namename of index to set
singleonly read / write a single sub index or complete access

◆ ~SDOArgument()

virtual ~SDOArgument ( )
virtualdefault

Member Function Documentation

◆ getData()

virtual void* getData ( )
pure virtual

Override in derived classes. Returns the pointer to the block of data.

Returns
pointer to the block of data

Implemented in SDOValue< T >.

◆ getDescription()

const std::string& getDescription ( ) const
Returns
name (optional)

◆ getIndex()

uint16 getIndex ( ) const
Returns
SDO index

◆ getSize()

virtual int getSize ( )
pure virtual

Override in derived classes

Returns
size in bytes of the data block that is set

Implemented in SDOValue< T >.

◆ getSubIndex()

uint16 getSubIndex ( ) const
Returns
SDO sub index

◆ init()

virtual bool init ( utility::ErrorState errorState)
virtual

Converts index and sub-index into numerical representation.

Parameters
errorStatecontains error message if conversion fails
Returns
if conversion succeeded

Reimplemented from Object.

◆ singleSubIndex()

bool singleSubIndex ( ) const
Returns
if only a single sub index is written or read at a time.

Member Data Documentation

◆ mBase

int mBase = 16

Property: 'Base' the number base used for conversion on init, defaults to 16 (hex).

◆ mDescription

std::string mDescription

Property: 'Description' optional description.

◆ mIndexStr

std::string mIndexStr

Property: 'Index' index as string, for example: '0x8011'. Converted to number on init().

◆ mSingle

bool mSingle = true

Property: 'Single' Only read / write a single subindex. Complete access to index otherwise.

◆ mSubIndexStr

std::string mSubIndexStr

Property: 'SubIndex' sub index as string, for example: '0x03'. Converted to number on init().