From 074919ea5c900d3b0598e8703041208609e16af9 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Mon, 14 May 2018 12:00:06 -0400 Subject: [PATCH] Oops! Forgot the P25 NID changes for the TSDU datatype. --- P25NID.cpp | 17 +++++++++++++++++ P25NID.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/P25NID.cpp b/P25NID.cpp index 145dce4..7e4f1e8 100644 --- a/P25NID.cpp +++ b/P25NID.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2016,2018 by Jonathan Naylor G4KLX +* Copyright (C) 2018 by Bryan Biedenkapp * * 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]; + 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; diff --git a/P25NID.h b/P25NID.h index bb0031f..fe7ee74 100644 --- a/P25NID.h +++ b/P25NID.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2016,2018 by Jonathan Naylor G4KLX +* Copyright (C) 2018 by Bryan Biedenkapp * * 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 @@ private: unsigned char* m_ldu2; unsigned char* m_termlc; unsigned char* m_term; + unsigned char* m_tsdu; unsigned char* m_pdu; };