Merge pull request #10476 from radiolinkW/RADIOLINKF722
[inav.git] / lib / main / MAVLink / common / mavlink_msg_gimbal_manager_status.h
blob4eace068bb120fbe8ec0d2d00325d900c91713eb
1 #pragma once
2 // MESSAGE GIMBAL_MANAGER_STATUS PACKING
4 #define MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS 281
7 typedef struct __mavlink_gimbal_manager_status_t {
8 uint32_t time_boot_ms; /*< [ms] Timestamp (time since system boot).*/
9 uint32_t flags; /*< High level gimbal manager flags currently applied.*/
10 uint8_t gimbal_device_id; /*< Gimbal device ID that this gimbal manager is responsible for.*/
11 uint8_t primary_control_sysid; /*< System ID of MAVLink component with primary control, 0 for none.*/
12 uint8_t primary_control_compid; /*< Component ID of MAVLink component with primary control, 0 for none.*/
13 uint8_t secondary_control_sysid; /*< System ID of MAVLink component with secondary control, 0 for none.*/
14 uint8_t secondary_control_compid; /*< Component ID of MAVLink component with secondary control, 0 for none.*/
15 } mavlink_gimbal_manager_status_t;
17 #define MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN 13
18 #define MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN 13
19 #define MAVLINK_MSG_ID_281_LEN 13
20 #define MAVLINK_MSG_ID_281_MIN_LEN 13
22 #define MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC 48
23 #define MAVLINK_MSG_ID_281_CRC 48
27 #if MAVLINK_COMMAND_24BIT
28 #define MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS { \
29 281, \
30 "GIMBAL_MANAGER_STATUS", \
31 7, \
32 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_manager_status_t, time_boot_ms) }, \
33 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gimbal_manager_status_t, flags) }, \
34 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gimbal_manager_status_t, gimbal_device_id) }, \
35 { "primary_control_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gimbal_manager_status_t, primary_control_sysid) }, \
36 { "primary_control_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gimbal_manager_status_t, primary_control_compid) }, \
37 { "secondary_control_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gimbal_manager_status_t, secondary_control_sysid) }, \
38 { "secondary_control_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gimbal_manager_status_t, secondary_control_compid) }, \
39 } \
41 #else
42 #define MAVLINK_MESSAGE_INFO_GIMBAL_MANAGER_STATUS { \
43 "GIMBAL_MANAGER_STATUS", \
44 7, \
45 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_gimbal_manager_status_t, time_boot_ms) }, \
46 { "flags", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_gimbal_manager_status_t, flags) }, \
47 { "gimbal_device_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gimbal_manager_status_t, gimbal_device_id) }, \
48 { "primary_control_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_gimbal_manager_status_t, primary_control_sysid) }, \
49 { "primary_control_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_gimbal_manager_status_t, primary_control_compid) }, \
50 { "secondary_control_sysid", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_gimbal_manager_status_t, secondary_control_sysid) }, \
51 { "secondary_control_compid", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_gimbal_manager_status_t, secondary_control_compid) }, \
52 } \
54 #endif
56 /**
57 * @brief Pack a gimbal_manager_status message
58 * @param system_id ID of this system
59 * @param component_id ID of this component (e.g. 200 for IMU)
60 * @param msg The MAVLink message to compress the data into
62 * @param time_boot_ms [ms] Timestamp (time since system boot).
63 * @param flags High level gimbal manager flags currently applied.
64 * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for.
65 * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none.
66 * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none.
67 * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none.
68 * @param secondary_control_compid Component ID of MAVLink component with secondary control, 0 for none.
69 * @return length of the message in bytes (excluding serial stream start sign)
71 static inline uint16_t mavlink_msg_gimbal_manager_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
72 uint32_t time_boot_ms, uint32_t flags, uint8_t gimbal_device_id, uint8_t primary_control_sysid, uint8_t primary_control_compid, uint8_t secondary_control_sysid, uint8_t secondary_control_compid)
74 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
75 char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN];
76 _mav_put_uint32_t(buf, 0, time_boot_ms);
77 _mav_put_uint32_t(buf, 4, flags);
78 _mav_put_uint8_t(buf, 8, gimbal_device_id);
79 _mav_put_uint8_t(buf, 9, primary_control_sysid);
80 _mav_put_uint8_t(buf, 10, primary_control_compid);
81 _mav_put_uint8_t(buf, 11, secondary_control_sysid);
82 _mav_put_uint8_t(buf, 12, secondary_control_compid);
84 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN);
85 #else
86 mavlink_gimbal_manager_status_t packet;
87 packet.time_boot_ms = time_boot_ms;
88 packet.flags = flags;
89 packet.gimbal_device_id = gimbal_device_id;
90 packet.primary_control_sysid = primary_control_sysid;
91 packet.primary_control_compid = primary_control_compid;
92 packet.secondary_control_sysid = secondary_control_sysid;
93 packet.secondary_control_compid = secondary_control_compid;
95 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN);
96 #endif
98 msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS;
99 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
103 * @brief Pack a gimbal_manager_status message on a channel
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param chan The MAVLink channel this message will be sent over
107 * @param msg The MAVLink message to compress the data into
108 * @param time_boot_ms [ms] Timestamp (time since system boot).
109 * @param flags High level gimbal manager flags currently applied.
110 * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for.
111 * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none.
112 * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none.
113 * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none.
114 * @param secondary_control_compid Component ID of MAVLink component with secondary control, 0 for none.
115 * @return length of the message in bytes (excluding serial stream start sign)
117 static inline uint16_t mavlink_msg_gimbal_manager_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
118 mavlink_message_t* msg,
119 uint32_t time_boot_ms,uint32_t flags,uint8_t gimbal_device_id,uint8_t primary_control_sysid,uint8_t primary_control_compid,uint8_t secondary_control_sysid,uint8_t secondary_control_compid)
121 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
122 char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN];
123 _mav_put_uint32_t(buf, 0, time_boot_ms);
124 _mav_put_uint32_t(buf, 4, flags);
125 _mav_put_uint8_t(buf, 8, gimbal_device_id);
126 _mav_put_uint8_t(buf, 9, primary_control_sysid);
127 _mav_put_uint8_t(buf, 10, primary_control_compid);
128 _mav_put_uint8_t(buf, 11, secondary_control_sysid);
129 _mav_put_uint8_t(buf, 12, secondary_control_compid);
131 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN);
132 #else
133 mavlink_gimbal_manager_status_t packet;
134 packet.time_boot_ms = time_boot_ms;
135 packet.flags = flags;
136 packet.gimbal_device_id = gimbal_device_id;
137 packet.primary_control_sysid = primary_control_sysid;
138 packet.primary_control_compid = primary_control_compid;
139 packet.secondary_control_sysid = secondary_control_sysid;
140 packet.secondary_control_compid = secondary_control_compid;
142 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN);
143 #endif
145 msg->msgid = MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS;
146 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
150 * @brief Encode a gimbal_manager_status struct
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param msg The MAVLink message to compress the data into
155 * @param gimbal_manager_status C-struct to read the message contents from
157 static inline uint16_t mavlink_msg_gimbal_manager_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gimbal_manager_status_t* gimbal_manager_status)
159 return mavlink_msg_gimbal_manager_status_pack(system_id, component_id, msg, gimbal_manager_status->time_boot_ms, gimbal_manager_status->flags, gimbal_manager_status->gimbal_device_id, gimbal_manager_status->primary_control_sysid, gimbal_manager_status->primary_control_compid, gimbal_manager_status->secondary_control_sysid, gimbal_manager_status->secondary_control_compid);
163 * @brief Encode a gimbal_manager_status struct on a channel
165 * @param system_id ID of this system
166 * @param component_id ID of this component (e.g. 200 for IMU)
167 * @param chan The MAVLink channel this message will be sent over
168 * @param msg The MAVLink message to compress the data into
169 * @param gimbal_manager_status C-struct to read the message contents from
171 static inline uint16_t mavlink_msg_gimbal_manager_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_gimbal_manager_status_t* gimbal_manager_status)
173 return mavlink_msg_gimbal_manager_status_pack_chan(system_id, component_id, chan, msg, gimbal_manager_status->time_boot_ms, gimbal_manager_status->flags, gimbal_manager_status->gimbal_device_id, gimbal_manager_status->primary_control_sysid, gimbal_manager_status->primary_control_compid, gimbal_manager_status->secondary_control_sysid, gimbal_manager_status->secondary_control_compid);
177 * @brief Send a gimbal_manager_status message
178 * @param chan MAVLink channel to send the message
180 * @param time_boot_ms [ms] Timestamp (time since system boot).
181 * @param flags High level gimbal manager flags currently applied.
182 * @param gimbal_device_id Gimbal device ID that this gimbal manager is responsible for.
183 * @param primary_control_sysid System ID of MAVLink component with primary control, 0 for none.
184 * @param primary_control_compid Component ID of MAVLink component with primary control, 0 for none.
185 * @param secondary_control_sysid System ID of MAVLink component with secondary control, 0 for none.
186 * @param secondary_control_compid Component ID of MAVLink component with secondary control, 0 for none.
188 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
190 static inline void mavlink_msg_gimbal_manager_status_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t flags, uint8_t gimbal_device_id, uint8_t primary_control_sysid, uint8_t primary_control_compid, uint8_t secondary_control_sysid, uint8_t secondary_control_compid)
192 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
193 char buf[MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN];
194 _mav_put_uint32_t(buf, 0, time_boot_ms);
195 _mav_put_uint32_t(buf, 4, flags);
196 _mav_put_uint8_t(buf, 8, gimbal_device_id);
197 _mav_put_uint8_t(buf, 9, primary_control_sysid);
198 _mav_put_uint8_t(buf, 10, primary_control_compid);
199 _mav_put_uint8_t(buf, 11, secondary_control_sysid);
200 _mav_put_uint8_t(buf, 12, secondary_control_compid);
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
203 #else
204 mavlink_gimbal_manager_status_t packet;
205 packet.time_boot_ms = time_boot_ms;
206 packet.flags = flags;
207 packet.gimbal_device_id = gimbal_device_id;
208 packet.primary_control_sysid = primary_control_sysid;
209 packet.primary_control_compid = primary_control_compid;
210 packet.secondary_control_sysid = secondary_control_sysid;
211 packet.secondary_control_compid = secondary_control_compid;
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, (const char *)&packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
214 #endif
218 * @brief Send a gimbal_manager_status message
219 * @param chan MAVLink channel to send the message
220 * @param struct The MAVLink struct to serialize
222 static inline void mavlink_msg_gimbal_manager_status_send_struct(mavlink_channel_t chan, const mavlink_gimbal_manager_status_t* gimbal_manager_status)
224 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
225 mavlink_msg_gimbal_manager_status_send(chan, gimbal_manager_status->time_boot_ms, gimbal_manager_status->flags, gimbal_manager_status->gimbal_device_id, gimbal_manager_status->primary_control_sysid, gimbal_manager_status->primary_control_compid, gimbal_manager_status->secondary_control_sysid, gimbal_manager_status->secondary_control_compid);
226 #else
227 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, (const char *)gimbal_manager_status, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
228 #endif
231 #if MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
233 This varient of _send() can be used to save stack space by re-using
234 memory from the receive buffer. The caller provides a
235 mavlink_message_t which is the size of a full mavlink message. This
236 is usually the receive buffer for the channel, and allows a reply to an
237 incoming message with minimum stack space usage.
239 static inline void mavlink_msg_gimbal_manager_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint32_t time_boot_ms, uint32_t flags, uint8_t gimbal_device_id, uint8_t primary_control_sysid, uint8_t primary_control_compid, uint8_t secondary_control_sysid, uint8_t secondary_control_compid)
241 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
242 char *buf = (char *)msgbuf;
243 _mav_put_uint32_t(buf, 0, time_boot_ms);
244 _mav_put_uint32_t(buf, 4, flags);
245 _mav_put_uint8_t(buf, 8, gimbal_device_id);
246 _mav_put_uint8_t(buf, 9, primary_control_sysid);
247 _mav_put_uint8_t(buf, 10, primary_control_compid);
248 _mav_put_uint8_t(buf, 11, secondary_control_sysid);
249 _mav_put_uint8_t(buf, 12, secondary_control_compid);
251 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, buf, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
252 #else
253 mavlink_gimbal_manager_status_t *packet = (mavlink_gimbal_manager_status_t *)msgbuf;
254 packet->time_boot_ms = time_boot_ms;
255 packet->flags = flags;
256 packet->gimbal_device_id = gimbal_device_id;
257 packet->primary_control_sysid = primary_control_sysid;
258 packet->primary_control_compid = primary_control_compid;
259 packet->secondary_control_sysid = secondary_control_sysid;
260 packet->secondary_control_compid = secondary_control_compid;
262 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS, (const char *)packet, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_MIN_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_CRC);
263 #endif
265 #endif
267 #endif
269 // MESSAGE GIMBAL_MANAGER_STATUS UNPACKING
273 * @brief Get field time_boot_ms from gimbal_manager_status message
275 * @return [ms] Timestamp (time since system boot).
277 static inline uint32_t mavlink_msg_gimbal_manager_status_get_time_boot_ms(const mavlink_message_t* msg)
279 return _MAV_RETURN_uint32_t(msg, 0);
283 * @brief Get field flags from gimbal_manager_status message
285 * @return High level gimbal manager flags currently applied.
287 static inline uint32_t mavlink_msg_gimbal_manager_status_get_flags(const mavlink_message_t* msg)
289 return _MAV_RETURN_uint32_t(msg, 4);
293 * @brief Get field gimbal_device_id from gimbal_manager_status message
295 * @return Gimbal device ID that this gimbal manager is responsible for.
297 static inline uint8_t mavlink_msg_gimbal_manager_status_get_gimbal_device_id(const mavlink_message_t* msg)
299 return _MAV_RETURN_uint8_t(msg, 8);
303 * @brief Get field primary_control_sysid from gimbal_manager_status message
305 * @return System ID of MAVLink component with primary control, 0 for none.
307 static inline uint8_t mavlink_msg_gimbal_manager_status_get_primary_control_sysid(const mavlink_message_t* msg)
309 return _MAV_RETURN_uint8_t(msg, 9);
313 * @brief Get field primary_control_compid from gimbal_manager_status message
315 * @return Component ID of MAVLink component with primary control, 0 for none.
317 static inline uint8_t mavlink_msg_gimbal_manager_status_get_primary_control_compid(const mavlink_message_t* msg)
319 return _MAV_RETURN_uint8_t(msg, 10);
323 * @brief Get field secondary_control_sysid from gimbal_manager_status message
325 * @return System ID of MAVLink component with secondary control, 0 for none.
327 static inline uint8_t mavlink_msg_gimbal_manager_status_get_secondary_control_sysid(const mavlink_message_t* msg)
329 return _MAV_RETURN_uint8_t(msg, 11);
333 * @brief Get field secondary_control_compid from gimbal_manager_status message
335 * @return Component ID of MAVLink component with secondary control, 0 for none.
337 static inline uint8_t mavlink_msg_gimbal_manager_status_get_secondary_control_compid(const mavlink_message_t* msg)
339 return _MAV_RETURN_uint8_t(msg, 12);
343 * @brief Decode a gimbal_manager_status message into a struct
345 * @param msg The message to decode
346 * @param gimbal_manager_status C-struct to decode the message contents into
348 static inline void mavlink_msg_gimbal_manager_status_decode(const mavlink_message_t* msg, mavlink_gimbal_manager_status_t* gimbal_manager_status)
350 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
351 gimbal_manager_status->time_boot_ms = mavlink_msg_gimbal_manager_status_get_time_boot_ms(msg);
352 gimbal_manager_status->flags = mavlink_msg_gimbal_manager_status_get_flags(msg);
353 gimbal_manager_status->gimbal_device_id = mavlink_msg_gimbal_manager_status_get_gimbal_device_id(msg);
354 gimbal_manager_status->primary_control_sysid = mavlink_msg_gimbal_manager_status_get_primary_control_sysid(msg);
355 gimbal_manager_status->primary_control_compid = mavlink_msg_gimbal_manager_status_get_primary_control_compid(msg);
356 gimbal_manager_status->secondary_control_sysid = mavlink_msg_gimbal_manager_status_get_secondary_control_sysid(msg);
357 gimbal_manager_status->secondary_control_compid = mavlink_msg_gimbal_manager_status_get_secondary_control_compid(msg);
358 #else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN? msg->len : MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN;
360 memset(gimbal_manager_status, 0, MAVLINK_MSG_ID_GIMBAL_MANAGER_STATUS_LEN);
361 memcpy(gimbal_manager_status, _MAV_PAYLOAD(msg), len);
362 #endif