#include <ethernet_master.h>
◆ EthernetMaster()
EthernetMaster::EthernetMaster |
( |
Notifier & |
notifier, |
|
|
const std::vector< std::string > |
ipAddresses |
|
) |
| |
|
explicit |
◆ ~EthernetMaster()
EthernetMaster::~EthernetMaster |
( |
| ) |
|
|
override |
◆ abort_all_client_requests()
void EthernetMaster::abort_all_client_requests |
( |
| ) |
|
|
inlineoverridevirtual |
◆ disable_all_slaves()
bool EthernetMaster::disable_all_slaves |
( |
| ) |
|
|
overridevirtual |
Switch all slaves to PREOP.
- Attention
- Must be implemented as non-blocking!
- Returns
- true on success, false otherwise
Implements EthercatMaster.
◆ execute()
int32_t EthernetMaster::execute |
( |
uint64_t |
pending_signals | ) |
|
|
overridevirtual |
Main EtherCAT master loop function to be executed at one millisecond interval.
- Returns
- error if any
Implements EthercatMaster.
◆ get_slaves()
Get all of the available slaves.
- Returns
- map of available slaves
Implements EthercatMaster.
◆ get_slaves_responding()
int EthernetMaster::get_slaves_responding |
( |
| ) |
|
|
overridevirtual |
Return the number of slaves actually responding on the bus.
- Returns
- number of responding slaves
Implements EthercatMaster.
◆ is_running()
bool EthernetMaster::is_running |
( |
| ) |
|
|
overridevirtual |
Check if the EtherCAT master is currently running.
- Returns
- true if currently running, false otherwise
Implements EthercatMaster.
◆ restart()
size_t EthernetMaster::restart |
( |
| ) |
|
|
overridevirtual |
Returns the number of EtherCAT slaves during a restart.
A restart is triggered when transitioning from PRE-OP to OP, typically due to updated PDO mappings on a device.
- Returns
- Current EtherCAT slave count.
Implements EthercatMaster.
◆ start()
size_t EthernetMaster::start |
( |
| ) |
|
|
overridevirtual |
Start the EtherCAT master.
- Returns
- the number of initially responding slaves
Implements EthercatMaster.
◆ stop()
void EthernetMaster::stop |
( |
| ) |
|
|
overridevirtual |
◆ wait_for_slaves()
void EthernetMaster::wait_for_slaves |
( |
Notifier & |
notifier, |
|
|
const std::vector< std::string > |
ipAddresses |
|
) |
| |
|
static |
◆ slaveMap
std::map< uint16_t, std::unique_ptr< EthercatSlave > > EthernetMaster::slaveMap {} |
|
static |
Static map of EtherCAT slave instances.
The slaveMap
is declared static because other components of the system, such as ParameterValueRefresher
, may hold raw pointers to instances of EthercatSlave
(retrieved via SoemMaster::get_slaves()
).
If slaveMap
were a non-static member of SoemMaster
, it would be destroyed when the SoemMaster
instance goes out of scope. Since slaveMap
holds std::unique_ptr
s, this would also delete the associated slave objects and their Object Dictionary (OD) entries. Consequently, any component still holding raw pointers to those objects would be left with dangling references, leading to undefined behavior.
Declaring slaveMap
as static ensures that these instances persist beyond the lifetime of a single SoemMaster
instance, preventing invalid memory access.
The documentation for this class was generated from the following files: