From cae6aea472ebadadc98e165b8707f9869a0707d2 Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Tue, 20 Sep 2022 20:48:15 +0200 Subject: [PATCH] Do not make DRats a compile option --- .circleci/config.yml | 4 ++-- .vscode/tasks.json | 1 - Common/RepeaterHandler.cpp | 32 +++++++---------------------- Common/RepeaterHandler.h | 13 +----------- DStarGateway/DStarGatewayApp.cpp | 4 ---- DStarGateway/DStarGatewayConfig.cpp | 8 +------- DStarGateway/DStarGatewayConfig.h | 10 --------- DStarGateway/DStarGatewayThread.cpp | 7 +------ DStarGateway/DStarGatewayThread.h | 7 ++----- Makefile | 4 ---- README.md | 10 ++------- 11 files changed, 16 insertions(+), 84 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6960b90..f858990 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -21,10 +21,10 @@ jobs: sudo apt-get -y install libgtest-dev libcurl4-openssl-dev libboost-dev libgps-dev - run: name: "Build" - command: "make -j 3 ENABLE_DEBUG=1 USE_GPSD=1 USE_DRATS=1" + command: "make -j 3 ENABLE_DEBUG=1 USE_GPSD=1" - run: name: "Run Tests" - command: "make run-tests ENABLE_DEBUG=1 USE_GPSD=1 USE_DRATS=1" + command: "make run-tests ENABLE_DEBUG=1 USE_GPSD=1" # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows workflows: diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e1ed666..587d251 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,6 @@ "-j3", "ENABLE_DEBUG=1", "USE_GPSD=1", - "USE_DRATS=1", "all" ], "group": "build", diff --git a/Common/RepeaterHandler.cpp b/Common/RepeaterHandler.cpp index 9f817ca..c66e95f 100644 --- a/Common/RepeaterHandler.cpp +++ b/Common/RepeaterHandler.cpp @@ -63,11 +63,8 @@ CAPRSHandler* CRepeaterHandler::m_aprsWriter = NULL; CCallsignList* CRepeaterHandler::m_restrictList = NULL; -#ifdef USE_DRATS - CRepeaterHandler::CRepeaterHandler(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) : -#else - CRepeaterHandler::CRepeaterHandler(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) : -#endif +CRepeaterHandler::CRepeaterHandler(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) : + m_index(0x00U), m_rptCallsign(), m_gwyCallsign(), @@ -137,9 +134,7 @@ m_wxAudio(NULL), m_wxNeeded(false), #endif m_version(NULL), -#ifdef USE_DRATS m_drats(NULL), -#endif m_dtmf(), m_pollTimer(1000U, 900U), // 15 minutes #ifdef USE_CSS @@ -228,7 +223,7 @@ m_heardTimer(1000U, 0U, 100U) // 100ms m_version = new CVersionUnit(this, callsign); m_aprsUnit = new CAPRSUnit(this); -#ifdef USE_DRATS + if (dratsEnabled) { m_drats = new CDRATSServer(m_localAddress, port, callsign, this); bool ret = m_drats->open(); @@ -237,7 +232,6 @@ m_heardTimer(1000U, 0U, 100U) // 100ms m_drats = NULL; } } -#endif } CRepeaterHandler::~CRepeaterHandler() @@ -250,10 +244,8 @@ CRepeaterHandler::~CRepeaterHandler() #endif delete m_version; -#ifdef USE_DRATS if (m_drats != NULL) m_drats->close(); -#endif } void CRepeaterHandler::initialise(unsigned int maxRepeaters) @@ -272,21 +264,14 @@ void CRepeaterHandler::setIndex(unsigned int index) m_index = index; } -#ifdef USE_DRATS void CRepeaterHandler::add(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) -#else -void CRepeaterHandler::add(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) -#endif { assert(!callsign.empty()); assert(port > 0U); assert(handler != NULL); -#ifdef USE_DRATS + CRepeaterHandler* repeater = new CRepeaterHandler(callsign, band, address, port, hwType, reflector, atStartup, reconnect, dratsEnabled, frequency, offset, range, latitude, longitude, agl, description1, description2, url, handler, band1, band2, band3); -#else - CRepeaterHandler* repeater = new CRepeaterHandler(callsign, band, address, port, hwType, reflector, atStartup, reconnect, frequency, offset, range, latitude, longitude, agl, description1, description2, url, handler, band1, band2, band3); -#endif for (unsigned int i = 0U; i < m_maxRepeaters; i++) { if (m_repeaters[i] == NULL) { @@ -606,10 +591,8 @@ void CRepeaterHandler::processRepeater(CHeaderData& header) // The Icom heard timer m_heardTimer.stop(); -#ifdef USE_DRATS if (m_drats != NULL) m_drats->writeHeader(header); -#endif // Reset the statistics m_frames = 0U; @@ -836,10 +819,9 @@ void CRepeaterHandler::processRepeater(CAMBEData& data) // CCS gets everything m_ccsHandler->writeAMBE(data); #endif -#ifdef USE_DRATS + if (m_drats != NULL) m_drats->writeData(data); -#endif if (m_aprsWriter != NULL) m_aprsWriter->writeData(m_rptCallsign, data); @@ -1572,10 +1554,10 @@ void CRepeaterHandler::clockInt(unsigned int ms) if (m_repeaterId != 0x00U) { if (m_text.empty()) sendHeard(); -#ifdef USE_DRATS + if (m_drats != NULL) m_drats->writeEnd(); -#endif + sendStats(); diff --git a/Common/RepeaterHandler.h b/Common/RepeaterHandler.h index 6b7e10d..e0422c4 100644 --- a/Common/RepeaterHandler.h +++ b/Common/RepeaterHandler.h @@ -35,9 +35,7 @@ #include "CacheManager.h" #include "HeaderLogger.h" #include "CallsignList.h" -#ifdef USE_DRATS #include "DRATSServer.h" -#endif #include "CCSCallback.h" #include "VersionUnit.h" #ifdef USE_CCS @@ -64,11 +62,7 @@ class CRepeaterHandler : public IRepeaterCallback, public IReflectorCallback, pu public: static void initialise(unsigned int maxRepeaters); -#ifdef USE_DRATS static void add(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3); -#else - static void add(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3); -#endif static void setLocalAddress(const std::string& address); static void setG2HandlerPool(CG2ProtocolHandlerPool* handler); @@ -143,11 +137,8 @@ public: virtual void readAPRSFrame(CAPRSFrame& frame); protected: -#ifdef USE_DRATS CRepeaterHandler(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3); -#else - CRepeaterHandler(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3); -#endif + virtual ~CRepeaterHandler(); void resolveUserInt(const std::string& user, const std::string& repeater, const std::string& gateway, const std::string& address); @@ -278,10 +269,8 @@ private: // APRS to DPRS CAPRSUnit* m_aprsUnit; -#ifdef USE_DRATS // D-RATS handler CDRATSServer* m_drats; -#endif // DTMF commands CDTMF m_dtmf; diff --git a/DStarGateway/DStarGatewayApp.cpp b/DStarGateway/DStarGatewayApp.cpp index 16c7f52..792a6bf 100644 --- a/DStarGateway/DStarGatewayApp.cpp +++ b/DStarGateway/DStarGatewayApp.cpp @@ -240,11 +240,9 @@ bool CDStarGatewayApp::createThread() delete restrictList; } -#ifdef USE_DRATS // Drats TDRats drats; m_config->getDRats(drats); -#endif // Setup the repeaters bool ddEnabled = false; @@ -266,9 +264,7 @@ bool CDStarGatewayApp::createThread() rptrConfig.reflectorAtStartup, rptrConfig.reflectorReconnect, rptrConfig.frequency, - #ifdef USE_DRATS drats.enabled, - #endif rptrConfig.offset, rptrConfig.range, rptrConfig.latitude, diff --git a/DStarGateway/DStarGatewayConfig.cpp b/DStarGateway/DStarGatewayConfig.cpp index 635a647..2cfd90a 100644 --- a/DStarGateway/DStarGatewayConfig.cpp +++ b/DStarGateway/DStarGatewayConfig.cpp @@ -57,9 +57,7 @@ bool CDStarGatewayConfig::load() #endif ret = loadDaemon(cfg) && ret; ret = loadAccessControl(cfg) && ret; -#ifdef USE_DRATS ret = loadDRats(cfg) && ret; -#endif } if(ret) { @@ -363,14 +361,12 @@ bool CDStarGatewayConfig::loadAccessControl(const CConfig & cfg) return ret; } -#ifdef USE_DRATS bool CDStarGatewayConfig::loadDRats(const CConfig & cfg) { bool ret = cfg.getValue("DRats", "enabled", m_drats.enabled, false); return ret; } -#endif bool CDStarGatewayConfig::open(CConfig & cfg) { @@ -479,9 +475,7 @@ void CDStarGatewayConfig::getAccessControl(TAccessControl & accessControl) const accessControl = m_accessControl; } -#if USE_DRATS void CDStarGatewayConfig::getDRats(TDRats & drats) const { drats = m_drats; -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/DStarGateway/DStarGatewayConfig.h b/DStarGateway/DStarGatewayConfig.h index fdb5339..d148987 100644 --- a/DStarGateway/DStarGatewayConfig.h +++ b/DStarGateway/DStarGatewayConfig.h @@ -56,9 +56,7 @@ typedef struct { HW_TYPE hwType; bool reflectorAtStartup; RECONNECT reflectorReconnect; -#ifdef USE_DRATS bool dRatsEnabled; -#endif double frequency; double offset; double range; @@ -115,11 +113,9 @@ typedef struct { bool enabled; } TDCS; -#ifdef USE_DRATS typedef struct { bool enabled; } TDRats; -#endif typedef struct { bool enabled; @@ -170,9 +166,7 @@ public: #endif void getDaemon(TDaemon & gen) const; void getAccessControl(TAccessControl & accessControl) const; -#ifdef USE_DRATS void getDRats(TDRats & drats) const; -#endif private: bool open(CConfig & cfg); @@ -192,9 +186,7 @@ private: #endif bool loadDaemon(const CConfig & cfg); bool loadAccessControl(const CConfig & cfg); -#ifdef USE_DRATS bool loadDRats(const CConfig & cfg); -#endif std::string m_fileName; TGateway m_gateway; @@ -211,9 +203,7 @@ private: #endif TDaemon m_daemon; TAccessControl m_accessControl; -#ifdef USE_DRATS TDRats m_drats; -#endif std::vector m_repeaters; std::vector m_ircDDB; diff --git a/DStarGateway/DStarGatewayThread.cpp b/DStarGateway/DStarGatewayThread.cpp index 73ea87c..1d7d074 100644 --- a/DStarGateway/DStarGatewayThread.cpp +++ b/DStarGateway/DStarGatewayThread.cpp @@ -511,15 +511,10 @@ void CDStarGatewayThread::setGateway(GATEWAY_TYPE gatewayType, const std::string m_gatewayAddress = gatewayAddress; } -#ifdef USE_DRATS + void CDStarGatewayThread::addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) { CRepeaterHandler::add(callsign, band, address, port, hwType, reflector, atStartup, reconnect, dratsEnabled, frequency, offset, range, latitude, longitude, agl, description1, description2, url, handler, band1, band2, band3); -#else -void CDStarGatewayThread::addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1, unsigned char band2, unsigned char band3) -{ - CRepeaterHandler::add(callsign, band, address, port, hwType, reflector, atStartup, reconnect, frequency, offset, range, latitude, longitude, agl, description1, description2, url, handler, band1, band2, band3); -#endif std::string repeater = callsign; repeater.resize(LONG_CALLSIGN_LENGTH - 1U); diff --git a/DStarGateway/DStarGatewayThread.h b/DStarGateway/DStarGatewayThread.h index 5b4fe3c..767a81d 100644 --- a/DStarGateway/DStarGatewayThread.h +++ b/DStarGateway/DStarGatewayThread.h @@ -44,11 +44,8 @@ public: virtual ~CDStarGatewayThread(); virtual void setGateway(GATEWAY_TYPE type, const std::string& callsign, const std::string& address); -#ifdef USE_DRATS -virtual void addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1 = 0x00U, unsigned char band2 = 0x00U, unsigned char band3 = 0x00U); -#else - virtual void addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1 = 0x00U, unsigned char band2 = 0x00U, unsigned char band3 = 0x00U); -#endif + virtual void addRepeater(const std::string& callsign, const std::string& band, const std::string& address, unsigned int port, HW_TYPE hwType, const std::string& reflector, bool atStartup, RECONNECT reconnect, bool dratsEnabled, double frequency, double offset, double range, double latitude, double longitude, double agl, const std::string& description1, const std::string& description2, const std::string& url, IRepeaterProtocolHandler* handler, unsigned char band1 = 0x00U, unsigned char band2 = 0x00U, unsigned char band3 = 0x00U); + #ifdef USE_STARNET #if defined(DEXTRA_LINK) || defined(DCS_LINK) virtual void addStarNet(const std::string& callsign, const std::string& logoff, const std::string& repeater, const std::string& infoText, const std::string& permanent, unsigned int userTimeout, unsigned int groupTimeout, STARNET_CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string& reflector); diff --git a/Makefile b/Makefile index 28e98c0..d7daf6d 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,6 @@ export CPPFLAGS+= -DUSE_GPSD export LDFLAGS+= -lgps endif -ifeq ($(USE_DRATS), 1) -export CPPFLAGS+= -DUSE_DRATS -endif - .PHONY: all all: DStarGateway/dstargateway DGWRemoteControl/dgwremotecontrol DGWTextTransmit/dgwtexttransmit DGWTimeServer/dgwtimeserver DGWVoiceTransmit/dgwvoicetransmit #tests diff --git a/README.md b/README.md index bc530e6..afda621 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ - [3.4. Prerequisites and dependencies](#34-prerequisites-and-dependencies) - [3.5. Building](#35-building) - [3.5.0.1. Build With GPSD Support](#3501-build-with-gpsd-support) - - [3.5.0.2. Build With DRats Support](#3502-build-with-drats-support) - - [3.5.0.3. Debug Build](#3503-debug-build) + - [3.5.0.2. Debug Build](#3502-debug-build) - [3.6. Installing](#36-installing) - [3.7. Configuring](#37-configuring) - [3.8. Updating host files](#38-updating-host-files) @@ -102,12 +101,7 @@ make ``` make USE_GPS=1 ``` -#### 3.5.0.2. Build With DRats Support -IMHO Drats is a decaying thing, therefore it is included as a build option. -``` -make USE_DRATS=1 -``` -#### 3.5.0.3. Debug Build +#### 3.5.0.2. Debug Build ``` make ENABLE_DEBUG=1 ```