2 // MESSAGE DATA_TRANSMISSION_HANDSHAKE PACKING
4 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE 130
7 typedef struct __mavlink_data_transmission_handshake_t
{
8 uint32_t size
; /*< [bytes] total data size (set on ACK only).*/
9 uint16_t width
; /*< Width of a matrix or image.*/
10 uint16_t height
; /*< Height of a matrix or image.*/
11 uint16_t packets
; /*< Number of packets being sent (set on ACK only).*/
12 uint8_t type
; /*< Type of requested/acknowledged data.*/
13 uint8_t payload
; /*< [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only).*/
14 uint8_t jpg_quality
; /*< [%] JPEG quality. Values: [1-100].*/
15 } mavlink_data_transmission_handshake_t
;
17 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN 13
18 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN 13
19 #define MAVLINK_MSG_ID_130_LEN 13
20 #define MAVLINK_MSG_ID_130_MIN_LEN 13
22 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC 29
23 #define MAVLINK_MSG_ID_130_CRC 29
27 #if MAVLINK_COMMAND_24BIT
28 #define MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE { \
30 "DATA_TRANSMISSION_HANDSHAKE", \
32 { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_data_transmission_handshake_t, type) }, \
33 { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_data_transmission_handshake_t, size) }, \
34 { "width", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_data_transmission_handshake_t, width) }, \
35 { "height", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_data_transmission_handshake_t, height) }, \
36 { "packets", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_data_transmission_handshake_t, packets) }, \
37 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_data_transmission_handshake_t, payload) }, \
38 { "jpg_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_data_transmission_handshake_t, jpg_quality) }, \
42 #define MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE { \
43 "DATA_TRANSMISSION_HANDSHAKE", \
45 { { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_data_transmission_handshake_t, type) }, \
46 { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_data_transmission_handshake_t, size) }, \
47 { "width", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_data_transmission_handshake_t, width) }, \
48 { "height", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_data_transmission_handshake_t, height) }, \
49 { "packets", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_data_transmission_handshake_t, packets) }, \
50 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_data_transmission_handshake_t, payload) }, \
51 { "jpg_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_data_transmission_handshake_t, jpg_quality) }, \
57 * @brief Pack a data_transmission_handshake message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
62 * @param type Type of requested/acknowledged data.
63 * @param size [bytes] total data size (set on ACK only).
64 * @param width Width of a matrix or image.
65 * @param height Height of a matrix or image.
66 * @param packets Number of packets being sent (set on ACK only).
67 * @param payload [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only).
68 * @param jpg_quality [%] JPEG quality. Values: [1-100].
69 * @return length of the message in bytes (excluding serial stream start sign)
71 static inline uint16_t mavlink_msg_data_transmission_handshake_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
72 uint8_t type
, uint32_t size
, uint16_t width
, uint16_t height
, uint16_t packets
, uint8_t payload
, uint8_t jpg_quality
)
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf
[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
];
76 _mav_put_uint32_t(buf
, 0, size
);
77 _mav_put_uint16_t(buf
, 4, width
);
78 _mav_put_uint16_t(buf
, 6, height
);
79 _mav_put_uint16_t(buf
, 8, packets
);
80 _mav_put_uint8_t(buf
, 10, type
);
81 _mav_put_uint8_t(buf
, 11, payload
);
82 _mav_put_uint8_t(buf
, 12, jpg_quality
);
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
);
86 mavlink_data_transmission_handshake_t packet
;
89 packet
.height
= height
;
90 packet
.packets
= packets
;
92 packet
.payload
= payload
;
93 packet
.jpg_quality
= jpg_quality
;
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
);
98 msg
->msgid
= MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
;
99 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
103 * @brief Pack a data_transmission_handshake message on a channel
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param chan The MAVLink channel this message will be sent over
107 * @param msg The MAVLink message to compress the data into
108 * @param type Type of requested/acknowledged data.
109 * @param size [bytes] total data size (set on ACK only).
110 * @param width Width of a matrix or image.
111 * @param height Height of a matrix or image.
112 * @param packets Number of packets being sent (set on ACK only).
113 * @param payload [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only).
114 * @param jpg_quality [%] JPEG quality. Values: [1-100].
115 * @return length of the message in bytes (excluding serial stream start sign)
117 static inline uint16_t mavlink_msg_data_transmission_handshake_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
118 mavlink_message_t
* msg
,
119 uint8_t type
,uint32_t size
,uint16_t width
,uint16_t height
,uint16_t packets
,uint8_t payload
,uint8_t jpg_quality
)
121 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf
[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
];
123 _mav_put_uint32_t(buf
, 0, size
);
124 _mav_put_uint16_t(buf
, 4, width
);
125 _mav_put_uint16_t(buf
, 6, height
);
126 _mav_put_uint16_t(buf
, 8, packets
);
127 _mav_put_uint8_t(buf
, 10, type
);
128 _mav_put_uint8_t(buf
, 11, payload
);
129 _mav_put_uint8_t(buf
, 12, jpg_quality
);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
);
133 mavlink_data_transmission_handshake_t packet
;
135 packet
.width
= width
;
136 packet
.height
= height
;
137 packet
.packets
= packets
;
139 packet
.payload
= payload
;
140 packet
.jpg_quality
= jpg_quality
;
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
);
145 msg
->msgid
= MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
;
146 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
150 * @brief Encode a data_transmission_handshake struct
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param msg The MAVLink message to compress the data into
155 * @param data_transmission_handshake C-struct to read the message contents from
157 static inline uint16_t mavlink_msg_data_transmission_handshake_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_data_transmission_handshake_t
* data_transmission_handshake
)
159 return mavlink_msg_data_transmission_handshake_pack(system_id
, component_id
, msg
, data_transmission_handshake
->type
, data_transmission_handshake
->size
, data_transmission_handshake
->width
, data_transmission_handshake
->height
, data_transmission_handshake
->packets
, data_transmission_handshake
->payload
, data_transmission_handshake
->jpg_quality
);
163 * @brief Encode a data_transmission_handshake struct on a channel
165 * @param system_id ID of this system
166 * @param component_id ID of this component (e.g. 200 for IMU)
167 * @param chan The MAVLink channel this message will be sent over
168 * @param msg The MAVLink message to compress the data into
169 * @param data_transmission_handshake C-struct to read the message contents from
171 static inline uint16_t mavlink_msg_data_transmission_handshake_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_data_transmission_handshake_t
* data_transmission_handshake
)
173 return mavlink_msg_data_transmission_handshake_pack_chan(system_id
, component_id
, chan
, msg
, data_transmission_handshake
->type
, data_transmission_handshake
->size
, data_transmission_handshake
->width
, data_transmission_handshake
->height
, data_transmission_handshake
->packets
, data_transmission_handshake
->payload
, data_transmission_handshake
->jpg_quality
);
177 * @brief Send a data_transmission_handshake message
178 * @param chan MAVLink channel to send the message
180 * @param type Type of requested/acknowledged data.
181 * @param size [bytes] total data size (set on ACK only).
182 * @param width Width of a matrix or image.
183 * @param height Height of a matrix or image.
184 * @param packets Number of packets being sent (set on ACK only).
185 * @param payload [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only).
186 * @param jpg_quality [%] JPEG quality. Values: [1-100].
188 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
190 static inline void mavlink_msg_data_transmission_handshake_send(mavlink_channel_t chan
, uint8_t type
, uint32_t size
, uint16_t width
, uint16_t height
, uint16_t packets
, uint8_t payload
, uint8_t jpg_quality
)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf
[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
];
194 _mav_put_uint32_t(buf
, 0, size
);
195 _mav_put_uint16_t(buf
, 4, width
);
196 _mav_put_uint16_t(buf
, 6, height
);
197 _mav_put_uint16_t(buf
, 8, packets
);
198 _mav_put_uint8_t(buf
, 10, type
);
199 _mav_put_uint8_t(buf
, 11, payload
);
200 _mav_put_uint8_t(buf
, 12, jpg_quality
);
202 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
, buf
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
204 mavlink_data_transmission_handshake_t packet
;
206 packet
.width
= width
;
207 packet
.height
= height
;
208 packet
.packets
= packets
;
210 packet
.payload
= payload
;
211 packet
.jpg_quality
= jpg_quality
;
213 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
, (const char *)&packet
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
218 * @brief Send a data_transmission_handshake message
219 * @param chan MAVLink channel to send the message
220 * @param struct The MAVLink struct to serialize
222 static inline void mavlink_msg_data_transmission_handshake_send_struct(mavlink_channel_t chan
, const mavlink_data_transmission_handshake_t
* data_transmission_handshake
)
224 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 mavlink_msg_data_transmission_handshake_send(chan
, data_transmission_handshake
->type
, data_transmission_handshake
->size
, data_transmission_handshake
->width
, data_transmission_handshake
->height
, data_transmission_handshake
->packets
, data_transmission_handshake
->payload
, data_transmission_handshake
->jpg_quality
);
227 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
, (const char *)data_transmission_handshake
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
231 #if MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
239 static inline void mavlink_msg_data_transmission_handshake_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint8_t type
, uint32_t size
, uint16_t width
, uint16_t height
, uint16_t packets
, uint8_t payload
, uint8_t jpg_quality
)
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf
= (char *)msgbuf
;
243 _mav_put_uint32_t(buf
, 0, size
);
244 _mav_put_uint16_t(buf
, 4, width
);
245 _mav_put_uint16_t(buf
, 6, height
);
246 _mav_put_uint16_t(buf
, 8, packets
);
247 _mav_put_uint8_t(buf
, 10, type
);
248 _mav_put_uint8_t(buf
, 11, payload
);
249 _mav_put_uint8_t(buf
, 12, jpg_quality
);
251 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
, buf
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
253 mavlink_data_transmission_handshake_t
*packet
= (mavlink_data_transmission_handshake_t
*)msgbuf
;
255 packet
->width
= width
;
256 packet
->height
= height
;
257 packet
->packets
= packets
;
259 packet
->payload
= payload
;
260 packet
->jpg_quality
= jpg_quality
;
262 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE
, (const char *)packet
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC
);
269 // MESSAGE DATA_TRANSMISSION_HANDSHAKE UNPACKING
273 * @brief Get field type from data_transmission_handshake message
275 * @return Type of requested/acknowledged data.
277 static inline uint8_t mavlink_msg_data_transmission_handshake_get_type(const mavlink_message_t
* msg
)
279 return _MAV_RETURN_uint8_t(msg
, 10);
283 * @brief Get field size from data_transmission_handshake message
285 * @return [bytes] total data size (set on ACK only).
287 static inline uint32_t mavlink_msg_data_transmission_handshake_get_size(const mavlink_message_t
* msg
)
289 return _MAV_RETURN_uint32_t(msg
, 0);
293 * @brief Get field width from data_transmission_handshake message
295 * @return Width of a matrix or image.
297 static inline uint16_t mavlink_msg_data_transmission_handshake_get_width(const mavlink_message_t
* msg
)
299 return _MAV_RETURN_uint16_t(msg
, 4);
303 * @brief Get field height from data_transmission_handshake message
305 * @return Height of a matrix or image.
307 static inline uint16_t mavlink_msg_data_transmission_handshake_get_height(const mavlink_message_t
* msg
)
309 return _MAV_RETURN_uint16_t(msg
, 6);
313 * @brief Get field packets from data_transmission_handshake message
315 * @return Number of packets being sent (set on ACK only).
317 static inline uint16_t mavlink_msg_data_transmission_handshake_get_packets(const mavlink_message_t
* msg
)
319 return _MAV_RETURN_uint16_t(msg
, 8);
323 * @brief Get field payload from data_transmission_handshake message
325 * @return [bytes] Payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only).
327 static inline uint8_t mavlink_msg_data_transmission_handshake_get_payload(const mavlink_message_t
* msg
)
329 return _MAV_RETURN_uint8_t(msg
, 11);
333 * @brief Get field jpg_quality from data_transmission_handshake message
335 * @return [%] JPEG quality. Values: [1-100].
337 static inline uint8_t mavlink_msg_data_transmission_handshake_get_jpg_quality(const mavlink_message_t
* msg
)
339 return _MAV_RETURN_uint8_t(msg
, 12);
343 * @brief Decode a data_transmission_handshake message into a struct
345 * @param msg The message to decode
346 * @param data_transmission_handshake C-struct to decode the message contents into
348 static inline void mavlink_msg_data_transmission_handshake_decode(const mavlink_message_t
* msg
, mavlink_data_transmission_handshake_t
* data_transmission_handshake
)
350 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 data_transmission_handshake
->size
= mavlink_msg_data_transmission_handshake_get_size(msg
);
352 data_transmission_handshake
->width
= mavlink_msg_data_transmission_handshake_get_width(msg
);
353 data_transmission_handshake
->height
= mavlink_msg_data_transmission_handshake_get_height(msg
);
354 data_transmission_handshake
->packets
= mavlink_msg_data_transmission_handshake_get_packets(msg
);
355 data_transmission_handshake
->type
= mavlink_msg_data_transmission_handshake_get_type(msg
);
356 data_transmission_handshake
->payload
= mavlink_msg_data_transmission_handshake_get_payload(msg
);
357 data_transmission_handshake
->jpg_quality
= mavlink_msg_data_transmission_handshake_get_jpg_quality(msg
);
359 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
? msg
->len
: MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
;
360 memset(data_transmission_handshake
, 0, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN
);
361 memcpy(data_transmission_handshake
, _MAV_PAYLOAD(msg
), len
);