Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_debug_float_array.h
blobc3a8b31fb8a61898e608353dd849613a09712278
1 #pragma once
2 // MESSAGE DEBUG_FLOAT_ARRAY PACKING
4 #define MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY 350
7 typedef struct __mavlink_debug_float_array_t {
8 uint64_t time_usec; /*< [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.*/
9 uint16_t array_id; /*< Unique ID used to discriminate between arrays*/
10 char name[10]; /*< Name, for human-friendly display in a Ground Control Station*/
11 float data[58]; /*< data*/
12 } mavlink_debug_float_array_t;
14 #define MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN 252
15 #define MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN 20
16 #define MAVLINK_MSG_ID_350_LEN 252
17 #define MAVLINK_MSG_ID_350_MIN_LEN 20
19 #define MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC 232
20 #define MAVLINK_MSG_ID_350_CRC 232
22 #define MAVLINK_MSG_DEBUG_FLOAT_ARRAY_FIELD_NAME_LEN 10
23 #define MAVLINK_MSG_DEBUG_FLOAT_ARRAY_FIELD_DATA_LEN 58
25 #if MAVLINK_COMMAND_24BIT
26 #define MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY { \
27 350, \
28 "DEBUG_FLOAT_ARRAY", \
29 4, \
30 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_debug_float_array_t, time_usec) }, \
31 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 10, offsetof(mavlink_debug_float_array_t, name) }, \
32 { "array_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_debug_float_array_t, array_id) }, \
33 { "data", NULL, MAVLINK_TYPE_FLOAT, 58, 20, offsetof(mavlink_debug_float_array_t, data) }, \
34 } \
36 #else
37 #define MAVLINK_MESSAGE_INFO_DEBUG_FLOAT_ARRAY { \
38 "DEBUG_FLOAT_ARRAY", \
39 4, \
40 { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_debug_float_array_t, time_usec) }, \
41 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 10, offsetof(mavlink_debug_float_array_t, name) }, \
42 { "array_id", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_debug_float_array_t, array_id) }, \
43 { "data", NULL, MAVLINK_TYPE_FLOAT, 58, 20, offsetof(mavlink_debug_float_array_t, data) }, \
44 } \
46 #endif
48 /**
49 * @brief Pack a debug_float_array message
50 * @param system_id ID of this system
51 * @param component_id ID of this component (e.g. 200 for IMU)
52 * @param msg The MAVLink message to compress the data into
54 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
55 * @param name Name, for human-friendly display in a Ground Control Station
56 * @param array_id Unique ID used to discriminate between arrays
57 * @param data data
58 * @return length of the message in bytes (excluding serial stream start sign)
60 static inline uint16_t mavlink_msg_debug_float_array_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
61 uint64_t time_usec, const char *name, uint16_t array_id, const float *data)
63 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
64 char buf[MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN];
65 _mav_put_uint64_t(buf, 0, time_usec);
66 _mav_put_uint16_t(buf, 8, array_id);
67 _mav_put_char_array(buf, 10, name, 10);
68 _mav_put_float_array(buf, 20, data, 58);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN);
70 #else
71 mavlink_debug_float_array_t packet;
72 packet.time_usec = time_usec;
73 packet.array_id = array_id;
74 mav_array_memcpy(packet.name, name, sizeof(char)*10);
75 mav_array_memcpy(packet.data, data, sizeof(float)*58);
76 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN);
77 #endif
79 msg->msgid = MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY;
80 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
83 /**
84 * @brief Pack a debug_float_array message on a channel
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param chan The MAVLink channel this message will be sent over
88 * @param msg The MAVLink message to compress the data into
89 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
90 * @param name Name, for human-friendly display in a Ground Control Station
91 * @param array_id Unique ID used to discriminate between arrays
92 * @param data data
93 * @return length of the message in bytes (excluding serial stream start sign)
95 static inline uint16_t mavlink_msg_debug_float_array_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96 mavlink_message_t* msg,
97 uint64_t time_usec,const char *name,uint16_t array_id,const float *data)
99 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 char buf[MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN];
101 _mav_put_uint64_t(buf, 0, time_usec);
102 _mav_put_uint16_t(buf, 8, array_id);
103 _mav_put_char_array(buf, 10, name, 10);
104 _mav_put_float_array(buf, 20, data, 58);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN);
106 #else
107 mavlink_debug_float_array_t packet;
108 packet.time_usec = time_usec;
109 packet.array_id = array_id;
110 mav_array_memcpy(packet.name, name, sizeof(char)*10);
111 mav_array_memcpy(packet.data, data, sizeof(float)*58);
112 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN);
113 #endif
115 msg->msgid = MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY;
116 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
120 * @brief Encode a debug_float_array struct
122 * @param system_id ID of this system
123 * @param component_id ID of this component (e.g. 200 for IMU)
124 * @param msg The MAVLink message to compress the data into
125 * @param debug_float_array C-struct to read the message contents from
127 static inline uint16_t mavlink_msg_debug_float_array_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_debug_float_array_t* debug_float_array)
129 return mavlink_msg_debug_float_array_pack(system_id, component_id, msg, debug_float_array->time_usec, debug_float_array->name, debug_float_array->array_id, debug_float_array->data);
133 * @brief Encode a debug_float_array struct on a channel
135 * @param system_id ID of this system
136 * @param component_id ID of this component (e.g. 200 for IMU)
137 * @param chan The MAVLink channel this message will be sent over
138 * @param msg The MAVLink message to compress the data into
139 * @param debug_float_array C-struct to read the message contents from
141 static inline uint16_t mavlink_msg_debug_float_array_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_debug_float_array_t* debug_float_array)
143 return mavlink_msg_debug_float_array_pack_chan(system_id, component_id, chan, msg, debug_float_array->time_usec, debug_float_array->name, debug_float_array->array_id, debug_float_array->data);
147 * @brief Send a debug_float_array message
148 * @param chan MAVLink channel to send the message
150 * @param time_usec [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
151 * @param name Name, for human-friendly display in a Ground Control Station
152 * @param array_id Unique ID used to discriminate between arrays
153 * @param data data
155 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
157 static inline void mavlink_msg_debug_float_array_send(mavlink_channel_t chan, uint64_t time_usec, const char *name, uint16_t array_id, const float *data)
159 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
160 char buf[MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN];
161 _mav_put_uint64_t(buf, 0, time_usec);
162 _mav_put_uint16_t(buf, 8, array_id);
163 _mav_put_char_array(buf, 10, name, 10);
164 _mav_put_float_array(buf, 20, data, 58);
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, buf, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
166 #else
167 mavlink_debug_float_array_t packet;
168 packet.time_usec = time_usec;
169 packet.array_id = array_id;
170 mav_array_memcpy(packet.name, name, sizeof(char)*10);
171 mav_array_memcpy(packet.data, data, sizeof(float)*58);
172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, (const char *)&packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
173 #endif
177 * @brief Send a debug_float_array message
178 * @param chan MAVLink channel to send the message
179 * @param struct The MAVLink struct to serialize
181 static inline void mavlink_msg_debug_float_array_send_struct(mavlink_channel_t chan, const mavlink_debug_float_array_t* debug_float_array)
183 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 mavlink_msg_debug_float_array_send(chan, debug_float_array->time_usec, debug_float_array->name, debug_float_array->array_id, debug_float_array->data);
185 #else
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, (const char *)debug_float_array, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
187 #endif
190 #if MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN <= MAVLINK_MAX_PAYLOAD_LEN
192 This varient of _send() can be used to save stack space by re-using
193 memory from the receive buffer. The caller provides a
194 mavlink_message_t which is the size of a full mavlink message. This
195 is usually the receive buffer for the channel, and allows a reply to an
196 incoming message with minimum stack space usage.
198 static inline void mavlink_msg_debug_float_array_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint64_t time_usec, const char *name, uint16_t array_id, const float *data)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 char *buf = (char *)msgbuf;
202 _mav_put_uint64_t(buf, 0, time_usec);
203 _mav_put_uint16_t(buf, 8, array_id);
204 _mav_put_char_array(buf, 10, name, 10);
205 _mav_put_float_array(buf, 20, data, 58);
206 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, buf, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
207 #else
208 mavlink_debug_float_array_t *packet = (mavlink_debug_float_array_t *)msgbuf;
209 packet->time_usec = time_usec;
210 packet->array_id = array_id;
211 mav_array_memcpy(packet->name, name, sizeof(char)*10);
212 mav_array_memcpy(packet->data, data, sizeof(float)*58);
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY, (const char *)packet, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_MIN_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_CRC);
214 #endif
216 #endif
218 #endif
220 // MESSAGE DEBUG_FLOAT_ARRAY UNPACKING
224 * @brief Get field time_usec from debug_float_array message
226 * @return [us] Timestamp (UNIX Epoch time or time since system boot). The receiving end can infer timestamp format (since 1.1.1970 or since system boot) by checking for the magnitude of the number.
228 static inline uint64_t mavlink_msg_debug_float_array_get_time_usec(const mavlink_message_t* msg)
230 return _MAV_RETURN_uint64_t(msg, 0);
234 * @brief Get field name from debug_float_array message
236 * @return Name, for human-friendly display in a Ground Control Station
238 static inline uint16_t mavlink_msg_debug_float_array_get_name(const mavlink_message_t* msg, char *name)
240 return _MAV_RETURN_char_array(msg, name, 10, 10);
244 * @brief Get field array_id from debug_float_array message
246 * @return Unique ID used to discriminate between arrays
248 static inline uint16_t mavlink_msg_debug_float_array_get_array_id(const mavlink_message_t* msg)
250 return _MAV_RETURN_uint16_t(msg, 8);
254 * @brief Get field data from debug_float_array message
256 * @return data
258 static inline uint16_t mavlink_msg_debug_float_array_get_data(const mavlink_message_t* msg, float *data)
260 return _MAV_RETURN_float_array(msg, data, 58, 20);
264 * @brief Decode a debug_float_array message into a struct
266 * @param msg The message to decode
267 * @param debug_float_array C-struct to decode the message contents into
269 static inline void mavlink_msg_debug_float_array_decode(const mavlink_message_t* msg, mavlink_debug_float_array_t* debug_float_array)
271 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272 debug_float_array->time_usec = mavlink_msg_debug_float_array_get_time_usec(msg);
273 debug_float_array->array_id = mavlink_msg_debug_float_array_get_array_id(msg);
274 mavlink_msg_debug_float_array_get_name(msg, debug_float_array->name);
275 mavlink_msg_debug_float_array_get_data(msg, debug_float_array->data);
276 #else
277 uint8_t len = msg->len < MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN? msg->len : MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN;
278 memset(debug_float_array, 0, MAVLINK_MSG_ID_DEBUG_FLOAT_ARRAY_LEN);
279 memcpy(debug_float_array, _MAV_PAYLOAD(msg), len);
280 #endif