pub struct Bbheader {
pub matype: Matype,
pub upl: u16,
pub sync: u8,
pub dfl: u16,
pub syncd: u16,
pub mode: Mode,
pub issy_in_header: Option<[u8; 3]>,
}Expand description
Parsed 10-byte BBHEADER.
Fields vary based on Mode:
- NM (MODE=0):
upl,syncare from the header;issy_in_headeris None. - HEM (MODE=1):
uplandsyncare both zero;issy_in_headercarries the 3 ISSY bytes that reuse the NM UPL/SYNC layout.
Detection: crc8(bytes[0..9]) ^ bytes[9] yields 0 for NM, 1 for HEM.
Fields§
§matype: MatypeMATYPE field.
upl: u16User Packet Length in bits (NM only; 0 in HEM).
sync: u8Copy of the User Packet Sync-byte (NM only; 0 in HEM).
dfl: u16Data Field Length in bits.
syncd: u16Distance in bits from DATA FIELD start to the first complete UP beginning.
mode: ModeDetected mode (NM vs HEM).
issy_in_header: Option<[u8; 3]>3-byte ISSY from header bytes (HEM only; None in NM).
Implementations§
Source§impl Bbheader
impl Bbheader
Sourcepub fn parse(bytes: &[u8]) -> Result<Self, Error>
pub fn parse(bytes: &[u8]) -> Result<Self, Error>
Parse a 10-byte BBHEADER, detecting NM vs HEM automatically.
Mode detection per EN 302 755 §5.1.7:
mode = crc8(bytes[0..9]) ^ bytes[9] (0 = NM, 1 = HEM).
Values other than 0 or 1 return Error::InvalidMode.
Sourcepub fn issy(&self) -> Option<Issy>
pub fn issy(&self) -> Option<Issy>
Decode the ISSY field from the header bytes (HEM only).
In HEM the 3-byte ISSY occupies the UPL/SYNC positions. This method
tries decode_issy_long first (the common case for 3-byte ISSY);
if that fails because the form bit indicates a short-form ISSY,
falls back to decode_issy_short on the first 2 bytes.
Returns None in Normal Mode (no ISSY in header) or if decoding
produces an unexpected error.
Trait Implementations§
impl Copy for Bbheader
impl Eq for Bbheader
Source§impl Serialize for Bbheader
impl Serialize for Bbheader
Source§type Error = Error
type Error = Error
Parse impl, but need not be).Source§fn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
serialize_into will write.