2020-12-06 22:51:59 +00:00
|
|
|
#ifndef PROJECT_CONFIGURATION_H_
|
|
|
|
#define PROJECT_CONFIGURATION_H_
|
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
#include <BoardFinder.h>
|
|
|
|
#include <configuration.h>
|
2020-12-06 22:51:59 +00:00
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
class Configuration {
|
2020-12-06 22:51:59 +00:00
|
|
|
public:
|
2021-12-18 21:33:35 +00:00
|
|
|
class Static {
|
2021-07-15 14:36:33 +00:00
|
|
|
public:
|
2021-12-18 21:33:35 +00:00
|
|
|
IPAddress ip;
|
2021-07-15 18:18:37 +00:00
|
|
|
IPAddress subnet;
|
|
|
|
IPAddress gateway;
|
2021-07-18 17:41:15 +00:00
|
|
|
IPAddress dns1;
|
|
|
|
IPAddress dns2;
|
2021-07-15 14:36:33 +00:00
|
|
|
};
|
|
|
|
|
2021-12-18 21:33:35 +00:00
|
|
|
class Hostname {
|
|
|
|
public:
|
|
|
|
bool overwrite;
|
|
|
|
String name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Network {
|
|
|
|
public:
|
|
|
|
Network() : DHCP(true) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DHCP;
|
|
|
|
Static static_;
|
|
|
|
Hostname hostname;
|
|
|
|
};
|
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
class Wifi {
|
|
|
|
public:
|
2021-11-07 09:48:10 +00:00
|
|
|
Wifi() : active(true) {
|
|
|
|
}
|
|
|
|
|
2021-11-06 21:00:27 +00:00
|
|
|
bool active;
|
2021-03-12 22:21:45 +00:00
|
|
|
class AP {
|
|
|
|
public:
|
2021-07-15 18:59:51 +00:00
|
|
|
String SSID;
|
|
|
|
String password;
|
2021-03-12 22:21:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
std::list<AP> APs;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Beacon {
|
|
|
|
public:
|
2022-03-26 21:27:43 +00:00
|
|
|
Beacon() : message("LoRa iGATE & Digi, Info: github.com/peterus/LoRa_APRS_iGate"), positionLatitude(0.0), positionLongitude(0.0), use_gps(false), timeout(15) {
|
2021-03-12 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
String message;
|
|
|
|
double positionLatitude;
|
|
|
|
double positionLongitude;
|
2022-03-26 21:27:43 +00:00
|
|
|
bool use_gps;
|
2021-03-12 22:21:45 +00:00
|
|
|
int timeout;
|
|
|
|
};
|
|
|
|
|
|
|
|
class APRS_IS {
|
|
|
|
public:
|
2021-05-24 12:22:16 +00:00
|
|
|
APRS_IS() : active(true), server("euro.aprs2.net"), port(14580) {
|
2021-03-12 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
2021-05-25 11:00:44 +00:00
|
|
|
bool active;
|
2021-03-12 22:21:45 +00:00
|
|
|
String passcode;
|
|
|
|
String server;
|
|
|
|
int port;
|
|
|
|
};
|
|
|
|
|
2021-05-09 12:21:24 +00:00
|
|
|
class Digi {
|
|
|
|
public:
|
2021-05-25 19:57:18 +00:00
|
|
|
Digi() : active(false), beacon(true) {
|
2021-05-09 12:21:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
bool beacon;
|
|
|
|
};
|
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
class LoRa {
|
|
|
|
public:
|
2022-03-19 19:53:38 +00:00
|
|
|
LoRa() : frequencyRx(433775000), frequencyTx(433775000), power(20), spreadingFactor(12), signalBandwidth(125000), codingRate4(5), tx_enable(true) {
|
2021-03-12 22:21:45 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 09:48:10 +00:00
|
|
|
long frequencyRx;
|
2021-11-06 21:00:27 +00:00
|
|
|
uint8_t gainRx;
|
2021-11-07 09:48:10 +00:00
|
|
|
long frequencyTx;
|
|
|
|
int power;
|
|
|
|
int spreadingFactor;
|
|
|
|
long signalBandwidth;
|
|
|
|
int codingRate4;
|
2022-03-19 19:53:38 +00:00
|
|
|
bool tx_enable;
|
2021-03-12 22:21:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Display {
|
|
|
|
public:
|
|
|
|
Display() : alwaysOn(true), timeout(10), overwritePin(0), turn180(true) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool alwaysOn;
|
|
|
|
int timeout;
|
|
|
|
int overwritePin;
|
|
|
|
bool turn180;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Ftp {
|
|
|
|
public:
|
|
|
|
class User {
|
|
|
|
public:
|
|
|
|
String name;
|
|
|
|
String password;
|
|
|
|
};
|
|
|
|
|
|
|
|
Ftp() : active(false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
std::list<User> users;
|
|
|
|
};
|
|
|
|
|
2022-02-23 18:40:31 +00:00
|
|
|
class MQTT {
|
|
|
|
public:
|
2022-03-20 11:16:37 +00:00
|
|
|
MQTT() : active(false), server(""), port(1883), name(""), password(""), topic("LoraAPRS/Data") {
|
|
|
|
}
|
|
|
|
|
2022-03-28 20:21:50 +00:00
|
|
|
bool active;
|
|
|
|
String server;
|
|
|
|
int port;
|
|
|
|
String name;
|
|
|
|
String password;
|
|
|
|
String topic;
|
2022-02-23 18:40:31 +00:00
|
|
|
};
|
|
|
|
|
2022-03-20 11:16:37 +00:00
|
|
|
class Syslog {
|
|
|
|
public:
|
2022-11-16 22:00:02 +00:00
|
|
|
Syslog() : active(true), server(""), port(514) {
|
2022-03-20 11:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
String server;
|
|
|
|
int port;
|
|
|
|
};
|
|
|
|
|
|
|
|
Configuration() : callsign("NOCALL-10"), ntpServer("pool.ntp.org"), board("") {
|
|
|
|
}
|
2021-03-12 22:21:45 +00:00
|
|
|
|
|
|
|
String callsign;
|
2021-07-23 08:37:58 +00:00
|
|
|
Network network;
|
2021-03-12 22:21:45 +00:00
|
|
|
Wifi wifi;
|
|
|
|
Beacon beacon;
|
|
|
|
APRS_IS aprs_is;
|
2021-05-09 12:21:24 +00:00
|
|
|
Digi digi;
|
2021-03-12 22:21:45 +00:00
|
|
|
LoRa lora;
|
|
|
|
Display display;
|
|
|
|
Ftp ftp;
|
2022-02-23 18:40:31 +00:00
|
|
|
MQTT mqtt;
|
2022-03-20 11:16:37 +00:00
|
|
|
Syslog syslog;
|
2021-03-12 22:21:45 +00:00
|
|
|
String ntpServer;
|
2022-03-20 11:16:37 +00:00
|
|
|
String board;
|
2020-12-06 22:51:59 +00:00
|
|
|
};
|
|
|
|
|
2021-03-12 22:21:45 +00:00
|
|
|
class ProjectConfigurationManagement : public ConfigurationManagement {
|
2020-12-06 22:51:59 +00:00
|
|
|
public:
|
2022-03-19 23:37:29 +00:00
|
|
|
explicit ProjectConfigurationManagement(logging::Logger &logger) : ConfigurationManagement(logger, "/is-cfg.json") {
|
2021-03-12 22:21:45 +00:00
|
|
|
}
|
|
|
|
virtual ~ProjectConfigurationManagement() {
|
|
|
|
}
|
2020-12-06 22:51:59 +00:00
|
|
|
|
|
|
|
private:
|
2021-05-18 22:44:37 +00:00
|
|
|
virtual void readProjectConfiguration(DynamicJsonDocument &data, Configuration &conf) override;
|
|
|
|
virtual void writeProjectConfiguration(Configuration &conf, DynamicJsonDocument &data) override;
|
2020-12-06 22:51:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|