Skip to main content

Message

Trait Message 

Source
pub trait Message: Sized {
    const ID: u32;
    const NAME: &'static str;
    const CRC_EXTRA: u8;
    const WIRE_LEN: usize;
    const BASE_FIELDS: &'static [(&'static str, &'static str, u8)];
    const DESCRIPTOR: &'static MessageDescriptor<'static>;

    // Required methods
    fn encode(&self, out: &mut [u8]) -> usize;
    fn decode(payload: &[u8]) -> Result<Self>;
}
Expand description

A typed MAVLink message: its identity on the wire and how it serializes.

Implemented for every message this crate types, via the message! declaration macro.

Required Associated Constants§

Source

const ID: u32

The message id on the wire.

Source

const NAME: &'static str

The message name, such as "HEARTBEAT", as used to derive CRC_EXTRA.

Source

const CRC_EXTRA: u8

The CRC_EXTRA seed folded into the checksum of a frame carrying this message.

Source

const WIRE_LEN: usize

The full length, in bytes, of this message’s base fields on the wire.

Source

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

The base fields in wire order as (type, name, array_len), the input from which CRC_EXTRA is derived and against which it is verified.

Source

const DESCRIPTOR: &'static MessageDescriptor<'static>

The message’s shape as data: the runtime counterpart of this type’s fields, for a caller reading and writing by name rather than through the struct.

Required Methods§

Source

fn encode(&self, out: &mut [u8]) -> usize

Serializes the message into out, returning the number of bytes written.

§Arguments
  • out - the destination buffer, which must be at least WIRE_LEN bytes; a MAX_PAYLOAD-byte buffer always suffices.
§Returns

The number of bytes written, which is WIRE_LEN.

Source

fn decode(payload: &[u8]) -> Result<Self>

Deserializes the message from a payload.

A short payload is zero-extended, as MAVLink 2 truncation requires, and a payload longer than WIRE_LEN (one carrying extension fields) has its trailing bytes ignored.

§Arguments
  • payload - the frame payload to read.
§Returns

The decoded message.

§Errors

Returns MavlinkError::BadPayload if the payload cannot form the message.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Message for Attitude

Source§

const ID: u32 = 30

Source§

const NAME: &'static str = "ATTITUDE"

Source§

const CRC_EXTRA: u8 = 39

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for AttitudeQuaternion

Source§

const ID: u32 = 31

Source§

const NAME: &'static str = "ATTITUDE_QUATERNION"

Source§

const CRC_EXTRA: u8 = 246

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for AutopilotVersion

Source§

const ID: u32 = 148

Source§

const NAME: &'static str = "AUTOPILOT_VERSION"

Source§

const CRC_EXTRA: u8 = 178

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for BatteryStatus

Source§

const ID: u32 = 147

Source§

const NAME: &'static str = "BATTERY_STATUS"

Source§

const CRC_EXTRA: u8 = 154

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for CommandAck

Source§

const ID: u32 = 77

Source§

const NAME: &'static str = "COMMAND_ACK"

Source§

const CRC_EXTRA: u8 = 143

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for CommandInt

Source§

const ID: u32 = 75

Source§

const NAME: &'static str = "COMMAND_INT"

Source§

const CRC_EXTRA: u8 = 158

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for CommandLong

Source§

const ID: u32 = 76

Source§

const NAME: &'static str = "COMMAND_LONG"

Source§

const CRC_EXTRA: u8 = 152

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ExtendedSysState

Source§

const ID: u32 = 245

Source§

const NAME: &'static str = "EXTENDED_SYS_STATE"

Source§

const CRC_EXTRA: u8 = 130

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for GlobalPositionInt

Source§

const ID: u32 = 33

Source§

const NAME: &'static str = "GLOBAL_POSITION_INT"

Source§

const CRC_EXTRA: u8 = 104

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for GpsRawInt

Source§

const ID: u32 = 24

Source§

const NAME: &'static str = "GPS_RAW_INT"

Source§

const CRC_EXTRA: u8 = 24

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for Heartbeat

Source§

const ID: u32 = 0

Source§

const NAME: &'static str = "HEARTBEAT"

Source§

const CRC_EXTRA: u8 = 50

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for HomePosition

Source§

const ID: u32 = 242

Source§

const NAME: &'static str = "HOME_POSITION"

Source§

const CRC_EXTRA: u8 = 104

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for LocalPositionNed

Source§

const ID: u32 = 32

Source§

const NAME: &'static str = "LOCAL_POSITION_NED"

Source§

const CRC_EXTRA: u8 = 185

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ManualControl

Source§

const ID: u32 = 69

Source§

const NAME: &'static str = "MANUAL_CONTROL"

Source§

const CRC_EXTRA: u8 = 243

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionAck

Source§

const ID: u32 = 47

Source§

const NAME: &'static str = "MISSION_ACK"

Source§

const CRC_EXTRA: u8 = 153

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionClearAll

Source§

const ID: u32 = 45

Source§

const NAME: &'static str = "MISSION_CLEAR_ALL"

Source§

const CRC_EXTRA: u8 = 232

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionCount

Source§

const ID: u32 = 44

Source§

const NAME: &'static str = "MISSION_COUNT"

Source§

const CRC_EXTRA: u8 = 221

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionCurrent

Source§

const ID: u32 = 42

Source§

const NAME: &'static str = "MISSION_CURRENT"

Source§

const CRC_EXTRA: u8 = 28

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionItemInt

Source§

const ID: u32 = 73

Source§

const NAME: &'static str = "MISSION_ITEM_INT"

Source§

const CRC_EXTRA: u8 = 38

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionRequest

Source§

const ID: u32 = 40

Source§

const NAME: &'static str = "MISSION_REQUEST"

Source§

const CRC_EXTRA: u8 = 230

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionRequestInt

Source§

const ID: u32 = 51

Source§

const NAME: &'static str = "MISSION_REQUEST_INT"

Source§

const CRC_EXTRA: u8 = 196

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for MissionRequestList

Source§

const ID: u32 = 43

Source§

const NAME: &'static str = "MISSION_REQUEST_LIST"

Source§

const CRC_EXTRA: u8 = 132

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ParamRequestList

Source§

const ID: u32 = 21

Source§

const NAME: &'static str = "PARAM_REQUEST_LIST"

Source§

const CRC_EXTRA: u8 = 159

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ParamRequestRead

Source§

const ID: u32 = 20

Source§

const NAME: &'static str = "PARAM_REQUEST_READ"

Source§

const CRC_EXTRA: u8 = 214

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ParamSet

Source§

const ID: u32 = 23

Source§

const NAME: &'static str = "PARAM_SET"

Source§

const CRC_EXTRA: u8 = 168

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ParamValue

Source§

const ID: u32 = 22

Source§

const NAME: &'static str = "PARAM_VALUE"

Source§

const CRC_EXTRA: u8 = 220

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for Ping

Source§

const ID: u32 = 4

Source§

const NAME: &'static str = "PING"

Source§

const CRC_EXTRA: u8 = 237

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for RcChannels

Source§

const ID: u32 = 65

Source§

const NAME: &'static str = "RC_CHANNELS"

Source§

const CRC_EXTRA: u8 = 118

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for ServoOutputRaw

Source§

const ID: u32 = 36

Source§

const NAME: &'static str = "SERVO_OUTPUT_RAW"

Source§

const CRC_EXTRA: u8 = 222

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for SetMode

Source§

const ID: u32 = 11

Source§

const NAME: &'static str = "SET_MODE"

Source§

const CRC_EXTRA: u8 = 89

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for SetPositionTargetGlobalInt

Source§

const ID: u32 = 86

Source§

const NAME: &'static str = "SET_POSITION_TARGET_GLOBAL_INT"

Source§

const CRC_EXTRA: u8 = 5

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for SetPositionTargetLocalNed

Source§

const ID: u32 = 84

Source§

const NAME: &'static str = "SET_POSITION_TARGET_LOCAL_NED"

Source§

const CRC_EXTRA: u8 = 143

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for Statustext

Source§

const ID: u32 = 253

Source§

const NAME: &'static str = "STATUSTEXT"

Source§

const CRC_EXTRA: u8 = 83

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for SysStatus

Source§

const ID: u32 = 1

Source§

const NAME: &'static str = "SYS_STATUS"

Source§

const CRC_EXTRA: u8 = 124

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for SystemTime

Source§

const ID: u32 = 2

Source§

const NAME: &'static str = "SYSTEM_TIME"

Source§

const CRC_EXTRA: u8 = 137

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>

Source§

impl Message for VfrHud

Source§

const ID: u32 = 74

Source§

const NAME: &'static str = "VFR_HUD"

Source§

const CRC_EXTRA: u8 = 20

Source§

const WIRE_LEN: usize

Source§

const BASE_FIELDS: &'static [(&'static str, &'static str, u8)]

Source§

const DESCRIPTOR: &'static MessageDescriptor<'static>