Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_adsb_vehicle.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE ADSB_VEHICLE PACKING
3
4#define MAVLINK_MSG_ID_ADSB_VEHICLE 246
5
6
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. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000*/
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 from the remote vehicle, in seconds.*/
21} mavlink_adsb_vehicle_t;
22
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
27
28#define MAVLINK_MSG_ID_ADSB_VEHICLE_CRC 184
29#define MAVLINK_MSG_ID_246_CRC 184
30
31#define MAVLINK_MSG_ADSB_VEHICLE_FIELD_CALLSIGN_LEN 9
32
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 } \
52}
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 } \
71}
72#endif
73
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
79 *
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 from the remote vehicle, in seconds.
91 * @param flags Bitmap to indicate various statuses including valid data fields
92 * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000
93 * @return length of the message in bytes (excluding serial stream start sign)
94 */
95static 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)
97{
98#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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
131
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);
134}
135
136/**
137 * @brief Pack a adsb_vehicle message
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param status MAVLink status structure
141 * @param msg The MAVLink message to compress the data into
142 *
143 * @param ICAO_address ICAO address
144 * @param lat [degE7] Latitude
145 * @param lon [degE7] Longitude
146 * @param altitude_type ADSB altitude type.
147 * @param altitude [mm] Altitude (ASL)
148 * @param heading [cdeg] Course over ground
149 * @param hor_velocity [cm/s] The horizontal velocity
150 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
151 * @param callsign The callsign, 8+null
152 * @param emitter_type ADSB emitter type.
153 * @param tslc [s] Time since last communication from the remote vehicle, in seconds.
154 * @param flags Bitmap to indicate various statuses including valid data fields
155 * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000
156 * @return length of the message in bytes (excluding serial stream start sign)
157 */
158static inline uint16_t mavlink_msg_adsb_vehicle_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, 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)
160{
161#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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
194
195 msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
196#if MAVLINK_CRC_EXTRA
197 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
198#else
199 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
200#endif
201}
202
203/**
204 * @brief Pack a adsb_vehicle message on a channel
205 * @param system_id ID of this system
206 * @param component_id ID of this component (e.g. 200 for IMU)
207 * @param chan The MAVLink channel this message will be sent over
208 * @param msg The MAVLink message to compress the data into
209 * @param ICAO_address ICAO address
210 * @param lat [degE7] Latitude
211 * @param lon [degE7] Longitude
212 * @param altitude_type ADSB altitude type.
213 * @param altitude [mm] Altitude (ASL)
214 * @param heading [cdeg] Course over ground
215 * @param hor_velocity [cm/s] The horizontal velocity
216 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
217 * @param callsign The callsign, 8+null
218 * @param emitter_type ADSB emitter type.
219 * @param tslc [s] Time since last communication from the remote vehicle, in seconds.
220 * @param flags Bitmap to indicate various statuses including valid data fields
221 * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000
222 * @return length of the message in bytes (excluding serial stream start sign)
223 */
224static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
225 mavlink_message_t* msg,
226 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)
227{
228#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 _mav_put_uint32_t(buf, 0, ICAO_address);
231 _mav_put_int32_t(buf, 4, lat);
232 _mav_put_int32_t(buf, 8, lon);
233 _mav_put_int32_t(buf, 12, altitude);
234 _mav_put_uint16_t(buf, 16, heading);
235 _mav_put_uint16_t(buf, 18, hor_velocity);
236 _mav_put_int16_t(buf, 20, ver_velocity);
237 _mav_put_uint16_t(buf, 22, flags);
238 _mav_put_uint16_t(buf, 24, squawk);
239 _mav_put_uint8_t(buf, 26, altitude_type);
240 _mav_put_uint8_t(buf, 36, emitter_type);
241 _mav_put_uint8_t(buf, 37, tslc);
242 _mav_put_char_array(buf, 27, callsign, 9);
243 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
244#else
245 mavlink_adsb_vehicle_t packet;
246 packet.ICAO_address = ICAO_address;
247 packet.lat = lat;
248 packet.lon = lon;
249 packet.altitude = altitude;
250 packet.heading = heading;
251 packet.hor_velocity = hor_velocity;
252 packet.ver_velocity = ver_velocity;
253 packet.flags = flags;
254 packet.squawk = squawk;
255 packet.altitude_type = altitude_type;
256 packet.emitter_type = emitter_type;
257 packet.tslc = tslc;
258 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
259 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
260#endif
261
262 msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
263 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);
264}
265
266/**
267 * @brief Encode a adsb_vehicle struct
268 *
269 * @param system_id ID of this system
270 * @param component_id ID of this component (e.g. 200 for IMU)
271 * @param msg The MAVLink message to compress the data into
272 * @param adsb_vehicle C-struct to read the message contents from
273 */
274static 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)
275{
276 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);
277}
278
279/**
280 * @brief Encode a adsb_vehicle struct on a channel
281 *
282 * @param system_id ID of this system
283 * @param component_id ID of this component (e.g. 200 for IMU)
284 * @param chan The MAVLink channel this message will be sent over
285 * @param msg The MAVLink message to compress the data into
286 * @param adsb_vehicle C-struct to read the message contents from
287 */
288static 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)
289{
290 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);
291}
292
293/**
294 * @brief Encode a adsb_vehicle struct with provided status structure
295 *
296 * @param system_id ID of this system
297 * @param component_id ID of this component (e.g. 200 for IMU)
298 * @param status MAVLink status structure
299 * @param msg The MAVLink message to compress the data into
300 * @param adsb_vehicle C-struct to read the message contents from
301 */
302static inline uint16_t mavlink_msg_adsb_vehicle_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
303{
304 return mavlink_msg_adsb_vehicle_pack_status(system_id, component_id, _status, 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);
305}
306
307/**
308 * @brief Send a adsb_vehicle message
309 * @param chan MAVLink channel to send the message
310 *
311 * @param ICAO_address ICAO address
312 * @param lat [degE7] Latitude
313 * @param lon [degE7] Longitude
314 * @param altitude_type ADSB altitude type.
315 * @param altitude [mm] Altitude (ASL)
316 * @param heading [cdeg] Course over ground
317 * @param hor_velocity [cm/s] The horizontal velocity
318 * @param ver_velocity [cm/s] The vertical velocity. Positive is up
319 * @param callsign The callsign, 8+null
320 * @param emitter_type ADSB emitter type.
321 * @param tslc [s] Time since last communication from the remote vehicle, in seconds.
322 * @param flags Bitmap to indicate various statuses including valid data fields
323 * @param squawk Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000
324 */
325#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
326
327static 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)
328{
329#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
330 char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
331 _mav_put_uint32_t(buf, 0, ICAO_address);
332 _mav_put_int32_t(buf, 4, lat);
333 _mav_put_int32_t(buf, 8, lon);
334 _mav_put_int32_t(buf, 12, altitude);
335 _mav_put_uint16_t(buf, 16, heading);
336 _mav_put_uint16_t(buf, 18, hor_velocity);
337 _mav_put_int16_t(buf, 20, ver_velocity);
338 _mav_put_uint16_t(buf, 22, flags);
339 _mav_put_uint16_t(buf, 24, squawk);
340 _mav_put_uint8_t(buf, 26, altitude_type);
341 _mav_put_uint8_t(buf, 36, emitter_type);
342 _mav_put_uint8_t(buf, 37, tslc);
343 _mav_put_char_array(buf, 27, callsign, 9);
344 _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);
345#else
346 mavlink_adsb_vehicle_t packet;
347 packet.ICAO_address = ICAO_address;
348 packet.lat = lat;
349 packet.lon = lon;
350 packet.altitude = altitude;
351 packet.heading = heading;
352 packet.hor_velocity = hor_velocity;
353 packet.ver_velocity = ver_velocity;
354 packet.flags = flags;
355 packet.squawk = squawk;
356 packet.altitude_type = altitude_type;
357 packet.emitter_type = emitter_type;
358 packet.tslc = tslc;
359 mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
360 _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);
361#endif
362}
363
364/**
365 * @brief Send a adsb_vehicle message
366 * @param chan MAVLink channel to send the message
367 * @param struct The MAVLink struct to serialize
368 */
369static inline void mavlink_msg_adsb_vehicle_send_struct(mavlink_channel_t chan, const mavlink_adsb_vehicle_t* adsb_vehicle)
370{
371#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
372 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);
373#else
374 _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);
375#endif
376}
377
378#if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
379/*
380 This variant of _send() can be used to save stack space by reusing
381 memory from the receive buffer. The caller provides a
382 mavlink_message_t which is the size of a full mavlink message. This
383 is usually the receive buffer for the channel, and allows a reply to an
384 incoming message with minimum stack space usage.
385 */
386static 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)
387{
388#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
389 char *buf = (char *)msgbuf;
390 _mav_put_uint32_t(buf, 0, ICAO_address);
391 _mav_put_int32_t(buf, 4, lat);
392 _mav_put_int32_t(buf, 8, lon);
393 _mav_put_int32_t(buf, 12, altitude);
394 _mav_put_uint16_t(buf, 16, heading);
395 _mav_put_uint16_t(buf, 18, hor_velocity);
396 _mav_put_int16_t(buf, 20, ver_velocity);
397 _mav_put_uint16_t(buf, 22, flags);
398 _mav_put_uint16_t(buf, 24, squawk);
399 _mav_put_uint8_t(buf, 26, altitude_type);
400 _mav_put_uint8_t(buf, 36, emitter_type);
401 _mav_put_uint8_t(buf, 37, tslc);
402 _mav_put_char_array(buf, 27, callsign, 9);
403 _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);
404#else
405 mavlink_adsb_vehicle_t *packet = (mavlink_adsb_vehicle_t *)msgbuf;
406 packet->ICAO_address = ICAO_address;
407 packet->lat = lat;
408 packet->lon = lon;
409 packet->altitude = altitude;
410 packet->heading = heading;
411 packet->hor_velocity = hor_velocity;
412 packet->ver_velocity = ver_velocity;
413 packet->flags = flags;
414 packet->squawk = squawk;
415 packet->altitude_type = altitude_type;
416 packet->emitter_type = emitter_type;
417 packet->tslc = tslc;
418 mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9);
419 _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);
420#endif
421}
422#endif
423
424#endif
425
426// MESSAGE ADSB_VEHICLE UNPACKING
427
428
429/**
430 * @brief Get field ICAO_address from adsb_vehicle message
431 *
432 * @return ICAO address
433 */
434static inline uint32_t mavlink_msg_adsb_vehicle_get_ICAO_address(const mavlink_message_t* msg)
435{
436 return _MAV_RETURN_uint32_t(msg, 0);
437}
438
439/**
440 * @brief Get field lat from adsb_vehicle message
441 *
442 * @return [degE7] Latitude
443 */
444static inline int32_t mavlink_msg_adsb_vehicle_get_lat(const mavlink_message_t* msg)
445{
446 return _MAV_RETURN_int32_t(msg, 4);
447}
448
449/**
450 * @brief Get field lon from adsb_vehicle message
451 *
452 * @return [degE7] Longitude
453 */
454static inline int32_t mavlink_msg_adsb_vehicle_get_lon(const mavlink_message_t* msg)
455{
456 return _MAV_RETURN_int32_t(msg, 8);
457}
458
459/**
460 * @brief Get field altitude_type from adsb_vehicle message
461 *
462 * @return ADSB altitude type.
463 */
464static inline uint8_t mavlink_msg_adsb_vehicle_get_altitude_type(const mavlink_message_t* msg)
465{
466 return _MAV_RETURN_uint8_t(msg, 26);
467}
468
469/**
470 * @brief Get field altitude from adsb_vehicle message
471 *
472 * @return [mm] Altitude (ASL)
473 */
474static inline int32_t mavlink_msg_adsb_vehicle_get_altitude(const mavlink_message_t* msg)
475{
476 return _MAV_RETURN_int32_t(msg, 12);
477}
478
479/**
480 * @brief Get field heading from adsb_vehicle message
481 *
482 * @return [cdeg] Course over ground
483 */
484static inline uint16_t mavlink_msg_adsb_vehicle_get_heading(const mavlink_message_t* msg)
485{
486 return _MAV_RETURN_uint16_t(msg, 16);
487}
488
489/**
490 * @brief Get field hor_velocity from adsb_vehicle message
491 *
492 * @return [cm/s] The horizontal velocity
493 */
494static inline uint16_t mavlink_msg_adsb_vehicle_get_hor_velocity(const mavlink_message_t* msg)
495{
496 return _MAV_RETURN_uint16_t(msg, 18);
497}
498
499/**
500 * @brief Get field ver_velocity from adsb_vehicle message
501 *
502 * @return [cm/s] The vertical velocity. Positive is up
503 */
504static inline int16_t mavlink_msg_adsb_vehicle_get_ver_velocity(const mavlink_message_t* msg)
505{
506 return _MAV_RETURN_int16_t(msg, 20);
507}
508
509/**
510 * @brief Get field callsign from adsb_vehicle message
511 *
512 * @return The callsign, 8+null
513 */
514static inline uint16_t mavlink_msg_adsb_vehicle_get_callsign(const mavlink_message_t* msg, char *callsign)
515{
516 return _MAV_RETURN_char_array(msg, callsign, 9, 27);
517}
518
519/**
520 * @brief Get field emitter_type from adsb_vehicle message
521 *
522 * @return ADSB emitter type.
523 */
524static inline uint8_t mavlink_msg_adsb_vehicle_get_emitter_type(const mavlink_message_t* msg)
525{
526 return _MAV_RETURN_uint8_t(msg, 36);
527}
528
529/**
530 * @brief Get field tslc from adsb_vehicle message
531 *
532 * @return [s] Time since last communication from the remote vehicle, in seconds.
533 */
534static inline uint8_t mavlink_msg_adsb_vehicle_get_tslc(const mavlink_message_t* msg)
535{
536 return _MAV_RETURN_uint8_t(msg, 37);
537}
538
539/**
540 * @brief Get field flags from adsb_vehicle message
541 *
542 * @return Bitmap to indicate various statuses including valid data fields
543 */
544static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_t* msg)
545{
546 return _MAV_RETURN_uint16_t(msg, 22);
547}
548
549/**
550 * @brief Get field squawk from adsb_vehicle message
551 *
552 * @return Squawk code. Note that the code is in decimal: e.g. 7700 (general emergency) is encoded as binary 0b0001_1110_0001_0100, not(!) as 0b0000_111_111_000_000
553 */
554static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg)
555{
556 return _MAV_RETURN_uint16_t(msg, 24);
557}
558
559/**
560 * @brief Decode a adsb_vehicle message into a struct
561 *
562 * @param msg The message to decode
563 * @param adsb_vehicle C-struct to decode the message contents into
564 */
565static inline void mavlink_msg_adsb_vehicle_decode(const mavlink_message_t* msg, mavlink_adsb_vehicle_t* adsb_vehicle)
566{
567#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
568 adsb_vehicle->ICAO_address = mavlink_msg_adsb_vehicle_get_ICAO_address(msg);
569 adsb_vehicle->lat = mavlink_msg_adsb_vehicle_get_lat(msg);
570 adsb_vehicle->lon = mavlink_msg_adsb_vehicle_get_lon(msg);
571 adsb_vehicle->altitude = mavlink_msg_adsb_vehicle_get_altitude(msg);
572 adsb_vehicle->heading = mavlink_msg_adsb_vehicle_get_heading(msg);
573 adsb_vehicle->hor_velocity = mavlink_msg_adsb_vehicle_get_hor_velocity(msg);
574 adsb_vehicle->ver_velocity = mavlink_msg_adsb_vehicle_get_ver_velocity(msg);
575 adsb_vehicle->flags = mavlink_msg_adsb_vehicle_get_flags(msg);
576 adsb_vehicle->squawk = mavlink_msg_adsb_vehicle_get_squawk(msg);
577 adsb_vehicle->altitude_type = mavlink_msg_adsb_vehicle_get_altitude_type(msg);
578 mavlink_msg_adsb_vehicle_get_callsign(msg, adsb_vehicle->callsign);
579 adsb_vehicle->emitter_type = mavlink_msg_adsb_vehicle_get_emitter_type(msg);
580 adsb_vehicle->tslc = mavlink_msg_adsb_vehicle_get_tslc(msg);
581#else
582 uint8_t len = msg->len < MAVLINK_MSG_ID_ADSB_VEHICLE_LEN? msg->len : MAVLINK_MSG_ID_ADSB_VEHICLE_LEN;
583 memset(adsb_vehicle, 0, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
584 memcpy(adsb_vehicle, _MAV_PAYLOAD(msg), len);
585#endif
586}