pub struct MAVLinkV2MessageRaw(/* private fields */);
Expand description
Byte buffer containing the raw representation of a MAVLink 2 message beginning with the STX marker.
Follow protocol definition: https://mavlink.io/en/guide/serialization.html#mavlink2_packet_format. Maximum size is 280 bytes.
Implementations§
Source§impl MAVLinkV2MessageRaw
impl MAVLinkV2MessageRaw
Sourcepub const fn new() -> MAVLinkV2MessageRaw
pub const fn new() -> MAVLinkV2MessageRaw
Create an new raw MAVLink 2 message filled with zeros.
Sourcepub fn payload_length(&self) -> u8
pub fn payload_length(&self) -> u8
Size of the payload of the message
Sourcepub fn incompatibility_flags(&self) -> u8
pub fn incompatibility_flags(&self) -> u8
Incompatiblity flags of the message
Currently the only supported incompatebility flag is MAVLINK_IFLAG_SIGNED
.
Sourcepub fn incompatibility_flags_mut(&mut self) -> &mut u8
pub fn incompatibility_flags_mut(&mut self) -> &mut u8
Mutable reference to the incompatiblity flags of the message
Currently the only supported incompatebility flag is MAVLINK_IFLAG_SIGNED
.
Sourcepub fn compatibility_flags(&self) -> u8
pub fn compatibility_flags(&self) -> u8
Compatibility Flags of the message
Sourcepub fn component_id(&self) -> u8
pub fn component_id(&self) -> u8
Message sender Component ID
Sourcepub fn message_id(&self) -> u32
pub fn message_id(&self) -> u32
Message ID
Sourcepub fn checksum(&self) -> u16
pub fn checksum(&self) -> u16
CRC-16 checksum field of the message
Sourcepub fn checksum_bytes(&self) -> &[u8] ⓘ
pub fn checksum_bytes(&self) -> &[u8] ⓘ
Reference to the 2 checksum bytes of the message
Sourcepub fn signature_link_id(&self) -> u8
pub fn signature_link_id(&self) -> u8
Signature Link ID
If the message is not signed this 0.
Sourcepub fn signature_link_id_mut(&mut self) -> &mut u8
pub fn signature_link_id_mut(&mut self) -> &mut u8
Mutable reference to the signature Link ID
Sourcepub fn signature_timestamp(&self) -> u64
pub fn signature_timestamp(&self) -> u64
Message signature timestamp
The timestamp is a 48 bit number with units of 10 microseconds since 1st January 2015 GMT. The offset since 1st January 1970 (the unix epoch) is 1420070400 seconds. Since all timestamps generated must be at least 1 more than the previous timestamp this timestamp may get ahead of GMT time if there is a burst of packets at a rate of more than 100000 packets per second.
Sourcepub fn signature_timestamp_bytes(&self) -> &[u8] ⓘ
pub fn signature_timestamp_bytes(&self) -> &[u8] ⓘ
48 bit signature timestamp byte slice
If the message is not signed this contains zeros.
Sourcepub fn signature_timestamp_bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn signature_timestamp_bytes_mut(&mut self) -> &mut [u8] ⓘ
Mutable reference to the 48 bit signature timestams byte slice
Sourcepub fn signature_value(&self) -> &[u8] ⓘ
pub fn signature_value(&self) -> &[u8] ⓘ
Reference to the 48 bit message signature byte slice
If the message is not signed this contains zeros.
Sourcepub fn signature_value_mut(&mut self) -> &mut [u8] ⓘ
pub fn signature_value_mut(&mut self) -> &mut [u8] ⓘ
Mutable reference to the 48 bit message signature byte slice
Sourcepub fn has_valid_crc<M>(&self) -> boolwhere
M: Message,
pub fn has_valid_crc<M>(&self) -> boolwhere
M: Message,
Checks wether the message’s CRC-16 checksum calculation matches its checksum field.
Sourcepub fn calculate_signature(
&self,
secret_key: &[u8],
target_buffer: &mut [u8; 6],
)
pub fn calculate_signature( &self, secret_key: &[u8], target_buffer: &mut [u8; 6], )
Calculates the messages sha256_48 signature.
This calculates the SHA-256 checksum of messages appended to the 32 byte secret key and copies the first 6 bytes of the result into the target buffer.
Sourcepub fn serialize_message<M>(&mut self, header: MavHeader, message: &M)where
M: Message,
pub fn serialize_message<M>(&mut self, header: MavHeader, message: &M)where
M: Message,
Serialize a Message with a given header into this raw message buffer.
This does not set any compatiblity or incompatiblity flags.
Sourcepub fn serialize_message_for_signing<M>(
&mut self,
header: MavHeader,
message: &M,
)where
M: Message,
pub fn serialize_message_for_signing<M>(
&mut self,
header: MavHeader,
message: &M,
)where
M: Message,
Serialize a Message with a given header into this raw message buffer and sets the MAVLINK_IFLAG_SIGNED
incompatiblity flag.
This does not update the message’s signature fields. This does not set any compatiblity flags.
pub fn serialize_message_data<D>(&mut self, header: MavHeader, message_data: &D)where
D: MessageData,
Trait Implementations§
Source§impl Clone for MAVLinkV2MessageRaw
impl Clone for MAVLinkV2MessageRaw
Source§fn clone(&self) -> MAVLinkV2MessageRaw
fn clone(&self) -> MAVLinkV2MessageRaw
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more