mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 06:53:42 +00:00
Handle the P25 low speed data.
This commit is contained in:
parent
c8cb7a5429
commit
34bf8f18a7
8 changed files with 105 additions and 32 deletions
27
P25NID.cpp
27
P25NID.cpp
|
|
@ -88,31 +88,31 @@ bool CP25NID::decode(const unsigned char* data)
|
|||
unsigned char nid[P25_NID_LENGTH_BYTES];
|
||||
CP25Utils::decode(data, nid, 48U, 114U);
|
||||
|
||||
unsigned int errs = compare(nid, m_ldu1);
|
||||
unsigned int errs = CP25Utils::compare(nid, m_ldu1, P25_NID_LENGTH_BYTES);
|
||||
if (errs < MAX_NID_ERRS) {
|
||||
m_duid = P25_DUID_LDU1;
|
||||
return true;
|
||||
}
|
||||
|
||||
errs = compare(nid, m_ldu2);
|
||||
errs = CP25Utils::compare(nid, m_ldu2, P25_NID_LENGTH_BYTES);
|
||||
if (errs < MAX_NID_ERRS) {
|
||||
m_duid = P25_DUID_LDU2;
|
||||
return true;
|
||||
}
|
||||
|
||||
errs = compare(nid, m_term);
|
||||
errs = CP25Utils::compare(nid, m_term, P25_NID_LENGTH_BYTES);
|
||||
if (errs < MAX_NID_ERRS) {
|
||||
m_duid = P25_DUID_TERM;
|
||||
return true;
|
||||
}
|
||||
|
||||
errs = compare(nid, m_termlc);
|
||||
errs = CP25Utils::compare(nid, m_termlc, P25_NID_LENGTH_BYTES);
|
||||
if (errs < MAX_NID_ERRS) {
|
||||
m_duid = P25_DUID_TERM_LC;
|
||||
return true;
|
||||
}
|
||||
|
||||
errs = compare(nid, m_hdr);
|
||||
errs = CP25Utils::compare(nid, m_hdr, P25_NID_LENGTH_BYTES);
|
||||
if (errs < MAX_NID_ERRS) {
|
||||
m_duid = P25_DUID_HEADER;
|
||||
return true;
|
||||
|
|
@ -150,20 +150,3 @@ unsigned char CP25NID::getDUID() const
|
|||
{
|
||||
return m_duid;
|
||||
}
|
||||
|
||||
unsigned int CP25NID::compare(const unsigned char* nid1, const unsigned char* nid2) const
|
||||
{
|
||||
assert(nid1 != NULL);
|
||||
assert(nid2 != NULL);
|
||||
|
||||
unsigned int errs = 0U;
|
||||
for (unsigned int i = 0U; i < P25_NID_LENGTH_BYTES; i++) {
|
||||
unsigned char v = nid1[i] ^ nid2[i];
|
||||
while (v != 0U) {
|
||||
v &= v - 1U;
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
|
||||
return errs;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue