Add response callback for OTA configuration and update handling; adjust hardware configurations
This commit is contained in:
+12
-1
@@ -1,7 +1,18 @@
|
||||
#include "ota_update.hpp"
|
||||
|
||||
OtaUpdate::OtaUpdate()
|
||||
: _server(80), _httpUpdater(), _configured(false), _startTime(0) {
|
||||
: _server(80), _httpUpdater(), _configured(false), _startTime(0), m_responseCallback(nullptr) {
|
||||
}
|
||||
|
||||
void OtaUpdate::set(const hardware_SensorOTAEnable& config) {
|
||||
bool success = configure(config);
|
||||
if (m_responseCallback) {
|
||||
IPAddress ip = WiFi.localIP();
|
||||
if (!config.as_station_mode) {
|
||||
ip = WiFi.softAPIP();
|
||||
}
|
||||
m_responseCallback(success, success ? ip.toString().c_str() : "", success ? "" : "Failed to configure OTA");
|
||||
}
|
||||
}
|
||||
|
||||
bool OtaUpdate::configure(const hardware_SensorOTAEnable& config) {
|
||||
|
||||
Reference in New Issue
Block a user