RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_high_latency.h
1#pragma once
2// MESSAGE HIGH_LATENCY PACKING
3
4#define MAVLINK_MSG_ID_HIGH_LATENCY 234
5
6MAVPACKED(
7typedef struct __mavlink_high_latency_t {
8 uint32_t custom_mode; /*< A bitfield for use for autopilot-specific flags.*/
9 int32_t latitude; /*< Latitude, expressed as degrees * 1E7*/
10 int32_t longitude; /*< Longitude, expressed as degrees * 1E7*/
11 int16_t roll; /*< roll (centidegrees)*/
12 int16_t pitch; /*< pitch (centidegrees)*/
13 uint16_t heading; /*< heading (centidegrees)*/
14 int16_t heading_sp; /*< heading setpoint (centidegrees)*/
15 int16_t altitude_amsl; /*< Altitude above mean sea level (meters)*/
16 int16_t altitude_sp; /*< Altitude setpoint relative to the home position (meters)*/
17 uint16_t wp_distance; /*< distance to target (meters)*/
18 uint8_t base_mode; /*< System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h*/
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; /*< airspeed (m/s)*/
22 uint8_t airspeed_sp; /*< airspeed setpoint (m/s)*/
23 uint8_t groundspeed; /*< groundspeed (m/s)*/
24 int8_t climb_rate; /*< climb rate (m/s)*/
25 uint8_t gps_nsat; /*< Number of satellites visible. If unknown, set to 255*/
26 uint8_t gps_fix_type; /*< See the GPS_FIX_TYPE enum.*/
27 uint8_t battery_remaining; /*< Remaining battery (percentage)*/
28 int8_t temperature; /*< Autopilot temperature (degrees C)*/
29 int8_t temperature_air; /*< 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 System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
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 roll (centidegrees)
117 * @param pitch pitch (centidegrees)
118 * @param heading heading (centidegrees)
119 * @param throttle throttle (percentage)
120 * @param heading_sp heading setpoint (centidegrees)
121 * @param latitude Latitude, expressed as degrees * 1E7
122 * @param longitude Longitude, expressed as degrees * 1E7
123 * @param altitude_amsl Altitude above mean sea level (meters)
124 * @param altitude_sp Altitude setpoint relative to the home position (meters)
125 * @param airspeed airspeed (m/s)
126 * @param airspeed_sp airspeed setpoint (m/s)
127 * @param groundspeed groundspeed (m/s)
128 * @param climb_rate climb rate (m/s)
129 * @param gps_nsat Number of satellites visible. If unknown, set to 255
130 * @param gps_fix_type See the GPS_FIX_TYPE enum.
131 * @param battery_remaining Remaining battery (percentage)
132 * @param temperature Autopilot temperature (degrees C)
133 * @param temperature_air 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 distance to target (meters)
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
143 char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
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 on a channel
206 * @param system_id ID of this system
207 * @param component_id ID of this component (e.g. 200 for IMU)
208 * @param chan The MAVLink channel this message will be sent over
209 * @param msg The MAVLink message to compress the data into
210 * @param base_mode System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
211 * @param custom_mode A bitfield for use for autopilot-specific flags.
212 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
213 * @param roll roll (centidegrees)
214 * @param pitch pitch (centidegrees)
215 * @param heading heading (centidegrees)
216 * @param throttle throttle (percentage)
217 * @param heading_sp heading setpoint (centidegrees)
218 * @param latitude Latitude, expressed as degrees * 1E7
219 * @param longitude Longitude, expressed as degrees * 1E7
220 * @param altitude_amsl Altitude above mean sea level (meters)
221 * @param altitude_sp Altitude setpoint relative to the home position (meters)
222 * @param airspeed airspeed (m/s)
223 * @param airspeed_sp airspeed setpoint (m/s)
224 * @param groundspeed groundspeed (m/s)
225 * @param climb_rate climb rate (m/s)
226 * @param gps_nsat Number of satellites visible. If unknown, set to 255
227 * @param gps_fix_type See the GPS_FIX_TYPE enum.
228 * @param battery_remaining Remaining battery (percentage)
229 * @param temperature Autopilot temperature (degrees C)
230 * @param temperature_air Air temperature (degrees C) from airspeed sensor
231 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
232 * @param wp_num current waypoint number
233 * @param wp_distance distance to target (meters)
234 * @return length of the message in bytes (excluding serial stream start sign)
235 */
236static inline uint16_t mavlink_msg_high_latency_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
237 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
241 char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
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 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);
300}
301
302/**
303 * @brief Encode a high_latency struct
304 *
305 * @param system_id ID of this system
306 * @param component_id ID of this component (e.g. 200 for IMU)
307 * @param msg The MAVLink message to compress the data into
308 * @param high_latency C-struct to read the message contents from
309 */
310static 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)
311{
312 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);
313}
314
315/**
316 * @brief Encode a high_latency struct on a channel
317 *
318 * @param system_id ID of this system
319 * @param component_id ID of this component (e.g. 200 for IMU)
320 * @param chan The MAVLink channel this message will be sent over
321 * @param msg The MAVLink message to compress the data into
322 * @param high_latency C-struct to read the message contents from
323 */
324static 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)
325{
326 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);
327}
328
329/**
330 * @brief Send a high_latency message
331 * @param chan MAVLink channel to send the message
332 *
333 * @param base_mode System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
334 * @param custom_mode A bitfield for use for autopilot-specific flags.
335 * @param landed_state The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
336 * @param roll roll (centidegrees)
337 * @param pitch pitch (centidegrees)
338 * @param heading heading (centidegrees)
339 * @param throttle throttle (percentage)
340 * @param heading_sp heading setpoint (centidegrees)
341 * @param latitude Latitude, expressed as degrees * 1E7
342 * @param longitude Longitude, expressed as degrees * 1E7
343 * @param altitude_amsl Altitude above mean sea level (meters)
344 * @param altitude_sp Altitude setpoint relative to the home position (meters)
345 * @param airspeed airspeed (m/s)
346 * @param airspeed_sp airspeed setpoint (m/s)
347 * @param groundspeed groundspeed (m/s)
348 * @param climb_rate climb rate (m/s)
349 * @param gps_nsat Number of satellites visible. If unknown, set to 255
350 * @param gps_fix_type See the GPS_FIX_TYPE enum.
351 * @param battery_remaining Remaining battery (percentage)
352 * @param temperature Autopilot temperature (degrees C)
353 * @param temperature_air Air temperature (degrees C) from airspeed sensor
354 * @param failsafe failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
355 * @param wp_num current waypoint number
356 * @param wp_distance distance to target (meters)
357 */
358#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
359
360static 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)
361{
362#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
363 char buf[MAVLINK_MSG_ID_HIGH_LATENCY_LEN];
364 _mav_put_uint32_t(buf, 0, custom_mode);
365 _mav_put_int32_t(buf, 4, latitude);
366 _mav_put_int32_t(buf, 8, longitude);
367 _mav_put_int16_t(buf, 12, roll);
368 _mav_put_int16_t(buf, 14, pitch);
369 _mav_put_uint16_t(buf, 16, heading);
370 _mav_put_int16_t(buf, 18, heading_sp);
371 _mav_put_int16_t(buf, 20, altitude_amsl);
372 _mav_put_int16_t(buf, 22, altitude_sp);
373 _mav_put_uint16_t(buf, 24, wp_distance);
374 _mav_put_uint8_t(buf, 26, base_mode);
375 _mav_put_uint8_t(buf, 27, landed_state);
376 _mav_put_int8_t(buf, 28, throttle);
377 _mav_put_uint8_t(buf, 29, airspeed);
378 _mav_put_uint8_t(buf, 30, airspeed_sp);
379 _mav_put_uint8_t(buf, 31, groundspeed);
380 _mav_put_int8_t(buf, 32, climb_rate);
381 _mav_put_uint8_t(buf, 33, gps_nsat);
382 _mav_put_uint8_t(buf, 34, gps_fix_type);
383 _mav_put_uint8_t(buf, 35, battery_remaining);
384 _mav_put_int8_t(buf, 36, temperature);
385 _mav_put_int8_t(buf, 37, temperature_air);
386 _mav_put_uint8_t(buf, 38, failsafe);
387 _mav_put_uint8_t(buf, 39, wp_num);
388
389 _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);
390#else
391 mavlink_high_latency_t packet;
392 packet.custom_mode = custom_mode;
393 packet.latitude = latitude;
394 packet.longitude = longitude;
395 packet.roll = roll;
396 packet.pitch = pitch;
397 packet.heading = heading;
398 packet.heading_sp = heading_sp;
399 packet.altitude_amsl = altitude_amsl;
400 packet.altitude_sp = altitude_sp;
401 packet.wp_distance = wp_distance;
402 packet.base_mode = base_mode;
403 packet.landed_state = landed_state;
404 packet.throttle = throttle;
405 packet.airspeed = airspeed;
406 packet.airspeed_sp = airspeed_sp;
407 packet.groundspeed = groundspeed;
408 packet.climb_rate = climb_rate;
409 packet.gps_nsat = gps_nsat;
410 packet.gps_fix_type = gps_fix_type;
411 packet.battery_remaining = battery_remaining;
412 packet.temperature = temperature;
413 packet.temperature_air = temperature_air;
414 packet.failsafe = failsafe;
415 packet.wp_num = wp_num;
416
417 _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);
418#endif
419}
420
421/**
422 * @brief Send a high_latency message
423 * @param chan MAVLink channel to send the message
424 * @param struct The MAVLink struct to serialize
425 */
426static inline void mavlink_msg_high_latency_send_struct(mavlink_channel_t chan, const mavlink_high_latency_t* high_latency)
427{
428#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
429 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);
430#else
431 _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);
432#endif
433}
434
435#if MAVLINK_MSG_ID_HIGH_LATENCY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
436/*
437 This varient of _send() can be used to save stack space by re-using
438 memory from the receive buffer. The caller provides a
439 mavlink_message_t which is the size of a full mavlink message. This
440 is usually the receive buffer for the channel, and allows a reply to an
441 incoming message with minimum stack space usage.
442 */
443static 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)
444{
445#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
446 char *buf = (char *)msgbuf;
447 _mav_put_uint32_t(buf, 0, custom_mode);
448 _mav_put_int32_t(buf, 4, latitude);
449 _mav_put_int32_t(buf, 8, longitude);
450 _mav_put_int16_t(buf, 12, roll);
451 _mav_put_int16_t(buf, 14, pitch);
452 _mav_put_uint16_t(buf, 16, heading);
453 _mav_put_int16_t(buf, 18, heading_sp);
454 _mav_put_int16_t(buf, 20, altitude_amsl);
455 _mav_put_int16_t(buf, 22, altitude_sp);
456 _mav_put_uint16_t(buf, 24, wp_distance);
457 _mav_put_uint8_t(buf, 26, base_mode);
458 _mav_put_uint8_t(buf, 27, landed_state);
459 _mav_put_int8_t(buf, 28, throttle);
460 _mav_put_uint8_t(buf, 29, airspeed);
461 _mav_put_uint8_t(buf, 30, airspeed_sp);
462 _mav_put_uint8_t(buf, 31, groundspeed);
463 _mav_put_int8_t(buf, 32, climb_rate);
464 _mav_put_uint8_t(buf, 33, gps_nsat);
465 _mav_put_uint8_t(buf, 34, gps_fix_type);
466 _mav_put_uint8_t(buf, 35, battery_remaining);
467 _mav_put_int8_t(buf, 36, temperature);
468 _mav_put_int8_t(buf, 37, temperature_air);
469 _mav_put_uint8_t(buf, 38, failsafe);
470 _mav_put_uint8_t(buf, 39, wp_num);
471
472 _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);
473#else
474 mavlink_high_latency_t *packet = (mavlink_high_latency_t *)msgbuf;
475 packet->custom_mode = custom_mode;
476 packet->latitude = latitude;
477 packet->longitude = longitude;
478 packet->roll = roll;
479 packet->pitch = pitch;
480 packet->heading = heading;
481 packet->heading_sp = heading_sp;
482 packet->altitude_amsl = altitude_amsl;
483 packet->altitude_sp = altitude_sp;
484 packet->wp_distance = wp_distance;
485 packet->base_mode = base_mode;
486 packet->landed_state = landed_state;
487 packet->throttle = throttle;
488 packet->airspeed = airspeed;
489 packet->airspeed_sp = airspeed_sp;
490 packet->groundspeed = groundspeed;
491 packet->climb_rate = climb_rate;
492 packet->gps_nsat = gps_nsat;
493 packet->gps_fix_type = gps_fix_type;
494 packet->battery_remaining = battery_remaining;
495 packet->temperature = temperature;
496 packet->temperature_air = temperature_air;
497 packet->failsafe = failsafe;
498 packet->wp_num = wp_num;
499
500 _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);
501#endif
502}
503#endif
504
505#endif
506
507// MESSAGE HIGH_LATENCY UNPACKING
508
509
510/**
511 * @brief Get field base_mode from high_latency message
512 *
513 * @return System mode bitfield, see MAV_MODE_FLAG ENUM in mavlink/include/mavlink_types.h
514 */
515static inline uint8_t mavlink_msg_high_latency_get_base_mode(const mavlink_message_t* msg)
516{
517 return _MAV_RETURN_uint8_t(msg, 26);
518}
519
520/**
521 * @brief Get field custom_mode from high_latency message
522 *
523 * @return A bitfield for use for autopilot-specific flags.
524 */
525static inline uint32_t mavlink_msg_high_latency_get_custom_mode(const mavlink_message_t* msg)
526{
527 return _MAV_RETURN_uint32_t(msg, 0);
528}
529
530/**
531 * @brief Get field landed_state from high_latency message
532 *
533 * @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
534 */
535static inline uint8_t mavlink_msg_high_latency_get_landed_state(const mavlink_message_t* msg)
536{
537 return _MAV_RETURN_uint8_t(msg, 27);
538}
539
540/**
541 * @brief Get field roll from high_latency message
542 *
543 * @return roll (centidegrees)
544 */
545static inline int16_t mavlink_msg_high_latency_get_roll(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_int16_t(msg, 12);
548}
549
550/**
551 * @brief Get field pitch from high_latency message
552 *
553 * @return pitch (centidegrees)
554 */
555static inline int16_t mavlink_msg_high_latency_get_pitch(const mavlink_message_t* msg)
556{
557 return _MAV_RETURN_int16_t(msg, 14);
558}
559
560/**
561 * @brief Get field heading from high_latency message
562 *
563 * @return heading (centidegrees)
564 */
565static inline uint16_t mavlink_msg_high_latency_get_heading(const mavlink_message_t* msg)
566{
567 return _MAV_RETURN_uint16_t(msg, 16);
568}
569
570/**
571 * @brief Get field throttle from high_latency message
572 *
573 * @return throttle (percentage)
574 */
575static inline int8_t mavlink_msg_high_latency_get_throttle(const mavlink_message_t* msg)
576{
577 return _MAV_RETURN_int8_t(msg, 28);
578}
579
580/**
581 * @brief Get field heading_sp from high_latency message
582 *
583 * @return heading setpoint (centidegrees)
584 */
585static inline int16_t mavlink_msg_high_latency_get_heading_sp(const mavlink_message_t* msg)
586{
587 return _MAV_RETURN_int16_t(msg, 18);
588}
589
590/**
591 * @brief Get field latitude from high_latency message
592 *
593 * @return Latitude, expressed as degrees * 1E7
594 */
595static inline int32_t mavlink_msg_high_latency_get_latitude(const mavlink_message_t* msg)
596{
597 return _MAV_RETURN_int32_t(msg, 4);
598}
599
600/**
601 * @brief Get field longitude from high_latency message
602 *
603 * @return Longitude, expressed as degrees * 1E7
604 */
605static inline int32_t mavlink_msg_high_latency_get_longitude(const mavlink_message_t* msg)
606{
607 return _MAV_RETURN_int32_t(msg, 8);
608}
609
610/**
611 * @brief Get field altitude_amsl from high_latency message
612 *
613 * @return Altitude above mean sea level (meters)
614 */
615static inline int16_t mavlink_msg_high_latency_get_altitude_amsl(const mavlink_message_t* msg)
616{
617 return _MAV_RETURN_int16_t(msg, 20);
618}
619
620/**
621 * @brief Get field altitude_sp from high_latency message
622 *
623 * @return Altitude setpoint relative to the home position (meters)
624 */
625static inline int16_t mavlink_msg_high_latency_get_altitude_sp(const mavlink_message_t* msg)
626{
627 return _MAV_RETURN_int16_t(msg, 22);
628}
629
630/**
631 * @brief Get field airspeed from high_latency message
632 *
633 * @return airspeed (m/s)
634 */
635static inline uint8_t mavlink_msg_high_latency_get_airspeed(const mavlink_message_t* msg)
636{
637 return _MAV_RETURN_uint8_t(msg, 29);
638}
639
640/**
641 * @brief Get field airspeed_sp from high_latency message
642 *
643 * @return airspeed setpoint (m/s)
644 */
645static inline uint8_t mavlink_msg_high_latency_get_airspeed_sp(const mavlink_message_t* msg)
646{
647 return _MAV_RETURN_uint8_t(msg, 30);
648}
649
650/**
651 * @brief Get field groundspeed from high_latency message
652 *
653 * @return groundspeed (m/s)
654 */
655static inline uint8_t mavlink_msg_high_latency_get_groundspeed(const mavlink_message_t* msg)
656{
657 return _MAV_RETURN_uint8_t(msg, 31);
658}
659
660/**
661 * @brief Get field climb_rate from high_latency message
662 *
663 * @return climb rate (m/s)
664 */
665static inline int8_t mavlink_msg_high_latency_get_climb_rate(const mavlink_message_t* msg)
666{
667 return _MAV_RETURN_int8_t(msg, 32);
668}
669
670/**
671 * @brief Get field gps_nsat from high_latency message
672 *
673 * @return Number of satellites visible. If unknown, set to 255
674 */
675static inline uint8_t mavlink_msg_high_latency_get_gps_nsat(const mavlink_message_t* msg)
676{
677 return _MAV_RETURN_uint8_t(msg, 33);
678}
679
680/**
681 * @brief Get field gps_fix_type from high_latency message
682 *
683 * @return See the GPS_FIX_TYPE enum.
684 */
685static inline uint8_t mavlink_msg_high_latency_get_gps_fix_type(const mavlink_message_t* msg)
686{
687 return _MAV_RETURN_uint8_t(msg, 34);
688}
689
690/**
691 * @brief Get field battery_remaining from high_latency message
692 *
693 * @return Remaining battery (percentage)
694 */
695static inline uint8_t mavlink_msg_high_latency_get_battery_remaining(const mavlink_message_t* msg)
696{
697 return _MAV_RETURN_uint8_t(msg, 35);
698}
699
700/**
701 * @brief Get field temperature from high_latency message
702 *
703 * @return Autopilot temperature (degrees C)
704 */
705static inline int8_t mavlink_msg_high_latency_get_temperature(const mavlink_message_t* msg)
706{
707 return _MAV_RETURN_int8_t(msg, 36);
708}
709
710/**
711 * @brief Get field temperature_air from high_latency message
712 *
713 * @return Air temperature (degrees C) from airspeed sensor
714 */
715static inline int8_t mavlink_msg_high_latency_get_temperature_air(const mavlink_message_t* msg)
716{
717 return _MAV_RETURN_int8_t(msg, 37);
718}
719
720/**
721 * @brief Get field failsafe from high_latency message
722 *
723 * @return failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
724 */
725static inline uint8_t mavlink_msg_high_latency_get_failsafe(const mavlink_message_t* msg)
726{
727 return _MAV_RETURN_uint8_t(msg, 38);
728}
729
730/**
731 * @brief Get field wp_num from high_latency message
732 *
733 * @return current waypoint number
734 */
735static inline uint8_t mavlink_msg_high_latency_get_wp_num(const mavlink_message_t* msg)
736{
737 return _MAV_RETURN_uint8_t(msg, 39);
738}
739
740/**
741 * @brief Get field wp_distance from high_latency message
742 *
743 * @return distance to target (meters)
744 */
745static inline uint16_t mavlink_msg_high_latency_get_wp_distance(const mavlink_message_t* msg)
746{
747 return _MAV_RETURN_uint16_t(msg, 24);
748}
749
750/**
751 * @brief Decode a high_latency message into a struct
752 *
753 * @param msg The message to decode
754 * @param high_latency C-struct to decode the message contents into
755 */
756static inline void mavlink_msg_high_latency_decode(const mavlink_message_t* msg, mavlink_high_latency_t* high_latency)
757{
758#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
759 high_latency->custom_mode = mavlink_msg_high_latency_get_custom_mode(msg);
760 high_latency->latitude = mavlink_msg_high_latency_get_latitude(msg);
761 high_latency->longitude = mavlink_msg_high_latency_get_longitude(msg);
762 high_latency->roll = mavlink_msg_high_latency_get_roll(msg);
763 high_latency->pitch = mavlink_msg_high_latency_get_pitch(msg);
764 high_latency->heading = mavlink_msg_high_latency_get_heading(msg);
765 high_latency->heading_sp = mavlink_msg_high_latency_get_heading_sp(msg);
766 high_latency->altitude_amsl = mavlink_msg_high_latency_get_altitude_amsl(msg);
767 high_latency->altitude_sp = mavlink_msg_high_latency_get_altitude_sp(msg);
768 high_latency->wp_distance = mavlink_msg_high_latency_get_wp_distance(msg);
769 high_latency->base_mode = mavlink_msg_high_latency_get_base_mode(msg);
770 high_latency->landed_state = mavlink_msg_high_latency_get_landed_state(msg);
771 high_latency->throttle = mavlink_msg_high_latency_get_throttle(msg);
772 high_latency->airspeed = mavlink_msg_high_latency_get_airspeed(msg);
773 high_latency->airspeed_sp = mavlink_msg_high_latency_get_airspeed_sp(msg);
774 high_latency->groundspeed = mavlink_msg_high_latency_get_groundspeed(msg);
775 high_latency->climb_rate = mavlink_msg_high_latency_get_climb_rate(msg);
776 high_latency->gps_nsat = mavlink_msg_high_latency_get_gps_nsat(msg);
777 high_latency->gps_fix_type = mavlink_msg_high_latency_get_gps_fix_type(msg);
778 high_latency->battery_remaining = mavlink_msg_high_latency_get_battery_remaining(msg);
779 high_latency->temperature = mavlink_msg_high_latency_get_temperature(msg);
780 high_latency->temperature_air = mavlink_msg_high_latency_get_temperature_air(msg);
781 high_latency->failsafe = mavlink_msg_high_latency_get_failsafe(msg);
782 high_latency->wp_num = mavlink_msg_high_latency_get_wp_num(msg);
783#else
784 uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY_LEN? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY_LEN;
785 memset(high_latency, 0, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
786 memcpy(high_latency, _MAV_PAYLOAD(msg), len);
787#endif
788}