47 fd_ = ::open(path, O_RDWR);
60 it->factory_reset(fd_);
65 it->factory_reset(fd_);
85 if (it.operator->() == listener)
94 if (it.operator->() == listener)
105extern const char *
const CONFIG_FILENAME __attribute__((weak)) =
nullptr;
#define STATE(_fn)
Turns a function name into an argument to be supplied to functions expecting a state.
See OSMutexLock in os/OS.hxx.
Abstract class for components that need to receive configuration from EEPROM.
void erase(const iterator &position)
Removes the entry pointed to by the iterator.
Action exit()
Terminate current StateFlow activity.
void start_flow(Callback c)
Resets the flow to the specified state and starts it.
bool is_state(Callback c)
void push_front(T *entry)
Inserts an entry to the front of the queue.
int open_file(const char *path)
Must be called once (only) before calling anything else.
queue_type pendingListeners_
All listeners that have not yet been added to listeners_ and their initial load needs to be called.
void trigger_update() override
Executes an update in response to the configuration having changed.
queue_type listeners_
All registered update listeners. Protected by Atomic *this.
void init_flow()
Asynchronously invokes all update listeners with the config FD.
void register_update_listener(ConfigUpdateListener *listener) override
Adds a config update listener to be called upon configuration updates.
void unregister_update_listener(ConfigUpdateListener *listener) override
Removes a config update listener.
void factory_reset()
Synchronously invokes all update listeners to factory reset.
queue_type::iterator nextRefresh_
Where are we in the refresh cycle.
#define HASSERT(x)
Checks that the value of expression x is true, else terminates the current process.
const char *const CONFIG_FILENAME
This symbol must be defined by the application to tell which file to open for the configuration liste...
const size_t CONFIG_FILE_SIZE
This symbol must be defined by the application.