Update the C++ code.

This commit is contained in:
Jonathan Naylor 2025-03-15 17:03:06 +00:00
parent 29397cf65e
commit ec5c32b57a
63 changed files with 848 additions and 849 deletions

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2012 by Ian Wraith * Copyright (C) 2012 by Ian Wraith
* Copyright (C) 2015 by Jonathan Naylor G4KLX * Copyright (C) 2015,2025 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
@ -27,8 +27,8 @@
#include <cstring> #include <cstring>
CBPTC19696::CBPTC19696() : CBPTC19696::CBPTC19696() :
m_rawData(NULL), m_rawData(nullptr),
m_deInterData(NULL) m_deInterData(nullptr)
{ {
m_rawData = new bool[196]; m_rawData = new bool[196];
m_deInterData = new bool[196]; m_deInterData = new bool[196];
@ -43,8 +43,8 @@ CBPTC19696::~CBPTC19696()
// The main decode function // The main decode function
void CBPTC19696::decode(const unsigned char* in, unsigned char* out) void CBPTC19696::decode(const unsigned char* in, unsigned char* out)
{ {
assert(in != NULL); assert(in != nullptr);
assert(out != NULL); assert(out != nullptr);
// Get the raw binary // Get the raw binary
decodeExtractBinary(in); decodeExtractBinary(in);
@ -62,8 +62,8 @@ void CBPTC19696::decode(const unsigned char* in, unsigned char* out)
// The main encode function // The main encode function
void CBPTC19696::encode(const unsigned char* in, unsigned char* out) void CBPTC19696::encode(const unsigned char* in, unsigned char* out)
{ {
assert(in != NULL); assert(in != nullptr);
assert(out != NULL); assert(out != nullptr);
// Extract Data // Extract Data
encodeExtractData(in); encodeExtractData(in);

16
CRC.cpp
View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -121,7 +121,7 @@ const uint16_t CCITT16_TABLE2[] = {
bool CCRC::checkFiveBit(bool* in, unsigned int tcrc) bool CCRC::checkFiveBit(bool* in, unsigned int tcrc)
{ {
assert(in != NULL); assert(in != nullptr);
unsigned int crc; unsigned int crc;
encodeFiveBit(in, crc); encodeFiveBit(in, crc);
@ -131,7 +131,7 @@ bool CCRC::checkFiveBit(bool* in, unsigned int tcrc)
void CCRC::encodeFiveBit(const bool* in, unsigned int& tcrc) void CCRC::encodeFiveBit(const bool* in, unsigned int& tcrc)
{ {
assert(in != NULL); assert(in != nullptr);
unsigned short total = 0U; unsigned short total = 0U;
for (unsigned int i = 0U; i < 72U; i += 8U) { for (unsigned int i = 0U; i < 72U; i += 8U) {
@ -147,7 +147,7 @@ void CCRC::encodeFiveBit(const bool* in, unsigned int& tcrc)
void CCRC::addCCITT162(unsigned char *in, unsigned int length) void CCRC::addCCITT162(unsigned char *in, unsigned int length)
{ {
assert(in != NULL); assert(in != nullptr);
assert(length > 2U); assert(length > 2U);
union { union {
@ -168,7 +168,7 @@ void CCRC::addCCITT162(unsigned char *in, unsigned int length)
bool CCRC::checkCCITT162(const unsigned char *in, unsigned int length) bool CCRC::checkCCITT162(const unsigned char *in, unsigned int length)
{ {
assert(in != NULL); assert(in != nullptr);
assert(length > 2U); assert(length > 2U);
union { union {
@ -188,7 +188,7 @@ bool CCRC::checkCCITT162(const unsigned char *in, unsigned int length)
void CCRC::addCCITT161(unsigned char *in, unsigned int length) void CCRC::addCCITT161(unsigned char *in, unsigned int length)
{ {
assert(in != NULL); assert(in != nullptr);
assert(length > 2U); assert(length > 2U);
union { union {
@ -209,7 +209,7 @@ void CCRC::addCCITT161(unsigned char *in, unsigned int length)
bool CCRC::checkCCITT161(const unsigned char *in, unsigned int length) bool CCRC::checkCCITT161(const unsigned char *in, unsigned int length)
{ {
assert(in != NULL); assert(in != nullptr);
assert(length > 2U); assert(length > 2U);
union { union {
@ -229,7 +229,7 @@ bool CCRC::checkCCITT161(const unsigned char *in, unsigned int length)
unsigned char CCRC::crc8(const unsigned char *in, unsigned int length) unsigned char CCRC::crc8(const unsigned char *in, unsigned int length)
{ {
assert(in != NULL); assert(in != nullptr);
uint8_t crc = 0U; uint8_t crc = 0U;

406
Conf.cpp
View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX * Copyright (C) 2015-2020,2025 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
@ -26,22 +26,22 @@
const int BUFFER_SIZE = 500; const int BUFFER_SIZE = 500;
enum SECTION { enum class SECTION {
SECTION_NONE, NONE,
SECTION_GENERAL, GENERAL,
SECTION_LOG, LOG,
SECTION_VOICE, VOICE,
SECTION_INFO, INFO,
SECTION_DMR_NETWORK_1, DMR_NETWORK_1,
SECTION_DMR_NETWORK_2, DMR_NETWORK_2,
SECTION_DMR_NETWORK_3, DMR_NETWORK_3,
SECTION_DMR_NETWORK_4, DMR_NETWORK_4,
SECTION_DMR_NETWORK_5, DMR_NETWORK_5,
SECTION_XLX_NETWORK, XLX_NETWORK,
SECTION_GPSD, GPSD,
SECTION_APRS, APRS,
SECTION_DYNAMIC_TG_CONTROL, DYNAMIC_TG_CONTROL,
SECTION_REMOTE_CONTROL REMOTE_CONTROL
}; };
CConf::CConf(const std::string& file) : CConf::CConf(const std::string& file) :
@ -198,59 +198,59 @@ CConf::~CConf()
bool CConf::read() bool CConf::read()
{ {
FILE* fp = ::fopen(m_file.c_str(), "rt"); FILE* fp = ::fopen(m_file.c_str(), "rt");
if (fp == NULL) { if (fp == nullptr) {
::fprintf(stderr, "Couldn't open the .ini file - %s\n", m_file.c_str()); ::fprintf(stderr, "Couldn't open the .ini file - %s\n", m_file.c_str());
return false; return false;
} }
SECTION section = SECTION_NONE; SECTION section = SECTION::NONE;
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE];
while (::fgets(buffer, BUFFER_SIZE, fp) != NULL) { while (::fgets(buffer, BUFFER_SIZE, fp) != nullptr) {
if (buffer[0U] == '#') if (buffer[0U] == '#')
continue; continue;
if (buffer[0U] == '[') { if (buffer[0U] == '[') {
if (::strncmp(buffer, "[General]", 9U) == 0) if (::strncmp(buffer, "[General]", 9U) == 0)
section = SECTION_GENERAL; section = SECTION::GENERAL;
else if (::strncmp(buffer, "[Log]", 5U) == 0) else if (::strncmp(buffer, "[Log]", 5U) == 0)
section = SECTION_LOG; section = SECTION::LOG;
else if (::strncmp(buffer, "[Voice]", 7U) == 0) else if (::strncmp(buffer, "[Voice]", 7U) == 0)
section = SECTION_VOICE; section = SECTION::VOICE;
else if (::strncmp(buffer, "[Info]", 6U) == 0) else if (::strncmp(buffer, "[Info]", 6U) == 0)
section = SECTION_INFO; section = SECTION::INFO;
else if (::strncmp(buffer, "[XLX Network]", 13U) == 0) else if (::strncmp(buffer, "[XLX Network]", 13U) == 0)
section = SECTION_XLX_NETWORK; section = SECTION::XLX_NETWORK;
else if (::strncmp(buffer, "[DMR Network 1]", 15U) == 0) else if (::strncmp(buffer, "[DMR Network 1]", 15U) == 0)
section = SECTION_DMR_NETWORK_1; section = SECTION::DMR_NETWORK_1;
else if (::strncmp(buffer, "[DMR Network 2]", 15U) == 0) else if (::strncmp(buffer, "[DMR Network 2]", 15U) == 0)
section = SECTION_DMR_NETWORK_2; section = SECTION::DMR_NETWORK_2;
else if (::strncmp(buffer, "[DMR Network 3]", 15U) == 0) else if (::strncmp(buffer, "[DMR Network 3]", 15U) == 0)
section = SECTION_DMR_NETWORK_3; section = SECTION::DMR_NETWORK_3;
else if (::strncmp(buffer, "[DMR Network 4]", 15U) == 0) else if (::strncmp(buffer, "[DMR Network 4]", 15U) == 0)
section = SECTION_DMR_NETWORK_4; section = SECTION::DMR_NETWORK_4;
else if (::strncmp(buffer, "[DMR Network 5]", 15U) == 0) else if (::strncmp(buffer, "[DMR Network 5]", 15U) == 0)
section = SECTION_DMR_NETWORK_5; section = SECTION::DMR_NETWORK_5;
else if (::strncmp(buffer, "[GPSD]", 6U) == 0) else if (::strncmp(buffer, "[GPSD]", 6U) == 0)
section = SECTION_GPSD; section = SECTION::GPSD;
else if (::strncmp(buffer, "[APRS]", 6U) == 0) else if (::strncmp(buffer, "[APRS]", 6U) == 0)
section = SECTION_APRS; section = SECTION::APRS;
else if (::strncmp(buffer, "[Dynamic TG Control]", 20U) == 0) else if (::strncmp(buffer, "[Dynamic TG Control]", 20U) == 0)
section = SECTION_DYNAMIC_TG_CONTROL; section = SECTION::DYNAMIC_TG_CONTROL;
else if (::strncmp(buffer, "[Remote Control]", 16U) == 0) else if (::strncmp(buffer, "[Remote Control]", 16U) == 0)
section = SECTION_REMOTE_CONTROL; section = SECTION::REMOTE_CONTROL;
else else
section = SECTION_NONE; section = SECTION::NONE;
continue; continue;
} }
char* key = ::strtok(buffer, " \t=\r\n"); char* key = ::strtok(buffer, " \t=\r\n");
if (key == NULL) if (key == nullptr)
continue; continue;
char* value = ::strtok(NULL, "\r\n"); char* value = ::strtok(nullptr, "\r\n");
if (value == NULL) if (value == nullptr)
continue; continue;
// Remove quotes from the value // Remove quotes from the value
@ -262,7 +262,7 @@ bool CConf::read()
char *p; char *p;
// if value is not quoted, remove after # (to make comment) // if value is not quoted, remove after # (to make comment)
if ((p = strchr(value, '#')) != NULL) if ((p = strchr(value, '#')) != nullptr)
*p = '\0'; *p = '\0';
// remove trailing tab/space // remove trailing tab/space
@ -270,7 +270,7 @@ bool CConf::read()
*p = '\0'; *p = '\0';
} }
if (section == SECTION_GENERAL) { if (section == SECTION::GENERAL) {
if (::strcmp(key, "Daemon") == 0) if (::strcmp(key, "Daemon") == 0)
m_daemon = ::atoi(value) == 1; m_daemon = ::atoi(value) == 1;
else if (::strcmp(key, "Timeout") == 0) else if (::strcmp(key, "Timeout") == 0)
@ -291,7 +291,7 @@ bool CConf::read()
m_ruleTrace = ::atoi(value) == 1; m_ruleTrace = ::atoi(value) == 1;
else if (::strcmp(key, "Debug") == 0) else if (::strcmp(key, "Debug") == 0)
m_debug = ::atoi(value) == 1; m_debug = ::atoi(value) == 1;
} else if (section == SECTION_LOG) { } else if (section == SECTION::LOG) {
if (::strcmp(key, "FilePath") == 0) if (::strcmp(key, "FilePath") == 0)
m_logFilePath = value; m_logFilePath = value;
else if (::strcmp(key, "FileRoot") == 0) else if (::strcmp(key, "FileRoot") == 0)
@ -302,14 +302,14 @@ bool CConf::read()
m_logDisplayLevel = (unsigned int)::atoi(value); m_logDisplayLevel = (unsigned int)::atoi(value);
else if (::strcmp(key, "FileRotate") == 0) else if (::strcmp(key, "FileRotate") == 0)
m_logFileRotate = ::atoi(value) == 1; m_logFileRotate = ::atoi(value) == 1;
} else if (section == SECTION_VOICE) { } else if (section == SECTION::VOICE) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_voiceEnabled = ::atoi(value) == 1; m_voiceEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Language") == 0) else if (::strcmp(key, "Language") == 0)
m_voiceLanguage = value; m_voiceLanguage = value;
else if (::strcmp(key, "Directory") == 0) else if (::strcmp(key, "Directory") == 0)
m_voiceDirectory = value; m_voiceDirectory = value;
} else if (section == SECTION_INFO) { } else if (section == SECTION::INFO) {
if (::strcmp(key, "Latitude") == 0) if (::strcmp(key, "Latitude") == 0)
m_infoLatitude = float(::atof(value)); m_infoLatitude = float(::atof(value));
else if (::strcmp(key, "Longitude") == 0) else if (::strcmp(key, "Longitude") == 0)
@ -322,7 +322,7 @@ bool CConf::read()
m_infoDescription = value; m_infoDescription = value;
else if (::strcmp(key, "URL") == 0) else if (::strcmp(key, "URL") == 0)
m_infoURL = value; m_infoURL = value;
} else if (section == SECTION_XLX_NETWORK) { } else if (section == SECTION::XLX_NETWORK) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_xlxNetworkEnabled = ::atoi(value) == 1; m_xlxNetworkEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Id") == 0) else if (::strcmp(key, "Id") == 0)
@ -362,7 +362,7 @@ bool CConf::read()
m_xlxNetworkUserControl = ::atoi(value) ==1; m_xlxNetworkUserControl = ::atoi(value) ==1;
else if (::strcmp(key, "Module") == 0) else if (::strcmp(key, "Module") == 0)
m_xlxNetworkModule = ::toupper(value[0]); m_xlxNetworkModule = ::toupper(value[0]);
} else if (section == SECTION_DMR_NETWORK_1) { } else if (section == SECTION::DMR_NETWORK_1) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dmrNetwork1Enabled = ::atoi(value) == 1; m_dmrNetwork1Enabled = ::atoi(value) == 1;
else if (::strcmp(key, "Name") == 0) else if (::strcmp(key, "Name") == 0)
@ -385,11 +385,11 @@ bool CConf::read()
m_dmrNetwork1Debug = ::atoi(value) == 1; m_dmrNetwork1Debug = ::atoi(value) == 1;
else if (::strncmp(key, "TGRewrite", 9U) == 0) { else if (::strncmp(key, "TGRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CTGRewriteStruct rewrite; CTGRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -400,11 +400,11 @@ bool CConf::read()
} }
} else if (::strncmp(key, "PCRewrite", 9U) == 0) { } else if (::strncmp(key, "PCRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CPCRewriteStruct rewrite; CPCRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -415,26 +415,26 @@ bool CConf::read()
} }
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) { } else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", \r\n"); char* p4 = ::strtok(nullptr, ", \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toId = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1; rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
m_dmrNetwork1TypeRewrites.push_back(rewrite); m_dmrNetwork1TypeRewrites.push_back(rewrite);
} }
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) { } else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CSrcRewriteStruct rewrite; CSrcRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -446,15 +446,15 @@ bool CConf::read()
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) { } else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
std::vector<char*> p7; std::vector<char*> p7;
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, ", "); char* p5 = ::strtok(nullptr, ", ");
char* p6 = ::strtok(NULL, ", \r\n"); char* p6 = ::strtok(nullptr, ", \r\n");
char* p; char* p;
while ((p = ::strtok(NULL, ", \r\n")) != NULL) while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
p7.push_back(p); p7.push_back(p);
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL && p6 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr && p6 != nullptr) {
CTGDynRewriteStruct rewrite; CTGDynRewriteStruct rewrite;
rewrite.m_slot = ::atoi(p1); rewrite.m_slot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -470,8 +470,8 @@ bool CConf::read()
} }
} else if (::strncmp(key, "IdRewrite", 9U) == 0) { } else if (::strncmp(key, "IdRewrite", 9U) == 0) {
char* rfId = ::strtok(value, ", "); char* rfId = ::strtok(value, ", ");
char* netId = ::strtok(NULL, " \r\n"); char* netId = ::strtok(nullptr, " \r\n");
if (rfId != NULL && netId != NULL) { if (rfId != nullptr && netId != nullptr) {
CIdRewriteStruct rewrite; CIdRewriteStruct rewrite;
rewrite.m_rfId = ::atoi(rfId); rewrite.m_rfId = ::atoi(rfId);
rewrite.m_netId = ::atoi(netId); rewrite.m_netId = ::atoi(netId);
@ -484,7 +484,7 @@ bool CConf::read()
unsigned int slotNo = (unsigned int)::atoi(value); unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork1PassAllTG.push_back(slotNo); m_dmrNetwork1PassAllTG.push_back(slotNo);
} }
} else if (section == SECTION_DMR_NETWORK_2) { } else if (section == SECTION::DMR_NETWORK_2) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dmrNetwork2Enabled = ::atoi(value) == 1; m_dmrNetwork2Enabled = ::atoi(value) == 1;
else if (::strcmp(key, "Name") == 0) else if (::strcmp(key, "Name") == 0)
@ -507,11 +507,11 @@ bool CConf::read()
m_dmrNetwork2Debug = ::atoi(value) == 1; m_dmrNetwork2Debug = ::atoi(value) == 1;
else if (::strncmp(key, "TGRewrite", 9U) == 0) { else if (::strncmp(key, "TGRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CTGRewriteStruct rewrite; CTGRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -522,11 +522,11 @@ bool CConf::read()
} }
} else if (::strncmp(key, "PCRewrite", 9U) == 0) { } else if (::strncmp(key, "PCRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CPCRewriteStruct rewrite; CPCRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -537,26 +537,26 @@ bool CConf::read()
} }
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) { } else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", \r\n"); char* p4 = ::strtok(nullptr, ", \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toId = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1; rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
m_dmrNetwork2TypeRewrites.push_back(rewrite); m_dmrNetwork2TypeRewrites.push_back(rewrite);
} }
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) { } else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CSrcRewriteStruct rewrite; CSrcRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -568,15 +568,15 @@ bool CConf::read()
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) { } else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
std::vector<char*> p7; std::vector<char*> p7;
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, ", "); char* p5 = ::strtok(nullptr, ", ");
char* p6 = ::strtok(NULL, ", \r\n"); char* p6 = ::strtok(nullptr, ", \r\n");
char* p; char* p;
while ((p = ::strtok(NULL, ", \r\n")) != NULL) while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
p7.push_back(p); p7.push_back(p);
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL && p6 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr && p6 != nullptr) {
CTGDynRewriteStruct rewrite; CTGDynRewriteStruct rewrite;
rewrite.m_slot = ::atoi(p1); rewrite.m_slot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -592,8 +592,8 @@ bool CConf::read()
} }
} else if (::strncmp(key, "IdRewrite", 9U) == 0) { } else if (::strncmp(key, "IdRewrite", 9U) == 0) {
char* rfId = ::strtok(value, ", "); char* rfId = ::strtok(value, ", ");
char* netId = ::strtok(NULL, " \r\n"); char* netId = ::strtok(nullptr, " \r\n");
if (rfId != NULL && netId != NULL) { if (rfId != nullptr && netId != nullptr) {
CIdRewriteStruct rewrite; CIdRewriteStruct rewrite;
rewrite.m_rfId = ::atoi(rfId); rewrite.m_rfId = ::atoi(rfId);
rewrite.m_netId = ::atoi(netId); rewrite.m_netId = ::atoi(netId);
@ -606,7 +606,7 @@ bool CConf::read()
unsigned int slotNo = (unsigned int)::atoi(value); unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork2PassAllTG.push_back(slotNo); m_dmrNetwork2PassAllTG.push_back(slotNo);
} }
} else if (section == SECTION_DMR_NETWORK_3) { } else if (section == SECTION::DMR_NETWORK_3) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dmrNetwork3Enabled = ::atoi(value) == 1; m_dmrNetwork3Enabled = ::atoi(value) == 1;
else if (::strcmp(key, "Name") == 0) else if (::strcmp(key, "Name") == 0)
@ -629,11 +629,11 @@ bool CConf::read()
m_dmrNetwork3Debug = ::atoi(value) == 1; m_dmrNetwork3Debug = ::atoi(value) == 1;
else if (::strncmp(key, "TGRewrite", 9U) == 0) { else if (::strncmp(key, "TGRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CTGRewriteStruct rewrite; CTGRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -644,11 +644,11 @@ bool CConf::read()
} }
} else if (::strncmp(key, "PCRewrite", 9U) == 0) { } else if (::strncmp(key, "PCRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CPCRewriteStruct rewrite; CPCRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -659,26 +659,26 @@ bool CConf::read()
} }
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) { } else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", \r\n"); char* p4 = ::strtok(nullptr, ", \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toId = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1; rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
m_dmrNetwork3TypeRewrites.push_back(rewrite); m_dmrNetwork3TypeRewrites.push_back(rewrite);
} }
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) { } else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CSrcRewriteStruct rewrite; CSrcRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -690,15 +690,15 @@ bool CConf::read()
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) { } else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
std::vector<char*> p7; std::vector<char*> p7;
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, ", "); char* p5 = ::strtok(nullptr, ", ");
char* p6 = ::strtok(NULL, ", \r\n"); char* p6 = ::strtok(nullptr, ", \r\n");
char* p; char* p;
while ((p = ::strtok(NULL, ", \r\n")) != NULL) while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
p7.push_back(p); p7.push_back(p);
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL && p6 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr && p6 != nullptr) {
CTGDynRewriteStruct rewrite; CTGDynRewriteStruct rewrite;
rewrite.m_slot = ::atoi(p1); rewrite.m_slot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -714,8 +714,8 @@ bool CConf::read()
} }
} else if (::strncmp(key, "IdRewrite", 9U) == 0) { } else if (::strncmp(key, "IdRewrite", 9U) == 0) {
char* rfId = ::strtok(value, ", "); char* rfId = ::strtok(value, ", ");
char* netId = ::strtok(NULL, " \r\n"); char* netId = ::strtok(nullptr, " \r\n");
if (rfId != NULL && netId != NULL) { if (rfId != nullptr && netId != nullptr) {
CIdRewriteStruct rewrite; CIdRewriteStruct rewrite;
rewrite.m_rfId = ::atoi(rfId); rewrite.m_rfId = ::atoi(rfId);
rewrite.m_netId = ::atoi(netId); rewrite.m_netId = ::atoi(netId);
@ -728,7 +728,7 @@ bool CConf::read()
unsigned int slotNo = (unsigned int)::atoi(value); unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork3PassAllTG.push_back(slotNo); m_dmrNetwork3PassAllTG.push_back(slotNo);
} }
} else if (section == SECTION_DMR_NETWORK_4) { } else if (section == SECTION::DMR_NETWORK_4) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dmrNetwork4Enabled = ::atoi(value) == 1; m_dmrNetwork4Enabled = ::atoi(value) == 1;
else if (::strcmp(key, "Name") == 0) else if (::strcmp(key, "Name") == 0)
@ -751,11 +751,11 @@ bool CConf::read()
m_dmrNetwork4Debug = ::atoi(value) == 1; m_dmrNetwork4Debug = ::atoi(value) == 1;
else if (::strncmp(key, "TGRewrite", 9U) == 0) { else if (::strncmp(key, "TGRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CTGRewriteStruct rewrite; CTGRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -766,11 +766,11 @@ bool CConf::read()
} }
} else if (::strncmp(key, "PCRewrite", 9U) == 0) { } else if (::strncmp(key, "PCRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CPCRewriteStruct rewrite; CPCRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -781,26 +781,26 @@ bool CConf::read()
} }
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) { } else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", \r\n"); char* p4 = ::strtok(nullptr, ", \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toId = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1; rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
m_dmrNetwork4TypeRewrites.push_back(rewrite); m_dmrNetwork4TypeRewrites.push_back(rewrite);
} }
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) { } else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CSrcRewriteStruct rewrite; CSrcRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -812,15 +812,15 @@ bool CConf::read()
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) { } else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
std::vector<char*> p7; std::vector<char*> p7;
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, ", "); char* p5 = ::strtok(nullptr, ", ");
char* p6 = ::strtok(NULL, ", \r\n"); char* p6 = ::strtok(nullptr, ", \r\n");
char* p; char* p;
while ((p = ::strtok(NULL, ", \r\n")) != NULL) while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
p7.push_back(p); p7.push_back(p);
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL && p6 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr && p6 != nullptr) {
CTGDynRewriteStruct rewrite; CTGDynRewriteStruct rewrite;
rewrite.m_slot = ::atoi(p1); rewrite.m_slot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -836,8 +836,8 @@ bool CConf::read()
} }
} else if (::strncmp(key, "IdRewrite", 9U) == 0) { } else if (::strncmp(key, "IdRewrite", 9U) == 0) {
char* rfId = ::strtok(value, ", "); char* rfId = ::strtok(value, ", ");
char* netId = ::strtok(NULL, " \r\n"); char* netId = ::strtok(nullptr, " \r\n");
if (rfId != NULL && netId != NULL) { if (rfId != nullptr && netId != nullptr) {
CIdRewriteStruct rewrite; CIdRewriteStruct rewrite;
rewrite.m_rfId = ::atoi(rfId); rewrite.m_rfId = ::atoi(rfId);
rewrite.m_netId = ::atoi(netId); rewrite.m_netId = ::atoi(netId);
@ -850,7 +850,7 @@ bool CConf::read()
unsigned int slotNo = (unsigned int)::atoi(value); unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork4PassAllTG.push_back(slotNo); m_dmrNetwork4PassAllTG.push_back(slotNo);
} }
} else if (section == SECTION_DMR_NETWORK_5) { } else if (section == SECTION::DMR_NETWORK_5) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dmrNetwork5Enabled = ::atoi(value) == 1; m_dmrNetwork5Enabled = ::atoi(value) == 1;
else if (::strcmp(key, "Name") == 0) else if (::strcmp(key, "Name") == 0)
@ -873,11 +873,11 @@ bool CConf::read()
m_dmrNetwork5Debug = ::atoi(value) == 1; m_dmrNetwork5Debug = ::atoi(value) == 1;
else if (::strncmp(key, "TGRewrite", 9U) == 0) { else if (::strncmp(key, "TGRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CTGRewriteStruct rewrite; CTGRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -888,11 +888,11 @@ bool CConf::read()
} }
} else if (::strncmp(key, "PCRewrite", 9U) == 0) { } else if (::strncmp(key, "PCRewrite", 9U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CPCRewriteStruct rewrite; CPCRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -903,26 +903,26 @@ bool CConf::read()
} }
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) { } else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", \r\n"); char* p4 = ::strtok(nullptr, ", \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
CTypeRewriteStruct rewrite; CTypeRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
rewrite.m_toSlot = ::atoi(p3); rewrite.m_toSlot = ::atoi(p3);
rewrite.m_toId = ::atoi(p4); rewrite.m_toId = ::atoi(p4);
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1; rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
m_dmrNetwork5TypeRewrites.push_back(rewrite); m_dmrNetwork5TypeRewrites.push_back(rewrite);
} }
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) { } else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, " \r\n"); char* p5 = ::strtok(nullptr, " \r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
CSrcRewriteStruct rewrite; CSrcRewriteStruct rewrite;
rewrite.m_fromSlot = ::atoi(p1); rewrite.m_fromSlot = ::atoi(p1);
rewrite.m_fromId = ::atoi(p2); rewrite.m_fromId = ::atoi(p2);
@ -934,15 +934,15 @@ bool CConf::read()
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) { } else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
std::vector<char*> p7; std::vector<char*> p7;
char* p1 = ::strtok(value, ", "); char* p1 = ::strtok(value, ", ");
char* p2 = ::strtok(NULL, ", "); char* p2 = ::strtok(nullptr, ", ");
char* p3 = ::strtok(NULL, ", "); char* p3 = ::strtok(nullptr, ", ");
char* p4 = ::strtok(NULL, ", "); char* p4 = ::strtok(nullptr, ", ");
char* p5 = ::strtok(NULL, ", "); char* p5 = ::strtok(nullptr, ", ");
char* p6 = ::strtok(NULL, ", \r\n"); char* p6 = ::strtok(nullptr, ", \r\n");
char* p; char* p;
while ((p = ::strtok(NULL, ", \r\n")) != NULL) while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
p7.push_back(p); p7.push_back(p);
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL && p6 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr && p6 != nullptr) {
CTGDynRewriteStruct rewrite; CTGDynRewriteStruct rewrite;
rewrite.m_slot = ::atoi(p1); rewrite.m_slot = ::atoi(p1);
rewrite.m_fromTG = ::atoi(p2); rewrite.m_fromTG = ::atoi(p2);
@ -958,8 +958,8 @@ bool CConf::read()
} }
} else if (::strncmp(key, "IdRewrite", 9U) == 0) { } else if (::strncmp(key, "IdRewrite", 9U) == 0) {
char* rfId = ::strtok(value, ", "); char* rfId = ::strtok(value, ", ");
char* netId = ::strtok(NULL, " \r\n"); char* netId = ::strtok(nullptr, " \r\n");
if (rfId != NULL && netId != NULL) { if (rfId != nullptr && netId != nullptr) {
CIdRewriteStruct rewrite; CIdRewriteStruct rewrite;
rewrite.m_rfId = ::atoi(rfId); rewrite.m_rfId = ::atoi(rfId);
rewrite.m_netId = ::atoi(netId); rewrite.m_netId = ::atoi(netId);
@ -972,14 +972,14 @@ bool CConf::read()
unsigned int slotNo = (unsigned int)::atoi(value); unsigned int slotNo = (unsigned int)::atoi(value);
m_dmrNetwork5PassAllTG.push_back(slotNo); m_dmrNetwork5PassAllTG.push_back(slotNo);
} }
} else if (section == SECTION_GPSD) { } else if (section == SECTION::GPSD) {
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
m_gpsdEnabled = ::atoi(value) == 1; m_gpsdEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0) else if (::strcmp(key, "Address") == 0)
m_gpsdAddress = value; m_gpsdAddress = value;
else if (::strcmp(key, "Port") == 0) else if (::strcmp(key, "Port") == 0)
m_gpsdPort = value; m_gpsdPort = value;
} else if (section == SECTION_APRS) { } else if (section == SECTION::APRS) {
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
m_aprsEnabled = ::atoi(value) == 1; m_aprsEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0) else if (::strcmp(key, "Address") == 0)
@ -992,12 +992,12 @@ bool CConf::read()
m_aprsDescription = value; m_aprsDescription = value;
else if (::strcmp(key, "Symbol") == 0) else if (::strcmp(key, "Symbol") == 0)
m_aprsSymbol = value; m_aprsSymbol = value;
} else if (section == SECTION_DYNAMIC_TG_CONTROL) { } else if (section == SECTION::DYNAMIC_TG_CONTROL) {
if (::strcmp(key, "Enabled") == 0) if (::strcmp(key, "Enabled") == 0)
m_dynamicTGControlEnabled = ::atoi(value) == 1; m_dynamicTGControlEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Port") == 0) else if (::strcmp(key, "Port") == 0)
m_dynamicTGControlPort = (unsigned short)::atoi(value); m_dynamicTGControlPort = (unsigned short)::atoi(value);
} else if (section == SECTION_REMOTE_CONTROL) { } else if (section == SECTION::REMOTE_CONTROL) {
if (::strcmp(key, "Enable") == 0) if (::strcmp(key, "Enable") == 0)
m_remoteControlEnabled = ::atoi(value) == 1; m_remoteControlEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0) else if (::strcmp(key, "Address") == 0)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -25,8 +25,8 @@
#include <cassert> #include <cassert>
CDMRCSBK::CDMRCSBK() : CDMRCSBK::CDMRCSBK() :
m_data(NULL), m_data(nullptr),
m_CSBKO(CSBKO_NONE) m_CSBKO(CSBKO::NONE)
{ {
m_data = new unsigned char[12U]; m_data = new unsigned char[12U];
} }
@ -38,7 +38,7 @@ CDMRCSBK::~CDMRCSBK()
bool CDMRCSBK::put(const unsigned char* bytes) bool CDMRCSBK::put(const unsigned char* bytes)
{ {
assert(bytes != NULL); assert(bytes != nullptr);
CBPTC19696 bptc; CBPTC19696 bptc;
bptc.decode(bytes, m_data); bptc.decode(bytes, m_data);
@ -57,7 +57,7 @@ bool CDMRCSBK::put(const unsigned char* bytes)
void CDMRCSBK::get(unsigned char* bytes) const void CDMRCSBK::get(unsigned char* bytes) const
{ {
assert(bytes != NULL); assert(bytes != nullptr);
CCRC::addCCITT162(m_data, 12U); CCRC::addCCITT162(m_data, 12U);
@ -75,7 +75,7 @@ CSBKO CDMRCSBK::getCSBKO() const
bool CDMRCSBK::getGI() const bool CDMRCSBK::getGI() const
{ {
if (m_CSBKO == CSBKO_PRECCSBK) if (m_CSBKO == CSBKO::PRECCSBK)
return (m_data[2U] & 0x40U) == 0x40U; return (m_data[2U] & 0x40U) == 0x40U;
else else
return false; return false;
@ -83,7 +83,7 @@ bool CDMRCSBK::getGI() const
unsigned int CDMRCSBK::getSrcId() const unsigned int CDMRCSBK::getSrcId() const
{ {
if (m_CSBKO == CSBKO_NACKRSP) if (m_CSBKO == CSBKO::NACKRSP)
return m_data[4U] << 16 | m_data[5U] << 8 | m_data[6U]; return m_data[4U] << 16 | m_data[5U] << 8 | m_data[6U];
else else
return m_data[7U] << 16 | m_data[8U] << 8 | m_data[9U]; return m_data[7U] << 16 | m_data[8U] << 8 | m_data[9U];
@ -91,7 +91,7 @@ unsigned int CDMRCSBK::getSrcId() const
unsigned int CDMRCSBK::getDstId() const unsigned int CDMRCSBK::getDstId() const
{ {
if (m_CSBKO == CSBKO_NACKRSP) if (m_CSBKO == CSBKO::NACKRSP)
return m_data[7U] << 16 | m_data[8U] << 8 | m_data[9U]; return m_data[7U] << 16 | m_data[8U] << 8 | m_data[9U];
else else
return m_data[4U] << 16 | m_data[5U] << 8 | m_data[6U]; return m_data[4U] << 16 | m_data[5U] << 8 | m_data[6U];
@ -99,7 +99,7 @@ unsigned int CDMRCSBK::getDstId() const
void CDMRCSBK::setGI(bool group) void CDMRCSBK::setGI(bool group)
{ {
if (m_CSBKO == CSBKO_PRECCSBK) { if (m_CSBKO == CSBKO::PRECCSBK) {
if (group) if (group)
m_data[2U] |= 0x40U; m_data[2U] |= 0x40U;
else else
@ -109,7 +109,7 @@ void CDMRCSBK::setGI(bool group)
void CDMRCSBK::setSrcId(unsigned int id) void CDMRCSBK::setSrcId(unsigned int id)
{ {
if (m_CSBKO == CSBKO_NACKRSP) { if (m_CSBKO == CSBKO::NACKRSP) {
m_data[4U] = id >> 16; m_data[4U] = id >> 16;
m_data[5U] = id >> 8; m_data[5U] = id >> 8;
m_data[6U] = id >> 0; m_data[6U] = id >> 0;
@ -122,7 +122,7 @@ void CDMRCSBK::setSrcId(unsigned int id)
void CDMRCSBK::setDstId(unsigned int id) void CDMRCSBK::setDstId(unsigned int id)
{ {
if (m_CSBKO == CSBKO_NACKRSP) { if (m_CSBKO == CSBKO::NACKRSP) {
m_data[7U] = id >> 16; m_data[7U] = id >> 16;
m_data[8U] = id >> 8; m_data[8U] = id >> 8;
m_data[9U] = id >> 0; m_data[9U] = id >> 0;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -21,14 +21,14 @@
#include "DMRDefines.h" #include "DMRDefines.h"
enum CSBKO { enum class CSBKO : unsigned char {
CSBKO_NONE = 0x00, NONE = 0x00,
CSBKO_UUVREQ = 0x04, UUVREQ = 0x04,
CSBKO_UUANSRSP = 0x05, UUANSRSP = 0x05,
CSBKO_CTCSBK = 0x07, CTCSBK = 0x07,
CSBKO_NACKRSP = 0x26, NACKRSP = 0x26,
CSBKO_BSDWNACT = 0x38, BSDWNACT = 0x38,
CSBKO_PRECCSBK = 0x3D PRECCSBK = 0x3D
}; };
class CDMRCSBK class CDMRCSBK

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 Jonathan Naylor, G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -23,7 +23,7 @@
CDMRData::CDMRData(const CDMRData& data) : CDMRData::CDMRData(const CDMRData& data) :
m_slotNo(data.m_slotNo), m_slotNo(data.m_slotNo),
m_data(NULL), m_data(nullptr),
m_srcId(data.m_srcId), m_srcId(data.m_srcId),
m_dstId(data.m_dstId), m_dstId(data.m_dstId),
m_flco(data.m_flco), m_flco(data.m_flco),
@ -40,10 +40,10 @@ m_streamId(data.m_streamId)
CDMRData::CDMRData() : CDMRData::CDMRData() :
m_slotNo(1U), m_slotNo(1U),
m_data(NULL), m_data(nullptr),
m_srcId(0U), m_srcId(0U),
m_dstId(0U), m_dstId(0U),
m_flco(FLCO_GROUP), m_flco(FLCO::GROUP),
m_dataType(0U), m_dataType(0U),
m_seqNo(0U), m_seqNo(0U),
m_n(0U), m_n(0U),
@ -173,7 +173,7 @@ void CDMRData::setRSSI(unsigned char rssi)
unsigned int CDMRData::getData(unsigned char* buffer) const unsigned int CDMRData::getData(unsigned char* buffer) const
{ {
assert(buffer != NULL); assert(buffer != nullptr);
::memcpy(buffer, m_data, DMR_FRAME_LENGTH_BYTES); ::memcpy(buffer, m_data, DMR_FRAME_LENGTH_BYTES);
@ -182,7 +182,7 @@ unsigned int CDMRData::getData(unsigned char* buffer) const
void CDMRData::setData(const unsigned char* buffer) void CDMRData::setData(const unsigned char* buffer)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
::memcpy(m_data, buffer, DMR_FRAME_LENGTH_BYTES); ::memcpy(m_data, buffer, DMR_FRAME_LENGTH_BYTES);
} }

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2012 by Ian Wraith * Copyright (C) 2012 by Ian Wraith
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -30,7 +30,7 @@
#include <cstring> #include <cstring>
CDMRDataHeader::CDMRDataHeader() : CDMRDataHeader::CDMRDataHeader() :
m_data(NULL) m_data(nullptr)
{ {
m_data = new unsigned char[12U]; m_data = new unsigned char[12U];
} }
@ -42,7 +42,7 @@ CDMRDataHeader::~CDMRDataHeader()
bool CDMRDataHeader::put(const unsigned char* bytes) bool CDMRDataHeader::put(const unsigned char* bytes)
{ {
assert(bytes != NULL); assert(bytes != nullptr);
CBPTC19696 bptc; CBPTC19696 bptc;
bptc.decode(bytes, m_data); bptc.decode(bytes, m_data);
@ -63,7 +63,7 @@ bool CDMRDataHeader::put(const unsigned char* bytes)
void CDMRDataHeader::get(unsigned char* bytes) const void CDMRDataHeader::get(unsigned char* bytes) const
{ {
assert(bytes != NULL); assert(bytes != nullptr);
CCRC::addCCITT162(m_data, 12U); CCRC::addCCITT162(m_data, 12U);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -96,14 +96,14 @@ const unsigned char DPF_PROPRIETARY = 0x0FU;
const unsigned char FID_ETSI = 0U; const unsigned char FID_ETSI = 0U;
const unsigned char FID_DMRA = 16U; const unsigned char FID_DMRA = 16U;
enum FLCO { enum class FLCO : unsigned char {
FLCO_GROUP = 0, GROUP = 0,
FLCO_USER_USER = 3, USER_USER = 3,
FLCO_TALKER_ALIAS_HEADER = 4, TALKER_ALIAS_HEADER = 4,
FLCO_TALKER_ALIAS_BLOCK1 = 5, TALKER_ALIAS_BLOCK1 = 5,
FLCO_TALKER_ALIAS_BLOCK2 = 6, TALKER_ALIAS_BLOCK2 = 6,
FLCO_TALKER_ALIAS_BLOCK3 = 7, TALKER_ALIAS_BLOCK3 = 7,
FLCO_GPS_INFO = 8 GPS_INFO = 8
}; };
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -36,7 +36,7 @@ CDMREMB::~CDMREMB()
void CDMREMB::putData(const unsigned char* data) void CDMREMB::putData(const unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char DMREMB[2U]; unsigned char DMREMB[2U];
DMREMB[0U] = (data[13U] << 4) & 0xF0U; DMREMB[0U] = (data[13U] << 4) & 0xF0U;
@ -53,7 +53,7 @@ void CDMREMB::putData(const unsigned char* data)
void CDMREMB::getData(unsigned char* data) const void CDMREMB::getData(unsigned char* data) const
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char DMREMB[2U]; unsigned char DMREMB[2U];
DMREMB[0U] = (m_colorCode << 4) & 0xF0U; DMREMB[0U] = (m_colorCode << 4) & 0xF0U;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -27,10 +27,10 @@
#include <cstring> #include <cstring>
CDMREmbeddedData::CDMREmbeddedData() : CDMREmbeddedData::CDMREmbeddedData() :
m_raw(NULL), m_raw(nullptr),
m_state(LCS_NONE), m_state(LC_STATE::NONE),
m_data(NULL), m_data(nullptr),
m_FLCO(FLCO_GROUP), m_FLCO(FLCO::GROUP),
m_valid(false) m_valid(false)
{ {
m_raw = new bool[128U]; m_raw = new bool[128U];
@ -46,7 +46,7 @@ CDMREmbeddedData::~CDMREmbeddedData()
// Add LC data (which may consist of 4 blocks) to the data store // Add LC data (which may consist of 4 blocks) to the data store
bool CDMREmbeddedData::addData(const unsigned char* data, unsigned char lcss) bool CDMREmbeddedData::addData(const unsigned char* data, unsigned char lcss)
{ {
assert(data != NULL); assert(data != nullptr);
bool rawData[40U]; bool rawData[40U];
CUtils::byteToBitsBE(data[14U], rawData + 0U); CUtils::byteToBitsBE(data[14U], rawData + 0U);
@ -61,41 +61,41 @@ bool CDMREmbeddedData::addData(const unsigned char* data, unsigned char lcss)
m_raw[a] = rawData[a + 4U]; m_raw[a] = rawData[a + 4U];
// Show we are ready for the next LC block // Show we are ready for the next LC block
m_state = LCS_FIRST; m_state = LC_STATE::FIRST;
m_valid = false; m_valid = false;
return false; return false;
} }
// Is this the 2nd block of a 4 block embedded LC ? // Is this the 2nd block of a 4 block embedded LC ?
if (lcss == 3U && m_state == LCS_FIRST) { if (lcss == 3U && m_state == LC_STATE::FIRST) {
for (unsigned int a = 0U; a < 32U; a++) for (unsigned int a = 0U; a < 32U; a++)
m_raw[a + 32U] = rawData[a + 4U]; m_raw[a + 32U] = rawData[a + 4U];
// Show we are ready for the next LC block // Show we are ready for the next LC block
m_state = LCS_SECOND; m_state = LC_STATE::SECOND;
return false; return false;
} }
// Is this the 3rd block of a 4 block embedded LC ? // Is this the 3rd block of a 4 block embedded LC ?
if (lcss == 3U && m_state == LCS_SECOND) { if (lcss == 3U && m_state == LC_STATE::SECOND) {
for (unsigned int a = 0U; a < 32U; a++) for (unsigned int a = 0U; a < 32U; a++)
m_raw[a + 64U] = rawData[a + 4U]; m_raw[a + 64U] = rawData[a + 4U];
// Show we are ready for the final LC block // Show we are ready for the final LC block
m_state = LCS_THIRD; m_state = LC_STATE::THIRD;
return false; return false;
} }
// Is this the final block of a 4 block embedded LC ? // Is this the final block of a 4 block embedded LC ?
if (lcss == 2U && m_state == LCS_THIRD) { if (lcss == 2U && m_state == LC_STATE::THIRD) {
for (unsigned int a = 0U; a < 32U; a++) for (unsigned int a = 0U; a < 32U; a++)
m_raw[a + 96U] = rawData[a + 4U]; m_raw[a + 96U] = rawData[a + 4U];
// Show that we're not ready for any more data // Show that we're not ready for any more data
m_state = LCS_NONE; m_state = LC_STATE::NONE;
// Process the complete data block // Process the complete data block
decodeEmbeddedData(); decodeEmbeddedData();
@ -168,7 +168,7 @@ void CDMREmbeddedData::encodeEmbeddedData()
unsigned char CDMREmbeddedData::getData(unsigned char* data, unsigned char n) const unsigned char CDMREmbeddedData::getData(unsigned char* data, unsigned char n) const
{ {
assert(data != NULL); assert(data != nullptr);
if (n >= 1U && n < 5U) { if (n >= 1U && n < 5U) {
n--; n--;
@ -277,10 +277,10 @@ void CDMREmbeddedData::decodeEmbeddedData()
CDMRLC* CDMREmbeddedData::getLC() const CDMRLC* CDMREmbeddedData::getLC() const
{ {
if (!m_valid) if (!m_valid)
return NULL; return nullptr;
if (m_FLCO != FLCO_GROUP && m_FLCO != FLCO_USER_USER) if (m_FLCO != FLCO::GROUP && m_FLCO != FLCO::USER_USER)
return NULL; return nullptr;
return new CDMRLC(m_data); return new CDMRLC(m_data);
} }
@ -297,13 +297,13 @@ FLCO CDMREmbeddedData::getFLCO() const
void CDMREmbeddedData::reset() void CDMREmbeddedData::reset()
{ {
m_state = LCS_NONE; m_state = LC_STATE::NONE;
m_valid = false; m_valid = false;
} }
bool CDMREmbeddedData::getRawData(unsigned char* data) const bool CDMREmbeddedData::getRawData(unsigned char* data) const
{ {
assert(data != NULL); assert(data != nullptr);
if (!m_valid) if (!m_valid)
return false; return false;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -22,11 +22,11 @@
#include "DMRDefines.h" #include "DMRDefines.h"
#include "DMRLC.h" #include "DMRLC.h"
enum LC_STATE { enum class LC_STATE {
LCS_NONE, NONE,
LCS_FIRST, FIRST,
LCS_SECOND, SECOND,
LCS_THIRD THIRD
}; };
class CDMREmbeddedData class CDMREmbeddedData

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2012 by Ian Wraith * Copyright (C) 2012 by Ian Wraith
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -38,7 +38,7 @@ CDMRFullLC::~CDMRFullLC()
CDMRLC* CDMRFullLC::decode(const unsigned char* data, unsigned char type) CDMRLC* CDMRFullLC::decode(const unsigned char* data, unsigned char type)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char lcData[12U]; unsigned char lcData[12U];
m_bptc.decode(data, lcData); m_bptc.decode(data, lcData);
@ -58,18 +58,18 @@ CDMRLC* CDMRFullLC::decode(const unsigned char* data, unsigned char type)
default: default:
::LogError("Unsupported LC type - %d", int(type)); ::LogError("Unsupported LC type - %d", int(type));
return NULL; return nullptr;
} }
if (!CRS129::check(lcData)) if (!CRS129::check(lcData))
return NULL; return nullptr;
return new CDMRLC(lcData); return new CDMRLC(lcData);
} }
void CDMRFullLC::encode(const CDMRLC& lc, unsigned char* data, unsigned char type) void CDMRFullLC::encode(const CDMRLC& lc, unsigned char* data, unsigned char type)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char lcData[12U]; unsigned char lcData[12U];
lc.getData(lcData); lc.getData(lcData);

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2019,2020 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2019,2020,2025 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
@ -37,14 +37,14 @@
#include <string> #include <string>
enum DMRGW_STATUS { enum class DMRGW_STATUS {
DMRGWS_NONE, NONE,
DMRGWS_DMRNETWORK1, DMRNETWORK1,
DMRGWS_DMRNETWORK2, DMRNETWORK2,
DMRGWS_DMRNETWORK3, DMRNETWORK3,
DMRGWS_DMRNETWORK4, DMRNETWORK4,
DMRGWS_DMRNETWORK5, DMRNETWORK5,
DMRGWS_XLXREFLECTOR XLXREFLECTOR
}; };
class CDMRGateway class CDMRGateway

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -37,13 +37,13 @@ m_dstId(dstId)
CDMRLC::CDMRLC(const unsigned char* bytes) : CDMRLC::CDMRLC(const unsigned char* bytes) :
m_PF(false), m_PF(false),
m_R(false), m_R(false),
m_FLCO(FLCO_GROUP), m_FLCO(FLCO::GROUP),
m_FID(0U), m_FID(0U),
m_options(0U), m_options(0U),
m_srcId(0U), m_srcId(0U),
m_dstId(0U) m_dstId(0U)
{ {
assert(bytes != NULL); assert(bytes != nullptr);
m_PF = (bytes[0U] & 0x80U) == 0x80U; m_PF = (bytes[0U] & 0x80U) == 0x80U;
m_R = (bytes[0U] & 0x40U) == 0x40U; m_R = (bytes[0U] & 0x40U) == 0x40U;
@ -61,13 +61,13 @@ m_dstId(0U)
CDMRLC::CDMRLC(const bool* bits) : CDMRLC::CDMRLC(const bool* bits) :
m_PF(false), m_PF(false),
m_R(false), m_R(false),
m_FLCO(FLCO_GROUP), m_FLCO(FLCO::GROUP),
m_FID(0U), m_FID(0U),
m_options(0U), m_options(0U),
m_srcId(0U), m_srcId(0U),
m_dstId(0U) m_dstId(0U)
{ {
assert(bits != NULL); assert(bits != nullptr);
m_PF = bits[0U]; m_PF = bits[0U];
m_R = bits[1U]; m_R = bits[1U];
@ -99,7 +99,7 @@ m_dstId(0U)
CDMRLC::CDMRLC() : CDMRLC::CDMRLC() :
m_PF(false), m_PF(false),
m_R(false), m_R(false),
m_FLCO(FLCO_GROUP), m_FLCO(FLCO::GROUP),
m_FID(0U), m_FID(0U),
m_options(0U), m_options(0U),
m_srcId(0U), m_srcId(0U),
@ -113,7 +113,7 @@ CDMRLC::~CDMRLC()
void CDMRLC::getData(unsigned char* bytes) const void CDMRLC::getData(unsigned char* bytes) const
{ {
assert(bytes != NULL); assert(bytes != nullptr);
bytes[0U] = (unsigned char)m_FLCO; bytes[0U] = (unsigned char)m_FLCO;
@ -138,7 +138,7 @@ void CDMRLC::getData(unsigned char* bytes) const
void CDMRLC::getData(bool* bits) const void CDMRLC::getData(bool* bits) const
{ {
assert(bits != NULL); assert(bits != nullptr);
unsigned char bytes[9U]; unsigned char bytes[9U];
getData(bytes); getData(bytes);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018,2020,2021 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2018,2020,2021,2025 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
@ -34,21 +34,21 @@ const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug) : CDMRNetwork::CDMRNetwork(const std::string& address, unsigned short port, unsigned short local, unsigned int id, const std::string& password, const std::string& name, bool location, bool debug) :
m_addr(), m_addr(),
m_addrLen(0U), m_addrLen(0U),
m_id(NULL), m_id(nullptr),
m_password(password), m_password(password),
m_name(name), m_name(name),
m_location(location), m_location(location),
m_debug(debug), m_debug(debug),
m_socket(local), m_socket(local),
m_enabled(false), m_enabled(false),
m_status(WAITING_CONNECT), m_status(STATUS::WAITING_CONNECT),
m_retryTimer(1000U, 10U), m_retryTimer(1000U, 10U),
m_timeoutTimer(1000U, 60U), m_timeoutTimer(1000U, 60U),
m_buffer(NULL), m_buffer(nullptr),
m_salt(NULL), m_salt(nullptr),
m_rxData(1000U, "DMR Network"), m_rxData(1000U, "DMR Network"),
m_options(), m_options(),
m_configData(NULL), m_configData(nullptr),
m_configLen(0U), m_configLen(0U),
m_beacon(false) m_beacon(false)
{ {
@ -70,7 +70,7 @@ m_beacon(false)
m_id[3U] = id >> 0; m_id[3U] = id >> 0;
CStopWatch stopWatch; CStopWatch stopWatch;
::srand(stopWatch.start()); ::srand((unsigned int)stopWatch.start());
} }
CDMRNetwork::~CDMRNetwork() CDMRNetwork::~CDMRNetwork()
@ -106,7 +106,7 @@ bool CDMRNetwork::open()
if (!ret) if (!ret)
return false; return false;
m_status = WAITING_CONNECT; m_status = STATUS::WAITING_CONNECT;
m_timeoutTimer.stop(); m_timeoutTimer.stop();
m_retryTimer.start(); m_retryTimer.start();
@ -123,7 +123,7 @@ void CDMRNetwork::enable(bool enabled)
bool CDMRNetwork::read(CDMRData& data) bool CDMRNetwork::read(CDMRData& data)
{ {
if (m_status != RUNNING) if (m_status != STATUS::RUNNING)
return false; return false;
if (m_rxData.isEmpty()) if (m_rxData.isEmpty())
@ -146,7 +146,7 @@ bool CDMRNetwork::read(CDMRData& data)
unsigned int slotNo = (m_buffer[15U] & 0x80U) == 0x80U ? 2U : 1U; unsigned int slotNo = (m_buffer[15U] & 0x80U) == 0x80U ? 2U : 1U;
FLCO flco = (m_buffer[15U] & 0x40U) == 0x40U ? FLCO_USER_USER : FLCO_GROUP; FLCO flco = (m_buffer[15U] & 0x40U) == 0x40U ? FLCO::USER_USER : FLCO::GROUP;
unsigned int streamId; unsigned int streamId;
::memcpy(&streamId, m_buffer + 16U, 4U); ::memcpy(&streamId, m_buffer + 16U, 4U);
@ -188,7 +188,7 @@ bool CDMRNetwork::read(CDMRData& data)
bool CDMRNetwork::write(const CDMRData& data) bool CDMRNetwork::write(const CDMRData& data)
{ {
if (m_status != RUNNING) if (m_status != STATUS::RUNNING)
return false; return false;
unsigned char buffer[HOMEBREW_DATA_PACKET_LENGTH]; unsigned char buffer[HOMEBREW_DATA_PACKET_LENGTH];
@ -216,7 +216,7 @@ bool CDMRNetwork::write(const CDMRData& data)
buffer[15U] = slotNo == 1U ? 0x00U : 0x80U; buffer[15U] = slotNo == 1U ? 0x00U : 0x80U;
FLCO flco = data.getFLCO(); FLCO flco = data.getFLCO();
buffer[15U] |= flco == FLCO_GROUP ? 0x00U : 0x40U; buffer[15U] |= flco == FLCO::GROUP ? 0x00U : 0x40U;
unsigned char dataType = data.getDataType(); unsigned char dataType = data.getDataType();
if (dataType == DT_VOICE_SYNC) { if (dataType == DT_VOICE_SYNC) {
@ -245,7 +245,7 @@ bool CDMRNetwork::write(const CDMRData& data)
bool CDMRNetwork::writeRadioPosition(const unsigned char* data, unsigned int length) bool CDMRNetwork::writeRadioPosition(const unsigned char* data, unsigned int length)
{ {
if (m_status != RUNNING) if (m_status != STATUS::RUNNING)
return false; return false;
if (!m_location) if (!m_location)
@ -264,7 +264,7 @@ bool CDMRNetwork::writeRadioPosition(const unsigned char* data, unsigned int len
bool CDMRNetwork::writeTalkerAlias(const unsigned char* data, unsigned int length) bool CDMRNetwork::writeTalkerAlias(const unsigned char* data, unsigned int length)
{ {
if (m_status != RUNNING) if (m_status != STATUS::RUNNING)
return false; return false;
unsigned char buffer[50U]; unsigned char buffer[50U];
@ -280,7 +280,7 @@ bool CDMRNetwork::writeTalkerAlias(const unsigned char* data, unsigned int lengt
bool CDMRNetwork::writeHomePosition(float latitude, float longitude) bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
{ {
if (m_status != RUNNING) if (m_status != STATUS::RUNNING)
return false; return false;
if (!m_location) if (!m_location)
@ -299,7 +299,7 @@ bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
bool CDMRNetwork::isConnected() const bool CDMRNetwork::isConnected() const
{ {
return m_status == RUNNING; return m_status == STATUS::RUNNING;
} }
std::string const CDMRNetwork::getName() const std::string const CDMRNetwork::getName() const
@ -311,7 +311,7 @@ void CDMRNetwork::close(bool sayGoodbye)
{ {
LogMessage("%s, Closing DMR Network", m_name.c_str()); LogMessage("%s, Closing DMR Network", m_name.c_str());
if (sayGoodbye && (m_status == RUNNING)) { if (sayGoodbye && (m_status == STATUS::RUNNING)) {
unsigned char buffer[9U]; unsigned char buffer[9U];
::memcpy(buffer + 0U, "RPTCL", 5U); ::memcpy(buffer + 0U, "RPTCL", 5U);
::memcpy(buffer + 5U, m_id, 4U); ::memcpy(buffer + 5U, m_id, 4U);
@ -326,14 +326,14 @@ void CDMRNetwork::close(bool sayGoodbye)
void CDMRNetwork::clock(unsigned int ms) void CDMRNetwork::clock(unsigned int ms)
{ {
if (m_status == WAITING_CONNECT) { if (m_status == STATUS::WAITING_CONNECT) {
m_retryTimer.clock(ms); m_retryTimer.clock(ms);
if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) { if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) {
bool ret = writeLogin(); bool ret = writeLogin();
if (!ret) if (!ret)
return; return;
m_status = WAITING_LOGIN; m_status = STATUS::WAITING_LOGIN;
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
} }
@ -365,9 +365,9 @@ void CDMRNetwork::clock(unsigned int ms)
m_rxData.addData(m_buffer, len); m_rxData.addData(m_buffer, len);
} }
} else if (::memcmp(m_buffer, "MSTNAK", 6U) == 0) { } else if (::memcmp(m_buffer, "MSTNAK", 6U) == 0) {
if (m_status == RUNNING) { if (m_status == STATUS::RUNNING) {
LogWarning("%s, Login to the master has failed, retrying login ...", m_name.c_str()); LogWarning("%s, Login to the master has failed, retrying login ...", m_name.c_str());
m_status = WAITING_LOGIN; m_status = STATUS::WAITING_LOGIN;
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
} else { } else {
@ -381,36 +381,36 @@ void CDMRNetwork::clock(unsigned int ms)
} }
} else if (::memcmp(m_buffer, "RPTACK", 6U) == 0) { } else if (::memcmp(m_buffer, "RPTACK", 6U) == 0) {
switch (m_status) { switch (m_status) {
case WAITING_LOGIN: case STATUS::WAITING_LOGIN:
LogDebug("%s, Sending authorisation", m_name.c_str()); LogDebug("%s, Sending authorisation", m_name.c_str());
::memcpy(m_salt, m_buffer + 6U, sizeof(uint32_t)); ::memcpy(m_salt, m_buffer + 6U, sizeof(uint32_t));
writeAuthorisation(); writeAuthorisation();
m_status = WAITING_AUTHORISATION; m_status = STATUS::WAITING_AUTHORISATION;
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
break; break;
case WAITING_AUTHORISATION: case STATUS::WAITING_AUTHORISATION:
LogDebug("%s, Sending configuration", m_name.c_str()); LogDebug("%s, Sending configuration", m_name.c_str());
writeConfig(); writeConfig();
m_status = WAITING_CONFIG; m_status = STATUS::WAITING_CONFIG;
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
break; break;
case WAITING_CONFIG: case STATUS::WAITING_CONFIG:
if (m_options.empty()) { if (m_options.empty()) {
LogMessage("%s, Logged into the master successfully", m_name.c_str()); LogMessage("%s, Logged into the master successfully", m_name.c_str());
m_status = RUNNING; m_status = STATUS::RUNNING;
} else { } else {
LogDebug("%s, Sending options", m_name.c_str()); LogDebug("%s, Sending options", m_name.c_str());
writeOptions(); writeOptions();
m_status = WAITING_OPTIONS; m_status = STATUS::WAITING_OPTIONS;
} }
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
break; break;
case WAITING_OPTIONS: case STATUS::WAITING_OPTIONS:
LogMessage("%s, Logged into the master successfully", m_name.c_str()); LogMessage("%s, Logged into the master successfully", m_name.c_str());
m_status = RUNNING; m_status = STATUS::RUNNING;
m_timeoutTimer.start(); m_timeoutTimer.start();
m_retryTimer.start(); m_retryTimer.start();
break; break;
@ -435,19 +435,19 @@ void CDMRNetwork::clock(unsigned int ms)
m_retryTimer.clock(ms); m_retryTimer.clock(ms);
if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) { if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) {
switch (m_status) { switch (m_status) {
case WAITING_LOGIN: case STATUS::WAITING_LOGIN:
writeLogin(); writeLogin();
break; break;
case WAITING_AUTHORISATION: case STATUS::WAITING_AUTHORISATION:
writeAuthorisation(); writeAuthorisation();
break; break;
case WAITING_OPTIONS: case STATUS::WAITING_OPTIONS:
writeOptions(); writeOptions();
break; break;
case WAITING_CONFIG: case STATUS::WAITING_CONFIG:
writeConfig(); writeConfig();
break; break;
case RUNNING: case STATUS::RUNNING:
writePing(); writePing();
break; break;
default: default:
@ -542,7 +542,7 @@ bool CDMRNetwork::wantsBeacon()
bool CDMRNetwork::write(const unsigned char* data, unsigned int length) bool CDMRNetwork::write(const unsigned char* data, unsigned int length)
{ {
assert(data != NULL); assert(data != nullptr);
assert(length > 0U); assert(length > 0U);
if (m_debug) if (m_debug)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018,2020.2021 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2018,2020.2021,2025 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
@ -71,7 +71,7 @@ private:
CUDPSocket m_socket; CUDPSocket m_socket;
bool m_enabled; bool m_enabled;
enum STATUS { enum class STATUS {
WAITING_CONNECT, WAITING_CONNECT,
WAITING_LOGIN, WAITING_LOGIN,
WAITING_AUTHORISATION, WAITING_AUTHORISATION,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -35,7 +35,7 @@ CDMRSlotType::~CDMRSlotType()
void CDMRSlotType::putData(const unsigned char* data) void CDMRSlotType::putData(const unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char DMRSlotType[3U]; unsigned char DMRSlotType[3U];
DMRSlotType[0U] = (data[12U] << 2) & 0xFCU; DMRSlotType[0U] = (data[12U] << 2) & 0xFCU;
@ -55,7 +55,7 @@ void CDMRSlotType::putData(const unsigned char* data)
void CDMRSlotType::getData(unsigned char* data) const void CDMRSlotType::getData(unsigned char* data) const
{ {
assert(data != NULL); assert(data != nullptr);
unsigned char DMRSlotType[3U]; unsigned char DMRSlotType[3U];
DMRSlotType[0U] = (m_colorCode << 4) & 0xF0U; DMRSlotType[0U] = (m_colorCode << 4) & 0xF0U;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -42,13 +42,13 @@ m_id(id),
m_slot(slot), m_slot(slot),
m_lc(), m_lc(),
m_embeddedLC(), m_embeddedLC(),
m_status(DYNVS_NONE), m_status(DYNVOICE_STATUS::NONE),
m_timer(1000U, 1U), m_timer(1000U, 1U),
m_stopWatch(), m_stopWatch(),
m_seqNo(0U), m_seqNo(0U),
m_streamId(0U), m_streamId(0U),
m_sent(0U), m_sent(0U),
m_ambe(NULL), m_ambe(nullptr),
m_positions(), m_positions(),
m_data(), m_data(),
m_it() m_it()
@ -61,7 +61,7 @@ m_it()
m_ambeFile = directory + "/" + language + ".ambe"; m_ambeFile = directory + "/" + language + ".ambe";
#endif #endif
m_lc.setFLCO(FLCO_GROUP); m_lc.setFLCO(FLCO::GROUP);
m_lc.setSrcId(id); m_lc.setSrcId(id);
m_lc.setDstId(tg); m_lc.setDstId(tg);
@ -85,7 +85,7 @@ CDynVoice::~CDynVoice()
bool CDynVoice::open() bool CDynVoice::open()
{ {
FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt"); FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt");
if (fpindx == NULL) { if (fpindx == nullptr) {
LogError("Unable to open the index file - %s", m_indxFile.c_str()); LogError("Unable to open the index file - %s", m_indxFile.c_str());
return false; return false;
} }
@ -99,7 +99,7 @@ bool CDynVoice::open()
} }
FILE* fpambe = ::fopen(m_ambeFile.c_str(), "rb"); FILE* fpambe = ::fopen(m_ambeFile.c_str(), "rb");
if (fpambe == NULL) { if (fpambe == nullptr) {
LogError("Unable to open the AMBE file - %s", m_ambeFile.c_str()); LogError("Unable to open the AMBE file - %s", m_ambeFile.c_str());
::fclose(fpindx); ::fclose(fpindx);
return false; return false;
@ -110,12 +110,12 @@ bool CDynVoice::open()
size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe); size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe);
if (sizeRead != 0U) { if (sizeRead != 0U) {
char buffer[80U]; char buffer[80U];
while (::fgets(buffer, 80, fpindx) != NULL) { while (::fgets(buffer, 80, fpindx) != nullptr) {
char* p1 = ::strtok(buffer, "\t\r\n"); char* p1 = ::strtok(buffer, "\t\r\n");
char* p2 = ::strtok(NULL, "\t\r\n"); char* p2 = ::strtok(nullptr, "\t\r\n");
char* p3 = ::strtok(NULL, "\t\r\n"); char* p3 = ::strtok(nullptr, "\t\r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr) {
std::string symbol = std::string(p1); std::string symbol = std::string(p1);
unsigned int start = ::atoi(p2) * AMBE_LENGTH; unsigned int start = ::atoi(p2) * AMBE_LENGTH;
unsigned int length = ::atoi(p3) * AMBE_LENGTH; unsigned int length = ::atoi(p3) * AMBE_LENGTH;
@ -170,7 +170,7 @@ void CDynVoice::abort()
m_data.clear(); m_data.clear();
m_timer.stop(); m_timer.stop();
m_status = DYNVS_NONE; m_status = DYNVOICE_STATUS::NONE;
} }
void CDynVoice::createVoice(const std::vector<std::string>& words) void CDynVoice::createVoice(const std::vector<std::string>& words)
@ -235,7 +235,7 @@ void CDynVoice::createVoice(const std::vector<std::string>& words)
CDMRData* data = new CDMRData; CDMRData* data = new CDMRData;
data->setSlotNo(m_slot); data->setSlotNo(m_slot);
data->setFLCO(FLCO_GROUP); data->setFLCO(FLCO::GROUP);
data->setSrcId(m_lc.getSrcId()); data->setSrcId(m_lc.getSrcId());
data->setDstId(m_lc.getDstId()); data->setDstId(m_lc.getDstId());
data->setN(n); data->setN(n);
@ -276,13 +276,13 @@ void CDynVoice::createVoice(const std::vector<std::string>& words)
delete[] ambeData; delete[] ambeData;
m_status = DYNVS_WAITING; m_status = DYNVOICE_STATUS::WAITING;
m_timer.start(); m_timer.start();
} }
bool CDynVoice::read(CDMRData& data) bool CDynVoice::read(CDMRData& data)
{ {
if (m_status != DYNVS_SENDING) if (m_status != DYNVOICE_STATUS::SENDING)
return false; return false;
unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME; unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME;
@ -298,7 +298,7 @@ bool CDynVoice::read(CDMRData& data)
delete *it; delete *it;
m_data.clear(); m_data.clear();
m_timer.stop(); m_timer.stop();
m_status = DYNVS_NONE; m_status = DYNVOICE_STATUS::NONE;
} }
return true; return true;
@ -311,9 +311,9 @@ void CDynVoice::clock(unsigned int ms)
{ {
m_timer.clock(ms); m_timer.clock(ms);
if (m_timer.isRunning() && m_timer.hasExpired()) { if (m_timer.isRunning() && m_timer.hasExpired()) {
if (m_status == DYNVS_WAITING) { if (m_status == DYNVOICE_STATUS::WAITING) {
m_stopWatch.start(); m_stopWatch.start();
m_status = DYNVS_SENDING; m_status = DYNVOICE_STATUS::SENDING;
m_it = m_data.begin(); m_it = m_data.begin();
m_sent = 0U; m_sent = 0U;
} }
@ -325,7 +325,7 @@ void CDynVoice::createHeaderTerminator(unsigned char type)
CDMRData* data = new CDMRData; CDMRData* data = new CDMRData;
data->setSlotNo(m_slot); data->setSlotNo(m_slot);
data->setFLCO(FLCO_GROUP); data->setFLCO(FLCO::GROUP);
data->setSrcId(m_lc.getSrcId()); data->setSrcId(m_lc.getSrcId());
data->setDstId(m_lc.getDstId()); data->setDstId(m_lc.getDstId());
data->setDataType(type); data->setDataType(type);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -29,10 +29,10 @@
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
enum DYNVOICE_STATUS { enum class DYNVOICE_STATUS {
DYNVS_NONE, NONE,
DYNVS_WAITING, WAITING,
DYNVS_SENDING SENDING
}; };
struct CDynPositions { struct CDynPositions {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2018,2020,2025 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
@ -31,7 +31,7 @@ m_gpsdPort(port),
m_gpsdData(), m_gpsdData(),
m_idTimer(1000U, 60U), m_idTimer(1000U, 60U),
m_networks(), m_networks(),
m_aprs(NULL) m_aprs(nullptr)
{ {
assert(!address.empty()); assert(!address.empty());
assert(!port.empty()); assert(!port.empty());
@ -43,14 +43,14 @@ CGPSD::~CGPSD()
void CGPSD::addNetwork(CDMRNetwork* network) void CGPSD::addNetwork(CDMRNetwork* network)
{ {
assert(network != NULL); assert(network != nullptr);
m_networks.push_back(network); m_networks.push_back(network);
} }
void CGPSD::setAPRS(CAPRSWriter* aprs) void CGPSD::setAPRS(CAPRSWriter* aprs)
{ {
assert(aprs != NULL); assert(aprs != nullptr);
m_aprs = aprs; m_aprs = aprs;
} }
@ -63,7 +63,7 @@ bool CGPSD::open()
return false; return false;
} }
::gps_stream(&m_gpsdData, WATCH_ENABLE | WATCH_JSON, NULL); ::gps_stream(&m_gpsdData, WATCH_ENABLE | WATCH_JSON, nullptr);
LogMessage("Connected to GPSD"); LogMessage("Connected to GPSD");
@ -84,7 +84,7 @@ void CGPSD::clock(unsigned int ms)
void CGPSD::close() void CGPSD::close()
{ {
::gps_stream(&m_gpsdData, WATCH_DISABLE, NULL); ::gps_stream(&m_gpsdData, WATCH_DISABLE, nullptr);
::gps_close(&m_gpsdData); ::gps_close(&m_gpsdData);
} }
@ -94,7 +94,7 @@ void CGPSD::sendReport()
return; return;
#if GPSD_API_MAJOR_VERSION >= 7 #if GPSD_API_MAJOR_VERSION >= 7
if (::gps_read(&m_gpsdData, NULL, 0) <= 0) if (::gps_read(&m_gpsdData, nullptr, 0) <= 0)
return; return;
#else #else
if (::gps_read(&m_gpsdData) <= 0) if (::gps_read(&m_gpsdData) <= 0)
@ -122,7 +122,7 @@ void CGPSD::sendReport()
float altitude = float(m_gpsdData.fix.altitude); float altitude = float(m_gpsdData.fix.altitude);
#endif #endif
if (m_aprs != NULL) if (m_aprs != nullptr)
m_aprs->setLocation(latitude, longitude, altitudeSet ? altitude : 0.0F); m_aprs->setLocation(latitude, longitude, altitudeSet ? altitude : 0.0F);
for (std::vector<CDMRNetwork*>::const_iterator it = m_networks.begin(); it != m_networks.end(); ++it) for (std::vector<CDMRNetwork*>::const_iterator it = m_networks.begin(); it != m_networks.end(); ++it)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -237,7 +237,7 @@ unsigned int CGolay2087::getSyndrome1987(unsigned int pattern)
unsigned char CGolay2087::decode(const unsigned char* data) unsigned char CGolay2087::decode(const unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned int code = (data[0U] << 11) + (data[1U] << 3) + (data[2U] >> 5); unsigned int code = (data[0U] << 11) + (data[1U] << 3) + (data[2U] >> 5);
unsigned int syndrome = getSyndrome1987(code); unsigned int syndrome = getSyndrome1987(code);
@ -251,7 +251,7 @@ unsigned char CGolay2087::decode(const unsigned char* data)
void CGolay2087::encode(unsigned char* data) void CGolay2087::encode(unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned int value = data[0U]; unsigned int value = data[0U];

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -24,7 +24,7 @@
// Hamming (15,11,3) check a boolean data array // Hamming (15,11,3) check a boolean data array
bool CHamming::decode15113_1(bool* d) bool CHamming::decode15113_1(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the parity it should have // Calculate the parity it should have
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[5] ^ d[6]; bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[5] ^ d[6];
@ -66,7 +66,7 @@ bool CHamming::decode15113_1(bool* d)
void CHamming::encode15113_1(bool* d) void CHamming::encode15113_1(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this row should have // Calculate the checksum this row should have
d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[5] ^ d[6]; d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[5] ^ d[6];
@ -78,7 +78,7 @@ void CHamming::encode15113_1(bool* d)
// Hamming (15,11,3) check a boolean data array // Hamming (15,11,3) check a boolean data array
bool CHamming::decode15113_2(bool* d) bool CHamming::decode15113_2(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this row should have // Calculate the checksum this row should have
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8]; bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8];
@ -119,7 +119,7 @@ bool CHamming::decode15113_2(bool* d)
void CHamming::encode15113_2(bool* d) void CHamming::encode15113_2(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this row should have // Calculate the checksum this row should have
d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8]; d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8];
@ -131,7 +131,7 @@ void CHamming::encode15113_2(bool* d)
// Hamming (13,9,3) check a boolean data array // Hamming (13,9,3) check a boolean data array
bool CHamming::decode1393(bool* d) bool CHamming::decode1393(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
bool c0 = d[0] ^ d[1] ^ d[3] ^ d[5] ^ d[6]; bool c0 = d[0] ^ d[1] ^ d[3] ^ d[5] ^ d[6];
@ -170,7 +170,7 @@ bool CHamming::decode1393(bool* d)
void CHamming::encode1393(bool* d) void CHamming::encode1393(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
d[9] = d[0] ^ d[1] ^ d[3] ^ d[5] ^ d[6]; d[9] = d[0] ^ d[1] ^ d[3] ^ d[5] ^ d[6];
@ -182,7 +182,7 @@ void CHamming::encode1393(bool* d)
// Hamming (10,6,3) check a boolean data array // Hamming (10,6,3) check a boolean data array
bool CHamming::decode1063(bool* d) bool CHamming::decode1063(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[5]; bool c0 = d[0] ^ d[1] ^ d[2] ^ d[5];
@ -218,7 +218,7 @@ bool CHamming::decode1063(bool* d)
void CHamming::encode1063(bool* d) void CHamming::encode1063(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
d[6] = d[0] ^ d[1] ^ d[2] ^ d[5]; d[6] = d[0] ^ d[1] ^ d[2] ^ d[5];
@ -230,7 +230,7 @@ void CHamming::encode1063(bool* d)
// A Hamming (16,11,4) Check // A Hamming (16,11,4) Check
bool CHamming::decode16114(bool* d) bool CHamming::decode16114(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8]; bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8];
@ -278,7 +278,7 @@ bool CHamming::decode16114(bool* d)
void CHamming::encode16114(bool* d) void CHamming::encode16114(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8]; d[11] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[5] ^ d[7] ^ d[8];
d[12] = d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[6] ^ d[8] ^ d[9]; d[12] = d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[6] ^ d[8] ^ d[9];
@ -290,7 +290,7 @@ void CHamming::encode16114(bool* d)
// A Hamming (17,12,3) Check // A Hamming (17,12,3) Check
bool CHamming::decode17123(bool* d) bool CHamming::decode17123(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
// Calculate the checksum this column should have // Calculate the checksum this column should have
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[6] ^ d[7] ^ d[9]; bool c0 = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[6] ^ d[7] ^ d[9];
@ -339,7 +339,7 @@ bool CHamming::decode17123(bool* d)
void CHamming::encode17123(bool* d) void CHamming::encode17123(bool* d)
{ {
assert(d != NULL); assert(d != nullptr);
d[12] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[6] ^ d[7] ^ d[9]; d[12] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[6] ^ d[7] ^ d[9];
d[13] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[7] ^ d[8] ^ d[10]; d[13] = d[0] ^ d[1] ^ d[2] ^ d[3] ^ d[4] ^ d[7] ^ d[8] ^ d[10];

22
Log.cpp
View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2020,2025 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
@ -37,7 +37,7 @@ static std::string m_filePath;
static std::string m_fileRoot; static std::string m_fileRoot;
static bool m_fileRotate = true; static bool m_fileRotate = true;
static FILE* m_fpLog = NULL; static FILE* m_fpLog = nullptr;
static bool m_daemon = false; static bool m_daemon = false;
static unsigned int m_displayLevel = 2U; static unsigned int m_displayLevel = 2U;
@ -59,10 +59,10 @@ static bool logOpenRotate()
struct tm* tm = ::gmtime(&now); struct tm* tm = ::gmtime(&now);
if (tm->tm_mday == m_tm.tm_mday && tm->tm_mon == m_tm.tm_mon && tm->tm_year == m_tm.tm_year) { if (tm->tm_mday == m_tm.tm_mday && tm->tm_mon == m_tm.tm_mon && tm->tm_year == m_tm.tm_year) {
if (m_fpLog != NULL) if (m_fpLog != nullptr)
return true; return true;
} else { } else {
if (m_fpLog != NULL) if (m_fpLog != nullptr)
::fclose(m_fpLog); ::fclose(m_fpLog);
} }
@ -73,7 +73,7 @@ static bool logOpenRotate()
::sprintf(filename, "%s/%s-%04d-%02d-%02d.log", m_filePath.c_str(), m_fileRoot.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday); ::sprintf(filename, "%s/%s-%04d-%02d-%02d.log", m_filePath.c_str(), m_fileRoot.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
#endif #endif
if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) { if ((m_fpLog = ::fopen(filename, "a+t")) != nullptr) {
status = true; status = true;
#if !defined(_WIN32) && !defined(_WIN64) #if !defined(_WIN32) && !defined(_WIN64)
@ -94,7 +94,7 @@ static bool logOpenNoRotate()
if (m_fileLevel == 0U) if (m_fileLevel == 0U)
return true; return true;
if (m_fpLog != NULL) if (m_fpLog != nullptr)
return true; return true;
char filename[200U]; char filename[200U];
@ -104,7 +104,7 @@ static bool logOpenNoRotate()
::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str()); ::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str());
#endif #endif
if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) { if ((m_fpLog = ::fopen(filename, "a+t")) != nullptr) {
status = true; status = true;
#if !defined(_WIN32) && !defined(_WIN64) #if !defined(_WIN32) && !defined(_WIN64)
@ -141,13 +141,13 @@ bool LogInitialise(bool daemon, const std::string& filePath, const std::string&
void LogFinalise() void LogFinalise()
{ {
if (m_fpLog != NULL) if (m_fpLog != nullptr)
::fclose(m_fpLog); ::fclose(m_fpLog);
} }
void Log(unsigned int level, const char* fmt, ...) void Log(unsigned int level, const char* fmt, ...)
{ {
assert(fmt != NULL); assert(fmt != nullptr);
char buffer[501U]; char buffer[501U];
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
@ -157,7 +157,7 @@ void Log(unsigned int level, const char* fmt, ...)
::sprintf(buffer, "%c: %04u-%02u-%02u %02u:%02u:%02u.%03u ", LEVELS[level], st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds); ::sprintf(buffer, "%c: %04u-%02u-%02u %02u:%02u:%02u.%03u ", LEVELS[level], st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
#else #else
struct timeval now; struct timeval now;
::gettimeofday(&now, NULL); ::gettimeofday(&now, nullptr);
struct tm* tm = ::gmtime(&now.tv_sec); struct tm* tm = ::gmtime(&now.tv_sec);
@ -167,7 +167,7 @@ void Log(unsigned int level, const char* fmt, ...)
va_list vl; va_list vl;
va_start(vl, fmt); va_start(vl, fmt);
::vsnprintf(buffer + ::strlen(buffer), 500, fmt, vl); ::vsnprintf(buffer + ::strlen(buffer), 500 - ::strlen(buffer), fmt, vl);
va_end(vl); va_end(vl);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017,2018,2020 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2018,2020,2025 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
@ -34,16 +34,16 @@ CMMDVMNetwork::CMMDVMNetwork(const std::string& rptAddress, unsigned short rptPo
m_rptAddr(), m_rptAddr(),
m_rptAddrLen(0U), m_rptAddrLen(0U),
m_id(0U), m_id(0U),
m_netId(NULL), m_netId(nullptr),
m_debug(debug), m_debug(debug),
m_socket(localAddress, localPort), m_socket(localAddress, localPort),
m_buffer(NULL), m_buffer(nullptr),
m_rxData(1000U, "MMDVM Network"), m_rxData(1000U, "MMDVM Network"),
m_configData(NULL), m_configData(nullptr),
m_configLen(0U), m_configLen(0U),
m_radioPositionData(NULL), m_radioPositionData(nullptr),
m_radioPositionLen(0U), m_radioPositionLen(0U),
m_talkerAliasData(NULL), m_talkerAliasData(nullptr),
m_talkerAliasLen(0U) m_talkerAliasLen(0U)
{ {
assert(!rptAddress.empty()); assert(!rptAddress.empty());
@ -120,7 +120,7 @@ bool CMMDVMNetwork::read(CDMRData& data)
unsigned int slotNo = (m_buffer[15U] & 0x80U) == 0x80U ? 2U : 1U; unsigned int slotNo = (m_buffer[15U] & 0x80U) == 0x80U ? 2U : 1U;
FLCO flco = (m_buffer[15U] & 0x40U) == 0x40U ? FLCO_USER_USER : FLCO_GROUP; FLCO flco = (m_buffer[15U] & 0x40U) == 0x40U ? FLCO::USER_USER : FLCO::GROUP;
unsigned int streamId; unsigned int streamId;
::memcpy(&streamId, m_buffer + 16U, 4U); ::memcpy(&streamId, m_buffer + 16U, 4U);
@ -187,7 +187,7 @@ bool CMMDVMNetwork::write(const CDMRData& data)
buffer[15U] = slotNo == 1U ? 0x00U : 0x80U; buffer[15U] = slotNo == 1U ? 0x00U : 0x80U;
FLCO flco = data.getFLCO(); FLCO flco = data.getFLCO();
buffer[15U] |= flco == FLCO_GROUP ? 0x00U : 0x40U; buffer[15U] |= flco == FLCO::GROUP ? 0x00U : 0x40U;
unsigned char dataType = data.getDataType(); unsigned char dataType = data.getDataType();
if (dataType == DT_VOICE_SYNC) { if (dataType == DT_VOICE_SYNC) {
@ -284,7 +284,7 @@ void CMMDVMNetwork::clock(unsigned int ms)
} else if (::memcmp(m_buffer, "DMRC", 4U) == 0) { } else if (::memcmp(m_buffer, "DMRC", 4U) == 0) {
m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0); m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0);
if (m_configData == NULL) { if (m_configData == nullptr) {
m_configLen = length - 8U; m_configLen = length - 8U;
m_configData = new unsigned char[m_configLen]; m_configData = new unsigned char[m_configLen];
::memcpy(m_configData, m_buffer + 8U, m_configLen); ::memcpy(m_configData, m_buffer + 8U, m_configLen);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -41,10 +41,10 @@ PROCESS_RESULT CPassAllPC::process(CDMRData& data, bool trace)
FLCO flco = data.getFLCO(); FLCO flco = data.getFLCO();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
bool ret = (flco == FLCO_USER_USER && slotNo == m_slot); bool ret = (flco == FLCO::USER_USER && slotNo == m_slot);
if (trace) if (trace)
LogDebug("Rule Trace,\tPassAllPC %s Slot=%u: %s", m_name.c_str(), m_slot, ret ? "matched" : "not matched"); LogDebug("Rule Trace,\tPassAllPC %s Slot=%u: %s", m_name.c_str(), m_slot, ret ? "matched" : "not matched");
return ret ? RESULT_MATCHED : RESULT_UNMATCHED; return ret ? PROCESS_RESULT::MATCHED : PROCESS_RESULT::UNMATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -41,10 +41,10 @@ PROCESS_RESULT CPassAllTG::process(CDMRData& data, bool trace)
FLCO flco = data.getFLCO(); FLCO flco = data.getFLCO();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
bool ret = (flco == FLCO_GROUP && slotNo == m_slot); bool ret = (flco == FLCO::GROUP && slotNo == m_slot);
if (trace) if (trace)
LogDebug("Rule Trace,\tPassAllTG %s Slot=%u: %s", m_name.c_str(), m_slot, ret ? "matched" : "not matched"); LogDebug("Rule Trace,\tPassAllTG %s Slot=%u: %s", m_name.c_str(), m_slot, ret ? "matched" : "not matched");
return ret ? RESULT_MATCHED : RESULT_UNMATCHED; return ret ? PROCESS_RESULT::MATCHED : PROCESS_RESULT::UNMATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2025 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
@ -92,7 +92,7 @@ unsigned int CQR1676::getSyndrome1576(unsigned int pattern)
// Compute the EMB against a precomputed list of correct words // Compute the EMB against a precomputed list of correct words
void CQR1676::encode(unsigned char* data) void CQR1676::encode(unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned int value = (data[0U] >> 1) & 0x7FU; unsigned int value = (data[0U] >> 1) & 0x7FU;
unsigned int cksum = ENCODING_TABLE_1676[value]; unsigned int cksum = ENCODING_TABLE_1676[value];
@ -103,7 +103,7 @@ void CQR1676::encode(unsigned char* data)
unsigned char CQR1676::decode(const unsigned char* data) unsigned char CQR1676::decode(const unsigned char* data)
{ {
assert(data != NULL); assert(data != nullptr);
unsigned int code = (data[0U] << 7) + (data[1U] >> 1); unsigned int code = (data[0U] << 7) + (data[1U] >> 1);
unsigned int syndrome = getSyndrome1576(code); unsigned int syndrome = getSyndrome1576(code);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 by Jonathan Naylor G4KLX * Copyright (C) 2015,2025 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
@ -101,8 +101,8 @@ static unsigned char gmult(unsigned char a, unsigned char b)
*/ */
void CRS129::encode(const unsigned char* msg, unsigned int nbytes, unsigned char* parity) void CRS129::encode(const unsigned char* msg, unsigned int nbytes, unsigned char* parity)
{ {
assert(msg != NULL); assert(msg != nullptr);
assert(parity != NULL); assert(parity != nullptr);
for (unsigned int i = 0U; i < NPAR + 1U; i++) for (unsigned int i = 0U; i < NPAR + 1U; i++)
parity[i] = 0x00U; parity[i] = 0x00U;
@ -120,7 +120,7 @@ void CRS129::encode(const unsigned char* msg, unsigned int nbytes, unsigned char
// Reed-Solomon (12,9) check // Reed-Solomon (12,9) check
bool CRS129::check(const unsigned char* in) bool CRS129::check(const unsigned char* in)
{ {
assert(in != NULL); assert(in != nullptr);
unsigned char parity[4U]; unsigned char parity[4U];
encode(in, 9U, parity); encode(in, 9U, parity);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2016,2017,2025 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
@ -51,17 +51,17 @@ bool CReflectors::load()
m_reflectors.clear(); m_reflectors.clear();
FILE* fp = ::fopen(m_hostsFile.c_str(), "rt"); FILE* fp = ::fopen(m_hostsFile.c_str(), "rt");
if (fp != NULL) { if (fp != nullptr) {
char buffer[100U]; char buffer[100U];
while (::fgets(buffer, 100U, fp) != NULL) { while (::fgets(buffer, 100U, fp) != nullptr) {
if (buffer[0U] == '#') if (buffer[0U] == '#')
continue; continue;
char* p1 = ::strtok(buffer, ";\r\n"); char* p1 = ::strtok(buffer, ";\r\n");
char* p2 = ::strtok(NULL, ";\r\n"); char* p2 = ::strtok(nullptr, ";\r\n");
char* p3 = ::strtok(NULL, "\r\n"); char* p3 = ::strtok(nullptr, "\r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr) {
CReflector* refl = new CReflector; CReflector* refl = new CReflector;
refl->m_id = std::string(p1); refl->m_id = std::string(p1);
refl->m_address = std::string(p2); refl->m_address = std::string(p2);
@ -92,7 +92,7 @@ CReflector* CReflectors::find(const std::string &id)
LogMessage("Trying to find non existent XLX reflector with an id of %s", id.c_str()); LogMessage("Trying to find non existent XLX reflector with an id of %s", id.c_str());
return NULL; return nullptr;
} }
void CReflectors::clock(unsigned int ms) void CReflectors::clock(unsigned int ms)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019,2021 by Jonathan Naylor G4KLX * Copyright (C) 2019,2021,2025 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
@ -33,7 +33,7 @@ const unsigned int BUFFER_LENGTH = 100U;
CRemoteControl::CRemoteControl(CDMRGateway* host, const std::string address, unsigned short port) : CRemoteControl::CRemoteControl(CDMRGateway* host, const std::string address, unsigned short port) :
m_host(host), m_host(host),
m_socket(address, port), m_socket(address, port),
m_command(RCD_NONE), m_command(REMOTE_COMMAND::NONE),
m_args() m_args()
{ {
assert(port > 0U); assert(port > 0U);
@ -50,7 +50,7 @@ bool CRemoteControl::open()
REMOTE_COMMAND CRemoteControl::getCommand() REMOTE_COMMAND CRemoteControl::getCommand()
{ {
m_command = RCD_NONE; m_command = REMOTE_COMMAND::NONE;
m_args.clear(); m_args.clear();
char command[BUFFER_LENGTH]; char command[BUFFER_LENGTH];
@ -67,65 +67,63 @@ REMOTE_COMMAND CRemoteControl::getCommand()
// Parse the original command into a vector of strings. // Parse the original command into a vector of strings.
char* b = buffer; char* b = buffer;
char* p = NULL; char* p = nullptr;
while ((p = ::strtok(b, " ")) != NULL) { while ((p = ::strtok(b, " ")) != nullptr) {
b = NULL; b = nullptr;
m_args.push_back(std::string(p)); m_args.push_back(std::string(p));
} }
if (m_args.at(0U) == "enable" && m_args.size() >= ENABLE_ARGS) { if (m_args.at(0U) == "enable" && m_args.size() >= ENABLE_ARGS) {
if (m_args.at(1U) == "net1") if (m_args.at(1U) == "net1")
m_command = RCD_ENABLE_NETWORK1; m_command = REMOTE_COMMAND::ENABLE_NETWORK1;
else if (m_args.at(1U) == "net2") else if (m_args.at(1U) == "net2")
m_command = RCD_ENABLE_NETWORK2; m_command = REMOTE_COMMAND::ENABLE_NETWORK2;
else if (m_args.at(1U) == "net3") else if (m_args.at(1U) == "net3")
m_command = RCD_ENABLE_NETWORK3; m_command = REMOTE_COMMAND::ENABLE_NETWORK3;
else if (m_args.at(1U) == "net4") else if (m_args.at(1U) == "net4")
m_command = RCD_ENABLE_NETWORK4; m_command = REMOTE_COMMAND::ENABLE_NETWORK4;
else if (m_args.at(1U) == "net5") else if (m_args.at(1U) == "net5")
m_command = RCD_ENABLE_NETWORK5; m_command = REMOTE_COMMAND::ENABLE_NETWORK5;
else if (m_args.at(1U) == "xlx") else if (m_args.at(1U) == "xlx")
m_command = RCD_ENABLE_XLX; m_command = REMOTE_COMMAND::ENABLE_XLX;
else else
replyStr = "KO"; replyStr = "KO";
} else if (m_args.at(0U) == "disable" && m_args.size() >= DISABLE_ARGS) { } else if (m_args.at(0U) == "disable" && m_args.size() >= DISABLE_ARGS) {
if (m_args.at(1U) == "net1") if (m_args.at(1U) == "net1")
m_command = RCD_DISABLE_NETWORK1; m_command = REMOTE_COMMAND::DISABLE_NETWORK1;
else if (m_args.at(1U) == "net2") else if (m_args.at(1U) == "net2")
m_command = RCD_DISABLE_NETWORK2; m_command = REMOTE_COMMAND::DISABLE_NETWORK2;
else if (m_args.at(1U) == "net3") else if (m_args.at(1U) == "net3")
m_command = RCD_DISABLE_NETWORK3; m_command = REMOTE_COMMAND::DISABLE_NETWORK3;
else if (m_args.at(1U) == "net4") else if (m_args.at(1U) == "net4")
m_command = RCD_DISABLE_NETWORK4; m_command = REMOTE_COMMAND::DISABLE_NETWORK4;
else if (m_args.at(1U) == "net5") else if (m_args.at(1U) == "net5")
m_command = RCD_DISABLE_NETWORK5; m_command = REMOTE_COMMAND::DISABLE_NETWORK5;
else if (m_args.at(1U) == "xlx") else if (m_args.at(1U) == "xlx")
m_command = RCD_DISABLE_XLX; m_command = REMOTE_COMMAND::DISABLE_XLX;
else else
replyStr = "KO"; replyStr = "KO";
} else if (m_args.at(0U) == "status") { } else if (m_args.at(0U) == "status") {
if (m_host != NULL) { if (m_host != nullptr) {
m_host->buildNetworkStatusString(replyStr); m_host->buildNetworkStatusString(replyStr);
}
else {
replyStr = "KO";
}
m_command = RCD_CONNECTION_STATUS;
} else if (m_args.at(0U) == "hosts") {
if (m_host != NULL) {
m_host->buildNetworkHostsString(replyStr);
}
else {
replyStr = "KO";
}
m_command = RCD_CONFIG_HOSTS;
} else { } else {
replyStr = "KO"; replyStr = "KO";
} }
::snprintf(buffer, BUFFER_LENGTH * 2, "%s remote command of \"%s\" received", ((m_command == RCD_NONE) ? "Invalid" : "Valid"), command); m_command = REMOTE_COMMAND::CONNECTION_STATUS;
if (m_command == RCD_NONE) { } else if (m_args.at(0U) == "hosts") {
if (m_host != nullptr) {
m_host->buildNetworkHostsString(replyStr);
} else {
replyStr = "KO";
}
m_command = REMOTE_COMMAND::CONFIG_HOSTS;
} else {
replyStr = "KO";
}
::snprintf(buffer, BUFFER_LENGTH * 2, "%s remote command of \"%s\" received", ((m_command == REMOTE_COMMAND::NONE) ? "Invalid" : "Valid"), command);
if (m_command == REMOTE_COMMAND::NONE) {
m_args.clear(); m_args.clear();
LogWarning(buffer); LogWarning(buffer);
} else { } else {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2019,2021 by Jonathan Naylor G4KLX * Copyright (C) 2019,2021,2025 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
@ -24,22 +24,22 @@
#include <vector> #include <vector>
#include <string> #include <string>
enum REMOTE_COMMAND { enum class REMOTE_COMMAND {
RCD_ENABLE_NETWORK1, ENABLE_NETWORK1,
RCD_ENABLE_NETWORK2, ENABLE_NETWORK2,
RCD_ENABLE_NETWORK3, ENABLE_NETWORK3,
RCD_ENABLE_NETWORK4, ENABLE_NETWORK4,
RCD_ENABLE_NETWORK5, ENABLE_NETWORK5,
RCD_ENABLE_XLX, ENABLE_XLX,
RCD_DISABLE_NETWORK1, DISABLE_NETWORK1,
RCD_DISABLE_NETWORK2, DISABLE_NETWORK2,
RCD_DISABLE_NETWORK3, DISABLE_NETWORK3,
RCD_DISABLE_NETWORK4, DISABLE_NETWORK4,
RCD_DISABLE_NETWORK5, DISABLE_NETWORK5,
RCD_DISABLE_XLX, DISABLE_XLX,
RCD_CONNECTION_STATUS, CONNECTION_STATUS,
RCD_CONFIG_HOSTS, CONFIG_HOSTS,
RCD_NONE NONE
}; };
class CDMRGateway; class CDMRGateway;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 by Jonathan Naylor G4KLX * Copyright (C) 2017,2025 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
@ -27,7 +27,7 @@
CRewrite::CRewrite() : CRewrite::CRewrite() :
m_lc(), m_lc(),
m_embeddedLC(), m_embeddedLC(),
m_data(NULL), m_data(nullptr),
m_writeNum(0U), m_writeNum(0U),
m_readNum(0U), m_readNum(0U),
m_lastN(0U) m_lastN(0U)
@ -113,7 +113,7 @@ void CRewrite::processEmbeddedData(unsigned char* data, unsigned char n)
FLCO flco = m_data[m_readNum].getFLCO(); FLCO flco = m_data[m_readNum].getFLCO();
// Replace any identity embedded data with the new one // Replace any identity embedded data with the new one
if (flco == FLCO_GROUP || flco == FLCO_USER_USER) if (flco == FLCO::GROUP || flco == FLCO::USER_USER)
lcss = m_embeddedLC.getData(data, n); lcss = m_embeddedLC.getData(data, n);
else else
lcss = m_data[m_readNum].getData(data, n); lcss = m_data[m_readNum].getData(data, n);
@ -196,7 +196,7 @@ void CRewrite::processDataHeader(CDMRData& data)
if (!ret) if (!ret)
return; return;
dataHeader.setGI(data.getFLCO() == FLCO_GROUP); dataHeader.setGI(data.getFLCO() == FLCO::GROUP);
dataHeader.setSrcId(data.getSrcId()); dataHeader.setSrcId(data.getSrcId());
dataHeader.setDstId(data.getDstId()); dataHeader.setDstId(data.getDstId());
@ -220,7 +220,7 @@ void CRewrite::processCSBK(CDMRData& data)
if (!ret) if (!ret)
return; return;
csbk.setGI(data.getFLCO() == FLCO_GROUP); csbk.setGI(data.getFLCO() == FLCO::GROUP);
csbk.setSrcId(data.getSrcId()); csbk.setSrcId(data.getSrcId());
csbk.setDstId(data.getDstId()); csbk.setDstId(data.getDstId());

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -23,10 +23,10 @@
#include "DMRData.h" #include "DMRData.h"
#include "DMRLC.h" #include "DMRLC.h"
enum PROCESS_RESULT { enum class PROCESS_RESULT {
RESULT_UNMATCHED, UNMATCHED,
RESULT_MATCHED, MATCHED,
RESULT_IGNORED IGNORED
}; };
class CRewrite { class CRewrite {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -40,11 +40,11 @@ PROCESS_RESULT CRewriteDstId::process(CDMRData& data, bool trace)
FLCO flco = data.getFLCO(); FLCO flco = data.getFLCO();
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
if (flco != FLCO_USER_USER || dstId != m_fromId) { if (flco != FLCO::USER_USER || dstId != m_fromId) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDstId from %s Src=%u: not matched", m_name.c_str(), m_fromId); LogDebug("Rule Trace,\tRewriteDstId from %s Src=%u: not matched", m_name.c_str(), m_fromId);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
data.setDstId(m_toId); data.setDstId(m_toId);
@ -56,5 +56,5 @@ PROCESS_RESULT CRewriteDstId::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteDstId to %s Src=%u", m_name.c_str(), m_toId); LogDebug("Rule Trace,\tRewriteDstId to %s Src=%u", m_name.c_str(), m_toId);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -44,11 +44,11 @@ PROCESS_RESULT CRewriteDynTGNet::process(CDMRData& data, bool trace)
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_GROUP || slotNo != m_slot || dstId != m_currentTG) { if (flco != FLCO::GROUP || slotNo != m_slot || dstId != m_currentTG) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDynTGNet from %s Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_slot, m_currentTG); LogDebug("Rule Trace,\tRewriteDynTGNet from %s Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_slot, m_currentTG);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
data.setDstId(m_toTG); data.setDstId(m_toTG);
@ -58,7 +58,7 @@ PROCESS_RESULT CRewriteDynTGNet::process(CDMRData& data, bool trace)
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDynTGNet from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_currentTG); LogDebug("Rule Trace,\tRewriteDynTGNet from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_currentTG);
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }
void CRewriteDynTGNet::setCurrentTG(unsigned int currentTG) void CRewriteDynTGNet::setCurrentTG(unsigned int currentTG)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -40,7 +40,7 @@ m_voice(voice),
m_currentTG(0U) m_currentTG(0U)
{ {
assert(slot == 1U || slot == 2U); assert(slot == 1U || slot == 2U);
assert(rewriteNet != NULL); assert(rewriteNet != nullptr);
} }
CRewriteDynTGRF::~CRewriteDynTGRF() CRewriteDynTGRF::~CRewriteDynTGRF()
@ -54,7 +54,7 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
unsigned char type = data.getDataType(); unsigned char type = data.getDataType();
if (flco == FLCO_GROUP && slotNo == m_slot && dstId == m_toTG) { if (flco == FLCO::GROUP && slotNo == m_slot && dstId == m_toTG) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_toTG); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=TG%u: matched", m_name.c_str(), m_slot, m_toTG);
@ -63,9 +63,9 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
processMessage(data); processMessage(data);
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} else { } else {
return RESULT_IGNORED; return PROCESS_RESULT::IGNORED;
} }
} }
@ -74,20 +74,20 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: matched", m_name.c_str(), m_slot, m_discPC); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: matched", m_name.c_str(), m_slot, m_discPC);
if (m_currentTG != 0U) { if (m_currentTG != 0U) {
data.setFLCO(FLCO_GROUP); data.setFLCO(FLCO::GROUP);
processMessage(data); processMessage(data);
if (type == DT_TERMINATOR_WITH_LC) { if (type == DT_TERMINATOR_WITH_LC) {
m_rewriteNet->setCurrentTG(0U); m_rewriteNet->setCurrentTG(0U);
m_currentTG = 0U; m_currentTG = 0U;
if (m_voice != NULL) if (m_voice != nullptr)
m_voice->unlinked(); m_voice->unlinked();
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} else { } else {
return RESULT_IGNORED; return PROCESS_RESULT::IGNORED;
} }
} }
@ -95,21 +95,21 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: matched", m_name.c_str(), m_slot, m_statusPC); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: matched", m_name.c_str(), m_slot, m_statusPC);
if (type == DT_TERMINATOR_WITH_LC && m_voice != NULL) { if (type == DT_TERMINATOR_WITH_LC && m_voice != nullptr) {
if (m_currentTG == 0U) if (m_currentTG == 0U)
m_voice->unlinked(); m_voice->unlinked();
else else
m_voice->linkedTo(m_currentTG); m_voice->linkedTo(m_currentTG);
} }
return RESULT_IGNORED; return PROCESS_RESULT::IGNORED;
} }
if (slotNo == m_slot && std::find(m_exclTGs.cbegin(), m_exclTGs.cend(), dstId) != m_exclTGs.cend()) { if (slotNo == m_slot && std::find(m_exclTGs.cbegin(), m_exclTGs.cend(), dstId) != m_exclTGs.cend()) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: not matched", m_name.c_str(), m_slot, dstId); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u: not matched", m_name.c_str(), m_slot, dstId);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
if (slotNo == m_slot && dstId >= m_fromTGStart && dstId <= m_fromTGEnd) { if (slotNo == m_slot && dstId >= m_fromTGStart && dstId <= m_fromTGEnd) {
@ -120,18 +120,18 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u-%u: matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u-%u: matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd);
} }
data.setFLCO(FLCO_GROUP); data.setFLCO(FLCO::GROUP);
processMessage(data); processMessage(data);
if (type == DT_TERMINATOR_WITH_LC) { if (type == DT_TERMINATOR_WITH_LC) {
m_rewriteNet->setCurrentTG(dstId); m_rewriteNet->setCurrentTG(dstId);
m_currentTG = dstId; m_currentTG = dstId;
if (m_voice != NULL) if (m_voice != nullptr)
m_voice->linkedTo(dstId); m_voice->linkedTo(dstId);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }
if (trace) { if (trace) {
@ -141,7 +141,7 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u-%u or Dst=TG%u or Dst=%u or Dst=%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd, m_toTG, m_discPC, m_statusPC); LogDebug("Rule Trace,\tRewriteDynTGRF from %s Slot=%u Dst=%u-%u or Dst=TG%u or Dst=%u or Dst=%u: not matched", m_name.c_str(), m_slot, m_fromTGStart, m_fromTGEnd, m_toTG, m_discPC, m_statusPC);
} }
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg) void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
@ -150,7 +150,7 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
if (m_currentTG != 0U) { if (m_currentTG != 0U) {
m_currentTG = 0U; m_currentTG = 0U;
m_rewriteNet->setCurrentTG(0U); m_rewriteNet->setCurrentTG(0U);
if (m_voice != NULL) if (m_voice != nullptr)
m_voice->unlinked(); m_voice->unlinked();
} }
return; return;
@ -166,7 +166,7 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
if (m_currentTG != tg) { if (m_currentTG != tg) {
m_currentTG = tg; m_currentTG = tg;
m_rewriteNet->setCurrentTG(tg); m_rewriteNet->setCurrentTG(tg);
if (m_voice != NULL) if (m_voice != nullptr)
m_voice->linkedTo(tg); m_voice->linkedTo(tg);
} }
return; return;
@ -175,6 +175,6 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
void CRewriteDynTGRF::stopVoice(unsigned int slot) void CRewriteDynTGRF::stopVoice(unsigned int slot)
{ {
if (slot == m_slot && m_voice != NULL) if (slot == m_slot && m_voice != nullptr)
m_voice->abort(); m_voice->abort();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -48,11 +48,11 @@ PROCESS_RESULT CRewritePC::process(CDMRData& data, bool trace)
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_USER_USER || slotNo != m_fromSlot || dstId < m_fromIdStart || dstId > m_fromIdEnd) { if (flco != FLCO::USER_USER || slotNo != m_fromSlot || dstId < m_fromIdStart || dstId > m_fromIdEnd) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewritePC from %s Slot=%u Dst=%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromIdStart, m_fromIdEnd); LogDebug("Rule Trace,\tRewritePC from %s Slot=%u Dst=%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromIdStart, m_fromIdEnd);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
if (m_fromSlot != m_toSlot) if (m_fromSlot != m_toSlot)
@ -70,5 +70,5 @@ PROCESS_RESULT CRewritePC::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewritePC to %s Slot=%u Dst=%u-%u", m_name.c_str(), m_toSlot, m_toIdStart, m_toIdEnd); LogDebug("Rule Trace,\tRewritePC to %s Slot=%u Dst=%u-%u", m_name.c_str(), m_toSlot, m_toIdStart, m_toIdEnd);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -47,18 +47,18 @@ PROCESS_RESULT CRewriteSrc::process(CDMRData& data, bool trace)
unsigned int srcId = data.getSrcId(); unsigned int srcId = data.getSrcId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_USER_USER || slotNo != m_fromSlot || srcId < m_fromIdStart || srcId > m_fromIdEnd) { if (flco != FLCO::USER_USER || slotNo != m_fromSlot || srcId < m_fromIdStart || srcId > m_fromIdEnd) {
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteSrc from %s Slot=%u Src=%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromIdStart, m_fromIdEnd); LogDebug("Rule Trace,\tRewriteSrc from %s Slot=%u Src=%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromIdStart, m_fromIdEnd);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
if (m_fromSlot != m_toSlot) if (m_fromSlot != m_toSlot)
data.setSlotNo(m_toSlot); data.setSlotNo(m_toSlot);
data.setDstId(m_toTG); data.setDstId(m_toTG);
data.setFLCO(FLCO_GROUP); data.setFLCO(FLCO::GROUP);
processMessage(data); processMessage(data);
@ -67,5 +67,5 @@ PROCESS_RESULT CRewriteSrc::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteSrc to %s Slot=%u Dst=TG%u", m_name.c_str(), m_toSlot, m_toTG); LogDebug("Rule Trace,\tRewriteSrc to %s Slot=%u Dst=TG%u", m_name.c_str(), m_toSlot, m_toTG);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -43,7 +43,7 @@ PROCESS_RESULT CRewriteSrcId::process(CDMRData& data, bool trace)
if (trace) if (trace)
LogDebug("Rule Trace,\tRewriteSrcId from %s Src=%u: not matched", m_name.c_str(), m_fromId); LogDebug("Rule Trace,\tRewriteSrcId from %s Src=%u: not matched", m_name.c_str(), m_fromId);
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
data.setSrcId(m_toId); data.setSrcId(m_toId);
@ -55,5 +55,5 @@ PROCESS_RESULT CRewriteSrcId::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteSrcId to %s Src=%u", m_name.c_str(), m_toId); LogDebug("Rule Trace,\tRewriteSrcId to %s Src=%u", m_name.c_str(), m_toId);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -48,7 +48,7 @@ PROCESS_RESULT CRewriteTG::process(CDMRData& data, bool trace)
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_GROUP || slotNo != m_fromSlot || dstId < m_fromTGStart || dstId > m_fromTGEnd) { if (flco != FLCO::GROUP || slotNo != m_fromSlot || dstId < m_fromTGStart || dstId > m_fromTGEnd) {
if (trace) { if (trace) {
if (m_fromTGStart == m_fromTGEnd) if (m_fromTGStart == m_fromTGEnd)
LogDebug("Rule Trace,\tRewriteTG from %s Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart); LogDebug("Rule Trace,\tRewriteTG from %s Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart);
@ -56,7 +56,7 @@ PROCESS_RESULT CRewriteTG::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteTG from %s Slot=%u Dst=TG%u-TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart, m_fromTGEnd); LogDebug("Rule Trace,\tRewriteTG from %s Slot=%u Dst=TG%u-TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart, m_fromTGEnd);
} }
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
if (m_fromSlot != m_toSlot) if (m_fromSlot != m_toSlot)
@ -81,5 +81,5 @@ PROCESS_RESULT CRewriteTG::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteTG to %s Slot=%u Dst=TG%u-TG%u", m_name.c_str(), m_toSlot, m_toTGStart, m_toTGEnd); LogDebug("Rule Trace,\tRewriteTG to %s Slot=%u Dst=TG%u-TG%u", m_name.c_str(), m_toSlot, m_toTGStart, m_toTGEnd);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -48,14 +48,14 @@ PROCESS_RESULT CRewriteType::process(CDMRData& data, bool trace)
unsigned int dstId = data.getDstId(); unsigned int dstId = data.getDstId();
unsigned int slotNo = data.getSlotNo(); unsigned int slotNo = data.getSlotNo();
if (flco != FLCO_GROUP || slotNo != m_fromSlot || dstId < m_fromTGStart || dstId > m_fromTGEnd) { if (flco != FLCO::GROUP || slotNo != m_fromSlot || dstId < m_fromTGStart || dstId > m_fromTGEnd) {
if (trace) { if (trace) {
if (m_fromTGStart == m_fromTGEnd) if (m_fromTGStart == m_fromTGEnd)
LogDebug("Rule Trace,\tRewriteType from \"%s\" Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart); LogDebug("Rule Trace,\tRewriteType from \"%s\" Slot=%u Dst=TG%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart);
else else
LogDebug("Rule Trace,\tRewriteType from \"%s\" Slot=%u Dst=TG%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart, m_fromTGEnd); LogDebug("Rule Trace,\tRewriteType from \"%s\" Slot=%u Dst=TG%u-%u: not matched", m_name.c_str(), m_fromSlot, m_fromTGStart, m_fromTGEnd);
} }
return RESULT_UNMATCHED; return PROCESS_RESULT::UNMATCHED;
} }
if (m_fromSlot != m_toSlot) if (m_fromSlot != m_toSlot)
@ -65,7 +65,7 @@ PROCESS_RESULT CRewriteType::process(CDMRData& data, bool trace)
unsigned int newDstId = dstId + m_toIdStart - m_fromTGStart; unsigned int newDstId = dstId + m_toIdStart - m_fromTGStart;
data.setDstId(newDstId); data.setDstId(newDstId);
} }
data.setFLCO(FLCO_USER_USER); data.setFLCO(FLCO::USER_USER);
processMessage(data); processMessage(data);
@ -80,5 +80,5 @@ PROCESS_RESULT CRewriteType::process(CDMRData& data, bool trace)
LogDebug("Rule Trace,\tRewriteType to \"%s\" Slot=%u Dst=%u-%u: matched", m_name.c_str(), m_toSlot, m_toIdStart, m_toIdEnd); LogDebug("Rule Trace,\tRewriteType to \"%s\" Slot=%u Dst=%u-%u: matched", m_name.c_str(), m_toSlot, m_toIdStart, m_toIdEnd);
} }
return RESULT_MATCHED; return PROCESS_RESULT::MATCHED;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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) 2006-2009,2012,2013,2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2006-2009,2012,2013,2015,2016,2025 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
@ -30,12 +30,12 @@ public:
CRingBuffer(unsigned int length, const char* name) : CRingBuffer(unsigned int length, const char* name) :
m_length(length), m_length(length),
m_name(name), m_name(name),
m_buffer(NULL), m_buffer(nullptr),
m_iPtr(0U), m_iPtr(0U),
m_oPtr(0U) m_oPtr(0U)
{ {
assert(length > 0U); assert(length > 0U);
assert(name != NULL); assert(name != nullptr);
m_buffer = new T[length]; m_buffer = new T[length];

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2005,2006,2008 Free Software Foundation, Inc. * Copyright (C) 2005,2006,2008 Free Software Foundation, Inc.
* Copyright (C) 2011,2015 by Jonathan Naylor G4KLX * Copyright (C) 2011,2015,2025 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
@ -46,10 +46,10 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
must be called before using hash in the call to sha256_hash must be called before using hash in the call to sha256_hash
*/ */
CSHA256::CSHA256() : CSHA256::CSHA256() :
m_state(NULL), m_state(nullptr),
m_total(NULL), m_total(nullptr),
m_buflen(0U), m_buflen(0U),
m_buffer(NULL) m_buffer(nullptr)
{ {
m_state = new uint32_t[8U]; m_state = new uint32_t[8U];
m_total = new uint32_t[2U]; m_total = new uint32_t[2U];
@ -85,7 +85,7 @@ void CSHA256::init()
* (uint32_t *) cp = v */ * (uint32_t *) cp = v */
static inline void set_uint32(unsigned char* cp, uint32_t v) static inline void set_uint32(unsigned char* cp, uint32_t v)
{ {
assert(cp != NULL); assert(cp != nullptr);
::memcpy(cp, &v, sizeof v); ::memcpy(cp, &v, sizeof v);
} }
@ -94,7 +94,7 @@ static inline void set_uint32(unsigned char* cp, uint32_t v)
must be in little endian byte order. */ must be in little endian byte order. */
unsigned char* CSHA256::read(unsigned char* resbuf) unsigned char* CSHA256::read(unsigned char* resbuf)
{ {
assert(resbuf != NULL); assert(resbuf != nullptr);
for (unsigned int i = 0U; i < 8U; i++) for (unsigned int i = 0U; i < 8U; i++)
set_uint32(resbuf + i * sizeof(m_state[0]), SWAP(m_state[i])); set_uint32(resbuf + i * sizeof(m_state[0]), SWAP(m_state[i]));
@ -129,7 +129,7 @@ void CSHA256::conclude()
unsigned char* CSHA256::finish(unsigned char* resbuf) unsigned char* CSHA256::finish(unsigned char* resbuf)
{ {
assert(resbuf != NULL); assert(resbuf != nullptr);
conclude(); conclude();
@ -142,8 +142,8 @@ unsigned char* CSHA256::finish(unsigned char* resbuf)
digest. */ digest. */
unsigned char* CSHA256::buffer(const unsigned char* buffer, unsigned int len, unsigned char* resblock) unsigned char* CSHA256::buffer(const unsigned char* buffer, unsigned int len, unsigned char* resblock)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
assert(resblock != NULL); assert(resblock != nullptr);
/* Initialize the computation context. */ /* Initialize the computation context. */
init(); init();
@ -157,7 +157,7 @@ unsigned char* CSHA256::buffer(const unsigned char* buffer, unsigned int len, un
void CSHA256::processBytes(const unsigned char* buffer, unsigned int len) void CSHA256::processBytes(const unsigned char* buffer, unsigned int len)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
/* When we already have some bits in our internal buffer concatenate /* When we already have some bits in our internal buffer concatenate
both inputs first. */ both inputs first. */
@ -252,7 +252,7 @@ static const uint32_t roundConstants[64] = {
void CSHA256::processBlock(const unsigned char* buffer, unsigned int len) void CSHA256::processBlock(const unsigned char* buffer, unsigned int len)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
const uint32_t* words = (uint32_t*)buffer; const uint32_t* words = (uint32_t*)buffer;
unsigned int nwords = len / sizeof(uint32_t); unsigned int nwords = len / sizeof(uint32_t);

View file

@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2005,2006,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2005,2006,2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2011,2015,2016 by Jonathan Naylor G4KLX * Copyright (C) 2011,2015,2016,2025 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
@ -22,9 +22,7 @@
#include <cstdint> #include <cstdint>
enum { const unsigned int SHA256_DIGEST_SIZE = 256U / 8U;
SHA256_DIGEST_SIZE = 256 / 8
};
class CSHA256 { class CSHA256 {
public: public:

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2018 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2018,2025 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
@ -77,7 +77,7 @@ CStopWatch::~CStopWatch()
unsigned long long CStopWatch::time() const unsigned long long CStopWatch::time() const
{ {
struct timeval now; struct timeval now;
::gettimeofday(&now, NULL); ::gettimeofday(&now, nullptr);
return now.tv_sec * 1000ULL + now.tv_usec / 1000ULL; return now.tv_sec * 1000ULL + now.tv_usec / 1000ULL;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2017,2025 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
@ -27,7 +27,7 @@
void CSync::addDMRDataSync(unsigned char* data, bool duplex) void CSync::addDMRDataSync(unsigned char* data, bool duplex)
{ {
assert(data != NULL); assert(data != nullptr);
if (duplex) { if (duplex) {
for (unsigned int i = 0U; i < 7U; i++) for (unsigned int i = 0U; i < 7U; i++)
@ -40,7 +40,7 @@ void CSync::addDMRDataSync(unsigned char* data, bool duplex)
void CSync::addDMRAudioSync(unsigned char* data, bool duplex) void CSync::addDMRAudioSync(unsigned char* data, bool duplex)
{ {
assert(data != NULL); assert(data != nullptr);
if (duplex) { if (duplex) {
for (unsigned int i = 0U; i < 7U; i++) for (unsigned int i = 0U; i < 7U; i++)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015,2016,2020 by Jonathan Naylor G4KLX * Copyright (C) 2015,2016,2020,2025 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
@ -31,9 +31,9 @@ CThread::~CThread()
bool CThread::run() bool CThread::run()
{ {
m_handle = ::CreateThread(NULL, 0, &helper, this, 0, NULL); m_handle = ::CreateThread(nullptr, 0, &helper, this, 0, nullptr);
return m_handle != NULL; return m_handle != nullptr;
} }
@ -74,13 +74,13 @@ CThread::~CThread()
bool CThread::run() bool CThread::run()
{ {
return ::pthread_create(&m_thread, NULL, helper, this) == 0; return ::pthread_create(&m_thread, nullptr, helper, this) == 0;
} }
void CThread::wait() void CThread::wait()
{ {
::pthread_join(m_thread, NULL); ::pthread_join(m_thread, nullptr);
} }
@ -90,7 +90,7 @@ void* CThread::helper(void* arg)
p->entry(); p->entry();
return NULL; return nullptr;
} }
void CThread::sleep(unsigned int ms) void CThread::sleep(unsigned int ms)
@ -100,7 +100,7 @@ void CThread::sleep(unsigned int ms)
ts.tv_sec = ms / 1000U; ts.tv_sec = ms / 1000U;
ts.tv_nsec = (ms % 1000U) * 1000000U; ts.tv_nsec = (ms % 1000U) * 1000000U;
::nanosleep(&ts, NULL); ::nanosleep(&ts, nullptr);
} }
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2006-2016,2020,2024 by Jonathan Naylor G4KLX * Copyright (C) 2006-2016,2020,2024,2025 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
@ -94,7 +94,7 @@ int CUDPSocket::lookup(const std::string& hostname, unsigned short port, sockadd
/* Port is always digits, no needs to lookup service */ /* Port is always digits, no needs to lookup service */
hints.ai_flags |= AI_NUMERICSERV; hints.ai_flags |= AI_NUMERICSERV;
int err = ::getaddrinfo(hostname.empty() ? NULL : hostname.c_str(), portstr.c_str(), &hints, &res); int err = ::getaddrinfo(hostname.empty() ? nullptr : hostname.c_str(), portstr.c_str(), &hints, &res);
if (err != 0) { if (err != 0) {
sockaddr_in* paddr = (sockaddr_in*)&addr; sockaddr_in* paddr = (sockaddr_in*)&addr;
::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in)); ::memset(paddr, 0x00U, address_length = sizeof(sockaddr_in));
@ -119,7 +119,7 @@ bool CUDPSocket::match(const sockaddr_storage& addr1, const sockaddr_storage& ad
if (addr1.ss_family != addr2.ss_family) if (addr1.ss_family != addr2.ss_family)
return false; return false;
if (type == IMT_ADDRESS_AND_PORT) { if (type == IPMATCHTYPE::ADDRESS_AND_PORT) {
switch (addr1.ss_family) { switch (addr1.ss_family) {
case AF_INET: case AF_INET:
struct sockaddr_in *in_1, *in_2; struct sockaddr_in *in_1, *in_2;
@ -134,7 +134,7 @@ bool CUDPSocket::match(const sockaddr_storage& addr1, const sockaddr_storage& ad
default: default:
return false; return false;
} }
} else if (type == IMT_ADDRESS_ONLY) { } else if (type == IPMATCHTYPE::ADDRESS_ONLY) {
switch (addr1.ss_family) { switch (addr1.ss_family) {
case AF_INET: case AF_INET:
struct sockaddr_in *in_1, *in_2; struct sockaddr_in *in_1, *in_2;
@ -233,7 +233,7 @@ bool CUDPSocket::open()
int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storage& address, unsigned int &addressLength) int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storage& address, unsigned int &addressLength)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
assert(length > 0U); assert(length > 0U);
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
@ -301,7 +301,7 @@ int CUDPSocket::read(unsigned char* buffer, unsigned int length, sockaddr_storag
bool CUDPSocket::write(const unsigned char* buffer, unsigned int length, const sockaddr_storage& address, unsigned int addressLength) bool CUDPSocket::write(const unsigned char* buffer, unsigned int length, const sockaddr_storage& address, unsigned int addressLength)
{ {
assert(buffer != NULL); assert(buffer != nullptr);
assert(length > 0U); assert(length > 0U);
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
assert(m_fd != INVALID_SOCKET); assert(m_fd != INVALID_SOCKET);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009-2011,2013,2015,2016,2020,2024 by Jonathan Naylor G4KLX * Copyright (C) 2009-2011,2013,2015,2016,2020,2024,2025 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
@ -35,9 +35,9 @@
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
enum IPMATCHTYPE { enum class IPMATCHTYPE {
IMT_ADDRESS_AND_PORT, ADDRESS_AND_PORT,
IMT_ADDRESS_ONLY ADDRESS_ONLY
}; };
class CUDPSocket { class CUDPSocket {
@ -60,7 +60,7 @@ public:
static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& addressLength); static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& addressLength);
static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& addressLength, struct addrinfo& hints); static int lookup(const std::string& hostName, unsigned short port, sockaddr_storage& address, unsigned int& addressLength, struct addrinfo& hints);
static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IMT_ADDRESS_AND_PORT); static bool match(const sockaddr_storage& addr1, const sockaddr_storage& addr2, IPMATCHTYPE type = IPMATCHTYPE::ADDRESS_AND_PORT);
static bool isNone(const sockaddr_storage& addr); static bool isNone(const sockaddr_storage& addr);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2009,2014,2015,2016 Jonathan Naylor, G4KLX * Copyright (C) 2009,2014,2015,2016,2025 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
@ -19,14 +19,14 @@
void CUtils::dump(const std::string& title, const unsigned char* data, unsigned int length) void CUtils::dump(const std::string& title, const unsigned char* data, unsigned int length)
{ {
assert(data != NULL); assert(data != nullptr);
dump(2U, title, data, length); dump(2U, title, data, length);
} }
void CUtils::dump(int level, const std::string& title, const unsigned char* data, unsigned int length) void CUtils::dump(int level, const std::string& title, const unsigned char* data, unsigned int length)
{ {
assert(data != NULL); assert(data != nullptr);
::Log(level, "%s", title.c_str()); ::Log(level, "%s", title.c_str());
@ -72,14 +72,14 @@ void CUtils::dump(int level, const std::string& title, const unsigned char* data
void CUtils::dump(const std::string& title, const bool* bits, unsigned int length) void CUtils::dump(const std::string& title, const bool* bits, unsigned int length)
{ {
assert(bits != NULL); assert(bits != nullptr);
dump(2U, title, bits, length); dump(2U, title, bits, length);
} }
void CUtils::dump(int level, const std::string& title, const bool* bits, unsigned int length) void CUtils::dump(int level, const std::string& title, const bool* bits, unsigned int length)
{ {
assert(bits != NULL); assert(bits != nullptr);
unsigned char bytes[100U]; unsigned char bytes[100U];
unsigned int nBytes = 0U; unsigned int nBytes = 0U;
@ -91,7 +91,7 @@ void CUtils::dump(int level, const std::string& title, const bool* bits, unsigne
void CUtils::byteToBitsBE(unsigned char byte, bool* bits) void CUtils::byteToBitsBE(unsigned char byte, bool* bits)
{ {
assert(bits != NULL); assert(bits != nullptr);
bits[0U] = (byte & 0x80U) == 0x80U; bits[0U] = (byte & 0x80U) == 0x80U;
bits[1U] = (byte & 0x40U) == 0x40U; bits[1U] = (byte & 0x40U) == 0x40U;
@ -105,7 +105,7 @@ void CUtils::byteToBitsBE(unsigned char byte, bool* bits)
void CUtils::byteToBitsLE(unsigned char byte, bool* bits) void CUtils::byteToBitsLE(unsigned char byte, bool* bits)
{ {
assert(bits != NULL); assert(bits != nullptr);
bits[0U] = (byte & 0x01U) == 0x01U; bits[0U] = (byte & 0x01U) == 0x01U;
bits[1U] = (byte & 0x02U) == 0x02U; bits[1U] = (byte & 0x02U) == 0x02U;
@ -119,7 +119,7 @@ void CUtils::byteToBitsLE(unsigned char byte, bool* bits)
void CUtils::bitsToByteBE(const bool* bits, unsigned char& byte) void CUtils::bitsToByteBE(const bool* bits, unsigned char& byte)
{ {
assert(bits != NULL); assert(bits != nullptr);
byte = bits[0U] ? 0x80U : 0x00U; byte = bits[0U] ? 0x80U : 0x00U;
byte |= bits[1U] ? 0x40U : 0x00U; byte |= bits[1U] ? 0x40U : 0x00U;
@ -133,7 +133,7 @@ void CUtils::bitsToByteBE(const bool* bits, unsigned char& byte)
void CUtils::bitsToByteLE(const bool* bits, unsigned char& byte) void CUtils::bitsToByteLE(const bool* bits, unsigned char& byte)
{ {
assert(bits != NULL); assert(bits != nullptr);
byte = bits[0U] ? 0x01U : 0x00U; byte = bits[0U] ? 0x01U : 0x00U;
byte |= bits[1U] ? 0x02U : 0x00U; byte |= bits[1U] ? 0x02U : 0x00U;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015-2021,2023,2024 by Jonathan Naylor G4KLX * Copyright (C) 2015-2021,2023,2024,2025 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
@ -19,6 +19,6 @@
#if !defined(VERSION_H) #if !defined(VERSION_H)
#define VERSION_H #define VERSION_H
const char* VERSION = "20240831"; const char* VERSION = "20250315";
#endif #endif

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -39,15 +39,15 @@ CXLXVoice::CXLXVoice(const std::string& directory, const std::string& language,
m_indxFile(), m_indxFile(),
m_ambeFile(), m_ambeFile(),
m_slot(slot), m_slot(slot),
m_lc(FLCO_GROUP, id, tg), m_lc(FLCO::GROUP, id, tg),
m_embeddedLC(), m_embeddedLC(),
m_status(XLXVS_NONE), m_status(XLXVOICE_STATUS::NONE),
m_timer(1000U, 1U), m_timer(1000U, 1U),
m_stopWatch(), m_stopWatch(),
m_seqNo(0U), m_seqNo(0U),
m_streamId(0U), m_streamId(0U),
m_sent(0U), m_sent(0U),
m_ambe(NULL), m_ambe(nullptr),
m_positions(), m_positions(),
m_data(), m_data(),
m_it() m_it()
@ -80,7 +80,7 @@ CXLXVoice::~CXLXVoice()
bool CXLXVoice::open() bool CXLXVoice::open()
{ {
FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt"); FILE* fpindx = ::fopen(m_indxFile.c_str(), "rt");
if (fpindx == NULL) { if (fpindx == nullptr) {
LogError("Unable to open the index file - %s", m_indxFile.c_str()); LogError("Unable to open the index file - %s", m_indxFile.c_str());
return false; return false;
} }
@ -94,7 +94,7 @@ bool CXLXVoice::open()
} }
FILE* fpambe = ::fopen(m_ambeFile.c_str(), "rb"); FILE* fpambe = ::fopen(m_ambeFile.c_str(), "rb");
if (fpambe == NULL) { if (fpambe == nullptr) {
LogError("Unable to open the AMBE file - %s", m_ambeFile.c_str()); LogError("Unable to open the AMBE file - %s", m_ambeFile.c_str());
::fclose(fpindx); ::fclose(fpindx);
return false; return false;
@ -105,12 +105,12 @@ bool CXLXVoice::open()
size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe); size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe);
if (sizeRead != 0U) { if (sizeRead != 0U) {
char buffer[80U]; char buffer[80U];
while (::fgets(buffer, 80, fpindx) != NULL) { while (::fgets(buffer, 80, fpindx) != nullptr) {
char* p1 = ::strtok(buffer, "\t\r\n"); char* p1 = ::strtok(buffer, "\t\r\n");
char* p2 = ::strtok(NULL, "\t\r\n"); char* p2 = ::strtok(nullptr, "\t\r\n");
char* p3 = ::strtok(NULL, "\t\r\n"); char* p3 = ::strtok(nullptr, "\t\r\n");
if (p1 != NULL && p2 != NULL && p3 != NULL) { if (p1 != nullptr && p2 != nullptr && p3 != nullptr) {
std::string symbol = std::string(p1); std::string symbol = std::string(p1);
unsigned int start = ::atoi(p2) * AMBE_LENGTH; unsigned int start = ::atoi(p2) * AMBE_LENGTH;
unsigned int length = ::atoi(p3) * AMBE_LENGTH; unsigned int length = ::atoi(p3) * AMBE_LENGTH;
@ -225,7 +225,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
CDMRData* data = new CDMRData; CDMRData* data = new CDMRData;
data->setSlotNo(m_slot); data->setSlotNo(m_slot);
data->setFLCO(FLCO_GROUP); data->setFLCO(FLCO::GROUP);
data->setSrcId(m_lc.getSrcId()); data->setSrcId(m_lc.getSrcId());
data->setDstId(m_lc.getDstId()); data->setDstId(m_lc.getDstId());
data->setN(n); data->setN(n);
@ -266,7 +266,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
delete[] ambeData; delete[] ambeData;
m_status = XLXVS_WAITING; m_status = XLXVOICE_STATUS::WAITING;
m_timer.start(); m_timer.start();
} }
@ -276,7 +276,7 @@ void CXLXVoice::reset()
delete *it; delete *it;
m_timer.stop(); m_timer.stop();
m_status = XLXVS_NONE; m_status = XLXVOICE_STATUS::NONE;
m_data.clear(); m_data.clear();
m_seqNo = 0U; m_seqNo = 0U;
m_streamId = 0U; m_streamId = 0U;
@ -285,7 +285,7 @@ void CXLXVoice::reset()
bool CXLXVoice::read(CDMRData& data) bool CXLXVoice::read(CDMRData& data)
{ {
if (m_status != XLXVS_SENDING) if (m_status != XLXVOICE_STATUS::SENDING)
return false; return false;
unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME; unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME;
@ -301,7 +301,7 @@ bool CXLXVoice::read(CDMRData& data)
delete *it; delete *it;
m_data.clear(); m_data.clear();
m_timer.stop(); m_timer.stop();
m_status = XLXVS_NONE; m_status = XLXVOICE_STATUS::NONE;
} }
return true; return true;
@ -314,9 +314,9 @@ void CXLXVoice::clock(unsigned int ms)
{ {
m_timer.clock(ms); m_timer.clock(ms);
if (m_timer.isRunning() && m_timer.hasExpired()) { if (m_timer.isRunning() && m_timer.hasExpired()) {
if (m_status == XLXVS_WAITING) { if (m_status == XLXVOICE_STATUS::WAITING) {
m_stopWatch.start(); m_stopWatch.start();
m_status = XLXVS_SENDING; m_status = XLXVOICE_STATUS::SENDING;
m_it = m_data.begin(); m_it = m_data.begin();
m_sent = 0U; m_sent = 0U;
} }
@ -328,7 +328,7 @@ void CXLXVoice::createHeaderTerminator(unsigned char type)
CDMRData* data = new CDMRData; CDMRData* data = new CDMRData;
data->setSlotNo(m_slot); data->setSlotNo(m_slot);
data->setFLCO(FLCO_GROUP); data->setFLCO(FLCO::GROUP);
data->setSrcId(m_lc.getSrcId()); data->setSrcId(m_lc.getSrcId());
data->setDstId(m_lc.getDstId()); data->setDstId(m_lc.getDstId());
data->setDataType(type); data->setDataType(type);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX * Copyright (C) 2017,2020,2025 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
@ -29,10 +29,10 @@
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
enum XLXVOICE_STATUS { enum class XLXVOICE_STATUS {
XLXVS_NONE, NONE,
XLXVS_WAITING, WAITING,
XLXVS_SENDING SENDING
}; };
struct CXLXPositions { struct CXLXPositions {