1
0
Fork 0

Convert the IMRS sequence number to little-endian.

ycs232-kbc
Jonathan Naylor 4 years ago
parent 47c9edb4fc
commit 9c1e4239ff

@ -124,9 +124,9 @@ bool CIMRSNetwork::writeHeaderTrailer(IMRSDGId* ptr, CYSFFICH& fich, const unsig
buffer[0U] = 0x33U;
}
// Copy the sequence number (2 bytes)
buffer[1U] = (ptr->m_seqNo << 8) & 0xFFU;
buffer[2U] = (ptr->m_seqNo << 0) & 0xFFU;
// Copy the sequence number LE (2 bytes)
buffer[1U] = (ptr->m_seqNo << 0) & 0xFFU;
buffer[2U] = (ptr->m_seqNo << 8) & 0xFFU;
// Copy CSD1 and CSD2 (40 bytes)
CYSFPayload payload;
@ -166,9 +166,9 @@ bool CIMRSNetwork::writeData(IMRSDGId* ptr, CYSFFICH& fich, const unsigned char*
buffer[0U] = 0x22U;
// Copy the sequence number (2 bytes)
buffer[1U] = (ptr->m_seqNo << 8) & 0xFFU;
buffer[2U] = (ptr->m_seqNo << 0) & 0xFFU;
// Copy the sequence number LE (2 bytes)
buffer[1U] = (ptr->m_seqNo << 0) & 0xFFU;
buffer[2U] = (ptr->m_seqNo << 8) & 0xFFU;
unsigned char dt = fich.getDT();
unsigned char ft = fich.getFT();
@ -272,7 +272,7 @@ void CIMRSNetwork::readHeaderTrailer(IMRSDGId* ptr, CYSFFICH& fich, const unsign
buffer[34U] = 0x00U;
} else {
uint16_t seqNo = (data[1U] << 8) + (data[2U] << 0);
uint16_t seqNo = (data[1U] << 0) + (data[2U] << 8);
buffer[34U] = 0x01U | ((seqNo & 0x7FU) << 1);
}
@ -309,7 +309,7 @@ void CIMRSNetwork::readData(IMRSDGId* ptr, CYSFFICH& fich, const unsigned char*
::memcpy(buffer + 14U, ptr->m_source, YSF_CALLSIGN_LENGTH);
::memcpy(buffer + 24U, ptr->m_dest, YSF_CALLSIGN_LENGTH);
uint16_t seqNo = (data[1U] << 8) + (data[2U] << 0);
uint16_t seqNo = (data[1U] << 0) + (data[2U] << 8);
buffer[34U] = (seqNo & 0x7FU) << 1;
::memcpy(buffer + 35U, YSF_SYNC_BYTES, YSF_SYNC_LENGTH_BYTES);

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200928";
const char* VERSION = "20200929";
#endif

Loading…
Cancel
Save