Move telemetry displayport init and cms device registering
[betaflight.git] / lib / main / MAVLink / common / mavlink_msg_file_transfer_protocol.h
blobf77cd943c1149e8873106ca989b4510040ca1a08
1 // MESSAGE FILE_TRANSFER_PROTOCOL PACKING
3 #define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL 110
5 typedef struct __mavlink_file_transfer_protocol_t
7 uint8_t target_network; ///< Network ID (0 for broadcast)
8 uint8_t target_system; ///< System ID (0 for broadcast)
9 uint8_t target_component; ///< Component ID (0 for broadcast)
10 uint8_t payload[251]; ///< Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.
11 } mavlink_file_transfer_protocol_t;
13 #define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN 254
14 #define MAVLINK_MSG_ID_110_LEN 254
16 #define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC 84
17 #define MAVLINK_MSG_ID_110_CRC 84
19 #define MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN 251
21 #define MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL { \
22 "FILE_TRANSFER_PROTOCOL", \
23 4, \
24 { { "target_network", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_file_transfer_protocol_t, target_network) }, \
25 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_file_transfer_protocol_t, target_system) }, \
26 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_file_transfer_protocol_t, target_component) }, \
27 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 251, 3, offsetof(mavlink_file_transfer_protocol_t, payload) }, \
28 } \
32 /**
33 * @brief Pack a file_transfer_protocol message
34 * @param system_id ID of this system
35 * @param component_id ID of this component (e.g. 200 for IMU)
36 * @param msg The MAVLink message to compress the data into
38 * @param target_network Network ID (0 for broadcast)
39 * @param target_system System ID (0 for broadcast)
40 * @param target_component Component ID (0 for broadcast)
41 * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.
42 * @return length of the message in bytes (excluding serial stream start sign)
44 static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45 uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
49 _mav_put_uint8_t(buf, 0, target_network);
50 _mav_put_uint8_t(buf, 1, target_system);
51 _mav_put_uint8_t(buf, 2, target_component);
52 _mav_put_uint8_t_array(buf, 3, payload, 251);
53 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
54 #else
55 mavlink_file_transfer_protocol_t packet;
56 packet.target_network = target_network;
57 packet.target_system = target_system;
58 packet.target_component = target_component;
59 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
60 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
61 #endif
63 msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
64 #if MAVLINK_CRC_EXTRA
65 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
66 #else
67 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
68 #endif
71 /**
72 * @brief Pack a file_transfer_protocol message on a channel
73 * @param system_id ID of this system
74 * @param component_id ID of this component (e.g. 200 for IMU)
75 * @param chan The MAVLink channel this message will be sent over
76 * @param msg The MAVLink message to compress the data into
77 * @param target_network Network ID (0 for broadcast)
78 * @param target_system System ID (0 for broadcast)
79 * @param target_component Component ID (0 for broadcast)
80 * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.
81 * @return length of the message in bytes (excluding serial stream start sign)
83 static inline uint16_t mavlink_msg_file_transfer_protocol_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
84 mavlink_message_t* msg,
85 uint8_t target_network,uint8_t target_system,uint8_t target_component,const uint8_t *payload)
87 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
88 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
89 _mav_put_uint8_t(buf, 0, target_network);
90 _mav_put_uint8_t(buf, 1, target_system);
91 _mav_put_uint8_t(buf, 2, target_component);
92 _mav_put_uint8_t_array(buf, 3, payload, 251);
93 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
94 #else
95 mavlink_file_transfer_protocol_t packet;
96 packet.target_network = target_network;
97 packet.target_system = target_system;
98 packet.target_component = target_component;
99 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
100 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
101 #endif
103 msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
104 #if MAVLINK_CRC_EXTRA
105 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
106 #else
107 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
108 #endif
112 * @brief Encode a file_transfer_protocol struct
114 * @param system_id ID of this system
115 * @param component_id ID of this component (e.g. 200 for IMU)
116 * @param msg The MAVLink message to compress the data into
117 * @param file_transfer_protocol C-struct to read the message contents from
119 static inline uint16_t mavlink_msg_file_transfer_protocol_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_file_transfer_protocol_t* file_transfer_protocol)
121 return mavlink_msg_file_transfer_protocol_pack(system_id, component_id, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload);
125 * @brief Encode a file_transfer_protocol struct on a channel
127 * @param system_id ID of this system
128 * @param component_id ID of this component (e.g. 200 for IMU)
129 * @param chan The MAVLink channel this message will be sent over
130 * @param msg The MAVLink message to compress the data into
131 * @param file_transfer_protocol C-struct to read the message contents from
133 static inline uint16_t mavlink_msg_file_transfer_protocol_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_file_transfer_protocol_t* file_transfer_protocol)
135 return mavlink_msg_file_transfer_protocol_pack_chan(system_id, component_id, chan, msg, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload);
139 * @brief Send a file_transfer_protocol message
140 * @param chan MAVLink channel to send the message
142 * @param target_network Network ID (0 for broadcast)
143 * @param target_system System ID (0 for broadcast)
144 * @param target_component Component ID (0 for broadcast)
145 * @param payload Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.
147 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
149 static inline void mavlink_msg_file_transfer_protocol_send(mavlink_channel_t chan, uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
151 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
152 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
153 _mav_put_uint8_t(buf, 0, target_network);
154 _mav_put_uint8_t(buf, 1, target_system);
155 _mav_put_uint8_t(buf, 2, target_component);
156 _mav_put_uint8_t_array(buf, 3, payload, 251);
157 #if MAVLINK_CRC_EXTRA
158 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
159 #else
160 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
161 #endif
162 #else
163 mavlink_file_transfer_protocol_t packet;
164 packet.target_network = target_network;
165 packet.target_system = target_system;
166 packet.target_component = target_component;
167 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
168 #if MAVLINK_CRC_EXTRA
169 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
170 #else
171 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
172 #endif
173 #endif
176 #if MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
178 This varient of _send() can be used to save stack space by re-using
179 memory from the receive buffer. The caller provides a
180 mavlink_message_t which is the size of a full mavlink message. This
181 is usually the receive buffer for the channel, and allows a reply to an
182 incoming message with minimum stack space usage.
184 static inline void mavlink_msg_file_transfer_protocol_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
186 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
187 char *buf = (char *)msgbuf;
188 _mav_put_uint8_t(buf, 0, target_network);
189 _mav_put_uint8_t(buf, 1, target_system);
190 _mav_put_uint8_t(buf, 2, target_component);
191 _mav_put_uint8_t_array(buf, 3, payload, 251);
192 #if MAVLINK_CRC_EXTRA
193 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
194 #else
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
196 #endif
197 #else
198 mavlink_file_transfer_protocol_t *packet = (mavlink_file_transfer_protocol_t *)msgbuf;
199 packet->target_network = target_network;
200 packet->target_system = target_system;
201 packet->target_component = target_component;
202 mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*251);
203 #if MAVLINK_CRC_EXTRA
204 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
205 #else
206 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
207 #endif
208 #endif
210 #endif
212 #endif
214 // MESSAGE FILE_TRANSFER_PROTOCOL UNPACKING
218 * @brief Get field target_network from file_transfer_protocol message
220 * @return Network ID (0 for broadcast)
222 static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_network(const mavlink_message_t* msg)
224 return _MAV_RETURN_uint8_t(msg, 0);
228 * @brief Get field target_system from file_transfer_protocol message
230 * @return System ID (0 for broadcast)
232 static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_system(const mavlink_message_t* msg)
234 return _MAV_RETURN_uint8_t(msg, 1);
238 * @brief Get field target_component from file_transfer_protocol message
240 * @return Component ID (0 for broadcast)
242 static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_component(const mavlink_message_t* msg)
244 return _MAV_RETURN_uint8_t(msg, 2);
248 * @brief Get field payload from file_transfer_protocol message
250 * @return Variable length payload. The length is defined by the remaining message length when subtracting the header and other fields. The entire content of this block is opaque unless you understand any the encoding message_type. The particular encoding used can be extension specific and might not always be documented as part of the mavlink specification.
252 static inline uint16_t mavlink_msg_file_transfer_protocol_get_payload(const mavlink_message_t* msg, uint8_t *payload)
254 return _MAV_RETURN_uint8_t_array(msg, payload, 251, 3);
258 * @brief Decode a file_transfer_protocol message into a struct
260 * @param msg The message to decode
261 * @param file_transfer_protocol C-struct to decode the message contents into
263 static inline void mavlink_msg_file_transfer_protocol_decode(const mavlink_message_t* msg, mavlink_file_transfer_protocol_t* file_transfer_protocol)
265 #if MAVLINK_NEED_BYTE_SWAP
266 file_transfer_protocol->target_network = mavlink_msg_file_transfer_protocol_get_target_network(msg);
267 file_transfer_protocol->target_system = mavlink_msg_file_transfer_protocol_get_target_system(msg);
268 file_transfer_protocol->target_component = mavlink_msg_file_transfer_protocol_get_target_component(msg);
269 mavlink_msg_file_transfer_protocol_get_payload(msg, file_transfer_protocol->payload);
270 #else
271 memcpy(file_transfer_protocol, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
272 #endif