mirror of
https://github.com/g4klx/DMRGateway.git
synced 2025-12-06 05:32:01 +01:00
Update the C++ code.
This commit is contained in:
parent
29397cf65e
commit
ec5c32b57a
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,8 +27,8 @@
|
|||
#include <cstring>
|
||||
|
||||
CBPTC19696::CBPTC19696() :
|
||||
m_rawData(NULL),
|
||||
m_deInterData(NULL)
|
||||
m_rawData(nullptr),
|
||||
m_deInterData(nullptr)
|
||||
{
|
||||
m_rawData = new bool[196];
|
||||
m_deInterData = new bool[196];
|
||||
|
|
@ -43,8 +43,8 @@ CBPTC19696::~CBPTC19696()
|
|||
// The main decode function
|
||||
void CBPTC19696::decode(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
assert(in != nullptr);
|
||||
assert(out != nullptr);
|
||||
|
||||
// Get the raw binary
|
||||
decodeExtractBinary(in);
|
||||
|
|
@ -62,8 +62,8 @@ void CBPTC19696::decode(const unsigned char* in, unsigned char* out)
|
|||
// The main encode function
|
||||
void CBPTC19696::encode(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
assert(in != nullptr);
|
||||
assert(out != nullptr);
|
||||
|
||||
// Extract Data
|
||||
encodeExtractData(in);
|
||||
|
|
|
|||
16
CRC.cpp
16
CRC.cpp
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
|
||||
unsigned int 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)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
|
||||
unsigned short total = 0U;
|
||||
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)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
assert(length > 2U);
|
||||
|
||||
union {
|
||||
|
|
@ -168,7 +168,7 @@ void CCRC::addCCITT162(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);
|
||||
|
||||
union {
|
||||
|
|
@ -188,7 +188,7 @@ bool CCRC::checkCCITT162(const unsigned char *in, unsigned int length)
|
|||
|
||||
void CCRC::addCCITT161(unsigned char *in, unsigned int length)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
assert(length > 2U);
|
||||
|
||||
union {
|
||||
|
|
@ -209,7 +209,7 @@ void CCRC::addCCITT161(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);
|
||||
|
||||
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)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
|
||||
uint8_t crc = 0U;
|
||||
|
||||
|
|
|
|||
406
Conf.cpp
406
Conf.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -26,22 +26,22 @@
|
|||
|
||||
const int BUFFER_SIZE = 500;
|
||||
|
||||
enum SECTION {
|
||||
SECTION_NONE,
|
||||
SECTION_GENERAL,
|
||||
SECTION_LOG,
|
||||
SECTION_VOICE,
|
||||
SECTION_INFO,
|
||||
SECTION_DMR_NETWORK_1,
|
||||
SECTION_DMR_NETWORK_2,
|
||||
SECTION_DMR_NETWORK_3,
|
||||
SECTION_DMR_NETWORK_4,
|
||||
SECTION_DMR_NETWORK_5,
|
||||
SECTION_XLX_NETWORK,
|
||||
SECTION_GPSD,
|
||||
SECTION_APRS,
|
||||
SECTION_DYNAMIC_TG_CONTROL,
|
||||
SECTION_REMOTE_CONTROL
|
||||
enum class SECTION {
|
||||
NONE,
|
||||
GENERAL,
|
||||
LOG,
|
||||
VOICE,
|
||||
INFO,
|
||||
DMR_NETWORK_1,
|
||||
DMR_NETWORK_2,
|
||||
DMR_NETWORK_3,
|
||||
DMR_NETWORK_4,
|
||||
DMR_NETWORK_5,
|
||||
XLX_NETWORK,
|
||||
GPSD,
|
||||
APRS,
|
||||
DYNAMIC_TG_CONTROL,
|
||||
REMOTE_CONTROL
|
||||
};
|
||||
|
||||
CConf::CConf(const std::string& file) :
|
||||
|
|
@ -198,59 +198,59 @@ CConf::~CConf()
|
|||
bool CConf::read()
|
||||
{
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
|
||||
SECTION section = SECTION_NONE;
|
||||
SECTION section = SECTION::NONE;
|
||||
|
||||
char buffer[BUFFER_SIZE];
|
||||
while (::fgets(buffer, BUFFER_SIZE, fp) != NULL) {
|
||||
while (::fgets(buffer, BUFFER_SIZE, fp) != nullptr) {
|
||||
if (buffer[0U] == '#')
|
||||
continue;
|
||||
|
||||
if (buffer[0U] == '[') {
|
||||
if (::strncmp(buffer, "[General]", 9U) == 0)
|
||||
section = SECTION_GENERAL;
|
||||
section = SECTION::GENERAL;
|
||||
else if (::strncmp(buffer, "[Log]", 5U) == 0)
|
||||
section = SECTION_LOG;
|
||||
section = SECTION::LOG;
|
||||
else if (::strncmp(buffer, "[Voice]", 7U) == 0)
|
||||
section = SECTION_VOICE;
|
||||
section = SECTION::VOICE;
|
||||
else if (::strncmp(buffer, "[Info]", 6U) == 0)
|
||||
section = SECTION_INFO;
|
||||
section = SECTION::INFO;
|
||||
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)
|
||||
section = SECTION_DMR_NETWORK_1;
|
||||
section = SECTION::DMR_NETWORK_1;
|
||||
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)
|
||||
section = SECTION_DMR_NETWORK_3;
|
||||
section = SECTION::DMR_NETWORK_3;
|
||||
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)
|
||||
section = SECTION_DMR_NETWORK_5;
|
||||
section = SECTION::DMR_NETWORK_5;
|
||||
else if (::strncmp(buffer, "[GPSD]", 6U) == 0)
|
||||
section = SECTION_GPSD;
|
||||
section = SECTION::GPSD;
|
||||
else if (::strncmp(buffer, "[APRS]", 6U) == 0)
|
||||
section = SECTION_APRS;
|
||||
section = SECTION::APRS;
|
||||
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)
|
||||
section = SECTION_REMOTE_CONTROL;
|
||||
section = SECTION::REMOTE_CONTROL;
|
||||
else
|
||||
section = SECTION_NONE;
|
||||
section = SECTION::NONE;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
char* key = ::strtok(buffer, " \t=\r\n");
|
||||
if (key == NULL)
|
||||
if (key == nullptr)
|
||||
continue;
|
||||
|
||||
char* value = ::strtok(NULL, "\r\n");
|
||||
if (value == NULL)
|
||||
char* value = ::strtok(nullptr, "\r\n");
|
||||
if (value == nullptr)
|
||||
continue;
|
||||
|
||||
// Remove quotes from the value
|
||||
|
|
@ -262,7 +262,7 @@ bool CConf::read()
|
|||
char *p;
|
||||
|
||||
// if value is not quoted, remove after # (to make comment)
|
||||
if ((p = strchr(value, '#')) != NULL)
|
||||
if ((p = strchr(value, '#')) != nullptr)
|
||||
*p = '\0';
|
||||
|
||||
// remove trailing tab/space
|
||||
|
|
@ -270,7 +270,7 @@ bool CConf::read()
|
|||
*p = '\0';
|
||||
}
|
||||
|
||||
if (section == SECTION_GENERAL) {
|
||||
if (section == SECTION::GENERAL) {
|
||||
if (::strcmp(key, "Daemon") == 0)
|
||||
m_daemon = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Timeout") == 0)
|
||||
|
|
@ -291,7 +291,7 @@ bool CConf::read()
|
|||
m_ruleTrace = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Debug") == 0)
|
||||
m_debug = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_LOG) {
|
||||
} else if (section == SECTION::LOG) {
|
||||
if (::strcmp(key, "FilePath") == 0)
|
||||
m_logFilePath = value;
|
||||
else if (::strcmp(key, "FileRoot") == 0)
|
||||
|
|
@ -302,14 +302,14 @@ bool CConf::read()
|
|||
m_logDisplayLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "FileRotate") == 0)
|
||||
m_logFileRotate = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_VOICE) {
|
||||
} else if (section == SECTION::VOICE) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_voiceEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Language") == 0)
|
||||
m_voiceLanguage = value;
|
||||
else if (::strcmp(key, "Directory") == 0)
|
||||
m_voiceDirectory = value;
|
||||
} else if (section == SECTION_INFO) {
|
||||
} else if (section == SECTION::INFO) {
|
||||
if (::strcmp(key, "Latitude") == 0)
|
||||
m_infoLatitude = float(::atof(value));
|
||||
else if (::strcmp(key, "Longitude") == 0)
|
||||
|
|
@ -322,7 +322,7 @@ bool CConf::read()
|
|||
m_infoDescription = value;
|
||||
else if (::strcmp(key, "URL") == 0)
|
||||
m_infoURL = value;
|
||||
} else if (section == SECTION_XLX_NETWORK) {
|
||||
} else if (section == SECTION::XLX_NETWORK) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_xlxNetworkEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Id") == 0)
|
||||
|
|
@ -362,7 +362,7 @@ bool CConf::read()
|
|||
m_xlxNetworkUserControl = ::atoi(value) ==1;
|
||||
else if (::strcmp(key, "Module") == 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)
|
||||
m_dmrNetwork1Enabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
|
|
@ -385,11 +385,11 @@ bool CConf::read()
|
|||
m_dmrNetwork1Debug = ::atoi(value) == 1;
|
||||
else if (::strncmp(key, "TGRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CTGRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -400,11 +400,11 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "PCRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CPCRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -415,26 +415,26 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1;
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
|
||||
m_dmrNetwork1TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CSrcRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -446,15 +446,15 @@ bool CConf::read()
|
|||
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
|
||||
std::vector<char*> p7;
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, ", ");
|
||||
char* p6 = ::strtok(NULL, ", \r\n");
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, ", ");
|
||||
char* p6 = ::strtok(nullptr, ", \r\n");
|
||||
char* p;
|
||||
while ((p = ::strtok(NULL, ", \r\n")) != NULL)
|
||||
while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
|
||||
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;
|
||||
rewrite.m_slot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -470,8 +470,8 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "IdRewrite", 9U) == 0) {
|
||||
char* rfId = ::strtok(value, ", ");
|
||||
char* netId = ::strtok(NULL, " \r\n");
|
||||
if (rfId != NULL && netId != NULL) {
|
||||
char* netId = ::strtok(nullptr, " \r\n");
|
||||
if (rfId != nullptr && netId != nullptr) {
|
||||
CIdRewriteStruct rewrite;
|
||||
rewrite.m_rfId = ::atoi(rfId);
|
||||
rewrite.m_netId = ::atoi(netId);
|
||||
|
|
@ -484,7 +484,7 @@ bool CConf::read()
|
|||
unsigned int slotNo = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork1PassAllTG.push_back(slotNo);
|
||||
}
|
||||
} else if (section == SECTION_DMR_NETWORK_2) {
|
||||
} else if (section == SECTION::DMR_NETWORK_2) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dmrNetwork2Enabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
|
|
@ -507,11 +507,11 @@ bool CConf::read()
|
|||
m_dmrNetwork2Debug = ::atoi(value) == 1;
|
||||
else if (::strncmp(key, "TGRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CTGRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -522,11 +522,11 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "PCRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CPCRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -537,26 +537,26 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1;
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
|
||||
m_dmrNetwork2TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CSrcRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -568,15 +568,15 @@ bool CConf::read()
|
|||
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
|
||||
std::vector<char*> p7;
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, ", ");
|
||||
char* p6 = ::strtok(NULL, ", \r\n");
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, ", ");
|
||||
char* p6 = ::strtok(nullptr, ", \r\n");
|
||||
char* p;
|
||||
while ((p = ::strtok(NULL, ", \r\n")) != NULL)
|
||||
while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
|
||||
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;
|
||||
rewrite.m_slot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -592,8 +592,8 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "IdRewrite", 9U) == 0) {
|
||||
char* rfId = ::strtok(value, ", ");
|
||||
char* netId = ::strtok(NULL, " \r\n");
|
||||
if (rfId != NULL && netId != NULL) {
|
||||
char* netId = ::strtok(nullptr, " \r\n");
|
||||
if (rfId != nullptr && netId != nullptr) {
|
||||
CIdRewriteStruct rewrite;
|
||||
rewrite.m_rfId = ::atoi(rfId);
|
||||
rewrite.m_netId = ::atoi(netId);
|
||||
|
|
@ -606,7 +606,7 @@ bool CConf::read()
|
|||
unsigned int slotNo = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork2PassAllTG.push_back(slotNo);
|
||||
}
|
||||
} else if (section == SECTION_DMR_NETWORK_3) {
|
||||
} else if (section == SECTION::DMR_NETWORK_3) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dmrNetwork3Enabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
|
|
@ -629,11 +629,11 @@ bool CConf::read()
|
|||
m_dmrNetwork3Debug = ::atoi(value) == 1;
|
||||
else if (::strncmp(key, "TGRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CTGRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -644,11 +644,11 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "PCRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CPCRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -659,26 +659,26 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1;
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
|
||||
m_dmrNetwork3TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CSrcRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -690,15 +690,15 @@ bool CConf::read()
|
|||
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
|
||||
std::vector<char*> p7;
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, ", ");
|
||||
char* p6 = ::strtok(NULL, ", \r\n");
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, ", ");
|
||||
char* p6 = ::strtok(nullptr, ", \r\n");
|
||||
char* p;
|
||||
while ((p = ::strtok(NULL, ", \r\n")) != NULL)
|
||||
while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
|
||||
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;
|
||||
rewrite.m_slot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -714,8 +714,8 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "IdRewrite", 9U) == 0) {
|
||||
char* rfId = ::strtok(value, ", ");
|
||||
char* netId = ::strtok(NULL, " \r\n");
|
||||
if (rfId != NULL && netId != NULL) {
|
||||
char* netId = ::strtok(nullptr, " \r\n");
|
||||
if (rfId != nullptr && netId != nullptr) {
|
||||
CIdRewriteStruct rewrite;
|
||||
rewrite.m_rfId = ::atoi(rfId);
|
||||
rewrite.m_netId = ::atoi(netId);
|
||||
|
|
@ -728,7 +728,7 @@ bool CConf::read()
|
|||
unsigned int slotNo = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork3PassAllTG.push_back(slotNo);
|
||||
}
|
||||
} else if (section == SECTION_DMR_NETWORK_4) {
|
||||
} else if (section == SECTION::DMR_NETWORK_4) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dmrNetwork4Enabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
|
|
@ -751,11 +751,11 @@ bool CConf::read()
|
|||
m_dmrNetwork4Debug = ::atoi(value) == 1;
|
||||
else if (::strncmp(key, "TGRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CTGRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -766,11 +766,11 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "PCRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CPCRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -781,26 +781,26 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1;
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
|
||||
m_dmrNetwork4TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CSrcRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -812,15 +812,15 @@ bool CConf::read()
|
|||
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
|
||||
std::vector<char*> p7;
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, ", ");
|
||||
char* p6 = ::strtok(NULL, ", \r\n");
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, ", ");
|
||||
char* p6 = ::strtok(nullptr, ", \r\n");
|
||||
char* p;
|
||||
while ((p = ::strtok(NULL, ", \r\n")) != NULL)
|
||||
while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
|
||||
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;
|
||||
rewrite.m_slot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -836,8 +836,8 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "IdRewrite", 9U) == 0) {
|
||||
char* rfId = ::strtok(value, ", ");
|
||||
char* netId = ::strtok(NULL, " \r\n");
|
||||
if (rfId != NULL && netId != NULL) {
|
||||
char* netId = ::strtok(nullptr, " \r\n");
|
||||
if (rfId != nullptr && netId != nullptr) {
|
||||
CIdRewriteStruct rewrite;
|
||||
rewrite.m_rfId = ::atoi(rfId);
|
||||
rewrite.m_netId = ::atoi(netId);
|
||||
|
|
@ -850,7 +850,7 @@ bool CConf::read()
|
|||
unsigned int slotNo = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork4PassAllTG.push_back(slotNo);
|
||||
}
|
||||
} else if (section == SECTION_DMR_NETWORK_5) {
|
||||
} else if (section == SECTION::DMR_NETWORK_5) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dmrNetwork5Enabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
|
|
@ -873,11 +873,11 @@ bool CConf::read()
|
|||
m_dmrNetwork5Debug = ::atoi(value) == 1;
|
||||
else if (::strncmp(key, "TGRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CTGRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -888,11 +888,11 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "PCRewrite", 9U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CPCRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -903,26 +903,26 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "TypeRewrite", 11U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr) {
|
||||
CTypeRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
rewrite.m_toSlot = ::atoi(p3);
|
||||
rewrite.m_toId = ::atoi(p4);
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
rewrite.m_range = p5 != NULL ? ::atoi(p5) : 1;
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
rewrite.m_range = p5 != nullptr ? ::atoi(p5) : 1;
|
||||
m_dmrNetwork5TypeRewrites.push_back(rewrite);
|
||||
}
|
||||
} else if (::strncmp(key, "SrcRewrite", 10U) == 0) {
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, " \r\n");
|
||||
if (p1 != NULL && p2 != NULL && p3 != NULL && p4 != NULL && p5 != NULL) {
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, " \r\n");
|
||||
if (p1 != nullptr && p2 != nullptr && p3 != nullptr && p4 != nullptr && p5 != nullptr) {
|
||||
CSrcRewriteStruct rewrite;
|
||||
rewrite.m_fromSlot = ::atoi(p1);
|
||||
rewrite.m_fromId = ::atoi(p2);
|
||||
|
|
@ -934,15 +934,15 @@ bool CConf::read()
|
|||
} else if (::strncmp(key, "TGDynRewrite", 12U) == 0) {
|
||||
std::vector<char*> p7;
|
||||
char* p1 = ::strtok(value, ", ");
|
||||
char* p2 = ::strtok(NULL, ", ");
|
||||
char* p3 = ::strtok(NULL, ", ");
|
||||
char* p4 = ::strtok(NULL, ", ");
|
||||
char* p5 = ::strtok(NULL, ", ");
|
||||
char* p6 = ::strtok(NULL, ", \r\n");
|
||||
char* p2 = ::strtok(nullptr, ", ");
|
||||
char* p3 = ::strtok(nullptr, ", ");
|
||||
char* p4 = ::strtok(nullptr, ", ");
|
||||
char* p5 = ::strtok(nullptr, ", ");
|
||||
char* p6 = ::strtok(nullptr, ", \r\n");
|
||||
char* p;
|
||||
while ((p = ::strtok(NULL, ", \r\n")) != NULL)
|
||||
while ((p = ::strtok(nullptr, ", \r\n")) != nullptr)
|
||||
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;
|
||||
rewrite.m_slot = ::atoi(p1);
|
||||
rewrite.m_fromTG = ::atoi(p2);
|
||||
|
|
@ -958,8 +958,8 @@ bool CConf::read()
|
|||
}
|
||||
} else if (::strncmp(key, "IdRewrite", 9U) == 0) {
|
||||
char* rfId = ::strtok(value, ", ");
|
||||
char* netId = ::strtok(NULL, " \r\n");
|
||||
if (rfId != NULL && netId != NULL) {
|
||||
char* netId = ::strtok(nullptr, " \r\n");
|
||||
if (rfId != nullptr && netId != nullptr) {
|
||||
CIdRewriteStruct rewrite;
|
||||
rewrite.m_rfId = ::atoi(rfId);
|
||||
rewrite.m_netId = ::atoi(netId);
|
||||
|
|
@ -972,14 +972,14 @@ bool CConf::read()
|
|||
unsigned int slotNo = (unsigned int)::atoi(value);
|
||||
m_dmrNetwork5PassAllTG.push_back(slotNo);
|
||||
}
|
||||
} else if (section == SECTION_GPSD) {
|
||||
} else if (section == SECTION::GPSD) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_gpsdEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
m_gpsdAddress = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_gpsdPort = value;
|
||||
} else if (section == SECTION_APRS) {
|
||||
} else if (section == SECTION::APRS) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_aprsEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
|
|
@ -992,12 +992,12 @@ bool CConf::read()
|
|||
m_aprsDescription = value;
|
||||
else if (::strcmp(key, "Symbol") == 0)
|
||||
m_aprsSymbol = value;
|
||||
} else if (section == SECTION_DYNAMIC_TG_CONTROL) {
|
||||
} else if (section == SECTION::DYNAMIC_TG_CONTROL) {
|
||||
if (::strcmp(key, "Enabled") == 0)
|
||||
m_dynamicTGControlEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_dynamicTGControlPort = (unsigned short)::atoi(value);
|
||||
} else if (section == SECTION_REMOTE_CONTROL) {
|
||||
} else if (section == SECTION::REMOTE_CONTROL) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_remoteControlEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Address") == 0)
|
||||
|
|
|
|||
22
DMRCSBK.cpp
22
DMRCSBK.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -25,8 +25,8 @@
|
|||
#include <cassert>
|
||||
|
||||
CDMRCSBK::CDMRCSBK() :
|
||||
m_data(NULL),
|
||||
m_CSBKO(CSBKO_NONE)
|
||||
m_data(nullptr),
|
||||
m_CSBKO(CSBKO::NONE)
|
||||
{
|
||||
m_data = new unsigned char[12U];
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ CDMRCSBK::~CDMRCSBK()
|
|||
|
||||
bool CDMRCSBK::put(const unsigned char* bytes)
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
CBPTC19696 bptc;
|
||||
bptc.decode(bytes, m_data);
|
||||
|
|
@ -57,7 +57,7 @@ bool CDMRCSBK::put(const unsigned char* bytes)
|
|||
|
||||
void CDMRCSBK::get(unsigned char* bytes) const
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
CCRC::addCCITT162(m_data, 12U);
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ CSBKO CDMRCSBK::getCSBKO() const
|
|||
|
||||
bool CDMRCSBK::getGI() const
|
||||
{
|
||||
if (m_CSBKO == CSBKO_PRECCSBK)
|
||||
if (m_CSBKO == CSBKO::PRECCSBK)
|
||||
return (m_data[2U] & 0x40U) == 0x40U;
|
||||
else
|
||||
return false;
|
||||
|
|
@ -83,7 +83,7 @@ bool CDMRCSBK::getGI() 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];
|
||||
else
|
||||
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
|
||||
{
|
||||
if (m_CSBKO == CSBKO_NACKRSP)
|
||||
if (m_CSBKO == CSBKO::NACKRSP)
|
||||
return m_data[7U] << 16 | m_data[8U] << 8 | m_data[9U];
|
||||
else
|
||||
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)
|
||||
{
|
||||
if (m_CSBKO == CSBKO_PRECCSBK) {
|
||||
if (m_CSBKO == CSBKO::PRECCSBK) {
|
||||
if (group)
|
||||
m_data[2U] |= 0x40U;
|
||||
else
|
||||
|
|
@ -109,7 +109,7 @@ void CDMRCSBK::setGI(bool group)
|
|||
|
||||
void CDMRCSBK::setSrcId(unsigned int id)
|
||||
{
|
||||
if (m_CSBKO == CSBKO_NACKRSP) {
|
||||
if (m_CSBKO == CSBKO::NACKRSP) {
|
||||
m_data[4U] = id >> 16;
|
||||
m_data[5U] = id >> 8;
|
||||
m_data[6U] = id >> 0;
|
||||
|
|
@ -122,7 +122,7 @@ void CDMRCSBK::setSrcId(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[8U] = id >> 8;
|
||||
m_data[9U] = id >> 0;
|
||||
|
|
|
|||
18
DMRCSBK.h
18
DMRCSBK.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -21,14 +21,14 @@
|
|||
|
||||
#include "DMRDefines.h"
|
||||
|
||||
enum CSBKO {
|
||||
CSBKO_NONE = 0x00,
|
||||
CSBKO_UUVREQ = 0x04,
|
||||
CSBKO_UUANSRSP = 0x05,
|
||||
CSBKO_CTCSBK = 0x07,
|
||||
CSBKO_NACKRSP = 0x26,
|
||||
CSBKO_BSDWNACT = 0x38,
|
||||
CSBKO_PRECCSBK = 0x3D
|
||||
enum class CSBKO : unsigned char {
|
||||
NONE = 0x00,
|
||||
UUVREQ = 0x04,
|
||||
UUANSRSP = 0x05,
|
||||
CTCSBK = 0x07,
|
||||
NACKRSP = 0x26,
|
||||
BSDWNACT = 0x38,
|
||||
PRECCSBK = 0x3D
|
||||
};
|
||||
|
||||
class CDMRCSBK
|
||||
|
|
|
|||
12
DMRData.cpp
12
DMRData.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
CDMRData::CDMRData(const CDMRData& data) :
|
||||
m_slotNo(data.m_slotNo),
|
||||
m_data(NULL),
|
||||
m_data(nullptr),
|
||||
m_srcId(data.m_srcId),
|
||||
m_dstId(data.m_dstId),
|
||||
m_flco(data.m_flco),
|
||||
|
|
@ -40,10 +40,10 @@ m_streamId(data.m_streamId)
|
|||
|
||||
CDMRData::CDMRData() :
|
||||
m_slotNo(1U),
|
||||
m_data(NULL),
|
||||
m_data(nullptr),
|
||||
m_srcId(0U),
|
||||
m_dstId(0U),
|
||||
m_flco(FLCO_GROUP),
|
||||
m_flco(FLCO::GROUP),
|
||||
m_dataType(0U),
|
||||
m_seqNo(0U),
|
||||
m_n(0U),
|
||||
|
|
@ -173,7 +173,7 @@ void CDMRData::setRSSI(unsigned char rssi)
|
|||
|
||||
unsigned int CDMRData::getData(unsigned char* buffer) const
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
|
||||
::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)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
|
||||
::memcpy(m_data, buffer, DMR_FRAME_LENGTH_BYTES);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
#include <cstring>
|
||||
|
||||
CDMRDataHeader::CDMRDataHeader() :
|
||||
m_data(NULL)
|
||||
m_data(nullptr)
|
||||
{
|
||||
m_data = new unsigned char[12U];
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ CDMRDataHeader::~CDMRDataHeader()
|
|||
|
||||
bool CDMRDataHeader::put(const unsigned char* bytes)
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
CBPTC19696 bptc;
|
||||
bptc.decode(bytes, m_data);
|
||||
|
|
@ -63,7 +63,7 @@ bool CDMRDataHeader::put(const unsigned char* bytes)
|
|||
|
||||
void CDMRDataHeader::get(unsigned char* bytes) const
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
CCRC::addCCITT162(m_data, 12U);
|
||||
|
||||
|
|
|
|||
18
DMRDefines.h
18
DMRDefines.h
|
|
@ -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
|
||||
* 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_DMRA = 16U;
|
||||
|
||||
enum FLCO {
|
||||
FLCO_GROUP = 0,
|
||||
FLCO_USER_USER = 3,
|
||||
FLCO_TALKER_ALIAS_HEADER = 4,
|
||||
FLCO_TALKER_ALIAS_BLOCK1 = 5,
|
||||
FLCO_TALKER_ALIAS_BLOCK2 = 6,
|
||||
FLCO_TALKER_ALIAS_BLOCK3 = 7,
|
||||
FLCO_GPS_INFO = 8
|
||||
enum class FLCO : unsigned char {
|
||||
GROUP = 0,
|
||||
USER_USER = 3,
|
||||
TALKER_ALIAS_HEADER = 4,
|
||||
TALKER_ALIAS_BLOCK1 = 5,
|
||||
TALKER_ALIAS_BLOCK2 = 6,
|
||||
TALKER_ALIAS_BLOCK3 = 7,
|
||||
GPS_INFO = 8
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char DMREMB[2U];
|
||||
DMREMB[0U] = (data[13U] << 4) & 0xF0U;
|
||||
|
|
@ -53,7 +53,7 @@ void CDMREMB::putData(const unsigned char* data)
|
|||
|
||||
void CDMREMB::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char DMREMB[2U];
|
||||
DMREMB[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,10 +27,10 @@
|
|||
#include <cstring>
|
||||
|
||||
CDMREmbeddedData::CDMREmbeddedData() :
|
||||
m_raw(NULL),
|
||||
m_state(LCS_NONE),
|
||||
m_data(NULL),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_raw(nullptr),
|
||||
m_state(LC_STATE::NONE),
|
||||
m_data(nullptr),
|
||||
m_FLCO(FLCO::GROUP),
|
||||
m_valid(false)
|
||||
{
|
||||
m_raw = new bool[128U];
|
||||
|
|
@ -46,7 +46,7 @@ CDMREmbeddedData::~CDMREmbeddedData()
|
|||
// Add LC data (which may consist of 4 blocks) to the data store
|
||||
bool CDMREmbeddedData::addData(const unsigned char* data, unsigned char lcss)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
bool rawData[40U];
|
||||
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];
|
||||
|
||||
// Show we are ready for the next LC block
|
||||
m_state = LCS_FIRST;
|
||||
m_state = LC_STATE::FIRST;
|
||||
m_valid = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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++)
|
||||
m_raw[a + 32U] = rawData[a + 4U];
|
||||
|
||||
// Show we are ready for the next LC block
|
||||
m_state = LCS_SECOND;
|
||||
m_state = LC_STATE::SECOND;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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++)
|
||||
m_raw[a + 64U] = rawData[a + 4U];
|
||||
|
||||
// Show we are ready for the final LC block
|
||||
m_state = LCS_THIRD;
|
||||
m_state = LC_STATE::THIRD;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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++)
|
||||
m_raw[a + 96U] = rawData[a + 4U];
|
||||
|
||||
// Show that we're not ready for any more data
|
||||
m_state = LCS_NONE;
|
||||
m_state = LC_STATE::NONE;
|
||||
|
||||
// Process the complete data block
|
||||
decodeEmbeddedData();
|
||||
|
|
@ -168,7 +168,7 @@ void CDMREmbeddedData::encodeEmbeddedData()
|
|||
|
||||
unsigned char CDMREmbeddedData::getData(unsigned char* data, unsigned char n) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (n >= 1U && n < 5U) {
|
||||
n--;
|
||||
|
|
@ -277,10 +277,10 @@ void CDMREmbeddedData::decodeEmbeddedData()
|
|||
CDMRLC* CDMREmbeddedData::getLC() const
|
||||
{
|
||||
if (!m_valid)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (m_FLCO != FLCO_GROUP && m_FLCO != FLCO_USER_USER)
|
||||
return NULL;
|
||||
if (m_FLCO != FLCO::GROUP && m_FLCO != FLCO::USER_USER)
|
||||
return nullptr;
|
||||
|
||||
return new CDMRLC(m_data);
|
||||
}
|
||||
|
|
@ -297,13 +297,13 @@ FLCO CDMREmbeddedData::getFLCO() const
|
|||
|
||||
void CDMREmbeddedData::reset()
|
||||
{
|
||||
m_state = LCS_NONE;
|
||||
m_state = LC_STATE::NONE;
|
||||
m_valid = false;
|
||||
}
|
||||
|
||||
bool CDMREmbeddedData::getRawData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (!m_valid)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -22,11 +22,11 @@
|
|||
#include "DMRDefines.h"
|
||||
#include "DMRLC.h"
|
||||
|
||||
enum LC_STATE {
|
||||
LCS_NONE,
|
||||
LCS_FIRST,
|
||||
LCS_SECOND,
|
||||
LCS_THIRD
|
||||
enum class LC_STATE {
|
||||
NONE,
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD
|
||||
};
|
||||
|
||||
class CDMREmbeddedData
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* 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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char lcData[12U];
|
||||
m_bptc.decode(data, lcData);
|
||||
|
|
@ -58,18 +58,18 @@ CDMRLC* CDMRFullLC::decode(const unsigned char* data, unsigned char type)
|
|||
|
||||
default:
|
||||
::LogError("Unsupported LC type - %d", int(type));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!CRS129::check(lcData))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return new CDMRLC(lcData);
|
||||
}
|
||||
|
||||
void CDMRFullLC::encode(const CDMRLC& lc, unsigned char* data, unsigned char type)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char lcData[12U];
|
||||
lc.getData(lcData);
|
||||
|
|
|
|||
453
DMRGateway.cpp
453
DMRGateway.cpp
File diff suppressed because it is too large
Load diff
18
DMRGateway.h
18
DMRGateway.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -37,14 +37,14 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
enum DMRGW_STATUS {
|
||||
DMRGWS_NONE,
|
||||
DMRGWS_DMRNETWORK1,
|
||||
DMRGWS_DMRNETWORK2,
|
||||
DMRGWS_DMRNETWORK3,
|
||||
DMRGWS_DMRNETWORK4,
|
||||
DMRGWS_DMRNETWORK5,
|
||||
DMRGWS_XLXREFLECTOR
|
||||
enum class DMRGW_STATUS {
|
||||
NONE,
|
||||
DMRNETWORK1,
|
||||
DMRNETWORK2,
|
||||
DMRNETWORK3,
|
||||
DMRNETWORK4,
|
||||
DMRNETWORK5,
|
||||
XLXREFLECTOR
|
||||
};
|
||||
|
||||
class CDMRGateway
|
||||
|
|
|
|||
16
DMRLC.cpp
16
DMRLC.cpp
|
|
@ -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
|
||||
* 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) :
|
||||
m_PF(false),
|
||||
m_R(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FLCO(FLCO::GROUP),
|
||||
m_FID(0U),
|
||||
m_options(0U),
|
||||
m_srcId(0U),
|
||||
m_dstId(0U)
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
m_PF = (bytes[0U] & 0x80U) == 0x80U;
|
||||
m_R = (bytes[0U] & 0x40U) == 0x40U;
|
||||
|
|
@ -61,13 +61,13 @@ m_dstId(0U)
|
|||
CDMRLC::CDMRLC(const bool* bits) :
|
||||
m_PF(false),
|
||||
m_R(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FLCO(FLCO::GROUP),
|
||||
m_FID(0U),
|
||||
m_options(0U),
|
||||
m_srcId(0U),
|
||||
m_dstId(0U)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
m_PF = bits[0U];
|
||||
m_R = bits[1U];
|
||||
|
|
@ -99,7 +99,7 @@ m_dstId(0U)
|
|||
CDMRLC::CDMRLC() :
|
||||
m_PF(false),
|
||||
m_R(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FLCO(FLCO::GROUP),
|
||||
m_FID(0U),
|
||||
m_options(0U),
|
||||
m_srcId(0U),
|
||||
|
|
@ -113,7 +113,7 @@ CDMRLC::~CDMRLC()
|
|||
|
||||
void CDMRLC::getData(unsigned char* bytes) const
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
assert(bytes != nullptr);
|
||||
|
||||
bytes[0U] = (unsigned char)m_FLCO;
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ void CDMRLC::getData(unsigned char* bytes) const
|
|||
|
||||
void CDMRLC::getData(bool* bits) const
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
unsigned char bytes[9U];
|
||||
getData(bytes);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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) :
|
||||
m_addr(),
|
||||
m_addrLen(0U),
|
||||
m_id(NULL),
|
||||
m_id(nullptr),
|
||||
m_password(password),
|
||||
m_name(name),
|
||||
m_location(location),
|
||||
m_debug(debug),
|
||||
m_socket(local),
|
||||
m_enabled(false),
|
||||
m_status(WAITING_CONNECT),
|
||||
m_status(STATUS::WAITING_CONNECT),
|
||||
m_retryTimer(1000U, 10U),
|
||||
m_timeoutTimer(1000U, 60U),
|
||||
m_buffer(NULL),
|
||||
m_salt(NULL),
|
||||
m_buffer(nullptr),
|
||||
m_salt(nullptr),
|
||||
m_rxData(1000U, "DMR Network"),
|
||||
m_options(),
|
||||
m_configData(NULL),
|
||||
m_configData(nullptr),
|
||||
m_configLen(0U),
|
||||
m_beacon(false)
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ m_beacon(false)
|
|||
m_id[3U] = id >> 0;
|
||||
|
||||
CStopWatch stopWatch;
|
||||
::srand(stopWatch.start());
|
||||
::srand((unsigned int)stopWatch.start());
|
||||
}
|
||||
|
||||
CDMRNetwork::~CDMRNetwork()
|
||||
|
|
@ -106,7 +106,7 @@ bool CDMRNetwork::open()
|
|||
if (!ret)
|
||||
return false;
|
||||
|
||||
m_status = WAITING_CONNECT;
|
||||
m_status = STATUS::WAITING_CONNECT;
|
||||
m_timeoutTimer.stop();
|
||||
m_retryTimer.start();
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ void CDMRNetwork::enable(bool enabled)
|
|||
|
||||
bool CDMRNetwork::read(CDMRData& data)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
if (m_status != STATUS::RUNNING)
|
||||
return false;
|
||||
|
||||
if (m_rxData.isEmpty())
|
||||
|
|
@ -146,7 +146,7 @@ bool CDMRNetwork::read(CDMRData& data)
|
|||
|
||||
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;
|
||||
::memcpy(&streamId, m_buffer + 16U, 4U);
|
||||
|
|
@ -188,7 +188,7 @@ bool CDMRNetwork::read(CDMRData& data)
|
|||
|
||||
bool CDMRNetwork::write(const CDMRData& data)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
if (m_status != STATUS::RUNNING)
|
||||
return false;
|
||||
|
||||
unsigned char buffer[HOMEBREW_DATA_PACKET_LENGTH];
|
||||
|
|
@ -216,7 +216,7 @@ bool CDMRNetwork::write(const CDMRData& data)
|
|||
buffer[15U] = slotNo == 1U ? 0x00U : 0x80U;
|
||||
|
||||
FLCO flco = data.getFLCO();
|
||||
buffer[15U] |= flco == FLCO_GROUP ? 0x00U : 0x40U;
|
||||
buffer[15U] |= flco == FLCO::GROUP ? 0x00U : 0x40U;
|
||||
|
||||
unsigned char dataType = data.getDataType();
|
||||
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)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
if (m_status != STATUS::RUNNING)
|
||||
return false;
|
||||
|
||||
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)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
if (m_status != STATUS::RUNNING)
|
||||
return false;
|
||||
|
||||
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)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
if (m_status != STATUS::RUNNING)
|
||||
return false;
|
||||
|
||||
if (!m_location)
|
||||
|
|
@ -299,7 +299,7 @@ bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
|
|||
|
||||
bool CDMRNetwork::isConnected() const
|
||||
{
|
||||
return m_status == RUNNING;
|
||||
return m_status == STATUS::RUNNING;
|
||||
}
|
||||
|
||||
std::string const CDMRNetwork::getName() const
|
||||
|
|
@ -311,7 +311,7 @@ void CDMRNetwork::close(bool sayGoodbye)
|
|||
{
|
||||
LogMessage("%s, Closing DMR Network", m_name.c_str());
|
||||
|
||||
if (sayGoodbye && (m_status == RUNNING)) {
|
||||
if (sayGoodbye && (m_status == STATUS::RUNNING)) {
|
||||
unsigned char buffer[9U];
|
||||
::memcpy(buffer + 0U, "RPTCL", 5U);
|
||||
::memcpy(buffer + 5U, m_id, 4U);
|
||||
|
|
@ -326,14 +326,14 @@ void CDMRNetwork::close(bool sayGoodbye)
|
|||
|
||||
void CDMRNetwork::clock(unsigned int ms)
|
||||
{
|
||||
if (m_status == WAITING_CONNECT) {
|
||||
if (m_status == STATUS::WAITING_CONNECT) {
|
||||
m_retryTimer.clock(ms);
|
||||
if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) {
|
||||
bool ret = writeLogin();
|
||||
if (!ret)
|
||||
return;
|
||||
|
||||
m_status = WAITING_LOGIN;
|
||||
m_status = STATUS::WAITING_LOGIN;
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
}
|
||||
|
|
@ -365,9 +365,9 @@ void CDMRNetwork::clock(unsigned int ms)
|
|||
m_rxData.addData(m_buffer, len);
|
||||
}
|
||||
} 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());
|
||||
m_status = WAITING_LOGIN;
|
||||
m_status = STATUS::WAITING_LOGIN;
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
} else {
|
||||
|
|
@ -381,36 +381,36 @@ void CDMRNetwork::clock(unsigned int ms)
|
|||
}
|
||||
} else if (::memcmp(m_buffer, "RPTACK", 6U) == 0) {
|
||||
switch (m_status) {
|
||||
case WAITING_LOGIN:
|
||||
case STATUS::WAITING_LOGIN:
|
||||
LogDebug("%s, Sending authorisation", m_name.c_str());
|
||||
::memcpy(m_salt, m_buffer + 6U, sizeof(uint32_t));
|
||||
writeAuthorisation();
|
||||
m_status = WAITING_AUTHORISATION;
|
||||
m_status = STATUS::WAITING_AUTHORISATION;
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
break;
|
||||
case WAITING_AUTHORISATION:
|
||||
case STATUS::WAITING_AUTHORISATION:
|
||||
LogDebug("%s, Sending configuration", m_name.c_str());
|
||||
writeConfig();
|
||||
m_status = WAITING_CONFIG;
|
||||
m_status = STATUS::WAITING_CONFIG;
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
break;
|
||||
case WAITING_CONFIG:
|
||||
case STATUS::WAITING_CONFIG:
|
||||
if (m_options.empty()) {
|
||||
LogMessage("%s, Logged into the master successfully", m_name.c_str());
|
||||
m_status = RUNNING;
|
||||
m_status = STATUS::RUNNING;
|
||||
} else {
|
||||
LogDebug("%s, Sending options", m_name.c_str());
|
||||
writeOptions();
|
||||
m_status = WAITING_OPTIONS;
|
||||
m_status = STATUS::WAITING_OPTIONS;
|
||||
}
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
break;
|
||||
case WAITING_OPTIONS:
|
||||
case STATUS::WAITING_OPTIONS:
|
||||
LogMessage("%s, Logged into the master successfully", m_name.c_str());
|
||||
m_status = RUNNING;
|
||||
m_status = STATUS::RUNNING;
|
||||
m_timeoutTimer.start();
|
||||
m_retryTimer.start();
|
||||
break;
|
||||
|
|
@ -435,19 +435,19 @@ void CDMRNetwork::clock(unsigned int ms)
|
|||
m_retryTimer.clock(ms);
|
||||
if (m_retryTimer.isRunning() && m_retryTimer.hasExpired()) {
|
||||
switch (m_status) {
|
||||
case WAITING_LOGIN:
|
||||
case STATUS::WAITING_LOGIN:
|
||||
writeLogin();
|
||||
break;
|
||||
case WAITING_AUTHORISATION:
|
||||
case STATUS::WAITING_AUTHORISATION:
|
||||
writeAuthorisation();
|
||||
break;
|
||||
case WAITING_OPTIONS:
|
||||
case STATUS::WAITING_OPTIONS:
|
||||
writeOptions();
|
||||
break;
|
||||
case WAITING_CONFIG:
|
||||
case STATUS::WAITING_CONFIG:
|
||||
writeConfig();
|
||||
break;
|
||||
case RUNNING:
|
||||
case STATUS::RUNNING:
|
||||
writePing();
|
||||
break;
|
||||
default:
|
||||
|
|
@ -542,7 +542,7 @@ bool CDMRNetwork::wantsBeacon()
|
|||
|
||||
bool CDMRNetwork::write(const unsigned char* data, unsigned int length)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
assert(length > 0U);
|
||||
|
||||
if (m_debug)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -71,7 +71,7 @@ private:
|
|||
CUDPSocket m_socket;
|
||||
bool m_enabled;
|
||||
|
||||
enum STATUS {
|
||||
enum class STATUS {
|
||||
WAITING_CONNECT,
|
||||
WAITING_LOGIN,
|
||||
WAITING_AUTHORISATION,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char DMRSlotType[3U];
|
||||
DMRSlotType[0U] = (data[12U] << 2) & 0xFCU;
|
||||
|
|
@ -55,7 +55,7 @@ void CDMRSlotType::putData(const unsigned char* data)
|
|||
|
||||
void CDMRSlotType::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned char DMRSlotType[3U];
|
||||
DMRSlotType[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
|
|
|
|||
36
DynVoice.cpp
36
DynVoice.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -42,13 +42,13 @@ m_id(id),
|
|||
m_slot(slot),
|
||||
m_lc(),
|
||||
m_embeddedLC(),
|
||||
m_status(DYNVS_NONE),
|
||||
m_status(DYNVOICE_STATUS::NONE),
|
||||
m_timer(1000U, 1U),
|
||||
m_stopWatch(),
|
||||
m_seqNo(0U),
|
||||
m_streamId(0U),
|
||||
m_sent(0U),
|
||||
m_ambe(NULL),
|
||||
m_ambe(nullptr),
|
||||
m_positions(),
|
||||
m_data(),
|
||||
m_it()
|
||||
|
|
@ -61,7 +61,7 @@ m_it()
|
|||
m_ambeFile = directory + "/" + language + ".ambe";
|
||||
#endif
|
||||
|
||||
m_lc.setFLCO(FLCO_GROUP);
|
||||
m_lc.setFLCO(FLCO::GROUP);
|
||||
m_lc.setSrcId(id);
|
||||
m_lc.setDstId(tg);
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ CDynVoice::~CDynVoice()
|
|||
bool CDynVoice::open()
|
||||
{
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ bool CDynVoice::open()
|
|||
}
|
||||
|
||||
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());
|
||||
::fclose(fpindx);
|
||||
return false;
|
||||
|
|
@ -110,12 +110,12 @@ bool CDynVoice::open()
|
|||
size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe);
|
||||
if (sizeRead != 0U) {
|
||||
char buffer[80U];
|
||||
while (::fgets(buffer, 80, fpindx) != NULL) {
|
||||
while (::fgets(buffer, 80, fpindx) != nullptr) {
|
||||
char* p1 = ::strtok(buffer, "\t\r\n");
|
||||
char* p2 = ::strtok(NULL, "\t\r\n");
|
||||
char* p3 = ::strtok(NULL, "\t\r\n");
|
||||
char* p2 = ::strtok(nullptr, "\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);
|
||||
unsigned int start = ::atoi(p2) * AMBE_LENGTH;
|
||||
unsigned int length = ::atoi(p3) * AMBE_LENGTH;
|
||||
|
|
@ -170,7 +170,7 @@ void CDynVoice::abort()
|
|||
m_data.clear();
|
||||
m_timer.stop();
|
||||
|
||||
m_status = DYNVS_NONE;
|
||||
m_status = DYNVOICE_STATUS::NONE;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
data->setSlotNo(m_slot);
|
||||
data->setFLCO(FLCO_GROUP);
|
||||
data->setFLCO(FLCO::GROUP);
|
||||
data->setSrcId(m_lc.getSrcId());
|
||||
data->setDstId(m_lc.getDstId());
|
||||
data->setN(n);
|
||||
|
|
@ -276,13 +276,13 @@ void CDynVoice::createVoice(const std::vector<std::string>& words)
|
|||
|
||||
delete[] ambeData;
|
||||
|
||||
m_status = DYNVS_WAITING;
|
||||
m_status = DYNVOICE_STATUS::WAITING;
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
bool CDynVoice::read(CDMRData& data)
|
||||
{
|
||||
if (m_status != DYNVS_SENDING)
|
||||
if (m_status != DYNVOICE_STATUS::SENDING)
|
||||
return false;
|
||||
|
||||
unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME;
|
||||
|
|
@ -298,7 +298,7 @@ bool CDynVoice::read(CDMRData& data)
|
|||
delete *it;
|
||||
m_data.clear();
|
||||
m_timer.stop();
|
||||
m_status = DYNVS_NONE;
|
||||
m_status = DYNVOICE_STATUS::NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -311,9 +311,9 @@ void CDynVoice::clock(unsigned int ms)
|
|||
{
|
||||
m_timer.clock(ms);
|
||||
if (m_timer.isRunning() && m_timer.hasExpired()) {
|
||||
if (m_status == DYNVS_WAITING) {
|
||||
if (m_status == DYNVOICE_STATUS::WAITING) {
|
||||
m_stopWatch.start();
|
||||
m_status = DYNVS_SENDING;
|
||||
m_status = DYNVOICE_STATUS::SENDING;
|
||||
m_it = m_data.begin();
|
||||
m_sent = 0U;
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ void CDynVoice::createHeaderTerminator(unsigned char type)
|
|||
CDMRData* data = new CDMRData;
|
||||
|
||||
data->setSlotNo(m_slot);
|
||||
data->setFLCO(FLCO_GROUP);
|
||||
data->setFLCO(FLCO::GROUP);
|
||||
data->setSrcId(m_lc.getSrcId());
|
||||
data->setDstId(m_lc.getDstId());
|
||||
data->setDataType(type);
|
||||
|
|
|
|||
10
DynVoice.h
10
DynVoice.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -29,10 +29,10 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
enum DYNVOICE_STATUS {
|
||||
DYNVS_NONE,
|
||||
DYNVS_WAITING,
|
||||
DYNVS_SENDING
|
||||
enum class DYNVOICE_STATUS {
|
||||
NONE,
|
||||
WAITING,
|
||||
SENDING
|
||||
};
|
||||
|
||||
struct CDynPositions {
|
||||
|
|
|
|||
16
GPSD.cpp
16
GPSD.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -31,7 +31,7 @@ m_gpsdPort(port),
|
|||
m_gpsdData(),
|
||||
m_idTimer(1000U, 60U),
|
||||
m_networks(),
|
||||
m_aprs(NULL)
|
||||
m_aprs(nullptr)
|
||||
{
|
||||
assert(!address.empty());
|
||||
assert(!port.empty());
|
||||
|
|
@ -43,14 +43,14 @@ CGPSD::~CGPSD()
|
|||
|
||||
void CGPSD::addNetwork(CDMRNetwork* network)
|
||||
{
|
||||
assert(network != NULL);
|
||||
assert(network != nullptr);
|
||||
|
||||
m_networks.push_back(network);
|
||||
}
|
||||
|
||||
void CGPSD::setAPRS(CAPRSWriter* aprs)
|
||||
{
|
||||
assert(aprs != NULL);
|
||||
assert(aprs != nullptr);
|
||||
|
||||
m_aprs = aprs;
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ bool CGPSD::open()
|
|||
return false;
|
||||
}
|
||||
|
||||
::gps_stream(&m_gpsdData, WATCH_ENABLE | WATCH_JSON, NULL);
|
||||
::gps_stream(&m_gpsdData, WATCH_ENABLE | WATCH_JSON, nullptr);
|
||||
|
||||
LogMessage("Connected to GPSD");
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ void CGPSD::clock(unsigned int ms)
|
|||
|
||||
void CGPSD::close()
|
||||
{
|
||||
::gps_stream(&m_gpsdData, WATCH_DISABLE, NULL);
|
||||
::gps_stream(&m_gpsdData, WATCH_DISABLE, nullptr);
|
||||
::gps_close(&m_gpsdData);
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ void CGPSD::sendReport()
|
|||
return;
|
||||
|
||||
#if GPSD_API_MAJOR_VERSION >= 7
|
||||
if (::gps_read(&m_gpsdData, NULL, 0) <= 0)
|
||||
if (::gps_read(&m_gpsdData, nullptr, 0) <= 0)
|
||||
return;
|
||||
#else
|
||||
if (::gps_read(&m_gpsdData) <= 0)
|
||||
|
|
@ -122,7 +122,7 @@ void CGPSD::sendReport()
|
|||
float altitude = float(m_gpsdData.fix.altitude);
|
||||
#endif
|
||||
|
||||
if (m_aprs != NULL)
|
||||
if (m_aprs != nullptr)
|
||||
m_aprs->setLocation(latitude, longitude, altitudeSet ? altitude : 0.0F);
|
||||
|
||||
for (std::vector<CDMRNetwork*>::const_iterator it = m_networks.begin(); it != m_networks.end(); ++it)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned int code = (data[0U] << 11) + (data[1U] << 3) + (data[2U] >> 5);
|
||||
unsigned int syndrome = getSyndrome1987(code);
|
||||
|
|
@ -251,7 +251,7 @@ unsigned char CGolay2087::decode(const unsigned char* data)
|
|||
|
||||
void CGolay2087::encode(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned int value = data[0U];
|
||||
|
||||
|
|
|
|||
26
Hamming.cpp
26
Hamming.cpp
|
|
@ -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
|
||||
* 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
|
||||
bool CHamming::decode15113_1(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the parity it should have
|
||||
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)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this row should have
|
||||
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
|
||||
bool CHamming::decode15113_2(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this row should have
|
||||
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)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this row should have
|
||||
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
|
||||
bool CHamming::decode1393(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
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)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
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
|
||||
bool CHamming::decode1063(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
bool c0 = d[0] ^ d[1] ^ d[2] ^ d[5];
|
||||
|
|
@ -218,7 +218,7 @@ bool CHamming::decode1063(bool* d)
|
|||
|
||||
void CHamming::encode1063(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
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
|
||||
bool CHamming::decode16114(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
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)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
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];
|
||||
|
|
@ -290,7 +290,7 @@ void CHamming::encode16114(bool* d)
|
|||
// A Hamming (17,12,3) Check
|
||||
bool CHamming::decode17123(bool* d)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
// Calculate the checksum this column should have
|
||||
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)
|
||||
{
|
||||
assert(d != NULL);
|
||||
assert(d != nullptr);
|
||||
|
||||
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];
|
||||
|
|
|
|||
22
Log.cpp
22
Log.cpp
|
|
@ -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
|
||||
* 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 bool m_fileRotate = true;
|
||||
|
||||
static FILE* m_fpLog = NULL;
|
||||
static FILE* m_fpLog = nullptr;
|
||||
static bool m_daemon = false;
|
||||
|
||||
static unsigned int m_displayLevel = 2U;
|
||||
|
|
@ -59,10 +59,10 @@ static bool logOpenRotate()
|
|||
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 (m_fpLog != NULL)
|
||||
if (m_fpLog != nullptr)
|
||||
return true;
|
||||
} else {
|
||||
if (m_fpLog != NULL)
|
||||
if (m_fpLog != nullptr)
|
||||
::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);
|
||||
#endif
|
||||
|
||||
if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) {
|
||||
if ((m_fpLog = ::fopen(filename, "a+t")) != nullptr) {
|
||||
status = true;
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
@ -94,7 +94,7 @@ static bool logOpenNoRotate()
|
|||
if (m_fileLevel == 0U)
|
||||
return true;
|
||||
|
||||
if (m_fpLog != NULL)
|
||||
if (m_fpLog != nullptr)
|
||||
return true;
|
||||
|
||||
char filename[200U];
|
||||
|
|
@ -104,7 +104,7 @@ static bool logOpenNoRotate()
|
|||
::sprintf(filename, "%s/%s.log", m_filePath.c_str(), m_fileRoot.c_str());
|
||||
#endif
|
||||
|
||||
if ((m_fpLog = ::fopen(filename, "a+t")) != NULL) {
|
||||
if ((m_fpLog = ::fopen(filename, "a+t")) != nullptr) {
|
||||
status = true;
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
|
|
@ -141,13 +141,13 @@ bool LogInitialise(bool daemon, const std::string& filePath, const std::string&
|
|||
|
||||
void LogFinalise()
|
||||
{
|
||||
if (m_fpLog != NULL)
|
||||
if (m_fpLog != nullptr)
|
||||
::fclose(m_fpLog);
|
||||
}
|
||||
|
||||
void Log(unsigned int level, const char* fmt, ...)
|
||||
{
|
||||
assert(fmt != NULL);
|
||||
assert(fmt != nullptr);
|
||||
|
||||
char buffer[501U];
|
||||
#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);
|
||||
#else
|
||||
struct timeval now;
|
||||
::gettimeofday(&now, NULL);
|
||||
::gettimeofday(&now, nullptr);
|
||||
|
||||
struct tm* tm = ::gmtime(&now.tv_sec);
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ void Log(unsigned int level, const char* fmt, ...)
|
|||
va_list vl;
|
||||
va_start(vl, fmt);
|
||||
|
||||
::vsnprintf(buffer + ::strlen(buffer), 500, fmt, vl);
|
||||
::vsnprintf(buffer + ::strlen(buffer), 500 - ::strlen(buffer), fmt, vl);
|
||||
|
||||
va_end(vl);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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_rptAddrLen(0U),
|
||||
m_id(0U),
|
||||
m_netId(NULL),
|
||||
m_netId(nullptr),
|
||||
m_debug(debug),
|
||||
m_socket(localAddress, localPort),
|
||||
m_buffer(NULL),
|
||||
m_buffer(nullptr),
|
||||
m_rxData(1000U, "MMDVM Network"),
|
||||
m_configData(NULL),
|
||||
m_configData(nullptr),
|
||||
m_configLen(0U),
|
||||
m_radioPositionData(NULL),
|
||||
m_radioPositionData(nullptr),
|
||||
m_radioPositionLen(0U),
|
||||
m_talkerAliasData(NULL),
|
||||
m_talkerAliasData(nullptr),
|
||||
m_talkerAliasLen(0U)
|
||||
{
|
||||
assert(!rptAddress.empty());
|
||||
|
|
@ -120,7 +120,7 @@ bool CMMDVMNetwork::read(CDMRData& data)
|
|||
|
||||
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;
|
||||
::memcpy(&streamId, m_buffer + 16U, 4U);
|
||||
|
|
@ -187,7 +187,7 @@ bool CMMDVMNetwork::write(const CDMRData& data)
|
|||
buffer[15U] = slotNo == 1U ? 0x00U : 0x80U;
|
||||
|
||||
FLCO flco = data.getFLCO();
|
||||
buffer[15U] |= flco == FLCO_GROUP ? 0x00U : 0x40U;
|
||||
buffer[15U] |= flco == FLCO::GROUP ? 0x00U : 0x40U;
|
||||
|
||||
unsigned char dataType = data.getDataType();
|
||||
if (dataType == DT_VOICE_SYNC) {
|
||||
|
|
@ -284,7 +284,7 @@ void CMMDVMNetwork::clock(unsigned int ms)
|
|||
} 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);
|
||||
|
||||
if (m_configData == NULL) {
|
||||
if (m_configData == nullptr) {
|
||||
m_configLen = length - 8U;
|
||||
m_configData = new unsigned char[m_configLen];
|
||||
::memcpy(m_configData, m_buffer + 8U, m_configLen);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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();
|
||||
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)
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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();
|
||||
unsigned int slotNo = data.getSlotNo();
|
||||
|
||||
bool ret = (flco == FLCO_GROUP && slotNo == m_slot);
|
||||
bool ret = (flco == FLCO::GROUP && slotNo == m_slot);
|
||||
|
||||
if (trace)
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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
|
||||
void CQR1676::encode(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned int value = (data[0U] >> 1) & 0x7FU;
|
||||
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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
unsigned int code = (data[0U] << 7) + (data[1U] >> 1);
|
||||
unsigned int syndrome = getSyndrome1576(code);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(msg != NULL);
|
||||
assert(parity != NULL);
|
||||
assert(msg != nullptr);
|
||||
assert(parity != nullptr);
|
||||
|
||||
for (unsigned int i = 0U; i < NPAR + 1U; i++)
|
||||
parity[i] = 0x00U;
|
||||
|
|
@ -120,7 +120,7 @@ void CRS129::encode(const unsigned char* msg, unsigned int nbytes, unsigned char
|
|||
// Reed-Solomon (12,9) check
|
||||
bool CRS129::check(const unsigned char* in)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(in != nullptr);
|
||||
|
||||
unsigned char parity[4U];
|
||||
encode(in, 9U, parity);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -51,17 +51,17 @@ bool CReflectors::load()
|
|||
m_reflectors.clear();
|
||||
|
||||
FILE* fp = ::fopen(m_hostsFile.c_str(), "rt");
|
||||
if (fp != NULL) {
|
||||
if (fp != nullptr) {
|
||||
char buffer[100U];
|
||||
while (::fgets(buffer, 100U, fp) != NULL) {
|
||||
while (::fgets(buffer, 100U, fp) != nullptr) {
|
||||
if (buffer[0U] == '#')
|
||||
continue;
|
||||
|
||||
char* p1 = ::strtok(buffer, ";\r\n");
|
||||
char* p2 = ::strtok(NULL, ";\r\n");
|
||||
char* p3 = ::strtok(NULL, "\r\n");
|
||||
char* p2 = ::strtok(nullptr, ";\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;
|
||||
refl->m_id = std::string(p1);
|
||||
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());
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CReflectors::clock(unsigned int ms)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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) :
|
||||
m_host(host),
|
||||
m_socket(address, port),
|
||||
m_command(RCD_NONE),
|
||||
m_command(REMOTE_COMMAND::NONE),
|
||||
m_args()
|
||||
{
|
||||
assert(port > 0U);
|
||||
|
|
@ -50,7 +50,7 @@ bool CRemoteControl::open()
|
|||
|
||||
REMOTE_COMMAND CRemoteControl::getCommand()
|
||||
{
|
||||
m_command = RCD_NONE;
|
||||
m_command = REMOTE_COMMAND::NONE;
|
||||
m_args.clear();
|
||||
|
||||
char command[BUFFER_LENGTH];
|
||||
|
|
@ -67,65 +67,63 @@ REMOTE_COMMAND CRemoteControl::getCommand()
|
|||
|
||||
// Parse the original command into a vector of strings.
|
||||
char* b = buffer;
|
||||
char* p = NULL;
|
||||
while ((p = ::strtok(b, " ")) != NULL) {
|
||||
b = NULL;
|
||||
char* p = nullptr;
|
||||
while ((p = ::strtok(b, " ")) != nullptr) {
|
||||
b = nullptr;
|
||||
m_args.push_back(std::string(p));
|
||||
}
|
||||
if (m_args.at(0U) == "enable" && m_args.size() >= ENABLE_ARGS) {
|
||||
if (m_args.at(1U) == "net1")
|
||||
m_command = RCD_ENABLE_NETWORK1;
|
||||
m_command = REMOTE_COMMAND::ENABLE_NETWORK1;
|
||||
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")
|
||||
m_command = RCD_ENABLE_NETWORK3;
|
||||
m_command = REMOTE_COMMAND::ENABLE_NETWORK3;
|
||||
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")
|
||||
m_command = RCD_ENABLE_NETWORK5;
|
||||
m_command = REMOTE_COMMAND::ENABLE_NETWORK5;
|
||||
else if (m_args.at(1U) == "xlx")
|
||||
m_command = RCD_ENABLE_XLX;
|
||||
m_command = REMOTE_COMMAND::ENABLE_XLX;
|
||||
else
|
||||
replyStr = "KO";
|
||||
} else if (m_args.at(0U) == "disable" && m_args.size() >= DISABLE_ARGS) {
|
||||
if (m_args.at(1U) == "net1")
|
||||
m_command = RCD_DISABLE_NETWORK1;
|
||||
m_command = REMOTE_COMMAND::DISABLE_NETWORK1;
|
||||
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")
|
||||
m_command = RCD_DISABLE_NETWORK3;
|
||||
m_command = REMOTE_COMMAND::DISABLE_NETWORK3;
|
||||
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")
|
||||
m_command = RCD_DISABLE_NETWORK5;
|
||||
m_command = REMOTE_COMMAND::DISABLE_NETWORK5;
|
||||
else if (m_args.at(1U) == "xlx")
|
||||
m_command = RCD_DISABLE_XLX;
|
||||
m_command = REMOTE_COMMAND::DISABLE_XLX;
|
||||
else
|
||||
replyStr = "KO";
|
||||
} else if (m_args.at(0U) == "status") {
|
||||
if (m_host != NULL) {
|
||||
if (m_host != nullptr) {
|
||||
m_host->buildNetworkStatusString(replyStr);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
replyStr = "KO";
|
||||
}
|
||||
|
||||
m_command = RCD_CONNECTION_STATUS;
|
||||
m_command = REMOTE_COMMAND::CONNECTION_STATUS;
|
||||
} else if (m_args.at(0U) == "hosts") {
|
||||
if (m_host != NULL) {
|
||||
if (m_host != nullptr) {
|
||||
m_host->buildNetworkHostsString(replyStr);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
replyStr = "KO";
|
||||
}
|
||||
|
||||
m_command = RCD_CONFIG_HOSTS;
|
||||
m_command = REMOTE_COMMAND::CONFIG_HOSTS;
|
||||
} else {
|
||||
replyStr = "KO";
|
||||
}
|
||||
|
||||
::snprintf(buffer, BUFFER_LENGTH * 2, "%s remote command of \"%s\" received", ((m_command == RCD_NONE) ? "Invalid" : "Valid"), command);
|
||||
if (m_command == RCD_NONE) {
|
||||
::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();
|
||||
LogWarning(buffer);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -24,22 +24,22 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
enum REMOTE_COMMAND {
|
||||
RCD_ENABLE_NETWORK1,
|
||||
RCD_ENABLE_NETWORK2,
|
||||
RCD_ENABLE_NETWORK3,
|
||||
RCD_ENABLE_NETWORK4,
|
||||
RCD_ENABLE_NETWORK5,
|
||||
RCD_ENABLE_XLX,
|
||||
RCD_DISABLE_NETWORK1,
|
||||
RCD_DISABLE_NETWORK2,
|
||||
RCD_DISABLE_NETWORK3,
|
||||
RCD_DISABLE_NETWORK4,
|
||||
RCD_DISABLE_NETWORK5,
|
||||
RCD_DISABLE_XLX,
|
||||
RCD_CONNECTION_STATUS,
|
||||
RCD_CONFIG_HOSTS,
|
||||
RCD_NONE
|
||||
enum class REMOTE_COMMAND {
|
||||
ENABLE_NETWORK1,
|
||||
ENABLE_NETWORK2,
|
||||
ENABLE_NETWORK3,
|
||||
ENABLE_NETWORK4,
|
||||
ENABLE_NETWORK5,
|
||||
ENABLE_XLX,
|
||||
DISABLE_NETWORK1,
|
||||
DISABLE_NETWORK2,
|
||||
DISABLE_NETWORK3,
|
||||
DISABLE_NETWORK4,
|
||||
DISABLE_NETWORK5,
|
||||
DISABLE_XLX,
|
||||
CONNECTION_STATUS,
|
||||
CONFIG_HOSTS,
|
||||
NONE
|
||||
};
|
||||
|
||||
class CDMRGateway;
|
||||
|
|
|
|||
10
Rewrite.cpp
10
Rewrite.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
CRewrite::CRewrite() :
|
||||
m_lc(),
|
||||
m_embeddedLC(),
|
||||
m_data(NULL),
|
||||
m_data(nullptr),
|
||||
m_writeNum(0U),
|
||||
m_readNum(0U),
|
||||
m_lastN(0U)
|
||||
|
|
@ -113,7 +113,7 @@ void CRewrite::processEmbeddedData(unsigned char* data, unsigned char n)
|
|||
FLCO flco = m_data[m_readNum].getFLCO();
|
||||
|
||||
// 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);
|
||||
else
|
||||
lcss = m_data[m_readNum].getData(data, n);
|
||||
|
|
@ -196,7 +196,7 @@ void CRewrite::processDataHeader(CDMRData& data)
|
|||
if (!ret)
|
||||
return;
|
||||
|
||||
dataHeader.setGI(data.getFLCO() == FLCO_GROUP);
|
||||
dataHeader.setGI(data.getFLCO() == FLCO::GROUP);
|
||||
dataHeader.setSrcId(data.getSrcId());
|
||||
dataHeader.setDstId(data.getDstId());
|
||||
|
||||
|
|
@ -220,7 +220,7 @@ void CRewrite::processCSBK(CDMRData& data)
|
|||
if (!ret)
|
||||
return;
|
||||
|
||||
csbk.setGI(data.getFLCO() == FLCO_GROUP);
|
||||
csbk.setGI(data.getFLCO() == FLCO::GROUP);
|
||||
csbk.setSrcId(data.getSrcId());
|
||||
csbk.setDstId(data.getDstId());
|
||||
|
||||
|
|
|
|||
10
Rewrite.h
10
Rewrite.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -23,10 +23,10 @@
|
|||
#include "DMRData.h"
|
||||
#include "DMRLC.h"
|
||||
|
||||
enum PROCESS_RESULT {
|
||||
RESULT_UNMATCHED,
|
||||
RESULT_MATCHED,
|
||||
RESULT_IGNORED
|
||||
enum class PROCESS_RESULT {
|
||||
UNMATCHED,
|
||||
MATCHED,
|
||||
IGNORED
|
||||
};
|
||||
|
||||
class CRewrite {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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();
|
||||
unsigned int dstId = data.getDstId();
|
||||
|
||||
if (flco != FLCO_USER_USER || dstId != m_fromId) {
|
||||
if (flco != FLCO::USER_USER || dstId != m_fromId) {
|
||||
if (trace)
|
||||
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);
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 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)
|
||||
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);
|
||||
|
|
@ -58,7 +58,7 @@ PROCESS_RESULT CRewriteDynTGNet::process(CDMRData& data, bool trace)
|
|||
if (trace)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -40,7 +40,7 @@ m_voice(voice),
|
|||
m_currentTG(0U)
|
||||
{
|
||||
assert(slot == 1U || slot == 2U);
|
||||
assert(rewriteNet != NULL);
|
||||
assert(rewriteNet != nullptr);
|
||||
}
|
||||
|
||||
CRewriteDynTGRF::~CRewriteDynTGRF()
|
||||
|
|
@ -54,7 +54,7 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
|
|||
unsigned int slotNo = data.getSlotNo();
|
||||
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)
|
||||
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);
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
} 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);
|
||||
|
||||
if (m_currentTG != 0U) {
|
||||
data.setFLCO(FLCO_GROUP);
|
||||
data.setFLCO(FLCO::GROUP);
|
||||
|
||||
processMessage(data);
|
||||
|
||||
if (type == DT_TERMINATOR_WITH_LC) {
|
||||
m_rewriteNet->setCurrentTG(0U);
|
||||
m_currentTG = 0U;
|
||||
if (m_voice != NULL)
|
||||
if (m_voice != nullptr)
|
||||
m_voice->unlinked();
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
} else {
|
||||
return RESULT_IGNORED;
|
||||
return PROCESS_RESULT::IGNORED;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -95,21 +95,21 @@ PROCESS_RESULT CRewriteDynTGRF::process(CDMRData& data, bool trace)
|
|||
if (trace)
|
||||
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)
|
||||
m_voice->unlinked();
|
||||
else
|
||||
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 (trace)
|
||||
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) {
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
data.setFLCO(FLCO_GROUP);
|
||||
data.setFLCO(FLCO::GROUP);
|
||||
|
||||
processMessage(data);
|
||||
|
||||
if (type == DT_TERMINATOR_WITH_LC) {
|
||||
m_rewriteNet->setCurrentTG(dstId);
|
||||
m_currentTG = dstId;
|
||||
if (m_voice != NULL)
|
||||
if (m_voice != nullptr)
|
||||
m_voice->linkedTo(dstId);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return RESULT_UNMATCHED;
|
||||
return PROCESS_RESULT::UNMATCHED;
|
||||
}
|
||||
|
||||
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) {
|
||||
m_currentTG = 0U;
|
||||
m_rewriteNet->setCurrentTG(0U);
|
||||
if (m_voice != NULL)
|
||||
if (m_voice != nullptr)
|
||||
m_voice->unlinked();
|
||||
}
|
||||
return;
|
||||
|
|
@ -166,7 +166,7 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
|
|||
if (m_currentTG != tg) {
|
||||
m_currentTG = tg;
|
||||
m_rewriteNet->setCurrentTG(tg);
|
||||
if (m_voice != NULL)
|
||||
if (m_voice != nullptr)
|
||||
m_voice->linkedTo(tg);
|
||||
}
|
||||
return;
|
||||
|
|
@ -175,6 +175,6 @@ void CRewriteDynTGRF::tgChange(unsigned int slot, unsigned int tg)
|
|||
|
||||
void CRewriteDynTGRF::stopVoice(unsigned int slot)
|
||||
{
|
||||
if (slot == m_slot && m_voice != NULL)
|
||||
if (slot == m_slot && m_voice != nullptr)
|
||||
m_voice->abort();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 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)
|
||||
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)
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 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)
|
||||
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)
|
||||
data.setSlotNo(m_toSlot);
|
||||
|
||||
data.setDstId(m_toTG);
|
||||
data.setFLCO(FLCO_GROUP);
|
||||
data.setFLCO(FLCO::GROUP);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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)
|
||||
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);
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 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 (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);
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
||||
return RESULT_UNMATCHED;
|
||||
return PROCESS_RESULT::UNMATCHED;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 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 (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);
|
||||
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);
|
||||
}
|
||||
return RESULT_UNMATCHED;
|
||||
return PROCESS_RESULT::UNMATCHED;
|
||||
}
|
||||
|
||||
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;
|
||||
data.setDstId(newDstId);
|
||||
}
|
||||
data.setFLCO(FLCO_USER_USER);
|
||||
data.setFLCO(FLCO::USER_USER);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
return RESULT_MATCHED;
|
||||
return PROCESS_RESULT::MATCHED;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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) :
|
||||
m_length(length),
|
||||
m_name(name),
|
||||
m_buffer(NULL),
|
||||
m_buffer(nullptr),
|
||||
m_iPtr(0U),
|
||||
m_oPtr(0U)
|
||||
{
|
||||
assert(length > 0U);
|
||||
assert(name != NULL);
|
||||
assert(name != nullptr);
|
||||
|
||||
m_buffer = new T[length];
|
||||
|
||||
|
|
|
|||
24
SHA256.cpp
24
SHA256.cpp
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2005, 2006, 2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011,2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2005,2006,2008 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011,2015,2025 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -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
|
||||
*/
|
||||
CSHA256::CSHA256() :
|
||||
m_state(NULL),
|
||||
m_total(NULL),
|
||||
m_state(nullptr),
|
||||
m_total(nullptr),
|
||||
m_buflen(0U),
|
||||
m_buffer(NULL)
|
||||
m_buffer(nullptr)
|
||||
{
|
||||
m_state = new uint32_t[8U];
|
||||
m_total = new uint32_t[2U];
|
||||
|
|
@ -85,7 +85,7 @@ void CSHA256::init()
|
|||
* (uint32_t *) cp = v */
|
||||
static inline void set_uint32(unsigned char* cp, uint32_t v)
|
||||
{
|
||||
assert(cp != NULL);
|
||||
assert(cp != nullptr);
|
||||
|
||||
::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. */
|
||||
unsigned char* CSHA256::read(unsigned char* resbuf)
|
||||
{
|
||||
assert(resbuf != NULL);
|
||||
assert(resbuf != nullptr);
|
||||
|
||||
for (unsigned int i = 0U; i < 8U; 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)
|
||||
{
|
||||
assert(resbuf != NULL);
|
||||
assert(resbuf != nullptr);
|
||||
|
||||
conclude();
|
||||
|
||||
|
|
@ -142,8 +142,8 @@ unsigned char* CSHA256::finish(unsigned char* resbuf)
|
|||
digest. */
|
||||
unsigned char* CSHA256::buffer(const unsigned char* buffer, unsigned int len, unsigned char* resblock)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(resblock != NULL);
|
||||
assert(buffer != nullptr);
|
||||
assert(resblock != nullptr);
|
||||
|
||||
/* Initialize the computation context. */
|
||||
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)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
|
|
@ -252,7 +252,7 @@ static const uint32_t roundConstants[64] = {
|
|||
|
||||
void CSHA256::processBlock(const unsigned char* buffer, unsigned int len)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
|
||||
const uint32_t* words = (uint32_t*)buffer;
|
||||
unsigned int nwords = len / sizeof(uint32_t);
|
||||
|
|
|
|||
8
SHA256.h
8
SHA256.h
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011,2015,2016 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2005,2006,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2011,2015,2016,2025 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
enum {
|
||||
SHA256_DIGEST_SIZE = 256 / 8
|
||||
};
|
||||
const unsigned int SHA256_DIGEST_SIZE = 256U / 8U;
|
||||
|
||||
class CSHA256 {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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
|
||||
{
|
||||
struct timeval now;
|
||||
::gettimeofday(&now, NULL);
|
||||
::gettimeofday(&now, nullptr);
|
||||
|
||||
return now.tv_sec * 1000ULL + now.tv_usec / 1000ULL;
|
||||
}
|
||||
|
|
|
|||
6
Sync.cpp
6
Sync.cpp
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (duplex) {
|
||||
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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (duplex) {
|
||||
for (unsigned int i = 0U; i < 7U; i++)
|
||||
|
|
|
|||
14
Thread.cpp
14
Thread.cpp
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -31,9 +31,9 @@ CThread::~CThread()
|
|||
|
||||
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()
|
||||
{
|
||||
return ::pthread_create(&m_thread, NULL, helper, this) == 0;
|
||||
return ::pthread_create(&m_thread, nullptr, helper, this) == 0;
|
||||
}
|
||||
|
||||
|
||||
void CThread::wait()
|
||||
{
|
||||
::pthread_join(m_thread, NULL);
|
||||
::pthread_join(m_thread, nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ void* CThread::helper(void* arg)
|
|||
|
||||
p->entry();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CThread::sleep(unsigned int ms)
|
||||
|
|
@ -100,7 +100,7 @@ void CThread::sleep(unsigned int ms)
|
|||
ts.tv_sec = ms / 1000U;
|
||||
ts.tv_nsec = (ms % 1000U) * 1000000U;
|
||||
|
||||
::nanosleep(&ts, NULL);
|
||||
::nanosleep(&ts, nullptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* 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 */
|
||||
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) {
|
||||
sockaddr_in* paddr = (sockaddr_in*)&addr;
|
||||
::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)
|
||||
return false;
|
||||
|
||||
if (type == IMT_ADDRESS_AND_PORT) {
|
||||
if (type == IPMATCHTYPE::ADDRESS_AND_PORT) {
|
||||
switch (addr1.ss_family) {
|
||||
case AF_INET:
|
||||
struct sockaddr_in *in_1, *in_2;
|
||||
|
|
@ -134,7 +134,7 @@ bool CUDPSocket::match(const sockaddr_storage& addr1, const sockaddr_storage& ad
|
|||
default:
|
||||
return false;
|
||||
}
|
||||
} else if (type == IMT_ADDRESS_ONLY) {
|
||||
} else if (type == IPMATCHTYPE::ADDRESS_ONLY) {
|
||||
switch (addr1.ss_family) {
|
||||
case AF_INET:
|
||||
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)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
assert(length > 0U);
|
||||
|
||||
#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)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
assert(buffer != nullptr);
|
||||
assert(length > 0U);
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
assert(m_fd != INVALID_SOCKET);
|
||||
|
|
|
|||
10
UDPSocket.h
10
UDPSocket.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -35,9 +35,9 @@
|
|||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
enum IPMATCHTYPE {
|
||||
IMT_ADDRESS_AND_PORT,
|
||||
IMT_ADDRESS_ONLY
|
||||
enum class IPMATCHTYPE {
|
||||
ADDRESS_AND_PORT,
|
||||
ADDRESS_ONLY
|
||||
};
|
||||
|
||||
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, 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);
|
||||
|
||||
|
|
|
|||
18
Utils.cpp
18
Utils.cpp
|
|
@ -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
|
||||
* 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)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(data != nullptr);
|
||||
|
||||
dump(2U, title, data, 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());
|
||||
|
||||
|
|
@ -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)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
dump(2U, title, bits, 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 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)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
bits[0U] = (byte & 0x80U) == 0x80U;
|
||||
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)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
bits[0U] = (byte & 0x01U) == 0x01U;
|
||||
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)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
byte = bits[0U] ? 0x80U : 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)
|
||||
{
|
||||
assert(bits != NULL);
|
||||
assert(bits != nullptr);
|
||||
|
||||
byte = bits[0U] ? 0x01U : 0x00U;
|
||||
byte |= bits[1U] ? 0x02U : 0x00U;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -19,6 +19,6 @@
|
|||
#if !defined(VERSION_H)
|
||||
#define VERSION_H
|
||||
|
||||
const char* VERSION = "20240831";
|
||||
const char* VERSION = "20250315";
|
||||
|
||||
#endif
|
||||
|
|
|
|||
36
XLXVoice.cpp
36
XLXVoice.cpp
|
|
@ -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
|
||||
* 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_ambeFile(),
|
||||
m_slot(slot),
|
||||
m_lc(FLCO_GROUP, id, tg),
|
||||
m_lc(FLCO::GROUP, id, tg),
|
||||
m_embeddedLC(),
|
||||
m_status(XLXVS_NONE),
|
||||
m_status(XLXVOICE_STATUS::NONE),
|
||||
m_timer(1000U, 1U),
|
||||
m_stopWatch(),
|
||||
m_seqNo(0U),
|
||||
m_streamId(0U),
|
||||
m_sent(0U),
|
||||
m_ambe(NULL),
|
||||
m_ambe(nullptr),
|
||||
m_positions(),
|
||||
m_data(),
|
||||
m_it()
|
||||
|
|
@ -80,7 +80,7 @@ CXLXVoice::~CXLXVoice()
|
|||
bool CXLXVoice::open()
|
||||
{
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
|
|
@ -94,7 +94,7 @@ bool CXLXVoice::open()
|
|||
}
|
||||
|
||||
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());
|
||||
::fclose(fpindx);
|
||||
return false;
|
||||
|
|
@ -105,12 +105,12 @@ bool CXLXVoice::open()
|
|||
size_t sizeRead = ::fread(m_ambe, 1U, statStruct.st_size, fpambe);
|
||||
if (sizeRead != 0U) {
|
||||
char buffer[80U];
|
||||
while (::fgets(buffer, 80, fpindx) != NULL) {
|
||||
while (::fgets(buffer, 80, fpindx) != nullptr) {
|
||||
char* p1 = ::strtok(buffer, "\t\r\n");
|
||||
char* p2 = ::strtok(NULL, "\t\r\n");
|
||||
char* p3 = ::strtok(NULL, "\t\r\n");
|
||||
char* p2 = ::strtok(nullptr, "\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);
|
||||
unsigned int start = ::atoi(p2) * 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;
|
||||
|
||||
data->setSlotNo(m_slot);
|
||||
data->setFLCO(FLCO_GROUP);
|
||||
data->setFLCO(FLCO::GROUP);
|
||||
data->setSrcId(m_lc.getSrcId());
|
||||
data->setDstId(m_lc.getDstId());
|
||||
data->setN(n);
|
||||
|
|
@ -266,7 +266,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
|
|||
|
||||
delete[] ambeData;
|
||||
|
||||
m_status = XLXVS_WAITING;
|
||||
m_status = XLXVOICE_STATUS::WAITING;
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ void CXLXVoice::reset()
|
|||
delete *it;
|
||||
|
||||
m_timer.stop();
|
||||
m_status = XLXVS_NONE;
|
||||
m_status = XLXVOICE_STATUS::NONE;
|
||||
m_data.clear();
|
||||
m_seqNo = 0U;
|
||||
m_streamId = 0U;
|
||||
|
|
@ -285,7 +285,7 @@ void CXLXVoice::reset()
|
|||
|
||||
bool CXLXVoice::read(CDMRData& data)
|
||||
{
|
||||
if (m_status != XLXVS_SENDING)
|
||||
if (m_status != XLXVOICE_STATUS::SENDING)
|
||||
return false;
|
||||
|
||||
unsigned int count = m_stopWatch.elapsed() / DMR_SLOT_TIME;
|
||||
|
|
@ -301,7 +301,7 @@ bool CXLXVoice::read(CDMRData& data)
|
|||
delete *it;
|
||||
m_data.clear();
|
||||
m_timer.stop();
|
||||
m_status = XLXVS_NONE;
|
||||
m_status = XLXVOICE_STATUS::NONE;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -314,9 +314,9 @@ void CXLXVoice::clock(unsigned int ms)
|
|||
{
|
||||
m_timer.clock(ms);
|
||||
if (m_timer.isRunning() && m_timer.hasExpired()) {
|
||||
if (m_status == XLXVS_WAITING) {
|
||||
if (m_status == XLXVOICE_STATUS::WAITING) {
|
||||
m_stopWatch.start();
|
||||
m_status = XLXVS_SENDING;
|
||||
m_status = XLXVOICE_STATUS::SENDING;
|
||||
m_it = m_data.begin();
|
||||
m_sent = 0U;
|
||||
}
|
||||
|
|
@ -328,7 +328,7 @@ void CXLXVoice::createHeaderTerminator(unsigned char type)
|
|||
CDMRData* data = new CDMRData;
|
||||
|
||||
data->setSlotNo(m_slot);
|
||||
data->setFLCO(FLCO_GROUP);
|
||||
data->setFLCO(FLCO::GROUP);
|
||||
data->setSrcId(m_lc.getSrcId());
|
||||
data->setDstId(m_lc.getDstId());
|
||||
data->setDataType(type);
|
||||
|
|
|
|||
10
XLXVoice.h
10
XLXVoice.h
|
|
@ -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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -29,10 +29,10 @@
|
|||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
enum XLXVOICE_STATUS {
|
||||
XLXVS_NONE,
|
||||
XLXVS_WAITING,
|
||||
XLXVS_SENDING
|
||||
enum class XLXVOICE_STATUS {
|
||||
NONE,
|
||||
WAITING,
|
||||
SENDING
|
||||
};
|
||||
|
||||
struct CXLXPositions {
|
||||
|
|
|
|||
Loading…
Reference in a new issue