2024-04-03 07:04:55 +07:00
|
|
|
#ifndef _AG_CONFIG_H_
|
|
|
|
#define _AG_CONFIG_H_
|
|
|
|
|
2024-04-03 21:26:04 +07:00
|
|
|
#include "App/AppDef.h"
|
|
|
|
#include "Main/PrintLog.h"
|
2024-04-25 06:49:14 +07:00
|
|
|
#include "AirGradient.h"
|
2024-04-03 07:04:55 +07:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
2024-04-07 16:39:01 +07:00
|
|
|
class Configuration : public PrintLog {
|
2024-04-03 07:04:55 +07:00
|
|
|
private:
|
|
|
|
bool co2CalibrationRequested;
|
|
|
|
bool ledBarTestRequested;
|
2024-04-07 16:39:01 +07:00
|
|
|
bool udpated;
|
2024-04-08 10:15:45 +07:00
|
|
|
String failedMessage;
|
2024-04-14 21:30:56 +07:00
|
|
|
bool _noxLearnOffsetChanged;
|
|
|
|
bool _tvocLearningOffsetChanged;
|
2024-05-01 21:25:35 +07:00
|
|
|
bool ledBarBrightnessChanged = false;
|
|
|
|
bool displayBrightnessChanged = false;
|
2024-05-02 10:19:49 +07:00
|
|
|
String otaNewFirmwareVersion;
|
2024-05-13 14:43:53 +07:00
|
|
|
bool _offlineMode = false;
|
2024-05-17 11:52:22 +07:00
|
|
|
bool _ledBarModeChanged = false;
|
2024-04-03 07:04:55 +07:00
|
|
|
|
2024-04-25 06:49:14 +07:00
|
|
|
AirGradient* ag;
|
|
|
|
|
2024-04-03 07:04:55 +07:00
|
|
|
String getLedBarModeName(LedBarMode mode);
|
|
|
|
void saveConfig(void);
|
|
|
|
void loadConfig(void);
|
|
|
|
void defaultConfig(void);
|
|
|
|
void printConfig(void);
|
2024-04-08 10:15:45 +07:00
|
|
|
String jsonTypeInvalidMessage(String name, String type);
|
|
|
|
String jsonValueInvalidMessage(String name, String value);
|
|
|
|
void jsonInvalid(void);
|
2024-04-22 16:32:17 +07:00
|
|
|
void configLogInfo(String name, String fromValue, String toValue);
|
|
|
|
String getPMStandardString(bool usaqi);
|
|
|
|
String getAbcDayString(int value);
|
2024-05-08 12:22:34 +07:00
|
|
|
void toConfig(const char* buf);
|
2024-04-03 07:04:55 +07:00
|
|
|
|
|
|
|
public:
|
2024-04-07 16:39:01 +07:00
|
|
|
Configuration(Stream &debugLog);
|
|
|
|
~Configuration();
|
|
|
|
|
|
|
|
bool hasSensorS8 = true;
|
|
|
|
bool hasSensorPMS1 = true;
|
|
|
|
bool hasSensorPMS2 = true;
|
|
|
|
bool hasSensorSGP = true;
|
|
|
|
bool hasSensorSHT = true;
|
2024-04-03 07:04:55 +07:00
|
|
|
|
|
|
|
bool begin(void);
|
|
|
|
bool parse(String data, bool isLocal);
|
|
|
|
String toString(void);
|
2024-05-13 18:11:46 +07:00
|
|
|
String toString(AgFirmwareMode fwMode);
|
2024-04-03 07:04:55 +07:00
|
|
|
bool isTemperatureUnitInF(void);
|
|
|
|
String getCountry(void);
|
|
|
|
bool isPmStandardInUSAQI(void);
|
2024-04-07 16:39:01 +07:00
|
|
|
int getCO2CalibrationAbcDays(void);
|
2024-04-03 07:04:55 +07:00
|
|
|
LedBarMode getLedBarMode(void);
|
|
|
|
String getLedBarModeName(void);
|
|
|
|
bool getDisplayMode(void);
|
|
|
|
String getMqttBrokerUri(void);
|
|
|
|
bool isPostDataToAirGradient(void);
|
|
|
|
ConfigurationControl getConfigurationControl(void);
|
|
|
|
bool isCo2CalibrationRequested(void);
|
|
|
|
bool isLedBarTestRequested(void);
|
|
|
|
void reset(void);
|
|
|
|
String getModel(void);
|
2024-04-07 16:39:01 +07:00
|
|
|
bool isUpdated(void);
|
2024-04-08 10:15:45 +07:00
|
|
|
String getFailedMesage(void);
|
2024-04-11 06:33:56 +07:00
|
|
|
void setPostToAirGradient(bool enable);
|
2024-04-14 21:30:56 +07:00
|
|
|
bool noxLearnOffsetChanged(void);
|
|
|
|
bool tvocLearnOffsetChanged(void);
|
|
|
|
int getTvocLearningOffset(void);
|
|
|
|
int getNoxLearningOffset(void);
|
2024-04-25 06:49:14 +07:00
|
|
|
String wifiSSID(void);
|
|
|
|
String wifiPass(void);
|
|
|
|
void setAirGradient(AirGradient *ag);
|
2024-05-01 21:25:35 +07:00
|
|
|
bool isLedBarBrightnessChanged(void);
|
|
|
|
int getLedBarBrightness(void);
|
|
|
|
bool isDisplayBrightnessChanged(void);
|
|
|
|
int getDisplayBrightness(void);
|
2024-05-02 10:19:49 +07:00
|
|
|
String newFirmwareVersion(void);
|
2024-05-09 14:32:42 +07:00
|
|
|
bool isOfflineMode(void);
|
|
|
|
void setOfflineMode(bool offline);
|
2024-05-13 14:43:53 +07:00
|
|
|
void setOfflineModeWithoutSave(bool offline);
|
2024-05-17 11:52:22 +07:00
|
|
|
bool isLedBarModeChanged(void);
|
2024-04-03 07:04:55 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /** _AG_CONFIG_H_ */
|