|
Open Model Railroad Network (OpenMRN)
|
OpenLCB Producer class integrating a simple CDI-based configuration for two event IDs, and an input GPIO object whose value will determine when to produce events. More...
#include <ConfiguredProducer.hxx>
Public Types | |
| using | Impl = GPIOBit |
| using | ProducerClass = PolledProducer< QuiesceDebouncer, Impl > |
Public Types inherited from ConfigUpdateListener | |
| enum | UpdateAction { UPDATED = 0 , REINIT_NEEDED , REBOOT_NEEDED } |
| Specifies what additional steps are needed to apply the new configuration. More... | |
Public Member Functions | |
| ConfiguredProducer (Node *node, const ProducerConfig &cfg, const Gpio *gpio) | |
| template<class HW > | |
| ConfiguredProducer (Node *node, const ProducerConfig &cfg, const HW &, const Gpio *g=HW::instance(), decltype(HW::instance) *=0) | |
| UpdateAction | apply_configuration (int fd, bool initial_load, BarrierNotifiable *done) override |
| Notifies the component that there is new configuration available for loading. | |
| void | factory_reset (int fd) OVERRIDE |
| Clears configuration file and resets the configuration settings to factory value. | |
| Polling * | polling () |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Private Attributes | |
| ProducerClass | producer_ |
| const ProducerConfig | cfg_ |
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 | |
OpenLCB Producer class integrating a simple CDI-based configuration for two event IDs, and an input GPIO object whose value will determine when to produce events.
This is usually the most important object for a simple IO node.
Usage: Must be called repeatedly via the Polling implementation exposed by polling(). Use for example the RefreshLoop class and supply the polling argument at the constructor to it:
openlcb::RefreshLoop loop( stack.node(), {producer_sw1.polling(), producer_sw2.polling()});
Definition at line 95 of file ConfiguredProducer.hxx.
Definition at line 98 of file ConfiguredProducer.hxx.
Definition at line 99 of file ConfiguredProducer.hxx.
|
inline |
Definition at line 101 of file ConfiguredProducer.hxx.
|
inline |
Definition at line 109 of file ConfiguredProducer.hxx.
|
inlineoverridevirtual |
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. |
Implements ConfigUpdateListener.
Definition at line 117 of file ConfiguredProducer.hxx.
|
inlinevirtual |
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. |
Implements ConfigUpdateListener.
Definition at line 140 of file ConfiguredProducer.hxx.
|
inline |
Definition at line 146 of file ConfiguredProducer.hxx.
|
private |
Definition at line 153 of file ConfiguredProducer.hxx.
|
private |
Definition at line 152 of file ConfiguredProducer.hxx.