2
0

mavlink_msg_open_drone_id_location.h 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. #pragma once
  2. // MESSAGE OPEN_DRONE_ID_LOCATION PACKING
  3. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION 12901
  4. typedef struct __mavlink_open_drone_id_location_t {
  5. int32_t latitude; /*< [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).*/
  6. int32_t longitude; /*< [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).*/
  7. float altitude_barometric; /*< [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.*/
  8. float altitude_geodetic; /*< [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.*/
  9. float height; /*< [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.*/
  10. float timestamp; /*< [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.*/
  11. uint16_t direction; /*< [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.*/
  12. uint16_t speed_horizontal; /*< [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.*/
  13. int16_t speed_vertical; /*< [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.*/
  14. uint8_t target_system; /*< System ID (0 for broadcast).*/
  15. uint8_t target_component; /*< Component ID (0 for broadcast).*/
  16. uint8_t id_or_mac[20]; /*< Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html. */
  17. uint8_t status; /*< Indicates whether the unmanned aircraft is on the ground or in the air.*/
  18. uint8_t height_reference; /*< Indicates the reference point for the height field.*/
  19. uint8_t horizontal_accuracy; /*< The accuracy of the horizontal position.*/
  20. uint8_t vertical_accuracy; /*< The accuracy of the vertical position.*/
  21. uint8_t barometer_accuracy; /*< The accuracy of the barometric altitude.*/
  22. uint8_t speed_accuracy; /*< The accuracy of the horizontal and vertical speed.*/
  23. uint8_t timestamp_accuracy; /*< The accuracy of the timestamps.*/
  24. } mavlink_open_drone_id_location_t;
  25. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN 59
  26. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN 59
  27. #define MAVLINK_MSG_ID_12901_LEN 59
  28. #define MAVLINK_MSG_ID_12901_MIN_LEN 59
  29. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC 254
  30. #define MAVLINK_MSG_ID_12901_CRC 254
  31. #define MAVLINK_MSG_OPEN_DRONE_ID_LOCATION_FIELD_ID_OR_MAC_LEN 20
  32. #if MAVLINK_COMMAND_24BIT
  33. #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION { \
  34. 12901, \
  35. "OPEN_DRONE_ID_LOCATION", \
  36. 19, \
  37. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_open_drone_id_location_t, target_system) }, \
  38. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_open_drone_id_location_t, target_component) }, \
  39. { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 32, offsetof(mavlink_open_drone_id_location_t, id_or_mac) }, \
  40. { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_open_drone_id_location_t, status) }, \
  41. { "direction", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_open_drone_id_location_t, direction) }, \
  42. { "speed_horizontal", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_open_drone_id_location_t, speed_horizontal) }, \
  43. { "speed_vertical", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_open_drone_id_location_t, speed_vertical) }, \
  44. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_location_t, latitude) }, \
  45. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_location_t, longitude) }, \
  46. { "altitude_barometric", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_location_t, altitude_barometric) }, \
  47. { "altitude_geodetic", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_open_drone_id_location_t, altitude_geodetic) }, \
  48. { "height_reference", NULL, MAVLINK_TYPE_UINT8_T, 0, 53, offsetof(mavlink_open_drone_id_location_t, height_reference) }, \
  49. { "height", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_open_drone_id_location_t, height) }, \
  50. { "horizontal_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 54, offsetof(mavlink_open_drone_id_location_t, horizontal_accuracy) }, \
  51. { "vertical_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 55, offsetof(mavlink_open_drone_id_location_t, vertical_accuracy) }, \
  52. { "barometer_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_open_drone_id_location_t, barometer_accuracy) }, \
  53. { "speed_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_open_drone_id_location_t, speed_accuracy) }, \
  54. { "timestamp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_open_drone_id_location_t, timestamp) }, \
  55. { "timestamp_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_open_drone_id_location_t, timestamp_accuracy) }, \
  56. } \
  57. }
  58. #else
  59. #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_LOCATION { \
  60. "OPEN_DRONE_ID_LOCATION", \
  61. 19, \
  62. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_open_drone_id_location_t, target_system) }, \
  63. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_open_drone_id_location_t, target_component) }, \
  64. { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 32, offsetof(mavlink_open_drone_id_location_t, id_or_mac) }, \
  65. { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 52, offsetof(mavlink_open_drone_id_location_t, status) }, \
  66. { "direction", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_open_drone_id_location_t, direction) }, \
  67. { "speed_horizontal", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_open_drone_id_location_t, speed_horizontal) }, \
  68. { "speed_vertical", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_open_drone_id_location_t, speed_vertical) }, \
  69. { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_open_drone_id_location_t, latitude) }, \
  70. { "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_open_drone_id_location_t, longitude) }, \
  71. { "altitude_barometric", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_open_drone_id_location_t, altitude_barometric) }, \
  72. { "altitude_geodetic", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_open_drone_id_location_t, altitude_geodetic) }, \
  73. { "height_reference", NULL, MAVLINK_TYPE_UINT8_T, 0, 53, offsetof(mavlink_open_drone_id_location_t, height_reference) }, \
  74. { "height", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_open_drone_id_location_t, height) }, \
  75. { "horizontal_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 54, offsetof(mavlink_open_drone_id_location_t, horizontal_accuracy) }, \
  76. { "vertical_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 55, offsetof(mavlink_open_drone_id_location_t, vertical_accuracy) }, \
  77. { "barometer_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 56, offsetof(mavlink_open_drone_id_location_t, barometer_accuracy) }, \
  78. { "speed_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 57, offsetof(mavlink_open_drone_id_location_t, speed_accuracy) }, \
  79. { "timestamp", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_open_drone_id_location_t, timestamp) }, \
  80. { "timestamp_accuracy", NULL, MAVLINK_TYPE_UINT8_T, 0, 58, offsetof(mavlink_open_drone_id_location_t, timestamp_accuracy) }, \
  81. } \
  82. }
  83. #endif
  84. /**
  85. * @brief Pack a open_drone_id_location message
  86. * @param system_id ID of this system
  87. * @param component_id ID of this component (e.g. 200 for IMU)
  88. * @param msg The MAVLink message to compress the data into
  89. *
  90. * @param target_system System ID (0 for broadcast).
  91. * @param target_component Component ID (0 for broadcast).
  92. * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  93. * @param status Indicates whether the unmanned aircraft is on the ground or in the air.
  94. * @param direction [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.
  95. * @param speed_horizontal [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.
  96. * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.
  97. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  98. * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  99. * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.
  100. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.
  101. * @param height_reference Indicates the reference point for the height field.
  102. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.
  103. * @param horizontal_accuracy The accuracy of the horizontal position.
  104. * @param vertical_accuracy The accuracy of the vertical position.
  105. * @param barometer_accuracy The accuracy of the barometric altitude.
  106. * @param speed_accuracy The accuracy of the horizontal and vertical speed.
  107. * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.
  108. * @param timestamp_accuracy The accuracy of the timestamps.
  109. * @return length of the message in bytes (excluding serial stream start sign)
  110. */
  111. static inline uint16_t mavlink_msg_open_drone_id_location_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  112. uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t status, uint16_t direction, uint16_t speed_horizontal, int16_t speed_vertical, int32_t latitude, int32_t longitude, float altitude_barometric, float altitude_geodetic, uint8_t height_reference, float height, uint8_t horizontal_accuracy, uint8_t vertical_accuracy, uint8_t barometer_accuracy, uint8_t speed_accuracy, float timestamp, uint8_t timestamp_accuracy)
  113. {
  114. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  115. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN];
  116. _mav_put_int32_t(buf, 0, latitude);
  117. _mav_put_int32_t(buf, 4, longitude);
  118. _mav_put_float(buf, 8, altitude_barometric);
  119. _mav_put_float(buf, 12, altitude_geodetic);
  120. _mav_put_float(buf, 16, height);
  121. _mav_put_float(buf, 20, timestamp);
  122. _mav_put_uint16_t(buf, 24, direction);
  123. _mav_put_uint16_t(buf, 26, speed_horizontal);
  124. _mav_put_int16_t(buf, 28, speed_vertical);
  125. _mav_put_uint8_t(buf, 30, target_system);
  126. _mav_put_uint8_t(buf, 31, target_component);
  127. _mav_put_uint8_t(buf, 52, status);
  128. _mav_put_uint8_t(buf, 53, height_reference);
  129. _mav_put_uint8_t(buf, 54, horizontal_accuracy);
  130. _mav_put_uint8_t(buf, 55, vertical_accuracy);
  131. _mav_put_uint8_t(buf, 56, barometer_accuracy);
  132. _mav_put_uint8_t(buf, 57, speed_accuracy);
  133. _mav_put_uint8_t(buf, 58, timestamp_accuracy);
  134. _mav_put_uint8_t_array(buf, 32, id_or_mac, 20);
  135. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  136. #else
  137. mavlink_open_drone_id_location_t packet;
  138. packet.latitude = latitude;
  139. packet.longitude = longitude;
  140. packet.altitude_barometric = altitude_barometric;
  141. packet.altitude_geodetic = altitude_geodetic;
  142. packet.height = height;
  143. packet.timestamp = timestamp;
  144. packet.direction = direction;
  145. packet.speed_horizontal = speed_horizontal;
  146. packet.speed_vertical = speed_vertical;
  147. packet.target_system = target_system;
  148. packet.target_component = target_component;
  149. packet.status = status;
  150. packet.height_reference = height_reference;
  151. packet.horizontal_accuracy = horizontal_accuracy;
  152. packet.vertical_accuracy = vertical_accuracy;
  153. packet.barometer_accuracy = barometer_accuracy;
  154. packet.speed_accuracy = speed_accuracy;
  155. packet.timestamp_accuracy = timestamp_accuracy;
  156. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  157. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  158. #endif
  159. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION;
  160. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  161. }
  162. /**
  163. * @brief Pack a open_drone_id_location message
  164. * @param system_id ID of this system
  165. * @param component_id ID of this component (e.g. 200 for IMU)
  166. * @param status MAVLink status structure
  167. * @param msg The MAVLink message to compress the data into
  168. *
  169. * @param target_system System ID (0 for broadcast).
  170. * @param target_component Component ID (0 for broadcast).
  171. * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  172. * @param status Indicates whether the unmanned aircraft is on the ground or in the air.
  173. * @param direction [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.
  174. * @param speed_horizontal [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.
  175. * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.
  176. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  177. * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  178. * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.
  179. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.
  180. * @param height_reference Indicates the reference point for the height field.
  181. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.
  182. * @param horizontal_accuracy The accuracy of the horizontal position.
  183. * @param vertical_accuracy The accuracy of the vertical position.
  184. * @param barometer_accuracy The accuracy of the barometric altitude.
  185. * @param speed_accuracy The accuracy of the horizontal and vertical speed.
  186. * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.
  187. * @param timestamp_accuracy The accuracy of the timestamps.
  188. * @return length of the message in bytes (excluding serial stream start sign)
  189. */
  190. static inline uint16_t mavlink_msg_open_drone_id_location_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  191. uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t status, uint16_t direction, uint16_t speed_horizontal, int16_t speed_vertical, int32_t latitude, int32_t longitude, float altitude_barometric, float altitude_geodetic, uint8_t height_reference, float height, uint8_t horizontal_accuracy, uint8_t vertical_accuracy, uint8_t barometer_accuracy, uint8_t speed_accuracy, float timestamp, uint8_t timestamp_accuracy)
  192. {
  193. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  194. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN];
  195. _mav_put_int32_t(buf, 0, latitude);
  196. _mav_put_int32_t(buf, 4, longitude);
  197. _mav_put_float(buf, 8, altitude_barometric);
  198. _mav_put_float(buf, 12, altitude_geodetic);
  199. _mav_put_float(buf, 16, height);
  200. _mav_put_float(buf, 20, timestamp);
  201. _mav_put_uint16_t(buf, 24, direction);
  202. _mav_put_uint16_t(buf, 26, speed_horizontal);
  203. _mav_put_int16_t(buf, 28, speed_vertical);
  204. _mav_put_uint8_t(buf, 30, target_system);
  205. _mav_put_uint8_t(buf, 31, target_component);
  206. _mav_put_uint8_t(buf, 52, status);
  207. _mav_put_uint8_t(buf, 53, height_reference);
  208. _mav_put_uint8_t(buf, 54, horizontal_accuracy);
  209. _mav_put_uint8_t(buf, 55, vertical_accuracy);
  210. _mav_put_uint8_t(buf, 56, barometer_accuracy);
  211. _mav_put_uint8_t(buf, 57, speed_accuracy);
  212. _mav_put_uint8_t(buf, 58, timestamp_accuracy);
  213. _mav_put_uint8_t_array(buf, 32, id_or_mac, 20);
  214. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  215. #else
  216. mavlink_open_drone_id_location_t packet;
  217. packet.latitude = latitude;
  218. packet.longitude = longitude;
  219. packet.altitude_barometric = altitude_barometric;
  220. packet.altitude_geodetic = altitude_geodetic;
  221. packet.height = height;
  222. packet.timestamp = timestamp;
  223. packet.direction = direction;
  224. packet.speed_horizontal = speed_horizontal;
  225. packet.speed_vertical = speed_vertical;
  226. packet.target_system = target_system;
  227. packet.target_component = target_component;
  228. packet.status = status;
  229. packet.height_reference = height_reference;
  230. packet.horizontal_accuracy = horizontal_accuracy;
  231. packet.vertical_accuracy = vertical_accuracy;
  232. packet.barometer_accuracy = barometer_accuracy;
  233. packet.speed_accuracy = speed_accuracy;
  234. packet.timestamp_accuracy = timestamp_accuracy;
  235. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  236. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  237. #endif
  238. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION;
  239. #if MAVLINK_CRC_EXTRA
  240. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  241. #else
  242. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  243. #endif
  244. }
  245. /**
  246. * @brief Pack a open_drone_id_location message on a channel
  247. * @param system_id ID of this system
  248. * @param component_id ID of this component (e.g. 200 for IMU)
  249. * @param chan The MAVLink channel this message will be sent over
  250. * @param msg The MAVLink message to compress the data into
  251. * @param target_system System ID (0 for broadcast).
  252. * @param target_component Component ID (0 for broadcast).
  253. * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  254. * @param status Indicates whether the unmanned aircraft is on the ground or in the air.
  255. * @param direction [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.
  256. * @param speed_horizontal [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.
  257. * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.
  258. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  259. * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  260. * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.
  261. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.
  262. * @param height_reference Indicates the reference point for the height field.
  263. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.
  264. * @param horizontal_accuracy The accuracy of the horizontal position.
  265. * @param vertical_accuracy The accuracy of the vertical position.
  266. * @param barometer_accuracy The accuracy of the barometric altitude.
  267. * @param speed_accuracy The accuracy of the horizontal and vertical speed.
  268. * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.
  269. * @param timestamp_accuracy The accuracy of the timestamps.
  270. * @return length of the message in bytes (excluding serial stream start sign)
  271. */
  272. static inline uint16_t mavlink_msg_open_drone_id_location_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  273. mavlink_message_t* msg,
  274. uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t status,uint16_t direction,uint16_t speed_horizontal,int16_t speed_vertical,int32_t latitude,int32_t longitude,float altitude_barometric,float altitude_geodetic,uint8_t height_reference,float height,uint8_t horizontal_accuracy,uint8_t vertical_accuracy,uint8_t barometer_accuracy,uint8_t speed_accuracy,float timestamp,uint8_t timestamp_accuracy)
  275. {
  276. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  277. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN];
  278. _mav_put_int32_t(buf, 0, latitude);
  279. _mav_put_int32_t(buf, 4, longitude);
  280. _mav_put_float(buf, 8, altitude_barometric);
  281. _mav_put_float(buf, 12, altitude_geodetic);
  282. _mav_put_float(buf, 16, height);
  283. _mav_put_float(buf, 20, timestamp);
  284. _mav_put_uint16_t(buf, 24, direction);
  285. _mav_put_uint16_t(buf, 26, speed_horizontal);
  286. _mav_put_int16_t(buf, 28, speed_vertical);
  287. _mav_put_uint8_t(buf, 30, target_system);
  288. _mav_put_uint8_t(buf, 31, target_component);
  289. _mav_put_uint8_t(buf, 52, status);
  290. _mav_put_uint8_t(buf, 53, height_reference);
  291. _mav_put_uint8_t(buf, 54, horizontal_accuracy);
  292. _mav_put_uint8_t(buf, 55, vertical_accuracy);
  293. _mav_put_uint8_t(buf, 56, barometer_accuracy);
  294. _mav_put_uint8_t(buf, 57, speed_accuracy);
  295. _mav_put_uint8_t(buf, 58, timestamp_accuracy);
  296. _mav_put_uint8_t_array(buf, 32, id_or_mac, 20);
  297. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  298. #else
  299. mavlink_open_drone_id_location_t packet;
  300. packet.latitude = latitude;
  301. packet.longitude = longitude;
  302. packet.altitude_barometric = altitude_barometric;
  303. packet.altitude_geodetic = altitude_geodetic;
  304. packet.height = height;
  305. packet.timestamp = timestamp;
  306. packet.direction = direction;
  307. packet.speed_horizontal = speed_horizontal;
  308. packet.speed_vertical = speed_vertical;
  309. packet.target_system = target_system;
  310. packet.target_component = target_component;
  311. packet.status = status;
  312. packet.height_reference = height_reference;
  313. packet.horizontal_accuracy = horizontal_accuracy;
  314. packet.vertical_accuracy = vertical_accuracy;
  315. packet.barometer_accuracy = barometer_accuracy;
  316. packet.speed_accuracy = speed_accuracy;
  317. packet.timestamp_accuracy = timestamp_accuracy;
  318. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  319. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  320. #endif
  321. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION;
  322. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  323. }
  324. /**
  325. * @brief Encode a open_drone_id_location struct
  326. *
  327. * @param system_id ID of this system
  328. * @param component_id ID of this component (e.g. 200 for IMU)
  329. * @param msg The MAVLink message to compress the data into
  330. * @param open_drone_id_location C-struct to read the message contents from
  331. */
  332. static inline uint16_t mavlink_msg_open_drone_id_location_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_location_t* open_drone_id_location)
  333. {
  334. return mavlink_msg_open_drone_id_location_pack(system_id, component_id, msg, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy);
  335. }
  336. /**
  337. * @brief Encode a open_drone_id_location struct on a channel
  338. *
  339. * @param system_id ID of this system
  340. * @param component_id ID of this component (e.g. 200 for IMU)
  341. * @param chan The MAVLink channel this message will be sent over
  342. * @param msg The MAVLink message to compress the data into
  343. * @param open_drone_id_location C-struct to read the message contents from
  344. */
  345. static inline uint16_t mavlink_msg_open_drone_id_location_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_location_t* open_drone_id_location)
  346. {
  347. return mavlink_msg_open_drone_id_location_pack_chan(system_id, component_id, chan, msg, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy);
  348. }
  349. /**
  350. * @brief Encode a open_drone_id_location struct with provided status structure
  351. *
  352. * @param system_id ID of this system
  353. * @param component_id ID of this component (e.g. 200 for IMU)
  354. * @param status MAVLink status structure
  355. * @param msg The MAVLink message to compress the data into
  356. * @param open_drone_id_location C-struct to read the message contents from
  357. */
  358. static inline uint16_t mavlink_msg_open_drone_id_location_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_location_t* open_drone_id_location)
  359. {
  360. return mavlink_msg_open_drone_id_location_pack_status(system_id, component_id, _status, msg, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy);
  361. }
  362. /**
  363. * @brief Send a open_drone_id_location message
  364. * @param chan MAVLink channel to send the message
  365. *
  366. * @param target_system System ID (0 for broadcast).
  367. * @param target_component Component ID (0 for broadcast).
  368. * @param id_or_mac Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  369. * @param status Indicates whether the unmanned aircraft is on the ground or in the air.
  370. * @param direction [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.
  371. * @param speed_horizontal [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.
  372. * @param speed_vertical [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.
  373. * @param latitude [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  374. * @param longitude [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  375. * @param altitude_barometric [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.
  376. * @param altitude_geodetic [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.
  377. * @param height_reference Indicates the reference point for the height field.
  378. * @param height [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.
  379. * @param horizontal_accuracy The accuracy of the horizontal position.
  380. * @param vertical_accuracy The accuracy of the vertical position.
  381. * @param barometer_accuracy The accuracy of the barometric altitude.
  382. * @param speed_accuracy The accuracy of the horizontal and vertical speed.
  383. * @param timestamp [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.
  384. * @param timestamp_accuracy The accuracy of the timestamps.
  385. */
  386. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  387. static inline void mavlink_msg_open_drone_id_location_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t status, uint16_t direction, uint16_t speed_horizontal, int16_t speed_vertical, int32_t latitude, int32_t longitude, float altitude_barometric, float altitude_geodetic, uint8_t height_reference, float height, uint8_t horizontal_accuracy, uint8_t vertical_accuracy, uint8_t barometer_accuracy, uint8_t speed_accuracy, float timestamp, uint8_t timestamp_accuracy)
  388. {
  389. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  390. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN];
  391. _mav_put_int32_t(buf, 0, latitude);
  392. _mav_put_int32_t(buf, 4, longitude);
  393. _mav_put_float(buf, 8, altitude_barometric);
  394. _mav_put_float(buf, 12, altitude_geodetic);
  395. _mav_put_float(buf, 16, height);
  396. _mav_put_float(buf, 20, timestamp);
  397. _mav_put_uint16_t(buf, 24, direction);
  398. _mav_put_uint16_t(buf, 26, speed_horizontal);
  399. _mav_put_int16_t(buf, 28, speed_vertical);
  400. _mav_put_uint8_t(buf, 30, target_system);
  401. _mav_put_uint8_t(buf, 31, target_component);
  402. _mav_put_uint8_t(buf, 52, status);
  403. _mav_put_uint8_t(buf, 53, height_reference);
  404. _mav_put_uint8_t(buf, 54, horizontal_accuracy);
  405. _mav_put_uint8_t(buf, 55, vertical_accuracy);
  406. _mav_put_uint8_t(buf, 56, barometer_accuracy);
  407. _mav_put_uint8_t(buf, 57, speed_accuracy);
  408. _mav_put_uint8_t(buf, 58, timestamp_accuracy);
  409. _mav_put_uint8_t_array(buf, 32, id_or_mac, 20);
  410. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  411. #else
  412. mavlink_open_drone_id_location_t packet;
  413. packet.latitude = latitude;
  414. packet.longitude = longitude;
  415. packet.altitude_barometric = altitude_barometric;
  416. packet.altitude_geodetic = altitude_geodetic;
  417. packet.height = height;
  418. packet.timestamp = timestamp;
  419. packet.direction = direction;
  420. packet.speed_horizontal = speed_horizontal;
  421. packet.speed_vertical = speed_vertical;
  422. packet.target_system = target_system;
  423. packet.target_component = target_component;
  424. packet.status = status;
  425. packet.height_reference = height_reference;
  426. packet.horizontal_accuracy = horizontal_accuracy;
  427. packet.vertical_accuracy = vertical_accuracy;
  428. packet.barometer_accuracy = barometer_accuracy;
  429. packet.speed_accuracy = speed_accuracy;
  430. packet.timestamp_accuracy = timestamp_accuracy;
  431. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  432. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  433. #endif
  434. }
  435. /**
  436. * @brief Send a open_drone_id_location message
  437. * @param chan MAVLink channel to send the message
  438. * @param struct The MAVLink struct to serialize
  439. */
  440. static inline void mavlink_msg_open_drone_id_location_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_location_t* open_drone_id_location)
  441. {
  442. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  443. mavlink_msg_open_drone_id_location_send(chan, open_drone_id_location->target_system, open_drone_id_location->target_component, open_drone_id_location->id_or_mac, open_drone_id_location->status, open_drone_id_location->direction, open_drone_id_location->speed_horizontal, open_drone_id_location->speed_vertical, open_drone_id_location->latitude, open_drone_id_location->longitude, open_drone_id_location->altitude_barometric, open_drone_id_location->altitude_geodetic, open_drone_id_location->height_reference, open_drone_id_location->height, open_drone_id_location->horizontal_accuracy, open_drone_id_location->vertical_accuracy, open_drone_id_location->barometer_accuracy, open_drone_id_location->speed_accuracy, open_drone_id_location->timestamp, open_drone_id_location->timestamp_accuracy);
  444. #else
  445. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, (const char *)open_drone_id_location, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  446. #endif
  447. }
  448. #if MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  449. /*
  450. This variant of _send() can be used to save stack space by re-using
  451. memory from the receive buffer. The caller provides a
  452. mavlink_message_t which is the size of a full mavlink message. This
  453. is usually the receive buffer for the channel, and allows a reply to an
  454. incoming message with minimum stack space usage.
  455. */
  456. static inline void mavlink_msg_open_drone_id_location_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t status, uint16_t direction, uint16_t speed_horizontal, int16_t speed_vertical, int32_t latitude, int32_t longitude, float altitude_barometric, float altitude_geodetic, uint8_t height_reference, float height, uint8_t horizontal_accuracy, uint8_t vertical_accuracy, uint8_t barometer_accuracy, uint8_t speed_accuracy, float timestamp, uint8_t timestamp_accuracy)
  457. {
  458. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  459. char *buf = (char *)msgbuf;
  460. _mav_put_int32_t(buf, 0, latitude);
  461. _mav_put_int32_t(buf, 4, longitude);
  462. _mav_put_float(buf, 8, altitude_barometric);
  463. _mav_put_float(buf, 12, altitude_geodetic);
  464. _mav_put_float(buf, 16, height);
  465. _mav_put_float(buf, 20, timestamp);
  466. _mav_put_uint16_t(buf, 24, direction);
  467. _mav_put_uint16_t(buf, 26, speed_horizontal);
  468. _mav_put_int16_t(buf, 28, speed_vertical);
  469. _mav_put_uint8_t(buf, 30, target_system);
  470. _mav_put_uint8_t(buf, 31, target_component);
  471. _mav_put_uint8_t(buf, 52, status);
  472. _mav_put_uint8_t(buf, 53, height_reference);
  473. _mav_put_uint8_t(buf, 54, horizontal_accuracy);
  474. _mav_put_uint8_t(buf, 55, vertical_accuracy);
  475. _mav_put_uint8_t(buf, 56, barometer_accuracy);
  476. _mav_put_uint8_t(buf, 57, speed_accuracy);
  477. _mav_put_uint8_t(buf, 58, timestamp_accuracy);
  478. _mav_put_uint8_t_array(buf, 32, id_or_mac, 20);
  479. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  480. #else
  481. mavlink_open_drone_id_location_t *packet = (mavlink_open_drone_id_location_t *)msgbuf;
  482. packet->latitude = latitude;
  483. packet->longitude = longitude;
  484. packet->altitude_barometric = altitude_barometric;
  485. packet->altitude_geodetic = altitude_geodetic;
  486. packet->height = height;
  487. packet->timestamp = timestamp;
  488. packet->direction = direction;
  489. packet->speed_horizontal = speed_horizontal;
  490. packet->speed_vertical = speed_vertical;
  491. packet->target_system = target_system;
  492. packet->target_component = target_component;
  493. packet->status = status;
  494. packet->height_reference = height_reference;
  495. packet->horizontal_accuracy = horizontal_accuracy;
  496. packet->vertical_accuracy = vertical_accuracy;
  497. packet->barometer_accuracy = barometer_accuracy;
  498. packet->speed_accuracy = speed_accuracy;
  499. packet->timestamp_accuracy = timestamp_accuracy;
  500. mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  501. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_CRC);
  502. #endif
  503. }
  504. #endif
  505. #endif
  506. // MESSAGE OPEN_DRONE_ID_LOCATION UNPACKING
  507. /**
  508. * @brief Get field target_system from open_drone_id_location message
  509. *
  510. * @return System ID (0 for broadcast).
  511. */
  512. static inline uint8_t mavlink_msg_open_drone_id_location_get_target_system(const mavlink_message_t* msg)
  513. {
  514. return _MAV_RETURN_uint8_t(msg, 30);
  515. }
  516. /**
  517. * @brief Get field target_component from open_drone_id_location message
  518. *
  519. * @return Component ID (0 for broadcast).
  520. */
  521. static inline uint8_t mavlink_msg_open_drone_id_location_get_target_component(const mavlink_message_t* msg)
  522. {
  523. return _MAV_RETURN_uint8_t(msg, 31);
  524. }
  525. /**
  526. * @brief Get field id_or_mac from open_drone_id_location message
  527. *
  528. * @return Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  529. */
  530. static inline uint16_t mavlink_msg_open_drone_id_location_get_id_or_mac(const mavlink_message_t* msg, uint8_t *id_or_mac)
  531. {
  532. return _MAV_RETURN_uint8_t_array(msg, id_or_mac, 20, 32);
  533. }
  534. /**
  535. * @brief Get field status from open_drone_id_location message
  536. *
  537. * @return Indicates whether the unmanned aircraft is on the ground or in the air.
  538. */
  539. static inline uint8_t mavlink_msg_open_drone_id_location_get_status(const mavlink_message_t* msg)
  540. {
  541. return _MAV_RETURN_uint8_t(msg, 52);
  542. }
  543. /**
  544. * @brief Get field direction from open_drone_id_location message
  545. *
  546. * @return [cdeg] Direction over ground (not heading, but direction of movement) measured clockwise from true North: 0 - 35999 centi-degrees. If unknown: 36100 centi-degrees.
  547. */
  548. static inline uint16_t mavlink_msg_open_drone_id_location_get_direction(const mavlink_message_t* msg)
  549. {
  550. return _MAV_RETURN_uint16_t(msg, 24);
  551. }
  552. /**
  553. * @brief Get field speed_horizontal from open_drone_id_location message
  554. *
  555. * @return [cm/s] Ground speed. Positive only. If unknown: 25500 cm/s. If speed is larger than 25425 cm/s, use 25425 cm/s.
  556. */
  557. static inline uint16_t mavlink_msg_open_drone_id_location_get_speed_horizontal(const mavlink_message_t* msg)
  558. {
  559. return _MAV_RETURN_uint16_t(msg, 26);
  560. }
  561. /**
  562. * @brief Get field speed_vertical from open_drone_id_location message
  563. *
  564. * @return [cm/s] The vertical speed. Up is positive. If unknown: 6300 cm/s. If speed is larger than 6200 cm/s, use 6200 cm/s. If lower than -6200 cm/s, use -6200 cm/s.
  565. */
  566. static inline int16_t mavlink_msg_open_drone_id_location_get_speed_vertical(const mavlink_message_t* msg)
  567. {
  568. return _MAV_RETURN_int16_t(msg, 28);
  569. }
  570. /**
  571. * @brief Get field latitude from open_drone_id_location message
  572. *
  573. * @return [degE7] Current latitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  574. */
  575. static inline int32_t mavlink_msg_open_drone_id_location_get_latitude(const mavlink_message_t* msg)
  576. {
  577. return _MAV_RETURN_int32_t(msg, 0);
  578. }
  579. /**
  580. * @brief Get field longitude from open_drone_id_location message
  581. *
  582. * @return [degE7] Current longitude of the unmanned aircraft. If unknown: 0 (both Lat/Lon).
  583. */
  584. static inline int32_t mavlink_msg_open_drone_id_location_get_longitude(const mavlink_message_t* msg)
  585. {
  586. return _MAV_RETURN_int32_t(msg, 4);
  587. }
  588. /**
  589. * @brief Get field altitude_barometric from open_drone_id_location message
  590. *
  591. * @return [m] The altitude calculated from the barometric pressue. Reference is against 29.92inHg or 1013.2mb. If unknown: -1000 m.
  592. */
  593. static inline float mavlink_msg_open_drone_id_location_get_altitude_barometric(const mavlink_message_t* msg)
  594. {
  595. return _MAV_RETURN_float(msg, 8);
  596. }
  597. /**
  598. * @brief Get field altitude_geodetic from open_drone_id_location message
  599. *
  600. * @return [m] The geodetic altitude as defined by WGS84. If unknown: -1000 m.
  601. */
  602. static inline float mavlink_msg_open_drone_id_location_get_altitude_geodetic(const mavlink_message_t* msg)
  603. {
  604. return _MAV_RETURN_float(msg, 12);
  605. }
  606. /**
  607. * @brief Get field height_reference from open_drone_id_location message
  608. *
  609. * @return Indicates the reference point for the height field.
  610. */
  611. static inline uint8_t mavlink_msg_open_drone_id_location_get_height_reference(const mavlink_message_t* msg)
  612. {
  613. return _MAV_RETURN_uint8_t(msg, 53);
  614. }
  615. /**
  616. * @brief Get field height from open_drone_id_location message
  617. *
  618. * @return [m] The current height of the unmanned aircraft above the take-off location or the ground as indicated by height_reference. If unknown: -1000 m.
  619. */
  620. static inline float mavlink_msg_open_drone_id_location_get_height(const mavlink_message_t* msg)
  621. {
  622. return _MAV_RETURN_float(msg, 16);
  623. }
  624. /**
  625. * @brief Get field horizontal_accuracy from open_drone_id_location message
  626. *
  627. * @return The accuracy of the horizontal position.
  628. */
  629. static inline uint8_t mavlink_msg_open_drone_id_location_get_horizontal_accuracy(const mavlink_message_t* msg)
  630. {
  631. return _MAV_RETURN_uint8_t(msg, 54);
  632. }
  633. /**
  634. * @brief Get field vertical_accuracy from open_drone_id_location message
  635. *
  636. * @return The accuracy of the vertical position.
  637. */
  638. static inline uint8_t mavlink_msg_open_drone_id_location_get_vertical_accuracy(const mavlink_message_t* msg)
  639. {
  640. return _MAV_RETURN_uint8_t(msg, 55);
  641. }
  642. /**
  643. * @brief Get field barometer_accuracy from open_drone_id_location message
  644. *
  645. * @return The accuracy of the barometric altitude.
  646. */
  647. static inline uint8_t mavlink_msg_open_drone_id_location_get_barometer_accuracy(const mavlink_message_t* msg)
  648. {
  649. return _MAV_RETURN_uint8_t(msg, 56);
  650. }
  651. /**
  652. * @brief Get field speed_accuracy from open_drone_id_location message
  653. *
  654. * @return The accuracy of the horizontal and vertical speed.
  655. */
  656. static inline uint8_t mavlink_msg_open_drone_id_location_get_speed_accuracy(const mavlink_message_t* msg)
  657. {
  658. return _MAV_RETURN_uint8_t(msg, 57);
  659. }
  660. /**
  661. * @brief Get field timestamp from open_drone_id_location message
  662. *
  663. * @return [s] Seconds after the full hour with reference to UTC time. Typically the GPS outputs a time-of-week value in milliseconds. First convert that to UTC and then convert for this field using ((float) (time_week_ms % (60*60*1000))) / 1000. If unknown: 0xFFFF.
  664. */
  665. static inline float mavlink_msg_open_drone_id_location_get_timestamp(const mavlink_message_t* msg)
  666. {
  667. return _MAV_RETURN_float(msg, 20);
  668. }
  669. /**
  670. * @brief Get field timestamp_accuracy from open_drone_id_location message
  671. *
  672. * @return The accuracy of the timestamps.
  673. */
  674. static inline uint8_t mavlink_msg_open_drone_id_location_get_timestamp_accuracy(const mavlink_message_t* msg)
  675. {
  676. return _MAV_RETURN_uint8_t(msg, 58);
  677. }
  678. /**
  679. * @brief Decode a open_drone_id_location message into a struct
  680. *
  681. * @param msg The message to decode
  682. * @param open_drone_id_location C-struct to decode the message contents into
  683. */
  684. static inline void mavlink_msg_open_drone_id_location_decode(const mavlink_message_t* msg, mavlink_open_drone_id_location_t* open_drone_id_location)
  685. {
  686. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  687. open_drone_id_location->latitude = mavlink_msg_open_drone_id_location_get_latitude(msg);
  688. open_drone_id_location->longitude = mavlink_msg_open_drone_id_location_get_longitude(msg);
  689. open_drone_id_location->altitude_barometric = mavlink_msg_open_drone_id_location_get_altitude_barometric(msg);
  690. open_drone_id_location->altitude_geodetic = mavlink_msg_open_drone_id_location_get_altitude_geodetic(msg);
  691. open_drone_id_location->height = mavlink_msg_open_drone_id_location_get_height(msg);
  692. open_drone_id_location->timestamp = mavlink_msg_open_drone_id_location_get_timestamp(msg);
  693. open_drone_id_location->direction = mavlink_msg_open_drone_id_location_get_direction(msg);
  694. open_drone_id_location->speed_horizontal = mavlink_msg_open_drone_id_location_get_speed_horizontal(msg);
  695. open_drone_id_location->speed_vertical = mavlink_msg_open_drone_id_location_get_speed_vertical(msg);
  696. open_drone_id_location->target_system = mavlink_msg_open_drone_id_location_get_target_system(msg);
  697. open_drone_id_location->target_component = mavlink_msg_open_drone_id_location_get_target_component(msg);
  698. mavlink_msg_open_drone_id_location_get_id_or_mac(msg, open_drone_id_location->id_or_mac);
  699. open_drone_id_location->status = mavlink_msg_open_drone_id_location_get_status(msg);
  700. open_drone_id_location->height_reference = mavlink_msg_open_drone_id_location_get_height_reference(msg);
  701. open_drone_id_location->horizontal_accuracy = mavlink_msg_open_drone_id_location_get_horizontal_accuracy(msg);
  702. open_drone_id_location->vertical_accuracy = mavlink_msg_open_drone_id_location_get_vertical_accuracy(msg);
  703. open_drone_id_location->barometer_accuracy = mavlink_msg_open_drone_id_location_get_barometer_accuracy(msg);
  704. open_drone_id_location->speed_accuracy = mavlink_msg_open_drone_id_location_get_speed_accuracy(msg);
  705. open_drone_id_location->timestamp_accuracy = mavlink_msg_open_drone_id_location_get_timestamp_accuracy(msg);
  706. #else
  707. uint8_t len = msg->len < MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN? msg->len : MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN;
  708. memset(open_drone_id_location, 0, MAVLINK_MSG_ID_OPEN_DRONE_ID_LOCATION_LEN);
  709. memcpy(open_drone_id_location, _MAV_PAYLOAD(msg), len);
  710. #endif
  711. }