RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_camera_status.h
1#pragma once
2// MESSAGE CAMERA_STATUS PACKING
3
4#define MAVLINK_MSG_ID_CAMERA_STATUS 179
5
6MAVPACKED(
7typedef struct __mavlink_camera_status_t {
8 uint64_t time_usec; /*< Image timestamp (microseconds since UNIX epoch, according to camera clock)*/
9 float p1; /*< Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum)*/
10 float p2; /*< Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum)*/
11 float p3; /*< Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum)*/
12 float p4; /*< Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum)*/
13 uint16_t img_idx; /*< Image index*/
14 uint8_t target_system; /*< System ID*/
15 uint8_t cam_idx; /*< Camera ID*/
16 uint8_t event_id; /*< See CAMERA_STATUS_TYPES enum for definition of the bitmask*/
17}) mavlink_camera_status_t;
18
19#define MAVLINK_MSG_ID_CAMERA_STATUS_LEN 29
20#define MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN 29
21#define MAVLINK_MSG_ID_179_LEN 29
22#define MAVLINK_MSG_ID_179_MIN_LEN 29
23
24#define MAVLINK_MSG_ID_CAMERA_STATUS_CRC 189
25#define MAVLINK_MSG_ID_179_CRC 189
26
27
28
29#if MAVLINK_COMMAND_24BIT
30#define MAVLINK_MESSAGE_INFO_CAMERA_STATUS { \
31 179, \
32 "CAMERA_STATUS", \
33 9, \
34 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_status_t, time_usec) }, \
35 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_camera_status_t, target_system) }, \
36 { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_camera_status_t, cam_idx) }, \
37 { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_status_t, img_idx) }, \
38 { "event_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_status_t, event_id) }, \
39 { "p1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_status_t, p1) }, \
40 { "p2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_status_t, p2) }, \
41 { "p3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_status_t, p3) }, \
42 { "p4", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_status_t, p4) }, \
43 } \
44}
45#else
46#define MAVLINK_MESSAGE_INFO_CAMERA_STATUS { \
47 "CAMERA_STATUS", \
48 9, \
49 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_status_t, time_usec) }, \
50 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_camera_status_t, target_system) }, \
51 { "cam_idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_camera_status_t, cam_idx) }, \
52 { "img_idx", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_status_t, img_idx) }, \
53 { "event_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_camera_status_t, event_id) }, \
54 { "p1", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_status_t, p1) }, \
55 { "p2", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_status_t, p2) }, \
56 { "p3", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_status_t, p3) }, \
57 { "p4", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_camera_status_t, p4) }, \
58 } \
59}
60#endif
61
62/**
63 * @brief Pack a camera_status message
64 * @param system_id ID of this system
65 * @param component_id ID of this component (e.g. 200 for IMU)
66 * @param msg The MAVLink message to compress the data into
67 *
68 * @param time_usec Image timestamp (microseconds since UNIX epoch, according to camera clock)
69 * @param target_system System ID
70 * @param cam_idx Camera ID
71 * @param img_idx Image index
72 * @param event_id See CAMERA_STATUS_TYPES enum for definition of the bitmask
73 * @param p1 Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
74 * @param p2 Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
75 * @param p3 Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
76 * @param p4 Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
77 * @return length of the message in bytes (excluding serial stream start sign)
78 */
79static inline uint16_t mavlink_msg_camera_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
80 uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4)
81{
82#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83 char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN];
84 _mav_put_uint64_t(buf, 0, time_usec);
85 _mav_put_float(buf, 8, p1);
86 _mav_put_float(buf, 12, p2);
87 _mav_put_float(buf, 16, p3);
88 _mav_put_float(buf, 20, p4);
89 _mav_put_uint16_t(buf, 24, img_idx);
90 _mav_put_uint8_t(buf, 26, target_system);
91 _mav_put_uint8_t(buf, 27, cam_idx);
92 _mav_put_uint8_t(buf, 28, event_id);
93
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_STATUS_LEN);
95#else
96 mavlink_camera_status_t packet;
97 packet.time_usec = time_usec;
98 packet.p1 = p1;
99 packet.p2 = p2;
100 packet.p3 = p3;
101 packet.p4 = p4;
102 packet.img_idx = img_idx;
103 packet.target_system = target_system;
104 packet.cam_idx = cam_idx;
105 packet.event_id = event_id;
106
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_STATUS_LEN);
108#endif
109
110 msg->msgid = MAVLINK_MSG_ID_CAMERA_STATUS;
111 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
112}
113
114/**
115 * @brief Pack a camera_status message on a channel
116 * @param system_id ID of this system
117 * @param component_id ID of this component (e.g. 200 for IMU)
118 * @param chan The MAVLink channel this message will be sent over
119 * @param msg The MAVLink message to compress the data into
120 * @param time_usec Image timestamp (microseconds since UNIX epoch, according to camera clock)
121 * @param target_system System ID
122 * @param cam_idx Camera ID
123 * @param img_idx Image index
124 * @param event_id See CAMERA_STATUS_TYPES enum for definition of the bitmask
125 * @param p1 Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
126 * @param p2 Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
127 * @param p3 Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
128 * @param p4 Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
129 * @return length of the message in bytes (excluding serial stream start sign)
130 */
131static inline uint16_t mavlink_msg_camera_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
132 mavlink_message_t* msg,
133 uint64_t time_usec,uint8_t target_system,uint8_t cam_idx,uint16_t img_idx,uint8_t event_id,float p1,float p2,float p3,float p4)
134{
135#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
136 char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN];
137 _mav_put_uint64_t(buf, 0, time_usec);
138 _mav_put_float(buf, 8, p1);
139 _mav_put_float(buf, 12, p2);
140 _mav_put_float(buf, 16, p3);
141 _mav_put_float(buf, 20, p4);
142 _mav_put_uint16_t(buf, 24, img_idx);
143 _mav_put_uint8_t(buf, 26, target_system);
144 _mav_put_uint8_t(buf, 27, cam_idx);
145 _mav_put_uint8_t(buf, 28, event_id);
146
147 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_STATUS_LEN);
148#else
149 mavlink_camera_status_t packet;
150 packet.time_usec = time_usec;
151 packet.p1 = p1;
152 packet.p2 = p2;
153 packet.p3 = p3;
154 packet.p4 = p4;
155 packet.img_idx = img_idx;
156 packet.target_system = target_system;
157 packet.cam_idx = cam_idx;
158 packet.event_id = event_id;
159
160 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_STATUS_LEN);
161#endif
162
163 msg->msgid = MAVLINK_MSG_ID_CAMERA_STATUS;
164 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
165}
166
167/**
168 * @brief Encode a camera_status struct
169 *
170 * @param system_id ID of this system
171 * @param component_id ID of this component (e.g. 200 for IMU)
172 * @param msg The MAVLink message to compress the data into
173 * @param camera_status C-struct to read the message contents from
174 */
175static inline uint16_t mavlink_msg_camera_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_status_t* camera_status)
176{
177 return mavlink_msg_camera_status_pack(system_id, component_id, msg, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4);
178}
179
180/**
181 * @brief Encode a camera_status struct on a channel
182 *
183 * @param system_id ID of this system
184 * @param component_id ID of this component (e.g. 200 for IMU)
185 * @param chan The MAVLink channel this message will be sent over
186 * @param msg The MAVLink message to compress the data into
187 * @param camera_status C-struct to read the message contents from
188 */
189static inline uint16_t mavlink_msg_camera_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_status_t* camera_status)
190{
191 return mavlink_msg_camera_status_pack_chan(system_id, component_id, chan, msg, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4);
192}
193
194/**
195 * @brief Send a camera_status message
196 * @param chan MAVLink channel to send the message
197 *
198 * @param time_usec Image timestamp (microseconds since UNIX epoch, according to camera clock)
199 * @param target_system System ID
200 * @param cam_idx Camera ID
201 * @param img_idx Image index
202 * @param event_id See CAMERA_STATUS_TYPES enum for definition of the bitmask
203 * @param p1 Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
204 * @param p2 Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
205 * @param p3 Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
206 * @param p4 Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
207 */
208#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
209
210static inline void mavlink_msg_camera_status_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4)
211{
212#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
213 char buf[MAVLINK_MSG_ID_CAMERA_STATUS_LEN];
214 _mav_put_uint64_t(buf, 0, time_usec);
215 _mav_put_float(buf, 8, p1);
216 _mav_put_float(buf, 12, p2);
217 _mav_put_float(buf, 16, p3);
218 _mav_put_float(buf, 20, p4);
219 _mav_put_uint16_t(buf, 24, img_idx);
220 _mav_put_uint8_t(buf, 26, target_system);
221 _mav_put_uint8_t(buf, 27, cam_idx);
222 _mav_put_uint8_t(buf, 28, event_id);
223
224 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, buf, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
225#else
226 mavlink_camera_status_t packet;
227 packet.time_usec = time_usec;
228 packet.p1 = p1;
229 packet.p2 = p2;
230 packet.p3 = p3;
231 packet.p4 = p4;
232 packet.img_idx = img_idx;
233 packet.target_system = target_system;
234 packet.cam_idx = cam_idx;
235 packet.event_id = event_id;
236
237 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
238#endif
239}
240
241/**
242 * @brief Send a camera_status message
243 * @param chan MAVLink channel to send the message
244 * @param struct The MAVLink struct to serialize
245 */
246static inline void mavlink_msg_camera_status_send_struct(mavlink_channel_t chan, const mavlink_camera_status_t* camera_status)
247{
248#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
249 mavlink_msg_camera_status_send(chan, camera_status->time_usec, camera_status->target_system, camera_status->cam_idx, camera_status->img_idx, camera_status->event_id, camera_status->p1, camera_status->p2, camera_status->p3, camera_status->p4);
250#else
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)camera_status, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
252#endif
253}
254
255#if MAVLINK_MSG_ID_CAMERA_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
256/*
257 This varient of _send() can be used to save stack space by re-using
258 memory from the receive buffer. The caller provides a
259 mavlink_message_t which is the size of a full mavlink message. This
260 is usually the receive buffer for the channel, and allows a reply to an
261 incoming message with minimum stack space usage.
262 */
263static inline void mavlink_msg_camera_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, uint8_t target_system, uint8_t cam_idx, uint16_t img_idx, uint8_t event_id, float p1, float p2, float p3, float p4)
264{
265#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
266 char *buf = (char *)msgbuf;
267 _mav_put_uint64_t(buf, 0, time_usec);
268 _mav_put_float(buf, 8, p1);
269 _mav_put_float(buf, 12, p2);
270 _mav_put_float(buf, 16, p3);
271 _mav_put_float(buf, 20, p4);
272 _mav_put_uint16_t(buf, 24, img_idx);
273 _mav_put_uint8_t(buf, 26, target_system);
274 _mav_put_uint8_t(buf, 27, cam_idx);
275 _mav_put_uint8_t(buf, 28, event_id);
276
277 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, buf, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
278#else
279 mavlink_camera_status_t *packet = (mavlink_camera_status_t *)msgbuf;
280 packet->time_usec = time_usec;
281 packet->p1 = p1;
282 packet->p2 = p2;
283 packet->p3 = p3;
284 packet->p4 = p4;
285 packet->img_idx = img_idx;
286 packet->target_system = target_system;
287 packet->cam_idx = cam_idx;
288 packet->event_id = event_id;
289
290 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_STATUS, (const char *)packet, MAVLINK_MSG_ID_CAMERA_STATUS_MIN_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_LEN, MAVLINK_MSG_ID_CAMERA_STATUS_CRC);
291#endif
292}
293#endif
294
295#endif
296
297// MESSAGE CAMERA_STATUS UNPACKING
298
299
300/**
301 * @brief Get field time_usec from camera_status message
302 *
303 * @return Image timestamp (microseconds since UNIX epoch, according to camera clock)
304 */
305static inline uint64_t mavlink_msg_camera_status_get_time_usec(const mavlink_message_t* msg)
306{
307 return _MAV_RETURN_uint64_t(msg, 0);
308}
309
310/**
311 * @brief Get field target_system from camera_status message
312 *
313 * @return System ID
314 */
315static inline uint8_t mavlink_msg_camera_status_get_target_system(const mavlink_message_t* msg)
316{
317 return _MAV_RETURN_uint8_t(msg, 26);
318}
319
320/**
321 * @brief Get field cam_idx from camera_status message
322 *
323 * @return Camera ID
324 */
325static inline uint8_t mavlink_msg_camera_status_get_cam_idx(const mavlink_message_t* msg)
326{
327 return _MAV_RETURN_uint8_t(msg, 27);
328}
329
330/**
331 * @brief Get field img_idx from camera_status message
332 *
333 * @return Image index
334 */
335static inline uint16_t mavlink_msg_camera_status_get_img_idx(const mavlink_message_t* msg)
336{
337 return _MAV_RETURN_uint16_t(msg, 24);
338}
339
340/**
341 * @brief Get field event_id from camera_status message
342 *
343 * @return See CAMERA_STATUS_TYPES enum for definition of the bitmask
344 */
345static inline uint8_t mavlink_msg_camera_status_get_event_id(const mavlink_message_t* msg)
346{
347 return _MAV_RETURN_uint8_t(msg, 28);
348}
349
350/**
351 * @brief Get field p1 from camera_status message
352 *
353 * @return Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
354 */
355static inline float mavlink_msg_camera_status_get_p1(const mavlink_message_t* msg)
356{
357 return _MAV_RETURN_float(msg, 8);
358}
359
360/**
361 * @brief Get field p2 from camera_status message
362 *
363 * @return Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
364 */
365static inline float mavlink_msg_camera_status_get_p2(const mavlink_message_t* msg)
366{
367 return _MAV_RETURN_float(msg, 12);
368}
369
370/**
371 * @brief Get field p3 from camera_status message
372 *
373 * @return Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
374 */
375static inline float mavlink_msg_camera_status_get_p3(const mavlink_message_t* msg)
376{
377 return _MAV_RETURN_float(msg, 16);
378}
379
380/**
381 * @brief Get field p4 from camera_status message
382 *
383 * @return Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum)
384 */
385static inline float mavlink_msg_camera_status_get_p4(const mavlink_message_t* msg)
386{
387 return _MAV_RETURN_float(msg, 20);
388}
389
390/**
391 * @brief Decode a camera_status message into a struct
392 *
393 * @param msg The message to decode
394 * @param camera_status C-struct to decode the message contents into
395 */
396static inline void mavlink_msg_camera_status_decode(const mavlink_message_t* msg, mavlink_camera_status_t* camera_status)
397{
398#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
399 camera_status->time_usec = mavlink_msg_camera_status_get_time_usec(msg);
400 camera_status->p1 = mavlink_msg_camera_status_get_p1(msg);
401 camera_status->p2 = mavlink_msg_camera_status_get_p2(msg);
402 camera_status->p3 = mavlink_msg_camera_status_get_p3(msg);
403 camera_status->p4 = mavlink_msg_camera_status_get_p4(msg);
404 camera_status->img_idx = mavlink_msg_camera_status_get_img_idx(msg);
405 camera_status->target_system = mavlink_msg_camera_status_get_target_system(msg);
406 camera_status->cam_idx = mavlink_msg_camera_status_get_cam_idx(msg);
407 camera_status->event_id = mavlink_msg_camera_status_get_event_id(msg);
408#else
409 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_STATUS_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_STATUS_LEN;
410 memset(camera_status, 0, MAVLINK_MSG_ID_CAMERA_STATUS_LEN);
411 memcpy(camera_status, _MAV_PAYLOAD(msg), len);
412#endif
413}