Skip to main content

MessageHeader

Struct MessageHeader 

Source
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: u16

Size 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: u8

Whether 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: u8

Type discriminator.

§sequence_number: u16

Message sequence number.

§date: u16

This 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: u32

Milliseconds past midnight, GMT.

§segment_count: u16

Number 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: u16

This 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

Source

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.

Source

pub fn rda_redundant_channel(&self) -> RedundantChannel

Whether the RDA is operating on a redundant channel.

Source

pub fn message_type(&self) -> MessageType

Message type discriminator.

Source

pub fn date_time(&self) -> Option<DateTime<Utc>>

This message’s date and time in UTC.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> MessageHeader

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MessageHeader

Available on crate feature uom only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MessageHeader

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for MessageHeader

Source§

impl Hash for MessageHeader

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for MessageHeader

Source§

fn eq(&self, other: &MessageHeader) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MessageHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.