Motion Master
Loading...
Searching...
No Matches
ethernet_slave.h
Go to the documentation of this file.
1#include <string>
2#include <utility>
3
4#include "comm/spoe.h"
5#include "ethercat_slave.h"
6#include "ethernet_od_entry.h"
7
8class EthernetSlave : public EthercatSlave {
9 Type type_;
10 uint16_t hardware_id_;
11 std::map<uint32_t, EthernetOdEntry> od_entry_map_;
12
14
16 EthernetSlave(const std::pair<std::string, uint16_t>& endpoint,
17 uint16_t position);
18
19 public:
22 explicit EthernetSlave(const std::string& endpoint, uint16_t position);
23
24 ~EthernetSlave() override;
25
27
28 [[nodiscard]] uint16_t get_device_id() const override;
29
30 [[nodiscard]] uint16_t get_hardware_id() const override;
31
32 [[nodiscard]] Type get_device_type() const override;
33
34 [[nodiscard]] std::list<VirtualParameter*> get_all_virtual_parameters()
35 override;
36
37 [[nodiscard]] bool has_virtual_parameters() override;
38
40 uint16_t index, uint8_t subindex) override;
41
42 [[nodiscard]] std::variant<MotionMasterError, std::list<std::string>>
43 get_file_list() override;
44
45 [[nodiscard]] std::variant<MotionMasterError, std::vector<uint8_t>> read_file(
46 const std::string& file_name) override;
47
49 const std::string& file_name, const std::vector<uint8_t>& content,
50 std::function<void(uint8_t)> progress_callback) override;
51
52 MotionMasterError remove_file(const std::string& file_name) override;
53
54 bool has_firmware() override;
55
56 [[nodiscard]] bool is_operational() const override;
57
58 bool is_supported();
59
60 [[nodiscard]] bool has_pdos() override;
61
62 [[nodiscard]] State get_state(bool force_refresh) const override;
63
64 bool set_state(State state, uint32_t timeout_ms = 5000) override;
65};
State
Definition ethercat_slave.h:18
EthercatSlave()
Definition ethercat_slave.h:12
uint16_t get_device_id() const override
Get the ID (absolute position) of the EtherCAT slave in the EtherCAT chain.
Definition ethernet_slave.cc:89
bool is_supported()
Definition ethernet_slave.cc:176
VirtualParameter * get_virtual_parameter(uint16_t index, uint8_t subindex) override
Get a configuration parameter by its index/subindex.
Definition ethernet_slave.cc:105
bool has_firmware() override
Check if the slave has a firmware installed.
Definition ethernet_slave.cc:169
bool has_pdos() override
Check if PDO mapping is available.
Definition ethernet_slave.cc:178
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 ethernet_slave.cc:127
std::variant< MotionMasterError, std::list< std::string > > get_file_list() override
Get the list of available files on the device.
Definition ethernet_slave.cc:117
State get_state(bool force_refresh) const override
Get the slave EtherCAT state.
Definition ethernet_slave.cc:180
uint16_t get_hardware_id() const override
Get the hardware ID.
Definition ethernet_slave.cc:91
bool set_state(State state, uint32_t timeout_ms=5000) override
Change the EtherCAT state of the slave.
Definition ethernet_slave.cc:185
~EthernetSlave() override
Definition ethernet_slave.cc:81
bool is_operational() const override
Request the current slave state.
Definition ethernet_slave.cc:171
std::list< VirtualParameter * > get_all_virtual_parameters() override
Get all configuration parameters from a slave.
Definition ethernet_slave.cc:95
mm::comm::spoe::Device & getDevice()
Definition ethernet_slave.cc:87
Type get_device_type() const override
Get the device type.
Definition ethernet_slave.cc:93
bool has_virtual_parameters() override
Definition ethernet_slave.cc:103
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 ethernet_slave.cc:139
MotionMasterError remove_file(const std::string &file_name) override
Remove a file from the flash memory.
Definition ethernet_slave.cc:159
Definition motion_master_error.h:6
Type
Definition virtual_device.h:26
Definition virtual_parameter.h:9
Handles TCP communication with SOMANET devices over SPoE.
Definition spoe.h:302
uint16_t index
Definition co_dictionary.h:0