Main Content

deserializemsg

Deserialize MAVLink message from binary buffer

Description

msg = deserializemsg(dialect,buffer) deserializes binary buffer data specified in buffer based on the specified MAVLink dialect. If a message is received as multiple buffers, you can combine them by concatenating the vectors in the proper order to get a valid message.

[msg,status] = deserializemsg(dialect,buffer,OutputAllMessage=true) returns all messages msg that can be deserialized from buffer, and the status status of each message. deserializemsg returns messages and statuses even if an error occurs during the signature check or checksum check.

Input Arguments

collapse all

MAVLink dialect, specified as a mavlinkdialect object, which contains a parsed dialect XML for MAVLink message definitions.

Serialized messaged, specified as vector of uint8 integers.

Data Types: uint8

Output Arguments

collapse all

MAVLink message, returned as a structure if OutputAllMessage is false, or a structure array if OutputAllMessage is true. Each message is a structure with the fields:

  • MsgID: Positive integer for message ID.

  • Payload: Structure containing fields for the specific message definition.

Statuses of messages, returned as an N-element row vector of integers in the range [0, 2]. N is the total number of messages in msg. The ith element of status corresponds to the parse state of the ith message in msg.

These are the possible statuses and the meaning for the corresponding message:

  • 0 — Correctly serialized

  • 1 — Checksum mismatch

  • 2 — Signature mismatch

Version History

Introduced in R2019a