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.

483 lines
28 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #pragma once
  2. // MESSAGE AUTOPILOT_VERSION PACKING
  3. #define MAVLINK_MSG_ID_AUTOPILOT_VERSION 148
  4. MAVPACKED(
  5. typedef struct __mavlink_autopilot_version_t {
  6. uint64_t capabilities; /*< Bitmap of capabilities*/
  7. uint64_t uid; /*< UID if provided by hardware (see uid2)*/
  8. uint32_t flight_sw_version; /*< Firmware version number*/
  9. uint32_t middleware_sw_version; /*< Middleware version number*/
  10. uint32_t os_sw_version; /*< Operating system version number*/
  11. uint32_t board_version; /*< HW / board version (last 8 bytes should be silicon ID, if any)*/
  12. uint16_t vendor_id; /*< ID of the board vendor*/
  13. uint16_t product_id; /*< ID of the product*/
  14. uint8_t flight_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/
  15. uint8_t middleware_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/
  16. uint8_t os_custom_version[8]; /*< Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.*/
  17. uint8_t uid2[18]; /*< UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)*/
  18. }) mavlink_autopilot_version_t;
  19. #define MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN 78
  20. #define MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN 60
  21. #define MAVLINK_MSG_ID_148_LEN 78
  22. #define MAVLINK_MSG_ID_148_MIN_LEN 60
  23. #define MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC 178
  24. #define MAVLINK_MSG_ID_148_CRC 178
  25. #define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_FLIGHT_CUSTOM_VERSION_LEN 8
  26. #define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_MIDDLEWARE_CUSTOM_VERSION_LEN 8
  27. #define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_OS_CUSTOM_VERSION_LEN 8
  28. #define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_UID2_LEN 18
  29. #if MAVLINK_COMMAND_24BIT
  30. #define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION { \
  31. 148, \
  32. "AUTOPILOT_VERSION", \
  33. 12, \
  34. { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) }, \
  35. { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) }, \
  36. { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) }, \
  37. { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) }, \
  38. { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) }, \
  39. { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) }, \
  40. { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) }, \
  41. { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) }, \
  42. { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) }, \
  43. { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) }, \
  44. { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) }, \
  45. { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) }, \
  46. } \
  47. }
  48. #else
  49. #define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION { \
  50. "AUTOPILOT_VERSION", \
  51. 12, \
  52. { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) }, \
  53. { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) }, \
  54. { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) }, \
  55. { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) }, \
  56. { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) }, \
  57. { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) }, \
  58. { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) }, \
  59. { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) }, \
  60. { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) }, \
  61. { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) }, \
  62. { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) }, \
  63. { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) }, \
  64. } \
  65. }
  66. #endif
  67. /**
  68. * @brief Pack a autopilot_version 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 capabilities Bitmap of capabilities
  74. * @param flight_sw_version Firmware version number
  75. * @param middleware_sw_version Middleware version number
  76. * @param os_sw_version Operating system version number
  77. * @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
  78. * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  79. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  80. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  81. * @param vendor_id ID of the board vendor
  82. * @param product_id ID of the product
  83. * @param uid UID if provided by hardware (see uid2)
  84. * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
  85. * @return length of the message in bytes (excluding serial stream start sign)
  86. */
  87. static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
  88. uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2)
  89. {
  90. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  91. char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
  92. _mav_put_uint64_t(buf, 0, capabilities);
  93. _mav_put_uint64_t(buf, 8, uid);
  94. _mav_put_uint32_t(buf, 16, flight_sw_version);
  95. _mav_put_uint32_t(buf, 20, middleware_sw_version);
  96. _mav_put_uint32_t(buf, 24, os_sw_version);
  97. _mav_put_uint32_t(buf, 28, board_version);
  98. _mav_put_uint16_t(buf, 32, vendor_id);
  99. _mav_put_uint16_t(buf, 34, product_id);
  100. _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
  101. _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
  102. _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
  103. _mav_put_uint8_t_array(buf, 60, uid2, 18);
  104. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
  105. #else
  106. mavlink_autopilot_version_t packet;
  107. packet.capabilities = capabilities;
  108. packet.uid = uid;
  109. packet.flight_sw_version = flight_sw_version;
  110. packet.middleware_sw_version = middleware_sw_version;
  111. packet.os_sw_version = os_sw_version;
  112. packet.board_version = board_version;
  113. packet.vendor_id = vendor_id;
  114. packet.product_id = product_id;
  115. mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
  116. mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
  117. mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
  118. mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
  119. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
  120. #endif
  121. msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION;
  122. return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  123. }
  124. /**
  125. * @brief Pack a autopilot_version message on a channel
  126. * @param system_id ID of this system
  127. * @param component_id ID of this component (e.g. 200 for IMU)
  128. * @param chan The MAVLink channel this message will be sent over
  129. * @param msg The MAVLink message to compress the data into
  130. * @param capabilities Bitmap of capabilities
  131. * @param flight_sw_version Firmware version number
  132. * @param middleware_sw_version Middleware version number
  133. * @param os_sw_version Operating system version number
  134. * @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
  135. * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  136. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  137. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  138. * @param vendor_id ID of the board vendor
  139. * @param product_id ID of the product
  140. * @param uid UID if provided by hardware (see uid2)
  141. * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
  142. * @return length of the message in bytes (excluding serial stream start sign)
  143. */
  144. static inline uint16_t mavlink_msg_autopilot_version_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
  145. mavlink_message_t* msg,
  146. uint64_t capabilities,uint32_t flight_sw_version,uint32_t middleware_sw_version,uint32_t os_sw_version,uint32_t board_version,const uint8_t *flight_custom_version,const uint8_t *middleware_custom_version,const uint8_t *os_custom_version,uint16_t vendor_id,uint16_t product_id,uint64_t uid,const uint8_t *uid2)
  147. {
  148. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  149. char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
  150. _mav_put_uint64_t(buf, 0, capabilities);
  151. _mav_put_uint64_t(buf, 8, uid);
  152. _mav_put_uint32_t(buf, 16, flight_sw_version);
  153. _mav_put_uint32_t(buf, 20, middleware_sw_version);
  154. _mav_put_uint32_t(buf, 24, os_sw_version);
  155. _mav_put_uint32_t(buf, 28, board_version);
  156. _mav_put_uint16_t(buf, 32, vendor_id);
  157. _mav_put_uint16_t(buf, 34, product_id);
  158. _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
  159. _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
  160. _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
  161. _mav_put_uint8_t_array(buf, 60, uid2, 18);
  162. memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
  163. #else
  164. mavlink_autopilot_version_t packet;
  165. packet.capabilities = capabilities;
  166. packet.uid = uid;
  167. packet.flight_sw_version = flight_sw_version;
  168. packet.middleware_sw_version = middleware_sw_version;
  169. packet.os_sw_version = os_sw_version;
  170. packet.board_version = board_version;
  171. packet.vendor_id = vendor_id;
  172. packet.product_id = product_id;
  173. mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
  174. mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
  175. mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
  176. mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
  177. memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
  178. #endif
  179. msg->msgid = MAVLINK_MSG_ID_AUTOPILOT_VERSION;
  180. return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  181. }
  182. /**
  183. * @brief Encode a autopilot_version struct
  184. *
  185. * @param system_id ID of this system
  186. * @param component_id ID of this component (e.g. 200 for IMU)
  187. * @param msg The MAVLink message to compress the data into
  188. * @param autopilot_version C-struct to read the message contents from
  189. */
  190. static inline uint16_t mavlink_msg_autopilot_version_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version)
  191. {
  192. return mavlink_msg_autopilot_version_pack(system_id, component_id, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2);
  193. }
  194. /**
  195. * @brief Encode a autopilot_version struct on a channel
  196. *
  197. * @param system_id ID of this system
  198. * @param component_id ID of this component (e.g. 200 for IMU)
  199. * @param chan The MAVLink channel this message will be sent over
  200. * @param msg The MAVLink message to compress the data into
  201. * @param autopilot_version C-struct to read the message contents from
  202. */
  203. static inline uint16_t mavlink_msg_autopilot_version_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version)
  204. {
  205. return mavlink_msg_autopilot_version_pack_chan(system_id, component_id, chan, msg, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2);
  206. }
  207. /**
  208. * @brief Send a autopilot_version message
  209. * @param chan MAVLink channel to send the message
  210. *
  211. * @param capabilities Bitmap of capabilities
  212. * @param flight_sw_version Firmware version number
  213. * @param middleware_sw_version Middleware version number
  214. * @param os_sw_version Operating system version number
  215. * @param board_version HW / board version (last 8 bytes should be silicon ID, if any)
  216. * @param flight_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  217. * @param middleware_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  218. * @param os_custom_version Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  219. * @param vendor_id ID of the board vendor
  220. * @param product_id ID of the product
  221. * @param uid UID if provided by hardware (see uid2)
  222. * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
  223. */
  224. #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
  225. static inline void mavlink_msg_autopilot_version_send(mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2)
  226. {
  227. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  228. char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
  229. _mav_put_uint64_t(buf, 0, capabilities);
  230. _mav_put_uint64_t(buf, 8, uid);
  231. _mav_put_uint32_t(buf, 16, flight_sw_version);
  232. _mav_put_uint32_t(buf, 20, middleware_sw_version);
  233. _mav_put_uint32_t(buf, 24, os_sw_version);
  234. _mav_put_uint32_t(buf, 28, board_version);
  235. _mav_put_uint16_t(buf, 32, vendor_id);
  236. _mav_put_uint16_t(buf, 34, product_id);
  237. _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
  238. _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
  239. _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
  240. _mav_put_uint8_t_array(buf, 60, uid2, 18);
  241. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  242. #else
  243. mavlink_autopilot_version_t packet;
  244. packet.capabilities = capabilities;
  245. packet.uid = uid;
  246. packet.flight_sw_version = flight_sw_version;
  247. packet.middleware_sw_version = middleware_sw_version;
  248. packet.os_sw_version = os_sw_version;
  249. packet.board_version = board_version;
  250. packet.vendor_id = vendor_id;
  251. packet.product_id = product_id;
  252. mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
  253. mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
  254. mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
  255. mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
  256. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)&packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  257. #endif
  258. }
  259. /**
  260. * @brief Send a autopilot_version message
  261. * @param chan MAVLink channel to send the message
  262. * @param struct The MAVLink struct to serialize
  263. */
  264. static inline void mavlink_msg_autopilot_version_send_struct(mavlink_channel_t chan, const mavlink_autopilot_version_t* autopilot_version)
  265. {
  266. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  267. mavlink_msg_autopilot_version_send(chan, autopilot_version->capabilities, autopilot_version->flight_sw_version, autopilot_version->middleware_sw_version, autopilot_version->os_sw_version, autopilot_version->board_version, autopilot_version->flight_custom_version, autopilot_version->middleware_custom_version, autopilot_version->os_custom_version, autopilot_version->vendor_id, autopilot_version->product_id, autopilot_version->uid, autopilot_version->uid2);
  268. #else
  269. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)autopilot_version, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  270. #endif
  271. }
  272. #if MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
  273. /*
  274. This varient of _send() can be used to save stack space by re-using
  275. memory from the receive buffer. The caller provides a
  276. mavlink_message_t which is the size of a full mavlink message. This
  277. is usually the receive buffer for the channel, and allows a reply to an
  278. incoming message with minimum stack space usage.
  279. */
  280. static inline void mavlink_msg_autopilot_version_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t capabilities, uint32_t flight_sw_version, uint32_t middleware_sw_version, uint32_t os_sw_version, uint32_t board_version, const uint8_t *flight_custom_version, const uint8_t *middleware_custom_version, const uint8_t *os_custom_version, uint16_t vendor_id, uint16_t product_id, uint64_t uid, const uint8_t *uid2)
  281. {
  282. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  283. char *buf = (char *)msgbuf;
  284. _mav_put_uint64_t(buf, 0, capabilities);
  285. _mav_put_uint64_t(buf, 8, uid);
  286. _mav_put_uint32_t(buf, 16, flight_sw_version);
  287. _mav_put_uint32_t(buf, 20, middleware_sw_version);
  288. _mav_put_uint32_t(buf, 24, os_sw_version);
  289. _mav_put_uint32_t(buf, 28, board_version);
  290. _mav_put_uint16_t(buf, 32, vendor_id);
  291. _mav_put_uint16_t(buf, 34, product_id);
  292. _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
  293. _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
  294. _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
  295. _mav_put_uint8_t_array(buf, 60, uid2, 18);
  296. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  297. #else
  298. mavlink_autopilot_version_t *packet = (mavlink_autopilot_version_t *)msgbuf;
  299. packet->capabilities = capabilities;
  300. packet->uid = uid;
  301. packet->flight_sw_version = flight_sw_version;
  302. packet->middleware_sw_version = middleware_sw_version;
  303. packet->os_sw_version = os_sw_version;
  304. packet->board_version = board_version;
  305. packet->vendor_id = vendor_id;
  306. packet->product_id = product_id;
  307. mav_array_memcpy(packet->flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
  308. mav_array_memcpy(packet->middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
  309. mav_array_memcpy(packet->os_custom_version, os_custom_version, sizeof(uint8_t)*8);
  310. mav_array_memcpy(packet->uid2, uid2, sizeof(uint8_t)*18);
  311. _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTOPILOT_VERSION, (const char *)packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
  312. #endif
  313. }
  314. #endif
  315. #endif
  316. // MESSAGE AUTOPILOT_VERSION UNPACKING
  317. /**
  318. * @brief Get field capabilities from autopilot_version message
  319. *
  320. * @return Bitmap of capabilities
  321. */
  322. static inline uint64_t mavlink_msg_autopilot_version_get_capabilities(const mavlink_message_t* msg)
  323. {
  324. return _MAV_RETURN_uint64_t(msg, 0);
  325. }
  326. /**
  327. * @brief Get field flight_sw_version from autopilot_version message
  328. *
  329. * @return Firmware version number
  330. */
  331. static inline uint32_t mavlink_msg_autopilot_version_get_flight_sw_version(const mavlink_message_t* msg)
  332. {
  333. return _MAV_RETURN_uint32_t(msg, 16);
  334. }
  335. /**
  336. * @brief Get field middleware_sw_version from autopilot_version message
  337. *
  338. * @return Middleware version number
  339. */
  340. static inline uint32_t mavlink_msg_autopilot_version_get_middleware_sw_version(const mavlink_message_t* msg)
  341. {
  342. return _MAV_RETURN_uint32_t(msg, 20);
  343. }
  344. /**
  345. * @brief Get field os_sw_version from autopilot_version message
  346. *
  347. * @return Operating system version number
  348. */
  349. static inline uint32_t mavlink_msg_autopilot_version_get_os_sw_version(const mavlink_message_t* msg)
  350. {
  351. return _MAV_RETURN_uint32_t(msg, 24);
  352. }
  353. /**
  354. * @brief Get field board_version from autopilot_version message
  355. *
  356. * @return HW / board version (last 8 bytes should be silicon ID, if any)
  357. */
  358. static inline uint32_t mavlink_msg_autopilot_version_get_board_version(const mavlink_message_t* msg)
  359. {
  360. return _MAV_RETURN_uint32_t(msg, 28);
  361. }
  362. /**
  363. * @brief Get field flight_custom_version from autopilot_version message
  364. *
  365. * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  366. */
  367. static inline uint16_t mavlink_msg_autopilot_version_get_flight_custom_version(const mavlink_message_t* msg, uint8_t *flight_custom_version)
  368. {
  369. return _MAV_RETURN_uint8_t_array(msg, flight_custom_version, 8, 36);
  370. }
  371. /**
  372. * @brief Get field middleware_custom_version from autopilot_version message
  373. *
  374. * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  375. */
  376. static inline uint16_t mavlink_msg_autopilot_version_get_middleware_custom_version(const mavlink_message_t* msg, uint8_t *middleware_custom_version)
  377. {
  378. return _MAV_RETURN_uint8_t_array(msg, middleware_custom_version, 8, 44);
  379. }
  380. /**
  381. * @brief Get field os_custom_version from autopilot_version message
  382. *
  383. * @return Custom version field, commonly the first 8 bytes of the git hash. This is not an unique identifier, but should allow to identify the commit using the main version number even for very large code bases.
  384. */
  385. static inline uint16_t mavlink_msg_autopilot_version_get_os_custom_version(const mavlink_message_t* msg, uint8_t *os_custom_version)
  386. {
  387. return _MAV_RETURN_uint8_t_array(msg, os_custom_version, 8, 52);
  388. }
  389. /**
  390. * @brief Get field vendor_id from autopilot_version message
  391. *
  392. * @return ID of the board vendor
  393. */
  394. static inline uint16_t mavlink_msg_autopilot_version_get_vendor_id(const mavlink_message_t* msg)
  395. {
  396. return _MAV_RETURN_uint16_t(msg, 32);
  397. }
  398. /**
  399. * @brief Get field product_id from autopilot_version message
  400. *
  401. * @return ID of the product
  402. */
  403. static inline uint16_t mavlink_msg_autopilot_version_get_product_id(const mavlink_message_t* msg)
  404. {
  405. return _MAV_RETURN_uint16_t(msg, 34);
  406. }
  407. /**
  408. * @brief Get field uid from autopilot_version message
  409. *
  410. * @return UID if provided by hardware (see uid2)
  411. */
  412. static inline uint64_t mavlink_msg_autopilot_version_get_uid(const mavlink_message_t* msg)
  413. {
  414. return _MAV_RETURN_uint64_t(msg, 8);
  415. }
  416. /**
  417. * @brief Get field uid2 from autopilot_version message
  418. *
  419. * @return UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
  420. */
  421. static inline uint16_t mavlink_msg_autopilot_version_get_uid2(const mavlink_message_t* msg, uint8_t *uid2)
  422. {
  423. return _MAV_RETURN_uint8_t_array(msg, uid2, 18, 60);
  424. }
  425. /**
  426. * @brief Decode a autopilot_version message into a struct
  427. *
  428. * @param msg The message to decode
  429. * @param autopilot_version C-struct to decode the message contents into
  430. */
  431. static inline void mavlink_msg_autopilot_version_decode(const mavlink_message_t* msg, mavlink_autopilot_version_t* autopilot_version)
  432. {
  433. #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
  434. autopilot_version->capabilities = mavlink_msg_autopilot_version_get_capabilities(msg);
  435. autopilot_version->uid = mavlink_msg_autopilot_version_get_uid(msg);
  436. autopilot_version->flight_sw_version = mavlink_msg_autopilot_version_get_flight_sw_version(msg);
  437. autopilot_version->middleware_sw_version = mavlink_msg_autopilot_version_get_middleware_sw_version(msg);
  438. autopilot_version->os_sw_version = mavlink_msg_autopilot_version_get_os_sw_version(msg);
  439. autopilot_version->board_version = mavlink_msg_autopilot_version_get_board_version(msg);
  440. autopilot_version->vendor_id = mavlink_msg_autopilot_version_get_vendor_id(msg);
  441. autopilot_version->product_id = mavlink_msg_autopilot_version_get_product_id(msg);
  442. mavlink_msg_autopilot_version_get_flight_custom_version(msg, autopilot_version->flight_custom_version);
  443. mavlink_msg_autopilot_version_get_middleware_custom_version(msg, autopilot_version->middleware_custom_version);
  444. mavlink_msg_autopilot_version_get_os_custom_version(msg, autopilot_version->os_custom_version);
  445. mavlink_msg_autopilot_version_get_uid2(msg, autopilot_version->uid2);
  446. #else
  447. uint8_t len = msg->len < MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN? msg->len : MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN;
  448. memset(autopilot_version, 0, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
  449. memcpy(autopilot_version, _MAV_PAYLOAD(msg), len);
  450. #endif
  451. }