Change the message length decision

Assume that DF0-DF15 are all short 56 bit messages
Assume that DF16-DF31 are all long 112 bit messages

This helps us error detect and error recover for bits in the first byte
This commit is contained in:
Malcolm Robb 2013-04-28 20:53:30 +01:00
parent 748f2f5e91
commit 7cf79580a4

View file

@ -1125,16 +1125,15 @@ uint32_t modesChecksum(unsigned char *msg, int bits) {
} }
return crc; // 24 bit checksum. return crc; // 24 bit checksum.
} }
//
/* Given the Downlink Format (DF) of the message, return the message length // Given the Downlink Format (DF) of the message, return the message length in bits.
* in bits. */ //
// All known DF's 16 or greater are long. All known DF's 15 or less are short.
// There are lots of unused codes in both category, so we can assume ICAO will stick to
// these rules, meaning that the most significant bit of the DF indicates the length.
//
int modesMessageLenByType(int type) { int modesMessageLenByType(int type) {
if (type == 16 || type == 17 || return (type & 0x10) ? MODES_LONG_MSG_BITS : MODES_SHORT_MSG_BITS ;
type == 19 || type == 20 ||
type == 21)
return MODES_LONG_MSG_BITS;
else
return MODES_SHORT_MSG_BITS;
} }
/* Try to fix single bit errors using the checksum. On success modifies /* Try to fix single bit errors using the checksum. On success modifies