Fix LICH processing.

This commit is contained in:
Jonathan Naylor
2018-01-23 23:23:05 +00:00
parent cf2f8ee3c8
commit d905de493d
3 changed files with 14 additions and 3 deletions

View File

@@ -39,6 +39,9 @@ const unsigned int NXDN_SACCH_LENGTH_BITS = 60U;
const unsigned int NXDN_FACCH1_LENGTH_BITS = 144U;
const unsigned int NXDN_FACCH2_LENGTH_BITS = 348U;
const unsigned int NXDN_FSW_LICH_SACCH_LENGTH_BITS = NXDN_FSW_LENGTH_BITS + NXDN_LICH_LENGTH_BITS + NXDN_SACCH_LENGTH_BITS;
const unsigned int NXDN_FSW_LICH_SACCH_LENGTH_BYTES = NXDN_FSW_LICH_SACCH_LENGTH_BITS / 8U;
const unsigned char NXDN_LICH_RFCT_RCCH = 0U;
const unsigned char NXDN_LICH_RFCT_RTCH = 1U;
const unsigned char NXDN_LICH_RFCT_RDCH = 2U;

View File

@@ -56,7 +56,7 @@ bool CNXDNLICH::decode(const unsigned char* bytes)
unsigned int offset2 = 7U;
for (unsigned int i = 0U; i < (NXDN_LICH_LENGTH_BITS / 2U); i++, offset1 += 2U, offset2--) {
b[offset2] = READ_BIT1(bytes, offset1);
WRITE_BIT1(lich, offset2, b[offset2]);
WRITE_BIT1(lich, i, b[offset2]);
}
bool parity = b[7U] ^ b[6U] ^ b[5U] ^ b[4U];

View File

@@ -178,7 +178,11 @@ void CNXDNSACCH::getData(unsigned char* data) const
{
assert(data != NULL);
::memcpy(data, m_data + 1U, 3U);
unsigned int offset = 8U;
for (unsigned int i = 0U; i < 18U; i++, offset++) {
bool b = READ_BIT1(data, offset);
WRITE_BIT1(m_data, i, b);
}
}
void CNXDNSACCH::setRAN(unsigned char ran)
@@ -197,7 +201,11 @@ void CNXDNSACCH::setData(const unsigned char* data)
{
assert(data != NULL);
::memcpy(m_data + 1U, data, 3U);
unsigned int offset = 8U;
for (unsigned int i = 0U; i < 18U; i++, offset++) {
bool b = READ_BIT1(data, i);
WRITE_BIT1(m_data, offset, b);
}
}
CNXDNSACCH& CNXDNSACCH::operator=(const CNXDNSACCH& sacch)