mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 05:25:40 +08:00
Modify Type Rewrite to handle BM Echo.
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -242,9 +242,9 @@ bool CConf::read()
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toTG = ::atoi(p4);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
m_dmrNetwork1TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strcmp(key, "SrcRewrite") == 0) {
|
||||
@@ -318,9 +318,9 @@ bool CConf::read()
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toTG = ::atoi(p4);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
m_dmrNetwork2TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strcmp(key, "SrcRewrite") == 0) {
|
||||
|
||||
4
Conf.h
4
Conf.h
@@ -40,9 +40,9 @@ struct CPCRewriteStruct {
|
||||
|
||||
struct CTypeRewriteStruct {
|
||||
unsigned int m_fromSlot;
|
||||
unsigned int m_fromId;
|
||||
unsigned int m_fromTG;
|
||||
unsigned int m_toSlot;
|
||||
unsigned int m_toTG;
|
||||
unsigned int m_toId;
|
||||
};
|
||||
|
||||
struct CSrcRewriteStruct {
|
||||
|
||||
@@ -659,11 +659,11 @@ bool CDMRGateway::createDMRNetwork1()
|
||||
|
||||
std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork1TypeRewrites();
|
||||
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();
|
||||
@@ -748,11 +748,11 @@ bool CDMRGateway::createDMRNetwork2()
|
||||
|
||||
std::vector<CTypeRewriteStruct> typeRewrites = m_conf.getDMRNetwork2TypeRewrites();
|
||||
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();
|
||||
|
||||
@@ -42,8 +42,9 @@ TGRewrite=1,9,1,9,1
|
||||
TGRewrite=2,9,2,9,1
|
||||
# Reflector control command slot 2 94000->4000 to 95000->5000
|
||||
PCRewrite=2,94000,2,4000,1001
|
||||
# Echo on slot 1 9990
|
||||
PCRewrite=1,9990,2,9990,1
|
||||
# Echo on RF slot 1 TG9990 to network slot 1 9990
|
||||
TypeRewrite=1,9990,1,9990
|
||||
SrcRewrite=1,9990,1,9990,1
|
||||
# Reflector status returns
|
||||
SrcRewrite=2,4000,2,9,1001
|
||||
Password=PASSWORD
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
#include <cstdio>
|
||||
#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_fromSlot(fromSlot),
|
||||
m_fromId(fromId),
|
||||
m_fromTG(fromTG),
|
||||
m_toSlot(toSlot),
|
||||
m_toTG(toTG),
|
||||
m_lc(FLCO_GROUP, 0U, toTG),
|
||||
m_toId(toId),
|
||||
m_lc(FLCO_USER_USER, 0U, toId),
|
||||
m_embeddedLC()
|
||||
{
|
||||
assert(fromSlot == 1U || fromSlot == 2U);
|
||||
@@ -48,14 +48,14 @@ bool CRewriteType::process(CDMRData& data)
|
||||
unsigned int dstId = data.getDstId();
|
||||
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;
|
||||
|
||||
if (m_fromSlot != m_toSlot)
|
||||
data.setSlotNo(m_toSlot);
|
||||
|
||||
data.setDstId(m_toTG);
|
||||
data.setFLCO(FLCO_GROUP);
|
||||
data.setDstId(m_toId);
|
||||
data.setFLCO(FLCO_USER_USER);
|
||||
|
||||
unsigned char dataType = data.getDataType();
|
||||
|
||||
@@ -86,8 +86,6 @@ void CRewriteType::processHeader(CDMRData& data, unsigned char dataType)
|
||||
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];
|
||||
data.getData(buffer);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
class CRewriteType : public IRewrite {
|
||||
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 bool process(CDMRData& data);
|
||||
@@ -34,9 +34,9 @@ public:
|
||||
private:
|
||||
const char* m_name;
|
||||
unsigned int m_fromSlot;
|
||||
unsigned int m_fromId;
|
||||
unsigned int m_fromTG;
|
||||
unsigned int m_toSlot;
|
||||
unsigned int m_toTG;
|
||||
unsigned int m_toId;
|
||||
CDMRLC m_lc;
|
||||
CDMREmbeddedData m_embeddedLC;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user