Update the C++ code.

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

View File

@@ -1,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;