Merge pull request #10476 from radiolinkW/RADIOLINKF722
[inav.git] / lib / main / MAVLink / common / mavlink_msg_video_stream_status.h
blob380941005ee6d5adcc947aa0bf38bff8e88e3aca
1 #pragma once
2 // MESSAGE VIDEO_STREAM_STATUS PACKING
4 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS 270
7 typedef struct __mavlink_video_stream_status_t {
8 float framerate; /*< [Hz] Frame rate*/
9 uint32_t bitrate; /*< [bits/s] Bit rate*/
10 uint16_t flags; /*< Bitmap of stream status flags*/
11 uint16_t resolution_h; /*< [pix] Horizontal resolution*/
12 uint16_t resolution_v; /*< [pix] Vertical resolution*/
13 uint16_t rotation; /*< [deg] Video image rotation clockwise*/
14 uint16_t hfov; /*< [deg] Horizontal Field of view*/
15 uint8_t stream_id; /*< Video Stream ID (1 for first, 2 for second, etc.)*/
16 } mavlink_video_stream_status_t;
18 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN 19
19 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN 19
20 #define MAVLINK_MSG_ID_270_LEN 19
21 #define MAVLINK_MSG_ID_270_MIN_LEN 19
23 #define MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC 59
24 #define MAVLINK_MSG_ID_270_CRC 59
28 #if MAVLINK_COMMAND_24BIT
29 #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS { \
30 270, \
31 "VIDEO_STREAM_STATUS", \
32 8, \
33 { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_status_t, stream_id) }, \
34 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_status_t, flags) }, \
35 { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_status_t, framerate) }, \
36 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_video_stream_status_t, resolution_h) }, \
37 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_video_stream_status_t, resolution_v) }, \
38 { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_status_t, bitrate) }, \
39 { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_status_t, rotation) }, \
40 { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_status_t, hfov) }, \
41 } \
43 #else
44 #define MAVLINK_MESSAGE_INFO_VIDEO_STREAM_STATUS { \
45 "VIDEO_STREAM_STATUS", \
46 8, \
47 { { "stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 18, offsetof(mavlink_video_stream_status_t, stream_id) }, \
48 { "flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_video_stream_status_t, flags) }, \
49 { "framerate", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_video_stream_status_t, framerate) }, \
50 { "resolution_h", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_video_stream_status_t, resolution_h) }, \
51 { "resolution_v", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_video_stream_status_t, resolution_v) }, \
52 { "bitrate", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_video_stream_status_t, bitrate) }, \
53 { "rotation", NULL, MAVLINK_TYPE_UINT16_T, 0, 14, offsetof(mavlink_video_stream_status_t, rotation) }, \
54 { "hfov", NULL, MAVLINK_TYPE_UINT16_T, 0, 16, offsetof(mavlink_video_stream_status_t, hfov) }, \
55 } \
57 #endif
59 /**
60 * @brief Pack a video_stream_status message
61 * @param system_id ID of this system
62 * @param component_id ID of this component (e.g. 200 for IMU)
63 * @param msg The MAVLink message to compress the data into
65 * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
66 * @param flags Bitmap of stream status flags
67 * @param framerate [Hz] Frame rate
68 * @param resolution_h [pix] Horizontal resolution
69 * @param resolution_v [pix] Vertical resolution
70 * @param bitrate [bits/s] Bit rate
71 * @param rotation [deg] Video image rotation clockwise
72 * @param hfov [deg] Horizontal Field of view
73 * @return length of the message in bytes (excluding serial stream start sign)
75 static inline uint16_t mavlink_msg_video_stream_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
76 uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov)
78 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
79 char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN];
80 _mav_put_float(buf, 0, framerate);
81 _mav_put_uint32_t(buf, 4, bitrate);
82 _mav_put_uint16_t(buf, 8, flags);
83 _mav_put_uint16_t(buf, 10, resolution_h);
84 _mav_put_uint16_t(buf, 12, resolution_v);
85 _mav_put_uint16_t(buf, 14, rotation);
86 _mav_put_uint16_t(buf, 16, hfov);
87 _mav_put_uint8_t(buf, 18, stream_id);
89 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN);
90 #else
91 mavlink_video_stream_status_t packet;
92 packet.framerate = framerate;
93 packet.bitrate = bitrate;
94 packet.flags = flags;
95 packet.resolution_h = resolution_h;
96 packet.resolution_v = resolution_v;
97 packet.rotation = rotation;
98 packet.hfov = hfov;
99 packet.stream_id = stream_id;
101 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN);
102 #endif
104 msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_STATUS;
105 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
109 * @brief Pack a video_stream_status message on a channel
110 * @param system_id ID of this system
111 * @param component_id ID of this component (e.g. 200 for IMU)
112 * @param chan The MAVLink channel this message will be sent over
113 * @param msg The MAVLink message to compress the data into
114 * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
115 * @param flags Bitmap of stream status flags
116 * @param framerate [Hz] Frame rate
117 * @param resolution_h [pix] Horizontal resolution
118 * @param resolution_v [pix] Vertical resolution
119 * @param bitrate [bits/s] Bit rate
120 * @param rotation [deg] Video image rotation clockwise
121 * @param hfov [deg] Horizontal Field of view
122 * @return length of the message in bytes (excluding serial stream start sign)
124 static inline uint16_t mavlink_msg_video_stream_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
125 mavlink_message_t* msg,
126 uint8_t stream_id,uint16_t flags,float framerate,uint16_t resolution_h,uint16_t resolution_v,uint32_t bitrate,uint16_t rotation,uint16_t hfov)
128 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
129 char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN];
130 _mav_put_float(buf, 0, framerate);
131 _mav_put_uint32_t(buf, 4, bitrate);
132 _mav_put_uint16_t(buf, 8, flags);
133 _mav_put_uint16_t(buf, 10, resolution_h);
134 _mav_put_uint16_t(buf, 12, resolution_v);
135 _mav_put_uint16_t(buf, 14, rotation);
136 _mav_put_uint16_t(buf, 16, hfov);
137 _mav_put_uint8_t(buf, 18, stream_id);
139 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN);
140 #else
141 mavlink_video_stream_status_t packet;
142 packet.framerate = framerate;
143 packet.bitrate = bitrate;
144 packet.flags = flags;
145 packet.resolution_h = resolution_h;
146 packet.resolution_v = resolution_v;
147 packet.rotation = rotation;
148 packet.hfov = hfov;
149 packet.stream_id = stream_id;
151 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN);
152 #endif
154 msg->msgid = MAVLINK_MSG_ID_VIDEO_STREAM_STATUS;
155 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
159 * @brief Encode a video_stream_status struct
161 * @param system_id ID of this system
162 * @param component_id ID of this component (e.g. 200 for IMU)
163 * @param msg The MAVLink message to compress the data into
164 * @param video_stream_status C-struct to read the message contents from
166 static inline uint16_t mavlink_msg_video_stream_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_video_stream_status_t* video_stream_status)
168 return mavlink_msg_video_stream_status_pack(system_id, component_id, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov);
172 * @brief Encode a video_stream_status struct on a channel
174 * @param system_id ID of this system
175 * @param component_id ID of this component (e.g. 200 for IMU)
176 * @param chan The MAVLink channel this message will be sent over
177 * @param msg The MAVLink message to compress the data into
178 * @param video_stream_status C-struct to read the message contents from
180 static inline uint16_t mavlink_msg_video_stream_status_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_video_stream_status_t* video_stream_status)
182 return mavlink_msg_video_stream_status_pack_chan(system_id, component_id, chan, msg, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov);
186 * @brief Send a video_stream_status message
187 * @param chan MAVLink channel to send the message
189 * @param stream_id Video Stream ID (1 for first, 2 for second, etc.)
190 * @param flags Bitmap of stream status flags
191 * @param framerate [Hz] Frame rate
192 * @param resolution_h [pix] Horizontal resolution
193 * @param resolution_v [pix] Vertical resolution
194 * @param bitrate [bits/s] Bit rate
195 * @param rotation [deg] Video image rotation clockwise
196 * @param hfov [deg] Horizontal Field of view
198 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
200 static inline void mavlink_msg_video_stream_status_send(mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov)
202 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
203 char buf[MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN];
204 _mav_put_float(buf, 0, framerate);
205 _mav_put_uint32_t(buf, 4, bitrate);
206 _mav_put_uint16_t(buf, 8, flags);
207 _mav_put_uint16_t(buf, 10, resolution_h);
208 _mav_put_uint16_t(buf, 12, resolution_v);
209 _mav_put_uint16_t(buf, 14, rotation);
210 _mav_put_uint16_t(buf, 16, hfov);
211 _mav_put_uint8_t(buf, 18, stream_id);
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
214 #else
215 mavlink_video_stream_status_t packet;
216 packet.framerate = framerate;
217 packet.bitrate = bitrate;
218 packet.flags = flags;
219 packet.resolution_h = resolution_h;
220 packet.resolution_v = resolution_v;
221 packet.rotation = rotation;
222 packet.hfov = hfov;
223 packet.stream_id = stream_id;
225 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)&packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
226 #endif
230 * @brief Send a video_stream_status message
231 * @param chan MAVLink channel to send the message
232 * @param struct The MAVLink struct to serialize
234 static inline void mavlink_msg_video_stream_status_send_struct(mavlink_channel_t chan, const mavlink_video_stream_status_t* video_stream_status)
236 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
237 mavlink_msg_video_stream_status_send(chan, video_stream_status->stream_id, video_stream_status->flags, video_stream_status->framerate, video_stream_status->resolution_h, video_stream_status->resolution_v, video_stream_status->bitrate, video_stream_status->rotation, video_stream_status->hfov);
238 #else
239 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)video_stream_status, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
240 #endif
243 #if MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN <= MAVLINK_MAX_PAYLOAD_LEN
245 This varient of _send() can be used to save stack space by re-using
246 memory from the receive buffer. The caller provides a
247 mavlink_message_t which is the size of a full mavlink message. This
248 is usually the receive buffer for the channel, and allows a reply to an
249 incoming message with minimum stack space usage.
251 static inline void mavlink_msg_video_stream_status_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t stream_id, uint16_t flags, float framerate, uint16_t resolution_h, uint16_t resolution_v, uint32_t bitrate, uint16_t rotation, uint16_t hfov)
253 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
254 char *buf = (char *)msgbuf;
255 _mav_put_float(buf, 0, framerate);
256 _mav_put_uint32_t(buf, 4, bitrate);
257 _mav_put_uint16_t(buf, 8, flags);
258 _mav_put_uint16_t(buf, 10, resolution_h);
259 _mav_put_uint16_t(buf, 12, resolution_v);
260 _mav_put_uint16_t(buf, 14, rotation);
261 _mav_put_uint16_t(buf, 16, hfov);
262 _mav_put_uint8_t(buf, 18, stream_id);
264 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, buf, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
265 #else
266 mavlink_video_stream_status_t *packet = (mavlink_video_stream_status_t *)msgbuf;
267 packet->framerate = framerate;
268 packet->bitrate = bitrate;
269 packet->flags = flags;
270 packet->resolution_h = resolution_h;
271 packet->resolution_v = resolution_v;
272 packet->rotation = rotation;
273 packet->hfov = hfov;
274 packet->stream_id = stream_id;
276 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS, (const char *)packet, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_MIN_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_CRC);
277 #endif
279 #endif
281 #endif
283 // MESSAGE VIDEO_STREAM_STATUS UNPACKING
287 * @brief Get field stream_id from video_stream_status message
289 * @return Video Stream ID (1 for first, 2 for second, etc.)
291 static inline uint8_t mavlink_msg_video_stream_status_get_stream_id(const mavlink_message_t* msg)
293 return _MAV_RETURN_uint8_t(msg, 18);
297 * @brief Get field flags from video_stream_status message
299 * @return Bitmap of stream status flags
301 static inline uint16_t mavlink_msg_video_stream_status_get_flags(const mavlink_message_t* msg)
303 return _MAV_RETURN_uint16_t(msg, 8);
307 * @brief Get field framerate from video_stream_status message
309 * @return [Hz] Frame rate
311 static inline float mavlink_msg_video_stream_status_get_framerate(const mavlink_message_t* msg)
313 return _MAV_RETURN_float(msg, 0);
317 * @brief Get field resolution_h from video_stream_status message
319 * @return [pix] Horizontal resolution
321 static inline uint16_t mavlink_msg_video_stream_status_get_resolution_h(const mavlink_message_t* msg)
323 return _MAV_RETURN_uint16_t(msg, 10);
327 * @brief Get field resolution_v from video_stream_status message
329 * @return [pix] Vertical resolution
331 static inline uint16_t mavlink_msg_video_stream_status_get_resolution_v(const mavlink_message_t* msg)
333 return _MAV_RETURN_uint16_t(msg, 12);
337 * @brief Get field bitrate from video_stream_status message
339 * @return [bits/s] Bit rate
341 static inline uint32_t mavlink_msg_video_stream_status_get_bitrate(const mavlink_message_t* msg)
343 return _MAV_RETURN_uint32_t(msg, 4);
347 * @brief Get field rotation from video_stream_status message
349 * @return [deg] Video image rotation clockwise
351 static inline uint16_t mavlink_msg_video_stream_status_get_rotation(const mavlink_message_t* msg)
353 return _MAV_RETURN_uint16_t(msg, 14);
357 * @brief Get field hfov from video_stream_status message
359 * @return [deg] Horizontal Field of view
361 static inline uint16_t mavlink_msg_video_stream_status_get_hfov(const mavlink_message_t* msg)
363 return _MAV_RETURN_uint16_t(msg, 16);
367 * @brief Decode a video_stream_status message into a struct
369 * @param msg The message to decode
370 * @param video_stream_status C-struct to decode the message contents into
372 static inline void mavlink_msg_video_stream_status_decode(const mavlink_message_t* msg, mavlink_video_stream_status_t* video_stream_status)
374 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
375 video_stream_status->framerate = mavlink_msg_video_stream_status_get_framerate(msg);
376 video_stream_status->bitrate = mavlink_msg_video_stream_status_get_bitrate(msg);
377 video_stream_status->flags = mavlink_msg_video_stream_status_get_flags(msg);
378 video_stream_status->resolution_h = mavlink_msg_video_stream_status_get_resolution_h(msg);
379 video_stream_status->resolution_v = mavlink_msg_video_stream_status_get_resolution_v(msg);
380 video_stream_status->rotation = mavlink_msg_video_stream_status_get_rotation(msg);
381 video_stream_status->hfov = mavlink_msg_video_stream_status_get_hfov(msg);
382 video_stream_status->stream_id = mavlink_msg_video_stream_status_get_stream_id(msg);
383 #else
384 uint8_t len = msg->len < MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN? msg->len : MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN;
385 memset(video_stream_status, 0, MAVLINK_MSG_ID_VIDEO_STREAM_STATUS_LEN);
386 memcpy(video_stream_status, _MAV_PAYLOAD(msg), len);
387 #endif