Files
Tobias Maier ab16379e73
All checks were successful
Test compiling project / test (push) Successful in 2m38s
Added SPIFFS updating
2025-02-19 20:48:26 +01:00

32 lines
998 B
C++

#ifndef UNIT_TEST
#include <utils.h>
#ifdef UNIT_TEST
#include<ArduinoFake.h>
#else
#include <Arduino.h>
#endif
#pragma once
class OTA {
public:
OTA(String server_url, Version currentVersion, String currentDeviceConfiguration);
Firmware getLatestVersionOnServer();
bool checkForUpdate();
private:
bool _isHTTPS = false;
String _serverUrl;
Version _currentVersion;
String _current_device_configuration;
Firmware createErrorResponse(const String& errorMsg);
};
void run_ota_update(String url, std::function<void()> callback_started, std::function<void()> callback_finished, std::function<void(int, int)> callback_progress, std::function<void(int)> callback_error);
void run_ota_spiffs_update(String url, std::function<void()> callback_started, std::function<void()> callback_finished, std::function<void(int, int)> callback_progress, std::function<void(int)> callback_error);
#endif