Modify Type Rewrite to handle BM Echo.

This commit is contained in:
Jonathan Naylor
2017-05-24 17:46:07 +01:00
parent f3c95d6618
commit c2bcec4a59
6 changed files with 25 additions and 26 deletions

View File

@@ -242,9 +242,9 @@ bool CConf::read()
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toTG = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
m_dmrNetwork1TypeRewrites.push_back(rewrite); m_dmrNetwork1TypeRewrites.push_back(rewrite);
} }
} else if (::strcmp(key, "SrcRewrite") == 0) { } else if (::strcmp(key, "SrcRewrite") == 0) {
@@ -318,9 +318,9 @@ bool CConf::read()
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toTG = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
m_dmrNetwork2TypeRewrites.push_back(rewrite); m_dmrNetwork2TypeRewrites.push_back(rewrite);
} }
} else if (::strcmp(key, "SrcRewrite") == 0) { } else if (::strcmp(key, "SrcRewrite") == 0) {

4
Conf.h
View File

@@ -40,9 +40,9 @@ struct CPCRewriteStruct {
struct CTypeRewriteStruct { struct CTypeRewriteStruct {
unsigned int m_fromSlot; unsigned int m_fromSlot;
unsigned int m_fromId; unsigned int m_fromTG;
unsigned int m_toSlot; unsigned int m_toSlot;
unsigned int m_toTG; unsigned int m_toId;
}; };
struct CSrcRewriteStruct { struct CSrcRewriteStruct {

View File

@@ -659,11 +659,11 @@ bool CDMRGateway::createDMRNetwork1()
std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork1TypeRewrites(); std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork1TypeRewrites();
for (std::vector<CTypeRewriteStruct>::const_iterator it = typeRewrites.begin(); it != typeRewrites.end(); ++it) { for (std::vector<CTypeRewriteStruct>::const_iterator it = typeRewrites.begin(); it != typeRewrites.end(); ++it) {
LogInfo(" Rewrite Net: %u:%u -> %u:TG%u", (*it).m_fromSlot, (*it).m_fromId, (*it).m_toSlot, (*it).m_toTG); LogInfo(" Rewrite RF: %u:TG%u -> %u:%u", (*it).m_fromSlot, (*it).m_fromTG, (*it).m_toSlot, (*it).m_toId);
CRewriteType* rewrite = new CRewriteType("DMR-1", (*it).m_fromSlot, (*it).m_fromId, (*it).m_toSlot, (*it).m_toTG); CRewriteType* rewrite = new CRewriteType("DMR-1", (*it).m_fromSlot, (*it).m_fromTG, (*it).m_toSlot, (*it).m_toId);
m_dmr1NetRewrites.push_back(rewrite); m_dmr1RFRewrites.push_back(rewrite);
} }
std::vector<CSrcRewriteStruct> srcRewrites = m_conf.getDMRNetwork1SrcRewrites(); std::vector<CSrcRewriteStruct> srcRewrites = m_conf.getDMRNetwork1SrcRewrites();
@@ -748,11 +748,11 @@ bool CDMRGateway::createDMRNetwork2()
std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork2TypeRewrites(); std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork2TypeRewrites();
for (std::vector<CTypeRewriteStruct>::const_iterator it = typeRewrites.begin(); it != typeRewrites.end(); ++it) { for (std::vector<CTypeRewriteStruct>::const_iterator it = typeRewrites.begin(); it != typeRewrites.end(); ++it) {
LogInfo(" Rewrite Net: %u:%u -> %u:TG%u", (*it).m_fromSlot, (*it).m_fromId, (*it).m_toSlot, (*it).m_toTG); LogInfo(" Rewrite RF: %u:TG%u -> %u:%u", (*it).m_fromSlot, (*it).m_fromTG, (*it).m_toSlot, (*it).m_toId);
CRewriteType* rewrite = new CRewriteType("DMR-2", (*it).m_fromSlot, (*it).m_fromId, (*it).m_toSlot, (*it).m_toTG); CRewriteType* rewrite = new CRewriteType("DMR-2", (*it).m_fromSlot, (*it).m_fromTG, (*it).m_toSlot, (*it).m_toId);
m_dmr2NetRewrites.push_back(rewrite); m_dmr2RFRewrites.push_back(rewrite);
} }
std::vector<CSrcRewriteStruct> srcRewrites = m_conf.getDMRNetwork2SrcRewrites(); std::vector<CSrcRewriteStruct> srcRewrites = m_conf.getDMRNetwork2SrcRewrites();

View File

@@ -42,8 +42,9 @@ TGRewrite=1,9,1,9,1
TGRewrite=2,9,2,9,1 TGRewrite=2,9,2,9,1
# Reflector control command slot 2 94000->4000 to 95000->5000 # Reflector control command slot 2 94000->4000 to 95000->5000
PCRewrite=2,94000,2,4000,1001 PCRewrite=2,94000,2,4000,1001
# Echo on slot 1 9990 # Echo on RF slot 1 TG9990 to network slot 1 9990
PCRewrite=1,9990,2,9990,1 TypeRewrite=1,9990,1,9990
SrcRewrite=1,9990,1,9990,1
# Reflector status returns # Reflector status returns
SrcRewrite=2,4000,2,9,1001 SrcRewrite=2,4000,2,9,1001
Password=PASSWORD Password=PASSWORD

View File

@@ -25,13 +25,13 @@
#include <cstdio> #include <cstdio>
#include <cassert> #include <cassert>
CRewriteType::CRewriteType(const char* name, unsigned int fromSlot, unsigned int fromId, unsigned int toSlot, unsigned int toTG) : CRewriteType::CRewriteType(const char* name, unsigned int fromSlot, unsigned int fromTG, unsigned int toSlot, unsigned int toId) :
m_name(name), m_name(name),
m_fromSlot(fromSlot), m_fromSlot(fromSlot),
m_fromId(fromId), m_fromTG(fromTG),
m_toSlot(toSlot), m_toSlot(toSlot),
m_toTG(toTG), m_toId(toId),
m_lc(FLCO_GROUP, 0U, toTG), m_lc(FLCO_USER_USER, 0U, toId),
m_embeddedLC() m_embeddedLC()
{ {
assert(fromSlot == 1U || fromSlot == 2U); assert(fromSlot == 1U || fromSlot == 2U);
@@ -48,14 +48,14 @@ bool CRewriteType::process(CDMRData& data)
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_USER_USER || slotNo != m_fromSlot || dstId != m_fromId) if (flco != FLCO_GROUP || slotNo != m_fromSlot || dstId != m_fromTG)
return false; return false;
if (m_fromSlot != m_toSlot) if (m_fromSlot != m_toSlot)
data.setSlotNo(m_toSlot); data.setSlotNo(m_toSlot);
data.setDstId(m_toTG); data.setDstId(m_toId);
data.setFLCO(FLCO_GROUP); data.setFLCO(FLCO_USER_USER);
unsigned char dataType = data.getDataType(); unsigned char dataType = data.getDataType();
@@ -86,8 +86,6 @@ void CRewriteType::processHeader(CDMRData& data, unsigned char dataType)
m_embeddedLC.setLC(m_lc); m_embeddedLC.setLC(m_lc);
} }
LogDebug("%s, Private call to TG rewrite of id: %u", m_name, m_fromId);
unsigned char buffer[DMR_FRAME_LENGTH_BYTES]; unsigned char buffer[DMR_FRAME_LENGTH_BYTES];
data.getData(buffer); data.getData(buffer);

View File

@@ -26,7 +26,7 @@
class CRewriteType : public IRewrite { class CRewriteType : public IRewrite {
public: public:
CRewriteType(const char* name, unsigned int fromSlot, unsigned int fromId, unsigned int toSlot, unsigned int toTG); CRewriteType(const char* name, unsigned int fromSlot, unsigned int fromTG, unsigned int toSlot, unsigned int toId);
virtual ~CRewriteType(); virtual ~CRewriteType();
virtual bool process(CDMRData& data); virtual bool process(CDMRData& data);
@@ -34,9 +34,9 @@ public:
private: private:
const char* m_name; const char* m_name;
unsigned int m_fromSlot; unsigned int m_fromSlot;
unsigned int m_fromId; unsigned int m_fromTG;
unsigned int m_toSlot; unsigned int m_toSlot;
unsigned int m_toTG; unsigned int m_toId;
CDMRLC m_lc; CDMRLC m_lc;
CDMREmbeddedData m_embeddedLC; CDMREmbeddedData m_embeddedLC;