/* * Stairs * Copyright 2017 (c) Mark van Renswoude * * https://git.x2software.net/pub/Stairs */ #ifndef __settingssystem #define __settingssystem #include #include #include #include "../charproperties.h" #include "./abstractjson.h" class SystemSettings : public AbstractJsonSettings { private: char* mNTPServer = nullptr; uint32_t mNTPInterval = 5; double mLatitude = 0; double mLongitude = 0; uint8_t mPinLEDAP = 4; uint8_t mPinLEDSTA = 5; uint8_t mPinAPButton = 2; uint8_t mPinPWMDriverSDA = 13; uint8_t mPinPWMDriverSCL = 12; uint8_t mPWMDriverAddress = 0x40; uint16_t mPWMDriverFrequency = 1600; char* mMapsAPIKey = nullptr; protected: virtual const char* getFilename() { return SystemSettingsFile; }; virtual const char* getDebugPrefix() { return "SystemSettings"; }; public: void toJson(Print &print); bool fromJson(char* data, bool* changed); char* ntpServer() { return mNTPServer; } void ntpServer(const char* value) { assignChar(&mNTPServer, value); } double ntpInterval() { return mNTPInterval; } void ntpInterval(double value) { mNTPInterval = value; } double latitude() { return mLatitude; } void latitude(double value) { mLatitude = value; } double longitude() { return mLongitude; } void longitude(double value) { mLongitude = value; } uint8_t pinLEDAP() { return mPinLEDAP; } void pinLEDAP(uint8_t value) { mPinLEDAP = value; } uint8_t pinLEDSTA() { return mPinLEDSTA; } void pinLEDSTA(uint8_t value) { mPinLEDSTA = value; } uint8_t pinAPButton() { return mPinAPButton; } void pinAPButton(uint8_t value) { mPinAPButton = value; } uint8_t pinPWMDriverSDA() { return mPinPWMDriverSDA; } void pinPWMDriverSDA(uint8_t value) { mPinPWMDriverSDA = value; } uint8_t pinPWMDriverSCL() { return mPinPWMDriverSCL; } void pinPWMDriverSCL(uint8_t value) { mPinPWMDriverSCL = value; } uint8_t pwmDriverAddress() { return mPWMDriverAddress; } void pwmDriverAddress(uint8_t value) { mPWMDriverAddress = value; } uint16_t pwmDriverFrequency() { return mPWMDriverFrequency; } void pwmDriverFrequency(uint16_t value) { mPWMDriverFrequency = value; } char* mapsAPIKey() { return mMapsAPIKey; } void mapsAPIKey(const char* value) { assignChar(&mMapsAPIKey, value); } }; #endif