|
Open Model Railroad Network (OpenMRN)
|
Abstract class for components that need to receive configuration from EEPROM. More...
#include <ConfigUpdateListener.hxx>
Public Types | |
| enum | UpdateAction { UPDATED = 0 , REINIT_NEEDED , REBOOT_NEEDED } |
| Specifies what additional steps are needed to apply the new configuration. More... | |
Public Member Functions | |
| virtual UpdateAction | apply_configuration (int fd, bool initial_load, BarrierNotifiable *done)=0 |
| Notifies the component that there is new configuration available for loading. | |
| virtual void | factory_reset (int fd)=0 |
| Clears configuration file and resets the configuration settings to factory value. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Additional Inherited Members | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
Abstract class for components that need to receive configuration from EEPROM.
Configuration update comes in two flavors: initial load and refresh (upon potential change). Each configuration update call supplies the file desriptor of the EEPROM file, which is already opened for reading.
Config listeners provide feedback to the system in two forms: they notify the system in case the configuration change can be applied only with a reboot of the hardware node, or whether an application-level reinitialization sequence is needed.
Definition at line 51 of file ConfigUpdateListener.hxx.
Specifies what additional steps are needed to apply the new configuration.
Definition at line 56 of file ConfigUpdateListener.hxx.
|
pure virtual |
Notifies the component that there is new configuration available for loading.
The call is made on the main executor, so the call must not block. Reading the given EEPROM device should be fine. Asynchronous operations may be implemented by using a special return status RETRY: the runner will call the same method on the same component once more after the done callback is invoked. This allows implementing state machines.
| fd | is the file descriptor for the EEPROM file. The current offset in this file is unspecified, callees must do lseek. |
| initial_load | is true if this is the first load upon starting the binary. |
| done | must be notified when the call and its dependent actions are complete. No other configuration component will be called until the done callback is invoked. |
Implemented in openmrn_arduino::Esp32WiFiManager, openlcb::ConfiguredConsumer, openlcb::ConfiguredPulseConsumer, openlcb::ConfiguredProducer, and openlcb::ServoConsumer.
|
pure virtual |
Clears configuration file and resets the configuration settings to factory value.
| fd | is the file descriptor for the EEPROM file. The current offset in this file is unspecified, callees must do lseek. |
Implemented in openmrn_arduino::Esp32WiFiManager, openlcb::ConfiguredConsumer, openlcb::ConfiguredPulseConsumer, openlcb::ConfiguredProducer, and openlcb::ServoConsumer.