1#ifndef ESP32_OTA_UPDATER_H_
2#define ESP32_OTA_UPDATER_H_
10#include <WiFiClientSecure.h>
11#include <HTTPClient.h>
16#define ESP32_OTA_UPDATER_SHORTSTRING_LENGTH 50
17#define ESP32_OTA_UPDATER_LONGSTRING_LENGTH 150
29 char repositry_owner[ESP32_OTA_UPDATER_SHORTSTRING_LENGTH];
30 char repositry_name[ESP32_OTA_UPDATER_SHORTSTRING_LENGTH];
31 char gh_api_key[ESP32_OTA_UPDATER_LONGSTRING_LENGTH];
33 char firmware_asset_path[ESP32_OTA_UPDATER_SHORTSTRING_LENGTH];
34 const char *http_useragent =
"ESP32-OTA-Updater";
36 bool new_version_available =
false;
37 char binary_download_url[ESP32_OTA_UPDATER_LONGSTRING_LENGTH];
41 ESP32_OTA_Updater_Error error;
42 WiFiClientSecure wifi_client_secure;
43 HTTPClient http_client;
47 void updateProgressCallback(
size_t progress,
size_t size);
48 int httpclientSendRequest(HTTPClient &http_client);
49 inline void _begin(
const char *owner,
const char *repo,
const char *firmware_path);
51 Print *debugPrinter = NULL;
52 void debugf(
const char *format, ...);
78 bool begin(
const char *owner,
const char *repo,
const char *firmware_path,
const char *api_key);
89 bool begin(
const char *owner,
const char *repo,
const char *firmware_path);
Contains the declaration of the Version class.
Class for performing Over-The-Air (OTA) updates on ESP32 devices, with Github Actions and Releases.
Definition ESP32_OTA_Updater.h:27
void setDebug(Print *debugStream)
Sets the debug output stream for logging messages.
Definition ESP32_OTA_Updater.cpp:316
bool downloadAndInstall()
Downloads and installs the firmware update. Use 'reboot()' for the esp to reboot and the update to ta...
Definition ESP32_OTA_Updater.cpp:188
bool begin(const char *owner, const char *repo, const char *firmware_path, const char *api_key)
Initializes the ESP32 OTA Updater.
Definition ESP32_OTA_Updater.cpp:11
String getErrorDescription()
Returns the description of the last error that occurred.
Definition ESP32_OTA_Updater.cpp:275
void reboot()
Initiates a reboot of the esp32, which effectively finished a previously installed update.
Definition ESP32_OTA_Updater.cpp:264
ESP32_OTA_Updater_Error getErrorCode()
Get the error code.
Definition ESP32_OTA_Updater.cpp:270
bool available()
Checks if a firmware update is available.
Definition ESP32_OTA_Updater.cpp:95
Represents a semantic version.
Definition SemanticVersion.h:17