Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_data_transmission_handshake.h
blobd84a73709d58cb72b96182e36f9c0f56fba45faa
1 // MESSAGE DATA_TRANSMISSION_HANDSHAKE PACKING
3 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE 130
5 typedef struct __mavlink_data_transmission_handshake_t
7 uint32_t size; ///< total data size in bytes (set on ACK only)
8 uint16_t width; ///< Width of a matrix or image
9 uint16_t height; ///< Height of a matrix or image
10 uint16_t packets; ///< number of packets beeing sent (set on ACK only)
11 uint8_t type; ///< type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
12 uint8_t payload; ///< payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
13 uint8_t jpg_quality; ///< JPEG quality out of [1,100]
14 } mavlink_data_transmission_handshake_t;
16 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN 13
17 #define MAVLINK_MSG_ID_130_LEN 13
19 #define MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC 29
20 #define MAVLINK_MSG_ID_130_CRC 29
24 #define MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE { \
25 "DATA_TRANSMISSION_HANDSHAKE", \
26 7, \
27 { { "size", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_data_transmission_handshake_t, size) }, \
28 { "width", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_data_transmission_handshake_t, width) }, \
29 { "height", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_data_transmission_handshake_t, height) }, \
30 { "packets", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_data_transmission_handshake_t, packets) }, \
31 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_data_transmission_handshake_t, type) }, \
32 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_data_transmission_handshake_t, payload) }, \
33 { "jpg_quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_data_transmission_handshake_t, jpg_quality) }, \
34 } \
38 /**
39 * @brief Pack a data_transmission_handshake message
40 * @param system_id ID of this system
41 * @param component_id ID of this component (e.g. 200 for IMU)
42 * @param msg The MAVLink message to compress the data into
44 * @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
45 * @param size total data size in bytes (set on ACK only)
46 * @param width Width of a matrix or image
47 * @param height Height of a matrix or image
48 * @param packets number of packets beeing sent (set on ACK only)
49 * @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
50 * @param jpg_quality JPEG quality out of [1,100]
51 * @return length of the message in bytes (excluding serial stream start sign)
53 static inline uint16_t mavlink_msg_data_transmission_handshake_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
54 uint8_t type, uint32_t size, uint16_t width, uint16_t height, uint16_t packets, uint8_t payload, uint8_t jpg_quality)
56 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
57 char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
58 _mav_put_uint32_t(buf, 0, size);
59 _mav_put_uint16_t(buf, 4, width);
60 _mav_put_uint16_t(buf, 6, height);
61 _mav_put_uint16_t(buf, 8, packets);
62 _mav_put_uint8_t(buf, 10, type);
63 _mav_put_uint8_t(buf, 11, payload);
64 _mav_put_uint8_t(buf, 12, jpg_quality);
66 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
67 #else
68 mavlink_data_transmission_handshake_t packet;
69 packet.size = size;
70 packet.width = width;
71 packet.height = height;
72 packet.packets = packets;
73 packet.type = type;
74 packet.payload = payload;
75 packet.jpg_quality = jpg_quality;
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
78 #endif
80 msg->msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE;
81 #if MAVLINK_CRC_EXTRA
82 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
83 #else
84 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
85 #endif
88 /**
89 * @brief Pack a data_transmission_handshake message on a channel
90 * @param system_id ID of this system
91 * @param component_id ID of this component (e.g. 200 for IMU)
92 * @param chan The MAVLink channel this message will be sent over
93 * @param msg The MAVLink message to compress the data into
94 * @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
95 * @param size total data size in bytes (set on ACK only)
96 * @param width Width of a matrix or image
97 * @param height Height of a matrix or image
98 * @param packets number of packets beeing sent (set on ACK only)
99 * @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
100 * @param jpg_quality JPEG quality out of [1,100]
101 * @return length of the message in bytes (excluding serial stream start sign)
103 static inline uint16_t mavlink_msg_data_transmission_handshake_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
104 mavlink_message_t* msg,
105 uint8_t type,uint32_t size,uint16_t width,uint16_t height,uint16_t packets,uint8_t payload,uint8_t jpg_quality)
107 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
109 _mav_put_uint32_t(buf, 0, size);
110 _mav_put_uint16_t(buf, 4, width);
111 _mav_put_uint16_t(buf, 6, height);
112 _mav_put_uint16_t(buf, 8, packets);
113 _mav_put_uint8_t(buf, 10, type);
114 _mav_put_uint8_t(buf, 11, payload);
115 _mav_put_uint8_t(buf, 12, jpg_quality);
117 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
118 #else
119 mavlink_data_transmission_handshake_t packet;
120 packet.size = size;
121 packet.width = width;
122 packet.height = height;
123 packet.packets = packets;
124 packet.type = type;
125 packet.payload = payload;
126 packet.jpg_quality = jpg_quality;
128 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
129 #endif
131 msg->msgid = MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE;
132 #if MAVLINK_CRC_EXTRA
133 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
134 #else
135 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
136 #endif
140 * @brief Encode a data_transmission_handshake struct
142 * @param system_id ID of this system
143 * @param component_id ID of this component (e.g. 200 for IMU)
144 * @param msg The MAVLink message to compress the data into
145 * @param data_transmission_handshake C-struct to read the message contents from
147 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)
149 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);
153 * @brief Encode a data_transmission_handshake struct on a channel
155 * @param system_id ID of this system
156 * @param component_id ID of this component (e.g. 200 for IMU)
157 * @param chan The MAVLink channel this message will be sent over
158 * @param msg The MAVLink message to compress the data into
159 * @param data_transmission_handshake C-struct to read the message contents from
161 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)
163 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);
167 * @brief Send a data_transmission_handshake message
168 * @param chan MAVLink channel to send the message
170 * @param type type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
171 * @param size total data size in bytes (set on ACK only)
172 * @param width Width of a matrix or image
173 * @param height Height of a matrix or image
174 * @param packets number of packets beeing sent (set on ACK only)
175 * @param payload payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
176 * @param jpg_quality JPEG quality out of [1,100]
178 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
180 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)
182 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN];
184 _mav_put_uint32_t(buf, 0, size);
185 _mav_put_uint16_t(buf, 4, width);
186 _mav_put_uint16_t(buf, 6, height);
187 _mav_put_uint16_t(buf, 8, packets);
188 _mav_put_uint8_t(buf, 10, type);
189 _mav_put_uint8_t(buf, 11, payload);
190 _mav_put_uint8_t(buf, 12, jpg_quality);
192 #if MAVLINK_CRC_EXTRA
193 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
194 #else
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
196 #endif
197 #else
198 mavlink_data_transmission_handshake_t packet;
199 packet.size = size;
200 packet.width = width;
201 packet.height = height;
202 packet.packets = packets;
203 packet.type = type;
204 packet.payload = payload;
205 packet.jpg_quality = jpg_quality;
207 #if MAVLINK_CRC_EXTRA
208 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)&packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
209 #else
210 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)&packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
211 #endif
212 #endif
215 #if MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
217 This varient of _send() can be used to save stack space by re-using
218 memory from the receive buffer. The caller provides a
219 mavlink_message_t which is the size of a full mavlink message. This
220 is usually the receive buffer for the channel, and allows a reply to an
221 incoming message with minimum stack space usage.
223 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)
225 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
226 char *buf = (char *)msgbuf;
227 _mav_put_uint32_t(buf, 0, size);
228 _mav_put_uint16_t(buf, 4, width);
229 _mav_put_uint16_t(buf, 6, height);
230 _mav_put_uint16_t(buf, 8, packets);
231 _mav_put_uint8_t(buf, 10, type);
232 _mav_put_uint8_t(buf, 11, payload);
233 _mav_put_uint8_t(buf, 12, jpg_quality);
235 #if MAVLINK_CRC_EXTRA
236 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
237 #else
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, buf, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
239 #endif
240 #else
241 mavlink_data_transmission_handshake_t *packet = (mavlink_data_transmission_handshake_t *)msgbuf;
242 packet->size = size;
243 packet->width = width;
244 packet->height = height;
245 packet->packets = packets;
246 packet->type = type;
247 packet->payload = payload;
248 packet->jpg_quality = jpg_quality;
250 #if MAVLINK_CRC_EXTRA
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_CRC);
252 #else
253 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE, (const char *)packet, MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
254 #endif
255 #endif
257 #endif
259 #endif
261 // MESSAGE DATA_TRANSMISSION_HANDSHAKE UNPACKING
265 * @brief Get field type from data_transmission_handshake message
267 * @return type of requested/acknowledged data (as defined in ENUM DATA_TYPES in mavlink/include/mavlink_types.h)
269 static inline uint8_t mavlink_msg_data_transmission_handshake_get_type(const mavlink_message_t* msg)
271 return _MAV_RETURN_uint8_t(msg, 10);
275 * @brief Get field size from data_transmission_handshake message
277 * @return total data size in bytes (set on ACK only)
279 static inline uint32_t mavlink_msg_data_transmission_handshake_get_size(const mavlink_message_t* msg)
281 return _MAV_RETURN_uint32_t(msg, 0);
285 * @brief Get field width from data_transmission_handshake message
287 * @return Width of a matrix or image
289 static inline uint16_t mavlink_msg_data_transmission_handshake_get_width(const mavlink_message_t* msg)
291 return _MAV_RETURN_uint16_t(msg, 4);
295 * @brief Get field height from data_transmission_handshake message
297 * @return Height of a matrix or image
299 static inline uint16_t mavlink_msg_data_transmission_handshake_get_height(const mavlink_message_t* msg)
301 return _MAV_RETURN_uint16_t(msg, 6);
305 * @brief Get field packets from data_transmission_handshake message
307 * @return number of packets beeing sent (set on ACK only)
309 static inline uint16_t mavlink_msg_data_transmission_handshake_get_packets(const mavlink_message_t* msg)
311 return _MAV_RETURN_uint16_t(msg, 8);
315 * @brief Get field payload from data_transmission_handshake message
317 * @return payload size per packet (normally 253 byte, see DATA field size in message ENCAPSULATED_DATA) (set on ACK only)
319 static inline uint8_t mavlink_msg_data_transmission_handshake_get_payload(const mavlink_message_t* msg)
321 return _MAV_RETURN_uint8_t(msg, 11);
325 * @brief Get field jpg_quality from data_transmission_handshake message
327 * @return JPEG quality out of [1,100]
329 static inline uint8_t mavlink_msg_data_transmission_handshake_get_jpg_quality(const mavlink_message_t* msg)
331 return _MAV_RETURN_uint8_t(msg, 12);
335 * @brief Decode a data_transmission_handshake message into a struct
337 * @param msg The message to decode
338 * @param data_transmission_handshake C-struct to decode the message contents into
340 static inline void mavlink_msg_data_transmission_handshake_decode(const mavlink_message_t* msg, mavlink_data_transmission_handshake_t* data_transmission_handshake)
342 #if MAVLINK_NEED_BYTE_SWAP
343 data_transmission_handshake->size = mavlink_msg_data_transmission_handshake_get_size(msg);
344 data_transmission_handshake->width = mavlink_msg_data_transmission_handshake_get_width(msg);
345 data_transmission_handshake->height = mavlink_msg_data_transmission_handshake_get_height(msg);
346 data_transmission_handshake->packets = mavlink_msg_data_transmission_handshake_get_packets(msg);
347 data_transmission_handshake->type = mavlink_msg_data_transmission_handshake_get_type(msg);
348 data_transmission_handshake->payload = mavlink_msg_data_transmission_handshake_get_payload(msg);
349 data_transmission_handshake->jpg_quality = mavlink_msg_data_transmission_handshake_get_jpg_quality(msg);
350 #else
351 memcpy(data_transmission_handshake, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_LEN);
352 #endif