Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_high_latency.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE HIGH_LATENCY PACKING
3
4#define MAVLINK_MSG_ID_HIGH_LATENCY 234
5
6
8 uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags.*/
9 int32_t latitude; /*< [degE7] Latitude*/
10 int32_t longitude; /*< [degE7] Longitude*/
11 int16_t roll; /*< [cdeg] roll*/
12 int16_t pitch; /*< [cdeg] pitch*/
13 uint16_t heading; /*< [cdeg] heading*/
14 int16_t heading_sp; /*< [cdeg] heading setpoint*/
15 int16_t altitude_amsl; /*< [m] Altitude above mean sea level*/
16 int16_t altitude_sp; /*< [m] Altitude setpoint relative to the home position*/
17 uint16_t wp_distance; /*< [m] distance to target*/
18 uint8_t base_mode; /*< Bitmap of enabled system modes.*/
19 uint8_t landed_state; /*< The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.*/
20 int8_t throttle; /*< [%] throttle (percentage)*/
21 uint8_t airspeed; /*< [m/s] airspeed*/
22 uint8_t airspeed_sp; /*< [m/s] airspeed setpoint*/
23 uint8_t groundspeed; /*< [m/s] groundspeed*/
24 int8_t climb_rate; /*< [m/s] climb rate*/
25 uint8_t gps_nsat; /*< Number of satellites visible. If unknown, set to UINT8_MAX*/
26 uint8_t gps_fix_type; /*< GPS Fix type.*/
27 uint8_t battery_remaining; /*< [%] Remaining battery (percentage)*/
28 int8_t temperature; /*< [degC] Autopilot temperature (degrees C)*/
29 int8_t temperature_air; /*< [degC] Air temperature (degrees C) from airspeed sensor*/
30 uint8_t failsafe; /*< failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)*/
31 uint8_t wp_num; /*< current waypoint number*/
32} mavlink_high_latency_t;
33
34#define MAVLINK_MSG_ID_HIGH_LATENCY_LEN 40
35#define MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN 40
36#define MAVLINK_MSG_ID_234_LEN 40
37#define MAVLINK_MSG_ID_234_MIN_LEN 40
38
39#define MAVLINK_MSG_ID_HIGH_LATENCY_CRC 150
40#define MAVLINK_MSG_ID_234_CRC 150
41
42
43
44#if MAVLINK_COMMAND_24BIT
45#define MAVLINK_MESSAGE_INFO_HIGH_LATENCY {
46 234,
47 "HIGH_LATENCY",
48 24,
49 { { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency_t, base_mode) },
50 { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency_t, custom_mode) },
51 { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency_t, landed_state) },
52 { "roll", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_high_latency_t, roll) },
53 { "pitch", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency_t, pitch) },
54 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_high_latency_t, heading) },
55 { "throttle", NULL, MAVLINK_TYPE_INT8_T, 0, 28, offsetof(mavlink_high_latency_t, throttle) },
56 { "heading_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_high_latency_t, heading_sp) },
57 { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency_t, latitude) },
58 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency_t, longitude) },
59 { "altitude_amsl", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_high_latency_t, altitude_amsl) },
60 { "altitude_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_high_latency_t, altitude_sp) },
61 { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency_t, airspeed) },
62 { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency_t, airspeed_sp) },
63 { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency_t, groundspeed) },
64 { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 32, offsetof(mavlink_high_latency_t, climb_rate) },
65 { "gps_nsat", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency_t, gps_nsat) },
66 { "gps_fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency_t, gps_fix_type) },
67 { "battery_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency_t, battery_remaining) },
68 { "temperature", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency_t, temperature) },
69 { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency_t, temperature_air) },
70 { "failsafe", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_high_latency_t, failsafe) },
71 { "wp_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_high_latency_t, wp_num) },
72 { "wp_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_high_latency_t, wp_distance) },
73 } \
74}
75#else
76#define MAVLINK_MESSAGE_INFO_HIGH_LATENCY {
77 "HIGH_LATENCY",
78 24,
79 { { "base_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency_t, base_mode) },
80 { "custom_mode", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency_t, custom_mode) },
81 { "landed_state", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency_t, landed_state) },
82 { "roll", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_high_latency_t, roll) },
83 { "pitch", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency_t, pitch) },
84 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_high_latency_t, heading) },
85 { "throttle", NULL, MAVLINK_TYPE_INT8_T, 0, 28, offsetof(mavlink_high_latency_t, throttle) },
86 { "heading_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 18, offsetof(mavlink_high_latency_t, heading_sp) },
87 { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency_t, latitude) },
88 { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency_t, longitude) },
89 { "altitude_amsl", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_high_latency_t, altitude_amsl) },
90 { "altitude_sp", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_high_latency_t, altitude_sp) },
91 { "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency_t, airspeed) },
92 { "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency_t, airspeed_sp) },
93 { "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency_t, groundspeed) },
94 { "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 32, offsetof(mavlink_high_latency_t, climb_rate) },
95 { "gps_nsat", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency_t, gps_nsat) },
96 { "gps_fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency_t, gps_fix_type) },
97 { "battery_remaining", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency_t, battery_remaining) },
98 { "temperature", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency_t, temperature) },
99 { "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency_t, temperature_air) },
100 { "failsafe", NULL, MAVLINK_TYPE_UINT8_T, 0, 38, offsetof(mavlink_high_latency_t, failsafe) },
101 { "wp_num", NULL, MAVLINK_TYPE_UINT8_T, 0, 39, offsetof(mavlink_high_latency_t, wp_num) },
102 { "wp_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_high_latency_t, wp_distance) },
103 } \
104}
105#endif
106
107/**
108 * @brief Pack a high_latency message
109 * @param system_id ID of this system
110 * @param component_id ID of this component (e.g. 200 for IMU)
111 * @param msg The MAVLink message to compress the data into
112 *
113 * @param base_mode Bitmap of enabled system modes.
114 * @param custom_mode A bitfield for use for autopilot-specific flags.
115 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
116 * @param roll [cdeg] roll
117 * @param pitch [cdeg] pitch
118 * @param heading [cdeg] heading
119 * @param throttle [%] throttle (percentage)
120 * @param heading_sp [cdeg] heading setpoint
121 * @param latitude [degE7] Latitude
122 * @param longitude [degE7] Longitude
123 * @param altitude_amsl [m] Altitude above mean sea level
124 * @param altitude_sp [m] Altitude setpoint relative to the home position
125 * @param airspeed [m/s] airspeed
126 * @param airspeed_sp [m/s] airspeed setpoint
127 * @param groundspeed [m/s] groundspeed
128 * @param climb_rate [m/s] climb rate
129 * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX
130 * @param gps_fix_type GPS Fix type.
131 * @param battery_remaining [%] Remaining battery (percentage)
132 * @param temperature [degC] Autopilot temperature (degrees C)
133 * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
134 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
135 * @param wp_num current waypoint number
136 * @param wp_distance [m] distance to target
137 * @return length of the message in bytes (excluding serial stream start sign)
138 */
139static inline uint16_t mavlink_msg_high_latency_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
140 uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
141{
142#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
144 _mav_put_uint32_t(buf, 0, custom_mode);
145 _mav_put_int32_t(buf, 4, latitude);
146 _mav_put_int32_t(buf, 8, longitude);
147 _mav_put_int16_t(buf, 12, roll);
148 _mav_put_int16_t(buf, 14, pitch);
149 _mav_put_uint16_t(buf, 16, heading);
150 _mav_put_int16_t(buf, 18, heading_sp);
151 _mav_put_int16_t(buf, 20, altitude_amsl);
152 _mav_put_int16_t(buf, 22, altitude_sp);
153 _mav_put_uint16_t(buf, 24, wp_distance);
154 _mav_put_uint8_t(buf, 26, base_mode);
155 _mav_put_uint8_t(buf, 27, landed_state);
156 _mav_put_int8_t(buf, 28, throttle);
157 _mav_put_uint8_t(buf, 29, airspeed);
158 _mav_put_uint8_t(buf, 30, airspeed_sp);
159 _mav_put_uint8_t(buf, 31, groundspeed);
160 _mav_put_int8_t(buf, 32, climb_rate);
161 _mav_put_uint8_t(buf, 33, gps_nsat);
162 _mav_put_uint8_t(buf, 34, gps_fix_type);
163 _mav_put_uint8_t(buf, 35, battery_remaining);
164 _mav_put_int8_t(buf, 36, temperature);
165 _mav_put_int8_t(buf, 37, temperature_air);
166 _mav_put_uint8_t(buf, 38, failsafe);
167 _mav_put_uint8_t(buf, 39, wp_num);
168
169 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
170#else
171 mavlink_high_latency_t packet;
172 packet.custom_mode = custom_mode;
173 packet.latitude = latitude;
174 packet.longitude = longitude;
175 packet.roll = roll;
176 packet.pitch = pitch;
177 packet.heading = heading;
178 packet.heading_sp = heading_sp;
179 packet.altitude_amsl = altitude_amsl;
180 packet.altitude_sp = altitude_sp;
181 packet.wp_distance = wp_distance;
182 packet.base_mode = base_mode;
183 packet.landed_state = landed_state;
184 packet.throttle = throttle;
185 packet.airspeed = airspeed;
186 packet.airspeed_sp = airspeed_sp;
187 packet.groundspeed = groundspeed;
188 packet.climb_rate = climb_rate;
189 packet.gps_nsat = gps_nsat;
190 packet.gps_fix_type = gps_fix_type;
191 packet.battery_remaining = battery_remaining;
192 packet.temperature = temperature;
193 packet.temperature_air = temperature_air;
194 packet.failsafe = failsafe;
195 packet.wp_num = wp_num;
196
197 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
198#endif
199
200 msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY;
201 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
202}
203
204/**
205 * @brief Pack a high_latency message
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param status MAVLink status structure
209 * @param msg The MAVLink message to compress the data into
210 *
211 * @param base_mode Bitmap of enabled system modes.
212 * @param custom_mode A bitfield for use for autopilot-specific flags.
213 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
214 * @param roll [cdeg] roll
215 * @param pitch [cdeg] pitch
216 * @param heading [cdeg] heading
217 * @param throttle [%] throttle (percentage)
218 * @param heading_sp [cdeg] heading setpoint
219 * @param latitude [degE7] Latitude
220 * @param longitude [degE7] Longitude
221 * @param altitude_amsl [m] Altitude above mean sea level
222 * @param altitude_sp [m] Altitude setpoint relative to the home position
223 * @param airspeed [m/s] airspeed
224 * @param airspeed_sp [m/s] airspeed setpoint
225 * @param groundspeed [m/s] groundspeed
226 * @param climb_rate [m/s] climb rate
227 * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX
228 * @param gps_fix_type GPS Fix type.
229 * @param battery_remaining [%] Remaining battery (percentage)
230 * @param temperature [degC] Autopilot temperature (degrees C)
231 * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
232 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
233 * @param wp_num current waypoint number
234 * @param wp_distance [m] distance to target
235 * @return length of the message in bytes (excluding serial stream start sign)
236 */
237static inline uint16_t mavlink_msg_high_latency_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
238 uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
239{
240#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 _mav_put_uint32_t(buf, 0, custom_mode);
243 _mav_put_int32_t(buf, 4, latitude);
244 _mav_put_int32_t(buf, 8, longitude);
245 _mav_put_int16_t(buf, 12, roll);
246 _mav_put_int16_t(buf, 14, pitch);
247 _mav_put_uint16_t(buf, 16, heading);
248 _mav_put_int16_t(buf, 18, heading_sp);
249 _mav_put_int16_t(buf, 20, altitude_amsl);
250 _mav_put_int16_t(buf, 22, altitude_sp);
251 _mav_put_uint16_t(buf, 24, wp_distance);
252 _mav_put_uint8_t(buf, 26, base_mode);
253 _mav_put_uint8_t(buf, 27, landed_state);
254 _mav_put_int8_t(buf, 28, throttle);
255 _mav_put_uint8_t(buf, 29, airspeed);
256 _mav_put_uint8_t(buf, 30, airspeed_sp);
257 _mav_put_uint8_t(buf, 31, groundspeed);
258 _mav_put_int8_t(buf, 32, climb_rate);
259 _mav_put_uint8_t(buf, 33, gps_nsat);
260 _mav_put_uint8_t(buf, 34, gps_fix_type);
261 _mav_put_uint8_t(buf, 35, battery_remaining);
262 _mav_put_int8_t(buf, 36, temperature);
263 _mav_put_int8_t(buf, 37, temperature_air);
264 _mav_put_uint8_t(buf, 38, failsafe);
265 _mav_put_uint8_t(buf, 39, wp_num);
266
267 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
268#else
269 mavlink_high_latency_t packet;
270 packet.custom_mode = custom_mode;
271 packet.latitude = latitude;
272 packet.longitude = longitude;
273 packet.roll = roll;
274 packet.pitch = pitch;
275 packet.heading = heading;
276 packet.heading_sp = heading_sp;
277 packet.altitude_amsl = altitude_amsl;
278 packet.altitude_sp = altitude_sp;
279 packet.wp_distance = wp_distance;
280 packet.base_mode = base_mode;
281 packet.landed_state = landed_state;
282 packet.throttle = throttle;
283 packet.airspeed = airspeed;
284 packet.airspeed_sp = airspeed_sp;
285 packet.groundspeed = groundspeed;
286 packet.climb_rate = climb_rate;
287 packet.gps_nsat = gps_nsat;
288 packet.gps_fix_type = gps_fix_type;
289 packet.battery_remaining = battery_remaining;
290 packet.temperature = temperature;
291 packet.temperature_air = temperature_air;
292 packet.failsafe = failsafe;
293 packet.wp_num = wp_num;
294
295 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
296#endif
297
298 msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY;
299#if MAVLINK_CRC_EXTRA
300 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
301#else
302 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
303#endif
304}
305
306/**
307 * @brief Pack a high_latency message on a channel
308 * @param system_id ID of this system
309 * @param component_id ID of this component (e.g. 200 for IMU)
310 * @param chan The MAVLink channel this message will be sent over
311 * @param msg The MAVLink message to compress the data into
312 * @param base_mode Bitmap of enabled system modes.
313 * @param custom_mode A bitfield for use for autopilot-specific flags.
314 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
315 * @param roll [cdeg] roll
316 * @param pitch [cdeg] pitch
317 * @param heading [cdeg] heading
318 * @param throttle [%] throttle (percentage)
319 * @param heading_sp [cdeg] heading setpoint
320 * @param latitude [degE7] Latitude
321 * @param longitude [degE7] Longitude
322 * @param altitude_amsl [m] Altitude above mean sea level
323 * @param altitude_sp [m] Altitude setpoint relative to the home position
324 * @param airspeed [m/s] airspeed
325 * @param airspeed_sp [m/s] airspeed setpoint
326 * @param groundspeed [m/s] groundspeed
327 * @param climb_rate [m/s] climb rate
328 * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX
329 * @param gps_fix_type GPS Fix type.
330 * @param battery_remaining [%] Remaining battery (percentage)
331 * @param temperature [degC] Autopilot temperature (degrees C)
332 * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
333 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
334 * @param wp_num current waypoint number
335 * @param wp_distance [m] distance to target
336 * @return length of the message in bytes (excluding serial stream start sign)
337 */
338static inline uint16_t mavlink_msg_high_latency_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
339 mavlink_message_t* msg,
340 uint8_t base_mode,uint32_t custom_mode,uint8_t landed_state,int16_t roll,int16_t pitch,uint16_t heading,int8_t throttle,int16_t heading_sp,int32_t latitude,int32_t longitude,int16_t altitude_amsl,int16_t altitude_sp,uint8_t airspeed,uint8_t airspeed_sp,uint8_t groundspeed,int8_t climb_rate,uint8_t gps_nsat,uint8_t gps_fix_type,uint8_t battery_remaining,int8_t temperature,int8_t temperature_air,uint8_t failsafe,uint8_t wp_num,uint16_t wp_distance)
341{
342#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
344 _mav_put_uint32_t(buf, 0, custom_mode);
345 _mav_put_int32_t(buf, 4, latitude);
346 _mav_put_int32_t(buf, 8, longitude);
347 _mav_put_int16_t(buf, 12, roll);
348 _mav_put_int16_t(buf, 14, pitch);
349 _mav_put_uint16_t(buf, 16, heading);
350 _mav_put_int16_t(buf, 18, heading_sp);
351 _mav_put_int16_t(buf, 20, altitude_amsl);
352 _mav_put_int16_t(buf, 22, altitude_sp);
353 _mav_put_uint16_t(buf, 24, wp_distance);
354 _mav_put_uint8_t(buf, 26, base_mode);
355 _mav_put_uint8_t(buf, 27, landed_state);
356 _mav_put_int8_t(buf, 28, throttle);
357 _mav_put_uint8_t(buf, 29, airspeed);
358 _mav_put_uint8_t(buf, 30, airspeed_sp);
359 _mav_put_uint8_t(buf, 31, groundspeed);
360 _mav_put_int8_t(buf, 32, climb_rate);
361 _mav_put_uint8_t(buf, 33, gps_nsat);
362 _mav_put_uint8_t(buf, 34, gps_fix_type);
363 _mav_put_uint8_t(buf, 35, battery_remaining);
364 _mav_put_int8_t(buf, 36, temperature);
365 _mav_put_int8_t(buf, 37, temperature_air);
366 _mav_put_uint8_t(buf, 38, failsafe);
367 _mav_put_uint8_t(buf, 39, wp_num);
368
369 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
370#else
371 mavlink_high_latency_t packet;
372 packet.custom_mode = custom_mode;
373 packet.latitude = latitude;
374 packet.longitude = longitude;
375 packet.roll = roll;
376 packet.pitch = pitch;
377 packet.heading = heading;
378 packet.heading_sp = heading_sp;
379 packet.altitude_amsl = altitude_amsl;
380 packet.altitude_sp = altitude_sp;
381 packet.wp_distance = wp_distance;
382 packet.base_mode = base_mode;
383 packet.landed_state = landed_state;
384 packet.throttle = throttle;
385 packet.airspeed = airspeed;
386 packet.airspeed_sp = airspeed_sp;
387 packet.groundspeed = groundspeed;
388 packet.climb_rate = climb_rate;
389 packet.gps_nsat = gps_nsat;
390 packet.gps_fix_type = gps_fix_type;
391 packet.battery_remaining = battery_remaining;
392 packet.temperature = temperature;
393 packet.temperature_air = temperature_air;
394 packet.failsafe = failsafe;
395 packet.wp_num = wp_num;
396
397 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
398#endif
399
400 msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY;
401 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
402}
403
404/**
405 * @brief Encode a high_latency struct
406 *
407 * @param system_id ID of this system
408 * @param component_id ID of this component (e.g. 200 for IMU)
409 * @param msg The MAVLink message to compress the data into
410 * @param high_latency C-struct to read the message contents from
411 */
412static inline uint16_t mavlink_msg_high_latency_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency)
413{
414 return mavlink_msg_high_latency_pack(system_id, component_id, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
415}
416
417/**
418 * @brief Encode a high_latency struct on a channel
419 *
420 * @param system_id ID of this system
421 * @param component_id ID of this component (e.g. 200 for IMU)
422 * @param chan The MAVLink channel this message will be sent over
423 * @param msg The MAVLink message to compress the data into
424 * @param high_latency C-struct to read the message contents from
425 */
426static inline uint16_t mavlink_msg_high_latency_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency)
427{
428 return mavlink_msg_high_latency_pack_chan(system_id, component_id, chan, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
429}
430
431/**
432 * @brief Encode a high_latency struct with provided status structure
433 *
434 * @param system_id ID of this system
435 * @param component_id ID of this component (e.g. 200 for IMU)
436 * @param status MAVLink status structure
437 * @param msg The MAVLink message to compress the data into
438 * @param high_latency C-struct to read the message contents from
439 */
440static inline uint16_t mavlink_msg_high_latency_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_high_latency_t* high_latency)
441{
442 return mavlink_msg_high_latency_pack_status(system_id, component_id, _status, msg, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
443}
444
445/**
446 * @brief Send a high_latency message
447 * @param chan MAVLink channel to send the message
448 *
449 * @param base_mode Bitmap of enabled system modes.
450 * @param custom_mode A bitfield for use for autopilot-specific flags.
451 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
452 * @param roll [cdeg] roll
453 * @param pitch [cdeg] pitch
454 * @param heading [cdeg] heading
455 * @param throttle [%] throttle (percentage)
456 * @param heading_sp [cdeg] heading setpoint
457 * @param latitude [degE7] Latitude
458 * @param longitude [degE7] Longitude
459 * @param altitude_amsl [m] Altitude above mean sea level
460 * @param altitude_sp [m] Altitude setpoint relative to the home position
461 * @param airspeed [m/s] airspeed
462 * @param airspeed_sp [m/s] airspeed setpoint
463 * @param groundspeed [m/s] groundspeed
464 * @param climb_rate [m/s] climb rate
465 * @param gps_nsat Number of satellites visible. If unknown, set to UINT8_MAX
466 * @param gps_fix_type GPS Fix type.
467 * @param battery_remaining [%] Remaining battery (percentage)
468 * @param temperature [degC] Autopilot temperature (degrees C)
469 * @param temperature_air [degC] Air temperature (degrees C) from airspeed sensor
470 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
471 * @param wp_num current waypoint number
472 * @param wp_distance [m] distance to target
473 */
474#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
475
476static inline void mavlink_msg_high_latency_send(mavlink_channel_t chan, uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
477{
478#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
479 char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
480 _mav_put_uint32_t(buf, 0, custom_mode);
481 _mav_put_int32_t(buf, 4, latitude);
482 _mav_put_int32_t(buf, 8, longitude);
483 _mav_put_int16_t(buf, 12, roll);
484 _mav_put_int16_t(buf, 14, pitch);
485 _mav_put_uint16_t(buf, 16, heading);
486 _mav_put_int16_t(buf, 18, heading_sp);
487 _mav_put_int16_t(buf, 20, altitude_amsl);
488 _mav_put_int16_t(buf, 22, altitude_sp);
489 _mav_put_uint16_t(buf, 24, wp_distance);
490 _mav_put_uint8_t(buf, 26, base_mode);
491 _mav_put_uint8_t(buf, 27, landed_state);
492 _mav_put_int8_t(buf, 28, throttle);
493 _mav_put_uint8_t(buf, 29, airspeed);
494 _mav_put_uint8_t(buf, 30, airspeed_sp);
495 _mav_put_uint8_t(buf, 31, groundspeed);
496 _mav_put_int8_t(buf, 32, climb_rate);
497 _mav_put_uint8_t(buf, 33, gps_nsat);
498 _mav_put_uint8_t(buf, 34, gps_fix_type);
499 _mav_put_uint8_t(buf, 35, battery_remaining);
500 _mav_put_int8_t(buf, 36, temperature);
501 _mav_put_int8_t(buf, 37, temperature_air);
502 _mav_put_uint8_t(buf, 38, failsafe);
503 _mav_put_uint8_t(buf, 39, wp_num);
504
505 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, buf, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
506#else
507 mavlink_high_latency_t packet;
508 packet.custom_mode = custom_mode;
509 packet.latitude = latitude;
510 packet.longitude = longitude;
511 packet.roll = roll;
512 packet.pitch = pitch;
513 packet.heading = heading;
514 packet.heading_sp = heading_sp;
515 packet.altitude_amsl = altitude_amsl;
516 packet.altitude_sp = altitude_sp;
517 packet.wp_distance = wp_distance;
518 packet.base_mode = base_mode;
519 packet.landed_state = landed_state;
520 packet.throttle = throttle;
521 packet.airspeed = airspeed;
522 packet.airspeed_sp = airspeed_sp;
523 packet.groundspeed = groundspeed;
524 packet.climb_rate = climb_rate;
525 packet.gps_nsat = gps_nsat;
526 packet.gps_fix_type = gps_fix_type;
527 packet.battery_remaining = battery_remaining;
528 packet.temperature = temperature;
529 packet.temperature_air = temperature_air;
530 packet.failsafe = failsafe;
531 packet.wp_num = wp_num;
532
533 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)&packet, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
534#endif
535}
536
537/**
538 * @brief Send a high_latency message
539 * @param chan MAVLink channel to send the message
540 * @param struct The MAVLink struct to serialize
541 */
542static inline void mavlink_msg_high_latency_send_struct(mavlink_channel_t chan, const mavlink_high_latency_t* high_latency)
543{
544#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
545 mavlink_msg_high_latency_send(chan, high_latency->base_mode, high_latency->custom_mode, high_latency->landed_state, high_latency->roll, high_latency->pitch, high_latency->heading, high_latency->throttle, high_latency->heading_sp, high_latency->latitude, high_latency->longitude, high_latency->altitude_amsl, high_latency->altitude_sp, high_latency->airspeed, high_latency->airspeed_sp, high_latency->groundspeed, high_latency->climb_rate, high_latency->gps_nsat, high_latency->gps_fix_type, high_latency->battery_remaining, high_latency->temperature, high_latency->temperature_air, high_latency->failsafe, high_latency->wp_num, high_latency->wp_distance);
546#else
547 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)high_latency, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
548#endif
549}
550
551#if MAVLINK_MSG_ID_HIGH_LATENCY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
552/*
553 This variant of _send() can be used to save stack space by reusing
554 memory from the receive buffer. The caller provides a
555 mavlink_message_t which is the size of a full mavlink message. This
556 is usually the receive buffer for the channel, and allows a reply to an
557 incoming message with minimum stack space usage.
558 */
559static inline void mavlink_msg_high_latency_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t base_mode, uint32_t custom_mode, uint8_t landed_state, int16_t roll, int16_t pitch, uint16_t heading, int8_t throttle, int16_t heading_sp, int32_t latitude, int32_t longitude, int16_t altitude_amsl, int16_t altitude_sp, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, int8_t climb_rate, uint8_t gps_nsat, uint8_t gps_fix_type, uint8_t battery_remaining, int8_t temperature, int8_t temperature_air, uint8_t failsafe, uint8_t wp_num, uint16_t wp_distance)
560{
561#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
562 char *buf = (char *)msgbuf;
563 _mav_put_uint32_t(buf, 0, custom_mode);
564 _mav_put_int32_t(buf, 4, latitude);
565 _mav_put_int32_t(buf, 8, longitude);
566 _mav_put_int16_t(buf, 12, roll);
567 _mav_put_int16_t(buf, 14, pitch);
568 _mav_put_uint16_t(buf, 16, heading);
569 _mav_put_int16_t(buf, 18, heading_sp);
570 _mav_put_int16_t(buf, 20, altitude_amsl);
571 _mav_put_int16_t(buf, 22, altitude_sp);
572 _mav_put_uint16_t(buf, 24, wp_distance);
573 _mav_put_uint8_t(buf, 26, base_mode);
574 _mav_put_uint8_t(buf, 27, landed_state);
575 _mav_put_int8_t(buf, 28, throttle);
576 _mav_put_uint8_t(buf, 29, airspeed);
577 _mav_put_uint8_t(buf, 30, airspeed_sp);
578 _mav_put_uint8_t(buf, 31, groundspeed);
579 _mav_put_int8_t(buf, 32, climb_rate);
580 _mav_put_uint8_t(buf, 33, gps_nsat);
581 _mav_put_uint8_t(buf, 34, gps_fix_type);
582 _mav_put_uint8_t(buf, 35, battery_remaining);
583 _mav_put_int8_t(buf, 36, temperature);
584 _mav_put_int8_t(buf, 37, temperature_air);
585 _mav_put_uint8_t(buf, 38, failsafe);
586 _mav_put_uint8_t(buf, 39, wp_num);
587
588 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, buf, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
589#else
590 mavlink_high_latency_t *packet = (mavlink_high_latency_t *)msgbuf;
591 packet->custom_mode = custom_mode;
592 packet->latitude = latitude;
593 packet->longitude = longitude;
594 packet->roll = roll;
595 packet->pitch = pitch;
596 packet->heading = heading;
597 packet->heading_sp = heading_sp;
598 packet->altitude_amsl = altitude_amsl;
599 packet->altitude_sp = altitude_sp;
600 packet->wp_distance = wp_distance;
601 packet->base_mode = base_mode;
602 packet->landed_state = landed_state;
603 packet->throttle = throttle;
604 packet->airspeed = airspeed;
605 packet->airspeed_sp = airspeed_sp;
606 packet->groundspeed = groundspeed;
607 packet->climb_rate = climb_rate;
608 packet->gps_nsat = gps_nsat;
609 packet->gps_fix_type = gps_fix_type;
610 packet->battery_remaining = battery_remaining;
611 packet->temperature = temperature;
612 packet->temperature_air = temperature_air;
613 packet->failsafe = failsafe;
614 packet->wp_num = wp_num;
615
616 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY, (const char *)packet, MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_LEN, MAVLINK_MSG_ID_HIGH_LATENCY_CRC);
617#endif
618}
619#endif
620
621#endif
622
623// MESSAGE HIGH_LATENCY UNPACKING
624
625
626/**
627 * @brief Get field base_mode from high_latency message
628 *
629 * @return Bitmap of enabled system modes.
630 */
631static inline uint8_t mavlink_msg_high_latency_get_base_mode(const mavlink_message_t* msg)
632{
633 return _MAV_RETURN_uint8_t(msg, 26);
634}
635
636/**
637 * @brief Get field custom_mode from high_latency message
638 *
639 * @return A bitfield for use for autopilot-specific flags.
640 */
641static inline uint32_t mavlink_msg_high_latency_get_custom_mode(const mavlink_message_t* msg)
642{
643 return _MAV_RETURN_uint32_t(msg, 0);
644}
645
646/**
647 * @brief Get field landed_state from high_latency message
648 *
649 * @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
650 */
651static inline uint8_t mavlink_msg_high_latency_get_landed_state(const mavlink_message_t* msg)
652{
653 return _MAV_RETURN_uint8_t(msg, 27);
654}
655
656/**
657 * @brief Get field roll from high_latency message
658 *
659 * @return [cdeg] roll
660 */
661static inline int16_t mavlink_msg_high_latency_get_roll(const mavlink_message_t* msg)
662{
663 return _MAV_RETURN_int16_t(msg, 12);
664}
665
666/**
667 * @brief Get field pitch from high_latency message
668 *
669 * @return [cdeg] pitch
670 */
671static inline int16_t mavlink_msg_high_latency_get_pitch(const mavlink_message_t* msg)
672{
673 return _MAV_RETURN_int16_t(msg, 14);
674}
675
676/**
677 * @brief Get field heading from high_latency message
678 *
679 * @return [cdeg] heading
680 */
681static inline uint16_t mavlink_msg_high_latency_get_heading(const mavlink_message_t* msg)
682{
683 return _MAV_RETURN_uint16_t(msg, 16);
684}
685
686/**
687 * @brief Get field throttle from high_latency message
688 *
689 * @return [%] throttle (percentage)
690 */
691static inline int8_t mavlink_msg_high_latency_get_throttle(const mavlink_message_t* msg)
692{
693 return _MAV_RETURN_int8_t(msg, 28);
694}
695
696/**
697 * @brief Get field heading_sp from high_latency message
698 *
699 * @return [cdeg] heading setpoint
700 */
701static inline int16_t mavlink_msg_high_latency_get_heading_sp(const mavlink_message_t* msg)
702{
703 return _MAV_RETURN_int16_t(msg, 18);
704}
705
706/**
707 * @brief Get field latitude from high_latency message
708 *
709 * @return [degE7] Latitude
710 */
711static inline int32_t mavlink_msg_high_latency_get_latitude(const mavlink_message_t* msg)
712{
713 return _MAV_RETURN_int32_t(msg, 4);
714}
715
716/**
717 * @brief Get field longitude from high_latency message
718 *
719 * @return [degE7] Longitude
720 */
721static inline int32_t mavlink_msg_high_latency_get_longitude(const mavlink_message_t* msg)
722{
723 return _MAV_RETURN_int32_t(msg, 8);
724}
725
726/**
727 * @brief Get field altitude_amsl from high_latency message
728 *
729 * @return [m] Altitude above mean sea level
730 */
731static inline int16_t mavlink_msg_high_latency_get_altitude_amsl(const mavlink_message_t* msg)
732{
733 return _MAV_RETURN_int16_t(msg, 20);
734}
735
736/**
737 * @brief Get field altitude_sp from high_latency message
738 *
739 * @return [m] Altitude setpoint relative to the home position
740 */
741static inline int16_t mavlink_msg_high_latency_get_altitude_sp(const mavlink_message_t* msg)
742{
743 return _MAV_RETURN_int16_t(msg, 22);
744}
745
746/**
747 * @brief Get field airspeed from high_latency message
748 *
749 * @return [m/s] airspeed
750 */
751static inline uint8_t mavlink_msg_high_latency_get_airspeed(const mavlink_message_t* msg)
752{
753 return _MAV_RETURN_uint8_t(msg, 29);
754}
755
756/**
757 * @brief Get field airspeed_sp from high_latency message
758 *
759 * @return [m/s] airspeed setpoint
760 */
761static inline uint8_t mavlink_msg_high_latency_get_airspeed_sp(const mavlink_message_t* msg)
762{
763 return _MAV_RETURN_uint8_t(msg, 30);
764}
765
766/**
767 * @brief Get field groundspeed from high_latency message
768 *
769 * @return [m/s] groundspeed
770 */
771static inline uint8_t mavlink_msg_high_latency_get_groundspeed(const mavlink_message_t* msg)
772{
773 return _MAV_RETURN_uint8_t(msg, 31);
774}
775
776/**
777 * @brief Get field climb_rate from high_latency message
778 *
779 * @return [m/s] climb rate
780 */
781static inline int8_t mavlink_msg_high_latency_get_climb_rate(const mavlink_message_t* msg)
782{
783 return _MAV_RETURN_int8_t(msg, 32);
784}
785
786/**
787 * @brief Get field gps_nsat from high_latency message
788 *
789 * @return Number of satellites visible. If unknown, set to UINT8_MAX
790 */
791static inline uint8_t mavlink_msg_high_latency_get_gps_nsat(const mavlink_message_t* msg)
792{
793 return _MAV_RETURN_uint8_t(msg, 33);
794}
795
796/**
797 * @brief Get field gps_fix_type from high_latency message
798 *
799 * @return GPS Fix type.
800 */
801static inline uint8_t mavlink_msg_high_latency_get_gps_fix_type(const mavlink_message_t* msg)
802{
803 return _MAV_RETURN_uint8_t(msg, 34);
804}
805
806/**
807 * @brief Get field battery_remaining from high_latency message
808 *
809 * @return [%] Remaining battery (percentage)
810 */
811static inline uint8_t mavlink_msg_high_latency_get_battery_remaining(const mavlink_message_t* msg)
812{
813 return _MAV_RETURN_uint8_t(msg, 35);
814}
815
816/**
817 * @brief Get field temperature from high_latency message
818 *
819 * @return [degC] Autopilot temperature (degrees C)
820 */
821static inline int8_t mavlink_msg_high_latency_get_temperature(const mavlink_message_t* msg)
822{
823 return _MAV_RETURN_int8_t(msg, 36);
824}
825
826/**
827 * @brief Get field temperature_air from high_latency message
828 *
829 * @return [degC] Air temperature (degrees C) from airspeed sensor
830 */
831static inline int8_t mavlink_msg_high_latency_get_temperature_air(const mavlink_message_t* msg)
832{
833 return _MAV_RETURN_int8_t(msg, 37);
834}
835
836/**
837 * @brief Get field failsafe from high_latency message
838 *
839 * @return failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
840 */
841static inline uint8_t mavlink_msg_high_latency_get_failsafe(const mavlink_message_t* msg)
842{
843 return _MAV_RETURN_uint8_t(msg, 38);
844}
845
846/**
847 * @brief Get field wp_num from high_latency message
848 *
849 * @return current waypoint number
850 */
851static inline uint8_t mavlink_msg_high_latency_get_wp_num(const mavlink_message_t* msg)
852{
853 return _MAV_RETURN_uint8_t(msg, 39);
854}
855
856/**
857 * @brief Get field wp_distance from high_latency message
858 *
859 * @return [m] distance to target
860 */
861static inline uint16_t mavlink_msg_high_latency_get_wp_distance(const mavlink_message_t* msg)
862{
863 return _MAV_RETURN_uint16_t(msg, 24);
864}
865
866/**
867 * @brief Decode a high_latency message into a struct
868 *
869 * @param msg The message to decode
870 * @param high_latency C-struct to decode the message contents into
871 */
872static inline void mavlink_msg_high_latency_decode(const mavlink_message_t* msg, mavlink_high_latency_t* high_latency)
873{
874#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
875 high_latency->custom_mode = mavlink_msg_high_latency_get_custom_mode(msg);
876 high_latency->latitude = mavlink_msg_high_latency_get_latitude(msg);
877 high_latency->longitude = mavlink_msg_high_latency_get_longitude(msg);
878 high_latency->roll = mavlink_msg_high_latency_get_roll(msg);
879 high_latency->pitch = mavlink_msg_high_latency_get_pitch(msg);
880 high_latency->heading = mavlink_msg_high_latency_get_heading(msg);
881 high_latency->heading_sp = mavlink_msg_high_latency_get_heading_sp(msg);
882 high_latency->altitude_amsl = mavlink_msg_high_latency_get_altitude_amsl(msg);
883 high_latency->altitude_sp = mavlink_msg_high_latency_get_altitude_sp(msg);
884 high_latency->wp_distance = mavlink_msg_high_latency_get_wp_distance(msg);
885 high_latency->base_mode = mavlink_msg_high_latency_get_base_mode(msg);
886 high_latency->landed_state = mavlink_msg_high_latency_get_landed_state(msg);
887 high_latency->throttle = mavlink_msg_high_latency_get_throttle(msg);
888 high_latency->airspeed = mavlink_msg_high_latency_get_airspeed(msg);
889 high_latency->airspeed_sp = mavlink_msg_high_latency_get_airspeed_sp(msg);
890 high_latency->groundspeed = mavlink_msg_high_latency_get_groundspeed(msg);
891 high_latency->climb_rate = mavlink_msg_high_latency_get_climb_rate(msg);
892 high_latency->gps_nsat = mavlink_msg_high_latency_get_gps_nsat(msg);
893 high_latency->gps_fix_type = mavlink_msg_high_latency_get_gps_fix_type(msg);
894 high_latency->battery_remaining = mavlink_msg_high_latency_get_battery_remaining(msg);
895 high_latency->temperature = mavlink_msg_high_latency_get_temperature(msg);
896 high_latency->temperature_air = mavlink_msg_high_latency_get_temperature_air(msg);
897 high_latency->failsafe = mavlink_msg_high_latency_get_failsafe(msg);
898 high_latency->wp_num = mavlink_msg_high_latency_get_wp_num(msg);
899#else
900 uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY_LEN? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY_LEN;
901 memset(high_latency, 0, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
902 memcpy(high_latency, _MAV_PAYLOAD(msg), len);
903#endif
904}