Motion Master
Loading...
Searching...
No Matches
soem.cc File Reference
#include "soem.h"
#include <tl/expected.hpp>
#include <algorithm>
#include <chrono>
#include <cstring>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <stdexcept>
#include <string>
#include <thread>
#include <unordered_map>
#include <utility>
#include <vector>
#include "base.h"
#include "core/util.h"
Include dependency graph for soem.cc:

Namespaces

namespace  mm
namespace  mm::comm
namespace  mm::comm::soem

Functions

std::map< std::string, std::string > mm::comm::soem::mapMacAddressesToInterfaces ()
 Maps MAC addresses to their corresponding network interface names.
SlaveInfo mm::comm::soem::getSlaveInfo (ecx_contextt *context, uint16 position)
void mm::comm::soem::logSlaveInfo (ecx_contextt *context, uint16 position)
 Logs detailed information about a specific EtherCAT slave in JSON format.
int mm::comm::soem::setPdoMappingFromUiConfig (ecx_contextt *context, uint16 slave)
 Sets PDO mapping for a specified EtherCAT slave using UI configuration.
void mm::comm::soem::checkPdoMapping (ecx_contextt *context, uint16 slave)
 Diagnoses and prints the PDO mapping for a given slave.
uint16_t mm::comm::soem::getSlaveState (ecx_contextt *context, uint16_t slave)
 Reads the current state of a specific EtherCAT slave directly from the device via an FPRD datagram.
std::string mm::comm::soem::convertSlaveStateToString (int state)
 Converts a numeric EtherCAT state value into a human-readable string.
void mm::comm::soem::transitionSlaves (ecx_contextt *context, const std::vector< uint16_t > &positions, uint16_t requiredState, uint16_t targetState, const char *targetName, std::chrono::steady_clock::duration timeout, std::chrono::steady_clock::duration resendInterval=std::chrono::seconds(2))
 Transitions multiple EtherCAT slaves to a target state using a single-threaded fire-then-poll pattern safe for use with SOEM's fixed-size frame buffer (EC_MAXBUF=16).
bool mm::comm::soem::setSlaveState (ecx_contextt *context, uint16_t slave, uint16_t targetState, std::chrono::steady_clock::duration timeout=std::chrono::seconds(5))
 Transitions a single EtherCAT slave to targetState.
void mm::comm::soem::updateMailboxSyncManagersOnNextState (ecx_contextt *context, uint16_t slave, int targetState)
 Updates the mailbox and sync manager (SM) configurations for an EtherCAT slave when transitioning to specific states (e.g., BOOT or INIT).
void mm::comm::soem::configureDetectedSmmModule (ecx_contextt *context, uint16_t slave)
 Reads the detected SMM module ID from the slave device and configures the module identification object accordingly.
std::vector< uint8_t > mm::comm::soem::readSii (ecx_contextt *context, uint16 position)
 Read the complete Slave Information Interface (SII) EEPROM from an EtherCAT slave device.
mm::comm::base::PdoMappings mm::comm::soem::readPdoMappings (ecx_contextt *context, uint16_t slave)
 Read and parse all mapped PDO entries for a given slave.
void mm::comm::soem::logPdoMappingEntries (const std::vector< mm::comm::base::PdoMappingEntry > &entries)
 Logs PDO mapping entries grouped by PDO index.
void mm::comm::soem::logIoMap (uint8_t *ioMap, size_t totalBytes)
 Logs the I/O map as a formatted hexadecimal string.
void mm::comm::soem::initFieldbus (std::unique_ptr< Fieldbus > &fieldbus, const std::string &iface)
 Initializes a Fieldbus instance for EtherCAT communication.