You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

505 lines
22 KiB

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