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