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