Fixed compiler warnings. Added alpha-version of FSUpdater, not functioning yet.

This commit is contained in:
2019-01-30 16:14:08 +01:00
parent 79bc78b511
commit 72f63d21f9
4 changed files with 167 additions and 23 deletions

38
src/FSUpdater.h Normal file
View File

@@ -0,0 +1,38 @@
#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