kopia lustrzana https://github.com/lora-aprs/LoRa_APRS_iGate
add syslog config
rodzic
4bd1c46335
commit
d6bc7e9788
|
@ -49,7 +49,7 @@
|
|||
"spreading_factor": 12,
|
||||
"signal_bandwidth": 125000,
|
||||
"coding_rate4": 5,
|
||||
"tx_enable": true
|
||||
"tx_enable": false
|
||||
},
|
||||
"display": {
|
||||
"always_on": true,
|
||||
|
@ -74,5 +74,10 @@
|
|||
"password": "",
|
||||
"topic": "LoraAPRS/Data"
|
||||
},
|
||||
"syslog": {
|
||||
"active": true,
|
||||
"server": "syslog.lora-aprs.info",
|
||||
"port": 514
|
||||
},
|
||||
"ntp_server": "pool.ntp.org"
|
||||
}
|
||||
|
|
|
@ -149,6 +149,11 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
LoRaSystem.getTaskManager().loop(LoRaSystem);
|
||||
if (LoRaSystem.isWifiEthConnected()) {
|
||||
if (LoRaSystem.getUserConfig()->syslog.active) {
|
||||
LoRaSystem.getLogger().setSyslogServer(LoRaSystem.getUserConfig()->syslog.server, LoRaSystem.getUserConfig()->syslog.port, LoRaSystem.getUserConfig()->callsign);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String create_lat_aprs(double lat) {
|
||||
|
|
|
@ -86,6 +86,11 @@ void ProjectConfigurationManagement::readProjectConfiguration(DynamicJsonDocumen
|
|||
conf.mqtt.password = data["mqtt"]["password"].as<String>();
|
||||
conf.mqtt.topic = data["mqtt"]["topic"].as<String>();
|
||||
}
|
||||
if (data.containsKey("syslog")) {
|
||||
conf.syslog.active = data["syslog"]["active"] | true;
|
||||
conf.syslog.server = data["syslog"]["server"].as<String>();
|
||||
conf.syslog.port = data["syslog"]["port"] | 514;
|
||||
}
|
||||
if (data.containsKey("ntp_server"))
|
||||
conf.ntpServer = data["ntp_server"].as<String>();
|
||||
|
||||
|
@ -149,6 +154,9 @@ void ProjectConfigurationManagement::writeProjectConfiguration(Configuration &co
|
|||
data["mqtt"]["name"] = conf.mqtt.name;
|
||||
data["mqtt"]["password"] = conf.mqtt.password;
|
||||
data["mqtt"]["topic"] = conf.mqtt.topic;
|
||||
data["syslog"]["active"] = conf.syslog.active;
|
||||
data["syslog"]["server"] = conf.syslog.server;
|
||||
data["syslog"]["port"] = conf.syslog.port;
|
||||
data["ntp_server"] = conf.ntpServer;
|
||||
|
||||
data["board"] = conf.board;
|
||||
|
|
|
@ -120,6 +120,9 @@ public:
|
|||
|
||||
class MQTT {
|
||||
public:
|
||||
MQTT() : active(false), server(""), port(1883), name(""), password(""), topic("LoraAPRS/Data") {
|
||||
}
|
||||
|
||||
bool active;
|
||||
String server;
|
||||
uint16_t port;
|
||||
|
@ -128,7 +131,18 @@ public:
|
|||
String topic;
|
||||
};
|
||||
|
||||
Configuration() : callsign("NOCALL-10"), board(""), ntpServer("pool.ntp.org"){};
|
||||
class Syslog {
|
||||
public:
|
||||
Syslog() : active(true), server("syslog.lora-aprs.info"), port(514) {
|
||||
}
|
||||
|
||||
bool active;
|
||||
String server;
|
||||
int port;
|
||||
};
|
||||
|
||||
Configuration() : callsign("NOCALL-10"), ntpServer("pool.ntp.org"), board("") {
|
||||
}
|
||||
|
||||
String callsign;
|
||||
Network network;
|
||||
|
@ -140,8 +154,9 @@ public:
|
|||
Display display;
|
||||
Ftp ftp;
|
||||
MQTT mqtt;
|
||||
String board;
|
||||
Syslog syslog;
|
||||
String ntpServer;
|
||||
String board;
|
||||
};
|
||||
|
||||
class ProjectConfigurationManagement : public ConfigurationManagement {
|
||||
|
|
Ładowanie…
Reference in New Issue