Merge pull request #319 from AndyTaylorTweet/master
Update DMRAccessControl.cpp
This commit is contained in:
commit
52775c55ef
1 changed files with 10 additions and 7 deletions
|
@ -22,7 +22,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
|
||||||
|
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_blackList;
|
std::vector<unsigned int> CDMRAccessControl::m_blackList;
|
||||||
std::vector<unsigned int> CDMRAccessControl::m_whiteList;
|
std::vector<unsigned int> CDMRAccessControl::m_whiteList;
|
||||||
|
@ -50,12 +49,16 @@ void CDMRAccessControl::init(const std::vector<unsigned int>& blacklist, const s
|
||||||
bool CDMRAccessControl::validateSrcId(unsigned int id)
|
bool CDMRAccessControl::validateSrcId(unsigned int id)
|
||||||
{
|
{
|
||||||
if (m_selfOnly) {
|
if (m_selfOnly) {
|
||||||
std::string str_id = std::to_string(id); // DMR ID from RF
|
if (m_id > 9999999) { // Check that the Config DMR-ID is bigger than 7 digits
|
||||||
std::string str_m_id = std::to_string(m_id); // MMDVMHost ID from Config
|
if ((id == m_id/10) || (id == m_id/100)) { // does RF ID match Config ID / 10 or Config ID / 100
|
||||||
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;
|
||||||
return true; // then allow the connection
|
}
|
||||||
} else {
|
else {
|
||||||
return false; // if not, reject it
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return id == m_id; // Origional Method
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue