Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_debug_vect.h
blobac1c6df35cb2800306e96497e4ae4309bfe613de
1 // MESSAGE DEBUG_VECT PACKING
3 #define MAVLINK_MSG_ID_DEBUG_VECT 250
5 typedef struct __mavlink_debug_vect_t {
6 uint64_t time_usec; ///< Timestamp
7 float x; ///< x
8 float y; ///< y
9 float z; ///< z
10 char name[10]; ///< Name
11 } mavlink_debug_vect_t;
13 #define MAVLINK_MSG_ID_DEBUG_VECT_LEN 30
14 #define MAVLINK_MSG_ID_250_LEN 30
16 #define MAVLINK_MSG_DEBUG_VECT_FIELD_NAME_LEN 10
18 #define MAVLINK_MESSAGE_INFO_DEBUG_VECT \
19 { \
20 "DEBUG_VECT", \
21 5, \
22 { \
23 { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_debug_vect_t, time_usec) }, \
24 { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_debug_vect_t, x) }, \
25 { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_debug_vect_t, y) }, \
26 { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_debug_vect_t, z) }, \
27 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 20, offsetof(mavlink_debug_vect_t, name) }, \
28 } \
32 /**
33 * @brief Pack a debug_vect message
34 * @param system_id ID of this system
35 * @param component_id ID of this component (e.g. 200 for IMU)
36 * @param msg The MAVLink message to compress the data into
38 * @param name Name
39 * @param time_usec Timestamp
40 * @param x x
41 * @param y y
42 * @param z z
43 * @return length of the message in bytes (excluding serial stream start sign)
45 static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
46 const char *name, uint64_t time_usec, float x, float y, float z)
48 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
49 char buf[30];
50 _mav_put_uint64_t(buf, 0, time_usec);
51 _mav_put_float(buf, 8, x);
52 _mav_put_float(buf, 12, y);
53 _mav_put_float(buf, 16, z);
54 _mav_put_char_array(buf, 20, name, 10);
55 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 30);
56 #else
57 mavlink_debug_vect_t packet;
58 packet.time_usec = time_usec;
59 packet.x = x;
60 packet.y = y;
61 packet.z = z;
62 mav_array_memcpy(packet.name, name, sizeof(char) * 10);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 30);
64 #endif
66 msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
67 return mavlink_finalize_message(msg, system_id, component_id, 30, 49);
70 /**
71 * @brief Pack a debug_vect message on a channel
72 * @param system_id ID of this system
73 * @param component_id ID of this component (e.g. 200 for IMU)
74 * @param chan The MAVLink channel this message was sent over
75 * @param msg The MAVLink message to compress the data into
76 * @param name Name
77 * @param time_usec Timestamp
78 * @param x x
79 * @param y y
80 * @param z z
81 * @return length of the message in bytes (excluding serial stream start sign)
83 static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
84 mavlink_message_t *msg,
85 const char *name, uint64_t time_usec, float x, float y, float z)
87 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
88 char buf[30];
89 _mav_put_uint64_t(buf, 0, time_usec);
90 _mav_put_float(buf, 8, x);
91 _mav_put_float(buf, 12, y);
92 _mav_put_float(buf, 16, z);
93 _mav_put_char_array(buf, 20, name, 10);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 30);
95 #else
96 mavlink_debug_vect_t packet;
97 packet.time_usec = time_usec;
98 packet.x = x;
99 packet.y = y;
100 packet.z = z;
101 mav_array_memcpy(packet.name, name, sizeof(char) * 10);
102 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 30);
103 #endif
105 msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
106 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 30, 49);
110 * @brief Encode a debug_vect struct into a message
112 * @param system_id ID of this system
113 * @param component_id ID of this component (e.g. 200 for IMU)
114 * @param msg The MAVLink message to compress the data into
115 * @param debug_vect C-struct to read the message contents from
117 static 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)
119 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);
123 * @brief Send a debug_vect message
124 * @param chan MAVLink channel to send the message
126 * @param name Name
127 * @param time_usec Timestamp
128 * @param x x
129 * @param y y
130 * @param z z
132 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
134 static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const char *name, uint64_t time_usec, float x, float y, float z)
136 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
137 char buf[30];
138 _mav_put_uint64_t(buf, 0, time_usec);
139 _mav_put_float(buf, 8, x);
140 _mav_put_float(buf, 12, y);
141 _mav_put_float(buf, 16, z);
142 _mav_put_char_array(buf, 20, name, 10);
143 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, 30, 49);
144 #else
145 mavlink_debug_vect_t packet;
146 packet.time_usec = time_usec;
147 packet.x = x;
148 packet.y = y;
149 packet.z = z;
150 mav_array_memcpy(packet.name, name, sizeof(char) * 10);
151 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, 30, 49);
152 #endif
155 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
157 // MESSAGE DEBUG_VECT UNPACKING
161 * @brief Get field name from debug_vect message
163 * @return Name
165 static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t *msg, char *name)
167 return _MAV_RETURN_char_array(msg, name, 10, 20);
171 * @brief Get field time_usec from debug_vect message
173 * @return Timestamp
175 static inline uint64_t mavlink_msg_debug_vect_get_time_usec(const mavlink_message_t *msg)
177 return _MAV_RETURN_uint64_t(msg, 0);
181 * @brief Get field x from debug_vect message
183 * @return x
185 static inline float mavlink_msg_debug_vect_get_x(const mavlink_message_t *msg)
187 return _MAV_RETURN_float(msg, 8);
191 * @brief Get field y from debug_vect message
193 * @return y
195 static inline float mavlink_msg_debug_vect_get_y(const mavlink_message_t *msg)
197 return _MAV_RETURN_float(msg, 12);
201 * @brief Get field z from debug_vect message
203 * @return z
205 static inline float mavlink_msg_debug_vect_get_z(const mavlink_message_t *msg)
207 return _MAV_RETURN_float(msg, 16);
211 * @brief Decode a debug_vect message into a struct
213 * @param msg The message to decode
214 * @param debug_vect C-struct to decode the message contents into
216 static inline void mavlink_msg_debug_vect_decode(const mavlink_message_t *msg, mavlink_debug_vect_t *debug_vect)
218 #if MAVLINK_NEED_BYTE_SWAP
219 debug_vect->time_usec = mavlink_msg_debug_vect_get_time_usec(msg);
220 debug_vect->x = mavlink_msg_debug_vect_get_x(msg);
221 debug_vect->y = mavlink_msg_debug_vect_get_y(msg);
222 debug_vect->z = mavlink_msg_debug_vect_get_z(msg);
223 mavlink_msg_debug_vect_get_name(msg, debug_vect->name);
224 #else
225 memcpy(debug_vect, _MAV_PAYLOAD(msg), 30);
226 #endif