Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_storage_information.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE STORAGE_INFORMATION PACKING
3
4#define MAVLINK_MSG_ID_STORAGE_INFORMATION 261
5
6
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 float total_capacity; /*< [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.*/
10 float used_capacity; /*< [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.*/
11 float available_capacity; /*< [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.*/
12 float read_speed; /*< [MiB/s] Read speed.*/
13 float write_speed; /*< [MiB/s] Write speed.*/
14 uint8_t storage_id; /*< Storage ID (1 for first, 2 for second, etc.)*/
15 uint8_t storage_count; /*< Number of storage devices*/
16 uint8_t status; /*< Status of storage*/
17 uint8_t type; /*< Type of storage*/
18 char name[32]; /*< Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.*/
19 uint8_t storage_usage; /*< Flags indicating whether this instance is preferred storage for photos, videos, etc.
20 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
21 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
22 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.*/
23} mavlink_storage_information_t;
24
25#define MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN 61
26#define MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN 27
27#define MAVLINK_MSG_ID_261_LEN 61
28#define MAVLINK_MSG_ID_261_MIN_LEN 27
29
30#define MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC 179
31#define MAVLINK_MSG_ID_261_CRC 179
32
33#define MAVLINK_MSG_STORAGE_INFORMATION_FIELD_NAME_LEN 32
34
35#if MAVLINK_COMMAND_24BIT
36#define MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION {
37 261,
38 "STORAGE_INFORMATION",
39 12,
40 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_storage_information_t, time_boot_ms) },
41 { "storage_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_storage_information_t, storage_id) },
42 { "storage_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_storage_information_t, storage_count) },
43 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_storage_information_t, status) },
44 { "total_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_storage_information_t, total_capacity) },
45 { "used_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_storage_information_t, used_capacity) },
46 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_storage_information_t, available_capacity) },
47 { "read_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_storage_information_t, read_speed) },
48 { "write_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_storage_information_t, write_speed) },
49 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_storage_information_t, type) },
50 { "name", NULL, MAVLINK_TYPE_CHAR, 32, 28, offsetof(mavlink_storage_information_t, name) },
51 { "storage_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_storage_information_t, storage_usage) },
52 } \
53}
54#else
55#define MAVLINK_MESSAGE_INFO_STORAGE_INFORMATION {
56 "STORAGE_INFORMATION",
57 12,
58 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_storage_information_t, time_boot_ms) },
59 { "storage_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_storage_information_t, storage_id) },
60 { "storage_count", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_storage_information_t, storage_count) },
61 { "status", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_storage_information_t, status) },
62 { "total_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_storage_information_t, total_capacity) },
63 { "used_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_storage_information_t, used_capacity) },
64 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_storage_information_t, available_capacity) },
65 { "read_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_storage_information_t, read_speed) },
66 { "write_speed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_storage_information_t, write_speed) },
67 { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_storage_information_t, type) },
68 { "name", NULL, MAVLINK_TYPE_CHAR, 32, 28, offsetof(mavlink_storage_information_t, name) },
69 { "storage_usage", NULL, MAVLINK_TYPE_UINT8_T, 0, 60, offsetof(mavlink_storage_information_t, storage_usage) },
70 } \
71}
72#endif
73
74/**
75 * @brief Pack a storage_information message
76 * @param system_id ID of this system
77 * @param component_id ID of this component (e.g. 200 for IMU)
78 * @param msg The MAVLink message to compress the data into
79 *
80 * @param time_boot_ms [ms] Timestamp (time since system boot).
81 * @param storage_id Storage ID (1 for first, 2 for second, etc.)
82 * @param storage_count Number of storage devices
83 * @param status Status of storage
84 * @param total_capacity [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
85 * @param used_capacity [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
86 * @param available_capacity [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
87 * @param read_speed [MiB/s] Read speed.
88 * @param write_speed [MiB/s] Write speed.
89 * @param type Type of storage
90 * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.
91 * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc.
92 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
93 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
94 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.
95 * @return length of the message in bytes (excluding serial stream start sign)
96 */
97static inline uint16_t mavlink_msg_storage_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
98 uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage)
99{
100#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
102 _mav_put_uint32_t(buf, 0, time_boot_ms);
103 _mav_put_float(buf, 4, total_capacity);
104 _mav_put_float(buf, 8, used_capacity);
105 _mav_put_float(buf, 12, available_capacity);
106 _mav_put_float(buf, 16, read_speed);
107 _mav_put_float(buf, 20, write_speed);
108 _mav_put_uint8_t(buf, 24, storage_id);
109 _mav_put_uint8_t(buf, 25, storage_count);
110 _mav_put_uint8_t(buf, 26, status);
111 _mav_put_uint8_t(buf, 27, type);
112 _mav_put_uint8_t(buf, 60, storage_usage);
113 _mav_put_char_array(buf, 28, name, 32);
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
115#else
116 mavlink_storage_information_t packet;
117 packet.time_boot_ms = time_boot_ms;
118 packet.total_capacity = total_capacity;
119 packet.used_capacity = used_capacity;
120 packet.available_capacity = available_capacity;
121 packet.read_speed = read_speed;
122 packet.write_speed = write_speed;
123 packet.storage_id = storage_id;
124 packet.storage_count = storage_count;
125 packet.status = status;
126 packet.type = type;
127 packet.storage_usage = storage_usage;
128 mav_array_memcpy(packet.name, name, sizeof(char)*32);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
130#endif
131
134}
135
136/**
137 * @brief Pack a storage_information message
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param status MAVLink status structure
141 * @param msg The MAVLink message to compress the data into
142 *
143 * @param time_boot_ms [ms] Timestamp (time since system boot).
144 * @param storage_id Storage ID (1 for first, 2 for second, etc.)
145 * @param storage_count Number of storage devices
146 * @param status Status of storage
147 * @param total_capacity [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
148 * @param used_capacity [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
149 * @param available_capacity [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
150 * @param read_speed [MiB/s] Read speed.
151 * @param write_speed [MiB/s] Write speed.
152 * @param type Type of storage
153 * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.
154 * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc.
155 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
156 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
157 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.
158 * @return length of the message in bytes (excluding serial stream start sign)
159 */
160static inline uint16_t mavlink_msg_storage_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
161 uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage)
162{
163#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
165 _mav_put_uint32_t(buf, 0, time_boot_ms);
166 _mav_put_float(buf, 4, total_capacity);
167 _mav_put_float(buf, 8, used_capacity);
168 _mav_put_float(buf, 12, available_capacity);
169 _mav_put_float(buf, 16, read_speed);
170 _mav_put_float(buf, 20, write_speed);
171 _mav_put_uint8_t(buf, 24, storage_id);
172 _mav_put_uint8_t(buf, 25, storage_count);
173 _mav_put_uint8_t(buf, 26, status);
174 _mav_put_uint8_t(buf, 27, type);
175 _mav_put_uint8_t(buf, 60, storage_usage);
176 _mav_put_char_array(buf, 28, name, 32);
177 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
178#else
179 mavlink_storage_information_t packet;
180 packet.time_boot_ms = time_boot_ms;
181 packet.total_capacity = total_capacity;
182 packet.used_capacity = used_capacity;
183 packet.available_capacity = available_capacity;
184 packet.read_speed = read_speed;
185 packet.write_speed = write_speed;
186 packet.storage_id = storage_id;
187 packet.storage_count = storage_count;
188 packet.status = status;
189 packet.type = type;
190 packet.storage_usage = storage_usage;
191 mav_array_memcpy(packet.name, name, sizeof(char)*32);
192 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
193#endif
194
196#if MAVLINK_CRC_EXTRA
197 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
198#else
199 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
200#endif
201}
202
203/**
204 * @brief Pack a storage_information message on a channel
205 * @param system_id ID of this system
206 * @param component_id ID of this component (e.g. 200 for IMU)
207 * @param chan The MAVLink channel this message will be sent over
208 * @param msg The MAVLink message to compress the data into
209 * @param time_boot_ms [ms] Timestamp (time since system boot).
210 * @param storage_id Storage ID (1 for first, 2 for second, etc.)
211 * @param storage_count Number of storage devices
212 * @param status Status of storage
213 * @param total_capacity [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
214 * @param used_capacity [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
215 * @param available_capacity [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
216 * @param read_speed [MiB/s] Read speed.
217 * @param write_speed [MiB/s] Write speed.
218 * @param type Type of storage
219 * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.
220 * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc.
221 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
222 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
223 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.
224 * @return length of the message in bytes (excluding serial stream start sign)
225 */
226static inline uint16_t mavlink_msg_storage_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
227 mavlink_message_t* msg,
228 uint32_t time_boot_ms,uint8_t storage_id,uint8_t storage_count,uint8_t status,float total_capacity,float used_capacity,float available_capacity,float read_speed,float write_speed,uint8_t type,const char *name,uint8_t storage_usage)
229{
230#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
232 _mav_put_uint32_t(buf, 0, time_boot_ms);
233 _mav_put_float(buf, 4, total_capacity);
234 _mav_put_float(buf, 8, used_capacity);
235 _mav_put_float(buf, 12, available_capacity);
236 _mav_put_float(buf, 16, read_speed);
237 _mav_put_float(buf, 20, write_speed);
238 _mav_put_uint8_t(buf, 24, storage_id);
239 _mav_put_uint8_t(buf, 25, storage_count);
240 _mav_put_uint8_t(buf, 26, status);
241 _mav_put_uint8_t(buf, 27, type);
242 _mav_put_uint8_t(buf, 60, storage_usage);
243 _mav_put_char_array(buf, 28, name, 32);
244 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
245#else
246 mavlink_storage_information_t packet;
247 packet.time_boot_ms = time_boot_ms;
248 packet.total_capacity = total_capacity;
249 packet.used_capacity = used_capacity;
250 packet.available_capacity = available_capacity;
251 packet.read_speed = read_speed;
252 packet.write_speed = write_speed;
253 packet.storage_id = storage_id;
254 packet.storage_count = storage_count;
255 packet.status = status;
256 packet.type = type;
257 packet.storage_usage = storage_usage;
258 mav_array_memcpy(packet.name, name, sizeof(char)*32);
259 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
260#endif
261
263 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
264}
265
266/**
267 * @brief Encode a storage_information struct
268 *
269 * @param system_id ID of this system
270 * @param component_id ID of this component (e.g. 200 for IMU)
271 * @param msg The MAVLink message to compress the data into
272 * @param storage_information C-struct to read the message contents from
273 */
274static inline uint16_t mavlink_msg_storage_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information)
275{
276 return mavlink_msg_storage_information_pack(system_id, component_id, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage);
277}
278
279/**
280 * @brief Encode a storage_information struct on a channel
281 *
282 * @param system_id ID of this system
283 * @param component_id ID of this component (e.g. 200 for IMU)
284 * @param chan The MAVLink channel this message will be sent over
285 * @param msg The MAVLink message to compress the data into
286 * @param storage_information C-struct to read the message contents from
287 */
288static inline uint16_t mavlink_msg_storage_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information)
289{
290 return mavlink_msg_storage_information_pack_chan(system_id, component_id, chan, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage);
291}
292
293/**
294 * @brief Encode a storage_information struct with provided status structure
295 *
296 * @param system_id ID of this system
297 * @param component_id ID of this component (e.g. 200 for IMU)
298 * @param status MAVLink status structure
299 * @param msg The MAVLink message to compress the data into
300 * @param storage_information C-struct to read the message contents from
301 */
302static inline uint16_t mavlink_msg_storage_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_storage_information_t* storage_information)
303{
304 return mavlink_msg_storage_information_pack_status(system_id, component_id, _status, msg, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage);
305}
306
307/**
308 * @brief Send a storage_information message
309 * @param chan MAVLink channel to send the message
310 *
311 * @param time_boot_ms [ms] Timestamp (time since system boot).
312 * @param storage_id Storage ID (1 for first, 2 for second, etc.)
313 * @param storage_count Number of storage devices
314 * @param status Status of storage
315 * @param total_capacity [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
316 * @param used_capacity [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
317 * @param available_capacity [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
318 * @param read_speed [MiB/s] Read speed.
319 * @param write_speed [MiB/s] Write speed.
320 * @param type Type of storage
321 * @param name Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.
322 * @param storage_usage Flags indicating whether this instance is preferred storage for photos, videos, etc.
323 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
324 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
325 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.
326 */
327#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
328
329static inline void mavlink_msg_storage_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage)
330{
331#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
332 char buf[MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN];
333 _mav_put_uint32_t(buf, 0, time_boot_ms);
334 _mav_put_float(buf, 4, total_capacity);
335 _mav_put_float(buf, 8, used_capacity);
336 _mav_put_float(buf, 12, available_capacity);
337 _mav_put_float(buf, 16, read_speed);
338 _mav_put_float(buf, 20, write_speed);
339 _mav_put_uint8_t(buf, 24, storage_id);
340 _mav_put_uint8_t(buf, 25, storage_count);
341 _mav_put_uint8_t(buf, 26, status);
342 _mav_put_uint8_t(buf, 27, type);
343 _mav_put_uint8_t(buf, 60, storage_usage);
344 _mav_put_char_array(buf, 28, name, 32);
345 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
346#else
347 mavlink_storage_information_t packet;
348 packet.time_boot_ms = time_boot_ms;
349 packet.total_capacity = total_capacity;
350 packet.used_capacity = used_capacity;
351 packet.available_capacity = available_capacity;
352 packet.read_speed = read_speed;
353 packet.write_speed = write_speed;
354 packet.storage_id = storage_id;
355 packet.storage_count = storage_count;
356 packet.status = status;
357 packet.type = type;
358 packet.storage_usage = storage_usage;
359 mav_array_memcpy(packet.name, name, sizeof(char)*32);
360 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
361#endif
362}
363
364/**
365 * @brief Send a storage_information message
366 * @param chan MAVLink channel to send the message
367 * @param struct The MAVLink struct to serialize
368 */
369static inline void mavlink_msg_storage_information_send_struct(mavlink_channel_t chan, const mavlink_storage_information_t* storage_information)
370{
371#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
372 mavlink_msg_storage_information_send(chan, storage_information->time_boot_ms, storage_information->storage_id, storage_information->storage_count, storage_information->status, storage_information->total_capacity, storage_information->used_capacity, storage_information->available_capacity, storage_information->read_speed, storage_information->write_speed, storage_information->type, storage_information->name, storage_information->storage_usage);
373#else
374 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)storage_information, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
375#endif
376}
377
378#if MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
379/*
380 This variant of _send() can be used to save stack space by reusing
381 memory from the receive buffer. The caller provides a
382 mavlink_message_t which is the size of a full mavlink message. This
383 is usually the receive buffer for the channel, and allows a reply to an
384 incoming message with minimum stack space usage.
385 */
386static inline void mavlink_msg_storage_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t storage_id, uint8_t storage_count, uint8_t status, float total_capacity, float used_capacity, float available_capacity, float read_speed, float write_speed, uint8_t type, const char *name, uint8_t storage_usage)
387{
388#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
389 char *buf = (char *)msgbuf;
390 _mav_put_uint32_t(buf, 0, time_boot_ms);
391 _mav_put_float(buf, 4, total_capacity);
392 _mav_put_float(buf, 8, used_capacity);
393 _mav_put_float(buf, 12, available_capacity);
394 _mav_put_float(buf, 16, read_speed);
395 _mav_put_float(buf, 20, write_speed);
396 _mav_put_uint8_t(buf, 24, storage_id);
397 _mav_put_uint8_t(buf, 25, storage_count);
398 _mav_put_uint8_t(buf, 26, status);
399 _mav_put_uint8_t(buf, 27, type);
400 _mav_put_uint8_t(buf, 60, storage_usage);
401 _mav_put_char_array(buf, 28, name, 32);
402 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, buf, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
403#else
404 mavlink_storage_information_t *packet = (mavlink_storage_information_t *)msgbuf;
405 packet->time_boot_ms = time_boot_ms;
406 packet->total_capacity = total_capacity;
407 packet->used_capacity = used_capacity;
408 packet->available_capacity = available_capacity;
409 packet->read_speed = read_speed;
410 packet->write_speed = write_speed;
411 packet->storage_id = storage_id;
412 packet->storage_count = storage_count;
413 packet->status = status;
414 packet->type = type;
415 packet->storage_usage = storage_usage;
416 mav_array_memcpy(packet->name, name, sizeof(char)*32);
417 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_STORAGE_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_STORAGE_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN, MAVLINK_MSG_ID_STORAGE_INFORMATION_CRC);
418#endif
419}
420#endif
421
422#endif
423
424// MESSAGE STORAGE_INFORMATION UNPACKING
425
426
427/**
428 * @brief Get field time_boot_ms from storage_information message
429 *
430 * @return [ms] Timestamp (time since system boot).
431 */
432static inline uint32_t mavlink_msg_storage_information_get_time_boot_ms(const mavlink_message_t* msg)
433{
434 return _MAV_RETURN_uint32_t(msg, 0);
435}
436
437/**
438 * @brief Get field storage_id from storage_information message
439 *
440 * @return Storage ID (1 for first, 2 for second, etc.)
441 */
442static inline uint8_t mavlink_msg_storage_information_get_storage_id(const mavlink_message_t* msg)
443{
444 return _MAV_RETURN_uint8_t(msg, 24);
445}
446
447/**
448 * @brief Get field storage_count from storage_information message
449 *
450 * @return Number of storage devices
451 */
452static inline uint8_t mavlink_msg_storage_information_get_storage_count(const mavlink_message_t* msg)
453{
454 return _MAV_RETURN_uint8_t(msg, 25);
455}
456
457/**
458 * @brief Get field status from storage_information message
459 *
460 * @return Status of storage
461 */
462static inline uint8_t mavlink_msg_storage_information_get_status(const mavlink_message_t* msg)
463{
464 return _MAV_RETURN_uint8_t(msg, 26);
465}
466
467/**
468 * @brief Get field total_capacity from storage_information message
469 *
470 * @return [MiB] Total capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
471 */
472static inline float mavlink_msg_storage_information_get_total_capacity(const mavlink_message_t* msg)
473{
474 return _MAV_RETURN_float(msg, 4);
475}
476
477/**
478 * @brief Get field used_capacity from storage_information message
479 *
480 * @return [MiB] Used capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
481 */
482static inline float mavlink_msg_storage_information_get_used_capacity(const mavlink_message_t* msg)
483{
484 return _MAV_RETURN_float(msg, 8);
485}
486
487/**
488 * @brief Get field available_capacity from storage_information message
489 *
490 * @return [MiB] Available storage capacity. If storage is not ready (STORAGE_STATUS_READY) value will be ignored.
491 */
492static inline float mavlink_msg_storage_information_get_available_capacity(const mavlink_message_t* msg)
493{
494 return _MAV_RETURN_float(msg, 12);
495}
496
497/**
498 * @brief Get field read_speed from storage_information message
499 *
500 * @return [MiB/s] Read speed.
501 */
502static inline float mavlink_msg_storage_information_get_read_speed(const mavlink_message_t* msg)
503{
504 return _MAV_RETURN_float(msg, 16);
505}
506
507/**
508 * @brief Get field write_speed from storage_information message
509 *
510 * @return [MiB/s] Write speed.
511 */
512static inline float mavlink_msg_storage_information_get_write_speed(const mavlink_message_t* msg)
513{
514 return _MAV_RETURN_float(msg, 20);
515}
516
517/**
518 * @brief Get field type from storage_information message
519 *
520 * @return Type of storage
521 */
522static inline uint8_t mavlink_msg_storage_information_get_type(const mavlink_message_t* msg)
523{
524 return _MAV_RETURN_uint8_t(msg, 27);
525}
526
527/**
528 * @brief Get field name from storage_information message
529 *
530 * @return Textual storage name to be used in UI (microSD 1, Internal Memory, etc.) This is a NULL terminated string. If it is exactly 32 characters long, add a terminating NULL. If this string is empty, the generic type is shown to the user.
531 */
532static inline uint16_t mavlink_msg_storage_information_get_name(const mavlink_message_t* msg, char *name)
533{
534 return _MAV_RETURN_char_array(msg, name, 32, 28);
535}
536
537/**
538 * @brief Get field storage_usage from storage_information message
539 *
540 * @return Flags indicating whether this instance is preferred storage for photos, videos, etc.
541 Note: Implementations should initially set the flags on the system-default storage id used for saving media (if possible/supported).
542 This setting can then be overridden using MAV_CMD_SET_STORAGE_USAGE.
543 If the media usage flags are not set, a GCS may assume storage ID 1 is the default storage for all media types.
544 */
545static inline uint8_t mavlink_msg_storage_information_get_storage_usage(const mavlink_message_t* msg)
546{
547 return _MAV_RETURN_uint8_t(msg, 60);
548}
549
550/**
551 * @brief Decode a storage_information message into a struct
552 *
553 * @param msg The message to decode
554 * @param storage_information C-struct to decode the message contents into
555 */
556static inline void mavlink_msg_storage_information_decode(const mavlink_message_t* msg, mavlink_storage_information_t* storage_information)
557{
558#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
559 storage_information->time_boot_ms = mavlink_msg_storage_information_get_time_boot_ms(msg);
560 storage_information->total_capacity = mavlink_msg_storage_information_get_total_capacity(msg);
561 storage_information->used_capacity = mavlink_msg_storage_information_get_used_capacity(msg);
562 storage_information->available_capacity = mavlink_msg_storage_information_get_available_capacity(msg);
563 storage_information->read_speed = mavlink_msg_storage_information_get_read_speed(msg);
564 storage_information->write_speed = mavlink_msg_storage_information_get_write_speed(msg);
565 storage_information->storage_id = mavlink_msg_storage_information_get_storage_id(msg);
566 storage_information->storage_count = mavlink_msg_storage_information_get_storage_count(msg);
567 storage_information->status = mavlink_msg_storage_information_get_status(msg);
568 storage_information->type = mavlink_msg_storage_information_get_type(msg);
569 mavlink_msg_storage_information_get_name(msg, storage_information->name);
570 storage_information->storage_usage = mavlink_msg_storage_information_get_storage_usage(msg);
571#else
572 uint8_t len = msg->len < MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN;
573 memset(storage_information, 0, MAVLINK_MSG_ID_STORAGE_INFORMATION_LEN);
574 memcpy(storage_information, _MAV_PAYLOAD(msg), len);
575#endif
576}