From f899af06801b078bb201c5f0d3bd38e8e6f86422 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Tue, 9 Feb 2021 17:59:27 +0000 Subject: [PATCH] correct some inconsistencies with the V.24-like packet implementation; --- network/BaseNetwork.cpp | 6 +++- network/BaseNetwork.h | 70 +++++++++++++++++++++++++---------------- p25/VoicePacket.cpp | 40 +++++++++++------------ 3 files changed, 68 insertions(+), 48 deletions(-) diff --git a/network/BaseNetwork.cpp b/network/BaseNetwork.cpp index bded6ac8..65664dcd 100644 --- a/network/BaseNetwork.cpp +++ b/network/BaseNetwork.cpp @@ -600,6 +600,7 @@ bool BaseNetwork::writeP25LDU1(const uint32_t id, const uint32_t streamId, const ::memcpy(tempBuf, LDU1_REC64, 17U); tempBuf[1U] = control.getLCO(); tempBuf[2U] = control.getMFId(); + tempBuf[3U] = serviceOptions; m_audio.decode(data, tempBuf + 5U, 2U); ::memcpy(buffer + 60U, tempBuf, 17U); count += 17U; @@ -642,7 +643,8 @@ bool BaseNetwork::writeP25LDU1(const uint32_t id, const uint32_t streamId, const // The '6A' record ::memcpy(tempBuf, LDU1_REC6A, 16U); - tempBuf[1U] = serviceOptions; + tempBuf[1U] = lsd.getLSD1(); + tempBuf[2U] = lsd.getLSD2(); m_audio.decode(data, tempBuf + 4U, 8U); ::memcpy(buffer + 162U, tempBuf, 16U); count += 16U; @@ -768,6 +770,8 @@ bool BaseNetwork::writeP25LDU2(const uint32_t id, const uint32_t streamId, const // The '73' record ::memcpy(tempBuf, LDU2_REC73, 16U); + tempBuf[1U] = lsd.getLSD1(); + tempBuf[2U] = lsd.getLSD2(); m_audio.decode(data, tempBuf + 4U, 8U); ::memcpy(buffer + 162U, tempBuf, 16U); diff --git a/network/BaseNetwork.h b/network/BaseNetwork.h index 598bb52e..f38b3f0b 100644 --- a/network/BaseNetwork.h +++ b/network/BaseNetwork.h @@ -84,61 +84,77 @@ namespace network // --------------------------------------------------------------------------- // P25 V.24 LDU1 Encapsulation Frames - const uint8_t LDU1_REC62[] = { - 0x62U, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x12U, 0x64U, 0x00U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, - 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; + const uint8_t LDU1_REC62[] = { // IMBE Voice 1 + // ID IMBE Voice + 0x62U, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x12U, 0x64U, 0x00U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; - const uint8_t LDU1_REC63[] = { + const uint8_t LDU1_REC63[] = { // IMBE Voice 2 + // ID IMBE Voice Status 0x63U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC64[] = { + const uint8_t LDU1_REC64[] = { // IMBE Voice 3 + Link Control + // ID Link Control IMBE Voice Status 0x64U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC65[] = { + const uint8_t LDU1_REC65[] = { // IMBE Voice 4 + Link Control + // ID Link Control IMBE Voice Status 0x65U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC66[] = { + const uint8_t LDU1_REC66[] = { // IMBE Voice 5 + Link Control + // ID Link Control IMBE Voice Status 0x66U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC67[] = { - 0x67U, 0xF0U, 0x9DU, 0x6AU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; + const uint8_t LDU1_REC67[] = { // IMBE Voice 6 + Link Control + // ID Link Control IMBE Voice Status + 0x67U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC68[] = { - 0x68U, 0x19U, 0xD4U, 0x26U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; + const uint8_t LDU1_REC68[] = { // IMBE Voice 7 + Link Control + // ID Link Control IMBE Voice Status + 0x68U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC69[] = { - 0x69U, 0xE0U, 0xEBU, 0x7BU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; + const uint8_t LDU1_REC69[] = { // IMBE Voice 8 + Link Control + // ID Link Control IMBE Voice Status + 0x69U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU1_REC6A[] = { + const uint8_t LDU1_REC6A[] = { // IMBE Voice 9 + Low Speed Data + // ID LSD Status IMBE Voice 0x6AU, 0x00U, 0x00U, 0x02U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; // P25 V.24 LDU2 Encapsulation Frames - const uint8_t LDU2_REC6B[] = { - 0x6BU, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x12U, 0x64U, 0x00U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, - 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; + const uint8_t LDU2_REC6B[] = { // IMBE Voice 10 + // ID IMBE Voice + 0x6BU, 0x02U, 0x02U, 0x0CU, 0x0BU, 0x12U, 0x64U, 0x00U, 0x00U, 0x80U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; - const uint8_t LDU2_REC6C[] = { + const uint8_t LDU2_REC6C[] = { // IMBE Voice 11 + // ID IMBE Voice Status 0x6CU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC6D[] = { + const uint8_t LDU2_REC6D[] = { // IMBE Voice 12 + Encryption Sync + // ID Encryption Sync IMBE Voice Status 0x6DU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC6E[] = { + const uint8_t LDU2_REC6E[] = { // IMBE Voice 13 + Encryption Sync + // ID Encryption Sync IMBE Voice Status 0x6EU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC6F[] = { + const uint8_t LDU2_REC6F[] = { // IMBE Voice 14 + Encryption Sync + // ID Encryption Sync IMBE Voice Status 0x6FU, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC70[] = { + const uint8_t LDU2_REC70[] = { // IMBE Voice 15 + Encryption Sync + // ID Encryption Sync IMBE Voice Status 0x70U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC71[] = { - 0x71U, 0xACU, 0xB8U, 0xA4U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; + const uint8_t LDU2_REC71[] = { // IMBE Voice 16 + Encryption Sync + // ID Encryption Sync IMBE Voice Status + 0x71U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC72[] = { - 0x72U, 0x9BU, 0xDCU, 0x75U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; + const uint8_t LDU2_REC72[] = { // IMBE Voice 17 + Encryption Sync + // ID Encryption Sync IMBE Voice Status + 0x72U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x02U }; - const uint8_t LDU2_REC73[] = { + const uint8_t LDU2_REC73[] = { // IMBE Voice 18 + Low Speed Data + // ID LSD Status IMBE Voice 0x73U, 0x00U, 0x00U, 0x02U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U }; const uint32_t DATA_PACKET_LENGTH = 8192U; diff --git a/p25/VoicePacket.cpp b/p25/VoicePacket.cpp index 2742eacb..516d2b7d 100644 --- a/p25/VoicePacket.cpp +++ b/p25/VoicePacket.cpp @@ -666,39 +666,39 @@ bool VoicePacket::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, d (data[70U] == 0x66U) && (data[87U] == 0x67U) && (data[104U] == 0x68U) && (data[121U] == 0x69U) && (data[138U] == 0x6AU)) { - // The '62' record + // The '62' record - IMBE Voice 1 ::memcpy(m_netLDU1 + 0U, data + count, 22U); count += 22U; - // The '63' record + // The '63' record - IMBE Voice 2 ::memcpy(m_netLDU1 + 25U, data + count, 14U); count += 14U; - // The '64' record + // The '64' record - IMBE Voice 3 + Link Control ::memcpy(m_netLDU1 + 50U, data + count, 17U); count += 17U; - // The '65' record + // The '65' record - IMBE Voice 4 + Link Control ::memcpy(m_netLDU1 + 75U, data + count, 17U); count += 17U; - // The '66' record + // The '66' record - IMBE Voice 5 + Link Control ::memcpy(m_netLDU1 + 100U, data + count, 17U); count += 17U; - // The '67' record + // The '67' record - IMBE Voice 6 + Link Control ::memcpy(m_netLDU1 + 125U, data + count, 17U); count += 17U; - // The '68' record + // The '68' record - IMBE Voice 7 + Link Control ::memcpy(m_netLDU1 + 150U, data + count, 17U); count += 17U; - // The '69' record + // The '69' record - IMBE Voice 8 + Link Control ::memcpy(m_netLDU1 + 175U, data + count, 17U); count += 17U; - // The '6A' record + // The '6A' record - IMBE Voice 9 + Low Speed Data ::memcpy(m_netLDU1 + 200U, data + count, 16U); count += 17U; @@ -719,39 +719,39 @@ bool VoicePacket::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, d (data[70U] == 0x6FU) && (data[87U] == 0x70U) && (data[104U] == 0x71U) && (data[121U] == 0x72U) && (data[138U] == 0x73U)) { - // The '6B' record + // The '6B' record - IMBE Voice 10 ::memcpy(m_netLDU2 + 0U, data + count, 22U); count += 22U; - // The '6C' record + // The '6C' record - IMBE Voice 11 ::memcpy(m_netLDU2 + 25U, data + count, 14U); count += 14U; - // The '6D' record + // The '6D' record - IMBE Voice 12 + Encryption Sync ::memcpy(m_netLDU2 + 50U, data + count, 17U); count += 17U; - // The '6E' record + // The '6E' record - IMBE Voice 13 + Encryption Sync ::memcpy(m_netLDU2 + 75U, data + count, 17U); count += 17U; - // The '6F' record + // The '6F' record - IMBE Voice 14 + Encryption Sync ::memcpy(m_netLDU2 + 100U, data + count, 17U); count += 17U; - // The '70' record + // The '70' record - IMBE Voice 15 + Encryption Sync ::memcpy(m_netLDU2 + 125U, data + count, 17U); count += 17U; - // The '71' record + // The '71' record - IMBE Voice 16 + Encryption Sync ::memcpy(m_netLDU2 + 150U, data + count, 17U); count += 17U; - // The '72' record + // The '72' record - IMBE Voice 17 + Encryption Sync ::memcpy(m_netLDU2 + 175U, data + count, 17U); count += 17U; - // The '73' record + // The '73' record - IMBE Voice 18 + Low Speed Data ::memcpy(m_netLDU2 + 200U, data + count, 16U); count += 17U; @@ -1036,7 +1036,7 @@ void VoicePacket::writeNet_HDU(const lc::LC& control, const data::LowSpeedData& ::memcpy(mi + 3U, m_netLDU2 + 76U, 3U); ::memcpy(mi + 6U, m_netLDU2 + 101U, 3U); - uint8_t serviceOptions = (uint8_t)(m_netLDU1[201U]); + uint8_t serviceOptions = (uint8_t)(m_netLDU1[53U]); m_netLC.reset(); m_netLC.setMI(mi); @@ -1266,7 +1266,7 @@ void VoicePacket::writeNet_LDU1(const lc::LC& control, const data::LowSpeedData& } } - uint8_t serviceOptions = (uint8_t)(m_netLDU1[201U]); + uint8_t serviceOptions = (uint8_t)(m_netLDU1[53U]); if (m_p25->m_control) { m_p25->m_trunk->touchDstIdGrant(m_rfLC.getDstId());