btclock_v3/src/lib/ota.hpp

38 lines
780 B
C++
Raw Normal View History

2024-09-11 15:40:44 +00:00
#pragma once
#include <Arduino.h>
#include <ArduinoOTA.h>
2023-11-30 21:56:50 +00:00
#include "lib/config.hpp"
#include "lib/shared.hpp"
2024-09-11 15:40:44 +00:00
#ifndef UPDATE_MESSAGE_HPP
#define UPDATE_MESSAGE_HPP
typedef struct {
char updateType;
} UpdateMessage;
#endif
extern QueueHandle_t otaQueue;
struct ReleaseInfo {
String fileUrl;
String checksumUrl;
};
void setupOTA();
void onOTAStart();
void handleOTATask(void *parameter);
void onOTAProgress(unsigned int progress, unsigned int total);
// void downloadUpdate();
2023-11-13 00:02:01 +00:00
void onOTAError(ota_error_t error);
2023-11-30 21:56:50 +00:00
void onOTAComplete();
2024-09-11 15:40:44 +00:00
int downloadUpdateHandler(char updateType);
ReleaseInfo getLatestRelease(const String& fileToDownload);
2024-09-11 15:40:44 +00:00
bool getIsOTAUpdating();
2024-06-29 00:19:25 +00:00
2024-09-11 15:40:44 +00:00
void updateWebUi(String latestRelease, int command);
String downloadSHA256(const String& filename);