Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE REQUEST_DATA_STREAM PACKING
2
 
3
#define MAVLINK_MSG_ID_REQUEST_DATA_STREAM 66
4
 
5
typedef struct __mavlink_request_data_stream_t
6
{
7
 uint16_t req_message_rate; ///< The requested interval between two messages of this type
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_66_LEN 6
16
 
17
 
18
 
19
#define MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM { \
20
        "REQUEST_DATA_STREAM", \
21
        5, \
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) }, \
27
         } \
28
}
29
 
30
 
31
/**
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
36
 *
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)
43
 */
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)
46
{
47
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48
        char buf[6];
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);
54
 
55
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 6);
56
#else
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;
63
 
64
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 6);
65
#endif
66
 
67
        msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM;
68
        return mavlink_finalize_message(msg, system_id, component_id, 6, 148);
69
}
70
 
71
/**
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)
83
 */
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)
87
{
88
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
89
        char buf[6];
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);
95
 
96
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 6);
97
#else
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;
104
 
105
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 6);
106
#endif
107
 
108
        msg->msgid = MAVLINK_MSG_ID_REQUEST_DATA_STREAM;
109
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 6, 148);
110
}
111
 
112
/**
113
 * @brief Encode a request_data_stream struct into a message
114
 *
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
119
 */
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)
121
{
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);
123
}
124
 
125
/**
126
 * @brief Send a request_data_stream message
127
 * @param chan MAVLink channel to send the message
128
 *
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.
134
 */
135
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
136
 
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)
138
{
139
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
140
        char buf[6];
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);
146
 
147
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, buf, 6, 148);
148
#else
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;
155
 
156
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_REQUEST_DATA_STREAM, (const char *)&packet, 6, 148);
157
#endif
158
}
159
 
160
#endif
161
 
162
// MESSAGE REQUEST_DATA_STREAM UNPACKING
163
 
164
 
165
/**
166
 * @brief Get field target_system from request_data_stream message
167
 *
168
 * @return The target requested to send the message stream.
169
 */
170
static inline uint8_t mavlink_msg_request_data_stream_get_target_system(const mavlink_message_t* msg)
171
{
172
        return _MAV_RETURN_uint8_t(msg,  2);
173
}
174
 
175
/**
176
 * @brief Get field target_component from request_data_stream message
177
 *
178
 * @return The target requested to send the message stream.
179
 */
180
static inline uint8_t mavlink_msg_request_data_stream_get_target_component(const mavlink_message_t* msg)
181
{
182
        return _MAV_RETURN_uint8_t(msg,  3);
183
}
184
 
185
/**
186
 * @brief Get field req_stream_id from request_data_stream message
187
 *
188
 * @return The ID of the requested data stream
189
 */
190
static inline uint8_t mavlink_msg_request_data_stream_get_req_stream_id(const mavlink_message_t* msg)
191
{
192
        return _MAV_RETURN_uint8_t(msg,  4);
193
}
194
 
195
/**
196
 * @brief Get field req_message_rate from request_data_stream message
197
 *
198
 * @return The requested interval between two messages of this type
199
 */
200
static inline uint16_t mavlink_msg_request_data_stream_get_req_message_rate(const mavlink_message_t* msg)
201
{
202
        return _MAV_RETURN_uint16_t(msg,  0);
203
}
204
 
205
/**
206
 * @brief Get field start_stop from request_data_stream message
207
 *
208
 * @return 1 to start sending, 0 to stop sending.
209
 */
210
static inline uint8_t mavlink_msg_request_data_stream_get_start_stop(const mavlink_message_t* msg)
211
{
212
        return _MAV_RETURN_uint8_t(msg,  5);
213
}
214
 
215
/**
216
 * @brief Decode a request_data_stream message into a struct
217
 *
218
 * @param msg The message to decode
219
 * @param request_data_stream C-struct to decode the message contents into
220
 */
221
static inline void mavlink_msg_request_data_stream_decode(const mavlink_message_t* msg, mavlink_request_data_stream_t* request_data_stream)
222
{
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);
229
#else
230
        memcpy(request_data_stream, _MAV_PAYLOAD(msg), 6);
231
#endif
232
}