pub struct MessageHeader {
pub segment_size: u16,
pub redundant_channel: u8,
pub message_type: u8,
pub sequence_number: u16,
pub date: u16,
pub time: u32,
pub segment_count: u16,
pub segment_number: u16,
/* private fields */
}Expand description
Message and system configuration information appended to the beginning of all messages.
Note that messages with a segment size of VARIABLE_LENGTH_MESSAGE_SIZE are not segmented and instead variable-length, with the segment count and segment number positions of the header (bytes 12-15) specifying the size of the full message in bytes.
Fields§
§segment_size: u16Size of this segment in half-words. Note that this only describes this segment’s size, though there could be multiple segments. In the case of a variable-length message (indicated by this field being set to VARIABLE_LENGTH_MESSAGE_SIZE), the full message’s size is determined differently. See MessageHeader::message_size_bytes and MessageHeader::segment_count for more information.
redundant_channel: u8Whether the RDA is operating on a redundant channel.
Legacy: 0 = Single Channel (no bits set) 1 = Redundant Channel 1 (bit 0 set) 2 = Redundant Channel 2 (bit 1 set) ORDA 8 = Single Channel (bit 3 set) 9 = Redundant Channel 1 (bits 0 and 3 set) 10 = Redundant Channel 2 (bits 1 and 3 set)
message_type: u8Type discriminator.
sequence_number: u16Message sequence number.
date: u16This message’s date represented as a count of days since 1 January 1970 00:00 GMT. It is also referred-to as a “modified Julian date” where it is the Julian date - 2440586.5.
time: u32Milliseconds past midnight, GMT.
segment_count: u16Number of segments in this message. If the MessageHeader::segment_size is less than VARIABLE_LENGTH_MESSAGE_SIZE, this field is meaningful, otherwise bytes 12-15 (this field and MessageHeader::segment_number) specify the size of the message in bytes.
segment_number: u16This message segment’s number. If the MessageHeader::segment_size is less than VARIABLE_LENGTH_MESSAGE_SIZE, this field is meaningful, otherwise, bytes 12-15 (this field and MessageHeader::segment_number) specify the size of the message in bytes.
Implementations§
Source§impl MessageHeader
impl MessageHeader
Sourcepub fn segment_size(&self) -> Option<Information>
pub fn segment_size(&self) -> Option<Information>
If this message is MessageHeader::segmented, this indicates this message segment’s size. Otherwise, this returns None and MessageHeader::message_size should be used to determine the message’s full size.
Sourcepub fn rda_redundant_channel(&self) -> RedundantChannel
pub fn rda_redundant_channel(&self) -> RedundantChannel
Whether the RDA is operating on a redundant channel.
Sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
Message type discriminator.
Sourcepub fn segmented(&self) -> bool
pub fn segmented(&self) -> bool
Whether this message is segmented or variable-length. If the message is segmented, multiple message segments compose the full message. If the message is variable-length as indicated by the MessageHeader::segment_size field being set to VARIABLE_LENGTH_MESSAGE_SIZE, the full message size can be retrieved by MessageHeader::message_size_bytes.
Sourcepub fn segment_count(&self) -> Option<u16>
pub fn segment_count(&self) -> Option<u16>
If the message is MessageHeader::segmented, this indicates the number of segments in the full message, otherwise this returns None. MessageHeader::message_size_bytes can be used to determine the message’s full size.
Sourcepub fn segment_number(&self) -> Option<u16>
pub fn segment_number(&self) -> Option<u16>
If the message is MessageHeader::segmented, this indicates this segment’s number/sequence in the message, otherwise this returns None. MessageHeader::message_size_bytes can be used to determine the message’s full size.
Sourcepub fn message_size_bytes(&self) -> u32
pub fn message_size_bytes(&self) -> u32
The full size of the message in bytes. If the message is MessageHeader::segmented then this is the segment size, otherwise this is the full variable-length message size.
Sourcepub fn message_size(&self) -> Information
pub fn message_size(&self) -> Information
The full size of the message. If the message is MessageHeader::segmented then this is the segment size, otherwise this is the full variable-length message size.
Trait Implementations§
Source§impl Clone for MessageHeader
impl Clone for MessageHeader
Source§fn clone(&self) -> MessageHeader
fn clone(&self) -> MessageHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageHeader
Available on crate feature uom only.
impl Debug for MessageHeader
uom only.