source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_request_data_stream.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 14.2 KB
Line 
1// MESSAGE REQUEST_DATA_STREAM PACKING
2
3#define MAVLINK_MSG_ID_REQUEST_DATA_STREAM 66
4
5typedef struct MAVLINK_PACKED __mavlink_request_data_stream_t
6{
7 uint16_t req_message_rate; /*< The requested message rate*/
8 uint8_t target_system; /*< The target requested to send the message stream.*/
9 uint8_t target_component; /*< The target requested to send the message stream.*/
10 uint8_t req_stream_id; /*< The ID of the requested data stream*/
11 uint8_t start_stop; /*< 1 to start sending, 0 to stop sending.*/
12} mavlink_request_data_stream_t;
13
14#define MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN 6
15#define MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN 6
16#define MAVLINK_MSG_ID_66_LEN 6
17#define MAVLINK_MSG_ID_66_MIN_LEN 6
18
19#define MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC 148
20#define MAVLINK_MSG_ID_66_CRC 148
21
22
23
24#if MAVLINK_COMMAND_24BIT
25#define MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM { \
26 66, \
27 "REQUEST_DATA_STREAM", \
28 5, \
29 { { "req_message_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_request_data_stream_t, req_message_rate) }, \
30 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_request_data_stream_t, target_system) }, \
31 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_request_data_stream_t, target_component) }, \
32 { "req_stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_request_data_stream_t, req_stream_id) }, \
33 { "start_stop", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_request_data_stream_t, start_stop) }, \
34 } \
35}
36#else
37#define MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM { \
38 "REQUEST_DATA_STREAM", \
39 5, \
40 { { "req_message_rate", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_request_data_stream_t, req_message_rate) }, \
41 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_request_data_stream_t, target_system) }, \
42 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_request_data_stream_t, target_component) }, \
43 { "req_stream_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_request_data_stream_t, req_stream_id) }, \
44 { "start_stop", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_request_data_stream_t, start_stop) }, \
45 } \
46}
47#endif
48
49/**
50 * @brief Pack a request_data_stream message
51 * @param system_id ID of this system
52 * @param component_id ID of this component (e.g. 200 for IMU)
53 * @param msg The MAVLink message to compress the data into
54 *
55 * @param target_system The target requested to send the message stream.
56 * @param target_component The target requested to send the message stream.
57 * @param req_stream_id The ID of the requested data stream
58 * @param req_message_rate The requested message rate
59 * @param start_stop 1 to start sending, 0 to stop sending.
60 * @return length of the message in bytes (excluding serial stream start sign)
61 */
62static inline uint16_t mavlink_msg_request_data_stream_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
63 uint8_t target_system, uint8_t target_component, uint8_t req_stream_id, uint16_t req_message_rate, uint8_t start_stop)
64{
65#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
66 char buf[MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN];
67 _mav_put_uint16_t(buf, 0, req_message_rate);
68 _mav_put_uint8_t(buf, 2, target_system);
69 _mav_put_uint8_t(buf, 3, target_component);
70 _mav_put_uint8_t(buf, 4, req_stream_id);
71 _mav_put_uint8_t(buf, 5, start_stop);
72
73 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN);
74#else
75 mavlink_request_data_stream_t packet;
76 packet.req_message_rate = req_message_rate;
77 packet.target_system = target_system;
78 packet.target_component = target_component;
79 packet.req_stream_id = req_stream_id;
80 packet.start_stop = start_stop;
81
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN);
83#endif
84
85 msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM;
86 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
87}
88
89/**
90 * @brief Pack a request_data_stream message on a channel
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param chan The MAVLink channel this message will be sent over
94 * @param msg The MAVLink message to compress the data into
95 * @param target_system The target requested to send the message stream.
96 * @param target_component The target requested to send the message stream.
97 * @param req_stream_id The ID of the requested data stream
98 * @param req_message_rate The requested message rate
99 * @param start_stop 1 to start sending, 0 to stop sending.
100 * @return length of the message in bytes (excluding serial stream start sign)
101 */
102static inline uint16_t mavlink_msg_request_data_stream_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
103 mavlink_message_t* msg,
104 uint8_t target_system,uint8_t target_component,uint8_t req_stream_id,uint16_t req_message_rate,uint8_t start_stop)
105{
106#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
107 char buf[MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN];
108 _mav_put_uint16_t(buf, 0, req_message_rate);
109 _mav_put_uint8_t(buf, 2, target_system);
110 _mav_put_uint8_t(buf, 3, target_component);
111 _mav_put_uint8_t(buf, 4, req_stream_id);
112 _mav_put_uint8_t(buf, 5, start_stop);
113
114 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN);
115#else
116 mavlink_request_data_stream_t packet;
117 packet.req_message_rate = req_message_rate;
118 packet.target_system = target_system;
119 packet.target_component = target_component;
120 packet.req_stream_id = req_stream_id;
121 packet.start_stop = start_stop;
122
123 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN);
124#endif
125
126 msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM;
127 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
128}
129
130/**
131 * @brief Encode a request_data_stream struct
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param msg The MAVLink message to compress the data into
136 * @param request_data_stream C-struct to read the message contents from
137 */
138static 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)
139{
140 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);
141}
142
143/**
144 * @brief Encode a request_data_stream struct on a channel
145 *
146 * @param system_id ID of this system
147 * @param component_id ID of this component (e.g. 200 for IMU)
148 * @param chan The MAVLink channel this message will be sent over
149 * @param msg The MAVLink message to compress the data into
150 * @param request_data_stream C-struct to read the message contents from
151 */
152static inline uint16_t mavlink_msg_request_data_stream_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_request_data_stream_t* request_data_stream)
153{
154 return mavlink_msg_request_data_stream_pack_chan(system_id, component_id, chan, 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);
155}
156
157/**
158 * @brief Send a request_data_stream message
159 * @param chan MAVLink channel to send the message
160 *
161 * @param target_system The target requested to send the message stream.
162 * @param target_component The target requested to send the message stream.
163 * @param req_stream_id The ID of the requested data stream
164 * @param req_message_rate The requested message rate
165 * @param start_stop 1 to start sending, 0 to stop sending.
166 */
167#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
168
169static 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)
170{
171#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
172 char buf[MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN];
173 _mav_put_uint16_t(buf, 0, req_message_rate);
174 _mav_put_uint8_t(buf, 2, target_system);
175 _mav_put_uint8_t(buf, 3, target_component);
176 _mav_put_uint8_t(buf, 4, req_stream_id);
177 _mav_put_uint8_t(buf, 5, start_stop);
178
179 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, buf, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
180#else
181 mavlink_request_data_stream_t packet;
182 packet.req_message_rate = req_message_rate;
183 packet.target_system = target_system;
184 packet.target_component = target_component;
185 packet.req_stream_id = req_stream_id;
186 packet.start_stop = start_stop;
187
188 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, (const char *)&packet, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
189#endif
190}
191
192/**
193 * @brief Send a request_data_stream message
194 * @param chan MAVLink channel to send the message
195 * @param struct The MAVLink struct to serialize
196 */
197static inline void mavlink_msg_request_data_stream_send_struct(mavlink_channel_t chan, const mavlink_request_data_stream_t* request_data_stream)
198{
199#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
200 mavlink_msg_request_data_stream_send(chan, 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);
201#else
202 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, (const char *)request_data_stream, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
203#endif
204}
205
206#if MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN <= MAVLINK_MAX_PAYLOAD_LEN
207/*
208 This varient of _send() can be used to save stack space by re-using
209 memory from the receive buffer. The caller provides a
210 mavlink_message_t which is the size of a full mavlink message. This
211 is usually the receive buffer for the channel, and allows a reply to an
212 incoming message with minimum stack space usage.
213 */
214static inline void mavlink_msg_request_data_stream_send_buf(mavlink_message_t *msgbuf, 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)
215{
216#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
217 char *buf = (char *)msgbuf;
218 _mav_put_uint16_t(buf, 0, req_message_rate);
219 _mav_put_uint8_t(buf, 2, target_system);
220 _mav_put_uint8_t(buf, 3, target_component);
221 _mav_put_uint8_t(buf, 4, req_stream_id);
222 _mav_put_uint8_t(buf, 5, start_stop);
223
224 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, buf, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
225#else
226 mavlink_request_data_stream_t *packet = (mavlink_request_data_stream_t *)msgbuf;
227 packet->req_message_rate = req_message_rate;
228 packet->target_system = target_system;
229 packet->target_component = target_component;
230 packet->req_stream_id = req_stream_id;
231 packet->start_stop = start_stop;
232
233 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, (const char *)packet, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_CRC);
234#endif
235}
236#endif
237
238#endif
239
240// MESSAGE REQUEST_DATA_STREAM UNPACKING
241
242
243/**
244 * @brief Get field target_system from request_data_stream message
245 *
246 * @return The target requested to send the message stream.
247 */
248static inline uint8_t mavlink_msg_request_data_stream_get_target_system(const mavlink_message_t* msg)
249{
250 return _MAV_RETURN_uint8_t(msg, 2);
251}
252
253/**
254 * @brief Get field target_component from request_data_stream message
255 *
256 * @return The target requested to send the message stream.
257 */
258static inline uint8_t mavlink_msg_request_data_stream_get_target_component(const mavlink_message_t* msg)
259{
260 return _MAV_RETURN_uint8_t(msg, 3);
261}
262
263/**
264 * @brief Get field req_stream_id from request_data_stream message
265 *
266 * @return The ID of the requested data stream
267 */
268static inline uint8_t mavlink_msg_request_data_stream_get_req_stream_id(const mavlink_message_t* msg)
269{
270 return _MAV_RETURN_uint8_t(msg, 4);
271}
272
273/**
274 * @brief Get field req_message_rate from request_data_stream message
275 *
276 * @return The requested message rate
277 */
278static inline uint16_t mavlink_msg_request_data_stream_get_req_message_rate(const mavlink_message_t* msg)
279{
280 return _MAV_RETURN_uint16_t(msg, 0);
281}
282
283/**
284 * @brief Get field start_stop from request_data_stream message
285 *
286 * @return 1 to start sending, 0 to stop sending.
287 */
288static inline uint8_t mavlink_msg_request_data_stream_get_start_stop(const mavlink_message_t* msg)
289{
290 return _MAV_RETURN_uint8_t(msg, 5);
291}
292
293/**
294 * @brief Decode a request_data_stream message into a struct
295 *
296 * @param msg The message to decode
297 * @param request_data_stream C-struct to decode the message contents into
298 */
299static inline void mavlink_msg_request_data_stream_decode(const mavlink_message_t* msg, mavlink_request_data_stream_t* request_data_stream)
300{
301#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
302 request_data_stream->req_message_rate = mavlink_msg_request_data_stream_get_req_message_rate(msg);
303 request_data_stream->target_system = mavlink_msg_request_data_stream_get_target_system(msg);
304 request_data_stream->target_component = mavlink_msg_request_data_stream_get_target_component(msg);
305 request_data_stream->req_stream_id = mavlink_msg_request_data_stream_get_req_stream_id(msg);
306 request_data_stream->start_stop = mavlink_msg_request_data_stream_get_start_stop(msg);
307#else
308 uint8_t len = msg->len < MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN? msg->len : MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN;
309 memset(request_data_stream, 0, MAVLINK_MSG_ID_REQUEST_DATA_STREAM_LEN);
310 memcpy(request_data_stream, _MAV_PAYLOAD(msg), len);
311#endif
312}
Note: See TracBrowser for help on using the repository browser.