mavlink_msg_adsb_vehicle.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. #pragma once
  2. // MESSAGE ADSB_VEHICLE PACKING
  3. #define MAVLINK_MSG_ID_ADSB_VEHICLE 246
  4. typedef struct __mavlink_adsb_vehicle_t {
  5. uint32_t ICAO_address; /*< ICAO address*/
  6. int32_t lat; /*< [degE7] Latitude*/
  7. int32_t lon; /*< [degE7] Longitude*/
  8. int32_t altitude; /*< [mm] Altitude(ASL)*/
  9. uint16_t heading; /*< [cdeg] Course over ground*/
  10. uint16_t hor_velocity; /*< [cm/s] The horizontal velocity*/
  11. int16_t ver_velocity; /*< [cm/s] The vertical velocity. Positive is up*/
  12. uint16_t flags; /*< Bitmap to indicate various statuses including valid data fields*/
  13. uint16_t squawk; /*< Squawk code*/
  14. uint8_t altitude_type; /*< ADSB altitude type.*/
  15. char callsign[9]; /*< The callsign, 8+null*/
  16. uint8_t emitter_type; /*< ADSB emitter type.*/
  17. uint8_t tslc; /*< [s] Time since last communication in seconds*/
  18. } mavlink_adsb_vehicle_t;
  19. #define MAVLINK_MSG_ID_ADSB_VEHICLE_LEN 38
  20. #define MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN 38
  21. #define MAVLINK_MSG_ID_246_LEN 38
  22. #define MAVLINK_MSG_ID_246_MIN_LEN 38
  23. #define MAVLINK_MSG_ID_ADSB_VEHICLE_CRC 184
  24. #define MAVLINK_MSG_ID_246_CRC 184
  25. #define MAVLINK_MSG_ADSB_VEHICLE_FIELD_CALLSIGN_LEN 9
  26. #if MAVLINK_COMMAND_24BIT
  27. #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
  28. 246, \
  29. "ADSB_VEHICLE", \
  30. 13, \
  31. { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
  32. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
  33. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
  34. { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
  35. { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
  36. { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
  37. { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
  38. { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
  39. { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
  40. { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
  41. { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
  42. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
  43. { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
  44. } \
  45. }
  46. #else
  47. #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
  48. "ADSB_VEHICLE", \
  49. 13, \
  50. { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
  51. { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
  52. { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
  53. { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
  54. { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
  55. { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
  56. { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
  57. { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
  58. { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
  59. { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
  60. { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
  61. { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
  62. { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
  63. } \
  64. }
  65. #endif
  66. /**
  67. * @brief Pack a adsb_vehicle message
  68. * @param system_id ID of this system
  69. * @param component_id ID of this component (e.g. 200 for IMU)
  70. * @param msg The MAVLink message to compress the data into
  71. *
  72. * @param ICAO_address ICAO address
  73. * @param lat [degE7] Latitude
  74. * @param lon [degE7] Longitude
  75. * @param altitude_type ADSB altitude type.
  76. * @param altitude [mm] Altitude(ASL)
  77. * @param heading [cdeg] Course over ground
  78. * @param hor_velocity [cm/s] The horizontal velocity
  79. * @param ver_velocity [cm/s] The vertical velocity. Positive is up
  80. * @param callsign The callsign, 8+null
  81. * @param emitter_type ADSB emitter type.
  82. * @param tslc [s] Time since last communication in seconds
  83. * @param flags Bitmap to indicate various statuses including valid data fields
  84. * @param squawk Squawk code
  85. * @return length of the message in bytes (excluding serial stream start sign)
  86. */
  87. static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  88. 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)
  89. {
  90. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  91. char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
  92. _mav_put_uint32_t(buf, 0, ICAO_address);
  93. _mav_put_int32_t(buf, 4, lat);
  94. _mav_put_int32_t(buf, 8, lon);
  95. _mav_put_int32_t(buf, 12, altitude);
  96. _mav_put_uint16_t(buf, 16, heading);
  97. _mav_put_uint16_t(buf, 18, hor_velocity);
  98. _mav_put_int16_t(buf, 20, ver_velocity);
  99. _mav_put_uint16_t(buf, 22, flags);
  100. _mav_put_uint16_t(buf, 24, squawk);
  101. _mav_put_uint8_t(buf, 26, altitude_type);
  102. _mav_put_uint8_t(buf, 36, emitter_type);
  103. _mav_put_uint8_t(buf, 37, tslc);
  104. _mav_put_char_array(buf, 27, callsign, 9);
  105. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
  106. #else
  107. mavlink_adsb_vehicle_t packet;
  108. packet.ICAO_address = ICAO_address;
  109. packet.lat = lat;
  110. packet.lon = lon;
  111. packet.altitude = altitude;
  112. packet.heading = heading;
  113. packet.hor_velocity = hor_velocity;
  114. packet.ver_velocity = ver_velocity;
  115. packet.flags = flags;
  116. packet.squawk = squawk;
  117. packet.altitude_type = altitude_type;
  118. packet.emitter_type = emitter_type;
  119. packet.tslc = tslc;
  120. mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
  121. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
  122. #endif
  123. msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
  124. 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);
  125. }
  126. /**
  127. * @brief Pack a adsb_vehicle message on a channel
  128. * @param system_id ID of this system
  129. * @param component_id ID of this component (e.g. 200 for IMU)
  130. * @param chan The MAVLink channel this message will be sent over
  131. * @param msg The MAVLink message to compress the data into
  132. * @param ICAO_address ICAO address
  133. * @param lat [degE7] Latitude
  134. * @param lon [degE7] Longitude
  135. * @param altitude_type ADSB altitude type.
  136. * @param altitude [mm] Altitude(ASL)
  137. * @param heading [cdeg] Course over ground
  138. * @param hor_velocity [cm/s] The horizontal velocity
  139. * @param ver_velocity [cm/s] The vertical velocity. Positive is up
  140. * @param callsign The callsign, 8+null
  141. * @param emitter_type ADSB emitter type.
  142. * @param tslc [s] Time since last communication in seconds
  143. * @param flags Bitmap to indicate various statuses including valid data fields
  144. * @param squawk Squawk code
  145. * @return length of the message in bytes (excluding serial stream start sign)
  146. */
  147. static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  148. mavlink_message_t* msg,
  149. 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)
  150. {
  151. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  152. char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
  153. _mav_put_uint32_t(buf, 0, ICAO_address);
  154. _mav_put_int32_t(buf, 4, lat);
  155. _mav_put_int32_t(buf, 8, lon);
  156. _mav_put_int32_t(buf, 12, altitude);
  157. _mav_put_uint16_t(buf, 16, heading);
  158. _mav_put_uint16_t(buf, 18, hor_velocity);
  159. _mav_put_int16_t(buf, 20, ver_velocity);
  160. _mav_put_uint16_t(buf, 22, flags);
  161. _mav_put_uint16_t(buf, 24, squawk);
  162. _mav_put_uint8_t(buf, 26, altitude_type);
  163. _mav_put_uint8_t(buf, 36, emitter_type);
  164. _mav_put_uint8_t(buf, 37, tslc);
  165. _mav_put_char_array(buf, 27, callsign, 9);
  166. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
  167. #else
  168. mavlink_adsb_vehicle_t packet;
  169. packet.ICAO_address = ICAO_address;
  170. packet.lat = lat;
  171. packet.lon = lon;
  172. packet.altitude = altitude;
  173. packet.heading = heading;
  174. packet.hor_velocity = hor_velocity;
  175. packet.ver_velocity = ver_velocity;
  176. packet.flags = flags;
  177. packet.squawk = squawk;
  178. packet.altitude_type = altitude_type;
  179. packet.emitter_type = emitter_type;
  180. packet.tslc = tslc;
  181. mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
  182. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
  183. #endif
  184. msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
  185. 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);
  186. }
  187. /**
  188. * @brief Encode a adsb_vehicle struct
  189. *
  190. * @param system_id ID of this system
  191. * @param component_id ID of this component (e.g. 200 for IMU)
  192. * @param msg The MAVLink message to compress the data into
  193. * @param adsb_vehicle C-struct to read the message contents from
  194. */
  195. 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)
  196. {
  197. 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);
  198. }
  199. /**
  200. * @brief Encode a adsb_vehicle struct on a channel
  201. *
  202. * @param system_id ID of this system
  203. * @param component_id ID of this component (e.g. 200 for IMU)
  204. * @param chan The MAVLink channel this message will be sent over
  205. * @param msg The MAVLink message to compress the data into
  206. * @param adsb_vehicle C-struct to read the message contents from
  207. */
  208. 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)
  209. {
  210. 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);
  211. }
  212. /**
  213. * @brief Send a adsb_vehicle message
  214. * @param chan MAVLink channel to send the message
  215. *
  216. * @param ICAO_address ICAO address
  217. * @param lat [degE7] Latitude
  218. * @param lon [degE7] Longitude
  219. * @param altitude_type ADSB altitude type.
  220. * @param altitude [mm] Altitude(ASL)
  221. * @param heading [cdeg] Course over ground
  222. * @param hor_velocity [cm/s] The horizontal velocity
  223. * @param ver_velocity [cm/s] The vertical velocity. Positive is up
  224. * @param callsign The callsign, 8+null
  225. * @param emitter_type ADSB emitter type.
  226. * @param tslc [s] Time since last communication in seconds
  227. * @param flags Bitmap to indicate various statuses including valid data fields
  228. * @param squawk Squawk code
  229. */
  230. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  231. 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)
  232. {
  233. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  234. char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
  235. _mav_put_uint32_t(buf, 0, ICAO_address);
  236. _mav_put_int32_t(buf, 4, lat);
  237. _mav_put_int32_t(buf, 8, lon);
  238. _mav_put_int32_t(buf, 12, altitude);
  239. _mav_put_uint16_t(buf, 16, heading);
  240. _mav_put_uint16_t(buf, 18, hor_velocity);
  241. _mav_put_int16_t(buf, 20, ver_velocity);
  242. _mav_put_uint16_t(buf, 22, flags);
  243. _mav_put_uint16_t(buf, 24, squawk);
  244. _mav_put_uint8_t(buf, 26, altitude_type);
  245. _mav_put_uint8_t(buf, 36, emitter_type);
  246. _mav_put_uint8_t(buf, 37, tslc);
  247. _mav_put_char_array(buf, 27, callsign, 9);
  248. _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);
  249. #else
  250. mavlink_adsb_vehicle_t packet;
  251. packet.ICAO_address = ICAO_address;
  252. packet.lat = lat;
  253. packet.lon = lon;
  254. packet.altitude = altitude;
  255. packet.heading = heading;
  256. packet.hor_velocity = hor_velocity;
  257. packet.ver_velocity = ver_velocity;
  258. packet.flags = flags;
  259. packet.squawk = squawk;
  260. packet.altitude_type = altitude_type;
  261. packet.emitter_type = emitter_type;
  262. packet.tslc = tslc;
  263. mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
  264. _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);
  265. #endif
  266. }
  267. /**
  268. * @brief Send a adsb_vehicle message
  269. * @param chan MAVLink channel to send the message
  270. * @param struct The MAVLink struct to serialize
  271. */
  272. static inline void mavlink_msg_adsb_vehicle_send_struct(mavlink_channel_t chan, const mavlink_adsb_vehicle_t* adsb_vehicle)
  273. {
  274. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  275. 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);
  276. #else
  277. _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);
  278. #endif
  279. }
  280. #if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  281. /*
  282. This variant of _send() can be used to save stack space by re-using
  283. memory from the receive buffer. The caller provides a
  284. mavlink_message_t which is the size of a full mavlink message. This
  285. is usually the receive buffer for the channel, and allows a reply to an
  286. incoming message with minimum stack space usage.
  287. */
  288. 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)
  289. {
  290. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  291. char *buf = (char *)msgbuf;
  292. _mav_put_uint32_t(buf, 0, ICAO_address);
  293. _mav_put_int32_t(buf, 4, lat);
  294. _mav_put_int32_t(buf, 8, lon);
  295. _mav_put_int32_t(buf, 12, altitude);
  296. _mav_put_uint16_t(buf, 16, heading);
  297. _mav_put_uint16_t(buf, 18, hor_velocity);
  298. _mav_put_int16_t(buf, 20, ver_velocity);
  299. _mav_put_uint16_t(buf, 22, flags);
  300. _mav_put_uint16_t(buf, 24, squawk);
  301. _mav_put_uint8_t(buf, 26, altitude_type);
  302. _mav_put_uint8_t(buf, 36, emitter_type);
  303. _mav_put_uint8_t(buf, 37, tslc);
  304. _mav_put_char_array(buf, 27, callsign, 9);
  305. _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);
  306. #else
  307. mavlink_adsb_vehicle_t *packet = (mavlink_adsb_vehicle_t *)msgbuf;
  308. packet->ICAO_address = ICAO_address;
  309. packet->lat = lat;
  310. packet->lon = lon;
  311. packet->altitude = altitude;
  312. packet->heading = heading;
  313. packet->hor_velocity = hor_velocity;
  314. packet->ver_velocity = ver_velocity;
  315. packet->flags = flags;
  316. packet->squawk = squawk;
  317. packet->altitude_type = altitude_type;
  318. packet->emitter_type = emitter_type;
  319. packet->tslc = tslc;
  320. mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9);
  321. _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);
  322. #endif
  323. }
  324. #endif
  325. #endif
  326. // MESSAGE ADSB_VEHICLE UNPACKING
  327. /**
  328. * @brief Get field ICAO_address from adsb_vehicle message
  329. *
  330. * @return ICAO address
  331. */
  332. static inline uint32_t mavlink_msg_adsb_vehicle_get_ICAO_address(const mavlink_message_t* msg)
  333. {
  334. return _MAV_RETURN_uint32_t(msg, 0);
  335. }
  336. /**
  337. * @brief Get field lat from adsb_vehicle message
  338. *
  339. * @return [degE7] Latitude
  340. */
  341. static inline int32_t mavlink_msg_adsb_vehicle_get_lat(const mavlink_message_t* msg)
  342. {
  343. return _MAV_RETURN_int32_t(msg, 4);
  344. }
  345. /**
  346. * @brief Get field lon from adsb_vehicle message
  347. *
  348. * @return [degE7] Longitude
  349. */
  350. static inline int32_t mavlink_msg_adsb_vehicle_get_lon(const mavlink_message_t* msg)
  351. {
  352. return _MAV_RETURN_int32_t(msg, 8);
  353. }
  354. /**
  355. * @brief Get field altitude_type from adsb_vehicle message
  356. *
  357. * @return ADSB altitude type.
  358. */
  359. static inline uint8_t mavlink_msg_adsb_vehicle_get_altitude_type(const mavlink_message_t* msg)
  360. {
  361. return _MAV_RETURN_uint8_t(msg, 26);
  362. }
  363. /**
  364. * @brief Get field altitude from adsb_vehicle message
  365. *
  366. * @return [mm] Altitude(ASL)
  367. */
  368. static inline int32_t mavlink_msg_adsb_vehicle_get_altitude(const mavlink_message_t* msg)
  369. {
  370. return _MAV_RETURN_int32_t(msg, 12);
  371. }
  372. /**
  373. * @brief Get field heading from adsb_vehicle message
  374. *
  375. * @return [cdeg] Course over ground
  376. */
  377. static inline uint16_t mavlink_msg_adsb_vehicle_get_heading(const mavlink_message_t* msg)
  378. {
  379. return _MAV_RETURN_uint16_t(msg, 16);
  380. }
  381. /**
  382. * @brief Get field hor_velocity from adsb_vehicle message
  383. *
  384. * @return [cm/s] The horizontal velocity
  385. */
  386. static inline uint16_t mavlink_msg_adsb_vehicle_get_hor_velocity(const mavlink_message_t* msg)
  387. {
  388. return _MAV_RETURN_uint16_t(msg, 18);
  389. }
  390. /**
  391. * @brief Get field ver_velocity from adsb_vehicle message
  392. *
  393. * @return [cm/s] The vertical velocity. Positive is up
  394. */
  395. static inline int16_t mavlink_msg_adsb_vehicle_get_ver_velocity(const mavlink_message_t* msg)
  396. {
  397. return _MAV_RETURN_int16_t(msg, 20);
  398. }
  399. /**
  400. * @brief Get field callsign from adsb_vehicle message
  401. *
  402. * @return The callsign, 8+null
  403. */
  404. static inline uint16_t mavlink_msg_adsb_vehicle_get_callsign(const mavlink_message_t* msg, char *callsign)
  405. {
  406. return _MAV_RETURN_char_array(msg, callsign, 9, 27);
  407. }
  408. /**
  409. * @brief Get field emitter_type from adsb_vehicle message
  410. *
  411. * @return ADSB emitter type.
  412. */
  413. static inline uint8_t mavlink_msg_adsb_vehicle_get_emitter_type(const mavlink_message_t* msg)
  414. {
  415. return _MAV_RETURN_uint8_t(msg, 36);
  416. }
  417. /**
  418. * @brief Get field tslc from adsb_vehicle message
  419. *
  420. * @return [s] Time since last communication in seconds
  421. */
  422. static inline uint8_t mavlink_msg_adsb_vehicle_get_tslc(const mavlink_message_t* msg)
  423. {
  424. return _MAV_RETURN_uint8_t(msg, 37);
  425. }
  426. /**
  427. * @brief Get field flags from adsb_vehicle message
  428. *
  429. * @return Bitmap to indicate various statuses including valid data fields
  430. */
  431. static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_t* msg)
  432. {
  433. return _MAV_RETURN_uint16_t(msg, 22);
  434. }
  435. /**
  436. * @brief Get field squawk from adsb_vehicle message
  437. *
  438. * @return Squawk code
  439. */
  440. static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg)
  441. {
  442. return _MAV_RETURN_uint16_t(msg, 24);
  443. }
  444. /**
  445. * @brief Decode a adsb_vehicle message into a struct
  446. *
  447. * @param msg The message to decode
  448. * @param adsb_vehicle C-struct to decode the message contents into
  449. */
  450. static inline void mavlink_msg_adsb_vehicle_decode(const mavlink_message_t* msg, mavlink_adsb_vehicle_t* adsb_vehicle)
  451. {
  452. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  453. adsb_vehicle->ICAO_address = mavlink_msg_adsb_vehicle_get_ICAO_address(msg);
  454. adsb_vehicle->lat = mavlink_msg_adsb_vehicle_get_lat(msg);
  455. adsb_vehicle->lon = mavlink_msg_adsb_vehicle_get_lon(msg);
  456. adsb_vehicle->altitude = mavlink_msg_adsb_vehicle_get_altitude(msg);
  457. adsb_vehicle->heading = mavlink_msg_adsb_vehicle_get_heading(msg);
  458. adsb_vehicle->hor_velocity = mavlink_msg_adsb_vehicle_get_hor_velocity(msg);
  459. adsb_vehicle->ver_velocity = mavlink_msg_adsb_vehicle_get_ver_velocity(msg);
  460. adsb_vehicle->flags = mavlink_msg_adsb_vehicle_get_flags(msg);
  461. adsb_vehicle->squawk = mavlink_msg_adsb_vehicle_get_squawk(msg);
  462. adsb_vehicle->altitude_type = mavlink_msg_adsb_vehicle_get_altitude_type(msg);
  463. mavlink_msg_adsb_vehicle_get_callsign(msg, adsb_vehicle->callsign);
  464. adsb_vehicle->emitter_type = mavlink_msg_adsb_vehicle_get_emitter_type(msg);
  465. adsb_vehicle->tslc = mavlink_msg_adsb_vehicle_get_tslc(msg);
  466. #else
  467. uint8_t len = msg->len < MAVLINK_MSG_ID_ADSB_VEHICLE_LEN? msg->len : MAVLINK_MSG_ID_ADSB_VEHICLE_LEN;
  468. memset(adsb_vehicle, 0, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
  469. memcpy(adsb_vehicle, _MAV_PAYLOAD(msg), len);
  470. #endif
  471. }