mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-24 07:15:38 +08:00
Integrate it into the main code.
This commit is contained in:
10
Conf.cpp
10
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;
|
||||
|
||||
4
Conf.h
4
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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
<ClInclude Include="QR1676.h" />
|
||||
<ClInclude Include="Reflectors.h" />
|
||||
<ClInclude Include="RepeaterProtocol.h" />
|
||||
<ClInclude Include="RemoveTA.h" />
|
||||
<ClInclude Include="Rewrite.h" />
|
||||
<ClInclude Include="RewritePC.h" />
|
||||
<ClInclude Include="RewriteSrc.h" />
|
||||
@@ -215,6 +216,7 @@
|
||||
<ClCompile Include="QR1676.cpp" />
|
||||
<ClCompile Include="Reflectors.cpp" />
|
||||
<ClCompile Include="RepeaterProtocol.cpp" />
|
||||
<ClCompile Include="RemoveTA.cpp" />
|
||||
<ClCompile Include="Rewrite.cpp" />
|
||||
<ClCompile Include="RewritePC.cpp" />
|
||||
<ClCompile Include="RewriteSrc.cpp" />
|
||||
|
||||
@@ -104,6 +104,9 @@
|
||||
<ClInclude Include="RewritePC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RemoveTA.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Rewrite.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -214,6 +217,9 @@
|
||||
<ClCompile Include="RewritePC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RemoveTA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Rewrite.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
4
Makefile
4
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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user