Merge branch 'master' into mqtt

This commit is contained in:
Jonathan Naylor
2025-03-14 13:39:49 +00:00
102 changed files with 1621 additions and 1489 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016,2018,2023 by Jonathan Naylor G4KLX
* Copyright (C) 2016,2018,2023,2025 by Jonathan Naylor G4KLX
*
* 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
@@ -31,24 +31,24 @@ const unsigned char BIT_MASK_TABLE[] = { 0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04
unsigned int CP25Utils::decode(const unsigned char* in, unsigned char* out, unsigned int start, unsigned int stop)
{
assert(in != NULL);
assert(out != NULL);
assert(in != nullptr);
assert(out != nullptr);
// Move the SSx positions to the range needed
unsigned int ss0Pos = P25_SS0_START;
unsigned int ss1Pos = P25_SS1_START;
while (ss0Pos < start) {
ss0Pos += P25_SS_INCREMENT;
ss1Pos += P25_SS_INCREMENT;
ss0Pos += P25_INCREMENT;
ss1Pos += P25_INCREMENT;
}
unsigned int n = 0U;
for (unsigned int i = start; i < stop; i++) {
if (i == ss0Pos) {
ss0Pos += P25_SS_INCREMENT;
ss0Pos += P25_INCREMENT;
} else if (i == ss1Pos) {
ss1Pos += P25_SS_INCREMENT;
ss1Pos += P25_INCREMENT;
} else {
bool b = READ_BIT(in, i);
WRITE_BIT(out, n, b);
@@ -61,24 +61,24 @@ unsigned int CP25Utils::decode(const unsigned char* in, unsigned char* out, unsi
unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsigned int start, unsigned int stop)
{
assert(in != NULL);
assert(out != NULL);
assert(in != nullptr);
assert(out != nullptr);
// Move the SSx positions to the range needed
unsigned int ss0Pos = P25_SS0_START;
unsigned int ss1Pos = P25_SS1_START;
while (ss0Pos < start) {
ss0Pos += P25_SS_INCREMENT;
ss1Pos += P25_SS_INCREMENT;
ss0Pos += P25_INCREMENT;
ss1Pos += P25_INCREMENT;
}
unsigned int n = 0U;
for (unsigned int i = start; i < stop; i++) {
if (i == ss0Pos) {
ss0Pos += P25_SS_INCREMENT;
ss0Pos += P25_INCREMENT;
} else if (i == ss1Pos) {
ss1Pos += P25_SS_INCREMENT;
ss1Pos += P25_INCREMENT;
} else {
bool b = READ_BIT(in, n);
WRITE_BIT(out, i, b);
@@ -91,8 +91,8 @@ unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsi
unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsigned int length)
{
assert(in != NULL);
assert(out != NULL);
assert(in != nullptr);
assert(out != nullptr);
// Move the SSx positions to the range needed
unsigned int ss0Pos = P25_SS0_START;
@@ -102,9 +102,9 @@ unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsi
unsigned int pos = 0U;
while (n < length) {
if (pos == ss0Pos) {
ss0Pos += P25_SS_INCREMENT;
ss0Pos += P25_INCREMENT;
} else if (pos == ss1Pos) {
ss1Pos += P25_SS_INCREMENT;
ss1Pos += P25_INCREMENT;
} else {
bool b = READ_BIT(in, n);
WRITE_BIT(out, pos, b);
@@ -118,8 +118,8 @@ unsigned int CP25Utils::encode(const unsigned char* in, unsigned char* out, unsi
unsigned int CP25Utils::compare(const unsigned char* data1, const unsigned char* data2, unsigned int length)
{
assert(data1 != NULL);
assert(data2 != NULL);
assert(data1 != nullptr);
assert(data2 != nullptr);
unsigned int errs = 0U;
for (unsigned int i = 0U; i < length; i++) {