39 lines
1.0 KiB
C++
39 lines
1.0 KiB
C++
#ifndef FSUpdater_h_included
|
|
#define FSUpdater_h_included
|
|
|
|
#include <Arduino.h>
|
|
|
|
#define MAX_FILES_IN_BOM 20
|
|
|
|
typedef struct {
|
|
char *localFilename, *remoteFilename, *md5;
|
|
unsigned long filesize;
|
|
char executionMark;
|
|
} BomEntry;
|
|
|
|
class FSUpdater {
|
|
public:
|
|
FSUpdater(String _baseUrl, String currentVersion, String user, String password):
|
|
baseUrl(_baseUrl),
|
|
swVersion(currentVersion),
|
|
authUser(user),
|
|
authPassword(password) {};
|
|
void checkForUpdates();
|
|
void manageFsOtaBom(String payload);
|
|
void freeMemory();
|
|
boolean errorWhileParsingBom() { return (errorMessage.length() > 0); };
|
|
String getBomParsingError() { return errorMessage; };
|
|
unsigned int numberOfBomEntries() { return bomCounter; };
|
|
BomEntry *getBomEntry(unsigned int num) { return &bom[num]; };
|
|
protected:
|
|
String baseUrl;
|
|
String swVersion;
|
|
String authUser, authPassword;
|
|
BomEntry bom[MAX_FILES_IN_BOM]; // array of bom's, dynamically allocated
|
|
char *bomBuffer = NULL;
|
|
unsigned int bomCounter = 0;
|
|
String errorMessage;
|
|
};
|
|
|
|
#endif
|