[88] | 1 | // MESSAGE ADSB_VEHICLE PACKING
|
---|
| 2 |
|
---|
| 3 | #define MAVLINK_MSG_ID_ADSB_VEHICLE 246
|
---|
| 4 |
|
---|
| 5 | typedef struct MAVLINK_PACKED __mavlink_adsb_vehicle_t
|
---|
| 6 | {
|
---|
| 7 | uint32_t ICAO_address; /*< ICAO address*/
|
---|
| 8 | int32_t lat; /*< Latitude, expressed as degrees * 1E7*/
|
---|
| 9 | int32_t lon; /*< Longitude, expressed as degrees * 1E7*/
|
---|
| 10 | int32_t altitude; /*< Altitude(ASL) in millimeters*/
|
---|
| 11 | uint16_t heading; /*< Course over ground in centidegrees*/
|
---|
| 12 | uint16_t hor_velocity; /*< The horizontal velocity in centimeters/second*/
|
---|
| 13 | int16_t ver_velocity; /*< The vertical velocity in centimeters/second, positive is up*/
|
---|
| 14 | uint16_t flags; /*< Flags to indicate various statuses including valid data fields*/
|
---|
| 15 | uint16_t squawk; /*< Squawk code*/
|
---|
| 16 | uint8_t altitude_type; /*< Type from ADSB_ALTITUDE_TYPE enum*/
|
---|
| 17 | char callsign[9]; /*< The callsign, 8+null*/
|
---|
| 18 | uint8_t emitter_type; /*< Type from ADSB_EMITTER_TYPE enum*/
|
---|
| 19 | uint8_t tslc; /*< Time since last communication in seconds*/
|
---|
| 20 | } mavlink_adsb_vehicle_t;
|
---|
| 21 |
|
---|
| 22 | #define MAVLINK_MSG_ID_ADSB_VEHICLE_LEN 38
|
---|
| 23 | #define MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN 38
|
---|
| 24 | #define MAVLINK_MSG_ID_246_LEN 38
|
---|
| 25 | #define MAVLINK_MSG_ID_246_MIN_LEN 38
|
---|
| 26 |
|
---|
| 27 | #define MAVLINK_MSG_ID_ADSB_VEHICLE_CRC 184
|
---|
| 28 | #define MAVLINK_MSG_ID_246_CRC 184
|
---|
| 29 |
|
---|
| 30 | #define MAVLINK_MSG_ADSB_VEHICLE_FIELD_CALLSIGN_LEN 9
|
---|
| 31 |
|
---|
| 32 | #if MAVLINK_COMMAND_24BIT
|
---|
| 33 | #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
|
---|
| 34 | 246, \
|
---|
| 35 | "ADSB_VEHICLE", \
|
---|
| 36 | 13, \
|
---|
| 37 | { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
|
---|
| 38 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
|
---|
| 39 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
|
---|
| 40 | { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
|
---|
| 41 | { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
|
---|
| 42 | { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
|
---|
| 43 | { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
|
---|
| 44 | { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
|
---|
| 45 | { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
|
---|
| 46 | { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
|
---|
| 47 | { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
|
---|
| 48 | { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
|
---|
| 49 | { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
|
---|
| 50 | } \
|
---|
| 51 | }
|
---|
| 52 | #else
|
---|
| 53 | #define MAVLINK_MESSAGE_INFO_ADSB_VEHICLE { \
|
---|
| 54 | "ADSB_VEHICLE", \
|
---|
| 55 | 13, \
|
---|
| 56 | { { "ICAO_address", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_adsb_vehicle_t, ICAO_address) }, \
|
---|
| 57 | { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_adsb_vehicle_t, lat) }, \
|
---|
| 58 | { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_adsb_vehicle_t, lon) }, \
|
---|
| 59 | { "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_adsb_vehicle_t, altitude) }, \
|
---|
| 60 | { "heading", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_adsb_vehicle_t, heading) }, \
|
---|
| 61 | { "hor_velocity", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_adsb_vehicle_t, hor_velocity) }, \
|
---|
| 62 | { "ver_velocity", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_adsb_vehicle_t, ver_velocity) }, \
|
---|
| 63 | { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_adsb_vehicle_t, flags) }, \
|
---|
| 64 | { "squawk", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_adsb_vehicle_t, squawk) }, \
|
---|
| 65 | { "altitude_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_adsb_vehicle_t, altitude_type) }, \
|
---|
| 66 | { "callsign", NULL, MAVLINK_TYPE_CHAR, 9, 27, offsetof(mavlink_adsb_vehicle_t, callsign) }, \
|
---|
| 67 | { "emitter_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 36, offsetof(mavlink_adsb_vehicle_t, emitter_type) }, \
|
---|
| 68 | { "tslc", NULL, MAVLINK_TYPE_UINT8_T, 0, 37, offsetof(mavlink_adsb_vehicle_t, tslc) }, \
|
---|
| 69 | } \
|
---|
| 70 | }
|
---|
| 71 | #endif
|
---|
| 72 |
|
---|
| 73 | /**
|
---|
| 74 | * @brief Pack a adsb_vehicle message
|
---|
| 75 | * @param system_id ID of this system
|
---|
| 76 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 77 | * @param msg The MAVLink message to compress the data into
|
---|
| 78 | *
|
---|
| 79 | * @param ICAO_address ICAO address
|
---|
| 80 | * @param lat Latitude, expressed as degrees * 1E7
|
---|
| 81 | * @param lon Longitude, expressed as degrees * 1E7
|
---|
| 82 | * @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
|
---|
| 83 | * @param altitude Altitude(ASL) in millimeters
|
---|
| 84 | * @param heading Course over ground in centidegrees
|
---|
| 85 | * @param hor_velocity The horizontal velocity in centimeters/second
|
---|
| 86 | * @param ver_velocity The vertical velocity in centimeters/second, positive is up
|
---|
| 87 | * @param callsign The callsign, 8+null
|
---|
| 88 | * @param emitter_type Type from ADSB_EMITTER_TYPE enum
|
---|
| 89 | * @param tslc Time since last communication in seconds
|
---|
| 90 | * @param flags Flags to indicate various statuses including valid data fields
|
---|
| 91 | * @param squawk Squawk code
|
---|
| 92 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 93 | */
|
---|
| 94 | static inline uint16_t mavlink_msg_adsb_vehicle_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
---|
| 95 | uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
|
---|
| 96 | {
|
---|
| 97 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 98 | char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
|
---|
| 99 | _mav_put_uint32_t(buf, 0, ICAO_address);
|
---|
| 100 | _mav_put_int32_t(buf, 4, lat);
|
---|
| 101 | _mav_put_int32_t(buf, 8, lon);
|
---|
| 102 | _mav_put_int32_t(buf, 12, altitude);
|
---|
| 103 | _mav_put_uint16_t(buf, 16, heading);
|
---|
| 104 | _mav_put_uint16_t(buf, 18, hor_velocity);
|
---|
| 105 | _mav_put_int16_t(buf, 20, ver_velocity);
|
---|
| 106 | _mav_put_uint16_t(buf, 22, flags);
|
---|
| 107 | _mav_put_uint16_t(buf, 24, squawk);
|
---|
| 108 | _mav_put_uint8_t(buf, 26, altitude_type);
|
---|
| 109 | _mav_put_uint8_t(buf, 36, emitter_type);
|
---|
| 110 | _mav_put_uint8_t(buf, 37, tslc);
|
---|
| 111 | _mav_put_char_array(buf, 27, callsign, 9);
|
---|
| 112 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
|
---|
| 113 | #else
|
---|
| 114 | mavlink_adsb_vehicle_t packet;
|
---|
| 115 | packet.ICAO_address = ICAO_address;
|
---|
| 116 | packet.lat = lat;
|
---|
| 117 | packet.lon = lon;
|
---|
| 118 | packet.altitude = altitude;
|
---|
| 119 | packet.heading = heading;
|
---|
| 120 | packet.hor_velocity = hor_velocity;
|
---|
| 121 | packet.ver_velocity = ver_velocity;
|
---|
| 122 | packet.flags = flags;
|
---|
| 123 | packet.squawk = squawk;
|
---|
| 124 | packet.altitude_type = altitude_type;
|
---|
| 125 | packet.emitter_type = emitter_type;
|
---|
| 126 | packet.tslc = tslc;
|
---|
| 127 | mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
|
---|
| 128 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
|
---|
| 129 | #endif
|
---|
| 130 |
|
---|
| 131 | msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
|
---|
| 132 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | /**
|
---|
| 136 | * @brief Pack a adsb_vehicle message on a channel
|
---|
| 137 | * @param system_id ID of this system
|
---|
| 138 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 139 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 140 | * @param msg The MAVLink message to compress the data into
|
---|
| 141 | * @param ICAO_address ICAO address
|
---|
| 142 | * @param lat Latitude, expressed as degrees * 1E7
|
---|
| 143 | * @param lon Longitude, expressed as degrees * 1E7
|
---|
| 144 | * @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
|
---|
| 145 | * @param altitude Altitude(ASL) in millimeters
|
---|
| 146 | * @param heading Course over ground in centidegrees
|
---|
| 147 | * @param hor_velocity The horizontal velocity in centimeters/second
|
---|
| 148 | * @param ver_velocity The vertical velocity in centimeters/second, positive is up
|
---|
| 149 | * @param callsign The callsign, 8+null
|
---|
| 150 | * @param emitter_type Type from ADSB_EMITTER_TYPE enum
|
---|
| 151 | * @param tslc Time since last communication in seconds
|
---|
| 152 | * @param flags Flags to indicate various statuses including valid data fields
|
---|
| 153 | * @param squawk Squawk code
|
---|
| 154 | * @return length of the message in bytes (excluding serial stream start sign)
|
---|
| 155 | */
|
---|
| 156 | static inline uint16_t mavlink_msg_adsb_vehicle_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
---|
| 157 | mavlink_message_t* msg,
|
---|
| 158 | uint32_t ICAO_address,int32_t lat,int32_t lon,uint8_t altitude_type,int32_t altitude,uint16_t heading,uint16_t hor_velocity,int16_t ver_velocity,const char *callsign,uint8_t emitter_type,uint8_t tslc,uint16_t flags,uint16_t squawk)
|
---|
| 159 | {
|
---|
| 160 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 161 | char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
|
---|
| 162 | _mav_put_uint32_t(buf, 0, ICAO_address);
|
---|
| 163 | _mav_put_int32_t(buf, 4, lat);
|
---|
| 164 | _mav_put_int32_t(buf, 8, lon);
|
---|
| 165 | _mav_put_int32_t(buf, 12, altitude);
|
---|
| 166 | _mav_put_uint16_t(buf, 16, heading);
|
---|
| 167 | _mav_put_uint16_t(buf, 18, hor_velocity);
|
---|
| 168 | _mav_put_int16_t(buf, 20, ver_velocity);
|
---|
| 169 | _mav_put_uint16_t(buf, 22, flags);
|
---|
| 170 | _mav_put_uint16_t(buf, 24, squawk);
|
---|
| 171 | _mav_put_uint8_t(buf, 26, altitude_type);
|
---|
| 172 | _mav_put_uint8_t(buf, 36, emitter_type);
|
---|
| 173 | _mav_put_uint8_t(buf, 37, tslc);
|
---|
| 174 | _mav_put_char_array(buf, 27, callsign, 9);
|
---|
| 175 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
|
---|
| 176 | #else
|
---|
| 177 | mavlink_adsb_vehicle_t packet;
|
---|
| 178 | packet.ICAO_address = ICAO_address;
|
---|
| 179 | packet.lat = lat;
|
---|
| 180 | packet.lon = lon;
|
---|
| 181 | packet.altitude = altitude;
|
---|
| 182 | packet.heading = heading;
|
---|
| 183 | packet.hor_velocity = hor_velocity;
|
---|
| 184 | packet.ver_velocity = ver_velocity;
|
---|
| 185 | packet.flags = flags;
|
---|
| 186 | packet.squawk = squawk;
|
---|
| 187 | packet.altitude_type = altitude_type;
|
---|
| 188 | packet.emitter_type = emitter_type;
|
---|
| 189 | packet.tslc = tslc;
|
---|
| 190 | mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
|
---|
| 191 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
|
---|
| 192 | #endif
|
---|
| 193 |
|
---|
| 194 | msg->msgid = MAVLINK_MSG_ID_ADSB_VEHICLE;
|
---|
| 195 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 | /**
|
---|
| 199 | * @brief Encode a adsb_vehicle struct
|
---|
| 200 | *
|
---|
| 201 | * @param system_id ID of this system
|
---|
| 202 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 203 | * @param msg The MAVLink message to compress the data into
|
---|
| 204 | * @param adsb_vehicle C-struct to read the message contents from
|
---|
| 205 | */
|
---|
| 206 | static inline uint16_t mavlink_msg_adsb_vehicle_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
|
---|
| 207 | {
|
---|
| 208 | return mavlink_msg_adsb_vehicle_pack(system_id, component_id, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | /**
|
---|
| 212 | * @brief Encode a adsb_vehicle struct on a channel
|
---|
| 213 | *
|
---|
| 214 | * @param system_id ID of this system
|
---|
| 215 | * @param component_id ID of this component (e.g. 200 for IMU)
|
---|
| 216 | * @param chan The MAVLink channel this message will be sent over
|
---|
| 217 | * @param msg The MAVLink message to compress the data into
|
---|
| 218 | * @param adsb_vehicle C-struct to read the message contents from
|
---|
| 219 | */
|
---|
| 220 | static inline uint16_t mavlink_msg_adsb_vehicle_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_adsb_vehicle_t* adsb_vehicle)
|
---|
| 221 | {
|
---|
| 222 | return mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, chan, msg, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | /**
|
---|
| 226 | * @brief Send a adsb_vehicle message
|
---|
| 227 | * @param chan MAVLink channel to send the message
|
---|
| 228 | *
|
---|
| 229 | * @param ICAO_address ICAO address
|
---|
| 230 | * @param lat Latitude, expressed as degrees * 1E7
|
---|
| 231 | * @param lon Longitude, expressed as degrees * 1E7
|
---|
| 232 | * @param altitude_type Type from ADSB_ALTITUDE_TYPE enum
|
---|
| 233 | * @param altitude Altitude(ASL) in millimeters
|
---|
| 234 | * @param heading Course over ground in centidegrees
|
---|
| 235 | * @param hor_velocity The horizontal velocity in centimeters/second
|
---|
| 236 | * @param ver_velocity The vertical velocity in centimeters/second, positive is up
|
---|
| 237 | * @param callsign The callsign, 8+null
|
---|
| 238 | * @param emitter_type Type from ADSB_EMITTER_TYPE enum
|
---|
| 239 | * @param tslc Time since last communication in seconds
|
---|
| 240 | * @param flags Flags to indicate various statuses including valid data fields
|
---|
| 241 | * @param squawk Squawk code
|
---|
| 242 | */
|
---|
| 243 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
---|
| 244 |
|
---|
| 245 | static inline void mavlink_msg_adsb_vehicle_send(mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
|
---|
| 246 | {
|
---|
| 247 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 248 | char buf[MAVLINK_MSG_ID_ADSB_VEHICLE_LEN];
|
---|
| 249 | _mav_put_uint32_t(buf, 0, ICAO_address);
|
---|
| 250 | _mav_put_int32_t(buf, 4, lat);
|
---|
| 251 | _mav_put_int32_t(buf, 8, lon);
|
---|
| 252 | _mav_put_int32_t(buf, 12, altitude);
|
---|
| 253 | _mav_put_uint16_t(buf, 16, heading);
|
---|
| 254 | _mav_put_uint16_t(buf, 18, hor_velocity);
|
---|
| 255 | _mav_put_int16_t(buf, 20, ver_velocity);
|
---|
| 256 | _mav_put_uint16_t(buf, 22, flags);
|
---|
| 257 | _mav_put_uint16_t(buf, 24, squawk);
|
---|
| 258 | _mav_put_uint8_t(buf, 26, altitude_type);
|
---|
| 259 | _mav_put_uint8_t(buf, 36, emitter_type);
|
---|
| 260 | _mav_put_uint8_t(buf, 37, tslc);
|
---|
| 261 | _mav_put_char_array(buf, 27, callsign, 9);
|
---|
| 262 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 263 | #else
|
---|
| 264 | mavlink_adsb_vehicle_t packet;
|
---|
| 265 | packet.ICAO_address = ICAO_address;
|
---|
| 266 | packet.lat = lat;
|
---|
| 267 | packet.lon = lon;
|
---|
| 268 | packet.altitude = altitude;
|
---|
| 269 | packet.heading = heading;
|
---|
| 270 | packet.hor_velocity = hor_velocity;
|
---|
| 271 | packet.ver_velocity = ver_velocity;
|
---|
| 272 | packet.flags = flags;
|
---|
| 273 | packet.squawk = squawk;
|
---|
| 274 | packet.altitude_type = altitude_type;
|
---|
| 275 | packet.emitter_type = emitter_type;
|
---|
| 276 | packet.tslc = tslc;
|
---|
| 277 | mav_array_memcpy(packet.callsign, callsign, sizeof(char)*9);
|
---|
| 278 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)&packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 279 | #endif
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | /**
|
---|
| 283 | * @brief Send a adsb_vehicle message
|
---|
| 284 | * @param chan MAVLink channel to send the message
|
---|
| 285 | * @param struct The MAVLink struct to serialize
|
---|
| 286 | */
|
---|
| 287 | static inline void mavlink_msg_adsb_vehicle_send_struct(mavlink_channel_t chan, const mavlink_adsb_vehicle_t* adsb_vehicle)
|
---|
| 288 | {
|
---|
| 289 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 290 | mavlink_msg_adsb_vehicle_send(chan, adsb_vehicle->ICAO_address, adsb_vehicle->lat, adsb_vehicle->lon, adsb_vehicle->altitude_type, adsb_vehicle->altitude, adsb_vehicle->heading, adsb_vehicle->hor_velocity, adsb_vehicle->ver_velocity, adsb_vehicle->callsign, adsb_vehicle->emitter_type, adsb_vehicle->tslc, adsb_vehicle->flags, adsb_vehicle->squawk);
|
---|
| 291 | #else
|
---|
| 292 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)adsb_vehicle, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 293 | #endif
|
---|
| 294 | }
|
---|
| 295 |
|
---|
| 296 | #if MAVLINK_MSG_ID_ADSB_VEHICLE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
|
---|
| 297 | /*
|
---|
| 298 | This varient of _send() can be used to save stack space by re-using
|
---|
| 299 | memory from the receive buffer. The caller provides a
|
---|
| 300 | mavlink_message_t which is the size of a full mavlink message. This
|
---|
| 301 | is usually the receive buffer for the channel, and allows a reply to an
|
---|
| 302 | incoming message with minimum stack space usage.
|
---|
| 303 | */
|
---|
| 304 | static inline void mavlink_msg_adsb_vehicle_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t ICAO_address, int32_t lat, int32_t lon, uint8_t altitude_type, int32_t altitude, uint16_t heading, uint16_t hor_velocity, int16_t ver_velocity, const char *callsign, uint8_t emitter_type, uint8_t tslc, uint16_t flags, uint16_t squawk)
|
---|
| 305 | {
|
---|
| 306 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 307 | char *buf = (char *)msgbuf;
|
---|
| 308 | _mav_put_uint32_t(buf, 0, ICAO_address);
|
---|
| 309 | _mav_put_int32_t(buf, 4, lat);
|
---|
| 310 | _mav_put_int32_t(buf, 8, lon);
|
---|
| 311 | _mav_put_int32_t(buf, 12, altitude);
|
---|
| 312 | _mav_put_uint16_t(buf, 16, heading);
|
---|
| 313 | _mav_put_uint16_t(buf, 18, hor_velocity);
|
---|
| 314 | _mav_put_int16_t(buf, 20, ver_velocity);
|
---|
| 315 | _mav_put_uint16_t(buf, 22, flags);
|
---|
| 316 | _mav_put_uint16_t(buf, 24, squawk);
|
---|
| 317 | _mav_put_uint8_t(buf, 26, altitude_type);
|
---|
| 318 | _mav_put_uint8_t(buf, 36, emitter_type);
|
---|
| 319 | _mav_put_uint8_t(buf, 37, tslc);
|
---|
| 320 | _mav_put_char_array(buf, 27, callsign, 9);
|
---|
| 321 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, buf, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 322 | #else
|
---|
| 323 | mavlink_adsb_vehicle_t *packet = (mavlink_adsb_vehicle_t *)msgbuf;
|
---|
| 324 | packet->ICAO_address = ICAO_address;
|
---|
| 325 | packet->lat = lat;
|
---|
| 326 | packet->lon = lon;
|
---|
| 327 | packet->altitude = altitude;
|
---|
| 328 | packet->heading = heading;
|
---|
| 329 | packet->hor_velocity = hor_velocity;
|
---|
| 330 | packet->ver_velocity = ver_velocity;
|
---|
| 331 | packet->flags = flags;
|
---|
| 332 | packet->squawk = squawk;
|
---|
| 333 | packet->altitude_type = altitude_type;
|
---|
| 334 | packet->emitter_type = emitter_type;
|
---|
| 335 | packet->tslc = tslc;
|
---|
| 336 | mav_array_memcpy(packet->callsign, callsign, sizeof(char)*9);
|
---|
| 337 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ADSB_VEHICLE, (const char *)packet, MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN, MAVLINK_MSG_ID_ADSB_VEHICLE_CRC);
|
---|
| 338 | #endif
|
---|
| 339 | }
|
---|
| 340 | #endif
|
---|
| 341 |
|
---|
| 342 | #endif
|
---|
| 343 |
|
---|
| 344 | // MESSAGE ADSB_VEHICLE UNPACKING
|
---|
| 345 |
|
---|
| 346 |
|
---|
| 347 | /**
|
---|
| 348 | * @brief Get field ICAO_address from adsb_vehicle message
|
---|
| 349 | *
|
---|
| 350 | * @return ICAO address
|
---|
| 351 | */
|
---|
| 352 | static inline uint32_t mavlink_msg_adsb_vehicle_get_ICAO_address(const mavlink_message_t* msg)
|
---|
| 353 | {
|
---|
| 354 | return _MAV_RETURN_uint32_t(msg, 0);
|
---|
| 355 | }
|
---|
| 356 |
|
---|
| 357 | /**
|
---|
| 358 | * @brief Get field lat from adsb_vehicle message
|
---|
| 359 | *
|
---|
| 360 | * @return Latitude, expressed as degrees * 1E7
|
---|
| 361 | */
|
---|
| 362 | static inline int32_t mavlink_msg_adsb_vehicle_get_lat(const mavlink_message_t* msg)
|
---|
| 363 | {
|
---|
| 364 | return _MAV_RETURN_int32_t(msg, 4);
|
---|
| 365 | }
|
---|
| 366 |
|
---|
| 367 | /**
|
---|
| 368 | * @brief Get field lon from adsb_vehicle message
|
---|
| 369 | *
|
---|
| 370 | * @return Longitude, expressed as degrees * 1E7
|
---|
| 371 | */
|
---|
| 372 | static inline int32_t mavlink_msg_adsb_vehicle_get_lon(const mavlink_message_t* msg)
|
---|
| 373 | {
|
---|
| 374 | return _MAV_RETURN_int32_t(msg, 8);
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 | /**
|
---|
| 378 | * @brief Get field altitude_type from adsb_vehicle message
|
---|
| 379 | *
|
---|
| 380 | * @return Type from ADSB_ALTITUDE_TYPE enum
|
---|
| 381 | */
|
---|
| 382 | static inline uint8_t mavlink_msg_adsb_vehicle_get_altitude_type(const mavlink_message_t* msg)
|
---|
| 383 | {
|
---|
| 384 | return _MAV_RETURN_uint8_t(msg, 26);
|
---|
| 385 | }
|
---|
| 386 |
|
---|
| 387 | /**
|
---|
| 388 | * @brief Get field altitude from adsb_vehicle message
|
---|
| 389 | *
|
---|
| 390 | * @return Altitude(ASL) in millimeters
|
---|
| 391 | */
|
---|
| 392 | static inline int32_t mavlink_msg_adsb_vehicle_get_altitude(const mavlink_message_t* msg)
|
---|
| 393 | {
|
---|
| 394 | return _MAV_RETURN_int32_t(msg, 12);
|
---|
| 395 | }
|
---|
| 396 |
|
---|
| 397 | /**
|
---|
| 398 | * @brief Get field heading from adsb_vehicle message
|
---|
| 399 | *
|
---|
| 400 | * @return Course over ground in centidegrees
|
---|
| 401 | */
|
---|
| 402 | static inline uint16_t mavlink_msg_adsb_vehicle_get_heading(const mavlink_message_t* msg)
|
---|
| 403 | {
|
---|
| 404 | return _MAV_RETURN_uint16_t(msg, 16);
|
---|
| 405 | }
|
---|
| 406 |
|
---|
| 407 | /**
|
---|
| 408 | * @brief Get field hor_velocity from adsb_vehicle message
|
---|
| 409 | *
|
---|
| 410 | * @return The horizontal velocity in centimeters/second
|
---|
| 411 | */
|
---|
| 412 | static inline uint16_t mavlink_msg_adsb_vehicle_get_hor_velocity(const mavlink_message_t* msg)
|
---|
| 413 | {
|
---|
| 414 | return _MAV_RETURN_uint16_t(msg, 18);
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | /**
|
---|
| 418 | * @brief Get field ver_velocity from adsb_vehicle message
|
---|
| 419 | *
|
---|
| 420 | * @return The vertical velocity in centimeters/second, positive is up
|
---|
| 421 | */
|
---|
| 422 | static inline int16_t mavlink_msg_adsb_vehicle_get_ver_velocity(const mavlink_message_t* msg)
|
---|
| 423 | {
|
---|
| 424 | return _MAV_RETURN_int16_t(msg, 20);
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | /**
|
---|
| 428 | * @brief Get field callsign from adsb_vehicle message
|
---|
| 429 | *
|
---|
| 430 | * @return The callsign, 8+null
|
---|
| 431 | */
|
---|
| 432 | static inline uint16_t mavlink_msg_adsb_vehicle_get_callsign(const mavlink_message_t* msg, char *callsign)
|
---|
| 433 | {
|
---|
| 434 | return _MAV_RETURN_char_array(msg, callsign, 9, 27);
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 | /**
|
---|
| 438 | * @brief Get field emitter_type from adsb_vehicle message
|
---|
| 439 | *
|
---|
| 440 | * @return Type from ADSB_EMITTER_TYPE enum
|
---|
| 441 | */
|
---|
| 442 | static inline uint8_t mavlink_msg_adsb_vehicle_get_emitter_type(const mavlink_message_t* msg)
|
---|
| 443 | {
|
---|
| 444 | return _MAV_RETURN_uint8_t(msg, 36);
|
---|
| 445 | }
|
---|
| 446 |
|
---|
| 447 | /**
|
---|
| 448 | * @brief Get field tslc from adsb_vehicle message
|
---|
| 449 | *
|
---|
| 450 | * @return Time since last communication in seconds
|
---|
| 451 | */
|
---|
| 452 | static inline uint8_t mavlink_msg_adsb_vehicle_get_tslc(const mavlink_message_t* msg)
|
---|
| 453 | {
|
---|
| 454 | return _MAV_RETURN_uint8_t(msg, 37);
|
---|
| 455 | }
|
---|
| 456 |
|
---|
| 457 | /**
|
---|
| 458 | * @brief Get field flags from adsb_vehicle message
|
---|
| 459 | *
|
---|
| 460 | * @return Flags to indicate various statuses including valid data fields
|
---|
| 461 | */
|
---|
| 462 | static inline uint16_t mavlink_msg_adsb_vehicle_get_flags(const mavlink_message_t* msg)
|
---|
| 463 | {
|
---|
| 464 | return _MAV_RETURN_uint16_t(msg, 22);
|
---|
| 465 | }
|
---|
| 466 |
|
---|
| 467 | /**
|
---|
| 468 | * @brief Get field squawk from adsb_vehicle message
|
---|
| 469 | *
|
---|
| 470 | * @return Squawk code
|
---|
| 471 | */
|
---|
| 472 | static inline uint16_t mavlink_msg_adsb_vehicle_get_squawk(const mavlink_message_t* msg)
|
---|
| 473 | {
|
---|
| 474 | return _MAV_RETURN_uint16_t(msg, 24);
|
---|
| 475 | }
|
---|
| 476 |
|
---|
| 477 | /**
|
---|
| 478 | * @brief Decode a adsb_vehicle message into a struct
|
---|
| 479 | *
|
---|
| 480 | * @param msg The message to decode
|
---|
| 481 | * @param adsb_vehicle C-struct to decode the message contents into
|
---|
| 482 | */
|
---|
| 483 | static inline void mavlink_msg_adsb_vehicle_decode(const mavlink_message_t* msg, mavlink_adsb_vehicle_t* adsb_vehicle)
|
---|
| 484 | {
|
---|
| 485 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
---|
| 486 | adsb_vehicle->ICAO_address = mavlink_msg_adsb_vehicle_get_ICAO_address(msg);
|
---|
| 487 | adsb_vehicle->lat = mavlink_msg_adsb_vehicle_get_lat(msg);
|
---|
| 488 | adsb_vehicle->lon = mavlink_msg_adsb_vehicle_get_lon(msg);
|
---|
| 489 | adsb_vehicle->altitude = mavlink_msg_adsb_vehicle_get_altitude(msg);
|
---|
| 490 | adsb_vehicle->heading = mavlink_msg_adsb_vehicle_get_heading(msg);
|
---|
| 491 | adsb_vehicle->hor_velocity = mavlink_msg_adsb_vehicle_get_hor_velocity(msg);
|
---|
| 492 | adsb_vehicle->ver_velocity = mavlink_msg_adsb_vehicle_get_ver_velocity(msg);
|
---|
| 493 | adsb_vehicle->flags = mavlink_msg_adsb_vehicle_get_flags(msg);
|
---|
| 494 | adsb_vehicle->squawk = mavlink_msg_adsb_vehicle_get_squawk(msg);
|
---|
| 495 | adsb_vehicle->altitude_type = mavlink_msg_adsb_vehicle_get_altitude_type(msg);
|
---|
| 496 | mavlink_msg_adsb_vehicle_get_callsign(msg, adsb_vehicle->callsign);
|
---|
| 497 | adsb_vehicle->emitter_type = mavlink_msg_adsb_vehicle_get_emitter_type(msg);
|
---|
| 498 | adsb_vehicle->tslc = mavlink_msg_adsb_vehicle_get_tslc(msg);
|
---|
| 499 | #else
|
---|
| 500 | uint8_t len = msg->len < MAVLINK_MSG_ID_ADSB_VEHICLE_LEN? msg->len : MAVLINK_MSG_ID_ADSB_VEHICLE_LEN;
|
---|
| 501 | memset(adsb_vehicle, 0, MAVLINK_MSG_ID_ADSB_VEHICLE_LEN);
|
---|
| 502 | memcpy(adsb_vehicle, _MAV_PAYLOAD(msg), len);
|
---|
| 503 | #endif
|
---|
| 504 | }
|
---|