From 9868df7fc7995783a12420fae906867f584ceda5 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Sun, 9 Jul 2017 23:33:02 +0100 Subject: [PATCH] Update DMRAccessControl.cpp Updated the DMR Id SelfOnly matching code to remove the need for string compare. --- DMRAccessControl.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/DMRAccessControl.cpp b/DMRAccessControl.cpp index 3c88ab4..67bd79e 100644 --- a/DMRAccessControl.cpp +++ b/DMRAccessControl.cpp @@ -22,7 +22,6 @@ #include #include #include -#include std::vector CDMRAccessControl::m_blackList; std::vector CDMRAccessControl::m_whiteList; @@ -50,12 +49,16 @@ void CDMRAccessControl::init(const std::vector& blacklist, const s bool CDMRAccessControl::validateSrcId(unsigned int id) { if (m_selfOnly) { - std::string str_id = std::to_string(id); // DMR ID from RF - std::string str_m_id = std::to_string(m_id); // MMDVMHost ID from Config - if ((id == m_id) || (str_m_id.compare(0,7,str_id) == 0)) {// if the RF ID matched the configured ID or if the first 7 digits of the MMDVMHost ID match the WHOLE of the RF ID - return true; // then allow the connection - } else { - return false; // if not, reject it + if (m_id > 9999999) { // Check that the RF DMR-ID is bigger than 7 digits + if ((id == m_id/10) || (id == m_id/100)) { // does RF ID match Config ID / 10 or Config ID / 100 + return true; + } + else { + return false; + } + } + else { + return id == m_id; // Origional Method } }