From 3ce8076e89ee40c8b205ad354880714200908b6c Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 21 Oct 2018 10:18:55 +0100 Subject: [PATCH] Add config option to enable/disable user XLX link control --- Conf.cpp | 9 ++++++++- Conf.h | 2 ++ DMRGateway.cpp | 22 +++++++++++++++------- DMRGateway.h | 1 + 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index 9679cac..f4b7acb 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -126,7 +126,8 @@ m_xlxNetworkTG(8U), m_xlxNetworkBase(84000U), m_xlxNetworkStartup(4000U), m_xlxNetworkRelink(0U), -m_xlxNetworkDebug(false) +m_xlxNetworkDebug(false), +m_xlxNetworkUserControl(true) { } @@ -272,6 +273,8 @@ bool CConf::read() m_xlxNetworkRelink = (unsigned int)::atoi(value); else if (::strcmp(key, "Debug") == 0) m_xlxNetworkDebug = ::atoi(value) == 1; + else if (::strcmp(key, "UserControl") == 0) + m_xlxNetworkUserControl = atoi(value) ==1; } else if (section == SECTION_DMR_NETWORK_1) { if (::strcmp(key, "Enabled") == 0) m_dmrNetwork1Enabled = ::atoi(value) == 1; @@ -732,6 +735,10 @@ bool CConf::getXLXNetworkDebug() const { return m_xlxNetworkDebug; } +bool CConf::getXLXNetworkUserControl() const +{ + return m_xlxNetworkUserControl; +} bool CConf::getDMRNetwork1Enabled() const { diff --git a/Conf.h b/Conf.h index 927e792..4412193 100644 --- a/Conf.h +++ b/Conf.h @@ -163,6 +163,7 @@ public: unsigned int getXLXNetworkStartup() const; unsigned int getXLXNetworkRelink() const; bool getXLXNetworkDebug() const; + bool getXLXNetworkUserControl() const; private: std::string m_file; @@ -260,6 +261,7 @@ private: unsigned int m_xlxNetworkStartup; unsigned int m_xlxNetworkRelink; bool m_xlxNetworkDebug; + bool m_xlxNetworkUserControl; }; #endif diff --git a/DMRGateway.cpp b/DMRGateway.cpp index 2b161e5..a85139a 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -156,6 +156,7 @@ m_xlxRoom(4000U), m_xlxRelink(1000U), m_xlxConnected(false), m_xlxDebug(false), +m_xlxUserControl(true), m_rptRewrite(NULL), m_xlxRewrite(NULL), m_dmr1NetRewrites(), @@ -483,7 +484,7 @@ int CDMRGateway::run() status[slotNo] = DMRGWS_XLXREFLECTOR; timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); - } else if ((dstId <= (m_xlxBase + 26U) || dstId == (m_xlxBase + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlxSlot && dstId >= m_xlxBase) { + } else if ((dstId <= (m_xlxBase + 26U) || dstId == (m_xlxBase + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlxSlot && dstId >= m_xlxBase && m_xlxUserControl) { dstId += 4000U; dstId -= m_xlxBase; @@ -525,7 +526,7 @@ int CDMRGateway::run() } } } - } else if (dstId >= (m_xlxBase + 4000U) && dstId < (m_xlxBase + 5000U) && flco == FLCO_USER_USER && slotNo == m_xlxSlot) { + } else if (dstId >= (m_xlxBase + 4000U) && dstId < (m_xlxBase + 5000U) && flco == FLCO_USER_USER && slotNo == m_xlxSlot && m_xlxUserControl) { dstId -= 4000U; dstId -= m_xlxBase; @@ -1370,11 +1371,12 @@ bool CDMRGateway::createXLXNetwork() return false; } - m_xlxLocal = m_conf.getXLXNetworkLocal(); - m_xlxPort = m_conf.getXLXNetworkPort(); - m_xlxPassword = m_conf.getXLXNetworkPassword(); - m_xlxId = m_conf.getXLXNetworkId(); - m_xlxDebug = m_conf.getXLXNetworkDebug(); + m_xlxLocal = m_conf.getXLXNetworkLocal(); + m_xlxPort = m_conf.getXLXNetworkPort(); + m_xlxPassword = m_conf.getXLXNetworkPassword(); + m_xlxId = m_conf.getXLXNetworkId(); + m_xlxDebug = m_conf.getXLXNetworkDebug(); + m_xlxUserControl = m_conf.getXLXNetworkUserControl(); if (m_xlxId == 0U) m_xlxId = m_repeater->getId(); @@ -1406,6 +1408,12 @@ bool CDMRGateway::createXLXNetwork() } else { LogInfo(" Relink: disabled"); } + if (m_xlxUserControl) { + LogInfo(" User Control: enabled"); + } else { + LogInfo(" User Control: disabled"); + } + if (m_xlxStartup > 0U) linkXLX(m_xlxStartup); diff --git a/DMRGateway.h b/DMRGateway.h index 6fa0e07..de9cdb6 100644 --- a/DMRGateway.h +++ b/DMRGateway.h @@ -65,6 +65,7 @@ private: CTimer m_xlxRelink; bool m_xlxConnected; bool m_xlxDebug; + bool m_xlxUserControl; CRewriteTG* m_rptRewrite; CRewriteTG* m_xlxRewrite; std::vector m_dmr1NetRewrites;