From 409135abefbfb9fd21685b81eaa0a5c475d1e797 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 22 Sep 2017 20:32:12 +0100 Subject: [PATCH 1/3] Upgrade the README. --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 22d66a4..8b77c7f 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,8 @@ For example, the default configuration moves the announcements from BrandMeister The rewrite rules don’t apply to the XLX reflector, where only the slot and the talk group used may be changed. The controls i.e. private calls, for altering the reflector are fixed. -It is hoped to expand the program in future to allow more functionality under the control of the sysop. +The MMDVM .ini file should have the IP address and port number of the client in the [DMR Network] settings. + +They build on 32-bit and 64-bit Linux as well as on Windows using Visual Studio 2017 on x86 and x64. + +This software is licenced under the GPL v2 and is intended for amateur and educational use only. Use of this software for commercial purposes is strictly forbidden. From c62c5fe0610563d1dc36ef06a86f90a211b5fda7 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 22 Sep 2017 20:49:12 +0100 Subject: [PATCH 2/3] Use the rewritten slot for checking if it is free. --- DMRGateway.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DMRGateway.cpp b/DMRGateway.cpp index fa62f9a..4a51d33 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -721,8 +721,7 @@ int CDMRGateway::run() m_repeater->write(data); status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2; timer[m_xlx2Slot]->start(); - } - else { + } else { unsigned int slotNo = data.getSlotNo(); unsigned int dstId = data.getDstId(); FLCO flco = data.getFLCO(); @@ -761,6 +760,8 @@ int CDMRGateway::run() } if (rewritten) { + // Check that the rewritten slot is free to use. + slotNo = data.getSlotNo(); if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) { m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK1; @@ -806,6 +807,8 @@ int CDMRGateway::run() } if (rewritten) { + // Check that the rewritten slot is free to use. + slotNo = data.getSlotNo(); if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) { m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK2; From b966fe71670fc5c537a76177dd29062ca122a241 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 22 Sep 2017 21:03:44 +0100 Subject: [PATCH 3/3] Add seperate timeouts for RF and network. --- Conf.cpp | 18 ++++++++++++++---- Conf.h | 6 ++++-- DMRGateway.cpp | 21 ++++++++++++++++++--- DMRGateway.ini | 2 ++ 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Conf.cpp b/Conf.cpp index e9b80e8..6ebe267 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -44,7 +44,8 @@ m_rptAddress("127.0.0.1"), m_rptPort(62032U), m_localAddress("127.0.0.1"), m_localPort(62031U), -m_timeout(10U), +m_rfTimeout(10U), +m_netTimeout(10U), m_ruleTrace(false), m_debug(false), m_voiceEnabled(true), @@ -169,7 +170,11 @@ bool CConf::read() if (::strcmp(key, "Daemon") == 0) m_daemon = ::atoi(value) == 1; else if (::strcmp(key, "Timeout") == 0) - m_timeout = (unsigned int)::atoi(value); + m_rfTimeout = m_netTimeout = (unsigned int)::atoi(value); + else if (::strcmp(key, "RFTimeout") == 0) + m_rfTimeout = (unsigned int)::atoi(value); + else if (::strcmp(key, "NetTimeout") == 0) + m_netTimeout = (unsigned int)::atoi(value); else if (::strcmp(key, "RptAddress") == 0) m_rptAddress = value; else if (::strcmp(key, "RptPort") == 0) @@ -461,9 +466,14 @@ unsigned int CConf::getLocalPort() const return m_localPort; } -unsigned int CConf::getTimeout() const +unsigned int CConf::getRFTimeout() const { - return m_timeout; + return m_rfTimeout; +} + +unsigned int CConf::getNetTimeout() const +{ + return m_netTimeout; } bool CConf::getRuleTrace() const diff --git a/Conf.h b/Conf.h index a24a33f..54c497c 100644 --- a/Conf.h +++ b/Conf.h @@ -63,7 +63,8 @@ public: // The General section bool getDaemon() const; - unsigned int getTimeout() const; + unsigned int getRFTimeout() const; + unsigned int getNetTimeout() const; std::string getRptAddress() const; unsigned int getRptPort() const; std::string getLocalAddress() const; @@ -157,7 +158,8 @@ private: unsigned int m_rptPort; std::string m_localAddress; unsigned int m_localPort; - unsigned int m_timeout; + unsigned int m_rfTimeout; + unsigned int m_netTimeout; bool m_ruleTrace; bool m_debug; diff --git a/DMRGateway.cpp b/DMRGateway.cpp index 4a51d33..345fd4e 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -329,7 +329,8 @@ int CDMRGateway::run() return 1; } - unsigned int timeout = m_conf.getTimeout(); + unsigned int rfTimeout = m_conf.getRFTimeout(); + unsigned int netTimeout = m_conf.getNetTimeout(); CVoice* voice1 = NULL; CVoice* voice2 = NULL; @@ -362,8 +363,8 @@ int CDMRGateway::run() } CTimer* timer[3U]; - timer[1U] = new CTimer(1000U, timeout); - timer[2U] = new CTimer(1000U, timeout); + timer[1U] = new CTimer(1000U); + timer[2U] = new CTimer(1000U); DMRGW_STATUS status[3U]; status[1U] = DMRGWS_NONE; @@ -489,6 +490,7 @@ int CDMRGateway::run() m_xlx1Rewrite->process(data, false); m_xlxNetwork1->write(data); status[slotNo] = DMRGWS_XLXREFLECTOR1; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } else if (flco == FLCO_GROUP && slotNo == m_xlx2Slot && dstId == m_xlx2TG) { if (m_xlx2Reflector != m_xlx2Startup) @@ -497,6 +499,7 @@ int CDMRGateway::run() m_xlx2Rewrite->process(data, false); m_xlxNetwork2->write(data); status[slotNo] = DMRGWS_XLXREFLECTOR2; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } else if ((dstId <= (m_xlx1Base + 26U) || dstId == (m_xlx1Base + 1000U)) && flco == FLCO_USER_USER && slotNo == m_xlx1Slot && dstId >= m_xlx1Base) { dstId += 4000U; @@ -530,6 +533,7 @@ int CDMRGateway::run() } status[slotNo] = DMRGWS_XLXREFLECTOR1; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); if (voice1 != NULL) { @@ -576,6 +580,7 @@ int CDMRGateway::run() } status[slotNo] = DMRGWS_XLXREFLECTOR2; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); if (voice2 != NULL) { @@ -622,6 +627,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) { m_dmrNetwork1->write(data); status[slotNo] = DMRGWS_DMRNETWORK1; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } } @@ -642,6 +648,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) { m_dmrNetwork2->write(data); status[slotNo] = DMRGWS_DMRNETWORK2; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } } @@ -662,6 +669,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) { m_dmrNetwork1->write(data); status[slotNo] = DMRGWS_DMRNETWORK1; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } } @@ -682,6 +690,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) { m_dmrNetwork2->write(data); status[slotNo] = DMRGWS_DMRNETWORK2; + timer[slotNo]->setTimeout(rfTimeout); timer[slotNo]->start(); } } @@ -701,6 +710,7 @@ int CDMRGateway::run() if (ret) { m_repeater->write(data); status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1; + timer[m_xlx1Slot]->setTimeout(netTimeout); timer[m_xlx1Slot]->start(); } else { unsigned int slotNo = data.getSlotNo(); @@ -720,6 +730,7 @@ int CDMRGateway::run() if (ret) { m_repeater->write(data); status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2; + timer[m_xlx2Slot]->setTimeout(netTimeout); timer[m_xlx2Slot]->start(); } else { unsigned int slotNo = data.getSlotNo(); @@ -765,6 +776,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) { m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK1; + timer[slotNo]->setTimeout(netTimeout); timer[slotNo]->start(); } } @@ -812,6 +824,7 @@ int CDMRGateway::run() if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) { m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK2; + timer[slotNo]->setTimeout(netTimeout); timer[slotNo]->start(); } } @@ -855,6 +868,7 @@ int CDMRGateway::run() if (ret) { m_repeater->write(data); status[m_xlx1Slot] = DMRGWS_XLXREFLECTOR1; + timer[m_xlx1Slot]->setTimeout(netTimeout); timer[m_xlx1Slot]->start(); } } @@ -864,6 +878,7 @@ int CDMRGateway::run() if (ret) { m_repeater->write(data); status[m_xlx2Slot] = DMRGWS_XLXREFLECTOR2; + timer[m_xlx2Slot]->setTimeout(netTimeout); timer[m_xlx2Slot]->start(); } } diff --git a/DMRGateway.ini b/DMRGateway.ini index 2f64676..57f4d2b 100644 --- a/DMRGateway.ini +++ b/DMRGateway.ini @@ -1,5 +1,7 @@ [General] Timeout=10 +# RFTimeout=10 +# NetTimeout=7 RptAddress=127.0.0.1 RptPort=62032 LocalAddress=127.0.0.1