mavlink_msg_open_drone_id_authentication.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. #pragma once
  2. // MESSAGE OPEN_DRONE_ID_AUTHENTICATION PACKING
  3. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION 12902
  4. typedef struct __mavlink_open_drone_id_authentication_t {
  5. uint32_t timestamp; /*< [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.*/
  6. uint8_t target_system; /*< System ID (0 for broadcast).*/
  7. uint8_t target_component; /*< Component ID (0 for broadcast).*/
  8. 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. */
  9. uint8_t authentication_type; /*< Indicates the type of authentication.*/
  10. uint8_t data_page; /*< Allowed range is 0 - 15.*/
  11. uint8_t last_page_index; /*< This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.*/
  12. uint8_t length; /*< [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.*/
  13. uint8_t authentication_data[23]; /*< Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.*/
  14. } mavlink_open_drone_id_authentication_t;
  15. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN 53
  16. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN 53
  17. #define MAVLINK_MSG_ID_12902_LEN 53
  18. #define MAVLINK_MSG_ID_12902_MIN_LEN 53
  19. #define MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC 140
  20. #define MAVLINK_MSG_ID_12902_CRC 140
  21. #define MAVLINK_MSG_OPEN_DRONE_ID_AUTHENTICATION_FIELD_ID_OR_MAC_LEN 20
  22. #define MAVLINK_MSG_OPEN_DRONE_ID_AUTHENTICATION_FIELD_AUTHENTICATION_DATA_LEN 23
  23. #if MAVLINK_COMMAND_24BIT
  24. #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION { \
  25. 12902, \
  26. "OPEN_DRONE_ID_AUTHENTICATION", \
  27. 9, \
  28. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_open_drone_id_authentication_t, target_system) }, \
  29. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_open_drone_id_authentication_t, target_component) }, \
  30. { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_open_drone_id_authentication_t, id_or_mac) }, \
  31. { "authentication_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_open_drone_id_authentication_t, authentication_type) }, \
  32. { "data_page", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_open_drone_id_authentication_t, data_page) }, \
  33. { "last_page_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, last_page_index) }, \
  34. { "length", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_authentication_t, length) }, \
  35. { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_open_drone_id_authentication_t, timestamp) }, \
  36. { "authentication_data", NULL, MAVLINK_TYPE_UINT8_T, 23, 30, offsetof(mavlink_open_drone_id_authentication_t, authentication_data) }, \
  37. } \
  38. }
  39. #else
  40. #define MAVLINK_MESSAGE_INFO_OPEN_DRONE_ID_AUTHENTICATION { \
  41. "OPEN_DRONE_ID_AUTHENTICATION", \
  42. 9, \
  43. { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_open_drone_id_authentication_t, target_system) }, \
  44. { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_open_drone_id_authentication_t, target_component) }, \
  45. { "id_or_mac", NULL, MAVLINK_TYPE_UINT8_T, 20, 6, offsetof(mavlink_open_drone_id_authentication_t, id_or_mac) }, \
  46. { "authentication_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_open_drone_id_authentication_t, authentication_type) }, \
  47. { "data_page", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_open_drone_id_authentication_t, data_page) }, \
  48. { "last_page_index", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_open_drone_id_authentication_t, last_page_index) }, \
  49. { "length", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_open_drone_id_authentication_t, length) }, \
  50. { "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_open_drone_id_authentication_t, timestamp) }, \
  51. { "authentication_data", NULL, MAVLINK_TYPE_UINT8_T, 23, 30, offsetof(mavlink_open_drone_id_authentication_t, authentication_data) }, \
  52. } \
  53. }
  54. #endif
  55. /**
  56. * @brief Pack a open_drone_id_authentication message
  57. * @param system_id ID of this system
  58. * @param component_id ID of this component (e.g. 200 for IMU)
  59. * @param msg The MAVLink message to compress the data into
  60. *
  61. * @param target_system System ID (0 for broadcast).
  62. * @param target_component Component ID (0 for broadcast).
  63. * @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.
  64. * @param authentication_type Indicates the type of authentication.
  65. * @param data_page Allowed range is 0 - 15.
  66. * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  67. * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  68. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.
  69. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.
  70. * @return length of the message in bytes (excluding serial stream start sign)
  71. */
  72. static inline uint16_t mavlink_msg_open_drone_id_authentication_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  73. uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data)
  74. {
  75. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  76. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN];
  77. _mav_put_uint32_t(buf, 0, timestamp);
  78. _mav_put_uint8_t(buf, 4, target_system);
  79. _mav_put_uint8_t(buf, 5, target_component);
  80. _mav_put_uint8_t(buf, 26, authentication_type);
  81. _mav_put_uint8_t(buf, 27, data_page);
  82. _mav_put_uint8_t(buf, 28, last_page_index);
  83. _mav_put_uint8_t(buf, 29, length);
  84. _mav_put_uint8_t_array(buf, 6, id_or_mac, 20);
  85. _mav_put_uint8_t_array(buf, 30, authentication_data, 23);
  86. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  87. #else
  88. mavlink_open_drone_id_authentication_t packet;
  89. packet.timestamp = timestamp;
  90. packet.target_system = target_system;
  91. packet.target_component = target_component;
  92. packet.authentication_type = authentication_type;
  93. packet.data_page = data_page;
  94. packet.last_page_index = last_page_index;
  95. packet.length = length;
  96. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  97. mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23);
  98. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  99. #endif
  100. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION;
  101. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  102. }
  103. /**
  104. * @brief Pack a open_drone_id_authentication message
  105. * @param system_id ID of this system
  106. * @param component_id ID of this component (e.g. 200 for IMU)
  107. * @param status MAVLink status structure
  108. * @param msg The MAVLink message to compress the data into
  109. *
  110. * @param target_system System ID (0 for broadcast).
  111. * @param target_component Component ID (0 for broadcast).
  112. * @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.
  113. * @param authentication_type Indicates the type of authentication.
  114. * @param data_page Allowed range is 0 - 15.
  115. * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  116. * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  117. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.
  118. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.
  119. * @return length of the message in bytes (excluding serial stream start sign)
  120. */
  121. static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
  122. uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data)
  123. {
  124. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  125. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN];
  126. _mav_put_uint32_t(buf, 0, timestamp);
  127. _mav_put_uint8_t(buf, 4, target_system);
  128. _mav_put_uint8_t(buf, 5, target_component);
  129. _mav_put_uint8_t(buf, 26, authentication_type);
  130. _mav_put_uint8_t(buf, 27, data_page);
  131. _mav_put_uint8_t(buf, 28, last_page_index);
  132. _mav_put_uint8_t(buf, 29, length);
  133. _mav_put_uint8_t_array(buf, 6, id_or_mac, 20);
  134. _mav_put_uint8_t_array(buf, 30, authentication_data, 23);
  135. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  136. #else
  137. mavlink_open_drone_id_authentication_t packet;
  138. packet.timestamp = timestamp;
  139. packet.target_system = target_system;
  140. packet.target_component = target_component;
  141. packet.authentication_type = authentication_type;
  142. packet.data_page = data_page;
  143. packet.last_page_index = last_page_index;
  144. packet.length = length;
  145. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  146. mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23);
  147. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  148. #endif
  149. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION;
  150. #if MAVLINK_CRC_EXTRA
  151. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  152. #else
  153. return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  154. #endif
  155. }
  156. /**
  157. * @brief Pack a open_drone_id_authentication message on a channel
  158. * @param system_id ID of this system
  159. * @param component_id ID of this component (e.g. 200 for IMU)
  160. * @param chan The MAVLink channel this message will be sent over
  161. * @param msg The MAVLink message to compress the data into
  162. * @param target_system System ID (0 for broadcast).
  163. * @param target_component Component ID (0 for broadcast).
  164. * @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.
  165. * @param authentication_type Indicates the type of authentication.
  166. * @param data_page Allowed range is 0 - 15.
  167. * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  168. * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  169. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.
  170. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.
  171. * @return length of the message in bytes (excluding serial stream start sign)
  172. */
  173. static inline uint16_t mavlink_msg_open_drone_id_authentication_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  174. mavlink_message_t* msg,
  175. uint8_t target_system,uint8_t target_component,const uint8_t *id_or_mac,uint8_t authentication_type,uint8_t data_page,uint8_t last_page_index,uint8_t length,uint32_t timestamp,const uint8_t *authentication_data)
  176. {
  177. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  178. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN];
  179. _mav_put_uint32_t(buf, 0, timestamp);
  180. _mav_put_uint8_t(buf, 4, target_system);
  181. _mav_put_uint8_t(buf, 5, target_component);
  182. _mav_put_uint8_t(buf, 26, authentication_type);
  183. _mav_put_uint8_t(buf, 27, data_page);
  184. _mav_put_uint8_t(buf, 28, last_page_index);
  185. _mav_put_uint8_t(buf, 29, length);
  186. _mav_put_uint8_t_array(buf, 6, id_or_mac, 20);
  187. _mav_put_uint8_t_array(buf, 30, authentication_data, 23);
  188. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  189. #else
  190. mavlink_open_drone_id_authentication_t packet;
  191. packet.timestamp = timestamp;
  192. packet.target_system = target_system;
  193. packet.target_component = target_component;
  194. packet.authentication_type = authentication_type;
  195. packet.data_page = data_page;
  196. packet.last_page_index = last_page_index;
  197. packet.length = length;
  198. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  199. mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23);
  200. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  201. #endif
  202. msg->msgid = MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION;
  203. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  204. }
  205. /**
  206. * @brief Encode a open_drone_id_authentication struct
  207. *
  208. * @param system_id ID of this system
  209. * @param component_id ID of this component (e.g. 200 for IMU)
  210. * @param msg The MAVLink message to compress the data into
  211. * @param open_drone_id_authentication C-struct to read the message contents from
  212. */
  213. static inline uint16_t mavlink_msg_open_drone_id_authentication_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication)
  214. {
  215. return mavlink_msg_open_drone_id_authentication_pack(system_id, component_id, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data);
  216. }
  217. /**
  218. * @brief Encode a open_drone_id_authentication struct on a channel
  219. *
  220. * @param system_id ID of this system
  221. * @param component_id ID of this component (e.g. 200 for IMU)
  222. * @param chan The MAVLink channel this message will be sent over
  223. * @param msg The MAVLink message to compress the data into
  224. * @param open_drone_id_authentication C-struct to read the message contents from
  225. */
  226. static inline uint16_t mavlink_msg_open_drone_id_authentication_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication)
  227. {
  228. return mavlink_msg_open_drone_id_authentication_pack_chan(system_id, component_id, chan, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data);
  229. }
  230. /**
  231. * @brief Encode a open_drone_id_authentication struct with provided status structure
  232. *
  233. * @param system_id ID of this system
  234. * @param component_id ID of this component (e.g. 200 for IMU)
  235. * @param status MAVLink status structure
  236. * @param msg The MAVLink message to compress the data into
  237. * @param open_drone_id_authentication C-struct to read the message contents from
  238. */
  239. static inline uint16_t mavlink_msg_open_drone_id_authentication_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication)
  240. {
  241. return mavlink_msg_open_drone_id_authentication_pack_status(system_id, component_id, _status, msg, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data);
  242. }
  243. /**
  244. * @brief Send a open_drone_id_authentication message
  245. * @param chan MAVLink channel to send the message
  246. *
  247. * @param target_system System ID (0 for broadcast).
  248. * @param target_component Component ID (0 for broadcast).
  249. * @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.
  250. * @param authentication_type Indicates the type of authentication.
  251. * @param data_page Allowed range is 0 - 15.
  252. * @param last_page_index This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  253. * @param length [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  254. * @param timestamp [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.
  255. * @param authentication_data Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.
  256. */
  257. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  258. static inline void mavlink_msg_open_drone_id_authentication_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const uint8_t *id_or_mac, uint8_t authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data)
  259. {
  260. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  261. char buf[MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN];
  262. _mav_put_uint32_t(buf, 0, timestamp);
  263. _mav_put_uint8_t(buf, 4, target_system);
  264. _mav_put_uint8_t(buf, 5, target_component);
  265. _mav_put_uint8_t(buf, 26, authentication_type);
  266. _mav_put_uint8_t(buf, 27, data_page);
  267. _mav_put_uint8_t(buf, 28, last_page_index);
  268. _mav_put_uint8_t(buf, 29, length);
  269. _mav_put_uint8_t_array(buf, 6, id_or_mac, 20);
  270. _mav_put_uint8_t_array(buf, 30, authentication_data, 23);
  271. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  272. #else
  273. mavlink_open_drone_id_authentication_t packet;
  274. packet.timestamp = timestamp;
  275. packet.target_system = target_system;
  276. packet.target_component = target_component;
  277. packet.authentication_type = authentication_type;
  278. packet.data_page = data_page;
  279. packet.last_page_index = last_page_index;
  280. packet.length = length;
  281. mav_array_memcpy(packet.id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  282. mav_array_memcpy(packet.authentication_data, authentication_data, sizeof(uint8_t)*23);
  283. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)&packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  284. #endif
  285. }
  286. /**
  287. * @brief Send a open_drone_id_authentication message
  288. * @param chan MAVLink channel to send the message
  289. * @param struct The MAVLink struct to serialize
  290. */
  291. static inline void mavlink_msg_open_drone_id_authentication_send_struct(mavlink_channel_t chan, const mavlink_open_drone_id_authentication_t* open_drone_id_authentication)
  292. {
  293. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  294. mavlink_msg_open_drone_id_authentication_send(chan, open_drone_id_authentication->target_system, open_drone_id_authentication->target_component, open_drone_id_authentication->id_or_mac, open_drone_id_authentication->authentication_type, open_drone_id_authentication->data_page, open_drone_id_authentication->last_page_index, open_drone_id_authentication->length, open_drone_id_authentication->timestamp, open_drone_id_authentication->authentication_data);
  295. #else
  296. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)open_drone_id_authentication, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  297. #endif
  298. }
  299. #if MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  300. /*
  301. This variant of _send() can be used to save stack space by re-using
  302. memory from the receive buffer. The caller provides a
  303. mavlink_message_t which is the size of a full mavlink message. This
  304. is usually the receive buffer for the channel, and allows a reply to an
  305. incoming message with minimum stack space usage.
  306. */
  307. static inline void mavlink_msg_open_drone_id_authentication_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 authentication_type, uint8_t data_page, uint8_t last_page_index, uint8_t length, uint32_t timestamp, const uint8_t *authentication_data)
  308. {
  309. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  310. char *buf = (char *)msgbuf;
  311. _mav_put_uint32_t(buf, 0, timestamp);
  312. _mav_put_uint8_t(buf, 4, target_system);
  313. _mav_put_uint8_t(buf, 5, target_component);
  314. _mav_put_uint8_t(buf, 26, authentication_type);
  315. _mav_put_uint8_t(buf, 27, data_page);
  316. _mav_put_uint8_t(buf, 28, last_page_index);
  317. _mav_put_uint8_t(buf, 29, length);
  318. _mav_put_uint8_t_array(buf, 6, id_or_mac, 20);
  319. _mav_put_uint8_t_array(buf, 30, authentication_data, 23);
  320. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, buf, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  321. #else
  322. mavlink_open_drone_id_authentication_t *packet = (mavlink_open_drone_id_authentication_t *)msgbuf;
  323. packet->timestamp = timestamp;
  324. packet->target_system = target_system;
  325. packet->target_component = target_component;
  326. packet->authentication_type = authentication_type;
  327. packet->data_page = data_page;
  328. packet->last_page_index = last_page_index;
  329. packet->length = length;
  330. mav_array_memcpy(packet->id_or_mac, id_or_mac, sizeof(uint8_t)*20);
  331. mav_array_memcpy(packet->authentication_data, authentication_data, sizeof(uint8_t)*23);
  332. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION, (const char *)packet, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_MIN_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_CRC);
  333. #endif
  334. }
  335. #endif
  336. #endif
  337. // MESSAGE OPEN_DRONE_ID_AUTHENTICATION UNPACKING
  338. /**
  339. * @brief Get field target_system from open_drone_id_authentication message
  340. *
  341. * @return System ID (0 for broadcast).
  342. */
  343. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_target_system(const mavlink_message_t* msg)
  344. {
  345. return _MAV_RETURN_uint8_t(msg, 4);
  346. }
  347. /**
  348. * @brief Get field target_component from open_drone_id_authentication message
  349. *
  350. * @return Component ID (0 for broadcast).
  351. */
  352. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_target_component(const mavlink_message_t* msg)
  353. {
  354. return _MAV_RETURN_uint8_t(msg, 5);
  355. }
  356. /**
  357. * @brief Get field id_or_mac from open_drone_id_authentication message
  358. *
  359. * @return Only used for drone ID data received from other UAs. See detailed description at https://mavlink.io/en/services/opendroneid.html.
  360. */
  361. static inline uint16_t mavlink_msg_open_drone_id_authentication_get_id_or_mac(const mavlink_message_t* msg, uint8_t *id_or_mac)
  362. {
  363. return _MAV_RETURN_uint8_t_array(msg, id_or_mac, 20, 6);
  364. }
  365. /**
  366. * @brief Get field authentication_type from open_drone_id_authentication message
  367. *
  368. * @return Indicates the type of authentication.
  369. */
  370. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_authentication_type(const mavlink_message_t* msg)
  371. {
  372. return _MAV_RETURN_uint8_t(msg, 26);
  373. }
  374. /**
  375. * @brief Get field data_page from open_drone_id_authentication message
  376. *
  377. * @return Allowed range is 0 - 15.
  378. */
  379. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_data_page(const mavlink_message_t* msg)
  380. {
  381. return _MAV_RETURN_uint8_t(msg, 27);
  382. }
  383. /**
  384. * @brief Get field last_page_index from open_drone_id_authentication message
  385. *
  386. * @return This field is only present for page 0. Allowed range is 0 - 15. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  387. */
  388. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_last_page_index(const mavlink_message_t* msg)
  389. {
  390. return _MAV_RETURN_uint8_t(msg, 28);
  391. }
  392. /**
  393. * @brief Get field length from open_drone_id_authentication message
  394. *
  395. * @return [bytes] This field is only present for page 0. Total bytes of authentication_data from all data pages. See the description of struct ODID_Auth_data at https://github.com/opendroneid/opendroneid-core-c/blob/master/libopendroneid/opendroneid.h.
  396. */
  397. static inline uint8_t mavlink_msg_open_drone_id_authentication_get_length(const mavlink_message_t* msg)
  398. {
  399. return _MAV_RETURN_uint8_t(msg, 29);
  400. }
  401. /**
  402. * @brief Get field timestamp from open_drone_id_authentication message
  403. *
  404. * @return [s] This field is only present for page 0. 32 bit Unix Timestamp in seconds since 00:00:00 01/01/2019.
  405. */
  406. static inline uint32_t mavlink_msg_open_drone_id_authentication_get_timestamp(const mavlink_message_t* msg)
  407. {
  408. return _MAV_RETURN_uint32_t(msg, 0);
  409. }
  410. /**
  411. * @brief Get field authentication_data from open_drone_id_authentication message
  412. *
  413. * @return Opaque authentication data. For page 0, the size is only 17 bytes. For other pages, the size is 23 bytes. Shall be filled with nulls in the unused portion of the field.
  414. */
  415. static inline uint16_t mavlink_msg_open_drone_id_authentication_get_authentication_data(const mavlink_message_t* msg, uint8_t *authentication_data)
  416. {
  417. return _MAV_RETURN_uint8_t_array(msg, authentication_data, 23, 30);
  418. }
  419. /**
  420. * @brief Decode a open_drone_id_authentication message into a struct
  421. *
  422. * @param msg The message to decode
  423. * @param open_drone_id_authentication C-struct to decode the message contents into
  424. */
  425. static inline void mavlink_msg_open_drone_id_authentication_decode(const mavlink_message_t* msg, mavlink_open_drone_id_authentication_t* open_drone_id_authentication)
  426. {
  427. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  428. open_drone_id_authentication->timestamp = mavlink_msg_open_drone_id_authentication_get_timestamp(msg);
  429. open_drone_id_authentication->target_system = mavlink_msg_open_drone_id_authentication_get_target_system(msg);
  430. open_drone_id_authentication->target_component = mavlink_msg_open_drone_id_authentication_get_target_component(msg);
  431. mavlink_msg_open_drone_id_authentication_get_id_or_mac(msg, open_drone_id_authentication->id_or_mac);
  432. open_drone_id_authentication->authentication_type = mavlink_msg_open_drone_id_authentication_get_authentication_type(msg);
  433. open_drone_id_authentication->data_page = mavlink_msg_open_drone_id_authentication_get_data_page(msg);
  434. open_drone_id_authentication->last_page_index = mavlink_msg_open_drone_id_authentication_get_last_page_index(msg);
  435. open_drone_id_authentication->length = mavlink_msg_open_drone_id_authentication_get_length(msg);
  436. mavlink_msg_open_drone_id_authentication_get_authentication_data(msg, open_drone_id_authentication->authentication_data);
  437. #else
  438. uint8_t len = msg->len < MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN? msg->len : MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN;
  439. memset(open_drone_id_authentication, 0, MAVLINK_MSG_ID_OPEN_DRONE_ID_AUTHENTICATION_LEN);
  440. memcpy(open_drone_id_authentication, _MAV_PAYLOAD(msg), len);
  441. #endif
  442. }