diff --git a/Conf.cpp b/Conf.cpp index a30738e..62dd0db 100644 --- a/Conf.cpp +++ b/Conf.cpp @@ -95,6 +95,7 @@ m_dmrDstIdBlacklistSlot2(), m_dmrDstIdWhitelistSlot1(), m_dmrDstIdWhitelistSlot2(), m_dmrLookupFile(), +m_dmrCallHang(3U), m_dmrTXHang(4U), m_fusionEnabled(true), m_dstarNetworkEnabled(true), @@ -354,6 +355,8 @@ bool CConf::read() m_dmrLookupFile = value; else if (::strcmp(key, "TXHang") == 0) m_dmrTXHang = (unsigned int)::atoi(value); + else if (::strcmp(key, "CallHang") == 0) + m_dmrCallHang = (unsigned int)::atoi(value); } else if (section == SECTION_FUSION) { if (::strcmp(key, "Enable") == 0) m_fusionEnabled = ::atoi(value) == 1; @@ -682,6 +685,11 @@ std::string CConf::getDMRLookupFile() const return m_dmrLookupFile; } +unsigned int CConf::getDMRCallHang() const +{ + return m_dmrCallHang; +} + unsigned int CConf::getDMRTXHang() const { return m_dmrTXHang; diff --git a/Conf.h b/Conf.h index dd7a4b4..53805d0 100644 --- a/Conf.h +++ b/Conf.h @@ -90,6 +90,7 @@ public: std::vector getDMRDstIdWhitelistSlot1() const; std::vector getDMRDstIdWhitelistSlot2() const; std::string getDMRLookupFile() const; + unsigned int getDMRCallHang() const; unsigned int getDMRTXHang() const; // The System Fusion section @@ -201,6 +202,7 @@ private: std::vector m_dmrDstIdWhitelistSlot1; std::vector m_dmrDstIdWhitelistSlot2; std::string m_dmrLookupFile; + unsigned int m_dmrCallHang; unsigned int m_dmrTXHang; bool m_fusionEnabled; diff --git a/DMRControl.cpp b/DMRControl.cpp index d576bc8..f4e2674 100644 --- a/DMRControl.cpp +++ b/DMRControl.cpp @@ -20,7 +20,7 @@ #include #include -CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile) : +CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile) : m_id(id), m_colorCode(colorCode), m_selfOnly(selfOnly), @@ -38,7 +38,7 @@ m_lookup(NULL) m_lookup = new CDMRLookup(lookupFile); m_lookup->read(); - CDMRSlot::init(id, colorCode, selfOnly, prefixes, blackList, DstIdBlacklistSlot1, DstIdWhitelistSlot1, DstIdBlacklistSlot2, DstIdWhitelistSlot2, modem, network, display, duplex, m_lookup); + CDMRSlot::init(id, colorCode, callHang, selfOnly, prefixes, blackList, DstIdBlacklistSlot1, DstIdWhitelistSlot1, DstIdBlacklistSlot2, DstIdWhitelistSlot2, modem, network, display, duplex, m_lookup); } CDMRControl::~CDMRControl() diff --git a/DMRControl.h b/DMRControl.h index c011048..3d3f8fe 100644 --- a/DMRControl.h +++ b/DMRControl.h @@ -30,7 +30,7 @@ class CDMRControl { public: - CDMRControl(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile); + CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, unsigned int timeout, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, const std::string& lookupFile); ~CDMRControl(); bool processWakeup(const unsigned char* data); diff --git a/DMRSlot.cpp b/DMRSlot.cpp index c0c8f7b..22d35ef 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -41,6 +41,7 @@ CDMRIPSC* CDMRSlot::m_network = NULL; CDisplay* CDMRSlot::m_display = NULL; bool CDMRSlot::m_duplex = true; CDMRLookup* CDMRSlot::m_lookup = NULL; +unsigned int CDMRSlot::m_hangCount = 3U * 17U; unsigned char* CDMRSlot::m_idle = NULL; @@ -136,32 +137,30 @@ void CDMRSlot::writeModem(unsigned char *data) if (lc == NULL) return; - unsigned int id; - unsigned int did; - id = lc->getSrcId(); + unsigned int id = lc->getSrcId(); if (!validateId(id)) { LogMessage("DMR Slot %u, invalid access attempt from %u (blacklisted)", m_slotNo, id); delete lc; return; } + // add check for valid dst id (e.g. TG) - // - G7RZU - did = lc->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, did); + unsigned int did = lc->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did); delete lc; return; } + did = lc->getDstId(); // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, did); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did); delete lc; return; } - m_rfLC = lc; // Store the LC for the embedded LC @@ -249,9 +248,8 @@ void CDMRSlot::writeModem(unsigned char *data) writeNetworkRF(data, DT_TERMINATOR_WITH_LC); if (m_duplex) { - writeQueueRF(data); - writeQueueRF(data); - writeQueueRF(data); + for (unsigned int i = 0U; i < m_hangCount; i++) + writeQueueRF(data); } if (m_rfBits == 0U) m_rfBits = 1U; @@ -275,15 +273,16 @@ void CDMRSlot::writeModem(unsigned char *data) LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId); return; } + // add check for valid dst id (e.g. TG) - // - G7RZU - if (DstIdBlacklist(dstId,m_slotNo)) { + if (DstIdBlacklist(dstId, m_slotNo)) { LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(dstId,m_slotNo,true)) { + if (!DstIdWhitelist(dstId, m_slotNo, true)) { LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId); return; } @@ -345,15 +344,16 @@ void CDMRSlot::writeModem(unsigned char *data) LogMessage("DMR Slot %u, invalid access attempt from %u", m_slotNo, srcId); return; } - // add check for valid dst id (e.g. TG) - + + // add check for valid dst id (e.g. TG) // - G7RZU - if (DstIdBlacklist(dstId,m_slotNo)) { + if (DstIdBlacklist(dstId, m_slotNo)) { LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, dstId); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(dstId,m_slotNo,true)) { + if (!DstIdWhitelist(dstId, m_slotNo, true)) { LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, dstId); return; } @@ -506,23 +506,23 @@ void CDMRSlot::writeModem(unsigned char *data) delete lc; return; } + // add check for valid dst id (e.g. TG) - - // - G7RZU - unsigned int did; - did = lc->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG blacklisted)", m_slotNo, did); - delete lc; - return; - } - did = lc->getDstId(); - // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Slot %u, invalid access attempt to TG %u (TG not in whitelist)", m_slotNo, did); - delete lc; - return; - } + // - G7RZU + unsigned int did = lc->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG blacklisted)", m_slotNo, did); + delete lc; + return; + } + + did = lc->getDstId(); + // true sets allow greater than 4k. Need to add boolean in conf for this later. + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid access attempt to TG%u (TG not in whitelist)", m_slotNo, did); + delete lc; + return; + } m_rfLC = lc; @@ -681,9 +681,8 @@ void CDMRSlot::writeEndRF(bool writeEnd) data[0U] = TAG_EOT; data[1U] = 0x00U; - writeQueueRF(data); - writeQueueRF(data); - writeQueueRF(data); + for (unsigned int i = 0U; i < m_hangCount; i++) + writeQueueRF(data); } } @@ -753,9 +752,8 @@ void CDMRSlot::writeEndNet(bool writeEnd) data[0U] = TAG_EOT; data[1U] = 0x00U; - writeQueueNet(data); - writeQueueNet(data); - writeQueueNet(data); + for (unsigned int i = 0U; i < m_hangCount; i++) + writeQueueRF(data); } delete m_netLC; @@ -765,8 +763,9 @@ void CDMRSlot::writeEndNet(bool writeEnd) closeFile(); #endif } + //add -void CDMRSlot::writeNetwork (const CDMRData& dmrData) +void CDMRSlot::writeNetwork(const CDMRData& dmrData) { if (m_rfState != RS_RF_LISTENING && m_netState == RS_NET_IDLE) return; @@ -790,17 +789,16 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) } // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } @@ -809,8 +807,7 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) // Regenerate the LC data fullLC.encode(*m_netLC, data + 2U, DT_VOICE_LC_HEADER); - - + // Regenerate the Slot Type CDMRSlotType slotType; slotType.setColorCode(m_colorCode); @@ -831,7 +828,6 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) m_netBits = 1U; m_netErrs = 0U; - writeQueueNet(m_idle); writeQueueNet(m_idle); writeQueueNet(m_idle); @@ -878,17 +874,16 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) data[1U] = 0x00U; // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } @@ -904,20 +899,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) // Regenerate the LC data CDMRFullLC fullLC; fullLC.encode(*m_netLC, data + 2U, DT_TERMINATOR_WITH_LC); + // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } + // Regenerate the Slot Type CDMRSlotType slotType; slotType.setColorCode(m_colorCode); @@ -930,9 +926,8 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) data[0U] = TAG_EOT; data[1U] = 0x00U; - writeQueueNet(data); - writeQueueNet(data); - writeQueueNet(data); + for (unsigned int i = 0U; i < m_hangCount; i++) + writeQueueRF(data); #if defined(DUMP_DMR) writeFile(data); @@ -964,20 +959,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) unsigned int dstId = dataHeader.getDstId(); m_netLC = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId); + // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } + // Regenerate the data header dataHeader.get(data + 2U); @@ -1015,18 +1011,18 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) } else if (dataType == DT_VOICE_SYNC) { if (m_netState == RS_NET_IDLE) { m_netLC = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId()); + // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } @@ -1117,20 +1113,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) } else if (dataType == DT_VOICE) { if (m_netState != RS_NET_AUDIO) return; + // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = m_netLC->getDstId(); - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = m_netLC->getDstId(); + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } + unsigned char fid = m_netLC->getFID(); if (fid == FID_ETSI || fid == FID_DMRA) m_netErrs += m_fec.regenerateDMR(data + 2U); @@ -1187,20 +1184,21 @@ void CDMRSlot::writeNetwork (const CDMRData& dmrData) bool gi = csbk.getGI(); unsigned int srcId = csbk.getSrcId(); unsigned int dstId = csbk.getDstId(); + // add check for valid dst id (e.g. TG) - // - G7RZU - unsigned int did; - did = dstId; - if (DstIdBlacklist(did,m_slotNo)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG blacklisted) dataType: %s", m_slotNo, did,dataType); + unsigned int did = dstId; + if (DstIdBlacklist(did, m_slotNo)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG blacklisted) dataType: %s", m_slotNo, did, dataType); return; } + // true sets allow greater than 4k. Need to add boolean in conf for this later. - if (!DstIdWhitelist(did,m_slotNo,true)) { - LogMessage("DMR Network Slot %u, invalid traffic to TG %u (TG not in whitelist) dataType: %s", m_slotNo, did,dataType); + if (!DstIdWhitelist(did, m_slotNo, true)) { + LogMessage("DMR Slot %u, invalid traffic to TG%u (TG not in whitelist) dataType: %s", m_slotNo, did, dataType); return; } + // Regenerate the CSBK data csbk.get(data + 2U); @@ -1418,7 +1416,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data) m_queue.addData(data, len); } -void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup) +void CDMRSlot::init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup) { assert(id != 0U); assert(modem != NULL); @@ -1439,6 +1437,7 @@ void CDMRSlot::init(unsigned int id, unsigned int colorCode, bool selfOnly, cons m_display = display; m_duplex = duplex; m_lookup = lookup; + m_hangCount = callHang * 17U, m_idle = new unsigned char[DMR_FRAME_LENGTH_BYTES + 2U]; @@ -1473,55 +1472,53 @@ bool CDMRSlot::validateId(unsigned int id) //is dst id blacklisted? bool CDMRSlot::DstIdBlacklist(unsigned int did, unsigned int slot) { - if (slot == 1) { + if (slot == 1U) { if (std::find(m_dstBlackListSlot1.begin(), m_dstBlackListSlot1.end(), did) != m_dstBlackListSlot1.end()) return true; } else { if (std::find(m_dstBlackListSlot2.begin(), m_dstBlackListSlot2.end(), did) != m_dstBlackListSlot2.end()) return true; } + return false; } bool CDMRSlot::DstIdWhitelist(unsigned int did, unsigned int slot, bool gt4k) { - if (slot == 1) { - if(m_dstWhiteListSlot1.size() == 0) - return true; - // No reflectors on slot1, so we only allow all IDs over 99999 unless specifically whitelisted. - if(gt4k) { - if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end() || did >= 99999) { - - return true; + if (slot == 1U) { + if (m_dstWhiteListSlot1.size() == 0U) + return true; + + // No reflectors on slot1, so we only allow all IDs over 99999 unless specifically whitelisted. + if (gt4k) { + if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end() || did >= 99999U) + return true; + } else { + if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end()) + return true; } - - } else { - if (std::find(m_dstWhiteListSlot1.begin(), m_dstWhiteListSlot1.end(), did) != m_dstWhiteListSlot1.end()) - return true; - } } else { - if(m_dstWhiteListSlot2.size() == 0) - return true; - //On slot2 we allow reflector control IDs, but not secondary TG IDs unless specifically listed. Also allow echo. - if(gt4k) { - if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end() || did >= 4000) { - - //if dstId in secondary TG range - if(did > 5000 && did < 10000) - return false; - - return true; + if (m_dstWhiteListSlot2.size() == 0U) + return true; + + //On slot2 we allow reflector control IDs, but not secondary TG IDs unless specifically listed. Also allow echo. + if (gt4k) { + if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end() || did >= 4000) { + //if dstId in secondary TG range + if (did > 5000U && did < 10000U) + return false; + else + return true; + } + } else { + if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end()) + return true; } - - } else { - if (std::find(m_dstWhiteListSlot2.begin(), m_dstWhiteListSlot2.end(), did) != m_dstWhiteListSlot2.end()) - return true; - } } + return false; } - void CDMRSlot::setShortLC(unsigned int slotNo, unsigned int id, FLCO flco, bool voice) { assert(m_modem != NULL); diff --git a/DMRSlot.h b/DMRSlot.h index 96fb3bf..aa363b5 100644 --- a/DMRSlot.h +++ b/DMRSlot.h @@ -50,7 +50,7 @@ public: void clock(); - static void init(unsigned int id, unsigned int colorCode, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup); + static void init(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, const std::vector& prefixes, const std::vector& blackList, const std::vector& DstIdBlacklistSlot1, const std::vector& DstIdWhitelistSlot1, const std::vector& DstIdBlacklistSlot2, const std::vector& DstIdWhitelistSlot2, CModem* modem, CDMRIPSC* network, CDisplay* display, bool duplex, CDMRLookup* lookup); private: unsigned int m_slotNo; @@ -100,6 +100,7 @@ private: static CDisplay* m_display; static bool m_duplex; static CDMRLookup* m_lookup; + static unsigned int m_hangCount; static unsigned char* m_idle; diff --git a/MMDVM.ini b/MMDVM.ini index 34bea62..e3cead6 100644 --- a/MMDVM.ini +++ b/MMDVM.ini @@ -54,6 +54,7 @@ ColorCode=1 SelfOnly=0 # Prefixes=234,235 LookupFile=DMRIds.dat +CallHang=3 TXHang=4 #Blacklist= #DstIdBlackListSlot1= diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 2d37f93..40169a2 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -296,6 +296,7 @@ int CMMDVMHost::run() std::vector dstIDWhiteListSlot2 = m_conf.getDMRDstIdWhitelistSlot2(); unsigned int timeout = m_conf.getTimeout(); std::string lookupFile = m_conf.getDMRLookupFile(); + unsigned int callHang = m_conf.getDMRCallHang(); unsigned int txHang = m_conf.getDMRTXHang(); LogInfo("DMR Parameters"); @@ -317,9 +318,10 @@ int CMMDVMHost::run() LogInfo(" Timeout: %us", timeout); LogInfo(" Lookup File: %s", lookupFile.length() > 0U ? lookupFile.c_str() : "None"); + LogInfo(" Call Hang: %us", callHang); LogInfo(" TX Hang: %us", txHang); - dmr = new CDMRControl(id, colorCode, selfOnly, prefixes, blackList,dstIDBlackListSlot1,dstIDWhiteListSlot1, dstIDBlackListSlot2, dstIDWhiteListSlot2, timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile); + dmr = new CDMRControl(id, colorCode, callHang, selfOnly, prefixes, blackList,dstIDBlackListSlot1,dstIDWhiteListSlot1, dstIDBlackListSlot2, dstIDWhiteListSlot2, timeout, m_modem, m_dmrNetwork, m_display, m_duplex, lookupFile); m_dmrTXTimer.setTimeout(txHang); }