5#include "platforms/ota.h"
24 const char* ssid,
const char* wifi_pass) {
26 mImpl = platforms::IOTA::create();
28 return mImpl->beginWiFi(hostname, password, ssid, wifi_pass);
31bool OTA::begin(
const char* hostname,
const char* password) {
33 mImpl = platforms::IOTA::create();
35 return mImpl->begin(hostname, password);
40 mImpl = platforms::IOTA::create();
42 return mImpl->enableApFallback(ap_ssid, ap_pass);
47 mImpl = platforms::IOTA::create();
49 mImpl->onProgress(callback);
54 mImpl = platforms::IOTA::create();
56 mImpl->onError(callback);
61 mImpl = platforms::IOTA::create();
63 mImpl->onState(callback);
68 mImpl = platforms::IOTA::create();
70 mImpl->onBeforeReboot(callback);
75 mImpl = platforms::IOTA::create();
84 return mImpl->isConnected();
91 return mImpl->getFailedServices();
void onState(StateCallback callback)
Set state callback (called on state transitions)
bool begin(const char *hostname, const char *password)
Start OTA services only (network already configured)
void onError(ErrorCallback callback)
Set error callback (called on OTA errors)
u8 getFailedServices() const
Get bitmask of services that failed to initialize.
fl::function< void(const char *message)> ErrorCallback
Callback function type for OTA errors.
OTA() FL_NOEXCEPT
Default constructor (lazy initialization)
void poll()
Poll OTA handlers (must be called regularly in loop())
bool isConnected() const
Check if WiFi is connected.
fl::function< void(size_t written, size_t total)> ProgressCallback
Callback function type for OTA progress updates.
bool enableApFallback(const char *ap_ssid, const char *ap_pass=nullptr)
Enable AP (Access Point) fallback mode if Wi-Fi STA connection fails.
~OTA() FL_NOEXCEPT
Destructor - cleans up resources.
void onProgress(ProgressCallback callback)
Set progress callback (called during firmware upload)
bool beginWiFi(const char *hostname, const char *password, const char *ssid, const char *wifi_pass)
Start OTA with full Wi-Fi setup (station mode)
fl::shared_ptr< fl::platforms::IOTA > mImpl
void onBeforeReboot(void(*callback)())
Set callback to be called before device reboots after OTA update.
fl::function< void(u8 state)> StateCallback
Callback function type for OTA state changes.
Base definition for an LED controller.
Minimal, batteries-included OTA (Over-The-Air) update system for ESP32.