|
virtual | ~Device ()=default |
| Virtual destructor for Device interface. More...
|
|
virtual uint8_t | getState (const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(3000))=0 |
| Reads and returns the current state of the device. More...
|
|
virtual bool | setState (uint8_t state, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(3000))=0 |
| Sets the device to a specified state. More...
|
|
virtual std::vector< uint8_t > | readFile (const std::string &filename, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0 |
| Reads the contents of a file from the device. More...
|
|
virtual bool | writeFile (const std::string &filename, const std::vector< uint8_t > &data, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0 |
| Sends a file to the device. More...
|
|
virtual void | loadParameters (bool readValues, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(9000))=0 |
| Loads parameters from the device and stores them locally. More...
|
|
virtual void | clearParameters ()=0 |
| Clears all loaded object dictionary parameters. More...
|
|
virtual Parameter & | findParameter (uint16_t index, uint8_t subindex)=0 |
| Finds and returns a reference to a parameter by its index and subindex. More...
|
|
virtual Parameter & | upload (uint16_t index, uint8_t subindex, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0 |
| Uploads a parameter from the device via SDO and updates the local parameter store. More...
|
|
virtual void | download (uint16_t index, uint8_t subindex, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0 |
| Downloads a parameter to the device using SDO communication. More...
|
|
virtual void | download (uint16_t index, uint8_t subindex, const ParameterValue &value, const std::chrono::steady_clock::duration expiryTime=std::chrono::milliseconds(5000))=0 |
| Sets a parameter value in the local store and downloads it to the device. More...
|
|
virtual void | exchangeProcessDataAndUpdateParameters ()=0 |
| Exchanges process data with the remote device and updates local parameters accordingly. More...
|
|
Abstract interface representing a generic device.
This class defines the virtual interface for device operations such as state management, parameter handling, and file transfer. All methods are pure virtual and must be implemented by derived classes.
virtual void common::Device::download |
( |
uint16_t |
index, |
|
|
uint8_t |
subindex, |
|
|
const ParameterValue & |
value, |
|
|
const std::chrono::steady_clock::duration |
expiryTime = std::chrono::milliseconds(5000) |
|
) |
| |
|
pure virtual |
Sets a parameter value in the local store and downloads it to the device.
This function updates the specified parameter in the local store with the provided value, serializes it, and then performs an SDO download to transfer the data to the device.
- Parameters
-
index | The 16-bit index of the parameter in the object dictionary. |
subindex | The 8-bit subindex of the parameter. |
value | The new parameter value to set and download. |
expiryTime | The maximum duration to wait for the SDO download operation to complete. |
- Exceptions
-
std::runtime_error | If the parameter data is empty after setting the value, or if the SDO download operation fails. |
Implemented in EthernetDevice.
virtual Parameter & common::Device::findParameter |
( |
uint16_t |
index, |
|
|
uint8_t |
subindex |
|
) |
| |
|
pure virtual |
Finds and returns a reference to a parameter by its index and subindex.
This function looks up a parameter in the internal parameter map using the specified index and subindex. If the parameter is found, a reference to it is returned. If not, a runtime exception is thrown.
- Parameters
-
index | The index of the parameter to find. |
subindex | The subindex of the parameter to find. |
- Returns
- Reference to the found parameter.
- Exceptions
-
std::runtime_error | If the parameter with the specified index and subindex is not found in the map. |
Implemented in EthernetDevice.
virtual Parameter & common::Device::upload |
( |
uint16_t |
index, |
|
|
uint8_t |
subindex, |
|
|
const std::chrono::steady_clock::duration |
expiryTime = std::chrono::milliseconds(5000) |
|
) |
| |
|
pure virtual |
Uploads a parameter from the device via SDO and updates the local parameter store.
This function reads a parameter value from the device using SDO communication, updates the corresponding local Parameter
object with the received value, and returns a reference to it.
- Parameters
-
index | The 16-bit parameter index in the object dictionary. |
subindex | The 8-bit subindex of the parameter. |
expiryTime | The maximum duration to wait for the SDO upload operation to complete. |
- Returns
- Reference to the updated local
common::Parameter
object.
- Exceptions
-
std::runtime_error | If the upload fails or returns an empty payload. |
Implemented in EthernetDevice, and EthernetDevice.