BusIO Class Reference

Brief description of class BusIO. More...

#include <armarx/control/ethercat/bus_io/BusIO.h>

+ Inheritance diagram for BusIO:

Public Member Functions

EtherCATState changeStateOfBus (EtherCATState state, bool validate=true)
 
EtherCATState changeStateOfSlave (std::uint16_t slaveIndex, EtherCATState state, bool validate=true)
 
void deactivateCOECA (std::uint16_t slaveIndex)
 This deactivates the Complete access mode in CoE for the given slave. More...
 
bool readRegisters (EtherCATFrameList *frames, std::uint16_t amountFramesToRead=0)
 
bool readRegisters (std::vector< RegisterDataList > &registerData)
 
bool readSDOByteBuffer (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, int *buflen, unsigned char *buf, bool completeAccess=false)
 Performs a SDO read from the slave and returns true if it succeeds. More...
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
bool readSDOEntry (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, T &result, bool completeAccess=false)
 Performs a SDO read of an single entry from the slave and returns true if it succeeds. More...
 
EtherCATState readStates ()
 
bool resetErrorRegisters (std::uint16_t slaveIndex)
 
void setTimeouts (Timeouts const &timeouts)
 
bool writeSDOByteBuffer (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, int buflen, const unsigned char *buf, bool completeAccess=false)
 Performs a SDO write to the slave with the given slaveIndex and returns true if it succeeds. More...
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
bool writeSDOEntry (std::uint16_t slaveIndex, std::uint16_t index, std::uint8_t subIndex, T value, bool completeAccess=false)
 Performs a SDO write to a single entry to the slave with the give slaveIndex and returns true if it succeeds. More...
 
virtual ~BusIO ()
 

Protected Types

using IOMap = std::array< char, 4096 >
 IOmap the IO map where the process data are mapped in. More...
 

Protected Member Functions

 BusIO ()
 
void rtUpdatePDO ()
 Updates the PDO of all slaves. More...
 
- Protected Member Functions inherited from ESIHandler
std::optional< std::vector< std::byte > > readESIBinaryBlob (std::uint16_t slaveIndex, std::uint16_t startAddress, std::uint16_t endAddress) const
 

Protected Attributes

IOMap ioMap
 
int lastWorkCounter = 0
 
bool pdoAccessAvailable = false
 
bool sdoAccessAvailable = false
 
Timeouts timeouts
 

Detailed Description

Brief description of class BusIO.

Detailed description of class BusIO.

Definition at line 57 of file BusIO.h.

Member Typedef Documentation

◆ IOMap

using IOMap = std::array<char, 4096>
protected

IOmap the IO map where the process data are mapped in.

Definition at line 210 of file BusIO.h.

Constructor & Destructor Documentation

◆ ~BusIO()

~BusIO ( )
virtual

Definition at line 396 of file BusIO.cpp.

◆ BusIO()

BusIO ( )
protected

Definition at line 25 of file BusIO.cpp.

Member Function Documentation

◆ changeStateOfBus()

EtherCATState changeStateOfBus ( EtherCATState  state,
bool  validate = true 
)

Definition at line 411 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ changeStateOfSlave()

EtherCATState changeStateOfSlave ( std::uint16_t  slaveIndex,
EtherCATState  state,
bool  validate = true 
)

Definition at line 403 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ deactivateCOECA()

void deactivateCOECA ( std::uint16_t  slaveIndex)

This deactivates the Complete access mode in CoE for the given slave.

For Elmo's it is necessary to deactivate the CA mode otherwise SOEM isn't able to bring them into OP-Mode

Parameters
slavethe slave for which the CA mode will be deactivated

Definition at line 445 of file BusIO.cpp.

◆ readRegisters() [1/2]

bool readRegisters ( EtherCATFrameList frames,
std::uint16_t  amountFramesToRead = 0 
)

Definition at line 439 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ readRegisters() [2/2]

bool readRegisters ( std::vector< RegisterDataList > &  registerData)

Definition at line 433 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ readSDOByteBuffer()

bool readSDOByteBuffer ( std::uint16_t  slaveIndex,
std::uint16_t  index,
std::uint8_t  subIndex,
int *  buflen,
unsigned char *  buf,
bool  completeAccess = false 
)
inline

Performs a SDO read from the slave and returns true if it succeeds.

Fails if the bus has not been started yet.

Blocking until the write has been performed or a timeout is reached.

Parameters
[IN]slaveIndex the index of the slave it will read from
[IN]index the index of the object dictonary it will read from
[IN]subIndex the sub index of the entry
[IN]buflen amount of bytes to read
[OUT]buf buffer which contains the read data afterwards
[IN]completeAccess with this flag you can activate writing in complete access mode
Returns
true when write was successful otherwise false

Definition at line 161 of file BusIO.h.

◆ readSDOEntry()

bool readSDOEntry ( std::uint16_t  slaveIndex,
std::uint16_t  index,
std::uint8_t  subIndex,
T result,
bool  completeAccess = false 
)
inline

Performs a SDO read of an single entry from the slave and returns true if it succeeds.

Fails if the bus has not been started yet.

Blocking until the write has been performed or a timeout is reached.

Parameters
[IN]slaveIndex the index of the slave it will read from
[IN]index the index of the object dictonary it will read from
[IN]subIndex the sub index of the entry
[OUT]result the read data
[IN]completeAccess with this flag you can activate writing in complete access mode
Returns
true when write was successful otherwise false

Definition at line 133 of file BusIO.h.

◆ readStates()

EtherCATState readStates ( )

Definition at line 419 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ resetErrorRegisters()

bool resetErrorRegisters ( std::uint16_t  slaveIndex)

Definition at line 427 of file BusIO.cpp.

+ Here is the call graph for this function:

◆ rtUpdatePDO()

void rtUpdatePDO ( )
protected

Updates the PDO of all slaves.

This function has priority over all other BusIO functions and can only be executed by the Bus itself.

Definition at line 113 of file BusIO.cpp.

+ Here is the caller graph for this function:

◆ setTimeouts()

void setTimeouts ( Timeouts const &  timeouts)

Definition at line 463 of file BusIO.cpp.

+ Here is the caller graph for this function:

◆ writeSDOByteBuffer()

bool writeSDOByteBuffer ( std::uint16_t  slaveIndex,
std::uint16_t  index,
std::uint8_t  subIndex,
int  buflen,
const unsigned char *  buf,
bool  completeAccess = false 
)
inline

Performs a SDO write to the slave with the given slaveIndex and returns true if it succeeds.

Fails if the bus has not been started yet.

Blocking until the write has been performed or a timeout is reached.

Parameters
[IN]slaveIndex the slavenumber of the slave on the bus
[IN]index the index of the entry where the value is written to
[IN]subIndex the subindex of the entry
[IN]buflen length of the buffer containing the data
[IN]buf buffer containing the data to write
[IN]completeAccess with this flag you can activate writing in complete access mode
Returns
true when write was successful otherwise false

Definition at line 106 of file BusIO.h.

◆ writeSDOEntry()

bool writeSDOEntry ( std::uint16_t  slaveIndex,
std::uint16_t  index,
std::uint8_t  subIndex,
T  value,
bool  completeAccess = false 
)
inline

Performs a SDO write to a single entry to the slave with the give slaveIndex and returns true if it succeeds.

Fails if the bus has not been started yet.

Blocking until the write has been performed or a timeout is reached.

Parameters
[IN]slaveIndex the slavenumber of the slave on the bus
[IN]index the index of the entry where the value is written to
[IN]subIndex the subindex of the entry
[IN]value the value that will be written to the slave
[IN]completeAccess with this flag you can activate writing in complete access mode
Returns
true when write was successful otherwise false

Definition at line 79 of file BusIO.h.

+ Here is the call graph for this function:

Member Data Documentation

◆ ioMap

IOMap ioMap
protected

Definition at line 211 of file BusIO.h.

◆ lastWorkCounter

int lastWorkCounter = 0
protected

Definition at line 207 of file BusIO.h.

◆ pdoAccessAvailable

bool pdoAccessAvailable = false
protected

Definition at line 203 of file BusIO.h.

◆ sdoAccessAvailable

bool sdoAccessAvailable = false
protected

Definition at line 202 of file BusIO.h.

◆ timeouts

Timeouts timeouts
protected

Definition at line 205 of file BusIO.h.


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