before merging master
[inav.git] / lib / main / MAVLink / common / mavlink_msg_high_latency.h
bloba0f4e84963df63f3721a679a6e3cf52a79d0ba40
1 #pragma once
2 // MESSAGE HIGH_LATENCY PACKING
4 #define MAVLINK_MSG_ID_HIGH_LATENCY 234
7 typedef struct __mavlink_high_latency_t {
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 255*/
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;
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
39 #define MAVLINK_MSG_ID_HIGH_LATENCY_CRC 150
40 #define MAVLINK_MSG_ID_234_CRC 150
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 } \
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) }, \
105 #endif
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
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 255
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)
139 static 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)
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);
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;
197 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
198 #endif
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);
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 Bitmap of enabled system modes.
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 [cdeg] roll
214 * @param pitch [cdeg] pitch
215 * @param heading [cdeg] heading
216 * @param throttle [%] throttle (percentage)
217 * @param heading_sp [cdeg] heading setpoint
218 * @param latitude [degE7] Latitude
219 * @param longitude [degE7] Longitude
220 * @param altitude_amsl [m] Altitude above mean sea level
221 * @param altitude_sp [m] Altitude setpoint relative to the home position
222 * @param airspeed [m/s] airspeed
223 * @param airspeed_sp [m/s] airspeed setpoint
224 * @param groundspeed [m/s] groundspeed
225 * @param climb_rate [m/s] climb rate
226 * @param gps_nsat Number of satellites visible. If unknown, set to 255
227 * @param gps_fix_type GPS Fix type.
228 * @param battery_remaining [%] Remaining battery (percentage)
229 * @param temperature [degC] Autopilot temperature (degrees C)
230 * @param temperature_air [degC] 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 [m] distance to target
234 * @return length of the message in bytes (excluding serial stream start sign)
236 static 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)
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);
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;
295 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY_LEN);
296 #endif
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);
303 * @brief Encode a high_latency struct
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
310 static 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)
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);
316 * @brief Encode a high_latency struct on a channel
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
324 static 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)
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);
330 * @brief Send a high_latency message
331 * @param chan MAVLink channel to send the message
333 * @param base_mode Bitmap of enabled system modes.
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 [cdeg] roll
337 * @param pitch [cdeg] pitch
338 * @param heading [cdeg] heading
339 * @param throttle [%] throttle (percentage)
340 * @param heading_sp [cdeg] heading setpoint
341 * @param latitude [degE7] Latitude
342 * @param longitude [degE7] Longitude
343 * @param altitude_amsl [m] Altitude above mean sea level
344 * @param altitude_sp [m] Altitude setpoint relative to the home position
345 * @param airspeed [m/s] airspeed
346 * @param airspeed_sp [m/s] airspeed setpoint
347 * @param groundspeed [m/s] groundspeed
348 * @param climb_rate [m/s] climb rate
349 * @param gps_nsat Number of satellites visible. If unknown, set to 255
350 * @param gps_fix_type GPS Fix type.
351 * @param battery_remaining [%] Remaining battery (percentage)
352 * @param temperature [degC] Autopilot temperature (degrees C)
353 * @param temperature_air [degC] 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 [m] distance to target
358 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
360 static 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)
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);
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;
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
422 * @brief Send a high_latency message
423 * @param chan MAVLink channel to send the message
424 * @param struct The MAVLink struct to serialize
426 static inline void mavlink_msg_high_latency_send_struct(mavlink_channel_t chan, const mavlink_high_latency_t* high_latency)
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
435 #if MAVLINK_MSG_ID_HIGH_LATENCY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
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.
443 static 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)
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);
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;
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
503 #endif
505 #endif
507 // MESSAGE HIGH_LATENCY UNPACKING
511 * @brief Get field base_mode from high_latency message
513 * @return Bitmap of enabled system modes.
515 static inline uint8_t mavlink_msg_high_latency_get_base_mode(const mavlink_message_t* msg)
517 return _MAV_RETURN_uint8_t(msg, 26);
521 * @brief Get field custom_mode from high_latency message
523 * @return A bitfield for use for autopilot-specific flags.
525 static inline uint32_t mavlink_msg_high_latency_get_custom_mode(const mavlink_message_t* msg)
527 return _MAV_RETURN_uint32_t(msg, 0);
531 * @brief Get field landed_state from high_latency message
533 * @return The landed state. Is set to MAV_LANDED_STATE_UNDEFINED if landed state is unknown.
535 static inline uint8_t mavlink_msg_high_latency_get_landed_state(const mavlink_message_t* msg)
537 return _MAV_RETURN_uint8_t(msg, 27);
541 * @brief Get field roll from high_latency message
543 * @return [cdeg] roll
545 static inline int16_t mavlink_msg_high_latency_get_roll(const mavlink_message_t* msg)
547 return _MAV_RETURN_int16_t(msg, 12);
551 * @brief Get field pitch from high_latency message
553 * @return [cdeg] pitch
555 static inline int16_t mavlink_msg_high_latency_get_pitch(const mavlink_message_t* msg)
557 return _MAV_RETURN_int16_t(msg, 14);
561 * @brief Get field heading from high_latency message
563 * @return [cdeg] heading
565 static inline uint16_t mavlink_msg_high_latency_get_heading(const mavlink_message_t* msg)
567 return _MAV_RETURN_uint16_t(msg, 16);
571 * @brief Get field throttle from high_latency message
573 * @return [%] throttle (percentage)
575 static inline int8_t mavlink_msg_high_latency_get_throttle(const mavlink_message_t* msg)
577 return _MAV_RETURN_int8_t(msg, 28);
581 * @brief Get field heading_sp from high_latency message
583 * @return [cdeg] heading setpoint
585 static inline int16_t mavlink_msg_high_latency_get_heading_sp(const mavlink_message_t* msg)
587 return _MAV_RETURN_int16_t(msg, 18);
591 * @brief Get field latitude from high_latency message
593 * @return [degE7] Latitude
595 static inline int32_t mavlink_msg_high_latency_get_latitude(const mavlink_message_t* msg)
597 return _MAV_RETURN_int32_t(msg, 4);
601 * @brief Get field longitude from high_latency message
603 * @return [degE7] Longitude
605 static inline int32_t mavlink_msg_high_latency_get_longitude(const mavlink_message_t* msg)
607 return _MAV_RETURN_int32_t(msg, 8);
611 * @brief Get field altitude_amsl from high_latency message
613 * @return [m] Altitude above mean sea level
615 static inline int16_t mavlink_msg_high_latency_get_altitude_amsl(const mavlink_message_t* msg)
617 return _MAV_RETURN_int16_t(msg, 20);
621 * @brief Get field altitude_sp from high_latency message
623 * @return [m] Altitude setpoint relative to the home position
625 static inline int16_t mavlink_msg_high_latency_get_altitude_sp(const mavlink_message_t* msg)
627 return _MAV_RETURN_int16_t(msg, 22);
631 * @brief Get field airspeed from high_latency message
633 * @return [m/s] airspeed
635 static inline uint8_t mavlink_msg_high_latency_get_airspeed(const mavlink_message_t* msg)
637 return _MAV_RETURN_uint8_t(msg, 29);
641 * @brief Get field airspeed_sp from high_latency message
643 * @return [m/s] airspeed setpoint
645 static inline uint8_t mavlink_msg_high_latency_get_airspeed_sp(const mavlink_message_t* msg)
647 return _MAV_RETURN_uint8_t(msg, 30);
651 * @brief Get field groundspeed from high_latency message
653 * @return [m/s] groundspeed
655 static inline uint8_t mavlink_msg_high_latency_get_groundspeed(const mavlink_message_t* msg)
657 return _MAV_RETURN_uint8_t(msg, 31);
661 * @brief Get field climb_rate from high_latency message
663 * @return [m/s] climb rate
665 static inline int8_t mavlink_msg_high_latency_get_climb_rate(const mavlink_message_t* msg)
667 return _MAV_RETURN_int8_t(msg, 32);
671 * @brief Get field gps_nsat from high_latency message
673 * @return Number of satellites visible. If unknown, set to 255
675 static inline uint8_t mavlink_msg_high_latency_get_gps_nsat(const mavlink_message_t* msg)
677 return _MAV_RETURN_uint8_t(msg, 33);
681 * @brief Get field gps_fix_type from high_latency message
683 * @return GPS Fix type.
685 static inline uint8_t mavlink_msg_high_latency_get_gps_fix_type(const mavlink_message_t* msg)
687 return _MAV_RETURN_uint8_t(msg, 34);
691 * @brief Get field battery_remaining from high_latency message
693 * @return [%] Remaining battery (percentage)
695 static inline uint8_t mavlink_msg_high_latency_get_battery_remaining(const mavlink_message_t* msg)
697 return _MAV_RETURN_uint8_t(msg, 35);
701 * @brief Get field temperature from high_latency message
703 * @return [degC] Autopilot temperature (degrees C)
705 static inline int8_t mavlink_msg_high_latency_get_temperature(const mavlink_message_t* msg)
707 return _MAV_RETURN_int8_t(msg, 36);
711 * @brief Get field temperature_air from high_latency message
713 * @return [degC] Air temperature (degrees C) from airspeed sensor
715 static inline int8_t mavlink_msg_high_latency_get_temperature_air(const mavlink_message_t* msg)
717 return _MAV_RETURN_int8_t(msg, 37);
721 * @brief Get field failsafe from high_latency message
723 * @return failsafe (each bit represents a failsafe where 0=ok, 1=failsafe active (bit0:RC, bit1:batt, bit2:GPS, bit3:GCS, bit4:fence)
725 static inline uint8_t mavlink_msg_high_latency_get_failsafe(const mavlink_message_t* msg)
727 return _MAV_RETURN_uint8_t(msg, 38);
731 * @brief Get field wp_num from high_latency message
733 * @return current waypoint number
735 static inline uint8_t mavlink_msg_high_latency_get_wp_num(const mavlink_message_t* msg)
737 return _MAV_RETURN_uint8_t(msg, 39);
741 * @brief Get field wp_distance from high_latency message
743 * @return [m] distance to target
745 static inline uint16_t mavlink_msg_high_latency_get_wp_distance(const mavlink_message_t* msg)
747 return _MAV_RETURN_uint16_t(msg, 24);
751 * @brief Decode a high_latency message into a struct
753 * @param msg The message to decode
754 * @param high_latency C-struct to decode the message contents into
756 static inline void mavlink_msg_high_latency_decode(const mavlink_message_t* msg, mavlink_high_latency_t* high_latency)
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