2021-03-03 20:58:31 +00:00
|
|
|
#ifndef CONFIGURATION_H_
|
|
|
|
#define CONFIGURATION_H_
|
|
|
|
|
2021-12-04 03:06:38 +00:00
|
|
|
#include <iterator>
|
2021-12-19 21:27:29 +00:00
|
|
|
#include <list>
|
2021-03-03 20:58:31 +00:00
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2021-10-14 21:31:56 +00:00
|
|
|
class Configuration {
|
2021-03-03 20:58:31 +00:00
|
|
|
public:
|
2021-10-14 21:31:56 +00:00
|
|
|
class Beacon {
|
|
|
|
public:
|
2021-12-19 21:27:29 +00:00
|
|
|
Beacon() : callsign("NOCALL-10"), path("WIDE1-1"), message("LoRa Tracker"), timeout(1), symbol("["), overlay("/") {
|
2021-10-14 21:31:56 +00:00
|
|
|
}
|
|
|
|
|
2021-12-04 03:06:38 +00:00
|
|
|
String callsign;
|
2021-12-19 21:27:29 +00:00
|
|
|
String path;
|
2021-10-14 21:31:56 +00:00
|
|
|
String message;
|
2021-12-19 20:51:56 +00:00
|
|
|
String path;
|
2021-10-14 21:31:56 +00:00
|
|
|
int timeout;
|
|
|
|
String symbol;
|
|
|
|
String overlay;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Smart_Beacon {
|
|
|
|
public:
|
|
|
|
Smart_Beacon() : active(false), turn_min(25), slow_rate(300), slow_speed(10), fast_rate(60), fast_speed(100), min_tx_dist(100), min_bcn(5) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
int turn_min;
|
|
|
|
int slow_rate;
|
|
|
|
int slow_speed;
|
|
|
|
int fast_rate;
|
|
|
|
int fast_speed;
|
|
|
|
int min_tx_dist;
|
|
|
|
int min_bcn;
|
|
|
|
};
|
|
|
|
|
|
|
|
class LoRa {
|
|
|
|
public:
|
|
|
|
LoRa() : frequencyRx(433775000), frequencyTx(433775000), power(20), spreadingFactor(12), signalBandwidth(125000), codingRate4(5) {
|
|
|
|
}
|
|
|
|
|
|
|
|
long frequencyRx;
|
|
|
|
long frequencyTx;
|
|
|
|
int power;
|
|
|
|
int spreadingFactor;
|
|
|
|
long signalBandwidth;
|
|
|
|
int codingRate4;
|
|
|
|
};
|
|
|
|
|
|
|
|
class PTT {
|
|
|
|
public:
|
|
|
|
PTT() : active(false), io_pin(4), start_delay(0), end_delay(0), reverse(false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool active;
|
|
|
|
int io_pin;
|
|
|
|
int start_delay;
|
|
|
|
int end_delay;
|
|
|
|
bool reverse;
|
|
|
|
};
|
|
|
|
|
2021-12-04 03:06:38 +00:00
|
|
|
class Button {
|
|
|
|
public:
|
|
|
|
Button() : tx(false), alt_message(false) {
|
|
|
|
}
|
|
|
|
|
|
|
|
bool tx;
|
|
|
|
int alt_message;
|
|
|
|
};
|
|
|
|
|
2021-12-19 21:27:29 +00:00
|
|
|
Configuration() : debug(false), enhance_precision(true), current_beacon_index(0){};
|
2021-12-04 03:06:38 +00:00
|
|
|
|
2021-12-19 21:27:29 +00:00
|
|
|
bool debug;
|
|
|
|
bool enhance_precision;
|
|
|
|
std::list<Beacon> beacons;
|
|
|
|
int current_beacon_index;
|
|
|
|
Smart_Beacon smart_beacon;
|
|
|
|
LoRa lora;
|
|
|
|
PTT ptt;
|
|
|
|
Button button;
|
2021-10-14 21:31:56 +00:00
|
|
|
|
2021-12-04 03:06:38 +00:00
|
|
|
Beacon GetCurrentBeacon();
|
|
|
|
Beacon SetNextBeacon();
|
2021-03-03 20:58:31 +00:00
|
|
|
};
|
|
|
|
|
2021-10-14 21:31:56 +00:00
|
|
|
class ConfigurationManagement {
|
2021-03-03 20:58:31 +00:00
|
|
|
public:
|
2021-10-14 21:31:56 +00:00
|
|
|
explicit ConfigurationManagement(String FilePath);
|
2021-03-03 20:58:31 +00:00
|
|
|
|
2021-10-14 21:31:56 +00:00
|
|
|
Configuration readConfiguration();
|
|
|
|
void writeConfiguration(Configuration conf);
|
2021-03-03 20:58:31 +00:00
|
|
|
|
|
|
|
private:
|
2021-10-14 21:31:56 +00:00
|
|
|
const String mFilePath;
|
2021-03-03 20:58:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|