OpenLCB Consumer class integrating a simple CDI-based configuration for two event IDs, and an output GPIO object that will be turned on or off depending on the incoming event notifications.
More...
#include <ConfiguredConsumer.hxx>
OpenLCB Consumer class integrating a simple CDI-based configuration for two event IDs, and an output GPIO object that will be turned on or off depending on the incoming event notifications.
This is usually the most important object for a simple IO node.
Definition at line 87 of file ConfiguredConsumer.hxx.
◆ Impl
◆ ConfiguredConsumer() [1/2]
| openlcb::ConfiguredConsumer::ConfiguredConsumer |
( |
Node * |
node, |
|
|
const ConsumerConfig & |
cfg, |
|
|
const Gpio * |
gpio |
|
) |
| |
|
inline |
◆ ConfiguredConsumer() [2/2]
template<class HW >
| openlcb::ConfiguredConsumer::ConfiguredConsumer |
( |
Node * |
node, |
|
|
const ConsumerConfig & |
cfg, |
|
|
const HW & |
, |
|
|
const Gpio * |
g = HW::instance(), |
|
|
decltype(HW::instance) * |
= 0 |
|
) |
| |
|
inline |
◆ apply_configuration()
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.
- Parameters
-
| 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. |
- Returns
- any necessary action. If returns UPDATED, then assumes that the configuration change was applied. If returns RETRY, then the same call will be made again after the notifiable is called. If return REINIT_NEEDED or REBOOT_NEEDED then at the end of the configuration update process the node will be reinitialized or rebooted accordingly.
Implements ConfigUpdateListener.
Definition at line 109 of file ConfiguredConsumer.hxx.
◆ factory_reset()
| void openlcb::ConfiguredConsumer::factory_reset |
( |
int |
fd | ) |
|
|
inlinevirtual |
Clears configuration file and resets the configuration settings to factory value.
- Parameters
-
| 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 132 of file ConfiguredConsumer.hxx.
◆ cfg_
| const ConsumerConfig openlcb::ConfiguredConsumer::cfg_ |
|
private |
◆ consumer_
◆ impl_
| Impl openlcb::ConfiguredConsumer::impl_ |
|
private |
The documentation for this class was generated from the following file: