FastLED 3.10.8
Loading...
Searching...
No Matches
ota.cpp.hpp
Go to the documentation of this file.
1
3
4#include "fl/net/ota/ota.h"
5#include "platforms/ota.h"
6#include "fl/stl/noexcept.h"
7
8namespace fl {
9namespace net {
10
11// ============================================================================
12// OTA Wrapper Implementation
13// ============================================================================
14
16 // Lazy initialization - mImpl will be created on first method call
17}
18
20 // shared_ptr handles cleanup automatically
21}
22
23bool OTA::beginWiFi(const char* hostname, const char* password,
24 const char* ssid, const char* wifi_pass) FL_NO_EXCEPT {
25 if (!mImpl) {
26 mImpl = platforms::IOTA::create();
27 }
28 return mImpl->beginWiFi(hostname, password, ssid, wifi_pass);
29}
30
31bool OTA::begin(const char* hostname, const char* password) FL_NO_EXCEPT {
32 if (!mImpl) {
33 mImpl = platforms::IOTA::create();
34 }
35 return mImpl->begin(hostname, password);
36}
37
38bool OTA::enableApFallback(const char* ap_ssid, const char* ap_pass) FL_NO_EXCEPT {
39 if (!mImpl) {
40 mImpl = platforms::IOTA::create();
41 }
42 return mImpl->enableApFallback(ap_ssid, ap_pass);
43}
44
46 if (!mImpl) {
47 mImpl = platforms::IOTA::create();
48 }
49 mImpl->onProgress(callback);
50}
51
53 if (!mImpl) {
54 mImpl = platforms::IOTA::create();
55 }
56 mImpl->onError(callback);
57}
58
60 if (!mImpl) {
61 mImpl = platforms::IOTA::create();
62 }
63 mImpl->onState(callback);
64}
65
66void OTA::onBeforeReboot(void (*callback)()) FL_NO_EXCEPT {
67 if (!mImpl) {
68 mImpl = platforms::IOTA::create();
69 }
70 mImpl->onBeforeReboot(callback);
71}
72
74 if (!mImpl) {
75 mImpl = platforms::IOTA::create();
76 }
77 mImpl->poll();
78}
79
81 if (!mImpl) {
82 return false;
83 }
84 return mImpl->isConnected();
85}
86
88 if (!mImpl) {
89 return 0;
90 }
91 return mImpl->getFailedServices();
92}
93
94} // namespace net
95} // namespace fl
void onProgress(ProgressCallback callback) FL_NO_EXCEPT
Set progress callback (called during firmware upload)
Definition ota.cpp.hpp:45
OTA() FL_NO_EXCEPT
Default constructor (lazy initialization)
Definition ota.cpp.hpp:15
u8 getFailedServices() const FL_NO_EXCEPT
Get bitmask of services that failed to initialize.
Definition ota.cpp.hpp:87
bool enableApFallback(const char *ap_ssid, const char *ap_pass=nullptr) FL_NO_EXCEPT
Enable AP (Access Point) fallback mode if Wi-Fi STA connection fails.
Definition ota.cpp.hpp:38
void onState(StateCallback callback) FL_NO_EXCEPT
Set state callback (called on state transitions)
Definition ota.cpp.hpp:59
fl::function< void(const char *message)> ErrorCallback
Callback function type for OTA errors.
Definition ota.h:170
void onBeforeReboot(void(*callback)()) FL_NO_EXCEPT
Set callback to be called before device reboots after OTA update.
Definition ota.cpp.hpp:66
fl::function< void(size_t written, size_t total)> ProgressCallback
Callback function type for OTA progress updates.
Definition ota.h:166
~OTA() FL_NO_EXCEPT
Destructor - cleans up resources.
Definition ota.cpp.hpp:19
void poll() FL_NO_EXCEPT
Poll OTA handlers (must be called regularly in loop())
Definition ota.cpp.hpp:73
bool isConnected() const FL_NO_EXCEPT
Check if WiFi is connected.
Definition ota.cpp.hpp:80
bool beginWiFi(const char *hostname, const char *password, const char *ssid, const char *wifi_pass) FL_NO_EXCEPT
Start OTA with full Wi-Fi setup (station mode)
Definition ota.cpp.hpp:23
fl::shared_ptr< fl::platforms::IOTA > mImpl
Definition ota.h:211
void onError(ErrorCallback callback) FL_NO_EXCEPT
Set error callback (called on OTA errors)
Definition ota.cpp.hpp:52
fl::function< void(u8 state)> StateCallback
Callback function type for OTA state changes.
Definition ota.h:174
bool begin(const char *hostname, const char *password) FL_NO_EXCEPT
Start OTA services only (network already configured)
Definition ota.cpp.hpp:31
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179
Minimal, batteries-included OTA (Over-The-Air) update system for ESP32.