Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_camera_information.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE CAMERA_INFORMATION PACKING
3
4#define MAVLINK_MSG_ID_CAMERA_INFORMATION 259
5
6
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)`. Use 0 if not known.*/
10 float focal_length; /*< [mm] Focal length. Use NaN if not known.*/
11 float sensor_size_h; /*< [mm] Image sensor size horizontal. Use NaN if not known.*/
12 float sensor_size_v; /*< [mm] Image sensor size vertical. Use NaN if not known.*/
13 uint32_t flags; /*< Bitmap of camera capability flags.*/
14 uint16_t resolution_h; /*< [pix] Horizontal image resolution. Use 0 if not known.*/
15 uint16_t resolution_v; /*< [pix] Vertical image resolution. Use 0 if not known.*/
16 uint16_t cam_definition_version; /*< Camera definition version (iteration). Use 0 if not known.*/
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. Use 0 if not known.*/
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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.*/
21 uint8_t gimbal_device_id; /*< Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.*/
22 uint8_t camera_device_id; /*< Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).*/
23} mavlink_camera_information_t;
24
25#define MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN 237
26#define MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN 235
27#define MAVLINK_MSG_ID_259_LEN 237
28#define MAVLINK_MSG_ID_259_MIN_LEN 235
29
30#define MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC 92
31#define MAVLINK_MSG_ID_259_CRC 92
32
33#define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_VENDOR_NAME_LEN 32
34#define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_MODEL_NAME_LEN 32
35#define MAVLINK_MSG_CAMERA_INFORMATION_FIELD_CAM_DEFINITION_URI_LEN 140
36
37#if MAVLINK_COMMAND_24BIT
38#define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION {
39 259,
40 "CAMERA_INFORMATION",
41 15,
42 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) },
43 { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) },
44 { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) },
45 { "firmware_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_camera_information_t, firmware_version) },
46 { "focal_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_information_t, focal_length) },
47 { "sensor_size_h", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_information_t, sensor_size_h) },
48 { "sensor_size_v", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_information_t, sensor_size_v) },
49 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_information_t, resolution_h) },
50 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_camera_information_t, resolution_v) },
51 { "lens_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 94, offsetof(mavlink_camera_information_t, lens_id) },
52 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) },
53 { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) },
54 { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) },
55 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 235, offsetof(mavlink_camera_information_t, gimbal_device_id) },
56 { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 236, offsetof(mavlink_camera_information_t, camera_device_id) },
57 } \
58}
59#else
60#define MAVLINK_MESSAGE_INFO_CAMERA_INFORMATION {
61 "CAMERA_INFORMATION",
62 15,
63 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_information_t, time_boot_ms) },
64 { "vendor_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 30, offsetof(mavlink_camera_information_t, vendor_name) },
65 { "model_name", NULL, MAVLINK_TYPE_UINT8_T, 32, 62, offsetof(mavlink_camera_information_t, model_name) },
66 { "firmware_version", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_camera_information_t, firmware_version) },
67 { "focal_length", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_camera_information_t, focal_length) },
68 { "sensor_size_h", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_camera_information_t, sensor_size_h) },
69 { "sensor_size_v", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_camera_information_t, sensor_size_v) },
70 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_camera_information_t, resolution_h) },
71 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 26, offsetof(mavlink_camera_information_t, resolution_v) },
72 { "lens_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 94, offsetof(mavlink_camera_information_t, lens_id) },
73 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 20, offsetof(mavlink_camera_information_t, flags) },
74 { "cam_definition_version", NULL, MAVLINK_TYPE_UINT16_T, 0, 28, offsetof(mavlink_camera_information_t, cam_definition_version) },
75 { "cam_definition_uri", NULL, MAVLINK_TYPE_CHAR, 140, 95, offsetof(mavlink_camera_information_t, cam_definition_uri) },
76 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 235, offsetof(mavlink_camera_information_t, gimbal_device_id) },
77 { "camera_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 236, offsetof(mavlink_camera_information_t, camera_device_id) },
78 } \
79}
80#endif
81
82/**
83 * @brief Pack a camera_information message
84 * @param system_id ID of this system
85 * @param component_id ID of this component (e.g. 200 for IMU)
86 * @param msg The MAVLink message to compress the data into
87 *
88 * @param time_boot_ms [ms] Timestamp (time since system boot).
89 * @param vendor_name Name of the camera vendor
90 * @param model_name Name of the camera model
91 * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.
92 * @param focal_length [mm] Focal length. Use NaN if not known.
93 * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known.
94 * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known.
95 * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known.
96 * @param resolution_v [pix] Vertical image resolution. Use 0 if not known.
97 * @param lens_id Reserved for a lens ID. Use 0 if not known.
98 * @param flags Bitmap of camera capability flags.
99 * @param cam_definition_version Camera definition version (iteration). Use 0 if not known.
100 * @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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.
101 * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.
102 * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).
103 * @return length of the message in bytes (excluding serial stream start sign)
104 */
105static inline uint16_t mavlink_msg_camera_information_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
106 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, uint8_t gimbal_device_id, uint8_t camera_device_id)
107{
108#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
110 _mav_put_uint32_t(buf, 0, time_boot_ms);
111 _mav_put_uint32_t(buf, 4, firmware_version);
112 _mav_put_float(buf, 8, focal_length);
113 _mav_put_float(buf, 12, sensor_size_h);
114 _mav_put_float(buf, 16, sensor_size_v);
115 _mav_put_uint32_t(buf, 20, flags);
116 _mav_put_uint16_t(buf, 24, resolution_h);
117 _mav_put_uint16_t(buf, 26, resolution_v);
118 _mav_put_uint16_t(buf, 28, cam_definition_version);
119 _mav_put_uint8_t(buf, 94, lens_id);
120 _mav_put_uint8_t(buf, 235, gimbal_device_id);
121 _mav_put_uint8_t(buf, 236, camera_device_id);
122 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
123 _mav_put_uint8_t_array(buf, 62, model_name, 32);
124 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
125 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
126#else
127 mavlink_camera_information_t packet;
128 packet.time_boot_ms = time_boot_ms;
129 packet.firmware_version = firmware_version;
130 packet.focal_length = focal_length;
131 packet.sensor_size_h = sensor_size_h;
132 packet.sensor_size_v = sensor_size_v;
133 packet.flags = flags;
134 packet.resolution_h = resolution_h;
135 packet.resolution_v = resolution_v;
136 packet.cam_definition_version = cam_definition_version;
137 packet.lens_id = lens_id;
138 packet.gimbal_device_id = gimbal_device_id;
139 packet.camera_device_id = camera_device_id;
140 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
141 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
142 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
143 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
144#endif
145
148}
149
150/**
151 * @brief Pack a camera_information message
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param status MAVLink status structure
155 * @param msg The MAVLink message to compress the data into
156 *
157 * @param time_boot_ms [ms] Timestamp (time since system boot).
158 * @param vendor_name Name of the camera vendor
159 * @param model_name Name of the camera model
160 * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.
161 * @param focal_length [mm] Focal length. Use NaN if not known.
162 * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known.
163 * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known.
164 * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known.
165 * @param resolution_v [pix] Vertical image resolution. Use 0 if not known.
166 * @param lens_id Reserved for a lens ID. Use 0 if not known.
167 * @param flags Bitmap of camera capability flags.
168 * @param cam_definition_version Camera definition version (iteration). Use 0 if not known.
169 * @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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.
170 * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.
171 * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).
172 * @return length of the message in bytes (excluding serial stream start sign)
173 */
174static inline uint16_t mavlink_msg_camera_information_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
175 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, uint8_t gimbal_device_id, uint8_t camera_device_id)
176{
177#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 _mav_put_uint32_t(buf, 0, time_boot_ms);
180 _mav_put_uint32_t(buf, 4, firmware_version);
181 _mav_put_float(buf, 8, focal_length);
182 _mav_put_float(buf, 12, sensor_size_h);
183 _mav_put_float(buf, 16, sensor_size_v);
184 _mav_put_uint32_t(buf, 20, flags);
185 _mav_put_uint16_t(buf, 24, resolution_h);
186 _mav_put_uint16_t(buf, 26, resolution_v);
187 _mav_put_uint16_t(buf, 28, cam_definition_version);
188 _mav_put_uint8_t(buf, 94, lens_id);
189 _mav_put_uint8_t(buf, 235, gimbal_device_id);
190 _mav_put_uint8_t(buf, 236, camera_device_id);
191 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
192 _mav_put_uint8_t_array(buf, 62, model_name, 32);
193 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
194 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
195#else
196 mavlink_camera_information_t packet;
197 packet.time_boot_ms = time_boot_ms;
198 packet.firmware_version = firmware_version;
199 packet.focal_length = focal_length;
200 packet.sensor_size_h = sensor_size_h;
201 packet.sensor_size_v = sensor_size_v;
202 packet.flags = flags;
203 packet.resolution_h = resolution_h;
204 packet.resolution_v = resolution_v;
205 packet.cam_definition_version = cam_definition_version;
206 packet.lens_id = lens_id;
207 packet.gimbal_device_id = gimbal_device_id;
208 packet.camera_device_id = camera_device_id;
209 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
210 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
211 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
212 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
213#endif
214
216#if MAVLINK_CRC_EXTRA
217 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_CRC);
218#else
219 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_CAMERA_INFORMATION_MIN_LEN, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
220#endif
221}
222
223/**
224 * @brief Pack a camera_information message on a channel
225 * @param system_id ID of this system
226 * @param component_id ID of this component (e.g. 200 for IMU)
227 * @param chan The MAVLink channel this message will be sent over
228 * @param msg The MAVLink message to compress the data into
229 * @param time_boot_ms [ms] Timestamp (time since system boot).
230 * @param vendor_name Name of the camera vendor
231 * @param model_name Name of the camera model
232 * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.
233 * @param focal_length [mm] Focal length. Use NaN if not known.
234 * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known.
235 * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known.
236 * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known.
237 * @param resolution_v [pix] Vertical image resolution. Use 0 if not known.
238 * @param lens_id Reserved for a lens ID. Use 0 if not known.
239 * @param flags Bitmap of camera capability flags.
240 * @param cam_definition_version Camera definition version (iteration). Use 0 if not known.
241 * @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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.
242 * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.
243 * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).
244 * @return length of the message in bytes (excluding serial stream start sign)
245 */
246static inline uint16_t mavlink_msg_camera_information_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
247 mavlink_message_t* msg,
248 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,uint8_t gimbal_device_id,uint8_t camera_device_id)
249{
250#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
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(buf, 235, gimbal_device_id);
263 _mav_put_uint8_t(buf, 236, camera_device_id);
264 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
265 _mav_put_uint8_t_array(buf, 62, model_name, 32);
266 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
267 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
268#else
269 mavlink_camera_information_t packet;
270 packet.time_boot_ms = time_boot_ms;
271 packet.firmware_version = firmware_version;
272 packet.focal_length = focal_length;
273 packet.sensor_size_h = sensor_size_h;
274 packet.sensor_size_v = sensor_size_v;
275 packet.flags = flags;
276 packet.resolution_h = resolution_h;
277 packet.resolution_v = resolution_v;
278 packet.cam_definition_version = cam_definition_version;
279 packet.lens_id = lens_id;
280 packet.gimbal_device_id = gimbal_device_id;
281 packet.camera_device_id = camera_device_id;
282 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
283 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
284 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
285 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
286#endif
287
289 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);
290}
291
292/**
293 * @brief Encode a camera_information struct
294 *
295 * @param system_id ID of this system
296 * @param component_id ID of this component (e.g. 200 for IMU)
297 * @param msg The MAVLink message to compress the data into
298 * @param camera_information C-struct to read the message contents from
299 */
300static 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)
301{
302 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, camera_information->gimbal_device_id, camera_information->camera_device_id);
303}
304
305/**
306 * @brief Encode a camera_information struct on a channel
307 *
308 * @param system_id ID of this system
309 * @param component_id ID of this component (e.g. 200 for IMU)
310 * @param chan The MAVLink channel this message will be sent over
311 * @param msg The MAVLink message to compress the data into
312 * @param camera_information C-struct to read the message contents from
313 */
314static 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)
315{
316 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, camera_information->gimbal_device_id, camera_information->camera_device_id);
317}
318
319/**
320 * @brief Encode a camera_information struct with provided status structure
321 *
322 * @param system_id ID of this system
323 * @param component_id ID of this component (e.g. 200 for IMU)
324 * @param status MAVLink status structure
325 * @param msg The MAVLink message to compress the data into
326 * @param camera_information C-struct to read the message contents from
327 */
328static inline uint16_t mavlink_msg_camera_information_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_camera_information_t* camera_information)
329{
330 return mavlink_msg_camera_information_pack_status(system_id, component_id, _status, 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, camera_information->gimbal_device_id, camera_information->camera_device_id);
331}
332
333/**
334 * @brief Send a camera_information message
335 * @param chan MAVLink channel to send the message
336 *
337 * @param time_boot_ms [ms] Timestamp (time since system boot).
338 * @param vendor_name Name of the camera vendor
339 * @param model_name Name of the camera model
340 * @param firmware_version Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.
341 * @param focal_length [mm] Focal length. Use NaN if not known.
342 * @param sensor_size_h [mm] Image sensor size horizontal. Use NaN if not known.
343 * @param sensor_size_v [mm] Image sensor size vertical. Use NaN if not known.
344 * @param resolution_h [pix] Horizontal image resolution. Use 0 if not known.
345 * @param resolution_v [pix] Vertical image resolution. Use 0 if not known.
346 * @param lens_id Reserved for a lens ID. Use 0 if not known.
347 * @param flags Bitmap of camera capability flags.
348 * @param cam_definition_version Camera definition version (iteration). Use 0 if not known.
349 * @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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.
350 * @param gimbal_device_id Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.
351 * @param camera_device_id Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).
352 */
353#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
354
355static 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, uint8_t gimbal_device_id, uint8_t camera_device_id)
356{
357#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
358 char buf[MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN];
359 _mav_put_uint32_t(buf, 0, time_boot_ms);
360 _mav_put_uint32_t(buf, 4, firmware_version);
361 _mav_put_float(buf, 8, focal_length);
362 _mav_put_float(buf, 12, sensor_size_h);
363 _mav_put_float(buf, 16, sensor_size_v);
364 _mav_put_uint32_t(buf, 20, flags);
365 _mav_put_uint16_t(buf, 24, resolution_h);
366 _mav_put_uint16_t(buf, 26, resolution_v);
367 _mav_put_uint16_t(buf, 28, cam_definition_version);
368 _mav_put_uint8_t(buf, 94, lens_id);
369 _mav_put_uint8_t(buf, 235, gimbal_device_id);
370 _mav_put_uint8_t(buf, 236, camera_device_id);
371 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
372 _mav_put_uint8_t_array(buf, 62, model_name, 32);
373 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
374 _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);
375#else
376 mavlink_camera_information_t packet;
377 packet.time_boot_ms = time_boot_ms;
378 packet.firmware_version = firmware_version;
379 packet.focal_length = focal_length;
380 packet.sensor_size_h = sensor_size_h;
381 packet.sensor_size_v = sensor_size_v;
382 packet.flags = flags;
383 packet.resolution_h = resolution_h;
384 packet.resolution_v = resolution_v;
385 packet.cam_definition_version = cam_definition_version;
386 packet.lens_id = lens_id;
387 packet.gimbal_device_id = gimbal_device_id;
388 packet.camera_device_id = camera_device_id;
389 mav_array_memcpy(packet.vendor_name, vendor_name, sizeof(uint8_t)*32);
390 mav_array_memcpy(packet.model_name, model_name, sizeof(uint8_t)*32);
391 mav_array_memcpy(packet.cam_definition_uri, cam_definition_uri, sizeof(char)*140);
392 _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);
393#endif
394}
395
396/**
397 * @brief Send a camera_information message
398 * @param chan MAVLink channel to send the message
399 * @param struct The MAVLink struct to serialize
400 */
401static inline void mavlink_msg_camera_information_send_struct(mavlink_channel_t chan, const mavlink_camera_information_t* camera_information)
402{
403#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
404 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, camera_information->gimbal_device_id, camera_information->camera_device_id);
405#else
406 _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);
407#endif
408}
409
410#if MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
411/*
412 This variant of _send() can be used to save stack space by reusing
413 memory from the receive buffer. The caller provides a
414 mavlink_message_t which is the size of a full mavlink message. This
415 is usually the receive buffer for the channel, and allows a reply to an
416 incoming message with minimum stack space usage.
417 */
418static 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, uint8_t gimbal_device_id, uint8_t camera_device_id)
419{
420#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
421 char *buf = (char *)msgbuf;
422 _mav_put_uint32_t(buf, 0, time_boot_ms);
423 _mav_put_uint32_t(buf, 4, firmware_version);
424 _mav_put_float(buf, 8, focal_length);
425 _mav_put_float(buf, 12, sensor_size_h);
426 _mav_put_float(buf, 16, sensor_size_v);
427 _mav_put_uint32_t(buf, 20, flags);
428 _mav_put_uint16_t(buf, 24, resolution_h);
429 _mav_put_uint16_t(buf, 26, resolution_v);
430 _mav_put_uint16_t(buf, 28, cam_definition_version);
431 _mav_put_uint8_t(buf, 94, lens_id);
432 _mav_put_uint8_t(buf, 235, gimbal_device_id);
433 _mav_put_uint8_t(buf, 236, camera_device_id);
434 _mav_put_uint8_t_array(buf, 30, vendor_name, 32);
435 _mav_put_uint8_t_array(buf, 62, model_name, 32);
436 _mav_put_char_array(buf, 95, cam_definition_uri, 140);
437 _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);
438#else
439 mavlink_camera_information_t *packet = (mavlink_camera_information_t *)msgbuf;
440 packet->time_boot_ms = time_boot_ms;
441 packet->firmware_version = firmware_version;
442 packet->focal_length = focal_length;
443 packet->sensor_size_h = sensor_size_h;
444 packet->sensor_size_v = sensor_size_v;
445 packet->flags = flags;
446 packet->resolution_h = resolution_h;
447 packet->resolution_v = resolution_v;
448 packet->cam_definition_version = cam_definition_version;
449 packet->lens_id = lens_id;
450 packet->gimbal_device_id = gimbal_device_id;
451 packet->camera_device_id = camera_device_id;
452 mav_array_memcpy(packet->vendor_name, vendor_name, sizeof(uint8_t)*32);
453 mav_array_memcpy(packet->model_name, model_name, sizeof(uint8_t)*32);
454 mav_array_memcpy(packet->cam_definition_uri, cam_definition_uri, sizeof(char)*140);
455 _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);
456#endif
457}
458#endif
459
460#endif
461
462// MESSAGE CAMERA_INFORMATION UNPACKING
463
464
465/**
466 * @brief Get field time_boot_ms from camera_information message
467 *
468 * @return [ms] Timestamp (time since system boot).
469 */
470static inline uint32_t mavlink_msg_camera_information_get_time_boot_ms(const mavlink_message_t* msg)
471{
472 return _MAV_RETURN_uint32_t(msg, 0);
473}
474
475/**
476 * @brief Get field vendor_name from camera_information message
477 *
478 * @return Name of the camera vendor
479 */
480static inline uint16_t mavlink_msg_camera_information_get_vendor_name(const mavlink_message_t* msg, uint8_t *vendor_name)
481{
482 return _MAV_RETURN_uint8_t_array(msg, vendor_name, 32, 30);
483}
484
485/**
486 * @brief Get field model_name from camera_information message
487 *
488 * @return Name of the camera model
489 */
490static inline uint16_t mavlink_msg_camera_information_get_model_name(const mavlink_message_t* msg, uint8_t *model_name)
491{
492 return _MAV_RETURN_uint8_t_array(msg, model_name, 32, 62);
493}
494
495/**
496 * @brief Get field firmware_version from camera_information message
497 *
498 * @return Version of the camera firmware, encoded as: `(Dev & 0xff) << 24 + (Patch & 0xff) << 16 + (Minor & 0xff) << 8 + (Major & 0xff)`. Use 0 if not known.
499 */
500static inline uint32_t mavlink_msg_camera_information_get_firmware_version(const mavlink_message_t* msg)
501{
502 return _MAV_RETURN_uint32_t(msg, 4);
503}
504
505/**
506 * @brief Get field focal_length from camera_information message
507 *
508 * @return [mm] Focal length. Use NaN if not known.
509 */
510static inline float mavlink_msg_camera_information_get_focal_length(const mavlink_message_t* msg)
511{
512 return _MAV_RETURN_float(msg, 8);
513}
514
515/**
516 * @brief Get field sensor_size_h from camera_information message
517 *
518 * @return [mm] Image sensor size horizontal. Use NaN if not known.
519 */
520static inline float mavlink_msg_camera_information_get_sensor_size_h(const mavlink_message_t* msg)
521{
522 return _MAV_RETURN_float(msg, 12);
523}
524
525/**
526 * @brief Get field sensor_size_v from camera_information message
527 *
528 * @return [mm] Image sensor size vertical. Use NaN if not known.
529 */
530static inline float mavlink_msg_camera_information_get_sensor_size_v(const mavlink_message_t* msg)
531{
532 return _MAV_RETURN_float(msg, 16);
533}
534
535/**
536 * @brief Get field resolution_h from camera_information message
537 *
538 * @return [pix] Horizontal image resolution. Use 0 if not known.
539 */
540static inline uint16_t mavlink_msg_camera_information_get_resolution_h(const mavlink_message_t* msg)
541{
542 return _MAV_RETURN_uint16_t(msg, 24);
543}
544
545/**
546 * @brief Get field resolution_v from camera_information message
547 *
548 * @return [pix] Vertical image resolution. Use 0 if not known.
549 */
550static inline uint16_t mavlink_msg_camera_information_get_resolution_v(const mavlink_message_t* msg)
551{
552 return _MAV_RETURN_uint16_t(msg, 26);
553}
554
555/**
556 * @brief Get field lens_id from camera_information message
557 *
558 * @return Reserved for a lens ID. Use 0 if not known.
559 */
560static inline uint8_t mavlink_msg_camera_information_get_lens_id(const mavlink_message_t* msg)
561{
562 return _MAV_RETURN_uint8_t(msg, 94);
563}
564
565/**
566 * @brief Get field flags from camera_information message
567 *
568 * @return Bitmap of camera capability flags.
569 */
570static inline uint32_t mavlink_msg_camera_information_get_flags(const mavlink_message_t* msg)
571{
572 return _MAV_RETURN_uint32_t(msg, 20);
573}
574
575/**
576 * @brief Get field cam_definition_version from camera_information message
577 *
578 * @return Camera definition version (iteration). Use 0 if not known.
579 */
580static inline uint16_t mavlink_msg_camera_information_get_cam_definition_version(const mavlink_message_t* msg)
581{
582 return _MAV_RETURN_uint16_t(msg, 28);
583}
584
585/**
586 * @brief Get field cam_definition_uri from camera_information message
587 *
588 * @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). The definition file may be xz compressed, which will be indicated by the file extension .xml.xz (a GCS that implements the protocol must support decompressing the file). The string needs to be zero terminated. Use a zero-length string if not known.
589 */
590static inline uint16_t mavlink_msg_camera_information_get_cam_definition_uri(const mavlink_message_t* msg, char *cam_definition_uri)
591{
592 return _MAV_RETURN_char_array(msg, cam_definition_uri, 140, 95);
593}
594
595/**
596 * @brief Get field gimbal_device_id from camera_information message
597 *
598 * @return Gimbal id of a gimbal associated with this camera. This is the component id of the gimbal device, or 1-6 for non mavlink gimbals. Use 0 if no gimbal is associated with the camera.
599 */
600static inline uint8_t mavlink_msg_camera_information_get_gimbal_device_id(const mavlink_message_t* msg)
601{
602 return _MAV_RETURN_uint8_t(msg, 235);
603}
604
605/**
606 * @brief Get field camera_device_id from camera_information message
607 *
608 * @return Camera id of a non-MAVLink camera attached to an autopilot (1-6). 0 if the component is a MAVLink camera (with its own component id).
609 */
610static inline uint8_t mavlink_msg_camera_information_get_camera_device_id(const mavlink_message_t* msg)
611{
612 return _MAV_RETURN_uint8_t(msg, 236);
613}
614
615/**
616 * @brief Decode a camera_information message into a struct
617 *
618 * @param msg The message to decode
619 * @param camera_information C-struct to decode the message contents into
620 */
621static inline void mavlink_msg_camera_information_decode(const mavlink_message_t* msg, mavlink_camera_information_t* camera_information)
622{
623#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
624 camera_information->time_boot_ms = mavlink_msg_camera_information_get_time_boot_ms(msg);
625 camera_information->firmware_version = mavlink_msg_camera_information_get_firmware_version(msg);
626 camera_information->focal_length = mavlink_msg_camera_information_get_focal_length(msg);
627 camera_information->sensor_size_h = mavlink_msg_camera_information_get_sensor_size_h(msg);
628 camera_information->sensor_size_v = mavlink_msg_camera_information_get_sensor_size_v(msg);
629 camera_information->flags = mavlink_msg_camera_information_get_flags(msg);
630 camera_information->resolution_h = mavlink_msg_camera_information_get_resolution_h(msg);
631 camera_information->resolution_v = mavlink_msg_camera_information_get_resolution_v(msg);
632 camera_information->cam_definition_version = mavlink_msg_camera_information_get_cam_definition_version(msg);
633 mavlink_msg_camera_information_get_vendor_name(msg, camera_information->vendor_name);
634 mavlink_msg_camera_information_get_model_name(msg, camera_information->model_name);
635 camera_information->lens_id = mavlink_msg_camera_information_get_lens_id(msg);
636 mavlink_msg_camera_information_get_cam_definition_uri(msg, camera_information->cam_definition_uri);
637 camera_information->gimbal_device_id = mavlink_msg_camera_information_get_gimbal_device_id(msg);
638 camera_information->camera_device_id = mavlink_msg_camera_information_get_camera_device_id(msg);
639#else
640 uint8_t len = msg->len < MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN? msg->len : MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN;
641 memset(camera_information, 0, MAVLINK_MSG_ID_CAMERA_INFORMATION_LEN);
642 memcpy(camera_information, _MAV_PAYLOAD(msg), len);
643#endif
644}