Parser for RailCom feedback that recognizes logon messages.
More...
#include <LogonFeedback.hxx>
|
| enum | Errors {
ERROR_SHIFT = 56
, ERROR_MASK = 0xffULL << ERROR_SHIFT
, LENGTH_SHIFT = 48
, LENGTH_OFFSET = 1ULL << LENGTH_SHIFT
,
LENGTH_MASK = 0xffULL << LENGTH_SHIFT
, PAYLOAD_MASK = LENGTH_OFFSET - 1
, ERROR_MISSING_DATA = 1ULL << ERROR_SHIFT
, ERROR_ACK = 2ULL << ERROR_SHIFT
,
ERROR_OUT_OF_ORDER = 4ULL << ERROR_SHIFT
, ERROR_GARBAGE = 8ULL << ERROR_SHIFT
, ERROR_UNKNOWN = 16ULL << ERROR_SHIFT
} |
| |
|
| static void | append_data (uint64_t &data, unsigned &shift, uint8_t next_byte) |
| | Appends 6 bits of incoming data from railcom.
|
| |
| static uint64_t | parse_code (const Feedback *fb) |
| | Parses a concatenated ch1+ch2 response into a single uint64_t.
|
| |
| static bool | has_crc_error (uint64_t data) |
| | Checks the CRC8 on a 6-byte payload in this feedback.
|
| |
|
| static MessageType * | cast_alloc (QMember *entry) |
| | Down casts and initializes an asynchronous allocation result to the appropriate flow's buffer type.
|
| |
Parser for RailCom feedback that recognizes logon messages.
Definition at line 96 of file LogonFeedback.hxx.
◆ PacketType
◆ Errors
| Enumerator |
|---|
| ERROR_SHIFT | Which bit offset do the error bits start.
|
| ERROR_MASK | Mask where the error bits are.
|
| LENGTH_SHIFT | Which bit offset do the error bits start.
|
| LENGTH_OFFSET | Counts the number of valid 6-bit counts.
|
| LENGTH_MASK | Which bit offset do the error bits start.
|
| PAYLOAD_MASK | Mask where the decoded payload is.
|
| ERROR_MISSING_DATA | Not enough bytes in the feedback response.
|
| ERROR_ACK | Found an ACK byte.
|
| ERROR_OUT_OF_ORDER | Found valid data past an ACK byte or a missing byte.
|
| ERROR_GARBAGE | Found invalid 6/8 code.
|
| ERROR_UNKNOWN | Found unknown codepoint (e.g. NACK or BUSY).
|
Definition at line 158 of file LogonFeedback.hxx.
◆ LogonFeedbackParser()
Constructor.
- Parameters
-
| cb | recognized packets get calls on this object. |
| hub | the railcom hub for gathering feedback. |
Definition at line 103 of file LogonFeedback.hxx.
◆ ~LogonFeedbackParser()
| dcc::LogonFeedbackParser::~LogonFeedbackParser |
( |
| ) |
|
|
inline |
◆ append_data()
| static void dcc::LogonFeedbackParser::append_data |
( |
uint64_t & |
data, |
|
|
unsigned & |
shift, |
|
|
uint8_t |
next_byte |
|
) |
| |
|
inlinestaticprivate |
Appends 6 bits of incoming data from railcom.
- Parameters
-
| data | the 48-bit aggregated data. |
| shift | where the next 6 bits should be at (0 to 42) |
| next_byte | the next byte from the uart. |
Definition at line 189 of file LogonFeedback.hxx.
◆ has_crc_error()
| static bool dcc::LogonFeedbackParser::has_crc_error |
( |
uint64_t |
data | ) |
|
|
inlinestaticprivate |
Checks the CRC8 on a 6-byte payload in this feedback.
- Parameters
-
| data | the feedback bytes (right aligned, first is MSB). |
- Returns
- true if there is a CRC error
Definition at line 259 of file LogonFeedback.hxx.
◆ parse_code()
| static uint64_t dcc::LogonFeedbackParser::parse_code |
( |
const Feedback * |
fb | ) |
|
|
inlinestaticprivate |
Parses a concatenated ch1+ch2 response into a single uint64_t.
It contains error flags in the MSB, the number of valid 6-bit codepoints in the second MSB , and 6 bytes data in the LSB, entered with the first wire byte in the third MSB and last wire byte in the LSB.
Any input byte that was missing or contained any other codepoint than a valid 6-bit data codepoint (including garbage or ACK) is translated into zero bits in the parse result.
- Parameters
-
- Returns
- parse result.
Definition at line 227 of file LogonFeedback.hxx.
◆ send()
◆ cb_
◆ hub_
The documentation for this class was generated from the following file: