-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oops! Forgot the P25 NID changes for the TSDU datatype.
- Loading branch information
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright (C) 2016,2018 by Jonathan Naylor G4KLX | ||
* Copyright (C) 2018 by Bryan Biedenkapp <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -72,6 +73,13 @@ m_pdu(NULL) | |
bch.encode(m_term); | ||
m_term[7U] &= 0xFEU; // Clear the parity bit | ||
|
||
m_tsdu = new unsigned char[P25_NID_LENGTH_BYTES]; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
g4klx
via email
Owner
|
||
m_tsdu[0U] = (nac >> 4) & 0xFFU; | ||
m_tsdu[1U] = (nac << 4) & 0xF0U; | ||
m_tsdu[1U] |= P25_DUID_TSDU; | ||
bch.encode(m_tsdu); | ||
m_tsdu[7U] &= 0xFEU; // Clear the parity bit | ||
|
||
m_pdu = new unsigned char[P25_NID_LENGTH_BYTES]; | ||
m_pdu[0U] = (nac >> 4) & 0xFFU; | ||
m_pdu[1U] = (nac << 4) & 0xF0U; | ||
|
@@ -127,6 +135,12 @@ bool CP25NID::decode(const unsigned char* data) | |
return true; | ||
} | ||
|
||
errs = CP25Utils::compare(nid, m_tsdu, P25_NID_LENGTH_BYTES); | ||
if (errs < MAX_NID_ERRS) { | ||
m_duid = P25_DUID_TSDU; | ||
return true; | ||
} | ||
|
||
errs = CP25Utils::compare(nid, m_pdu, P25_NID_LENGTH_BYTES); | ||
if (errs < MAX_NID_ERRS) { | ||
m_duid = P25_DUID_PDU; | ||
|
@@ -156,6 +170,9 @@ void CP25NID::encode(unsigned char* data, unsigned char duid) const | |
case P25_DUID_TERM_LC: | ||
CP25Utils::encode(m_termlc, data, 48U, 114U); | ||
break; | ||
case P25_DUID_TSDU: | ||
CP25Utils::encode(m_tsdu, data, 48U, 114U); | ||
break; | ||
case P25_DUID_PDU: | ||
CP25Utils::encode(m_pdu, data, 48U, 114U); | ||
break; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* Copyright (C) 2016,2018 by Jonathan Naylor G4KLX | ||
* Copyright (C) 2018 by Bryan Biedenkapp <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -37,6 +38,7 @@ class CP25NID { | |
unsigned char* m_ldu2; | ||
unsigned char* m_termlc; | ||
unsigned char* m_term; | ||
unsigned char* m_tsdu; | ||
unsigned char* m_pdu; | ||
}; | ||
|
||
|
Don't forget to release m_tsdu inside destructor.