EtherCATState Class Reference

This class is a wrapper around an enum containing the different EtherCAT states. More...

#include <armarx/control/ethercat/EtherCATState.h>

Public Types

enum  Value : std::uint16_t {
  invalid = EC_STATE_NONE, init = EC_STATE_INIT, preOp = EC_STATE_PRE_OP, boot = EC_STATE_BOOT,
  safeOp = EC_STATE_SAFE_OP, op = EC_STATE_OPERATIONAL, safeOpError = EC_STATE_SAFE_OP + EC_STATE_ERROR
}
 The EtherCAT state enum. More...
 

Public Member Functions

constexpr const char * c_str () const
 
 EtherCATState ()=default
 
constexpr EtherCATState (std::uint16_t state)
 Construct a new EtherCATState from a std::uint16_t (e.g. More...
 
constexpr EtherCATState (Value state)
 Construct a new EtherCATState from another EtherCATState. More...
 
 operator bool ()=delete
 Delete bool-operator to prevent usages like if(state) which does not make sense in this context and might lead to unexpected behaviour if being allowed to use. More...
 
 operator Value () const
 Returns the wrapped enum value. More...
 

Friends

std::ostream & operator<< (std::ostream &stream, const EtherCATState &rhs)
 

Detailed Description

This class is a wrapper around an enum containing the different EtherCAT states.

The EtherCAT states have been defined by Beckhoff here: https://infosys.beckhoff.com/english.php?content=../content/1033/ax2000-b110/html/bt_ecbasics_ecstatemachine.htm

This wrapper allows for easy, well defined construction from std::uint16_t and for converting the state into a string representation. The underlying numerical values are the same as defined by the SOEM library here: https://github.com/OpenEtherCATsociety/SOEM/blob/master/soem/ethercattype.h

Definition at line 25 of file EtherCATState.h.

Member Enumeration Documentation

◆ Value

enum Value : std::uint16_t

The EtherCAT state enum.

Enumerator
invalid 

State is not valid, e.g. if a request for reading the actual bus state failed.

init 

Initial state after switch a EtherCAT slave on.

No communication is possible.

preOp 

Pre-operational state.

SDO communication is possible, but no PDOs are updated.

boot 

Boot state.

The firmware could be updated in this state, but this functionality is not supported in theĆ­s framework.

safeOp 

Safe-operational state.

PDO inputs (data from the slaves) can be updated, but no data can be sent vie PDOs to the slaves.

op 

Operational state.

Both PDO inputs and outputs can be updated.

safeOpError 

Safe-operational state after an error has happend.

Definition at line 31 of file EtherCATState.h.

Constructor & Destructor Documentation

◆ EtherCATState() [1/3]

EtherCATState ( )
default

◆ EtherCATState() [2/3]

constexpr EtherCATState ( Value  state)
inlineconstexpr

Construct a new EtherCATState from another EtherCATState.

Definition at line 58 of file EtherCATState.h.

◆ EtherCATState() [3/3]

constexpr EtherCATState ( std::uint16_t  state)
inlineconstexpr

Construct a new EtherCATState from a std::uint16_t (e.g.

a state value provided by SOEM).

Definition at line 65 of file EtherCATState.h.

Member Function Documentation

◆ c_str()

constexpr const char* c_str ( ) const
inlineconstexpr
Returns
A string representation of this EtherCATState.

Definition at line 87 of file EtherCATState.h.

◆ operator bool()

operator bool ( )
explicitdelete

Delete bool-operator to prevent usages like if(state) which does not make sense in this context and might lead to unexpected behaviour if being allowed to use.

◆ operator Value()

operator Value ( ) const
inline

Returns the wrapped enum value.

Definition at line 72 of file EtherCATState.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const EtherCATState rhs 
)
friend

Definition at line 110 of file EtherCATState.h.


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