Motion Master
|
#include <ethercat_slave.h>
Public Types | |
enum class | State : uint8_t { kUnspecified = 0 , kInit = 1 , kPreOp = 2 , kBoot = 3 , kSafeOp = 4 , kOp = 8 } |
enum class | FoeError { kNotFound = 0x00008001 , kAccessDenied = 0x00008002 , kDiskFull = 0x00008003 , kIllegal = 0x00008004 , kPacketNumberWrong = 0x00008005 , kAlreadyExists = 0x00008006 , kNoUser = 0x00008007 , kBootstrapOnly = 0x00008008 , kNotBootstrap = 0x00008009 , kNoRights = 0x0000800a , kProgramError = 0x0000800b } |
![]() | |
enum class | Protocol { kUnspecified = 0 , kMock , kEcat , kSerial } |
enum class | Type { kUnspecified = 0 , kCia402Drive , kDigitalIo } |
Public Member Functions | |
EthercatSlave () | |
EthercatSlave (EthercatSlave const &) | |
~EthercatSlave () | |
uint16_t | get_device_id () const override |
Get the ID (absolute position) of the EtherCAT slave in the EtherCAT chain. More... | |
uint16_t | get_hardware_id () const override |
Get the hardware ID. More... | |
Protocol | get_protocol () const override |
Get the protocol the device uses. More... | |
Type | get_device_type () const override |
Get the device type. More... | |
std::list< VirtualParameter * > | get_all_virtual_parameters () override |
Get all configuration parameters from a slave. More... | |
VirtualParameter * | get_virtual_parameter (uint16_t index, uint8_t subindex) override |
Get a configuration parameter by its index/subindex. More... | |
std::variant< MotionMasterError, std::list< std::string > > | get_file_list () override |
Get the list of available files on the device. More... | |
std::variant< MotionMasterError, std::vector< uint8_t > > | read_file (const std::string &file_name) override |
Return the raw content (bytes) of the requested file from the flash memory. More... | |
MotionMasterError | write_file (const std::string &file_name, const std::vector< uint8_t > &content, std::function< void(uint8_t)> progress_callback) override |
Write raw content (bytes) into a file in the flash memory. More... | |
MotionMasterError | remove_file (const std::string &file_name) override |
Remove a file from the flash memory. More... | |
virtual bool | has_firmware () |
Check if the slave has a firmware installed. More... | |
bool | is_operational () const override |
Request the current slave state. More... | |
virtual bool | has_pdos () |
Check if PDO mapping is available. More... | |
virtual State | get_state (bool force_refresh) const |
Get the slave EtherCAT state. More... | |
virtual bool | set_state (State state, uint32_t timeout_ms=10000) |
Change the EtherCAT state of the slave. More... | |
virtual MotionMasterError | write_sii (const std::vector< uint8_t > &content) |
Write the SII file content onto an EtherCAT slave. More... | |
virtual void | update_pdo_mapping_od () |
virtual void | receive_pdos (const uint8_t *process_data) |
virtual void | send_pdos (const uint8_t *process_data) |
virtual bool | request_state_switch (State state) |
![]() | |
virtual | ~VirtualDevice ()=default |
virtual uint16_t | get_device_id () const =0 |
Get the device ID. More... | |
virtual uint16_t | get_hardware_id () const =0 |
Get the hardware ID. More... | |
virtual Protocol | get_protocol () const |
Get the protocol the device uses. More... | |
virtual Type | get_device_type () const |
Get the device type. More... | |
virtual std::list< VirtualParameter * > | get_all_virtual_parameters ()=0 |
Get all available configuration parameters on the virtual device. More... | |
virtual VirtualParameter * | get_virtual_parameter (uint16_t index, uint8_t subindex)=0 |
Get a configuration parameter. More... | |
virtual std::variant< MotionMasterError, std::list< std::string > > | get_file_list ()=0 |
Get the list of available files on the device. More... | |
virtual std::variant< MotionMasterError, std::vector< uint8_t > > | read_file (const std::string &file_name)=0 |
Get the file content from a file from the flash memory. More... | |
virtual MotionMasterError | write_file (const std::string &file_name, const std::vector< uint8_t > &content, std::function< void(uint8_t)> progress_callback)=0 |
Write the file to the flash memory. More... | |
virtual MotionMasterError | remove_file (const std::string &file_name)=0 |
Remove the file from the flash memory. More... | |
virtual bool | is_operational () const =0 |
Check if the device is operational. More... | |
Public Attributes | |
uint16_t | obytes = 0 |
uint16_t | ibytes = 0 |
Static Public Attributes | |
static const std::map< State, std::map< State, State > > | ecat_state_machine_table_ |
static const std::map< FoeError, std::string > | foe_error_messages_ |
![]() | |
static const std::map< std::pair< uint32_t, uint32_t >, Type > | device_type_map_ |
|
strong |
|
strong |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Get all configuration parameters from a slave.
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
Get the ID (absolute position) of the EtherCAT slave in the EtherCAT chain.
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Get the list of available files on the device.
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
|
inlinevirtual |
|
inlineoverridevirtual |
Get a configuration parameter by its index/subindex.
index | |
subindex |
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlinevirtual |
Check if the slave has a firmware installed.
Reimplemented in SoemSlave.
|
inlinevirtual |
Check if PDO mapping is available.
Try to fetch all of the OD entries that define the PDO mapping
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
Request the current slave state.
force_refresh | force refresh the state of the slave first |
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
Return the raw content (bytes) of the requested file from the flash memory.
file_name |
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlinevirtual |
Reimplemented in SoemSlave.
|
inlineoverridevirtual |
Remove a file from the flash memory.
file_name |
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlinevirtual |
Reimplemented in SoemSlave.
|
inlinevirtual |
Reimplemented in SoemSlave.
|
inlinevirtual |
Change the EtherCAT state of the slave.
state | EtherCAT state to switch the slave to |
timeout_ms | Timeout in ms, or how long to poll the state, default value is 10000 |
Reimplemented in SoemSlave.
|
inlinevirtual |
|
inlineoverridevirtual |
Write raw content (bytes) into a file in the flash memory.
file_name | |
content | vector of bytes |
progress_callback | function to call for progress changes |
Implements VirtualDevice.
Reimplemented in SoemSlave.
|
inlinevirtual |
Write the SII file content onto an EtherCAT slave.
content content as a vector of bytes
Reimplemented in SoemSlave.
|
inlinestatic |
Table of intermediate EtherCAT states for the EtherCAT state machine
Switch the slave into each intermediate state from the current state, until the target state has been reached.
<current_state, <target_state, intermediate_state>>
|
inlinestatic |
uint16_t EthercatSlave::ibytes = 0 |
uint16_t EthercatSlave::obytes = 0 |