LoRa_APRS_iGate/src/project_configuration.h

184 wiersze
3.5 KiB
C
Czysty Zwykły widok Historia

#ifndef PROJECT_CONFIGURATION_H_
#define PROJECT_CONFIGURATION_H_
2023-09-23 13:37:35 +00:00
#include "BoardFinder/BoardFinder.h"
#include "ConfigurationManagement/configuration.h"
class Configuration {
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;
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:
2023-06-08 10:51:25 +00:00
Hostname() : overwrite(false) {
}
2021-12-18 21:33:35 +00:00
bool overwrite;
String name;
};
class Network {
public:
Network() : DHCP(true) {
}
bool DHCP;
Static static_;
Hostname hostname;
};
class Wifi {
public:
Wifi() : active(true) {
}
bool active;
class AP {
public:
String SSID;
String password;
};
std::list<AP> APs;
};
class Beacon {
public:
2023-06-08 10:51:25 +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), send_on_hf(false) {
}
String message;
double positionLatitude;
double positionLongitude;
2022-03-26 21:27:43 +00:00
bool use_gps;
int timeout;
2023-06-08 10:51:25 +00:00
bool send_on_hf;
};
class APRS_IS {
public:
2021-05-24 12:22:16 +00:00
APRS_IS() : active(true), server("euro.aprs2.net"), port(14580) {
}
2021-05-25 11:00:44 +00:00
bool active;
String passcode;
String server;
int port;
2023-04-20 15:55:30 +00:00
String filter;
};
class Digi {
public:
2023-06-08 10:51:25 +00:00
Digi() : active(false) {
}
bool active;
};
class LoRa {
public:
2023-06-08 10:51:25 +00:00
LoRa() : frequencyRx(433775000), gainRx(0), frequencyTx(433775000), power(20), spreadingFactor(12), signalBandwidth(125000), codingRate4(5), tx_enable(true) {
}
long frequencyRx;
uint8_t gainRx;
long frequencyTx;
int power;
int spreadingFactor;
long signalBandwidth;
int codingRate4;
2022-03-19 19:53:38 +00:00
bool tx_enable;
};
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;
};
class MQTT {
public:
2023-03-21 20:28:50 +00:00
MQTT() : active(false), server(""), port(1883), name(""), password(""), topic("LoraAPRS/Data"), will_active(false), will_topic("LoraAPRS/State"), will_message("offline"), birth_message("online") {
2022-03-20 11:16:37 +00:00
}
2022-03-28 20:21:50 +00:00
bool active;
String server;
int port;
String name;
String password;
String topic;
bool will_active;
String will_topic;
String will_message;
String birth_message;
};
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("") {
}
String callsign;
2021-07-23 08:37:58 +00:00
Network network;
Wifi wifi;
Beacon beacon;
APRS_IS aprs_is;
Digi digi;
LoRa lora;
Display display;
Ftp ftp;
MQTT mqtt;
2022-03-20 11:16:37 +00:00
Syslog syslog;
String ntpServer;
2022-03-20 11:16:37 +00:00
String board;
};
class ProjectConfigurationManagement : public ConfigurationManagement {
public:
2022-03-19 23:37:29 +00:00
explicit ProjectConfigurationManagement(logging::Logger &logger) : ConfigurationManagement(logger, "/is-cfg.json") {
}
virtual ~ProjectConfigurationManagement() {
}
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;
};
#endif