pinxian wu / mavlink_bridge

Dependents:   mavlink F429ZI_LCD_demo

Fork of mavlink_bridge by Benjamin Hepp

Committer:
bhepp
Date:
Tue Nov 24 16:41:11 2015 +0000
Revision:
0:28183cc7963f
Mavlink bridge for Mbed

Who changed what in which revision?

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