Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_autopilot_version.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE AUTOPILOT_VERSION PACKING
3
4#define MAVLINK_MSG_ID_AUTOPILOT_VERSION 148
5
6
8 uint64_t capabilities; /*< Bitmap of capabilities*/
9 uint64_t uid; /*< UID if provided by hardware (see uid2)*/
10 uint32_t flight_sw_version; /*< Firmware version number.
11 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
12 */
13 uint32_t middleware_sw_version; /*< Middleware version number*/
14 uint32_t os_sw_version; /*< Operating system version number*/
15 uint32_t board_version; /*< HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt*/
16 uint16_t vendor_id; /*< ID of the board vendor*/
17 uint16_t product_id; /*< ID of the product*/
18 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.*/
19 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.*/
20 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.*/
21 uint8_t uid2[18]; /*< UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)*/
22} mavlink_autopilot_version_t;
23
24#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN 78
25#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN 60
26#define MAVLINK_MSG_ID_148_LEN 78
27#define MAVLINK_MSG_ID_148_MIN_LEN 60
28
29#define MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC 178
30#define MAVLINK_MSG_ID_148_CRC 178
31
32#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_FLIGHT_CUSTOM_VERSION_LEN 8
33#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_MIDDLEWARE_CUSTOM_VERSION_LEN 8
34#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_OS_CUSTOM_VERSION_LEN 8
35#define MAVLINK_MSG_AUTOPILOT_VERSION_FIELD_UID2_LEN 18
36
37#if MAVLINK_COMMAND_24BIT
38#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION {
39 148,
40 "AUTOPILOT_VERSION",
41 12,
42 { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) },
43 { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) },
44 { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) },
45 { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) },
46 { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) },
47 { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) },
48 { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) },
49 { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) },
50 { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) },
51 { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) },
52 { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) },
53 { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) },
54 } \
55}
56#else
57#define MAVLINK_MESSAGE_INFO_AUTOPILOT_VERSION {
58 "AUTOPILOT_VERSION",
59 12,
60 { { "capabilities", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_autopilot_version_t, capabilities) },
61 { "flight_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 16, offsetof(mavlink_autopilot_version_t, flight_sw_version) },
62 { "middleware_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_autopilot_version_t, middleware_sw_version) },
63 { "os_sw_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 24, offsetof(mavlink_autopilot_version_t, os_sw_version) },
64 { "board_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 28, offsetof(mavlink_autopilot_version_t, board_version) },
65 { "flight_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 36, offsetof(mavlink_autopilot_version_t, flight_custom_version) },
66 { "middleware_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 44, offsetof(mavlink_autopilot_version_t, middleware_custom_version) },
67 { "os_custom_version", NULL, MAVLINK_TYPE_UINT8_T, 8, 52, offsetof(mavlink_autopilot_version_t, os_custom_version) },
68 { "vendor_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_autopilot_version_t, vendor_id) },
69 { "product_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 34, offsetof(mavlink_autopilot_version_t, product_id) },
70 { "uid", NULL, MAVLINK_TYPE_UINT64_T, 0, 8, offsetof(mavlink_autopilot_version_t, uid) },
71 { "uid2", NULL, MAVLINK_TYPE_UINT8_T, 18, 60, offsetof(mavlink_autopilot_version_t, uid2) },
72 } \
73}
74#endif
75
76/**
77 * @brief Pack a autopilot_version message
78 * @param system_id ID of this system
79 * @param component_id ID of this component (e.g. 200 for IMU)
80 * @param msg The MAVLink message to compress the data into
81 *
82 * @param capabilities Bitmap of capabilities
83 * @param flight_sw_version Firmware version number.
84 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
85
86 * @param middleware_sw_version Middleware version number
87 * @param os_sw_version Operating system version number
88 * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt
89 * @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.
90 * @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.
91 * @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.
92 * @param vendor_id ID of the board vendor
93 * @param product_id ID of the product
94 * @param uid UID if provided by hardware (see uid2)
95 * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
96 * @return length of the message in bytes (excluding serial stream start sign)
97 */
98static inline uint16_t mavlink_msg_autopilot_version_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
99 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)
100{
101#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
103 _mav_put_uint64_t(buf, 0, capabilities);
104 _mav_put_uint64_t(buf, 8, uid);
105 _mav_put_uint32_t(buf, 16, flight_sw_version);
106 _mav_put_uint32_t(buf, 20, middleware_sw_version);
107 _mav_put_uint32_t(buf, 24, os_sw_version);
108 _mav_put_uint32_t(buf, 28, board_version);
109 _mav_put_uint16_t(buf, 32, vendor_id);
110 _mav_put_uint16_t(buf, 34, product_id);
111 _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
112 _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
113 _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
114 _mav_put_uint8_t_array(buf, 60, uid2, 18);
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
116#else
117 mavlink_autopilot_version_t packet;
118 packet.capabilities = capabilities;
119 packet.uid = uid;
120 packet.flight_sw_version = flight_sw_version;
121 packet.middleware_sw_version = middleware_sw_version;
122 packet.os_sw_version = os_sw_version;
123 packet.board_version = board_version;
124 packet.vendor_id = vendor_id;
125 packet.product_id = product_id;
126 mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
127 mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
128 mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
129 mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
130 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
131#endif
132
135}
136
137/**
138 * @brief Pack a autopilot_version message
139 * @param system_id ID of this system
140 * @param component_id ID of this component (e.g. 200 for IMU)
141 * @param status MAVLink status structure
142 * @param msg The MAVLink message to compress the data into
143 *
144 * @param capabilities Bitmap of capabilities
145 * @param flight_sw_version Firmware version number.
146 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
147
148 * @param middleware_sw_version Middleware version number
149 * @param os_sw_version Operating system version number
150 * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt
151 * @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.
152 * @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.
153 * @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.
154 * @param vendor_id ID of the board vendor
155 * @param product_id ID of the product
156 * @param uid UID if provided by hardware (see uid2)
157 * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
158 * @return length of the message in bytes (excluding serial stream start sign)
159 */
160static inline uint16_t mavlink_msg_autopilot_version_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
161 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)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 _mav_put_uint64_t(buf, 0, capabilities);
166 _mav_put_uint64_t(buf, 8, uid);
167 _mav_put_uint32_t(buf, 16, flight_sw_version);
168 _mav_put_uint32_t(buf, 20, middleware_sw_version);
169 _mav_put_uint32_t(buf, 24, os_sw_version);
170 _mav_put_uint32_t(buf, 28, board_version);
171 _mav_put_uint16_t(buf, 32, vendor_id);
172 _mav_put_uint16_t(buf, 34, product_id);
173 _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
174 _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
175 _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
176 _mav_put_uint8_t_array(buf, 60, uid2, 18);
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
178#else
179 mavlink_autopilot_version_t packet;
180 packet.capabilities = capabilities;
181 packet.uid = uid;
182 packet.flight_sw_version = flight_sw_version;
183 packet.middleware_sw_version = middleware_sw_version;
184 packet.os_sw_version = os_sw_version;
185 packet.board_version = board_version;
186 packet.vendor_id = vendor_id;
187 packet.product_id = product_id;
188 mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
189 mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
190 mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
191 mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
192 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
193#endif
194
196#if MAVLINK_CRC_EXTRA
197 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_CRC);
198#else
199 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
200#endif
201}
202
203/**
204 * @brief Pack a autopilot_version message on a channel
205 * @param system_id ID of this system
206 * @param component_id ID of this component (e.g. 200 for IMU)
207 * @param chan The MAVLink channel this message will be sent over
208 * @param msg The MAVLink message to compress the data into
209 * @param capabilities Bitmap of capabilities
210 * @param flight_sw_version Firmware version number.
211 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
212
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 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt
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 * @return length of the message in bytes (excluding serial stream start sign)
224 */
225static inline uint16_t mavlink_msg_autopilot_version_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
226 mavlink_message_t* msg,
227 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)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
231 _mav_put_uint64_t(buf, 0, capabilities);
232 _mav_put_uint64_t(buf, 8, uid);
233 _mav_put_uint32_t(buf, 16, flight_sw_version);
234 _mav_put_uint32_t(buf, 20, middleware_sw_version);
235 _mav_put_uint32_t(buf, 24, os_sw_version);
236 _mav_put_uint32_t(buf, 28, board_version);
237 _mav_put_uint16_t(buf, 32, vendor_id);
238 _mav_put_uint16_t(buf, 34, product_id);
239 _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
240 _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
241 _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
242 _mav_put_uint8_t_array(buf, 60, uid2, 18);
243 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
244#else
245 mavlink_autopilot_version_t packet;
246 packet.capabilities = capabilities;
247 packet.uid = uid;
248 packet.flight_sw_version = flight_sw_version;
249 packet.middleware_sw_version = middleware_sw_version;
250 packet.os_sw_version = os_sw_version;
251 packet.board_version = board_version;
252 packet.vendor_id = vendor_id;
253 packet.product_id = product_id;
254 mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
255 mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
256 mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
257 mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
258 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
259#endif
260
262 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);
263}
264
265/**
266 * @brief Encode a autopilot_version struct
267 *
268 * @param system_id ID of this system
269 * @param component_id ID of this component (e.g. 200 for IMU)
270 * @param msg The MAVLink message to compress the data into
271 * @param autopilot_version C-struct to read the message contents from
272 */
273static 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)
274{
275 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);
276}
277
278/**
279 * @brief Encode a autopilot_version struct on a channel
280 *
281 * @param system_id ID of this system
282 * @param component_id ID of this component (e.g. 200 for IMU)
283 * @param chan The MAVLink channel this message will be sent over
284 * @param msg The MAVLink message to compress the data into
285 * @param autopilot_version C-struct to read the message contents from
286 */
287static 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)
288{
289 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);
290}
291
292/**
293 * @brief Encode a autopilot_version struct with provided status structure
294 *
295 * @param system_id ID of this system
296 * @param component_id ID of this component (e.g. 200 for IMU)
297 * @param status MAVLink status structure
298 * @param msg The MAVLink message to compress the data into
299 * @param autopilot_version C-struct to read the message contents from
300 */
301static inline uint16_t mavlink_msg_autopilot_version_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_autopilot_version_t* autopilot_version)
302{
303 return mavlink_msg_autopilot_version_pack_status(system_id, component_id, _status, 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);
304}
305
306/**
307 * @brief Send a autopilot_version message
308 * @param chan MAVLink channel to send the message
309 *
310 * @param capabilities Bitmap of capabilities
311 * @param flight_sw_version Firmware version number.
312 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
313
314 * @param middleware_sw_version Middleware version number
315 * @param os_sw_version Operating system version number
316 * @param board_version HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt
317 * @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.
318 * @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.
319 * @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.
320 * @param vendor_id ID of the board vendor
321 * @param product_id ID of the product
322 * @param uid UID if provided by hardware (see uid2)
323 * @param uid2 UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
324 */
325#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
326
327static 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)
328{
329#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
330 char buf[MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN];
331 _mav_put_uint64_t(buf, 0, capabilities);
332 _mav_put_uint64_t(buf, 8, uid);
333 _mav_put_uint32_t(buf, 16, flight_sw_version);
334 _mav_put_uint32_t(buf, 20, middleware_sw_version);
335 _mav_put_uint32_t(buf, 24, os_sw_version);
336 _mav_put_uint32_t(buf, 28, board_version);
337 _mav_put_uint16_t(buf, 32, vendor_id);
338 _mav_put_uint16_t(buf, 34, product_id);
339 _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
340 _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
341 _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
342 _mav_put_uint8_t_array(buf, 60, uid2, 18);
343 _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);
344#else
345 mavlink_autopilot_version_t packet;
346 packet.capabilities = capabilities;
347 packet.uid = uid;
348 packet.flight_sw_version = flight_sw_version;
349 packet.middleware_sw_version = middleware_sw_version;
350 packet.os_sw_version = os_sw_version;
351 packet.board_version = board_version;
352 packet.vendor_id = vendor_id;
353 packet.product_id = product_id;
354 mav_array_memcpy(packet.flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
355 mav_array_memcpy(packet.middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
356 mav_array_memcpy(packet.os_custom_version, os_custom_version, sizeof(uint8_t)*8);
357 mav_array_memcpy(packet.uid2, uid2, sizeof(uint8_t)*18);
358 _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);
359#endif
360}
361
362/**
363 * @brief Send a autopilot_version message
364 * @param chan MAVLink channel to send the message
365 * @param struct The MAVLink struct to serialize
366 */
367static inline void mavlink_msg_autopilot_version_send_struct(mavlink_channel_t chan, const mavlink_autopilot_version_t* autopilot_version)
368{
369#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
370 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);
371#else
372 _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);
373#endif
374}
375
376#if MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
377/*
378 This variant of _send() can be used to save stack space by reusing
379 memory from the receive buffer. The caller provides a
380 mavlink_message_t which is the size of a full mavlink message. This
381 is usually the receive buffer for the channel, and allows a reply to an
382 incoming message with minimum stack space usage.
383 */
384static 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)
385{
386#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
387 char *buf = (char *)msgbuf;
388 _mav_put_uint64_t(buf, 0, capabilities);
389 _mav_put_uint64_t(buf, 8, uid);
390 _mav_put_uint32_t(buf, 16, flight_sw_version);
391 _mav_put_uint32_t(buf, 20, middleware_sw_version);
392 _mav_put_uint32_t(buf, 24, os_sw_version);
393 _mav_put_uint32_t(buf, 28, board_version);
394 _mav_put_uint16_t(buf, 32, vendor_id);
395 _mav_put_uint16_t(buf, 34, product_id);
396 _mav_put_uint8_t_array(buf, 36, flight_custom_version, 8);
397 _mav_put_uint8_t_array(buf, 44, middleware_custom_version, 8);
398 _mav_put_uint8_t_array(buf, 52, os_custom_version, 8);
399 _mav_put_uint8_t_array(buf, 60, uid2, 18);
400 _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);
401#else
402 mavlink_autopilot_version_t *packet = (mavlink_autopilot_version_t *)msgbuf;
403 packet->capabilities = capabilities;
404 packet->uid = uid;
405 packet->flight_sw_version = flight_sw_version;
406 packet->middleware_sw_version = middleware_sw_version;
407 packet->os_sw_version = os_sw_version;
408 packet->board_version = board_version;
409 packet->vendor_id = vendor_id;
410 packet->product_id = product_id;
411 mav_array_memcpy(packet->flight_custom_version, flight_custom_version, sizeof(uint8_t)*8);
412 mav_array_memcpy(packet->middleware_custom_version, middleware_custom_version, sizeof(uint8_t)*8);
413 mav_array_memcpy(packet->os_custom_version, os_custom_version, sizeof(uint8_t)*8);
414 mav_array_memcpy(packet->uid2, uid2, sizeof(uint8_t)*18);
415 _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);
416#endif
417}
418#endif
419
420#endif
421
422// MESSAGE AUTOPILOT_VERSION UNPACKING
423
424
425/**
426 * @brief Get field capabilities from autopilot_version message
427 *
428 * @return Bitmap of capabilities
429 */
430static inline uint64_t mavlink_msg_autopilot_version_get_capabilities(const mavlink_message_t* msg)
431{
432 return _MAV_RETURN_uint64_t(msg, 0);
433}
434
435/**
436 * @brief Get field flight_sw_version from autopilot_version message
437 *
438 * @return Firmware version number.
439 The field must be encoded as 4 bytes, where each byte (shown from MSB to LSB) is part of a semantic version: (major) (minor) (patch) (FIRMWARE_VERSION_TYPE).
440
441 */
442static inline uint32_t mavlink_msg_autopilot_version_get_flight_sw_version(const mavlink_message_t* msg)
443{
444 return _MAV_RETURN_uint32_t(msg, 16);
445}
446
447/**
448 * @brief Get field middleware_sw_version from autopilot_version message
449 *
450 * @return Middleware version number
451 */
452static inline uint32_t mavlink_msg_autopilot_version_get_middleware_sw_version(const mavlink_message_t* msg)
453{
454 return _MAV_RETURN_uint32_t(msg, 20);
455}
456
457/**
458 * @brief Get field os_sw_version from autopilot_version message
459 *
460 * @return Operating system version number
461 */
462static inline uint32_t mavlink_msg_autopilot_version_get_os_sw_version(const mavlink_message_t* msg)
463{
464 return _MAV_RETURN_uint32_t(msg, 24);
465}
466
467/**
468 * @brief Get field board_version from autopilot_version message
469 *
470 * @return HW / board version (last 8 bits should be silicon ID, if any). The first 16 bits of this field specify a board type from an enumeration stored at https://github.com/PX4/PX4-Bootloader/blob/master/board_types.txt and with extensive additions at https://github.com/ArduPilot/ardupilot/blob/master/Tools/AP_Bootloader/board_types.txt
471 */
472static inline uint32_t mavlink_msg_autopilot_version_get_board_version(const mavlink_message_t* msg)
473{
474 return _MAV_RETURN_uint32_t(msg, 28);
475}
476
477/**
478 * @brief Get field flight_custom_version from autopilot_version message
479 *
480 * @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.
481 */
482static inline uint16_t mavlink_msg_autopilot_version_get_flight_custom_version(const mavlink_message_t* msg, uint8_t *flight_custom_version)
483{
484 return _MAV_RETURN_uint8_t_array(msg, flight_custom_version, 8, 36);
485}
486
487/**
488 * @brief Get field middleware_custom_version from autopilot_version message
489 *
490 * @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.
491 */
492static inline uint16_t mavlink_msg_autopilot_version_get_middleware_custom_version(const mavlink_message_t* msg, uint8_t *middleware_custom_version)
493{
494 return _MAV_RETURN_uint8_t_array(msg, middleware_custom_version, 8, 44);
495}
496
497/**
498 * @brief Get field os_custom_version from autopilot_version message
499 *
500 * @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.
501 */
502static inline uint16_t mavlink_msg_autopilot_version_get_os_custom_version(const mavlink_message_t* msg, uint8_t *os_custom_version)
503{
504 return _MAV_RETURN_uint8_t_array(msg, os_custom_version, 8, 52);
505}
506
507/**
508 * @brief Get field vendor_id from autopilot_version message
509 *
510 * @return ID of the board vendor
511 */
512static inline uint16_t mavlink_msg_autopilot_version_get_vendor_id(const mavlink_message_t* msg)
513{
514 return _MAV_RETURN_uint16_t(msg, 32);
515}
516
517/**
518 * @brief Get field product_id from autopilot_version message
519 *
520 * @return ID of the product
521 */
522static inline uint16_t mavlink_msg_autopilot_version_get_product_id(const mavlink_message_t* msg)
523{
524 return _MAV_RETURN_uint16_t(msg, 34);
525}
526
527/**
528 * @brief Get field uid from autopilot_version message
529 *
530 * @return UID if provided by hardware (see uid2)
531 */
532static inline uint64_t mavlink_msg_autopilot_version_get_uid(const mavlink_message_t* msg)
533{
534 return _MAV_RETURN_uint64_t(msg, 8);
535}
536
537/**
538 * @brief Get field uid2 from autopilot_version message
539 *
540 * @return UID if provided by hardware (supersedes the uid field. If this is non-zero, use this field, otherwise use uid)
541 */
542static inline uint16_t mavlink_msg_autopilot_version_get_uid2(const mavlink_message_t* msg, uint8_t *uid2)
543{
544 return _MAV_RETURN_uint8_t_array(msg, uid2, 18, 60);
545}
546
547/**
548 * @brief Decode a autopilot_version message into a struct
549 *
550 * @param msg The message to decode
551 * @param autopilot_version C-struct to decode the message contents into
552 */
553static inline void mavlink_msg_autopilot_version_decode(const mavlink_message_t* msg, mavlink_autopilot_version_t* autopilot_version)
554{
555#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
556 autopilot_version->capabilities = mavlink_msg_autopilot_version_get_capabilities(msg);
557 autopilot_version->uid = mavlink_msg_autopilot_version_get_uid(msg);
558 autopilot_version->flight_sw_version = mavlink_msg_autopilot_version_get_flight_sw_version(msg);
559 autopilot_version->middleware_sw_version = mavlink_msg_autopilot_version_get_middleware_sw_version(msg);
560 autopilot_version->os_sw_version = mavlink_msg_autopilot_version_get_os_sw_version(msg);
561 autopilot_version->board_version = mavlink_msg_autopilot_version_get_board_version(msg);
562 autopilot_version->vendor_id = mavlink_msg_autopilot_version_get_vendor_id(msg);
563 autopilot_version->product_id = mavlink_msg_autopilot_version_get_product_id(msg);
564 mavlink_msg_autopilot_version_get_flight_custom_version(msg, autopilot_version->flight_custom_version);
565 mavlink_msg_autopilot_version_get_middleware_custom_version(msg, autopilot_version->middleware_custom_version);
566 mavlink_msg_autopilot_version_get_os_custom_version(msg, autopilot_version->os_custom_version);
567 mavlink_msg_autopilot_version_get_uid2(msg, autopilot_version->uid2);
568#else
569 uint8_t len = msg->len < MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN? msg->len : MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN;
570 memset(autopilot_version, 0, MAVLINK_MSG_ID_AUTOPILOT_VERSION_LEN);
571 memcpy(autopilot_version, _MAV_PAYLOAD(msg), len);
572#endif
573}