pinxian wu / mavlink_bridge

Dependents:   mavlink F429ZI_LCD_demo

Fork of mavlink_bridge by Benjamin Hepp

Committer:
bhepp
Date:
Tue Nov 24 16:41:11 2015 +0000
Revision:
0:28183cc7963f
Mavlink bridge for Mbed

Who changed what in which revision?

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