before merging master
[inav.git] / lib / main / MAVLink / common / mavlink_msg_adsb_vehicle.h
blob7296c22aa5ad8b0ac880eaa680800ea624e85369
1 #pragma once
2 // MESSAGE ADSB_VEHICLE PACKING
4 #define MAVLINK_MSG_ID_ADSB_VEHICLE 246
7 typedef struct __mavlink_adsb_vehicle_t {
8 uint32_t ICAO_address; /*< ICAO address*/
9 int32_t lat; /*< [degE7] Latitude*/
10 int32_t lon; /*< [degE7] Longitude*/
11 int32_t altitude; /*< [mm] Altitude(ASL)*/
12 uint16_t heading; /*< [cdeg] Course over ground*/
13 uint16_t hor_velocity; /*< [cm/s] The horizontal velocity*/
14 int16_t ver_velocity; /*< [cm/s] The vertical velocity. Positive is up*/
15 uint16_t flags; /*< Bitmap to indicate various statuses including valid data fields*/
16 uint16_t squawk; /*< Squawk code*/
17 uint8_t altitude_type; /*< ADSB altitude type.*/
18 char callsign[9]; /*< The callsign, 8+null*/
19 uint8_t emitter_type; /*< ADSB emitter type.*/
20 uint8_t tslc; /*< [s] Time since last communication in seconds*/
21 } mavlink_adsb_vehicle_t;
23 #define MAVLINK_MSG_ID_ADSB_VEHICLE_LEN 38
24 #define MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN 38
25 #define MAVLINK_MSG_ID_246_LEN 38
26 #define MAVLINK_MSG_ID_246_MIN_LEN 38
28 #define MAVLINK_MSG_ID_ADSB_VEHICLE_CRC 184
29 #define MAVLINK_MSG_ID_246_CRC 184
31 #define MAVLINK_MSG_ADSB_VEHICLE_FIELD_CALLSIGN_LEN 9
33 #if MAVLINK_COMMAND_24BIT
34 #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
35 246, \
36 "ADSB_VEHICLE", \
37 13, \
38 { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
39 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
40 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
41 { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
42 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
43 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
44 { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
45 { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
46 { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
47 { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
48 { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
49 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
50 { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
51 } \
53 #else
54 #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
55 "ADSB_VEHICLE", \
56 13, \
57 { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
58 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
59 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
60 { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
61 { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
62 { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
63 { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
64 { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
65 { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
66 { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
67 { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
68 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
69 { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
70 } \
72 #endif
74 /**
75 * @brief Pack a adsb_vehicle message
76 * @param system_id ID of this system
77 * @param component_id ID of this component (e.g. 200 for IMU)
78 * @param msg The MAVLink message to compress the data into
80 * @param ICAO_address ICAO address
81 * @param lat [degE7] Latitude
82 * @param lon [degE7] Longitude
83 * @param altitude_type ADSB altitude type.
84 * @param altitude [mm] Altitude(ASL)
85 * @param heading [cdeg] Course over ground
86 * @param hor_velocity [cm/s] The horizontal velocity
87 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
88 * @param callsign The callsign, 8+null
89 * @param emitter_type ADSB emitter type.
90 * @param tslc [s] Time since last communication in seconds
91 * @param flags Bitmap to indicate various statuses including valid data fields
92 * @param squawk Squawk code
93 * @return length of the message in bytes (excluding serial stream start sign)
95 static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
96 uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
98 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
99 char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
100 _mav_put_uint32_t(buf, 0, ICAO_address);
101 _mav_put_int32_t(buf, 4, lat);
102 _mav_put_int32_t(buf, 8, lon);
103 _mav_put_int32_t(buf, 12, altitude);
104 _mav_put_uint16_t(buf, 16, heading);
105 _mav_put_uint16_t(buf, 18, hor_velocity);
106 _mav_put_int16_t(buf, 20, ver_velocity);
107 _mav_put_uint16_t(buf, 22, flags);
108 _mav_put_uint16_t(buf, 24, squawk);
109 _mav_put_uint8_t(buf, 26, altitude_type);
110 _mav_put_uint8_t(buf, 36, emitter_type);
111 _mav_put_uint8_t(buf, 37, tslc);
112 _mav_put_char_array(buf, 27, callsign, 9);
113 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
114 #else
115 mavlink_adsb_vehicle_t packet;
116 packet.ICAO_address = ICAO_address;
117 packet.lat = lat;
118 packet.lon = lon;
119 packet.altitude = altitude;
120 packet.heading = heading;
121 packet.hor_velocity = hor_velocity;
122 packet.ver_velocity = ver_velocity;
123 packet.flags = flags;
124 packet.squawk = squawk;
125 packet.altitude_type = altitude_type;
126 packet.emitter_type = emitter_type;
127 packet.tslc = tslc;
128 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
130 #endif
132 msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
133 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
137 * @brief Pack a adsb_vehicle message on a channel
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param chan The MAVLink channel this message will be sent over
141 * @param msg The MAVLink message to compress the data into
142 * @param ICAO_address ICAO address
143 * @param lat [degE7] Latitude
144 * @param lon [degE7] Longitude
145 * @param altitude_type ADSB altitude type.
146 * @param altitude [mm] Altitude(ASL)
147 * @param heading [cdeg] Course over ground
148 * @param hor_velocity [cm/s] The horizontal velocity
149 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
150 * @param callsign The callsign, 8+null
151 * @param emitter_type ADSB emitter type.
152 * @param tslc [s] Time since last communication in seconds
153 * @param flags Bitmap to indicate various statuses including valid data fields
154 * @param squawk Squawk code
155 * @return length of the message in bytes (excluding serial stream start sign)
157 static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
158 mavlink_message_t* msg,
159 uint32_t ICAO_address,int32_t lat,int32_t lon,uint8_t altitude_type,int32_t altitude,uint16_t heading,uint16_t hor_velocity,int16_t ver_velocity,const char *callsign,uint8_t emitter_type,uint8_t tslc,uint16_t flags,uint16_t squawk)
161 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
162 char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
163 _mav_put_uint32_t(buf, 0, ICAO_address);
164 _mav_put_int32_t(buf, 4, lat);
165 _mav_put_int32_t(buf, 8, lon);
166 _mav_put_int32_t(buf, 12, altitude);
167 _mav_put_uint16_t(buf, 16, heading);
168 _mav_put_uint16_t(buf, 18, hor_velocity);
169 _mav_put_int16_t(buf, 20, ver_velocity);
170 _mav_put_uint16_t(buf, 22, flags);
171 _mav_put_uint16_t(buf, 24, squawk);
172 _mav_put_uint8_t(buf, 26, altitude_type);
173 _mav_put_uint8_t(buf, 36, emitter_type);
174 _mav_put_uint8_t(buf, 37, tslc);
175 _mav_put_char_array(buf, 27, callsign, 9);
176 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
177 #else
178 mavlink_adsb_vehicle_t packet;
179 packet.ICAO_address = ICAO_address;
180 packet.lat = lat;
181 packet.lon = lon;
182 packet.altitude = altitude;
183 packet.heading = heading;
184 packet.hor_velocity = hor_velocity;
185 packet.ver_velocity = ver_velocity;
186 packet.flags = flags;
187 packet.squawk = squawk;
188 packet.altitude_type = altitude_type;
189 packet.emitter_type = emitter_type;
190 packet.tslc = tslc;
191 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
192 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
193 #endif
195 msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
196 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
200 * @brief Encode a adsb_vehicle struct
202 * @param system_id ID of this system
203 * @param component_id ID of this component (e.g. 200 for IMU)
204 * @param msg The MAVLink message to compress the data into
205 * @param adsb_vehicle C-struct to read the message contents from
207 static inline uint16_t mavlink_msg_adsb_vehicle_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
209 return mavlink_msg_adsb_vehicle_pack(system_id, component_id, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
213 * @brief Encode a adsb_vehicle struct on a channel
215 * @param system_id ID of this system
216 * @param component_id ID of this component (e.g. 200 for IMU)
217 * @param chan The MAVLink channel this message will be sent over
218 * @param msg The MAVLink message to compress the data into
219 * @param adsb_vehicle C-struct to read the message contents from
221 static inline uint16_t mavlink_msg_adsb_vehicle_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
223 return mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, chan, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
227 * @brief Send a adsb_vehicle message
228 * @param chan MAVLink channel to send the message
230 * @param ICAO_address ICAO address
231 * @param lat [degE7] Latitude
232 * @param lon [degE7] Longitude
233 * @param altitude_type ADSB altitude type.
234 * @param altitude [mm] Altitude(ASL)
235 * @param heading [cdeg] Course over ground
236 * @param hor_velocity [cm/s] The horizontal velocity
237 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
238 * @param callsign The callsign, 8+null
239 * @param emitter_type ADSB emitter type.
240 * @param tslc [s] Time since last communication in seconds
241 * @param flags Bitmap to indicate various statuses including valid data fields
242 * @param squawk Squawk code
244 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
246 static inline void mavlink_msg_adsb_vehicle_send(mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
248 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
249 char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
250 _mav_put_uint32_t(buf, 0, ICAO_address);
251 _mav_put_int32_t(buf, 4, lat);
252 _mav_put_int32_t(buf, 8, lon);
253 _mav_put_int32_t(buf, 12, altitude);
254 _mav_put_uint16_t(buf, 16, heading);
255 _mav_put_uint16_t(buf, 18, hor_velocity);
256 _mav_put_int16_t(buf, 20, ver_velocity);
257 _mav_put_uint16_t(buf, 22, flags);
258 _mav_put_uint16_t(buf, 24, squawk);
259 _mav_put_uint8_t(buf, 26, altitude_type);
260 _mav_put_uint8_t(buf, 36, emitter_type);
261 _mav_put_uint8_t(buf, 37, tslc);
262 _mav_put_char_array(buf, 27, callsign, 9);
263 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
264 #else
265 mavlink_adsb_vehicle_t packet;
266 packet.ICAO_address = ICAO_address;
267 packet.lat = lat;
268 packet.lon = lon;
269 packet.altitude = altitude;
270 packet.heading = heading;
271 packet.hor_velocity = hor_velocity;
272 packet.ver_velocity = ver_velocity;
273 packet.flags = flags;
274 packet.squawk = squawk;
275 packet.altitude_type = altitude_type;
276 packet.emitter_type = emitter_type;
277 packet.tslc = tslc;
278 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
279 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)&packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
280 #endif
284 * @brief Send a adsb_vehicle message
285 * @param chan MAVLink channel to send the message
286 * @param struct The MAVLink struct to serialize
288 static inline void mavlink_msg_adsb_vehicle_send_struct(mavlink_channel_t chan, const mavlink_adsb_vehicle_t* adsb_vehicle)
290 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
291 mavlink_msg_adsb_vehicle_send(chan, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
292 #else
293 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)adsb_vehicle, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
294 #endif
297 #if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
299 This varient of _send() can be used to save stack space by re-using
300 memory from the receive buffer. The caller provides a
301 mavlink_message_t which is the size of a full mavlink message. This
302 is usually the receive buffer for the channel, and allows a reply to an
303 incoming message with minimum stack space usage.
305 static inline void mavlink_msg_adsb_vehicle_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
307 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
308 char *buf = (char *)msgbuf;
309 _mav_put_uint32_t(buf, 0, ICAO_address);
310 _mav_put_int32_t(buf, 4, lat);
311 _mav_put_int32_t(buf, 8, lon);
312 _mav_put_int32_t(buf, 12, altitude);
313 _mav_put_uint16_t(buf, 16, heading);
314 _mav_put_uint16_t(buf, 18, hor_velocity);
315 _mav_put_int16_t(buf, 20, ver_velocity);
316 _mav_put_uint16_t(buf, 22, flags);
317 _mav_put_uint16_t(buf, 24, squawk);
318 _mav_put_uint8_t(buf, 26, altitude_type);
319 _mav_put_uint8_t(buf, 36, emitter_type);
320 _mav_put_uint8_t(buf, 37, tslc);
321 _mav_put_char_array(buf, 27, callsign, 9);
322 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
323 #else
324 mavlink_adsb_vehicle_t *packet = (mavlink_adsb_vehicle_t *)msgbuf;
325 packet->ICAO_address = ICAO_address;
326 packet->lat = lat;
327 packet->lon = lon;
328 packet->altitude = altitude;
329 packet->heading = heading;
330 packet->hor_velocity = hor_velocity;
331 packet->ver_velocity = ver_velocity;
332 packet->flags = flags;
333 packet->squawk = squawk;
334 packet->altitude_type = altitude_type;
335 packet->emitter_type = emitter_type;
336 packet->tslc = tslc;
337 mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9);
338 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
339 #endif
341 #endif
343 #endif
345 // MESSAGE ADSB_VEHICLE UNPACKING
349 * @brief Get field ICAO_address from adsb_vehicle message
351 * @return ICAO address
353 static inline uint32_t mavlink_msg_adsb_vehicle_get_ICAO_address(const mavlink_message_t* msg)
355 return _MAV_RETURN_uint32_t(msg, 0);
359 * @brief Get field lat from adsb_vehicle message
361 * @return [degE7] Latitude
363 static inline int32_t mavlink_msg_adsb_vehicle_get_lat(const mavlink_message_t* msg)
365 return _MAV_RETURN_int32_t(msg, 4);
369 * @brief Get field lon from adsb_vehicle message
371 * @return [degE7] Longitude
373 static inline int32_t mavlink_msg_adsb_vehicle_get_lon(const mavlink_message_t* msg)
375 return _MAV_RETURN_int32_t(msg, 8);
379 * @brief Get field altitude_type from adsb_vehicle message
381 * @return ADSB altitude type.
383 static inline uint8_t mavlink_msg_adsb_vehicle_get_altitude_type(const mavlink_message_t* msg)
385 return _MAV_RETURN_uint8_t(msg, 26);
389 * @brief Get field altitude from adsb_vehicle message
391 * @return [mm] Altitude(ASL)
393 static inline int32_t mavlink_msg_adsb_vehicle_get_altitude(const mavlink_message_t* msg)
395 return _MAV_RETURN_int32_t(msg, 12);
399 * @brief Get field heading from adsb_vehicle message
401 * @return [cdeg] Course over ground
403 static inline uint16_t mavlink_msg_adsb_vehicle_get_heading(const mavlink_message_t* msg)
405 return _MAV_RETURN_uint16_t(msg, 16);
409 * @brief Get field hor_velocity from adsb_vehicle message
411 * @return [cm/s] The horizontal velocity
413 static inline uint16_t mavlink_msg_adsb_vehicle_get_hor_velocity(const mavlink_message_t* msg)
415 return _MAV_RETURN_uint16_t(msg, 18);
419 * @brief Get field ver_velocity from adsb_vehicle message
421 * @return [cm/s] The vertical velocity. Positive is up
423 static inline int16_t mavlink_msg_adsb_vehicle_get_ver_velocity(const mavlink_message_t* msg)
425 return _MAV_RETURN_int16_t(msg, 20);
429 * @brief Get field callsign from adsb_vehicle message
431 * @return The callsign, 8+null
433 static inline uint16_t mavlink_msg_adsb_vehicle_get_callsign(const mavlink_message_t* msg, char *callsign)
435 return _MAV_RETURN_char_array(msg, callsign, 9, 27);
439 * @brief Get field emitter_type from adsb_vehicle message
441 * @return ADSB emitter type.
443 static inline uint8_t mavlink_msg_adsb_vehicle_get_emitter_type(const mavlink_message_t* msg)
445 return _MAV_RETURN_uint8_t(msg, 36);
449 * @brief Get field tslc from adsb_vehicle message
451 * @return [s] Time since last communication in seconds
453 static inline uint8_t mavlink_msg_adsb_vehicle_get_tslc(const mavlink_message_t* msg)
455 return _MAV_RETURN_uint8_t(msg, 37);
459 * @brief Get field flags from adsb_vehicle message
461 * @return Bitmap to indicate various statuses including valid data fields
463 static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_t* msg)
465 return _MAV_RETURN_uint16_t(msg, 22);
469 * @brief Get field squawk from adsb_vehicle message
471 * @return Squawk code
473 static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg)
475 return _MAV_RETURN_uint16_t(msg, 24);
479 * @brief Decode a adsb_vehicle message into a struct
481 * @param msg The message to decode
482 * @param adsb_vehicle C-struct to decode the message contents into
484 static inline void mavlink_msg_adsb_vehicle_decode(const mavlink_message_t* msg, mavlink_adsb_vehicle_t* adsb_vehicle)
486 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
487 adsb_vehicle->ICAO_address = mavlink_msg_adsb_vehicle_get_ICAO_address(msg);
488 adsb_vehicle->lat = mavlink_msg_adsb_vehicle_get_lat(msg);
489 adsb_vehicle->lon = mavlink_msg_adsb_vehicle_get_lon(msg);
490 adsb_vehicle->altitude = mavlink_msg_adsb_vehicle_get_altitude(msg);
491 adsb_vehicle->heading = mavlink_msg_adsb_vehicle_get_heading(msg);
492 adsb_vehicle->hor_velocity = mavlink_msg_adsb_vehicle_get_hor_velocity(msg);
493 adsb_vehicle->ver_velocity = mavlink_msg_adsb_vehicle_get_ver_velocity(msg);
494 adsb_vehicle->flags = mavlink_msg_adsb_vehicle_get_flags(msg);
495 adsb_vehicle->squawk = mavlink_msg_adsb_vehicle_get_squawk(msg);
496 adsb_vehicle->altitude_type = mavlink_msg_adsb_vehicle_get_altitude_type(msg);
497 mavlink_msg_adsb_vehicle_get_callsign(msg, adsb_vehicle->callsign);
498 adsb_vehicle->emitter_type = mavlink_msg_adsb_vehicle_get_emitter_type(msg);
499 adsb_vehicle->tslc = mavlink_msg_adsb_vehicle_get_tslc(msg);
500 #else
501 uint8_t len = msg->len < MAVLINK_MSG_ID_ADSB_VEHICLE_LEN? msg->len : MAVLINK_MSG_ID_ADSB_VEHICLE_LEN;
502 memset(adsb_vehicle, 0, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
503 memcpy(adsb_vehicle, _MAV_PAYLOAD(msg), len);
504 #endif