Merge pull request #10476 from radiolinkW/RADIOLINKF722
[inav.git] / lib / main / MAVLink / common / mavlink_msg_camera_information.h
blob0ae20c4b3e45f889bd14fecb0788bb024cbcd456
1 #pragma once
2 // MESSAGE CAMERA_INFORMATION PACKING
4 #define MAVLINK_MSG_ID_CAMERA_INFORMATION 259
7 typedef struct __mavlink_camera_information_t {
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 uint32_t firmware_version; /*< Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)*/
10 float focal_length; /*< [mm] Focal length*/
11 float sensor_size_h; /*< [mm] Image sensor size horizontal*/
12 float sensor_size_v; /*< [mm] Image sensor size vertical*/
13 uint32_t flags; /*< Bitmap of camera capability flags.*/
14 uint16_t resolution_h; /*< [pix] Horizontal image resolution*/
15 uint16_t resolution_v; /*< [pix] Vertical image resolution*/
16 uint16_t cam_definition_version; /*< Camera definition version (iteration)*/
17 uint8_t vendor_name[32]; /*< Name of the camera vendor*/
18 uint8_t model_name[32]; /*< Name of the camera model*/
19 uint8_t lens_id; /*< Reserved for a lens ID*/
20 char cam_definition_uri[140]; /*< Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).*/
21 } mavlink_camera_information_t;
23 #define MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN 235
24 #define MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN 235
25 #define MAVLINK_MSG_ID_259_LEN 235
26 #define MAVLINK_MSG_ID_259_MIN_LEN 235
28 #define MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC 92
29 #define MAVLINK_MSG_ID_259_CRC 92
31 #define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_VENDOR_NAME_LEN 32
32 #define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_MODEL_NAME_LEN 32
33 #define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_CAM_DEFINITION_URI_LEN 140
35 #if MAVLINK_COMMAND_24BIT
36 #define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION { \
37 259, \
38 "CAMERA_INFORMATION", \
39 13, \
40 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) }, \
41 { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) }, \
42 { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) }, \
43 { "firmware_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_camera_information_t, firmware_version) }, \
44 { "focal_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_information_t, focal_length) }, \
45 { "sensor_size_h", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_information_t, sensor_size_h) }, \
46 { "sensor_size_v", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_information_t, sensor_size_v) }, \
47 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_information_t, resolution_h) }, \
48 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_camera_information_t, resolution_v) }, \
49 { "lens_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 94, offsetof(mavlink_camera_information_t, lens_id) }, \
50 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) }, \
51 { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) }, \
52 { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) }, \
53 } \
55 #else
56 #define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION { \
57 "CAMERA_INFORMATION", \
58 13, \
59 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) }, \
60 { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) }, \
61 { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) }, \
62 { "firmware_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_camera_information_t, firmware_version) }, \
63 { "focal_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_information_t, focal_length) }, \
64 { "sensor_size_h", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_information_t, sensor_size_h) }, \
65 { "sensor_size_v", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_information_t, sensor_size_v) }, \
66 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_information_t, resolution_h) }, \
67 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_camera_information_t, resolution_v) }, \
68 { "lens_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 94, offsetof(mavlink_camera_information_t, lens_id) }, \
69 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) }, \
70 { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) }, \
71 { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) }, \
72 } \
74 #endif
76 /**
77 * @brief Pack a camera_information message
78 * @param system_id ID of this system
79 * @param component_id ID of this component (e.g. 200 for IMU)
80 * @param msg The MAVLink message to compress the data into
82 * @param time_boot_ms [ms] Timestamp (time since system boot).
83 * @param vendor_name Name of the camera vendor
84 * @param model_name Name of the camera model
85 * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)
86 * @param focal_length [mm] Focal length
87 * @param sensor_size_h [mm] Image sensor size horizontal
88 * @param sensor_size_v [mm] Image sensor size vertical
89 * @param resolution_h [pix] Horizontal image resolution
90 * @param resolution_v [pix] Vertical image resolution
91 * @param lens_id Reserved for a lens ID
92 * @param flags Bitmap of camera capability flags.
93 * @param cam_definition_version Camera definition version (iteration)
94 * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).
95 * @return length of the message in bytes (excluding serial stream start sign)
97 static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
98 uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN];
102 _mav_put_uint32_t(buf, 0, time_boot_ms);
103 _mav_put_uint32_t(buf, 4, firmware_version);
104 _mav_put_float(buf, 8, focal_length);
105 _mav_put_float(buf, 12, sensor_size_h);
106 _mav_put_float(buf, 16, sensor_size_v);
107 _mav_put_uint32_t(buf, 20, flags);
108 _mav_put_uint16_t(buf, 24, resolution_h);
109 _mav_put_uint16_t(buf, 26, resolution_v);
110 _mav_put_uint16_t(buf, 28, cam_definition_version);
111 _mav_put_uint8_t(buf, 94, lens_id);
112 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
113 _mav_put_uint8_t_array(buf, 62, model_name, 32);
114 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
116 #else
117 mavlink_camera_information_t packet;
118 packet.time_boot_ms = time_boot_ms;
119 packet.firmware_version = firmware_version;
120 packet.focal_length = focal_length;
121 packet.sensor_size_h = sensor_size_h;
122 packet.sensor_size_v = sensor_size_v;
123 packet.flags = flags;
124 packet.resolution_h = resolution_h;
125 packet.resolution_v = resolution_v;
126 packet.cam_definition_version = cam_definition_version;
127 packet.lens_id = lens_id;
128 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
129 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
130 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
132 #endif
134 msg->msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION;
135 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
139 * @brief Pack a camera_information message on a channel
140 * @param system_id ID of this system
141 * @param component_id ID of this component (e.g. 200 for IMU)
142 * @param chan The MAVLink channel this message will be sent over
143 * @param msg The MAVLink message to compress the data into
144 * @param time_boot_ms [ms] Timestamp (time since system boot).
145 * @param vendor_name Name of the camera vendor
146 * @param model_name Name of the camera model
147 * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)
148 * @param focal_length [mm] Focal length
149 * @param sensor_size_h [mm] Image sensor size horizontal
150 * @param sensor_size_v [mm] Image sensor size vertical
151 * @param resolution_h [pix] Horizontal image resolution
152 * @param resolution_v [pix] Vertical image resolution
153 * @param lens_id Reserved for a lens ID
154 * @param flags Bitmap of camera capability flags.
155 * @param cam_definition_version Camera definition version (iteration)
156 * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).
157 * @return length of the message in bytes (excluding serial stream start sign)
159 static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
160 mavlink_message_t* msg,
161 uint32_t time_boot_ms,const uint8_t *vendor_name,const uint8_t *model_name,uint32_t firmware_version,float focal_length,float sensor_size_h,float sensor_size_v,uint16_t resolution_h,uint16_t resolution_v,uint8_t lens_id,uint32_t flags,uint16_t cam_definition_version,const char *cam_definition_uri)
163 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
164 char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN];
165 _mav_put_uint32_t(buf, 0, time_boot_ms);
166 _mav_put_uint32_t(buf, 4, firmware_version);
167 _mav_put_float(buf, 8, focal_length);
168 _mav_put_float(buf, 12, sensor_size_h);
169 _mav_put_float(buf, 16, sensor_size_v);
170 _mav_put_uint32_t(buf, 20, flags);
171 _mav_put_uint16_t(buf, 24, resolution_h);
172 _mav_put_uint16_t(buf, 26, resolution_v);
173 _mav_put_uint16_t(buf, 28, cam_definition_version);
174 _mav_put_uint8_t(buf, 94, lens_id);
175 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
176 _mav_put_uint8_t_array(buf, 62, model_name, 32);
177 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
178 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
179 #else
180 mavlink_camera_information_t packet;
181 packet.time_boot_ms = time_boot_ms;
182 packet.firmware_version = firmware_version;
183 packet.focal_length = focal_length;
184 packet.sensor_size_h = sensor_size_h;
185 packet.sensor_size_v = sensor_size_v;
186 packet.flags = flags;
187 packet.resolution_h = resolution_h;
188 packet.resolution_v = resolution_v;
189 packet.cam_definition_version = cam_definition_version;
190 packet.lens_id = lens_id;
191 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
192 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
193 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
194 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
195 #endif
197 msg->msgid = MAVLINK_MSG_ID_CAMERA_INFORMATION;
198 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
202 * @brief Encode a camera_information struct
204 * @param system_id ID of this system
205 * @param component_id ID of this component (e.g. 200 for IMU)
206 * @param msg The MAVLink message to compress the data into
207 * @param camera_information C-struct to read the message contents from
209 static inline uint16_t mavlink_msg_camera_information_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information)
211 return mavlink_msg_camera_information_pack(system_id, component_id, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri);
215 * @brief Encode a camera_information struct on a channel
217 * @param system_id ID of this system
218 * @param component_id ID of this component (e.g. 200 for IMU)
219 * @param chan The MAVLink channel this message will be sent over
220 * @param msg The MAVLink message to compress the data into
221 * @param camera_information C-struct to read the message contents from
223 static inline uint16_t mavlink_msg_camera_information_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information)
225 return mavlink_msg_camera_information_pack_chan(system_id, component_id, chan, msg, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri);
229 * @brief Send a camera_information message
230 * @param chan MAVLink channel to send the message
232 * @param time_boot_ms [ms] Timestamp (time since system boot).
233 * @param vendor_name Name of the camera vendor
234 * @param model_name Name of the camera model
235 * @param firmware_version Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)
236 * @param focal_length [mm] Focal length
237 * @param sensor_size_h [mm] Image sensor size horizontal
238 * @param sensor_size_v [mm] Image sensor size vertical
239 * @param resolution_h [pix] Horizontal image resolution
240 * @param resolution_v [pix] Vertical image resolution
241 * @param lens_id Reserved for a lens ID
242 * @param flags Bitmap of camera capability flags.
243 * @param cam_definition_version Camera definition version (iteration)
244 * @param cam_definition_uri Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).
246 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
248 static inline void mavlink_msg_camera_information_send(mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri)
250 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
251 char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN];
252 _mav_put_uint32_t(buf, 0, time_boot_ms);
253 _mav_put_uint32_t(buf, 4, firmware_version);
254 _mav_put_float(buf, 8, focal_length);
255 _mav_put_float(buf, 12, sensor_size_h);
256 _mav_put_float(buf, 16, sensor_size_v);
257 _mav_put_uint32_t(buf, 20, flags);
258 _mav_put_uint16_t(buf, 24, resolution_h);
259 _mav_put_uint16_t(buf, 26, resolution_v);
260 _mav_put_uint16_t(buf, 28, cam_definition_version);
261 _mav_put_uint8_t(buf, 94, lens_id);
262 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
263 _mav_put_uint8_t_array(buf, 62, model_name, 32);
264 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
265 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
266 #else
267 mavlink_camera_information_t packet;
268 packet.time_boot_ms = time_boot_ms;
269 packet.firmware_version = firmware_version;
270 packet.focal_length = focal_length;
271 packet.sensor_size_h = sensor_size_h;
272 packet.sensor_size_v = sensor_size_v;
273 packet.flags = flags;
274 packet.resolution_h = resolution_h;
275 packet.resolution_v = resolution_v;
276 packet.cam_definition_version = cam_definition_version;
277 packet.lens_id = lens_id;
278 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
279 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
280 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
281 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)&packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
282 #endif
286 * @brief Send a camera_information message
287 * @param chan MAVLink channel to send the message
288 * @param struct The MAVLink struct to serialize
290 static inline void mavlink_msg_camera_information_send_struct(mavlink_channel_t chan, const mavlink_camera_information_t* camera_information)
292 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
293 mavlink_msg_camera_information_send(chan, camera_information->time_boot_ms, camera_information->vendor_name, camera_information->model_name, camera_information->firmware_version, camera_information->focal_length, camera_information->sensor_size_h, camera_information->sensor_size_v, camera_information->resolution_h, camera_information->resolution_v, camera_information->lens_id, camera_information->flags, camera_information->cam_definition_version, camera_information->cam_definition_uri);
294 #else
295 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)camera_information, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
296 #endif
299 #if MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
301 This varient of _send() can be used to save stack space by re-using
302 memory from the receive buffer. The caller provides a
303 mavlink_message_t which is the size of a full mavlink message. This
304 is usually the receive buffer for the channel, and allows a reply to an
305 incoming message with minimum stack space usage.
307 static inline void mavlink_msg_camera_information_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, const uint8_t *vendor_name, const uint8_t *model_name, uint32_t firmware_version, float focal_length, float sensor_size_h, float sensor_size_v, uint16_t resolution_h, uint16_t resolution_v, uint8_t lens_id, uint32_t flags, uint16_t cam_definition_version, const char *cam_definition_uri)
309 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
310 char *buf = (char *)msgbuf;
311 _mav_put_uint32_t(buf, 0, time_boot_ms);
312 _mav_put_uint32_t(buf, 4, firmware_version);
313 _mav_put_float(buf, 8, focal_length);
314 _mav_put_float(buf, 12, sensor_size_h);
315 _mav_put_float(buf, 16, sensor_size_v);
316 _mav_put_uint32_t(buf, 20, flags);
317 _mav_put_uint16_t(buf, 24, resolution_h);
318 _mav_put_uint16_t(buf, 26, resolution_v);
319 _mav_put_uint16_t(buf, 28, cam_definition_version);
320 _mav_put_uint8_t(buf, 94, lens_id);
321 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
322 _mav_put_uint8_t_array(buf, 62, model_name, 32);
323 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
324 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
325 #else
326 mavlink_camera_information_t *packet = (mavlink_camera_information_t *)msgbuf;
327 packet->time_boot_ms = time_boot_ms;
328 packet->firmware_version = firmware_version;
329 packet->focal_length = focal_length;
330 packet->sensor_size_h = sensor_size_h;
331 packet->sensor_size_v = sensor_size_v;
332 packet->flags = flags;
333 packet->resolution_h = resolution_h;
334 packet->resolution_v = resolution_v;
335 packet->cam_definition_version = cam_definition_version;
336 packet->lens_id = lens_id;
337 mav_array_memcpy(packet->vendor_name, vendor_name, sizeof(uint8_t)*32);
338 mav_array_memcpy(packet->model_name, model_name, sizeof(uint8_t)*32);
339 mav_array_memcpy(packet->cam_definition_uri, cam_definition_uri, sizeof(char)*140);
340 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CAMERA_INFORMATION, (const char *)packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
341 #endif
343 #endif
345 #endif
347 // MESSAGE CAMERA_INFORMATION UNPACKING
351 * @brief Get field time_boot_ms from camera_information message
353 * @return [ms] Timestamp (time since system boot).
355 static inline uint32_t mavlink_msg_camera_information_get_time_boot_ms(const mavlink_message_t* msg)
357 return _MAV_RETURN_uint32_t(msg, 0);
361 * @brief Get field vendor_name from camera_information message
363 * @return Name of the camera vendor
365 static inline uint16_t mavlink_msg_camera_information_get_vendor_name(const mavlink_message_t* msg, uint8_t *vendor_name)
367 return _MAV_RETURN_uint8_t_array(msg, vendor_name, 32, 30);
371 * @brief Get field model_name from camera_information message
373 * @return Name of the camera model
375 static inline uint16_t mavlink_msg_camera_information_get_model_name(const mavlink_message_t* msg, uint8_t *model_name)
377 return _MAV_RETURN_uint8_t_array(msg, model_name, 32, 62);
381 * @brief Get field firmware_version from camera_information message
383 * @return Version of the camera firmware, encoded as: (Dev & 0xff) << 24 | (Patch & 0xff) << 16 | (Minor & 0xff) << 8 | (Major & 0xff)
385 static inline uint32_t mavlink_msg_camera_information_get_firmware_version(const mavlink_message_t* msg)
387 return _MAV_RETURN_uint32_t(msg, 4);
391 * @brief Get field focal_length from camera_information message
393 * @return [mm] Focal length
395 static inline float mavlink_msg_camera_information_get_focal_length(const mavlink_message_t* msg)
397 return _MAV_RETURN_float(msg, 8);
401 * @brief Get field sensor_size_h from camera_information message
403 * @return [mm] Image sensor size horizontal
405 static inline float mavlink_msg_camera_information_get_sensor_size_h(const mavlink_message_t* msg)
407 return _MAV_RETURN_float(msg, 12);
411 * @brief Get field sensor_size_v from camera_information message
413 * @return [mm] Image sensor size vertical
415 static inline float mavlink_msg_camera_information_get_sensor_size_v(const mavlink_message_t* msg)
417 return _MAV_RETURN_float(msg, 16);
421 * @brief Get field resolution_h from camera_information message
423 * @return [pix] Horizontal image resolution
425 static inline uint16_t mavlink_msg_camera_information_get_resolution_h(const mavlink_message_t* msg)
427 return _MAV_RETURN_uint16_t(msg, 24);
431 * @brief Get field resolution_v from camera_information message
433 * @return [pix] Vertical image resolution
435 static inline uint16_t mavlink_msg_camera_information_get_resolution_v(const mavlink_message_t* msg)
437 return _MAV_RETURN_uint16_t(msg, 26);
441 * @brief Get field lens_id from camera_information message
443 * @return Reserved for a lens ID
445 static inline uint8_t mavlink_msg_camera_information_get_lens_id(const mavlink_message_t* msg)
447 return _MAV_RETURN_uint8_t(msg, 94);
451 * @brief Get field flags from camera_information message
453 * @return Bitmap of camera capability flags.
455 static inline uint32_t mavlink_msg_camera_information_get_flags(const mavlink_message_t* msg)
457 return _MAV_RETURN_uint32_t(msg, 20);
461 * @brief Get field cam_definition_version from camera_information message
463 * @return Camera definition version (iteration)
465 static inline uint16_t mavlink_msg_camera_information_get_cam_definition_version(const mavlink_message_t* msg)
467 return _MAV_RETURN_uint16_t(msg, 28);
471 * @brief Get field cam_definition_uri from camera_information message
473 * @return Camera definition URI (if any, otherwise only basic functions will be available). HTTP- (http://) and MAVLink FTP- (mavlinkftp://) formatted URIs are allowed (and both must be supported by any GCS that implements the Camera Protocol).
475 static inline uint16_t mavlink_msg_camera_information_get_cam_definition_uri(const mavlink_message_t* msg, char *cam_definition_uri)
477 return _MAV_RETURN_char_array(msg, cam_definition_uri, 140, 95);
481 * @brief Decode a camera_information message into a struct
483 * @param msg The message to decode
484 * @param camera_information C-struct to decode the message contents into
486 static inline void mavlink_msg_camera_information_decode(const mavlink_message_t* msg, mavlink_camera_information_t* camera_information)
488 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
489 camera_information->time_boot_ms = mavlink_msg_camera_information_get_time_boot_ms(msg);
490 camera_information->firmware_version = mavlink_msg_camera_information_get_firmware_version(msg);
491 camera_information->focal_length = mavlink_msg_camera_information_get_focal_length(msg);
492 camera_information->sensor_size_h = mavlink_msg_camera_information_get_sensor_size_h(msg);
493 camera_information->sensor_size_v = mavlink_msg_camera_information_get_sensor_size_v(msg);
494 camera_information->flags = mavlink_msg_camera_information_get_flags(msg);
495 camera_information->resolution_h = mavlink_msg_camera_information_get_resolution_h(msg);
496 camera_information->resolution_v = mavlink_msg_camera_information_get_resolution_v(msg);
497 camera_information->cam_definition_version = mavlink_msg_camera_information_get_cam_definition_version(msg);
498 mavlink_msg_camera_information_get_vendor_name(msg, camera_information->vendor_name);
499 mavlink_msg_camera_information_get_model_name(msg, camera_information->model_name);
500 camera_information->lens_id = mavlink_msg_camera_information_get_lens_id(msg);
501 mavlink_msg_camera_information_get_cam_definition_uri(msg, camera_information->cam_definition_uri);
502 #else
503 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN;
504 memset(camera_information, 0, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
505 memcpy(camera_information, _MAV_PAYLOAD(msg), len);
506 #endif