Created
February 19, 2018 17:44
-
-
Save s-bauer/2cedbf8223cd3f826ca6573599bfed08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ConfigManager_H | |
#define ConfigManager_H | |
#include <Arduino.h> | |
#include <ArduinoJson.h> | |
#include <FS.h> | |
#include "Logger.h" | |
class WiFiNetwork { | |
public: | |
char *ssid; //max 32 | |
char *pass; //max 32 | |
}; | |
class Settings { | |
public: | |
const static char current_version[4]; | |
char version[4]; | |
WiFiNetwork *networks; | |
int led_count; | |
}; | |
class ConfigManager { | |
public: | |
ConfigManager(); | |
void read_from_eeprom(); | |
private: | |
Settings *settings; | |
File configFile; | |
JsonObject *json; | |
StaticJsonBuffer<200> jsonBuffer; | |
void open_file(const char *permission); | |
void read_json(); | |
void recreate_file(); | |
void create_json(); | |
void check_success(); | |
void populate_settings(); | |
void clean_up(); | |
}; | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment