2 // MESSAGE FLIGHT_INFORMATION PACKING
4 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION 264
7 typedef struct __mavlink_flight_information_t
{
8 uint64_t arming_time_utc
; /*< [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown*/
9 uint64_t takeoff_time_utc
; /*< [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown*/
10 uint64_t flight_uuid
; /*< Universally unique identifier (UUID) of flight, should correspond to name of log files*/
11 uint32_t time_boot_ms
; /*< [ms] Timestamp (time since system boot).*/
12 } mavlink_flight_information_t
;
14 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN 28
15 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN 28
16 #define MAVLINK_MSG_ID_264_LEN 28
17 #define MAVLINK_MSG_ID_264_MIN_LEN 28
19 #define MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC 49
20 #define MAVLINK_MSG_ID_264_CRC 49
24 #if MAVLINK_COMMAND_24BIT
25 #define MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION { \
27 "FLIGHT_INFORMATION", \
29 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_flight_information_t, time_boot_ms) }, \
30 { "arming_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_flight_information_t, arming_time_utc) }, \
31 { "takeoff_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_flight_information_t, takeoff_time_utc) }, \
32 { "flight_uuid", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_flight_information_t, flight_uuid) }, \
36 #define MAVLINK_MESSAGE_INFO_FLIGHT_INFORMATION { \
37 "FLIGHT_INFORMATION", \
39 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_flight_information_t, time_boot_ms) }, \
40 { "arming_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_flight_information_t, arming_time_utc) }, \
41 { "takeoff_time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_flight_information_t, takeoff_time_utc) }, \
42 { "flight_uuid", NULL, MAVLINK_TYPE_UINT64_T, 0, 16, offsetof(mavlink_flight_information_t, flight_uuid) }, \
48 * @brief Pack a flight_information message
49 * @param system_id ID of this system
50 * @param component_id ID of this component (e.g. 200 for IMU)
51 * @param msg The MAVLink message to compress the data into
53 * @param time_boot_ms [ms] Timestamp (time since system boot).
54 * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown
55 * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown
56 * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_flight_information_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
60 uint32_t time_boot_ms
, uint64_t arming_time_utc
, uint64_t takeoff_time_utc
, uint64_t flight_uuid
)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf
[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
];
64 _mav_put_uint64_t(buf
, 0, arming_time_utc
);
65 _mav_put_uint64_t(buf
, 8, takeoff_time_utc
);
66 _mav_put_uint64_t(buf
, 16, flight_uuid
);
67 _mav_put_uint32_t(buf
, 24, time_boot_ms
);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
);
71 mavlink_flight_information_t packet
;
72 packet
.arming_time_utc
= arming_time_utc
;
73 packet
.takeoff_time_utc
= takeoff_time_utc
;
74 packet
.flight_uuid
= flight_uuid
;
75 packet
.time_boot_ms
= time_boot_ms
;
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
);
80 msg
->msgid
= MAVLINK_MSG_ID_FLIGHT_INFORMATION
;
81 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
85 * @brief Pack a flight_information message on a channel
86 * @param system_id ID of this system
87 * @param component_id ID of this component (e.g. 200 for IMU)
88 * @param chan The MAVLink channel this message will be sent over
89 * @param msg The MAVLink message to compress the data into
90 * @param time_boot_ms [ms] Timestamp (time since system boot).
91 * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown
92 * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown
93 * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files
94 * @return length of the message in bytes (excluding serial stream start sign)
96 static inline uint16_t mavlink_msg_flight_information_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
97 mavlink_message_t
* msg
,
98 uint32_t time_boot_ms
,uint64_t arming_time_utc
,uint64_t takeoff_time_utc
,uint64_t flight_uuid
)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf
[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
];
102 _mav_put_uint64_t(buf
, 0, arming_time_utc
);
103 _mav_put_uint64_t(buf
, 8, takeoff_time_utc
);
104 _mav_put_uint64_t(buf
, 16, flight_uuid
);
105 _mav_put_uint32_t(buf
, 24, time_boot_ms
);
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
);
109 mavlink_flight_information_t packet
;
110 packet
.arming_time_utc
= arming_time_utc
;
111 packet
.takeoff_time_utc
= takeoff_time_utc
;
112 packet
.flight_uuid
= flight_uuid
;
113 packet
.time_boot_ms
= time_boot_ms
;
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
);
118 msg
->msgid
= MAVLINK_MSG_ID_FLIGHT_INFORMATION
;
119 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
123 * @brief Encode a flight_information struct
125 * @param system_id ID of this system
126 * @param component_id ID of this component (e.g. 200 for IMU)
127 * @param msg The MAVLink message to compress the data into
128 * @param flight_information C-struct to read the message contents from
130 static inline uint16_t mavlink_msg_flight_information_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_flight_information_t
* flight_information
)
132 return mavlink_msg_flight_information_pack(system_id
, component_id
, msg
, flight_information
->time_boot_ms
, flight_information
->arming_time_utc
, flight_information
->takeoff_time_utc
, flight_information
->flight_uuid
);
136 * @brief Encode a flight_information struct on a channel
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param chan The MAVLink channel this message will be sent over
141 * @param msg The MAVLink message to compress the data into
142 * @param flight_information C-struct to read the message contents from
144 static inline uint16_t mavlink_msg_flight_information_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_flight_information_t
* flight_information
)
146 return mavlink_msg_flight_information_pack_chan(system_id
, component_id
, chan
, msg
, flight_information
->time_boot_ms
, flight_information
->arming_time_utc
, flight_information
->takeoff_time_utc
, flight_information
->flight_uuid
);
150 * @brief Send a flight_information message
151 * @param chan MAVLink channel to send the message
153 * @param time_boot_ms [ms] Timestamp (time since system boot).
154 * @param arming_time_utc [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown
155 * @param takeoff_time_utc [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown
156 * @param flight_uuid Universally unique identifier (UUID) of flight, should correspond to name of log files
158 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
160 static inline void mavlink_msg_flight_information_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, uint64_t arming_time_utc
, uint64_t takeoff_time_utc
, uint64_t flight_uuid
)
162 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
163 char buf
[MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
];
164 _mav_put_uint64_t(buf
, 0, arming_time_utc
);
165 _mav_put_uint64_t(buf
, 8, takeoff_time_utc
);
166 _mav_put_uint64_t(buf
, 16, flight_uuid
);
167 _mav_put_uint32_t(buf
, 24, time_boot_ms
);
169 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION
, buf
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
171 mavlink_flight_information_t packet
;
172 packet
.arming_time_utc
= arming_time_utc
;
173 packet
.takeoff_time_utc
= takeoff_time_utc
;
174 packet
.flight_uuid
= flight_uuid
;
175 packet
.time_boot_ms
= time_boot_ms
;
177 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION
, (const char *)&packet
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
182 * @brief Send a flight_information message
183 * @param chan MAVLink channel to send the message
184 * @param struct The MAVLink struct to serialize
186 static inline void mavlink_msg_flight_information_send_struct(mavlink_channel_t chan
, const mavlink_flight_information_t
* flight_information
)
188 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
189 mavlink_msg_flight_information_send(chan
, flight_information
->time_boot_ms
, flight_information
->arming_time_utc
, flight_information
->takeoff_time_utc
, flight_information
->flight_uuid
);
191 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION
, (const char *)flight_information
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
195 #if MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
197 This varient of _send() can be used to save stack space by re-using
198 memory from the receive buffer. The caller provides a
199 mavlink_message_t which is the size of a full mavlink message. This
200 is usually the receive buffer for the channel, and allows a reply to an
201 incoming message with minimum stack space usage.
203 static inline void mavlink_msg_flight_information_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint32_t time_boot_ms
, uint64_t arming_time_utc
, uint64_t takeoff_time_utc
, uint64_t flight_uuid
)
205 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206 char *buf
= (char *)msgbuf
;
207 _mav_put_uint64_t(buf
, 0, arming_time_utc
);
208 _mav_put_uint64_t(buf
, 8, takeoff_time_utc
);
209 _mav_put_uint64_t(buf
, 16, flight_uuid
);
210 _mav_put_uint32_t(buf
, 24, time_boot_ms
);
212 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION
, buf
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
214 mavlink_flight_information_t
*packet
= (mavlink_flight_information_t
*)msgbuf
;
215 packet
->arming_time_utc
= arming_time_utc
;
216 packet
->takeoff_time_utc
= takeoff_time_utc
;
217 packet
->flight_uuid
= flight_uuid
;
218 packet
->time_boot_ms
= time_boot_ms
;
220 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_FLIGHT_INFORMATION
, (const char *)packet
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_MIN_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
, MAVLINK_MSG_ID_FLIGHT_INFORMATION_CRC
);
227 // MESSAGE FLIGHT_INFORMATION UNPACKING
231 * @brief Get field time_boot_ms from flight_information message
233 * @return [ms] Timestamp (time since system boot).
235 static inline uint32_t mavlink_msg_flight_information_get_time_boot_ms(const mavlink_message_t
* msg
)
237 return _MAV_RETURN_uint32_t(msg
, 24);
241 * @brief Get field arming_time_utc from flight_information message
243 * @return [us] Timestamp at arming (time since UNIX epoch) in UTC, 0 for unknown
245 static inline uint64_t mavlink_msg_flight_information_get_arming_time_utc(const mavlink_message_t
* msg
)
247 return _MAV_RETURN_uint64_t(msg
, 0);
251 * @brief Get field takeoff_time_utc from flight_information message
253 * @return [us] Timestamp at takeoff (time since UNIX epoch) in UTC, 0 for unknown
255 static inline uint64_t mavlink_msg_flight_information_get_takeoff_time_utc(const mavlink_message_t
* msg
)
257 return _MAV_RETURN_uint64_t(msg
, 8);
261 * @brief Get field flight_uuid from flight_information message
263 * @return Universally unique identifier (UUID) of flight, should correspond to name of log files
265 static inline uint64_t mavlink_msg_flight_information_get_flight_uuid(const mavlink_message_t
* msg
)
267 return _MAV_RETURN_uint64_t(msg
, 16);
271 * @brief Decode a flight_information message into a struct
273 * @param msg The message to decode
274 * @param flight_information C-struct to decode the message contents into
276 static inline void mavlink_msg_flight_information_decode(const mavlink_message_t
* msg
, mavlink_flight_information_t
* flight_information
)
278 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
279 flight_information
->arming_time_utc
= mavlink_msg_flight_information_get_arming_time_utc(msg
);
280 flight_information
->takeoff_time_utc
= mavlink_msg_flight_information_get_takeoff_time_utc(msg
);
281 flight_information
->flight_uuid
= mavlink_msg_flight_information_get_flight_uuid(msg
);
282 flight_information
->time_boot_ms
= mavlink_msg_flight_information_get_time_boot_ms(msg
);
284 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
? msg
->len
: MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
;
285 memset(flight_information
, 0, MAVLINK_MSG_ID_FLIGHT_INFORMATION_LEN
);
286 memcpy(flight_information
, _MAV_PAYLOAD(msg
), len
);