1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! # Constants
//!
//! We re-export from [`mavspec::rust::spec::consts`] to provide a full specification of MAVLink-related types.
/// <sup>[`mavspec`](https://crates.io/crates/mavspec)</sup>
pub use ;
/// `MAVLink 1` packet start marker value.
///
/// # Links
///
/// * [`MavSTX::V1`](crate::protocol::MavSTX::V1).
pub const STX_V1: u8 = 0xFE;
/// `MAVLink 2` packet start marker value.
///
/// # Links
///
/// * [`MavSTX::V2`](crate::protocol::MavSTX::V2).
pub const STX_V2: u8 = 0xFD;
/// Minimum size of a MAVLink header (regardless of protocol).
pub const HEADER_MIN_SIZE: usize = HEADER_V1_SIZE;
/// Maximum size of a MAVLink header (regardless of protocol).
pub const HEADER_MAX_SIZE: usize = HEADER_V2_SIZE;
/// Size of the `MAVLink 1` header in bytes.
///
/// `MAVLink 1` header have the following format:
///
/// | Field | Size in bytes |
/// |------------------|---------------|
/// | `magic` byte | 1 |
/// | `payload_length` | 1 |
/// | `sequence` | 1 |
/// | `system_id` | 1 |
/// | `component_id` | 1 |
/// | `message_id` | 1 |
///
/// # Links
///
/// * [MAVLink 1 packet format](https://mavlink.io/en/guide/serialization.html#mavlink2_packet_format).
pub const HEADER_V1_SIZE: usize = 6;
/// Size of the `MAVLink 2` header in bytes.
///
/// `MAVLink 2` header have the following format:
///
/// | Field | Size in bytes |
/// |------------------|---------------|
/// | `magic` byte | 1 |
/// | `incompat_flags` | 1 |
/// | `compat_flags` | 1 |
/// | `payload_length` | 1 |
/// | `sequence` | 1 |
/// | `system_id` | 1 |
/// | `component_id` | 1 |
/// | `message_id` | 3 |
///
/// # Links
///
/// * [MAVLink 2 packet format](https://mavlink.io/en/guide/serialization.html#v1_packet_format).
pub const HEADER_V2_SIZE: usize = 10;
/// Size of MAVLink checksum in bytes.
pub const CHECKSUM_SIZE: usize = 2;
/// `MAVLink 2` "message is signed" incompatibility flag.
///
/// # Links
///
/// * `MAVLINK_IFLAG_SIGNED` field in [MAVLink 2 incompatibility flags](https://mavlink.io/en/guide/serialization.html#incompat_flags)
pub const MAVLINK_IFLAG_SIGNED: u8 = 0x00000001;
/// `MAVLink 2` signature link ID length in bytes.
///
/// # Links
///
/// * [`Signature`](crate::protocol::Signature)
/// * `link id` field in [MAVLink 2 message signing](https://mavlink.io/en/guide/message_signing.html)
pub const SIGNATURE_LINK_ID_LENGTH: usize = 1;
/// `MAVLink 2` signature timestamp length in bytes.
///
/// # Links
///
/// * [`Signature`](crate::protocol::Signature)
/// * `tm.timestamp` field in [MAVLink 2 message signing](https://mavlink.io/en/guide/message_signing.html)
/// * [Timestamp handling](https://mavlink.io/en/guide/message_signing.html#timestamp) in MAVLink documentation.
/// * [`SIGNATURE_TIMESTAMP_OFFSET`] for switching between Unix and MAVLink epochs.
pub const SIGNATURE_TIMESTAMP_LENGTH: usize = 6;
/// `MAVLink 2` signature value length in bytes.
///
/// # Links
///
/// * [`Signature`](crate::protocol::Signature)
/// * `signature` field in [MAVLink 2 message signing](https://mavlink.io/en/guide/message_signing.html)
pub const SIGNATURE_VALUE_LENGTH: usize = 6;
/// `MAVLink 2` signature length in bytes.
///
/// # Links
///
/// * [`Signature`](crate::protocol::Signature)
/// * [MAVLink 2 message signing](https://mavlink.io/en/guide/message_signing.html)
pub const SIGNATURE_LENGTH: usize =
SIGNATURE_LINK_ID_LENGTH + SIGNATURE_TIMESTAMP_LENGTH + SIGNATURE_VALUE_LENGTH;
/// Timestamp offset in seconds from MAVLink to Unix epoch
///
/// Number of seconds between MAVLink epoch (1st January 2015 GMT) and Unix epoch (1st January 1970 GMT)
///
/// # Links
///
/// * [Timestamp handling](https://mavlink.io/en/guide/message_signing.html#timestamp) in MAVLink documentation.
pub const SIGNATURE_TIMESTAMP_OFFSET: u64 = 1420070400;
/// Length of a `MAVLink 2` secret key in bytes.
///
/// # Links
///
/// * [Signature](https://mavlink.io/en/guide/message_signing.html#signature) in MAVLink message signing documentation.
pub const SIGNATURE_SECRET_KEY_LENGTH: usize = 32;