2 // MESSAGE CAMERA_SETTINGS PACKING
4 #define MAVLINK_MSG_ID_CAMERA_SETTINGS 260
7 typedef struct __mavlink_camera_settings_t
{
8 uint32_t time_boot_ms
; /*< [ms] Timestamp (time since system boot).*/
9 uint8_t mode_id
; /*< Camera mode*/
10 float zoomLevel
; /*< Current zoom level (0.0 to 100.0, NaN if not known)*/
11 float focusLevel
; /*< Current focus level (0.0 to 100.0, NaN if not known)*/
12 }) mavlink_camera_settings_t
;
14 #define MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN 13
15 #define MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN 5
16 #define MAVLINK_MSG_ID_260_LEN 13
17 #define MAVLINK_MSG_ID_260_MIN_LEN 5
19 #define MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC 146
20 #define MAVLINK_MSG_ID_260_CRC 146
24 #if MAVLINK_COMMAND_24BIT
25 #define MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS { \
29 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_settings_t, time_boot_ms) }, \
30 { "mode_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_camera_settings_t, mode_id) }, \
31 { "zoomLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 5, offsetof(mavlink_camera_settings_t, zoomLevel) }, \
32 { "focusLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_camera_settings_t, focusLevel) }, \
36 #define MAVLINK_MESSAGE_INFO_CAMERA_SETTINGS { \
39 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_camera_settings_t, time_boot_ms) }, \
40 { "mode_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_camera_settings_t, mode_id) }, \
41 { "zoomLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 5, offsetof(mavlink_camera_settings_t, zoomLevel) }, \
42 { "focusLevel", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_camera_settings_t, focusLevel) }, \
48 * @brief Pack a camera_settings message
49 * @param system_id ID of this system
50 * @param component_id ID of this component (e.g. 200 for IMU)
51 * @param msg The MAVLink message to compress the data into
53 * @param time_boot_ms [ms] Timestamp (time since system boot).
54 * @param mode_id Camera mode
55 * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known)
56 * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known)
57 * @return length of the message in bytes (excluding serial stream start sign)
59 static inline uint16_t mavlink_msg_camera_settings_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
60 uint32_t time_boot_ms
, uint8_t mode_id
, float zoomLevel
, float focusLevel
)
62 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63 char buf
[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
];
64 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
65 _mav_put_uint8_t(buf
, 4, mode_id
);
66 _mav_put_float(buf
, 5, zoomLevel
);
67 _mav_put_float(buf
, 9, focusLevel
);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
);
71 mavlink_camera_settings_t packet
;
72 packet
.time_boot_ms
= time_boot_ms
;
73 packet
.mode_id
= mode_id
;
74 packet
.zoomLevel
= zoomLevel
;
75 packet
.focusLevel
= focusLevel
;
77 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
);
80 msg
->msgid
= MAVLINK_MSG_ID_CAMERA_SETTINGS
;
81 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
85 * @brief Pack a camera_settings message on a channel
86 * @param system_id ID of this system
87 * @param component_id ID of this component (e.g. 200 for IMU)
88 * @param chan The MAVLink channel this message will be sent over
89 * @param msg The MAVLink message to compress the data into
90 * @param time_boot_ms [ms] Timestamp (time since system boot).
91 * @param mode_id Camera mode
92 * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known)
93 * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known)
94 * @return length of the message in bytes (excluding serial stream start sign)
96 static inline uint16_t mavlink_msg_camera_settings_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
97 mavlink_message_t
* msg
,
98 uint32_t time_boot_ms
,uint8_t mode_id
,float zoomLevel
,float focusLevel
)
100 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
101 char buf
[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
];
102 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
103 _mav_put_uint8_t(buf
, 4, mode_id
);
104 _mav_put_float(buf
, 5, zoomLevel
);
105 _mav_put_float(buf
, 9, focusLevel
);
107 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
);
109 mavlink_camera_settings_t packet
;
110 packet
.time_boot_ms
= time_boot_ms
;
111 packet
.mode_id
= mode_id
;
112 packet
.zoomLevel
= zoomLevel
;
113 packet
.focusLevel
= focusLevel
;
115 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
);
118 msg
->msgid
= MAVLINK_MSG_ID_CAMERA_SETTINGS
;
119 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
123 * @brief Encode a camera_settings struct
125 * @param system_id ID of this system
126 * @param component_id ID of this component (e.g. 200 for IMU)
127 * @param msg The MAVLink message to compress the data into
128 * @param camera_settings C-struct to read the message contents from
130 static inline uint16_t mavlink_msg_camera_settings_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_camera_settings_t
* camera_settings
)
132 return mavlink_msg_camera_settings_pack(system_id
, component_id
, msg
, camera_settings
->time_boot_ms
, camera_settings
->mode_id
, camera_settings
->zoomLevel
, camera_settings
->focusLevel
);
136 * @brief Encode a camera_settings struct on a channel
138 * @param system_id ID of this system
139 * @param component_id ID of this component (e.g. 200 for IMU)
140 * @param chan The MAVLink channel this message will be sent over
141 * @param msg The MAVLink message to compress the data into
142 * @param camera_settings C-struct to read the message contents from
144 static inline uint16_t mavlink_msg_camera_settings_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_camera_settings_t
* camera_settings
)
146 return mavlink_msg_camera_settings_pack_chan(system_id
, component_id
, chan
, msg
, camera_settings
->time_boot_ms
, camera_settings
->mode_id
, camera_settings
->zoomLevel
, camera_settings
->focusLevel
);
150 * @brief Send a camera_settings message
151 * @param chan MAVLink channel to send the message
153 * @param time_boot_ms [ms] Timestamp (time since system boot).
154 * @param mode_id Camera mode
155 * @param zoomLevel Current zoom level (0.0 to 100.0, NaN if not known)
156 * @param focusLevel Current focus level (0.0 to 100.0, NaN if not known)
158 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
160 static inline void mavlink_msg_camera_settings_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, uint8_t mode_id
, float zoomLevel
, float focusLevel
)
162 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
163 char buf
[MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
];
164 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
165 _mav_put_uint8_t(buf
, 4, mode_id
);
166 _mav_put_float(buf
, 5, zoomLevel
);
167 _mav_put_float(buf
, 9, focusLevel
);
169 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS
, buf
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
171 mavlink_camera_settings_t packet
;
172 packet
.time_boot_ms
= time_boot_ms
;
173 packet
.mode_id
= mode_id
;
174 packet
.zoomLevel
= zoomLevel
;
175 packet
.focusLevel
= focusLevel
;
177 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS
, (const char *)&packet
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
182 * @brief Send a camera_settings message
183 * @param chan MAVLink channel to send the message
184 * @param struct The MAVLink struct to serialize
186 static inline void mavlink_msg_camera_settings_send_struct(mavlink_channel_t chan
, const mavlink_camera_settings_t
* camera_settings
)
188 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
189 mavlink_msg_camera_settings_send(chan
, camera_settings
->time_boot_ms
, camera_settings
->mode_id
, camera_settings
->zoomLevel
, camera_settings
->focusLevel
);
191 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS
, (const char *)camera_settings
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
195 #if MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
197 This varient of _send() can be used to save stack space by re-using
198 memory from the receive buffer. The caller provides a
199 mavlink_message_t which is the size of a full mavlink message. This
200 is usually the receive buffer for the channel, and allows a reply to an
201 incoming message with minimum stack space usage.
203 static inline void mavlink_msg_camera_settings_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint32_t time_boot_ms
, uint8_t mode_id
, float zoomLevel
, float focusLevel
)
205 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
206 char *buf
= (char *)msgbuf
;
207 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
208 _mav_put_uint8_t(buf
, 4, mode_id
);
209 _mav_put_float(buf
, 5, zoomLevel
);
210 _mav_put_float(buf
, 9, focusLevel
);
212 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS
, buf
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
214 mavlink_camera_settings_t
*packet
= (mavlink_camera_settings_t
*)msgbuf
;
215 packet
->time_boot_ms
= time_boot_ms
;
216 packet
->mode_id
= mode_id
;
217 packet
->zoomLevel
= zoomLevel
;
218 packet
->focusLevel
= focusLevel
;
220 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_CAMERA_SETTINGS
, (const char *)packet
, MAVLINK_MSG_ID_CAMERA_SETTINGS_MIN_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
, MAVLINK_MSG_ID_CAMERA_SETTINGS_CRC
);
227 // MESSAGE CAMERA_SETTINGS UNPACKING
231 * @brief Get field time_boot_ms from camera_settings message
233 * @return [ms] Timestamp (time since system boot).
235 static inline uint32_t mavlink_msg_camera_settings_get_time_boot_ms(const mavlink_message_t
* msg
)
237 return _MAV_RETURN_uint32_t(msg
, 0);
241 * @brief Get field mode_id from camera_settings message
243 * @return Camera mode
245 static inline uint8_t mavlink_msg_camera_settings_get_mode_id(const mavlink_message_t
* msg
)
247 return _MAV_RETURN_uint8_t(msg
, 4);
251 * @brief Get field zoomLevel from camera_settings message
253 * @return Current zoom level (0.0 to 100.0, NaN if not known)
255 static inline float mavlink_msg_camera_settings_get_zoomLevel(const mavlink_message_t
* msg
)
257 return _MAV_RETURN_float(msg
, 5);
261 * @brief Get field focusLevel from camera_settings message
263 * @return Current focus level (0.0 to 100.0, NaN if not known)
265 static inline float mavlink_msg_camera_settings_get_focusLevel(const mavlink_message_t
* msg
)
267 return _MAV_RETURN_float(msg
, 9);
271 * @brief Decode a camera_settings message into a struct
273 * @param msg The message to decode
274 * @param camera_settings C-struct to decode the message contents into
276 static inline void mavlink_msg_camera_settings_decode(const mavlink_message_t
* msg
, mavlink_camera_settings_t
* camera_settings
)
278 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
279 camera_settings
->time_boot_ms
= mavlink_msg_camera_settings_get_time_boot_ms(msg
);
280 camera_settings
->mode_id
= mavlink_msg_camera_settings_get_mode_id(msg
);
281 camera_settings
->zoomLevel
= mavlink_msg_camera_settings_get_zoomLevel(msg
);
282 camera_settings
->focusLevel
= mavlink_msg_camera_settings_get_focusLevel(msg
);
284 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
? msg
->len
: MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
;
285 memset(camera_settings
, 0, MAVLINK_MSG_ID_CAMERA_SETTINGS_LEN
);
286 memcpy(camera_settings
, _MAV_PAYLOAD(msg
), len
);