Add Pass All parameters for TGs and Private Calls.

This commit is contained in:
Jonathan Naylor
2017-05-27 16:50:34 +01:00
parent 92bda23094
commit a4cff2f3d7
11 changed files with 303 additions and 3 deletions

View File

@@ -65,6 +65,8 @@ m_dmrNetwork1TGRewrites(),
m_dmrNetwork1PCRewrites(),
m_dmrNetwork1TypeRewrites(),
m_dmrNetwork1SrcRewrites(),
m_dmrNetwork1PassAllPC(),
m_dmrNetwork1PassAllTG(),
m_dmrNetwork2Enabled(false),
m_dmrNetwork2Id(0U),
m_dmrNetwork2Address(),
@@ -77,6 +79,8 @@ m_dmrNetwork2TGRewrites(),
m_dmrNetwork2PCRewrites(),
m_dmrNetwork2TypeRewrites(),
m_dmrNetwork2SrcRewrites(),
m_dmrNetwork2PassAllPC(),
m_dmrNetwork2PassAllTG(),
m_xlxNetwork1Enabled(false),
m_xlxNetwork1Id(0U),
m_xlxNetwork1Address(),
@@ -302,6 +306,12 @@ bool CConf::read()
rewrite.m_range = ::atoi(p5);
m_dmrNetwork1SrcRewrites.push_back(rewrite);
}
} else if (::strcmp(key, "PassAllPC") == 0) {
unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork1PassAllPC.push_back(slotNo);
} else if (::strcmp(key, "PassAllTG") == 0) {
unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork1PassAllTG.push_back(slotNo);
}
} else if (section == SECTION_DMR_NETWORK_2) {
if (::strcmp(key, "Enabled") == 0)
@@ -378,6 +388,12 @@ bool CConf::read()
rewrite.m_range = ::atoi(p5);
m_dmrNetwork2SrcRewrites.push_back(rewrite);
}
} else if (::strcmp(key, "PassAllPC") == 0) {
unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork2PassAllPC.push_back(slotNo);
} else if (::strcmp(key, "PassAllTG") == 0) {
unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork2PassAllTG.push_back(slotNo);
}
}
}
@@ -627,6 +643,16 @@ std::vector<CSrcRewriteStruct> CConf::getDMRNetwork1SrcRewrites() const
return m_dmrNetwork1SrcRewrites;
}
std::vector<unsigned int> CConf::getDMRNetwork1PassAllPC() const
{
return m_dmrNetwork1PassAllPC;
}
std::vector<unsigned int> CConf::getDMRNetwork1PassAllTG() const
{
return m_dmrNetwork1PassAllTG;
}
bool CConf::getDMRNetwork2Enabled() const
{
return m_dmrNetwork2Enabled;
@@ -686,3 +712,13 @@ std::vector<CSrcRewriteStruct> CConf::getDMRNetwork2SrcRewrites() const
{
return m_dmrNetwork2SrcRewrites;
}
std::vector<unsigned int> CConf::getDMRNetwork2PassAllPC() const
{
return m_dmrNetwork2PassAllPC;
}
std::vector<unsigned int> CConf::getDMRNetwork2PassAllTG() const
{
return m_dmrNetwork2PassAllTG;
}

8
Conf.h
View File

@@ -94,6 +94,8 @@ public:
std::vector<CPCRewriteStruct> getDMRNetwork1PCRewrites() const;
std::vector<CTypeRewriteStruct> getDMRNetwork1TypeRewrites() const;
std::vector<CSrcRewriteStruct> getDMRNetwork1SrcRewrites() const;
std::vector<unsigned int> getDMRNetwork1PassAllPC() const;
std::vector<unsigned int> getDMRNetwork1PassAllTG() const;
// The DMR Network 2 section
bool getDMRNetwork2Enabled() const;
@@ -108,6 +110,8 @@ public:
std::vector<CPCRewriteStruct> getDMRNetwork2PCRewrites() const;
std::vector<CTypeRewriteStruct> getDMRNetwork2TypeRewrites() const;
std::vector<CSrcRewriteStruct> getDMRNetwork2SrcRewrites() const;
std::vector<unsigned int> getDMRNetwork2PassAllPC() const;
std::vector<unsigned int> getDMRNetwork2PassAllTG() const;
// The XLX Network 1 section
bool getXLXNetwork1Enabled() const;
@@ -166,6 +170,8 @@ private:
std::vector<CPCRewriteStruct> m_dmrNetwork1PCRewrites;
std::vector<CTypeRewriteStruct> m_dmrNetwork1TypeRewrites;
std::vector<CSrcRewriteStruct> m_dmrNetwork1SrcRewrites;
std::vector<unsigned int> m_dmrNetwork1PassAllPC;
std::vector<unsigned int> m_dmrNetwork1PassAllTG;
bool m_dmrNetwork2Enabled;
unsigned int m_dmrNetwork2Id;
@@ -179,6 +185,8 @@ private:
std::vector<CPCRewriteStruct> m_dmrNetwork2PCRewrites;
std::vector<CTypeRewriteStruct> m_dmrNetwork2TypeRewrites;
std::vector<CSrcRewriteStruct> m_dmrNetwork2SrcRewrites;
std::vector<unsigned int> m_dmrNetwork2PassAllPC;
std::vector<unsigned int> m_dmrNetwork2PassAllTG;
bool m_xlxNetwork1Enabled;
unsigned int m_xlxNetwork1Id;

View File

@@ -21,6 +21,8 @@
#include "DMRGateway.h"
#include "StopWatch.h"
#include "RewritePC.h"
#include "PassAllPC.h"
#include "PassAllTG.h"
#include "Version.h"
#include "Thread.h"
#include "Voice.h"
@@ -778,6 +780,28 @@ bool CDMRGateway::createDMRNetwork1()
m_dmr1NetRewrites.push_back(rewrite);
}
std::vector<unsigned int> tgPassAll = m_conf.getDMRNetwork2PassAllTG();
for (std::vector<unsigned int>::const_iterator it = tgPassAll.begin(); it != tgPassAll.end(); ++it) {
LogInfo(" Pass All TG: %u", *it);
CPassAllTG* rfPassAllTG = new CPassAllTG("DMR-1", *it);
CPassAllTG* netPassAllTG = new CPassAllTG("DMR-1", *it);
m_dmr1RFRewrites.push_back(rfPassAllTG);
m_dmr1NetRewrites.push_back(netPassAllTG);
}
std::vector<unsigned int> pcPassAll = m_conf.getDMRNetwork2PassAllPC();
for (std::vector<unsigned int>::const_iterator it = pcPassAll.begin(); it != pcPassAll.end(); ++it) {
LogInfo(" Pass All PC: %u", *it);
CPassAllPC* rfPassAllPC = new CPassAllPC("DMR-1", *it);
CPassAllPC* netPassAllPC = new CPassAllPC("DMR-1", *it);
m_dmr1RFRewrites.push_back(rfPassAllPC);
m_dmr1NetRewrites.push_back(netPassAllPC);
}
return true;
}
@@ -864,6 +888,28 @@ bool CDMRGateway::createDMRNetwork2()
m_dmr2NetRewrites.push_back(rewrite);
}
std::vector<unsigned int> tgPassAll = m_conf.getDMRNetwork2PassAllTG();
for (std::vector<unsigned int>::const_iterator it = tgPassAll.begin(); it != tgPassAll.end(); ++it) {
LogInfo(" Pass All TG: %u", *it);
CPassAllTG* rfPassAllTG = new CPassAllTG("DMR-2", *it);
CPassAllTG* netPassAllTG = new CPassAllTG("DMR-2", *it);
m_dmr2RFRewrites.push_back(rfPassAllTG);
m_dmr2NetRewrites.push_back(netPassAllTG);
}
std::vector<unsigned int> pcPassAll = m_conf.getDMRNetwork2PassAllPC();
for (std::vector<unsigned int>::const_iterator it = pcPassAll.begin(); it != pcPassAll.end(); ++it) {
LogInfo(" Pass All PC: %u", *it);
CPassAllPC* rfPassAllPC = new CPassAllPC("DMR-2", *it);
CPassAllPC* netPassAllPC = new CPassAllPC("DMR-2", *it);
m_dmr2RFRewrites.push_back(rfPassAllPC);
m_dmr2NetRewrites.push_back(netPassAllPC);
}
return true;
}

View File

@@ -60,6 +60,9 @@ TypeRewrite=1,9990,1,9990
SrcRewrite=1,9990,1,9990,1
# Reflector status returns
SrcRewrite=2,4000,2,9,1001
# Pass all of the other private traffic on slot 1 and slot 2
PassAllPC=1
PassAllPC=2
Password=PASSWORD
Debug=0
@@ -75,5 +78,8 @@ TGRewrite=2,8,2,9,1
TGRewrite=2,9990,2,9990,1
# Reflector control command slot 2 84000->4000 to 85000->5000
PCRewrite=2,84000,2,4000,1001
# Pass all of the other talk group traffic on slot 1 and slot 2
PassAllTG=1
PassAllTG=2
Password=PASSWORD
Debug=0

View File

@@ -168,6 +168,8 @@
<ClInclude Include="Hamming.h" />
<ClInclude Include="Log.h" />
<ClInclude Include="MMDVMNetwork.h" />
<ClInclude Include="PassAllPC.h" />
<ClInclude Include="PassAllTG.h" />
<ClInclude Include="QR1676.h" />
<ClInclude Include="RepeaterProtocol.h" />
<ClInclude Include="Rewrite.h" />
@@ -203,6 +205,8 @@
<ClCompile Include="Hamming.cpp" />
<ClCompile Include="Log.cpp" />
<ClCompile Include="MMDVMNetwork.cpp" />
<ClCompile Include="PassAllPC.cpp" />
<ClCompile Include="PassAllTG.cpp" />
<ClCompile Include="QR1676.cpp" />
<ClCompile Include="RepeaterProtocol.cpp" />
<ClCompile Include="Rewrite.cpp" />

View File

@@ -113,6 +113,12 @@
<ClInclude Include="RewriteType.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PassAllPC.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="PassAllTG.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Conf.cpp">
@@ -208,5 +214,11 @@
<ClCompile Include="RewriteType.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PassAllPC.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="PassAllTG.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@@ -5,8 +5,8 @@ LIBS = -lpthread
LDFLAGS = -g
OBJECTS = BPTC19696.o Conf.o CRC.o DMRData.o DMREmbeddedData.o DMREMB.o DMRFullLC.o DMRGateway.o DMRLC.o DMRNetwork.o DMRSlotType.o Golay2087.o Hamming.o Log.o \
MMDVMNetwork.o QR1676.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
MMDVMNetwork.o PassAllPC.o PassAllTG.o QR1676.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
all: DMRGateway

53
PassAllPC.cpp Normal file
View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2017 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "PassAllPC.h"
#include "DMRDefines.h"
#include <cstdio>
#include <cassert>
CPassAllPC::CPassAllPC(const char* name, unsigned int slot) :
m_name(name),
m_slot(slot)
{
assert(slot == 1U || slot == 2U);
}
CPassAllPC::~CPassAllPC()
{
}
bool CPassAllPC::processRF(CDMRData& data)
{
return process(data);
}
bool CPassAllPC::processNet(CDMRData& data)
{
return process(data);
}
bool CPassAllPC::process(CDMRData& data)
{
FLCO flco = data.getFLCO();
unsigned int slotNo = data.getSlotNo();
return flco == FLCO_USER_USER || slotNo == m_slot;
}

41
PassAllPC.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2017 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(PASSALLPC_H)
#define PASSALLPC_H
#include "Rewrite.h"
#include "DMRData.h"
class CPassAllPC : public IRewrite {
public:
CPassAllPC(const char* name, unsigned int slot);
virtual ~CPassAllPC();
virtual bool processRF(CDMRData& data);
virtual bool processNet(CDMRData& data);
private:
const char* m_name;
unsigned int m_slot;
bool process(CDMRData& data);
};
#endif

53
PassAllTG.cpp Normal file
View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2017 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "PassAllTG.h"
#include "DMRDefines.h"
#include <cstdio>
#include <cassert>
CPassAllTG::CPassAllTG(const char* name, unsigned int slot) :
m_name(name),
m_slot(slot)
{
assert(slot == 1U || slot == 2U);
}
CPassAllTG::~CPassAllTG()
{
}
bool CPassAllTG::processRF(CDMRData& data)
{
return process(data);
}
bool CPassAllTG::processNet(CDMRData& data)
{
return process(data);
}
bool CPassAllTG::process(CDMRData& data)
{
FLCO flco = data.getFLCO();
unsigned int slotNo = data.getSlotNo();
return flco == FLCO_GROUP || slotNo == m_slot;
}

41
PassAllTG.h Normal file
View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2017 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(PASSALLTG_H)
#define PASSALLTG_H
#include "Rewrite.h"
#include "DMRData.h"
class CPassAllTG : public IRewrite {
public:
CPassAllTG(const char* name, unsigned int slot);
virtual ~CPassAllTG();
virtual bool processRF(CDMRData& data);
virtual bool processNet(CDMRData& data);
private:
const char* m_name;
unsigned int m_slot;
bool process(CDMRData& data);
};
#endif