Merge branch 'mqtt' into mqtt_plus

This commit is contained in:
Jonathan Naylor
2024-02-09 16:13:03 +00:00
6 changed files with 34 additions and 35 deletions

View File

@@ -363,7 +363,7 @@ bool CP25Control::writeModem(unsigned char* data, unsigned int len)
// Regenerate NID // Regenerate NID
m_nid.encode(data + 2U, P25_DUID_LDU2); m_nid.encode(data + 2U, P25_DUID_LDU2);
// Add the dummy LDU2 data // Add the LDU2 data
m_rfData.encodeLDU2(data + 2U); m_rfData.encodeLDU2(data + 2U);
// Regenerate the Low Speed Data // Regenerate the Low Speed Data
@@ -958,7 +958,7 @@ void CP25Control::createRFHeader()
// Add the NID // Add the NID
m_nid.encode(buffer + 2U, P25_DUID_HEADER); m_nid.encode(buffer + 2U, P25_DUID_HEADER);
// Add the dummy header // Add the header
m_rfData.encodeHeader(buffer + 2U); m_rfData.encodeHeader(buffer + 2U);
// Add busy bits, inbound busy // Add busy bits, inbound busy
@@ -988,18 +988,18 @@ void CP25Control::createNetHeader()
unsigned int dstId = (m_netLDU1[76U] << 16) + (m_netLDU1[77U] << 8) + m_netLDU1[78U]; unsigned int dstId = (m_netLDU1[76U] << 16) + (m_netLDU1[77U] << 8) + m_netLDU1[78U];
unsigned int srcId = (m_netLDU1[101U] << 16) + (m_netLDU1[102U] << 8) + m_netLDU1[103U]; unsigned int srcId = (m_netLDU1[101U] << 16) + (m_netLDU1[102U] << 8) + m_netLDU1[103U];
unsigned char algId = m_netLDU2[126U]; // unsigned char algId = m_netLDU2[126U];
unsigned int kId = (m_netLDU2[127U] << 8) + m_netLDU2[128U]; // unsigned int kId = (m_netLDU2[127U] << 8) + m_netLDU2[128U];
unsigned char mi[P25_MI_LENGTH_BYTES]; // unsigned char mi[P25_MI_LENGTH_BYTES];
::memcpy(mi + 0U, m_netLDU2 + 51U, 3U); // ::memcpy(mi + 0U, m_netLDU2 + 51U, 3U);
::memcpy(mi + 3U, m_netLDU2 + 76U, 3U); // ::memcpy(mi + 3U, m_netLDU2 + 76U, 3U);
::memcpy(mi + 6U, m_netLDU2 + 101U, 3U); // ::memcpy(mi + 6U, m_netLDU2 + 101U, 3U);
m_netData.reset(); m_netData.reset();
m_netData.setMI(mi); // m_netData.setMI(mi);
m_netData.setAlgId(algId); // m_netData.setAlgId(algId);
m_netData.setKId(kId); // m_netData.setKId(kId);
m_netData.setLCF(lcf); m_netData.setLCF(lcf);
m_netData.setMFId(mfId); m_netData.setMFId(mfId);
m_netData.setSrcId(srcId); m_netData.setSrcId(srcId);
@@ -1027,7 +1027,7 @@ void CP25Control::createNetHeader()
// Add the NID // Add the NID
m_nid.encode(buffer + 2U, P25_DUID_HEADER); m_nid.encode(buffer + 2U, P25_DUID_HEADER);
// Add the dummy header // Add the header
m_netData.encodeHeader(buffer + 2U); m_netData.encodeHeader(buffer + 2U);
// Add busy bits // Add busy bits
@@ -1113,7 +1113,7 @@ void CP25Control::createNetLDU2()
// Add the NID // Add the NID
m_nid.encode(buffer + 2U, P25_DUID_LDU2); m_nid.encode(buffer + 2U, P25_DUID_LDU2);
// Add the dummy LDU2 data // Add the LDU2 data
m_netData.encodeLDU2(buffer + 2U); m_netData.encodeLDU2(buffer + 2U);
// Add the Audio // Add the Audio

View File

@@ -40,7 +40,7 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04
CP25Data::CP25Data() : CP25Data::CP25Data() :
m_mi(NULL), m_mi(NULL),
m_mfId(0U), m_mfId(0U),
m_algId(0x80U), m_algId(P25_ALGO_UNENCRYPT),
m_kId(0U), m_kId(0U),
m_lcf(0x00U), m_lcf(0x00U),
m_emergency(false), m_emergency(false),
@@ -50,6 +50,7 @@ m_rs241213(),
m_trellis() m_trellis()
{ {
m_mi = new unsigned char[P25_MI_LENGTH_BYTES]; m_mi = new unsigned char[P25_MI_LENGTH_BYTES];
::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES);
} }
CP25Data::~CP25Data() CP25Data::~CP25Data()
@@ -68,7 +69,7 @@ CP25Data& CP25Data::operator=(const CP25Data& data)
m_emergency = data.m_emergency; m_emergency = data.m_emergency;
m_algId = data.m_algId; m_algId = data.m_algId;
m_kId = data.m_kId; m_kId = data.m_kId;
::memcpy(m_mi, data.m_mi, P25_MI_LENGTH_BYTES); ::memcpy(m_mi, data.m_mi, P25_MI_LENGTH_BYTES);
} }
@@ -99,20 +100,19 @@ bool CP25Data::decodeHeader(const unsigned char* data)
} }
m_mfId = rs[9U]; // Mfg Id. m_mfId = rs[9U]; // Mfg Id.
/*
m_algId = rs[10U]; // Algorithm ID m_algId = rs[10U]; // Algorithm ID
if (m_algId != P25_ALGO_UNENCRYPT) { if (m_algId != P25_ALGO_UNENCRYPT) {
m_mi = new unsigned char[P25_MI_LENGTH_BYTES];
::memcpy(m_mi, rs, P25_MI_LENGTH_BYTES); // Message Indicator ::memcpy(m_mi, rs, P25_MI_LENGTH_BYTES); // Message Indicator
m_kId = (rs[11U] << 8) + rs[12U]; // Key ID m_kId = (rs[11U] << 8) | (rs[12U] << 0); // Key ID
} else { } else {
m_mi = new unsigned char[P25_MI_LENGTH_BYTES];
::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES); ::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES);
m_kId = 0x0000U; m_kId = 0x0000U;
} }
*/
return true; return true;
} }
@@ -293,21 +293,20 @@ bool CP25Data::decodeLDU2(const unsigned char* data)
CUtils::dump(2U, "P25, RS crashed with input data", rs, 18U); CUtils::dump(2U, "P25, RS crashed with input data", rs, 18U);
return false; return false;
} }
/*
m_algId = rs[9U]; // Algorithm ID
m_algId = rs[9U]; // Algorithm ID
if (m_algId != P25_ALGO_UNENCRYPT) { if (m_algId != P25_ALGO_UNENCRYPT) {
m_mi = new unsigned char[P25_MI_LENGTH_BYTES]; ::memcpy(m_mi, rs, P25_MI_LENGTH_BYTES); // Message Indicator
::memcpy(m_mi, rs, P25_MI_LENGTH_BYTES); // Message Indicator
m_kId = (rs[10U] << 8) + rs[11U]; // Key ID m_kId = (rs[10U] << 8) + rs[11U]; // Key ID
} }
else { else {
m_mi = new unsigned char[P25_MI_LENGTH_BYTES];
::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES); ::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES);
m_kId = 0x0000U; m_kId = 0x0000U;
} }
*/
return true; return true;
} }
@@ -320,11 +319,11 @@ void CP25Data::encodeLDU2(unsigned char* data)
::memset(rs, 0x00U, 18U); ::memset(rs, 0x00U, 18U);
for (unsigned int i = 0; i < P25_MI_LENGTH_BYTES; i++) for (unsigned int i = 0; i < P25_MI_LENGTH_BYTES; i++)
rs[i] = m_mi[i]; // Message Indicator rs[i] = m_mi[i]; // Message Indicator
rs[9U] = m_algId; // Algorithm ID rs[9U] = m_algId; // Algorithm ID
rs[10U] = (m_kId >> 8) & 0xFFU; // Key ID MSB rs[10U] = (m_kId >> 8) & 0xFFU; // Key ID MSB
rs[11U] = (m_kId >> 0) & 0xFFU; // Key ID LSB rs[11U] = (m_kId >> 0) & 0xFFU; // Key ID LSB
// encode RS (24,16,9) FEC // encode RS (24,16,9) FEC
m_rs241213.encode24169(rs); m_rs241213.encode24169(rs);
@@ -372,7 +371,7 @@ bool CP25Data::decodeTSDU(const unsigned char* data)
return false; return false;
} }
m_lcf = tsbk[0U] & 0x3F; m_lcf = tsbk[0U] & 0x3F;
m_mfId = tsbk[1U]; m_mfId = tsbk[1U];
unsigned long long tsbkValue = 0U; unsigned long long tsbkValue = 0U;
@@ -558,7 +557,7 @@ void CP25Data::reset()
{ {
::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES); ::memset(m_mi, 0x00U, P25_MI_LENGTH_BYTES);
m_algId = 0x80U; m_algId = P25_ALGO_UNENCRYPT;
m_kId = 0x0000U; m_kId = 0x0000U;
m_lcf = P25_LCF_GROUP; m_lcf = P25_LCF_GROUP;
m_mfId = 0x00U; m_mfId = 0x00U;

View File

@@ -54,7 +54,7 @@ bool CPOCSAGNetwork::open()
LogMessage("Opening POCSAG network connection"); LogMessage("Opening POCSAG network connection");
return m_socket.open(); return m_socket.open(m_addr);
} }
void CPOCSAGNetwork::clock(unsigned int ms) void CPOCSAGNetwork::clock(unsigned int ms)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019,2020,2021,2023 by Jonathan Naylor G4KLX * Copyright (C) 2019,2020,2021,2023,2024 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019,2020,2021,2023 by Jonathan Naylor G4KLX * Copyright (C) 2019,2020,2021,2023,2024 by Jonathan Naylor G4KLX
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20240129"; const char* VERSION = "20240207";
#endif #endif