source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_file_transfer_protocol.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 14.7 KB
Line 
1// MESSAGE FILE_TRANSFER_PROTOCOL PACKING
2
3#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL 110
4
5typedef struct MAVLINK_PACKED __mavlink_file_transfer_protocol_t
6{
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;
12
13#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN 254
14#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN 254
15#define MAVLINK_MSG_ID_110_LEN 254
16#define MAVLINK_MSG_ID_110_MIN_LEN 254
17
18#define MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC 84
19#define MAVLINK_MSG_ID_110_CRC 84
20
21#define MAVLINK_MSG_FILE_TRANSFER_PROTOCOL_FIELD_PAYLOAD_LEN 251
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL { \
25 110, \
26 "FILE_TRANSFER_PROTOCOL", \
27 4, \
28 { { "target_network", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_file_transfer_protocol_t, target_network) }, \
29 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_file_transfer_protocol_t, target_system) }, \
30 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_file_transfer_protocol_t, target_component) }, \
31 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 251, 3, offsetof(mavlink_file_transfer_protocol_t, payload) }, \
32 } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_FILE_TRANSFER_PROTOCOL { \
36 "FILE_TRANSFER_PROTOCOL", \
37 4, \
38 { { "target_network", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_file_transfer_protocol_t, target_network) }, \
39 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_file_transfer_protocol_t, target_system) }, \
40 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_file_transfer_protocol_t, target_component) }, \
41 { "payload", NULL, MAVLINK_TYPE_UINT8_T, 251, 3, offsetof(mavlink_file_transfer_protocol_t, payload) }, \
42 } \
43}
44#endif
45
46/**
47 * @brief Pack a file_transfer_protocol message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
51 *
52 * @param target_network Network ID (0 for broadcast)
53 * @param target_system System ID (0 for broadcast)
54 * @param target_component Component ID (0 for broadcast)
55 * @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.
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_file_transfer_protocol_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59 uint8_t target_network, uint8_t target_system, uint8_t target_component, const uint8_t *payload)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
63 _mav_put_uint8_t(buf, 0, target_network);
64 _mav_put_uint8_t(buf, 1, target_system);
65 _mav_put_uint8_t(buf, 2, target_component);
66 _mav_put_uint8_t_array(buf, 3, payload, 251);
67 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
68#else
69 mavlink_file_transfer_protocol_t packet;
70 packet.target_network = target_network;
71 packet.target_system = target_system;
72 packet.target_component = target_component;
73 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
75#endif
76
77 msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
78 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
79}
80
81/**
82 * @brief Pack a file_transfer_protocol message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message will be sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param target_network Network ID (0 for broadcast)
88 * @param target_system System ID (0 for broadcast)
89 * @param target_component Component ID (0 for broadcast)
90 * @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.
91 * @return length of the message in bytes (excluding serial stream start sign)
92 */
93static inline uint16_t mavlink_msg_file_transfer_protocol_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
94 mavlink_message_t* msg,
95 uint8_t target_network,uint8_t target_system,uint8_t target_component,const uint8_t *payload)
96{
97#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
98 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
99 _mav_put_uint8_t(buf, 0, target_network);
100 _mav_put_uint8_t(buf, 1, target_system);
101 _mav_put_uint8_t(buf, 2, target_component);
102 _mav_put_uint8_t_array(buf, 3, payload, 251);
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
104#else
105 mavlink_file_transfer_protocol_t packet;
106 packet.target_network = target_network;
107 packet.target_system = target_system;
108 packet.target_component = target_component;
109 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
111#endif
112
113 msg->msgid = MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL;
114 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
115}
116
117/**
118 * @brief Encode a file_transfer_protocol struct
119 *
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param msg The MAVLink message to compress the data into
123 * @param file_transfer_protocol C-struct to read the message contents from
124 */
125static 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)
126{
127 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);
128}
129
130/**
131 * @brief Encode a file_transfer_protocol struct on a channel
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param file_transfer_protocol C-struct to read the message contents from
138 */
139static 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)
140{
141 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);
142}
143
144/**
145 * @brief Send a file_transfer_protocol message
146 * @param chan MAVLink channel to send the message
147 *
148 * @param target_network Network ID (0 for broadcast)
149 * @param target_system System ID (0 for broadcast)
150 * @param target_component Component ID (0 for broadcast)
151 * @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.
152 */
153#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
154
155static 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)
156{
157#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN];
159 _mav_put_uint8_t(buf, 0, target_network);
160 _mav_put_uint8_t(buf, 1, target_system);
161 _mav_put_uint8_t(buf, 2, target_component);
162 _mav_put_uint8_t_array(buf, 3, payload, 251);
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
164#else
165 mavlink_file_transfer_protocol_t packet;
166 packet.target_network = target_network;
167 packet.target_system = target_system;
168 packet.target_component = target_component;
169 mav_array_memcpy(packet.payload, payload, sizeof(uint8_t)*251);
170 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)&packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
171#endif
172}
173
174/**
175 * @brief Send a file_transfer_protocol message
176 * @param chan MAVLink channel to send the message
177 * @param struct The MAVLink struct to serialize
178 */
179static inline void mavlink_msg_file_transfer_protocol_send_struct(mavlink_channel_t chan, const mavlink_file_transfer_protocol_t* file_transfer_protocol)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 mavlink_msg_file_transfer_protocol_send(chan, file_transfer_protocol->target_network, file_transfer_protocol->target_system, file_transfer_protocol->target_component, file_transfer_protocol->payload);
183#else
184 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)file_transfer_protocol, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
185#endif
186}
187
188#if MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
189/*
190 This varient of _send() can be used to save stack space by re-using
191 memory from the receive buffer. The caller provides a
192 mavlink_message_t which is the size of a full mavlink message. This
193 is usually the receive buffer for the channel, and allows a reply to an
194 incoming message with minimum stack space usage.
195 */
196static 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)
197{
198#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199 char *buf = (char *)msgbuf;
200 _mav_put_uint8_t(buf, 0, target_network);
201 _mav_put_uint8_t(buf, 1, target_system);
202 _mav_put_uint8_t(buf, 2, target_component);
203 _mav_put_uint8_t_array(buf, 3, payload, 251);
204 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, buf, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
205#else
206 mavlink_file_transfer_protocol_t *packet = (mavlink_file_transfer_protocol_t *)msgbuf;
207 packet->target_network = target_network;
208 packet->target_system = target_system;
209 packet->target_component = target_component;
210 mav_array_memcpy(packet->payload, payload, sizeof(uint8_t)*251);
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL, (const char *)packet, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_CRC);
212#endif
213}
214#endif
215
216#endif
217
218// MESSAGE FILE_TRANSFER_PROTOCOL UNPACKING
219
220
221/**
222 * @brief Get field target_network from file_transfer_protocol message
223 *
224 * @return Network ID (0 for broadcast)
225 */
226static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_network(const mavlink_message_t* msg)
227{
228 return _MAV_RETURN_uint8_t(msg, 0);
229}
230
231/**
232 * @brief Get field target_system from file_transfer_protocol message
233 *
234 * @return System ID (0 for broadcast)
235 */
236static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_system(const mavlink_message_t* msg)
237{
238 return _MAV_RETURN_uint8_t(msg, 1);
239}
240
241/**
242 * @brief Get field target_component from file_transfer_protocol message
243 *
244 * @return Component ID (0 for broadcast)
245 */
246static inline uint8_t mavlink_msg_file_transfer_protocol_get_target_component(const mavlink_message_t* msg)
247{
248 return _MAV_RETURN_uint8_t(msg, 2);
249}
250
251/**
252 * @brief Get field payload from file_transfer_protocol message
253 *
254 * @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.
255 */
256static inline uint16_t mavlink_msg_file_transfer_protocol_get_payload(const mavlink_message_t* msg, uint8_t *payload)
257{
258 return _MAV_RETURN_uint8_t_array(msg, payload, 251, 3);
259}
260
261/**
262 * @brief Decode a file_transfer_protocol message into a struct
263 *
264 * @param msg The message to decode
265 * @param file_transfer_protocol C-struct to decode the message contents into
266 */
267static inline void mavlink_msg_file_transfer_protocol_decode(const mavlink_message_t* msg, mavlink_file_transfer_protocol_t* file_transfer_protocol)
268{
269#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 file_transfer_protocol->target_network = mavlink_msg_file_transfer_protocol_get_target_network(msg);
271 file_transfer_protocol->target_system = mavlink_msg_file_transfer_protocol_get_target_system(msg);
272 file_transfer_protocol->target_component = mavlink_msg_file_transfer_protocol_get_target_component(msg);
273 mavlink_msg_file_transfer_protocol_get_payload(msg, file_transfer_protocol->payload);
274#else
275 uint8_t len = msg->len < MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN? msg->len : MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN;
276 memset(file_transfer_protocol, 0, MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_LEN);
277 memcpy(file_transfer_protocol, _MAV_PAYLOAD(msg), len);
278#endif
279}
Note: See TracBrowser for help on using the repository browser.