1 // MESSAGE REQUEST_DATA_STREAM PACKING
3 #define MAVLINK_MSG_ID_REQUEST_DATA_STREAM 66
5 typedef struct __mavlink_request_data_stream_t
{
6 uint16_t req_message_rate
; ///< The requested interval between two messages of this type
7 uint8_t target_system
; ///< The target requested to send the message stream.
8 uint8_t target_component
; ///< The target requested to send the message stream.
9 uint8_t req_stream_id
; ///< The ID of the requested data stream
10 uint8_t start_stop
; ///< 1 to start sending, 0 to stop sending.
11 } mavlink_request_data_stream_t
;
13 #define MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN 6
14 #define MAVLINK_MSG_ID_66_LEN 6
17 #define MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM \
19 "REQUEST_DATA_STREAM", \
22 { "req_message_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_request_data_stream_t, req_message_rate) }, \
23 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_request_data_stream_t, target_system) }, \
24 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_request_data_stream_t, target_component) }, \
25 { "req_stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_request_data_stream_t, req_stream_id) }, \
26 { "start_stop", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_request_data_stream_t, start_stop) }, \
32 * @brief Pack a request_data_stream message
33 * @param system_id ID of this system
34 * @param component_id ID of this component (e.g. 200 for IMU)
35 * @param msg The MAVLink message to compress the data into
37 * @param target_system The target requested to send the message stream.
38 * @param target_component The target requested to send the message stream.
39 * @param req_stream_id The ID of the requested data stream
40 * @param req_message_rate The requested interval between two messages of this type
41 * @param start_stop 1 to start sending, 0 to stop sending.
42 * @return length of the message in bytes (excluding serial stream start sign)
44 static inline uint16_t mavlink_msg_request_data_stream_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
,
45 uint8_t target_system
, uint8_t target_component
, uint8_t req_stream_id
, uint16_t req_message_rate
, uint8_t start_stop
)
47 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
49 _mav_put_uint16_t(buf
, 0, req_message_rate
);
50 _mav_put_uint8_t(buf
, 2, target_system
);
51 _mav_put_uint8_t(buf
, 3, target_component
);
52 _mav_put_uint8_t(buf
, 4, req_stream_id
);
53 _mav_put_uint8_t(buf
, 5, start_stop
);
55 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 6);
57 mavlink_request_data_stream_t packet
;
58 packet
.req_message_rate
= req_message_rate
;
59 packet
.target_system
= target_system
;
60 packet
.target_component
= target_component
;
61 packet
.req_stream_id
= req_stream_id
;
62 packet
.start_stop
= start_stop
;
64 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 6);
67 msg
->msgid
= MAVLINK_MSG_ID_REQUEST_DATA_STREAM
;
68 return mavlink_finalize_message(msg
, system_id
, component_id
, 6, 148);
72 * @brief Pack a request_data_stream message on a channel
73 * @param system_id ID of this system
74 * @param component_id ID of this component (e.g. 200 for IMU)
75 * @param chan The MAVLink channel this message was sent over
76 * @param msg The MAVLink message to compress the data into
77 * @param target_system The target requested to send the message stream.
78 * @param target_component The target requested to send the message stream.
79 * @param req_stream_id The ID of the requested data stream
80 * @param req_message_rate The requested interval between two messages of this type
81 * @param start_stop 1 to start sending, 0 to stop sending.
82 * @return length of the message in bytes (excluding serial stream start sign)
84 static inline uint16_t mavlink_msg_request_data_stream_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
85 mavlink_message_t
*msg
,
86 uint8_t target_system
, uint8_t target_component
, uint8_t req_stream_id
, uint16_t req_message_rate
, uint8_t start_stop
)
88 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
90 _mav_put_uint16_t(buf
, 0, req_message_rate
);
91 _mav_put_uint8_t(buf
, 2, target_system
);
92 _mav_put_uint8_t(buf
, 3, target_component
);
93 _mav_put_uint8_t(buf
, 4, req_stream_id
);
94 _mav_put_uint8_t(buf
, 5, start_stop
);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, 6);
98 mavlink_request_data_stream_t packet
;
99 packet
.req_message_rate
= req_message_rate
;
100 packet
.target_system
= target_system
;
101 packet
.target_component
= target_component
;
102 packet
.req_stream_id
= req_stream_id
;
103 packet
.start_stop
= start_stop
;
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, 6);
108 msg
->msgid
= MAVLINK_MSG_ID_REQUEST_DATA_STREAM
;
109 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, 6, 148);
113 * @brief Encode a request_data_stream struct into a message
115 * @param system_id ID of this system
116 * @param component_id ID of this component (e.g. 200 for IMU)
117 * @param msg The MAVLink message to compress the data into
118 * @param request_data_stream C-struct to read the message contents from
120 static inline uint16_t mavlink_msg_request_data_stream_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
*msg
, const mavlink_request_data_stream_t
*request_data_stream
)
122 return mavlink_msg_request_data_stream_pack(system_id
, component_id
, msg
, request_data_stream
->target_system
, request_data_stream
->target_component
, request_data_stream
->req_stream_id
, request_data_stream
->req_message_rate
, request_data_stream
->start_stop
);
126 * @brief Send a request_data_stream message
127 * @param chan MAVLink channel to send the message
129 * @param target_system The target requested to send the message stream.
130 * @param target_component The target requested to send the message stream.
131 * @param req_stream_id The ID of the requested data stream
132 * @param req_message_rate The requested interval between two messages of this type
133 * @param start_stop 1 to start sending, 0 to stop sending.
135 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
137 static inline void mavlink_msg_request_data_stream_send(mavlink_channel_t chan
, uint8_t target_system
, uint8_t target_component
, uint8_t req_stream_id
, uint16_t req_message_rate
, uint8_t start_stop
)
139 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
141 _mav_put_uint16_t(buf
, 0, req_message_rate
);
142 _mav_put_uint8_t(buf
, 2, target_system
);
143 _mav_put_uint8_t(buf
, 3, target_component
);
144 _mav_put_uint8_t(buf
, 4, req_stream_id
);
145 _mav_put_uint8_t(buf
, 5, start_stop
);
147 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_REQUEST_DATA_STREAM
, buf
, 6, 148);
149 mavlink_request_data_stream_t packet
;
150 packet
.req_message_rate
= req_message_rate
;
151 packet
.target_system
= target_system
;
152 packet
.target_component
= target_component
;
153 packet
.req_stream_id
= req_stream_id
;
154 packet
.start_stop
= start_stop
;
156 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_REQUEST_DATA_STREAM
, (const char *)&packet
, 6, 148);
160 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
162 // MESSAGE REQUEST_DATA_STREAM UNPACKING
166 * @brief Get field target_system from request_data_stream message
168 * @return The target requested to send the message stream.
170 static inline uint8_t mavlink_msg_request_data_stream_get_target_system(const mavlink_message_t
*msg
)
172 return _MAV_RETURN_uint8_t(msg
, 2);
176 * @brief Get field target_component from request_data_stream message
178 * @return The target requested to send the message stream.
180 static inline uint8_t mavlink_msg_request_data_stream_get_target_component(const mavlink_message_t
*msg
)
182 return _MAV_RETURN_uint8_t(msg
, 3);
186 * @brief Get field req_stream_id from request_data_stream message
188 * @return The ID of the requested data stream
190 static inline uint8_t mavlink_msg_request_data_stream_get_req_stream_id(const mavlink_message_t
*msg
)
192 return _MAV_RETURN_uint8_t(msg
, 4);
196 * @brief Get field req_message_rate from request_data_stream message
198 * @return The requested interval between two messages of this type
200 static inline uint16_t mavlink_msg_request_data_stream_get_req_message_rate(const mavlink_message_t
*msg
)
202 return _MAV_RETURN_uint16_t(msg
, 0);
206 * @brief Get field start_stop from request_data_stream message
208 * @return 1 to start sending, 0 to stop sending.
210 static inline uint8_t mavlink_msg_request_data_stream_get_start_stop(const mavlink_message_t
*msg
)
212 return _MAV_RETURN_uint8_t(msg
, 5);
216 * @brief Decode a request_data_stream message into a struct
218 * @param msg The message to decode
219 * @param request_data_stream C-struct to decode the message contents into
221 static inline void mavlink_msg_request_data_stream_decode(const mavlink_message_t
*msg
, mavlink_request_data_stream_t
*request_data_stream
)
223 #if MAVLINK_NEED_BYTE_SWAP
224 request_data_stream
->req_message_rate
= mavlink_msg_request_data_stream_get_req_message_rate(msg
);
225 request_data_stream
->target_system
= mavlink_msg_request_data_stream_get_target_system(msg
);
226 request_data_stream
->target_component
= mavlink_msg_request_data_stream_get_target_component(msg
);
227 request_data_stream
->req_stream_id
= mavlink_msg_request_data_stream_get_req_stream_id(msg
);
228 request_data_stream
->start_stop
= mavlink_msg_request_data_stream_get_start_stop(msg
);
230 memcpy(request_data_stream
, _MAV_PAYLOAD(msg
), 6);