|
Motion Master
|
Concrete refresher that uploads parameters from a device. More...
#include <spoe.h>


Public Member Functions | |
| DeviceParameterRefresher (mm::comm::base::Device &device, std::chrono::milliseconds interval) | |
| Public Member Functions inherited from mm::comm::base::DeviceParameterRefresher | |
| DeviceParameterRefresher (Device &device, std::chrono::milliseconds intervalBetweenUploads) | |
| Constructor initializes the refresher with a device reference and upload interval. | |
| ~DeviceParameterRefresher () | |
| Destructor ensures the refresher thread is stopped cleanly. | |
| void | add (uint16_t index, uint8_t subindex) |
| Add a parameter identified by (index, subindex) to the refresh list. | |
| void | remove (uint16_t index, uint8_t subindex) |
| Remove a parameter identified by (index, subindex) from the refresh list. | |
| void | clear () |
| Remove all parameters from the refresh list. | |
| void | start () |
| Starts the refresher background thread if it is not already running. | |
| void | stop () |
| Stops the refresher background thread if it is running. | |
| void | triggerManualRefresh (bool async=false) |
| Triggers a manual refresh of device parameters. | |
Protected Member Functions | |
| void | refresh (const std::vector< mm::comm::base::Parameter::Address > &addresses) override |
| Rereads the specified device parameters in a single message exchange. | |
Additional Inherited Members | |
| Protected Attributes inherited from mm::comm::base::DeviceParameterRefresher | |
| std::chrono::milliseconds | interval_ |
| Time to wait between consecutive parameter uploads. | |
| std::condition_variable | cv_ |
| Condition variable used to notify the worker thread. | |
| std::mutex | mutex_ |
| Mutex protecting access to shared data members. | |
| std::vector< Parameter::Address > | addresses_ |
| List of parameter addresses to refresh. | |
| Device & | device_ |
| Reference to the device instance used for uploading. | |
| bool | running_ |
| Flag indicating whether the refresher thread is running. | |
| std::thread | worker_ |
| The background thread performing periodic uploads. | |
Concrete refresher that uploads parameters from a device.
This class derives from mm::comm::DeviceParameterRefresher and implements the refresh() method to handle parameter uploads in bulk over SPoE.
The refresh() method is called by the base class's worker thread. It receives a snapshot of the current parameters and performs a single bulk upload operation, which is more efficient for SPoE-based devices than uploading parameters one by one.
| mm::comm::spoe::DeviceParameterRefresher::DeviceParameterRefresher | ( | mm::comm::base::Device & | device, |
| std::chrono::milliseconds | interval ) |
|
overrideprotectedvirtual |
Rereads the specified device parameters in a single message exchange.
This method is automatically called by the base class in a background thread. The implementation should handle uploading all parameters using the SPoE-specific protocol (readSdoBatch).
The refresh operation is performed only if the device is in a state that permits parameter reading—namely:
| addresses | A snapshot of the current parameter addresses (index and subindex pairs) to be uploaded. |
Implements mm::comm::base::DeviceParameterRefresher.