diff --git a/Conf.cpp b/Conf.cpp index 425d89858..3956e60f5 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -94,10 +94,10 @@ m_dmrBeacons(false), m_dmrId(0U), m_dmrColorCode(2U), m_dmrSelfOnly(false), -m_TGRewriteSlot1(false), -m_TGRewriteSlot2(false), -m_BMAutoRewrite(false), -m_BMRewriteReflectorVoicePrompts(false), +m_dmrTGRewriteSlot1(false), +m_dmrTGRewriteSlot2(false), +m_dmrBMAutoRewrite(false), +m_dmrBMRewriteReflectorVoicePrompts(false), m_dmrPrefixes(), m_dmrBlackList(), m_dmrDstIdBlacklistSlot1RF(), @@ -422,14 +422,14 @@ bool CConf::read() m_dmrTXHang = (unsigned int)::atoi(value); else if (::strcmp(key, "CallHang") == 0) m_dmrCallHang = (unsigned int)::atoi(value); - if (::strcmp(key, "TGRewriteSlot1") == 0) - m_TGRewriteSlot1 = ::atoi(value) == 1; + else if (::strcmp(key, "TGRewriteSlot1") == 0) + m_dmrTGRewriteSlot1 = ::atoi(value) == 1; else if (::strcmp(key, "TGRewriteSlot2") == 0) - m_TGRewriteSlot2 = ::atoi(value) == 1; + m_dmrTGRewriteSlot2 = ::atoi(value) == 1; else if (::strcmp(key, "BMAutoRewrite") == 0) - m_BMAutoRewrite = ::atoi(value) == 1; + m_dmrBMAutoRewrite = ::atoi(value) == 1; else if (::strcmp(key, "BMRewriteReflectorVoicePrompts") == 0) - m_BMRewriteReflectorVoicePrompts = ::atoi(value) == 1; + m_dmrBMRewriteReflectorVoicePrompts = ::atoi(value) == 1; } else if (section == SECTION_FUSION) { if (::strcmp(key, "Enable") == 0) m_fusionEnabled = ::atoi(value) == 1; @@ -765,22 +765,22 @@ bool CConf::getDMRSelfOnly() const bool CConf::getDMRTGRewriteSlot1() const { - return m_TGRewriteSlot1; + return m_dmrTGRewriteSlot1; } bool CConf::getDMRTGRewriteSlot2() const { - return m_TGRewriteSlot2; + return m_dmrTGRewriteSlot2; } bool CConf::getDMRBMAutoRewrite() const { - return m_BMAutoRewrite; + return m_dmrBMAutoRewrite; } bool CConf::getDMRBMRewriteReflectorVoicePrompts() const { - return m_BMRewriteReflectorVoicePrompts; + return m_dmrBMRewriteReflectorVoicePrompts; } std::vector CConf::getDMRPrefixes() const diff --git a/Conf.h b/Conf.h index 3df847433..5537f30c2 100644 --- a/Conf.h +++ b/Conf.h @@ -217,10 +217,10 @@ class CConf unsigned int m_dmrId; unsigned int m_dmrColorCode; bool m_dmrSelfOnly; - bool m_TGRewriteSlot1; - bool m_TGRewriteSlot2; - bool m_BMAutoRewrite; - bool m_BMRewriteReflectorVoicePrompts; + bool m_dmrTGRewriteSlot1; + bool m_dmrTGRewriteSlot2; + bool m_dmrBMAutoRewrite; + bool m_dmrBMRewriteReflectorVoicePrompts; std::vector m_dmrPrefixes; std::vector m_dmrBlackList; diff --git a/DMRAccessControl.cpp b/DMRAccessControl.cpp index cf12ffd65..52b48f340 100644 --- a/DMRAccessControl.cpp +++ b/DMRAccessControl.cpp @@ -206,11 +206,11 @@ bool DMRAccessControl::validateAccess (unsigned int src_id, unsigned int dst_id, unsigned int DMRAccessControl::DstIdRewrite (unsigned int did, unsigned int sid, unsigned int slot, bool network, CDMRLC* dmrLC) { - if (slot == 1 && m_TGRewriteSlot1 == false) - return 0; + if (slot == 1U && m_TGRewriteSlot1 == false) + return 0U; - if (slot == 2 && m_TGRewriteSlot2 == false) - return 0; + if (slot == 2U && m_TGRewriteSlot2 == false) + return 0U; std::time_t currenttime = std::time(nullptr); @@ -218,25 +218,26 @@ unsigned int DMRAccessControl::DstIdRewrite (unsigned int did, unsigned int sid, if (network) { m_dstRewriteID = did; m_SrcID = sid; - memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC)); - if (m_BMAutoRewrite && (did < 4000 || did > 5000) && did > 0 && did != 9 && dmrLC->getFLCO() == FLCO_GROUP ) { + //not needed at present - for direct dial, which requires change at master end. + //memcpy(&m_lastdmrLC, &dmrLC, sizeof(dmrLC)); + if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did != 9U && dmrLC->getFLCO() == FLCO_GROUP ) { LogMessage("DMR Slot %u, Rewrite DST ID (TG) of of inbound network traffic from %u to 9",slot,did); - return 9; + return 9U; // rewrite incoming BM voice prompts to TG 9 - } else if (m_BMRewriteReflectorVoicePrompts && (sid >= 4000 && sid <= 5000) && dmrLC->getFLCO() == FLCO_USER_USER) { + } else if (m_BMRewriteReflectorVoicePrompts && (sid >= 4000U && sid <= 5000U) && dmrLC->getFLCO() == FLCO_USER_USER) { dmrLC->setFLCO(FLCO_GROUP); LogMessage("DMR Slot %u, Rewrite inbound private call to %u to Group Call on TG 9 (BM reflector voice prompt)",slot,did); - return 9; + return 9U; } else { - return 0; + return 0U; } - } else if (m_BMAutoRewrite && did == 9 && m_dstRewriteID != 9 && m_dstRewriteID != 0 && (m_time + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP ) { + } else if (m_BMAutoRewrite && did == 9U && m_dstRewriteID != 9U && m_dstRewriteID != 0U && (m_time + m_callHang) > currenttime && dmrLC->getFLCO() == FLCO_GROUP ) { LogMessage("DMR Slot %u, Rewrite DST ID (TG) of outbound network traffic from %u to %u (return traffic during CallHang)",slot,did,m_dstRewriteID); return(m_dstRewriteID); - } else if (m_BMAutoRewrite && (did < 4000 || did > 5000) && did > 0 && did !=9) { + } else if (m_BMAutoRewrite && (did < 4000U || did > 5000U) && did > 0U && did !=9U) { m_dstRewriteID = did; } - return 0; + return 0U; } diff --git a/DMRControl.cpp b/DMRControl.cpp index 07ae70585..57ead2ff3 100644 --- a/DMRControl.cpp +++ b/DMRControl.cpp @@ -20,6 +20,7 @@ #include #include + CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1RF, const std::vector& DstIdWhitelistSlot1RF, const std::vector& DstIdBlacklistSlot2RF, const std::vector& DstIdWhitelistSlot2RF, const std::vector& DstIdBlacklistSlot1NET, const std::vector& DstIdWhitelistSlot1NET, const std::vector& DstIdBlacklistSlot2NET, const std::vector& DstIdWhitelistSlot2NET, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile, int rssiMultiplier, int rssiOffset, unsigned int jitter, bool TGRewriteSlot1, bool TGRewriteSlot2, bool BMAutoRewrite, bool BMRewriteReflectorVoicePrompts) : m_id(id), m_colorCode(colorCode), @@ -36,7 +37,7 @@ m_lookup(NULL) assert(display != NULL); m_lookup = new CDMRLookup(lookupFile); - m_lookup->read(); + //m_lookup->read(); CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1RF, DstIdWhitelistSlot1RF, DstIdBlacklistSlot2RF, DstIdWhitelistSlot2RF, DstIdBlacklistSlot1NET, DstIdWhitelistSlot1NET, DstIdBlacklistSlot2NET, DstIdWhitelistSlot2NET, modem, network, display, duplex, m_lookup, rssiMultiplier, rssiOffset, jitter, TGRewriteSlot1, TGRewriteSlot2, BMAutoRewrite, BMRewriteReflectorVoicePrompts); } diff --git a/DMRSlot.cpp b/DMRSlot.cpp index c9600f817..a7ee7f29e 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -496,8 +496,7 @@ void CDMRSlot::writeModem(unsigned char *data, unsigned int len) } unsigned int rw_id = DMRAccessControl::DstIdRewrite(did,sid,m_slotNo,false,lc); if (rw_id) { - - lc->setDstId(rw_id); + lc->setDstId(rw_id); } m_rfLC = lc;