Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_camera_capture_status.h
blob8951db6a79f525674dc4e8f66b898b8375d47fe4
1 #pragma once
2 // MESSAGE CAMERA_CAPTURE_STATUS PACKING
4 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS 262
6 MAVPACKED(
7 typedef struct __mavlink_camera_capture_status_t {
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 float image_interval; /*< [s] Image capture interval*/
10 uint32_t recording_time_ms; /*< [ms] Time since recording started*/
11 float available_capacity; /*< [MiB] Available storage capacity.*/
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 int32_t image_count; /*< Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).*/
15 }) mavlink_camera_capture_status_t;
17 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN 22
18 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_MIN_LEN 18
19 #define MAVLINK_MSG_ID_262_LEN 22
20 #define MAVLINK_MSG_ID_262_MIN_LEN 18
22 #define MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_CRC 12
23 #define MAVLINK_MSG_ID_262_CRC 12
27 #if MAVLINK_COMMAND_24BIT
28 #define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \
29 262, \
30 "CAMERA_CAPTURE_STATUS", \
31 7, \
32 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \
33 { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \
34 { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \
35 { "image_interval", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_capture_status_t, image_interval) }, \
36 { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \
37 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \
38 { "image_count", NULL, MAVLINK_TYPE_INT32_T, 0, 18, offsetof(mavlink_camera_capture_status_t, image_count) }, \
39 } \
41 #else
42 #define MAVLINK_MESSAGE_INFO_CAMERA_CAPTURE_STATUS { \
43 "CAMERA_CAPTURE_STATUS", \
44 7, \
45 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_capture_status_t, time_boot_ms) }, \
46 { "image_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 16, offsetof(mavlink_camera_capture_status_t, image_status) }, \
47 { "video_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 17, offsetof(mavlink_camera_capture_status_t, video_status) }, \
48 { "image_interval", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_camera_capture_status_t, image_interval) }, \
49 { "recording_time_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_capture_status_t, recording_time_ms) }, \
50 { "available_capacity", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_capture_status_t, available_capacity) }, \
51 { "image_count", NULL, MAVLINK_TYPE_INT32_T, 0, 18, offsetof(mavlink_camera_capture_status_t, image_count) }, \
52 } \
54 #endif
56 /**
57 * @brief Pack a camera_capture_status message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
62 * @param time_boot_ms [ms] Timestamp (time since system boot).
63 * @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)
64 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
65 * @param image_interval [s] Image capture interval
66 * @param recording_time_ms [ms] Time since recording started
67 * @param available_capacity [MiB] Available storage capacity.
68 * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).
69 * @return length of the message in bytes (excluding serial stream start sign)
71 static inline uint16_t mavlink_msg_camera_capture_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint32_t time_boot_ms, uint8_t image_status, uint8_t video_status, float image_interval, uint32_t recording_time_ms, float available_capacity, int32_t image_count)
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
76 _mav_put_uint32_t(buf, 0, time_boot_ms);
77 _mav_put_float(buf, 4, image_interval);
78 _mav_put_uint32_t(buf, 8, recording_time_ms);
79 _mav_put_float(buf, 12, available_capacity);
80 _mav_put_uint8_t(buf, 16, image_status);
81 _mav_put_uint8_t(buf, 17, video_status);
82 _mav_put_int32_t(buf, 18, image_count);
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
85 #else
86 mavlink_camera_capture_status_t packet;
87 packet.time_boot_ms = time_boot_ms;
88 packet.image_interval = image_interval;
89 packet.recording_time_ms = recording_time_ms;
90 packet.available_capacity = available_capacity;
91 packet.image_status = image_status;
92 packet.video_status = video_status;
93 packet.image_count = image_count;
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
96 #endif
98 msg->msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS;
99 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);
103 * @brief Pack a camera_capture_status message on a channel
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param chan The MAVLink channel this message will be sent over
107 * @param msg The MAVLink message to compress the data into
108 * @param time_boot_ms [ms] Timestamp (time since system boot).
109 * @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)
110 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
111 * @param image_interval [s] Image capture interval
112 * @param recording_time_ms [ms] Time since recording started
113 * @param available_capacity [MiB] Available storage capacity.
114 * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).
115 * @return length of the message in bytes (excluding serial stream start sign)
117 static inline uint16_t mavlink_msg_camera_capture_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
118 mavlink_message_t* msg,
119 uint32_t time_boot_ms,uint8_t image_status,uint8_t video_status,float image_interval,uint32_t recording_time_ms,float available_capacity,int32_t image_count)
121 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
123 _mav_put_uint32_t(buf, 0, time_boot_ms);
124 _mav_put_float(buf, 4, image_interval);
125 _mav_put_uint32_t(buf, 8, recording_time_ms);
126 _mav_put_float(buf, 12, available_capacity);
127 _mav_put_uint8_t(buf, 16, image_status);
128 _mav_put_uint8_t(buf, 17, video_status);
129 _mav_put_int32_t(buf, 18, image_count);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
132 #else
133 mavlink_camera_capture_status_t packet;
134 packet.time_boot_ms = time_boot_ms;
135 packet.image_interval = image_interval;
136 packet.recording_time_ms = recording_time_ms;
137 packet.available_capacity = available_capacity;
138 packet.image_status = image_status;
139 packet.video_status = video_status;
140 packet.image_count = image_count;
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
143 #endif
145 msg->msgid = MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS;
146 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);
150 * @brief Encode a camera_capture_status struct
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param msg The MAVLink message to compress the data into
155 * @param camera_capture_status C-struct to read the message contents from
157 static 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)
159 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, camera_capture_status->image_count);
163 * @brief Encode a camera_capture_status struct on a channel
165 * @param system_id ID of this system
166 * @param component_id ID of this component (e.g. 200 for IMU)
167 * @param chan The MAVLink channel this message will be sent over
168 * @param msg The MAVLink message to compress the data into
169 * @param camera_capture_status C-struct to read the message contents from
171 static 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)
173 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, camera_capture_status->image_count);
177 * @brief Send a camera_capture_status message
178 * @param chan MAVLink channel to send the message
180 * @param time_boot_ms [ms] Timestamp (time since system boot).
181 * @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)
182 * @param video_status Current status of video capturing (0: idle, 1: capture in progress)
183 * @param image_interval [s] Image capture interval
184 * @param recording_time_ms [ms] Time since recording started
185 * @param available_capacity [MiB] Available storage capacity.
186 * @param image_count Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).
188 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
190 static 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, int32_t image_count)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN];
194 _mav_put_uint32_t(buf, 0, time_boot_ms);
195 _mav_put_float(buf, 4, image_interval);
196 _mav_put_uint32_t(buf, 8, recording_time_ms);
197 _mav_put_float(buf, 12, available_capacity);
198 _mav_put_uint8_t(buf, 16, image_status);
199 _mav_put_uint8_t(buf, 17, video_status);
200 _mav_put_int32_t(buf, 18, image_count);
202 _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);
203 #else
204 mavlink_camera_capture_status_t packet;
205 packet.time_boot_ms = time_boot_ms;
206 packet.image_interval = image_interval;
207 packet.recording_time_ms = recording_time_ms;
208 packet.available_capacity = available_capacity;
209 packet.image_status = image_status;
210 packet.video_status = video_status;
211 packet.image_count = image_count;
213 _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);
214 #endif
218 * @brief Send a camera_capture_status message
219 * @param chan MAVLink channel to send the message
220 * @param struct The MAVLink struct to serialize
222 static inline void mavlink_msg_camera_capture_status_send_struct(mavlink_channel_t chan, const mavlink_camera_capture_status_t* camera_capture_status)
224 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 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, camera_capture_status->image_count);
226 #else
227 _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);
228 #endif
231 #if MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
239 static 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, int32_t image_count)
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_uint32_t(buf, 0, time_boot_ms);
244 _mav_put_float(buf, 4, image_interval);
245 _mav_put_uint32_t(buf, 8, recording_time_ms);
246 _mav_put_float(buf, 12, available_capacity);
247 _mav_put_uint8_t(buf, 16, image_status);
248 _mav_put_uint8_t(buf, 17, video_status);
249 _mav_put_int32_t(buf, 18, image_count);
251 _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);
252 #else
253 mavlink_camera_capture_status_t *packet = (mavlink_camera_capture_status_t *)msgbuf;
254 packet->time_boot_ms = time_boot_ms;
255 packet->image_interval = image_interval;
256 packet->recording_time_ms = recording_time_ms;
257 packet->available_capacity = available_capacity;
258 packet->image_status = image_status;
259 packet->video_status = video_status;
260 packet->image_count = image_count;
262 _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);
263 #endif
265 #endif
267 #endif
269 // MESSAGE CAMERA_CAPTURE_STATUS UNPACKING
273 * @brief Get field time_boot_ms from camera_capture_status message
275 * @return [ms] Timestamp (time since system boot).
277 static inline uint32_t mavlink_msg_camera_capture_status_get_time_boot_ms(const mavlink_message_t* msg)
279 return _MAV_RETURN_uint32_t(msg, 0);
283 * @brief Get field image_status from camera_capture_status message
285 * @return Current status of image capturing (0: idle, 1: capture in progress, 2: interval set but idle, 3: interval set and capture in progress)
287 static inline uint8_t mavlink_msg_camera_capture_status_get_image_status(const mavlink_message_t* msg)
289 return _MAV_RETURN_uint8_t(msg, 16);
293 * @brief Get field video_status from camera_capture_status message
295 * @return Current status of video capturing (0: idle, 1: capture in progress)
297 static inline uint8_t mavlink_msg_camera_capture_status_get_video_status(const mavlink_message_t* msg)
299 return _MAV_RETURN_uint8_t(msg, 17);
303 * @brief Get field image_interval from camera_capture_status message
305 * @return [s] Image capture interval
307 static inline float mavlink_msg_camera_capture_status_get_image_interval(const mavlink_message_t* msg)
309 return _MAV_RETURN_float(msg, 4);
313 * @brief Get field recording_time_ms from camera_capture_status message
315 * @return [ms] Time since recording started
317 static inline uint32_t mavlink_msg_camera_capture_status_get_recording_time_ms(const mavlink_message_t* msg)
319 return _MAV_RETURN_uint32_t(msg, 8);
323 * @brief Get field available_capacity from camera_capture_status message
325 * @return [MiB] Available storage capacity.
327 static inline float mavlink_msg_camera_capture_status_get_available_capacity(const mavlink_message_t* msg)
329 return _MAV_RETURN_float(msg, 12);
333 * @brief Get field image_count from camera_capture_status message
335 * @return Total number of images captured ('forever', or until reset using MAV_CMD_STORAGE_FORMAT).
337 static inline int32_t mavlink_msg_camera_capture_status_get_image_count(const mavlink_message_t* msg)
339 return _MAV_RETURN_int32_t(msg, 18);
343 * @brief Decode a camera_capture_status message into a struct
345 * @param msg The message to decode
346 * @param camera_capture_status C-struct to decode the message contents into
348 static inline void mavlink_msg_camera_capture_status_decode(const mavlink_message_t* msg, mavlink_camera_capture_status_t* camera_capture_status)
350 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 camera_capture_status->time_boot_ms = mavlink_msg_camera_capture_status_get_time_boot_ms(msg);
352 camera_capture_status->image_interval = mavlink_msg_camera_capture_status_get_image_interval(msg);
353 camera_capture_status->recording_time_ms = mavlink_msg_camera_capture_status_get_recording_time_ms(msg);
354 camera_capture_status->available_capacity = mavlink_msg_camera_capture_status_get_available_capacity(msg);
355 camera_capture_status->image_status = mavlink_msg_camera_capture_status_get_image_status(msg);
356 camera_capture_status->video_status = mavlink_msg_camera_capture_status_get_video_status(msg);
357 camera_capture_status->image_count = mavlink_msg_camera_capture_status_get_image_count(msg);
358 #else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN;
360 memset(camera_capture_status, 0, MAVLINK_MSG_ID_CAMERA_CAPTURE_STATUS_LEN);
361 memcpy(camera_capture_status, _MAV_PAYLOAD(msg), len);
362 #endif