diff --git a/M17Convolution.cpp b/M17Convolution.cpp index d9bf89d..16911cd 100644 --- a/M17Convolution.cpp +++ b/M17Convolution.cpp @@ -102,16 +102,16 @@ void CM17Convolution::encodeData(const unsigned char* in, unsigned char* out) co assert(in != NULL); assert(out != NULL); - unsigned char temp1[21U]; - ::memset(temp1, 0x00U, 21U); - ::memcpy(temp1, in, 20U); + unsigned char temp1[19U]; + ::memset(temp1, 0x00U, 19U); + ::memcpy(temp1, in, 18U); - unsigned char temp2[41U]; - encode(temp1, temp2, 164U); + unsigned char temp2[37U]; + encode(temp1, temp2, 148U); unsigned int n = 0U; unsigned int index = 0U; - for (unsigned int i = 0U; i < 328U; i++) { + for (unsigned int i = 0U; i < 296U; i++) { if (i != PUNCTURE_LIST_DATA[index]) { bool b = READ_BIT1(temp2, i); WRITE_BIT1(out, n, b); @@ -154,7 +154,7 @@ unsigned int CM17Convolution::decodeLinkSetup(const unsigned char* in, unsigned decode(s0, s1); } - return chainback(out, 240U) - PUNCTURE_LIST_LINK_SETUP_COUNT; + return chainback(out, 144U) - PUNCTURE_LIST_LINK_SETUP_COUNT; } unsigned int CM17Convolution::decodeData(const unsigned char* in, unsigned char* out) diff --git a/M17LSF.cpp b/M17LSF.cpp index e4e8d41..22b5a58 100644 --- a/M17LSF.cpp +++ b/M17LSF.cpp @@ -54,10 +54,6 @@ void CM17LSF::setNetwork(const unsigned char* data) std::string CM17LSF::getSource() const { - if (m_lsf[6U] == 0xFFU && m_lsf[7U] == 0xFFU && m_lsf[8U] == 0xFFU && - m_lsf[9U] == 0xFFU && m_lsf[10U] == 0xFFU && m_lsf[11U] == 0xFFU) - return "******"; - std::string callsign; CM17Utils::decodeCallsign(m_lsf + 6U, callsign); @@ -71,10 +67,6 @@ void CM17LSF::setSource(const std::string& callsign) std::string CM17LSF::getDest() const { - if (m_lsf[0U] == 0xFFU && m_lsf[1U] == 0xFFU && m_lsf[2U] == 0xFFU && - m_lsf[3U] == 0xFFU && m_lsf[4U] == 0xFFU && m_lsf[5U] == 0xFFU) - return "******"; - std::string callsign; CM17Utils::decodeCallsign(m_lsf + 0U, callsign); diff --git a/M17Utils.cpp b/M17Utils.cpp index 5a22adf..4462c9b 100644 --- a/M17Utils.cpp +++ b/M17Utils.cpp @@ -32,6 +32,16 @@ void CM17Utils::encodeCallsign(const std::string& callsign, unsigned char* encod { assert(encoded != NULL); + if (callsign == "ALL" || callsign == "ALL ") { + encoded[0U] = 0xFFU; + encoded[1U] = 0xFFU; + encoded[2U] = 0xFFU; + encoded[3U] = 0xFFU; + encoded[4U] = 0xFFU; + encoded[5U] = 0xFFU; + return; + } + unsigned int len = callsign.size(); if (len > 9U) len = 9U; @@ -60,6 +70,12 @@ void CM17Utils::decodeCallsign(const unsigned char* encoded, std::string& callsi callsign.clear(); + if (encoded[0U] == 0xFFU && encoded[1U] == 0xFFU && encoded[2U] == 0xFFU && + encoded[3U] == 0xFFU && encoded[4U] == 0xFFU && encoded[5U] == 0xFFU) { + callsign = "ALL"; + return; + } + uint64_t enc = (uint64_t(encoded[0U]) << 40) + (uint64_t(encoded[1U]) << 32) + diff --git a/Version.h b/Version.h index 5b7370a..d22c0a5 100644 --- a/Version.h +++ b/Version.h @@ -19,6 +19,6 @@ #if !defined(VERSION_H) #define VERSION_H -const char* VERSION = "20210701"; +const char* VERSION = "20210708"; #endif