#ifndef NL_APP_H #define NL_APP_H #include #include "config/nl_settings.h" void nl_app_lock(void); void nl_app_unlock(void); uint32_t nl_app_now_ms(void); nl_settings_t *nl_app_settings(void); /* Copies the settings under the app lock and writes them under the store lock; never call * while holding the app lock. */ int nl_app_save_settings(void); /* Writes a pending light state immediately (no write when unchanged). */ void nl_app_flush(void); /* Flushes pending state, then resets the chip. Does not return. */ void nl_app_reboot(void); void nl_app_factory_reset(void); /* Only sets a volatile flag; the app task (which owns the flash stores) checks it * once per loop iteration and calls nl_app_factory_reset() itself. This avoids the * race with the app task's own nl_state_log_append()/nl_resetcnt_clear() calls. * The console's `factory` command and, in a later plan, REST callers must use this * function instead of calling nl_app_factory_reset() directly from another task. */ void nl_app_request_factory_reset(void); /* Stores new station credentials (from a successful onboarding test) and persists them. */ int nl_app_set_wifi_credentials(const char *ssid, const char *pass); #endif