RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
mavlink_msg_camera_image_captured.h
1#pragma once
2// MESSAGE CAMERA_IMAGE_CAPTURED PACKING
3
4#define MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED 263
5
6MAVPACKED(
7typedef struct __mavlink_camera_image_captured_t {
8 uint64_t time_utc; /*< Timestamp (microseconds since UNIX epoch) in UTC. 0 for unknown.*/
9 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
10 int32_t lat; /*< Latitude, expressed as degrees * 1E7 where image was taken*/
11 int32_t lon; /*< Longitude, expressed as degrees * 1E7 where capture was taken*/
12 int32_t alt; /*< Altitude in meters, expressed as * 1E3 (AMSL, not WGS84) where image was taken*/
13 int32_t relative_alt; /*< Altitude above ground in meters, expressed as * 1E3 where image was taken*/
14 float q[4]; /*< Quaternion of camera orientation (w, x, y, z order, zero-rotation is 0, 0, 0, 0)*/
15 int32_t image_index; /*< Zero based index of this image (image count since armed -1)*/
16 uint8_t camera_id; /*< Camera ID (1 for first, 2 for second, etc.)*/
17 int8_t capture_result; /*< Boolean indicating success (1) or failure (0) while capturing this image.*/
18 char file_url[205]; /*< URL of image taken. Either local storage or http://foo.jpg if camera provides an HTTP interface.*/
19}) mavlink_camera_image_captured_t;
20
21#define MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN 255
22#define MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN 255
23#define MAVLINK_MSG_ID_263_LEN 255
24#define MAVLINK_MSG_ID_263_MIN_LEN 255
25
26#define MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC 133
27#define MAVLINK_MSG_ID_263_CRC 133
28
29#define MAVLINK_MSG_CAMERA_IMAGE_CAPTURED_FIELD_Q_LEN 4
30#define MAVLINK_MSG_CAMERA_IMAGE_CAPTURED_FIELD_FILE_URL_LEN 205
31
32#if MAVLINK_COMMAND_24BIT
33#define MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED { \
34 263, \
35 "CAMERA_IMAGE_CAPTURED", \
36 11, \
37 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_image_captured_t, time_boot_ms) }, \
38 { "time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_image_captured_t, time_utc) }, \
39 { "camera_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_camera_image_captured_t, camera_id) }, \
40 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_image_captured_t, lat) }, \
41 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_camera_image_captured_t, lon) }, \
42 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_camera_image_captured_t, alt) }, \
43 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_camera_image_captured_t, relative_alt) }, \
44 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 28, offsetof(mavlink_camera_image_captured_t, q) }, \
45 { "image_index", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_camera_image_captured_t, image_index) }, \
46 { "capture_result", NULL, MAVLINK_TYPE_INT8_T, 0, 49, offsetof(mavlink_camera_image_captured_t, capture_result) }, \
47 { "file_url", NULL, MAVLINK_TYPE_CHAR, 205, 50, offsetof(mavlink_camera_image_captured_t, file_url) }, \
48 } \
49}
50#else
51#define MAVLINK_MESSAGE_INFO_CAMERA_IMAGE_CAPTURED { \
52 "CAMERA_IMAGE_CAPTURED", \
53 11, \
54 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 8, offsetof(mavlink_camera_image_captured_t, time_boot_ms) }, \
55 { "time_utc", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_camera_image_captured_t, time_utc) }, \
56 { "camera_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 48, offsetof(mavlink_camera_image_captured_t, camera_id) }, \
57 { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_camera_image_captured_t, lat) }, \
58 { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_camera_image_captured_t, lon) }, \
59 { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_camera_image_captured_t, alt) }, \
60 { "relative_alt", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_camera_image_captured_t, relative_alt) }, \
61 { "q", NULL, MAVLINK_TYPE_FLOAT, 4, 28, offsetof(mavlink_camera_image_captured_t, q) }, \
62 { "image_index", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_camera_image_captured_t, image_index) }, \
63 { "capture_result", NULL, MAVLINK_TYPE_INT8_T, 0, 49, offsetof(mavlink_camera_image_captured_t, capture_result) }, \
64 { "file_url", NULL, MAVLINK_TYPE_CHAR, 205, 50, offsetof(mavlink_camera_image_captured_t, file_url) }, \
65 } \
66}
67#endif
68
88static inline uint16_t mavlink_msg_camera_image_captured_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
89 uint32_t time_boot_ms, uint64_t time_utc, uint8_t camera_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, const float *q, int32_t image_index, int8_t capture_result, const char *file_url)
90{
91#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 char buf[MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN];
93 _mav_put_uint64_t(buf, 0, time_utc);
94 _mav_put_uint32_t(buf, 8, time_boot_ms);
95 _mav_put_int32_t(buf, 12, lat);
96 _mav_put_int32_t(buf, 16, lon);
97 _mav_put_int32_t(buf, 20, alt);
98 _mav_put_int32_t(buf, 24, relative_alt);
99 _mav_put_int32_t(buf, 44, image_index);
100 _mav_put_uint8_t(buf, 48, camera_id);
101 _mav_put_int8_t(buf, 49, capture_result);
102 _mav_put_float_array(buf, 28, q, 4);
103 _mav_put_char_array(buf, 50, file_url, 205);
104 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN);
105#else
106 mavlink_camera_image_captured_t packet;
107 packet.time_utc = time_utc;
108 packet.time_boot_ms = time_boot_ms;
109 packet.lat = lat;
110 packet.lon = lon;
111 packet.alt = alt;
112 packet.relative_alt = relative_alt;
113 packet.image_index = image_index;
114 packet.camera_id = camera_id;
115 packet.capture_result = capture_result;
116 mav_array_memcpy(packet.q, q, sizeof(float)*4);
117 mav_array_memcpy(packet.file_url, file_url, sizeof(char)*205);
118 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN);
119#endif
120
121 msg->msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED;
122 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
123}
124
144static inline uint16_t mavlink_msg_camera_image_captured_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
145 mavlink_message_t* msg,
146 uint32_t time_boot_ms,uint64_t time_utc,uint8_t camera_id,int32_t lat,int32_t lon,int32_t alt,int32_t relative_alt,const float *q,int32_t image_index,int8_t capture_result,const char *file_url)
147{
148#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf[MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN];
150 _mav_put_uint64_t(buf, 0, time_utc);
151 _mav_put_uint32_t(buf, 8, time_boot_ms);
152 _mav_put_int32_t(buf, 12, lat);
153 _mav_put_int32_t(buf, 16, lon);
154 _mav_put_int32_t(buf, 20, alt);
155 _mav_put_int32_t(buf, 24, relative_alt);
156 _mav_put_int32_t(buf, 44, image_index);
157 _mav_put_uint8_t(buf, 48, camera_id);
158 _mav_put_int8_t(buf, 49, capture_result);
159 _mav_put_float_array(buf, 28, q, 4);
160 _mav_put_char_array(buf, 50, file_url, 205);
161 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN);
162#else
163 mavlink_camera_image_captured_t packet;
164 packet.time_utc = time_utc;
165 packet.time_boot_ms = time_boot_ms;
166 packet.lat = lat;
167 packet.lon = lon;
168 packet.alt = alt;
169 packet.relative_alt = relative_alt;
170 packet.image_index = image_index;
171 packet.camera_id = camera_id;
172 packet.capture_result = capture_result;
173 mav_array_memcpy(packet.q, q, sizeof(float)*4);
174 mav_array_memcpy(packet.file_url, file_url, sizeof(char)*205);
175 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN);
176#endif
177
178 msg->msgid = MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED;
179 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
180}
181
190static inline uint16_t mavlink_msg_camera_image_captured_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_image_captured_t* camera_image_captured)
191{
192 return mavlink_msg_camera_image_captured_pack(system_id, component_id, msg, camera_image_captured->time_boot_ms, camera_image_captured->time_utc, camera_image_captured->camera_id, camera_image_captured->lat, camera_image_captured->lon, camera_image_captured->alt, camera_image_captured->relative_alt, camera_image_captured->q, camera_image_captured->image_index, camera_image_captured->capture_result, camera_image_captured->file_url);
193}
194
204static inline uint16_t mavlink_msg_camera_image_captured_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_image_captured_t* camera_image_captured)
205{
206 return mavlink_msg_camera_image_captured_pack_chan(system_id, component_id, chan, msg, camera_image_captured->time_boot_ms, camera_image_captured->time_utc, camera_image_captured->camera_id, camera_image_captured->lat, camera_image_captured->lon, camera_image_captured->alt, camera_image_captured->relative_alt, camera_image_captured->q, camera_image_captured->image_index, camera_image_captured->capture_result, camera_image_captured->file_url);
207}
208
225#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
226
227static inline void mavlink_msg_camera_image_captured_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t camera_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, const float *q, int32_t image_index, int8_t capture_result, const char *file_url)
228{
229#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
230 char buf[MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN];
231 _mav_put_uint64_t(buf, 0, time_utc);
232 _mav_put_uint32_t(buf, 8, time_boot_ms);
233 _mav_put_int32_t(buf, 12, lat);
234 _mav_put_int32_t(buf, 16, lon);
235 _mav_put_int32_t(buf, 20, alt);
236 _mav_put_int32_t(buf, 24, relative_alt);
237 _mav_put_int32_t(buf, 44, image_index);
238 _mav_put_uint8_t(buf, 48, camera_id);
239 _mav_put_int8_t(buf, 49, capture_result);
240 _mav_put_float_array(buf, 28, q, 4);
241 _mav_put_char_array(buf, 50, file_url, 205);
242 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, buf, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
243#else
244 mavlink_camera_image_captured_t packet;
245 packet.time_utc = time_utc;
246 packet.time_boot_ms = time_boot_ms;
247 packet.lat = lat;
248 packet.lon = lon;
249 packet.alt = alt;
250 packet.relative_alt = relative_alt;
251 packet.image_index = image_index;
252 packet.camera_id = camera_id;
253 packet.capture_result = capture_result;
254 mav_array_memcpy(packet.q, q, sizeof(float)*4);
255 mav_array_memcpy(packet.file_url, file_url, sizeof(char)*205);
256 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
257#endif
258}
259
265static inline void mavlink_msg_camera_image_captured_send_struct(mavlink_channel_t chan, const mavlink_camera_image_captured_t* camera_image_captured)
266{
267#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
268 mavlink_msg_camera_image_captured_send(chan, camera_image_captured->time_boot_ms, camera_image_captured->time_utc, camera_image_captured->camera_id, camera_image_captured->lat, camera_image_captured->lon, camera_image_captured->alt, camera_image_captured->relative_alt, camera_image_captured->q, camera_image_captured->image_index, camera_image_captured->capture_result, camera_image_captured->file_url);
269#else
270 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, (const char *)camera_image_captured, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
271#endif
272}
273
274#if MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
275/*
276 This varient of _send() can be used to save stack space by re-using
277 memory from the receive buffer. The caller provides a
278 mavlink_message_t which is the size of a full mavlink message. This
279 is usually the receive buffer for the channel, and allows a reply to an
280 incoming message with minimum stack space usage.
281 */
282static inline void mavlink_msg_camera_image_captured_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint64_t time_utc, uint8_t camera_id, int32_t lat, int32_t lon, int32_t alt, int32_t relative_alt, const float *q, int32_t image_index, int8_t capture_result, const char *file_url)
283{
284#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
285 char *buf = (char *)msgbuf;
286 _mav_put_uint64_t(buf, 0, time_utc);
287 _mav_put_uint32_t(buf, 8, time_boot_ms);
288 _mav_put_int32_t(buf, 12, lat);
289 _mav_put_int32_t(buf, 16, lon);
290 _mav_put_int32_t(buf, 20, alt);
291 _mav_put_int32_t(buf, 24, relative_alt);
292 _mav_put_int32_t(buf, 44, image_index);
293 _mav_put_uint8_t(buf, 48, camera_id);
294 _mav_put_int8_t(buf, 49, capture_result);
295 _mav_put_float_array(buf, 28, q, 4);
296 _mav_put_char_array(buf, 50, file_url, 205);
297 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, buf, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
298#else
299 mavlink_camera_image_captured_t *packet = (mavlink_camera_image_captured_t *)msgbuf;
300 packet->time_utc = time_utc;
301 packet->time_boot_ms = time_boot_ms;
302 packet->lat = lat;
303 packet->lon = lon;
304 packet->alt = alt;
305 packet->relative_alt = relative_alt;
306 packet->image_index = image_index;
307 packet->camera_id = camera_id;
308 packet->capture_result = capture_result;
309 mav_array_memcpy(packet->q, q, sizeof(float)*4);
310 mav_array_memcpy(packet->file_url, file_url, sizeof(char)*205);
311 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED, (const char *)packet, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_MIN_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_CRC);
312#endif
313}
314#endif
315
316#endif
317
318// MESSAGE CAMERA_IMAGE_CAPTURED UNPACKING
319
320
326static inline uint32_t mavlink_msg_camera_image_captured_get_time_boot_ms(const mavlink_message_t* msg)
327{
328 return _MAV_RETURN_uint32_t(msg, 8);
329}
330
336static inline uint64_t mavlink_msg_camera_image_captured_get_time_utc(const mavlink_message_t* msg)
337{
338 return _MAV_RETURN_uint64_t(msg, 0);
339}
340
346static inline uint8_t mavlink_msg_camera_image_captured_get_camera_id(const mavlink_message_t* msg)
347{
348 return _MAV_RETURN_uint8_t(msg, 48);
349}
350
356static inline int32_t mavlink_msg_camera_image_captured_get_lat(const mavlink_message_t* msg)
357{
358 return _MAV_RETURN_int32_t(msg, 12);
359}
360
366static inline int32_t mavlink_msg_camera_image_captured_get_lon(const mavlink_message_t* msg)
367{
368 return _MAV_RETURN_int32_t(msg, 16);
369}
370
376static inline int32_t mavlink_msg_camera_image_captured_get_alt(const mavlink_message_t* msg)
377{
378 return _MAV_RETURN_int32_t(msg, 20);
379}
380
386static inline int32_t mavlink_msg_camera_image_captured_get_relative_alt(const mavlink_message_t* msg)
387{
388 return _MAV_RETURN_int32_t(msg, 24);
389}
390
396static inline uint16_t mavlink_msg_camera_image_captured_get_q(const mavlink_message_t* msg, float *q)
397{
398 return _MAV_RETURN_float_array(msg, q, 4, 28);
399}
400
406static inline int32_t mavlink_msg_camera_image_captured_get_image_index(const mavlink_message_t* msg)
407{
408 return _MAV_RETURN_int32_t(msg, 44);
409}
410
416static inline int8_t mavlink_msg_camera_image_captured_get_capture_result(const mavlink_message_t* msg)
417{
418 return _MAV_RETURN_int8_t(msg, 49);
419}
420
426static inline uint16_t mavlink_msg_camera_image_captured_get_file_url(const mavlink_message_t* msg, char *file_url)
427{
428 return _MAV_RETURN_char_array(msg, file_url, 205, 50);
429}
430
437static inline void mavlink_msg_camera_image_captured_decode(const mavlink_message_t* msg, mavlink_camera_image_captured_t* camera_image_captured)
438{
439#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
440 camera_image_captured->time_utc = mavlink_msg_camera_image_captured_get_time_utc(msg);
441 camera_image_captured->time_boot_ms = mavlink_msg_camera_image_captured_get_time_boot_ms(msg);
442 camera_image_captured->lat = mavlink_msg_camera_image_captured_get_lat(msg);
443 camera_image_captured->lon = mavlink_msg_camera_image_captured_get_lon(msg);
444 camera_image_captured->alt = mavlink_msg_camera_image_captured_get_alt(msg);
445 camera_image_captured->relative_alt = mavlink_msg_camera_image_captured_get_relative_alt(msg);
446 mavlink_msg_camera_image_captured_get_q(msg, camera_image_captured->q);
447 camera_image_captured->image_index = mavlink_msg_camera_image_captured_get_image_index(msg);
448 camera_image_captured->camera_id = mavlink_msg_camera_image_captured_get_camera_id(msg);
449 camera_image_captured->capture_result = mavlink_msg_camera_image_captured_get_capture_result(msg);
450 mavlink_msg_camera_image_captured_get_file_url(msg, camera_image_captured->file_url);
451#else
452 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN;
453 memset(camera_image_captured, 0, MAVLINK_MSG_ID_CAMERA_IMAGE_CAPTURED_LEN);
454 memcpy(camera_image_captured, _MAV_PAYLOAD(msg), len);
455#endif
456}