From b41051164a68d445077569df06238f8f90d99094 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Mon, 27 Dec 2021 22:48:12 +0100 Subject: [PATCH] Add XLX options --- DStarGatewayConfig.cpp | 16 +++++++++++++++- DStarGatewayConfig.h | 8 ++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/DStarGatewayConfig.cpp b/DStarGatewayConfig.cpp index eb70f0d..f49befe 100644 --- a/DStarGatewayConfig.cpp +++ b/DStarGatewayConfig.cpp @@ -46,7 +46,8 @@ bool CDStarGatewayConfig::load() && loadDextra(cfg) && loadDCS(cfg) && loadDPlus(cfg) - && loadRemote(cfg)) { + && loadRemote(cfg) + && loadXLX(cfg)) { //properly size values m_gateway.callsign.resize(LONG_CALLSIGN_LENGTH - 1U, ' '); @@ -60,6 +61,14 @@ bool CDStarGatewayConfig::load() return false; } +bool CDStarGatewayConfig::loadXLX(const Config & cfg) +{ + bool ret = get_value(cfg, "xlx.enabled", m_xlx.enabled, true); + ret = get_value(cfg, "xlx.hostfileUrl", m_xlx.url, 0, 1024, "", false) && ret; + + return ret; +} + bool CDStarGatewayConfig::loadRemote(const Config & cfg) { bool ret = get_value(cfg, "remote.enabled", m_remote.enabled, false); @@ -514,3 +523,8 @@ void CDStarGatewayConfig::getRemote(TRemote & remote) const { remote = m_remote; } + +void CDStarGatewayConfig::getXLX(TXLX & xlx) const +{ + xlx = m_xlx; +} diff --git a/DStarGatewayConfig.h b/DStarGatewayConfig.h index 97d4f12..2ff6209 100644 --- a/DStarGatewayConfig.h +++ b/DStarGatewayConfig.h @@ -101,6 +101,11 @@ typedef struct { bool enabled; } TDCS; +typedef struct { + bool enabled; + std::string url; +} TXLX; + typedef struct { bool enabled; unsigned int port; @@ -125,6 +130,7 @@ public: void getDPlus(TDplus & dplus) const; void getDCS(TDCS & dcs) const; void getRemote(TRemote & remote) const; + void getXLX(TXLX & xlx) const; private: bool open(Config & cfg); @@ -137,6 +143,7 @@ private: bool loadDPlus(const Config & cfg); bool loadDCS(const Config & cfg); bool loadRemote(const Config & cfg); + bool loadXLX(const Config & cfg); bool get_value(const Config &cfg, const std::string &path, unsigned int &value, unsigned int min, unsigned int max, unsigned int default_value); bool get_value(const Config &cfg, const std::string &path, int &value, int min, int max, int default_value); bool get_value(const Config &cfg, const std::string &path, double &value, double min, double max, double default_value); @@ -153,6 +160,7 @@ private: TDplus m_dplus; TDCS m_dcs; TRemote m_remote; + TXLX m_xlx; std::vector m_repeaters; std::vector m_ircDDB; };