14class IghEthercatMaster;
19 friend class IghEthercatMaster;
21 explicit IghEthercatSlave(IghEthercatMaster &master);
23 ~IghEthercatSlave()
override {};
66 uint16_t
index, uint8_t subindex)
override;
74 [[nodiscard]] std::variant<MotionMasterError, std::list<std::string>>
85 [[nodiscard]] std::variant<MotionMasterError, std::vector<uint8_t>>
read_file(
86 const std::string &file_name)
override;
98 const std::string &file_name,
const std::vector<uint8_t> &content,
99 std::function<
void(uint8_t)> progress_callback)
override;
134 [[nodiscard]]
bool has_pdos()
override;
141 [[nodiscard]] State
get_state(
bool force_refresh)
const override;
154 bool set_state(State state, uint32_t timeout_ms = 1000)
override;
182 void receive_pdos(
const uint8_t *process_data)
override;
189 void send_pdos(
const uint8_t *process_data)
override;
194 explicit Pdo(IghOdEntry *od_entry, ec_direction_t dir)
195 : od_entry_(od_entry), dir_(dir) {}
197 [[nodiscard]]
bool is_valid()
const {
198 return od_entry_ && dir_ != EC_DIR_INVALID;
201 IghOdEntry *od_entry_ =
nullptr;
202 ec_direction_t dir_ = EC_DIR_INVALID;
203 unsigned int offset_ = 0;
204 unsigned int bit_offset_ = 0;
208 IghEthercatMaster &master_;
212 uint16_t reference_alias_ = 0;
215 uint16_t relative_position_ = 0;
221 uint16_t hardware_id_ = 0;
224 ec_slave_info_t slave_info_{};
225 ec_slave_config_t *slave_config_ =
nullptr;
227 std::map<uint16_t, std::vector<ec_pdo_entry_info_t>> rx_pdo_map_;
228 std::vector<ec_pdo_info_t> rx_pdos_;
229 std::map<uint16_t, std::vector<ec_pdo_entry_info_t>> tx_pdo_map_;
230 std::vector<ec_pdo_info_t> tx_pdos_;
231 std::vector<ec_sync_info_t> syncs_;
234 ec_slave_config_state_t slave_config_state_{};
236 std::list<Pdo> pdos_;
238 std::map<uint32_t, IghOdEntry> od_entry_map_;
240 static inline std::vector<std::string> files_to_cache_ = {
244 std::map<std::string, std::vector<uint8_t>> cached_files_;
Definition: ethercat_slave.h:11
virtual bool has_pdos()
Check if PDO mapping is available.
Definition: ethercat_slave.h:230
std::variant< MotionMasterError, std::list< std::string > > get_file_list() override
Get the list of available files on the device.
Definition: ethercat_slave.h:163
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.
Definition: ethercat_slave.h:189
VirtualParameter * get_virtual_parameter(uint16_t index, uint8_t subindex) override
Get a configuration parameter by its index/subindex.
Definition: ethercat_slave.h:151
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.
Definition: ethercat_slave.h:175
virtual State get_state(bool force_refresh) const
Get the slave EtherCAT state.
Definition: ethercat_slave.h:237
virtual void send_pdos(const uint8_t *process_data)
Definition: ethercat_slave.h:270
std::list< VirtualParameter * > get_all_virtual_parameters() override
Get all configuration parameters from a slave.
Definition: ethercat_slave.h:137
virtual void update_pdo_mapping_od()
Definition: ethercat_slave.h:268
virtual MotionMasterError write_sii(const std::vector< uint8_t > &content)
Write the SII file content onto an EtherCAT slave.
Definition: ethercat_slave.h:264
MotionMasterError remove_file(const std::string &file_name) override
Remove a file from the flash memory.
Definition: ethercat_slave.h:202
virtual void receive_pdos(const uint8_t *process_data)
Definition: ethercat_slave.h:269
virtual bool request_state_switch(State state)
Definition: ethercat_slave.h:271
uint16_t get_device_id() const override
Get the ID (absolute position) of the EtherCAT slave in the EtherCAT chain.
Definition: ethercat_slave.h:104
virtual bool has_firmware()
Check if the slave has a firmware installed.
Definition: ethercat_slave.h:212
virtual bool set_state(State state, uint32_t timeout_ms=10000)
Change the EtherCAT state of the slave.
Definition: ethercat_slave.h:253
bool is_operational() const override
Request the current slave state.
Definition: ethercat_slave.h:221
Type get_device_type() const override
Get the device type.
Definition: ethercat_slave.h:127
uint16_t get_hardware_id() const override
Get the hardware ID.
Definition: ethercat_slave.h:111
Definition: motion_master_error.h:6
Definition: virtual_parameter.h:9
uint16_t index
Definition: co_dictionary.h:0
const char *const HARDWARE_DESCRIPTION_FILENAME
Definition: util.h:25
const char *const STACK_INFO_FILENAME
Definition: util.h:26