RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_camera_capture_status.h
1#pragma once
2// MESSAGE CAMERA_CAPTURE_STATUS PACKING
3
4#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS 262
5
6MAVPACKED(
7typedef struct __mavlink_camera_capture_status_t {
8 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
9 float image_interval; /*< Image capture interval in seconds*/
10 uint32_t recording_time_ms; /*< Time in milliseconds since recording started*/
11 float available_capacity; /*< Available storage capacity in MiB*/
12 uint8_t image_status; /*< Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)*/
13 uint8_t video_status; /*< Current status of video capturing (0: idle, 1: capture in progress)*/
14}) mavlink_camera_capture_status_t;
15
16#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN 18
17#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN 18
18#define MAVLINK_MSG_ID_262_LEN 18
19#define MAVLINK_MSG_ID_262_MIN_LEN 18
20
21#define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC 12
22#define MAVLINK_MSG_ID_262_CRC 12
23
24
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \
28 262, \
29 "CAMERA_CAPTURE_STATUS", \
30 6, \
31 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \
32 { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \
33 { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \
34 { "image_interval", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_capture_status_t, image_interval) }, \
35 { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \
36 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \
37 } \
38}
39#else
40#define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \
41 "CAMERA_CAPTURE_STATUS", \
42 6, \
43 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \
44 { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \
45 { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \
46 { "image_interval", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_capture_status_t, image_interval) }, \
47 { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \
48 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \
49 } \
50}
51#endif
52
53/**
54 * @brief Pack a camera_capture_status message
55 * @param system_id ID of this system
56 * @param component_id ID of this component (e.g. 200 for IMU)
57 * @param msg The MAVLink message to compress the data into
58 *
59 * @param time_boot_ms Timestamp (milliseconds since system boot)
60 * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)
61 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
62 * @param image_interval Image capture interval in seconds
63 * @param recording_time_ms Time in milliseconds since recording started
64 * @param available_capacity Available storage capacity in MiB
65 * @return length of the message in bytes (excluding serial stream start sign)
66 */
67static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity)
69{
70#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
72 _mav_put_uint32_t(buf, 0, time_boot_ms);
73 _mav_put_float(buf, 4, image_interval);
74 _mav_put_uint32_t(buf, 8, recording_time_ms);
75 _mav_put_float(buf, 12, available_capacity);
76 _mav_put_uint8_t(buf, 16, image_status);
77 _mav_put_uint8_t(buf, 17, video_status);
78
79 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
80#else
81 mavlink_camera_capture_status_t packet;
82 packet.time_boot_ms = time_boot_ms;
83 packet.image_interval = image_interval;
84 packet.recording_time_ms = recording_time_ms;
85 packet.available_capacity = available_capacity;
86 packet.image_status = image_status;
87 packet.video_status = video_status;
88
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
90#endif
91
92 msg->msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS;
93 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
94}
95
96/**
97 * @brief Pack a camera_capture_status message on a channel
98 * @param system_id ID of this system
99 * @param component_id ID of this component (e.g. 200 for IMU)
100 * @param chan The MAVLink channel this message will be sent over
101 * @param msg The MAVLink message to compress the data into
102 * @param time_boot_ms Timestamp (milliseconds since system boot)
103 * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)
104 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
105 * @param image_interval Image capture interval in seconds
106 * @param recording_time_ms Time in milliseconds since recording started
107 * @param available_capacity Available storage capacity in MiB
108 * @return length of the message in bytes (excluding serial stream start sign)
109 */
110static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
111 mavlink_message_t* msg,
112 uint32_t time_boot_ms,uint8_t image_status,uint8_t video_status,float image_interval,uint32_t recording_time_ms,float available_capacity)
113{
114#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
115 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
116 _mav_put_uint32_t(buf, 0, time_boot_ms);
117 _mav_put_float(buf, 4, image_interval);
118 _mav_put_uint32_t(buf, 8, recording_time_ms);
119 _mav_put_float(buf, 12, available_capacity);
120 _mav_put_uint8_t(buf, 16, image_status);
121 _mav_put_uint8_t(buf, 17, video_status);
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
124#else
125 mavlink_camera_capture_status_t packet;
126 packet.time_boot_ms = time_boot_ms;
127 packet.image_interval = image_interval;
128 packet.recording_time_ms = recording_time_ms;
129 packet.available_capacity = available_capacity;
130 packet.image_status = image_status;
131 packet.video_status = video_status;
132
133 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
134#endif
135
136 msg->msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS;
137 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
138}
139
140/**
141 * @brief Encode a camera_capture_status struct
142 *
143 * @param system_id ID of this system
144 * @param component_id ID of this component (e.g. 200 for IMU)
145 * @param msg The MAVLink message to compress the data into
146 * @param camera_capture_status C-struct to read the message contents from
147 */
148static inline uint16_t mavlink_msg_camera_capture_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_capture_status_t* camera_capture_status)
149{
150 return mavlink_msg_camera_capture_status_pack(system_id, component_id, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity);
151}
152
153/**
154 * @brief Encode a camera_capture_status struct on a channel
155 *
156 * @param system_id ID of this system
157 * @param component_id ID of this component (e.g. 200 for IMU)
158 * @param chan The MAVLink channel this message will be sent over
159 * @param msg The MAVLink message to compress the data into
160 * @param camera_capture_status C-struct to read the message contents from
161 */
162static inline uint16_t mavlink_msg_camera_capture_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_capture_status_t* camera_capture_status)
163{
164 return mavlink_msg_camera_capture_status_pack_chan(system_id, component_id, chan, msg, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity);
165}
166
167/**
168 * @brief Send a camera_capture_status message
169 * @param chan MAVLink channel to send the message
170 *
171 * @param time_boot_ms Timestamp (milliseconds since system boot)
172 * @param image_status Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)
173 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
174 * @param image_interval Image capture interval in seconds
175 * @param recording_time_ms Time in milliseconds since recording started
176 * @param available_capacity Available storage capacity in MiB
177 */
178#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
179
180static inline void mavlink_msg_camera_capture_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity)
181{
182#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
183 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
184 _mav_put_uint32_t(buf, 0, time_boot_ms);
185 _mav_put_float(buf, 4, image_interval);
186 _mav_put_uint32_t(buf, 8, recording_time_ms);
187 _mav_put_float(buf, 12, available_capacity);
188 _mav_put_uint8_t(buf, 16, image_status);
189 _mav_put_uint8_t(buf, 17, video_status);
190
191 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
192#else
193 mavlink_camera_capture_status_t packet;
194 packet.time_boot_ms = time_boot_ms;
195 packet.image_interval = image_interval;
196 packet.recording_time_ms = recording_time_ms;
197 packet.available_capacity = available_capacity;
198 packet.image_status = image_status;
199 packet.video_status = video_status;
200
201 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
202#endif
203}
204
205/**
206 * @brief Send a camera_capture_status message
207 * @param chan MAVLink channel to send the message
208 * @param struct The MAVLink struct to serialize
209 */
210static inline void mavlink_msg_camera_capture_status_send_struct(mavlink_channel_t chan, const mavlink_camera_capture_status_t* camera_capture_status)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 mavlink_msg_camera_capture_status_send(chan, camera_capture_status->time_boot_ms, camera_capture_status->image_status, camera_capture_status->video_status, camera_capture_status->image_interval, camera_capture_status->recording_time_ms, camera_capture_status->available_capacity);
214#else
215 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)camera_capture_status, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
216#endif
217}
218
219#if MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
220/*
221 This varient of _send() can be used to save stack space by re-using
222 memory from the receive buffer. The caller provides a
223 mavlink_message_t which is the size of a full mavlink message. This
224 is usually the receive buffer for the channel, and allows a reply to an
225 incoming message with minimum stack space usage.
226 */
227static inline void mavlink_msg_camera_capture_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 char *buf = (char *)msgbuf;
231 _mav_put_uint32_t(buf, 0, time_boot_ms);
232 _mav_put_float(buf, 4, image_interval);
233 _mav_put_uint32_t(buf, 8, recording_time_ms);
234 _mav_put_float(buf, 12, available_capacity);
235 _mav_put_uint8_t(buf, 16, image_status);
236 _mav_put_uint8_t(buf, 17, video_status);
237
238 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
239#else
240 mavlink_camera_capture_status_t *packet = (mavlink_camera_capture_status_t *)msgbuf;
241 packet->time_boot_ms = time_boot_ms;
242 packet->image_interval = image_interval;
243 packet->recording_time_ms = recording_time_ms;
244 packet->available_capacity = available_capacity;
245 packet->image_status = image_status;
246 packet->video_status = video_status;
247
248 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC);
249#endif
250}
251#endif
252
253#endif
254
255// MESSAGE CAMERA_CAPTURE_STATUS UNPACKING
256
257
258/**
259 * @brief Get field time_boot_ms from camera_capture_status message
260 *
261 * @return Timestamp (milliseconds since system boot)
262 */
263static inline uint32_t mavlink_msg_camera_capture_status_get_time_boot_ms(const mavlink_message_t* msg)
264{
265 return _MAV_RETURN_uint32_t(msg, 0);
266}
267
268/**
269 * @brief Get field image_status from camera_capture_status message
270 *
271 * @return Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)
272 */
273static inline uint8_t mavlink_msg_camera_capture_status_get_image_status(const mavlink_message_t* msg)
274{
275 return _MAV_RETURN_uint8_t(msg, 16);
276}
277
278/**
279 * @brief Get field video_status from camera_capture_status message
280 *
281 * @return Current status of video capturing (0: idle, 1: capture in progress)
282 */
283static inline uint8_t mavlink_msg_camera_capture_status_get_video_status(const mavlink_message_t* msg)
284{
285 return _MAV_RETURN_uint8_t(msg, 17);
286}
287
288/**
289 * @brief Get field image_interval from camera_capture_status message
290 *
291 * @return Image capture interval in seconds
292 */
293static inline float mavlink_msg_camera_capture_status_get_image_interval(const mavlink_message_t* msg)
294{
295 return _MAV_RETURN_float(msg, 4);
296}
297
298/**
299 * @brief Get field recording_time_ms from camera_capture_status message
300 *
301 * @return Time in milliseconds since recording started
302 */
303static inline uint32_t mavlink_msg_camera_capture_status_get_recording_time_ms(const mavlink_message_t* msg)
304{
305 return _MAV_RETURN_uint32_t(msg, 8);
306}
307
308/**
309 * @brief Get field available_capacity from camera_capture_status message
310 *
311 * @return Available storage capacity in MiB
312 */
313static inline float mavlink_msg_camera_capture_status_get_available_capacity(const mavlink_message_t* msg)
314{
315 return _MAV_RETURN_float(msg, 12);
316}
317
318/**
319 * @brief Decode a camera_capture_status message into a struct
320 *
321 * @param msg The message to decode
322 * @param camera_capture_status C-struct to decode the message contents into
323 */
324static inline void mavlink_msg_camera_capture_status_decode(const mavlink_message_t* msg, mavlink_camera_capture_status_t* camera_capture_status)
325{
326#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
327 camera_capture_status->time_boot_ms = mavlink_msg_camera_capture_status_get_time_boot_ms(msg);
328 camera_capture_status->image_interval = mavlink_msg_camera_capture_status_get_image_interval(msg);
329 camera_capture_status->recording_time_ms = mavlink_msg_camera_capture_status_get_recording_time_ms(msg);
330 camera_capture_status->available_capacity = mavlink_msg_camera_capture_status_get_available_capacity(msg);
331 camera_capture_status->image_status = mavlink_msg_camera_capture_status_get_image_status(msg);
332 camera_capture_status->video_status = mavlink_msg_camera_capture_status_get_video_status(msg);
333#else
334 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN;
335 memset(camera_capture_status, 0, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
336 memcpy(camera_capture_status, _MAV_PAYLOAD(msg), len);
337#endif
338}