1 | // MESSAGE RESOURCE_REQUEST PACKING |
---|
2 | |
---|
3 | #define MAVLINK_MSG_ID_RESOURCE_REQUEST 142 |
---|
4 | |
---|
5 | MAVPACKED( |
---|
6 | typedef struct __mavlink_resource_request_t { |
---|
7 | uint8_t request_id; /*< Request ID. This ID should be re-used when sending back URI contents*/ |
---|
8 | uint8_t uri_type; /*< The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary*/ |
---|
9 | uint8_t uri[120]; /*< The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum)*/ |
---|
10 | uint8_t transfer_type; /*< The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream.*/ |
---|
11 | uint8_t storage[120]; /*< The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP).*/ |
---|
12 | }) mavlink_resource_request_t; |
---|
13 | |
---|
14 | #define MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN 243 |
---|
15 | #define MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN 243 |
---|
16 | #define MAVLINK_MSG_ID_142_LEN 243 |
---|
17 | #define MAVLINK_MSG_ID_142_MIN_LEN 243 |
---|
18 | |
---|
19 | #define MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC 72 |
---|
20 | #define MAVLINK_MSG_ID_142_CRC 72 |
---|
21 | |
---|
22 | #define MAVLINK_MSG_RESOURCE_REQUEST_FIELD_URI_LEN 120 |
---|
23 | #define MAVLINK_MSG_RESOURCE_REQUEST_FIELD_STORAGE_LEN 120 |
---|
24 | |
---|
25 | #if MAVLINK_COMMAND_24BIT |
---|
26 | #define MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST { \ |
---|
27 | 142, \ |
---|
28 | "RESOURCE_REQUEST", \ |
---|
29 | 5, \ |
---|
30 | { { "request_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_resource_request_t, request_id) }, \ |
---|
31 | { "uri_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_resource_request_t, uri_type) }, \ |
---|
32 | { "uri", NULL, MAVLINK_TYPE_UINT8_T, 120, 2, offsetof(mavlink_resource_request_t, uri) }, \ |
---|
33 | { "transfer_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 122, offsetof(mavlink_resource_request_t, transfer_type) }, \ |
---|
34 | { "storage", NULL, MAVLINK_TYPE_UINT8_T, 120, 123, offsetof(mavlink_resource_request_t, storage) }, \ |
---|
35 | } \ |
---|
36 | } |
---|
37 | #else |
---|
38 | #define MAVLINK_MESSAGE_INFO_RESOURCE_REQUEST { \ |
---|
39 | "RESOURCE_REQUEST", \ |
---|
40 | 5, \ |
---|
41 | { { "request_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_resource_request_t, request_id) }, \ |
---|
42 | { "uri_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_resource_request_t, uri_type) }, \ |
---|
43 | { "uri", NULL, MAVLINK_TYPE_UINT8_T, 120, 2, offsetof(mavlink_resource_request_t, uri) }, \ |
---|
44 | { "transfer_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 122, offsetof(mavlink_resource_request_t, transfer_type) }, \ |
---|
45 | { "storage", NULL, MAVLINK_TYPE_UINT8_T, 120, 123, offsetof(mavlink_resource_request_t, storage) }, \ |
---|
46 | } \ |
---|
47 | } |
---|
48 | #endif |
---|
49 | |
---|
50 | /** |
---|
51 | * @brief Pack a resource_request message |
---|
52 | * @param system_id ID of this system |
---|
53 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
54 | * @param msg The MAVLink message to compress the data into |
---|
55 | * |
---|
56 | * @param request_id Request ID. This ID should be re-used when sending back URI contents |
---|
57 | * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary |
---|
58 | * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) |
---|
59 | * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. |
---|
60 | * @param storage The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). |
---|
61 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
62 | */ |
---|
63 | static inline uint16_t mavlink_msg_resource_request_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, |
---|
64 | uint8_t request_id, uint8_t uri_type, const uint8_t *uri, uint8_t transfer_type, const uint8_t *storage) |
---|
65 | { |
---|
66 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
67 | char buf[MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN]; |
---|
68 | _mav_put_uint8_t(buf, 0, request_id); |
---|
69 | _mav_put_uint8_t(buf, 1, uri_type); |
---|
70 | _mav_put_uint8_t(buf, 122, transfer_type); |
---|
71 | _mav_put_uint8_t_array(buf, 2, uri, 120); |
---|
72 | _mav_put_uint8_t_array(buf, 123, storage, 120); |
---|
73 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); |
---|
74 | #else |
---|
75 | mavlink_resource_request_t packet; |
---|
76 | packet.request_id = request_id; |
---|
77 | packet.uri_type = uri_type; |
---|
78 | packet.transfer_type = transfer_type; |
---|
79 | mav_array_memcpy(packet.uri, uri, sizeof(uint8_t)*120); |
---|
80 | mav_array_memcpy(packet.storage, storage, sizeof(uint8_t)*120); |
---|
81 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); |
---|
82 | #endif |
---|
83 | |
---|
84 | msg->msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; |
---|
85 | return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
86 | } |
---|
87 | |
---|
88 | /** |
---|
89 | * @brief Pack a resource_request 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 request_id Request ID. This ID should be re-used when sending back URI contents |
---|
95 | * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary |
---|
96 | * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) |
---|
97 | * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. |
---|
98 | * @param storage The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). |
---|
99 | * @return length of the message in bytes (excluding serial stream start sign) |
---|
100 | */ |
---|
101 | static inline uint16_t mavlink_msg_resource_request_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, |
---|
102 | mavlink_message_t* msg, |
---|
103 | uint8_t request_id,uint8_t uri_type,const uint8_t *uri,uint8_t transfer_type,const uint8_t *storage) |
---|
104 | { |
---|
105 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
106 | char buf[MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN]; |
---|
107 | _mav_put_uint8_t(buf, 0, request_id); |
---|
108 | _mav_put_uint8_t(buf, 1, uri_type); |
---|
109 | _mav_put_uint8_t(buf, 122, transfer_type); |
---|
110 | _mav_put_uint8_t_array(buf, 2, uri, 120); |
---|
111 | _mav_put_uint8_t_array(buf, 123, storage, 120); |
---|
112 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); |
---|
113 | #else |
---|
114 | mavlink_resource_request_t packet; |
---|
115 | packet.request_id = request_id; |
---|
116 | packet.uri_type = uri_type; |
---|
117 | packet.transfer_type = transfer_type; |
---|
118 | mav_array_memcpy(packet.uri, uri, sizeof(uint8_t)*120); |
---|
119 | mav_array_memcpy(packet.storage, storage, sizeof(uint8_t)*120); |
---|
120 | memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); |
---|
121 | #endif |
---|
122 | |
---|
123 | msg->msgid = MAVLINK_MSG_ID_RESOURCE_REQUEST; |
---|
124 | return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
125 | } |
---|
126 | |
---|
127 | /** |
---|
128 | * @brief Encode a resource_request struct |
---|
129 | * |
---|
130 | * @param system_id ID of this system |
---|
131 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
132 | * @param msg The MAVLink message to compress the data into |
---|
133 | * @param resource_request C-struct to read the message contents from |
---|
134 | */ |
---|
135 | static inline uint16_t mavlink_msg_resource_request_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_resource_request_t* resource_request) |
---|
136 | { |
---|
137 | return mavlink_msg_resource_request_pack(system_id, component_id, msg, resource_request->request_id, resource_request->uri_type, resource_request->uri, resource_request->transfer_type, resource_request->storage); |
---|
138 | } |
---|
139 | |
---|
140 | /** |
---|
141 | * @brief Encode a resource_request struct on a channel |
---|
142 | * |
---|
143 | * @param system_id ID of this system |
---|
144 | * @param component_id ID of this component (e.g. 200 for IMU) |
---|
145 | * @param chan The MAVLink channel this message will be sent over |
---|
146 | * @param msg The MAVLink message to compress the data into |
---|
147 | * @param resource_request C-struct to read the message contents from |
---|
148 | */ |
---|
149 | static inline uint16_t mavlink_msg_resource_request_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_resource_request_t* resource_request) |
---|
150 | { |
---|
151 | return mavlink_msg_resource_request_pack_chan(system_id, component_id, chan, msg, resource_request->request_id, resource_request->uri_type, resource_request->uri, resource_request->transfer_type, resource_request->storage); |
---|
152 | } |
---|
153 | |
---|
154 | /** |
---|
155 | * @brief Send a resource_request message |
---|
156 | * @param chan MAVLink channel to send the message |
---|
157 | * |
---|
158 | * @param request_id Request ID. This ID should be re-used when sending back URI contents |
---|
159 | * @param uri_type The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary |
---|
160 | * @param uri The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) |
---|
161 | * @param transfer_type The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. |
---|
162 | * @param storage The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). |
---|
163 | */ |
---|
164 | #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS |
---|
165 | |
---|
166 | static inline void mavlink_msg_resource_request_send(mavlink_channel_t chan, uint8_t request_id, uint8_t uri_type, const uint8_t *uri, uint8_t transfer_type, const uint8_t *storage) |
---|
167 | { |
---|
168 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
169 | char buf[MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN]; |
---|
170 | _mav_put_uint8_t(buf, 0, request_id); |
---|
171 | _mav_put_uint8_t(buf, 1, uri_type); |
---|
172 | _mav_put_uint8_t(buf, 122, transfer_type); |
---|
173 | _mav_put_uint8_t_array(buf, 2, uri, 120); |
---|
174 | _mav_put_uint8_t_array(buf, 123, storage, 120); |
---|
175 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, buf, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
176 | #else |
---|
177 | mavlink_resource_request_t packet; |
---|
178 | packet.request_id = request_id; |
---|
179 | packet.uri_type = uri_type; |
---|
180 | packet.transfer_type = transfer_type; |
---|
181 | mav_array_memcpy(packet.uri, uri, sizeof(uint8_t)*120); |
---|
182 | mav_array_memcpy(packet.storage, storage, sizeof(uint8_t)*120); |
---|
183 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, (const char *)&packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
184 | #endif |
---|
185 | } |
---|
186 | |
---|
187 | /** |
---|
188 | * @brief Send a resource_request message |
---|
189 | * @param chan MAVLink channel to send the message |
---|
190 | * @param struct The MAVLink struct to serialize |
---|
191 | */ |
---|
192 | static inline void mavlink_msg_resource_request_send_struct(mavlink_channel_t chan, const mavlink_resource_request_t* resource_request) |
---|
193 | { |
---|
194 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
195 | mavlink_msg_resource_request_send(chan, resource_request->request_id, resource_request->uri_type, resource_request->uri, resource_request->transfer_type, resource_request->storage); |
---|
196 | #else |
---|
197 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, (const char *)resource_request, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
198 | #endif |
---|
199 | } |
---|
200 | |
---|
201 | #if MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN <= MAVLINK_MAX_PAYLOAD_LEN |
---|
202 | /* |
---|
203 | This varient of _send() can be used to save stack space by re-using |
---|
204 | memory from the receive buffer. The caller provides a |
---|
205 | mavlink_message_t which is the size of a full mavlink message. This |
---|
206 | is usually the receive buffer for the channel, and allows a reply to an |
---|
207 | incoming message with minimum stack space usage. |
---|
208 | */ |
---|
209 | static inline void mavlink_msg_resource_request_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t request_id, uint8_t uri_type, const uint8_t *uri, uint8_t transfer_type, const uint8_t *storage) |
---|
210 | { |
---|
211 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
212 | char *buf = (char *)msgbuf; |
---|
213 | _mav_put_uint8_t(buf, 0, request_id); |
---|
214 | _mav_put_uint8_t(buf, 1, uri_type); |
---|
215 | _mav_put_uint8_t(buf, 122, transfer_type); |
---|
216 | _mav_put_uint8_t_array(buf, 2, uri, 120); |
---|
217 | _mav_put_uint8_t_array(buf, 123, storage, 120); |
---|
218 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, buf, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
219 | #else |
---|
220 | mavlink_resource_request_t *packet = (mavlink_resource_request_t *)msgbuf; |
---|
221 | packet->request_id = request_id; |
---|
222 | packet->uri_type = uri_type; |
---|
223 | packet->transfer_type = transfer_type; |
---|
224 | mav_array_memcpy(packet->uri, uri, sizeof(uint8_t)*120); |
---|
225 | mav_array_memcpy(packet->storage, storage, sizeof(uint8_t)*120); |
---|
226 | _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_RESOURCE_REQUEST, (const char *)packet, MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN, MAVLINK_MSG_ID_RESOURCE_REQUEST_CRC); |
---|
227 | #endif |
---|
228 | } |
---|
229 | #endif |
---|
230 | |
---|
231 | #endif |
---|
232 | |
---|
233 | // MESSAGE RESOURCE_REQUEST UNPACKING |
---|
234 | |
---|
235 | |
---|
236 | /** |
---|
237 | * @brief Get field request_id from resource_request message |
---|
238 | * |
---|
239 | * @return Request ID. This ID should be re-used when sending back URI contents |
---|
240 | */ |
---|
241 | static inline uint8_t mavlink_msg_resource_request_get_request_id(const mavlink_message_t* msg) |
---|
242 | { |
---|
243 | return _MAV_RETURN_uint8_t(msg, 0); |
---|
244 | } |
---|
245 | |
---|
246 | /** |
---|
247 | * @brief Get field uri_type from resource_request message |
---|
248 | * |
---|
249 | * @return The type of requested URI. 0 = a file via URL. 1 = a UAVCAN binary |
---|
250 | */ |
---|
251 | static inline uint8_t mavlink_msg_resource_request_get_uri_type(const mavlink_message_t* msg) |
---|
252 | { |
---|
253 | return _MAV_RETURN_uint8_t(msg, 1); |
---|
254 | } |
---|
255 | |
---|
256 | /** |
---|
257 | * @brief Get field uri from resource_request message |
---|
258 | * |
---|
259 | * @return The requested unique resource identifier (URI). It is not necessarily a straight domain name (depends on the URI type enum) |
---|
260 | */ |
---|
261 | static inline uint16_t mavlink_msg_resource_request_get_uri(const mavlink_message_t* msg, uint8_t *uri) |
---|
262 | { |
---|
263 | return _MAV_RETURN_uint8_t_array(msg, uri, 120, 2); |
---|
264 | } |
---|
265 | |
---|
266 | /** |
---|
267 | * @brief Get field transfer_type from resource_request message |
---|
268 | * |
---|
269 | * @return The way the autopilot wants to receive the URI. 0 = MAVLink FTP. 1 = binary stream. |
---|
270 | */ |
---|
271 | static inline uint8_t mavlink_msg_resource_request_get_transfer_type(const mavlink_message_t* msg) |
---|
272 | { |
---|
273 | return _MAV_RETURN_uint8_t(msg, 122); |
---|
274 | } |
---|
275 | |
---|
276 | /** |
---|
277 | * @brief Get field storage from resource_request message |
---|
278 | * |
---|
279 | * @return The storage path the autopilot wants the URI to be stored in. Will only be valid if the transfer_type has a storage associated (e.g. MAVLink FTP). |
---|
280 | */ |
---|
281 | static inline uint16_t mavlink_msg_resource_request_get_storage(const mavlink_message_t* msg, uint8_t *storage) |
---|
282 | { |
---|
283 | return _MAV_RETURN_uint8_t_array(msg, storage, 120, 123); |
---|
284 | } |
---|
285 | |
---|
286 | /** |
---|
287 | * @brief Decode a resource_request message into a struct |
---|
288 | * |
---|
289 | * @param msg The message to decode |
---|
290 | * @param resource_request C-struct to decode the message contents into |
---|
291 | */ |
---|
292 | static inline void mavlink_msg_resource_request_decode(const mavlink_message_t* msg, mavlink_resource_request_t* resource_request) |
---|
293 | { |
---|
294 | #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS |
---|
295 | resource_request->request_id = mavlink_msg_resource_request_get_request_id(msg); |
---|
296 | resource_request->uri_type = mavlink_msg_resource_request_get_uri_type(msg); |
---|
297 | mavlink_msg_resource_request_get_uri(msg, resource_request->uri); |
---|
298 | resource_request->transfer_type = mavlink_msg_resource_request_get_transfer_type(msg); |
---|
299 | mavlink_msg_resource_request_get_storage(msg, resource_request->storage); |
---|
300 | #else |
---|
301 | uint8_t len = msg->len < MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN? msg->len : MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN; |
---|
302 | memset(resource_request, 0, MAVLINK_MSG_ID_RESOURCE_REQUEST_LEN); |
---|
303 | memcpy(resource_request, _MAV_PAYLOAD(msg), len); |
---|
304 | #endif |
---|
305 | } |
---|