diff --git a/NXDNControl.cpp b/NXDNControl.cpp index 3231d0fd1..28868214e 100644 --- a/NXDNControl.cpp +++ b/NXDNControl.cpp @@ -679,7 +679,7 @@ void CNXDNControl::writeNetwork() CSync::addNXDNSync(data + 2U); CNXDNLICH lich; - lich.setData(netData[0U]); + lich.setRaw(netData[0U]); unsigned char usc = lich.getFCT(); unsigned char option = lich.getOption(); lich.setDirection(m_remoteGateway ? NXDN_LICH_DIRECTION_INBOUND : NXDN_LICH_DIRECTION_OUTBOUND); diff --git a/NXDNFACCH1.cpp b/NXDNFACCH1.cpp index 7f9c7c317..e8e04bcdc 100644 --- a/NXDNFACCH1.cpp +++ b/NXDNFACCH1.cpp @@ -148,17 +148,21 @@ void CNXDNFACCH1::encode(unsigned char* data, unsigned int offset) const } } -void CNXDNFACCH1::getData(unsigned char* data, bool checksum) const +void CNXDNFACCH1::getData(unsigned char* data) const { assert(data != NULL); - if (checksum) { - ::memset(data, 0x00U, 12U); - ::memcpy(data, m_data, 10U); - CNXDNCRC::encodeCRC12(data, 80U); - } else { - ::memcpy(data, m_data, 10U); - } + ::memcpy(data, m_data, 10U); +} + +void CNXDNFACCH1::getRaw(unsigned char* data) const +{ + assert(data != NULL); + + ::memset(data, 0x00U, 12U); + ::memcpy(data, m_data, 10U); + + CNXDNCRC::encodeCRC12(data, 80U); } void CNXDNFACCH1::setData(const unsigned char* data) @@ -168,6 +172,13 @@ void CNXDNFACCH1::setData(const unsigned char* data) ::memcpy(m_data, data, 10U); } +void CNXDNFACCH1::setRaw(const unsigned char* data) +{ + assert(data != NULL); + + ::memcpy(m_data, data, 12U); +} + CNXDNFACCH1& CNXDNFACCH1::operator=(const CNXDNFACCH1& facch1) { if (&facch1 != this) diff --git a/NXDNFACCH1.h b/NXDNFACCH1.h index 0a9a88125..db56ec1c6 100644 --- a/NXDNFACCH1.h +++ b/NXDNFACCH1.h @@ -29,9 +29,11 @@ class CNXDNFACCH1 { void encode(unsigned char* data, unsigned int offset) const; - void getData(unsigned char* data, bool checksum = false) const; + void getData(unsigned char* data) const; + void getRaw(unsigned char* data) const; void setData(const unsigned char* data); + void setRaw(const unsigned char* data); CNXDNFACCH1& operator=(const CNXDNFACCH1& facch); diff --git a/NXDNLICH.cpp b/NXDNLICH.cpp index 9b3595111..a61c72bb7 100644 --- a/NXDNLICH.cpp +++ b/NXDNLICH.cpp @@ -107,7 +107,7 @@ unsigned char CNXDNLICH::getDirection() const return (m_lich[0U] >> 1) & 0x01U; } -unsigned char CNXDNLICH::getData() const +unsigned char CNXDNLICH::getRaw() const { return m_lich[0U]; } @@ -136,7 +136,7 @@ void CNXDNLICH::setDirection(unsigned char direction) m_lich[0U] |= (direction << 1) & 0x02U; } -void CNXDNLICH::setData(unsigned char lich) +void CNXDNLICH::setRaw(unsigned char lich) { m_lich[0U] = lich; } diff --git a/NXDNLICH.h b/NXDNLICH.h index 65c63b643..ab220a16f 100644 --- a/NXDNLICH.h +++ b/NXDNLICH.h @@ -33,13 +33,13 @@ class CNXDNLICH { unsigned char getFCT() const; unsigned char getOption() const; unsigned char getDirection() const; - unsigned char getData() const; + unsigned char getRaw() const; void setRFCT(unsigned char rfct); void setFCT(unsigned char usc); void setOption(unsigned char option); void setDirection(unsigned char direction); - void setData(unsigned char lich); + void setRaw(unsigned char lich); CNXDNLICH& operator=(const CNXDNLICH& lich); diff --git a/NXDNSACCH.cpp b/NXDNSACCH.cpp index 6c94bada4..69795c340 100755 --- a/NXDNSACCH.cpp +++ b/NXDNSACCH.cpp @@ -155,22 +155,26 @@ unsigned char CNXDNSACCH::getStructure() const return (m_data[0U] >> 6) & 0x03U; } -void CNXDNSACCH::getData(unsigned char* data, bool checksum) const +void CNXDNSACCH::getData(unsigned char* data) const { assert(data != NULL); - if (checksum) { - ::memcpy(data, m_data, 4U); - CNXDNCRC::encodeCRC6(data, 26U); - } else { - unsigned int offset = 8U; - for (unsigned int i = 0U; i < 18U; i++, offset++) { - bool b = READ_BIT1(m_data, offset); - WRITE_BIT1(data, i, b); - } + unsigned int offset = 8U; + for (unsigned int i = 0U; i < 18U; i++, offset++) { + bool b = READ_BIT1(m_data, offset); + WRITE_BIT1(data, i, b); } } +void CNXDNSACCH::getRaw(unsigned char* data) const +{ + assert(data != NULL); + + ::memcpy(data, m_data, 4U); + + CNXDNCRC::encodeCRC6(data, 26U); +} + void CNXDNSACCH::setRAN(unsigned char ran) { m_data[0U] &= 0xC0U; @@ -194,6 +198,13 @@ void CNXDNSACCH::setData(const unsigned char* data) } } +void CNXDNSACCH::setRaw(const unsigned char* data) +{ + assert(data != NULL); + + ::memcpy(m_data, data, 4U); +} + CNXDNSACCH& CNXDNSACCH::operator=(const CNXDNSACCH& sacch) { if (&sacch != this) diff --git a/NXDNSACCH.h b/NXDNSACCH.h index c2087458c..8d6f44ac4 100644 --- a/NXDNSACCH.h +++ b/NXDNSACCH.h @@ -32,12 +32,14 @@ class CNXDNSACCH { unsigned char getRAN() const; unsigned char getStructure() const; - void getData(unsigned char* data, bool checksum = false) const; + void getData(unsigned char* data) const; + void getRaw(unsigned char* data) const; void setRAN(unsigned char ran); void setStructure(unsigned char structure); void setData(const unsigned char* data); + void setRaw(const unsigned char* data); CNXDNSACCH& operator=(const CNXDNSACCH& sacch); diff --git a/NXDNUDCH.cpp b/NXDNUDCH.cpp index 47d8413b5..55c81bf88 100644 --- a/NXDNUDCH.cpp +++ b/NXDNUDCH.cpp @@ -174,17 +174,21 @@ unsigned char CNXDNUDCH::getRAN() const return m_data[0U] & 0x3FU; } -void CNXDNUDCH::getData(unsigned char* data, bool checksum) const +void CNXDNUDCH::getData(unsigned char* data) const { assert(data != NULL); - if (checksum) { - ::memset(data, 0x00U, 25U); - ::memcpy(data, m_data, 23U); - CNXDNCRC::encodeCRC15(data, 184U); - } else { - ::memcpy(data, m_data + 1U, 22U); - } + ::memcpy(data, m_data + 1U, 22U); +} + +void CNXDNUDCH::getRaw(unsigned char* data) const +{ + assert(data != NULL); + + ::memset(data, 0x00U, 25U); + ::memcpy(data, m_data, 23U); + + CNXDNCRC::encodeCRC15(data, 184U); } void CNXDNUDCH::setRAN(unsigned char ran) @@ -199,6 +203,13 @@ void CNXDNUDCH::setData(const unsigned char* data) ::memcpy(m_data + 1U, data, 22U); } +void CNXDNUDCH::setRaw(const unsigned char* data) +{ + assert(data != NULL); + + ::memcpy(m_data, data, 25U); +} + CNXDNUDCH& CNXDNUDCH::operator=(const CNXDNUDCH& udch) { if (&udch != this) diff --git a/NXDNUDCH.h b/NXDNUDCH.h index 738c4693d..0db3bf67e 100644 --- a/NXDNUDCH.h +++ b/NXDNUDCH.h @@ -31,11 +31,13 @@ class CNXDNUDCH { unsigned char getRAN() const; - void getData(unsigned char* data, bool checksum = false) const; + void getData(unsigned char* data) const; + void getRaw(unsigned char* data) const; void setRAN(unsigned char ran); void setData(const unsigned char* data); + void setRaw(const unsigned char* data); CNXDNUDCH& operator=(const CNXDNUDCH& udch);