diff --git a/Conf.cpp b/Conf.cpp index 4188319..559a2aa 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ m_localAddress("127.0.0.1"), m_localPort(62031U), m_rfTimeout(10U), m_netTimeout(10U), +m_removeTA(false), m_ruleTrace(false), m_debug(false), m_voiceEnabled(true), @@ -206,6 +207,8 @@ bool CConf::read() m_localAddress = value; else if (::strcmp(key, "LocalPort") == 0) m_localPort = (unsigned int)::atoi(value); + else if (::strcmp(key, "RemoveTA") == 0) + m_removeTA = ::atoi(value) == 1; else if (::strcmp(key, "RuleTrace") == 0) m_ruleTrace = ::atoi(value) == 1; else if (::strcmp(key, "Debug") == 0) @@ -579,6 +582,11 @@ unsigned int CConf::getNetTimeout() const return m_netTimeout; } +bool CConf::getRemoveTA() const +{ + return m_removeTA; +} + bool CConf::getRuleTrace() const { return m_ruleTrace; diff --git a/Conf.h b/Conf.h index fd16f67..9b1a47e 100644 --- a/Conf.h +++ b/Conf.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX + * Copyright (C) 2015,2016,2017,2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,6 +69,7 @@ public: unsigned int getRptPort() const; std::string getLocalAddress() const; unsigned int getLocalPort() const; + bool getRemoveTA() const; bool getRuleTrace() const; bool getDebug() const; @@ -175,6 +176,7 @@ private: unsigned int m_localPort; unsigned int m_rfTimeout; unsigned int m_netTimeout; + bool m_removeTA; bool m_ruleTrace; bool m_debug; diff --git a/DMRGateway.cpp b/DMRGateway.cpp index 00beeea..716e619 100644 --- a/DMRGateway.cpp +++ b/DMRGateway.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX + * Copyright (C) 2015-2019 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include "PassAllPC.h" #include "PassAllTG.h" #include "DMRFullLC.h" +#include "RemoveTA.h" #include "Version.h" #include "Thread.h" #include "DMRLC.h" @@ -344,6 +345,10 @@ int CDMRGateway::run() return 1; } + CRemoveTA* removeTA = NULL; + if (m_conf.getRemoveTA()) + removeTA = new CRemoveTA; + unsigned int rfTimeout = m_conf.getRFTimeout(); unsigned int netTimeout = m_conf.getNetTimeout(); @@ -689,6 +694,8 @@ int CDMRGateway::run() if (status[m_xlxSlot] == DMRGWS_NONE || status[m_xlxSlot] == DMRGWS_XLXREFLECTOR) { bool ret = m_rptRewrite->process(data, false); if (ret) { + if (removeTA != NULL) + removeTA->process(data); m_repeater->write(data); status[m_xlxSlot] = DMRGWS_XLXREFLECTOR; timer[m_xlxSlot]->setTimeout(netTimeout); @@ -735,6 +742,8 @@ int CDMRGateway::run() // Check that the rewritten slot is free to use. slotNo = data.getSlotNo(); if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK1) { + if (removeTA != NULL) + removeTA->process(data); m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK1; timer[slotNo]->setTimeout(netTimeout); @@ -783,6 +792,8 @@ int CDMRGateway::run() // Check that the rewritten slot is free to use. slotNo = data.getSlotNo(); if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK2) { + if (removeTA != NULL) + removeTA->process(data); m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK2; timer[slotNo]->setTimeout(netTimeout); @@ -831,6 +842,8 @@ int CDMRGateway::run() // Check that the rewritten slot is free to use. slotNo = data.getSlotNo(); if (status[slotNo] == DMRGWS_NONE || status[slotNo] == DMRGWS_DMRNETWORK3) { + if (removeTA != NULL) + removeTA->process(data); m_repeater->write(data); status[slotNo] = DMRGWS_DMRNETWORK3; timer[slotNo]->setTimeout(netTimeout); @@ -931,6 +944,7 @@ int CDMRGateway::run() } delete voice; + delete removeTA; m_repeater->close(); delete m_repeater; diff --git a/DMRGateway.ini b/DMRGateway.ini index 95dfba0..379d14c 100644 --- a/DMRGateway.ini +++ b/DMRGateway.ini @@ -6,6 +6,7 @@ RptAddress=127.0.0.1 RptPort=62032 LocalAddress=127.0.0.1 LocalPort=62031 +RemoveTA=0 RuleTrace=0 Daemon=0 Debug=0 diff --git a/DMRGateway.vcxproj b/DMRGateway.vcxproj index ef04032..8ef11f4 100644 --- a/DMRGateway.vcxproj +++ b/DMRGateway.vcxproj @@ -175,6 +175,7 @@ + @@ -215,6 +216,7 @@ + diff --git a/DMRGateway.vcxproj.filters b/DMRGateway.vcxproj.filters index 239becf..1d4ba5a 100644 --- a/DMRGateway.vcxproj.filters +++ b/DMRGateway.vcxproj.filters @@ -104,6 +104,9 @@ Header Files + + Header Files + Header Files @@ -214,6 +217,9 @@ Source Files + + Source Files + Source Files diff --git a/Makefile b/Makefile index b0ae9f3..0c9b06e 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ LIBS = -lpthread LDFLAGS = -g OBJECTS = BPTC19696.o Conf.o CRC.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o \ - Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o Reflectors.o RepeaterProtocol.o Rewrite.o RewritePC.o RewriteSrc.o RewriteTG.o \ - RewriteType.o RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o Utils.o Voice.o + Golay2087.o Hamming.o Log.o MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.o Reflectors.o RepeaterProtocol.o RemoveTA.o Rewrite.o RewritePC.o \ + RewriteSrc.o RewriteTG.o RewriteType.o RS129.o SHA256.o StopWatch.o Sync.o Thread.o Timer.o UDPSocket.o Utils.o Voice.o all: DMRGateway diff --git a/RemoveTA.cpp b/RemoveTA.cpp index 76c52ea..f7af089 100644 --- a/RemoveTA.cpp +++ b/RemoveTA.cpp @@ -64,9 +64,9 @@ void CRemoveTA::process(CDMRData& data) void CRemoveTA::processHeader(CDMRData& data, unsigned char dataType) { CDMRLC lc; - lc.setFLCO(flco); - lc.setSrcId(srcId); - lc.setDstId(dstId); + lc.setFLCO(data.getFLCO()); + lc.setSrcId(data.getSrcId); + lc.setDstId(data.getDstId); m_embeddedLC.setLC(lc); }