1 // MESSAGE NAMED_VALUE_FLOAT PACKING
3 #define MAVLINK_MSG_ID_NAMED_VALUE_FLOAT 251
5 typedef struct __mavlink_named_value_float_t
7 uint32_t time_boot_ms
; ///< Timestamp (milliseconds since system boot)
8 float value
; ///< Floating point value
9 char name
[10]; ///< Name of the debug variable
10 } mavlink_named_value_float_t
;
12 #define MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN 18
13 #define MAVLINK_MSG_ID_251_LEN 18
15 #define MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC 170
16 #define MAVLINK_MSG_ID_251_CRC 170
18 #define MAVLINK_MSG_NAMED_VALUE_FLOAT_FIELD_NAME_LEN 10
20 #define MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT { \
21 "NAMED_VALUE_FLOAT", \
23 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_named_value_float_t, time_boot_ms) }, \
24 { "value", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_named_value_float_t, value) }, \
25 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 8, offsetof(mavlink_named_value_float_t, name) }, \
31 * @brief Pack a named_value_float message
32 * @param system_id ID of this system
33 * @param component_id ID of this component (e.g. 200 for IMU)
34 * @param msg The MAVLink message to compress the data into
36 * @param time_boot_ms Timestamp (milliseconds since system boot)
37 * @param name Name of the debug variable
38 * @param value Floating point value
39 * @return length of the message in bytes (excluding serial stream start sign)
41 static inline uint16_t mavlink_msg_named_value_float_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
42 uint32_t time_boot_ms
, const char *name
, float value
)
44 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
45 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
];
46 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
47 _mav_put_float(buf
, 4, value
);
48 _mav_put_char_array(buf
, 8, name
, 10);
49 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
51 mavlink_named_value_float_t packet
;
52 packet
.time_boot_ms
= time_boot_ms
;
54 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
55 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
58 msg
->msgid
= MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
;
60 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
62 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
67 * @brief Pack a named_value_float message on a channel
68 * @param system_id ID of this system
69 * @param component_id ID of this component (e.g. 200 for IMU)
70 * @param chan The MAVLink channel this message will be sent over
71 * @param msg The MAVLink message to compress the data into
72 * @param time_boot_ms Timestamp (milliseconds since system boot)
73 * @param name Name of the debug variable
74 * @param value Floating point value
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_named_value_float_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
78 mavlink_message_t
* msg
,
79 uint32_t time_boot_ms
,const char *name
,float value
)
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
];
83 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
84 _mav_put_float(buf
, 4, value
);
85 _mav_put_char_array(buf
, 8, name
, 10);
86 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
88 mavlink_named_value_float_t packet
;
89 packet
.time_boot_ms
= time_boot_ms
;
91 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
92 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
95 msg
->msgid
= MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
;
97 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
99 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
104 * @brief Encode a named_value_float struct
106 * @param system_id ID of this system
107 * @param component_id ID of this component (e.g. 200 for IMU)
108 * @param msg The MAVLink message to compress the data into
109 * @param named_value_float C-struct to read the message contents from
111 static inline uint16_t mavlink_msg_named_value_float_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_named_value_float_t
* named_value_float
)
113 return mavlink_msg_named_value_float_pack(system_id
, component_id
, msg
, named_value_float
->time_boot_ms
, named_value_float
->name
, named_value_float
->value
);
117 * @brief Encode a named_value_float struct on a channel
119 * @param system_id ID of this system
120 * @param component_id ID of this component (e.g. 200 for IMU)
121 * @param chan The MAVLink channel this message will be sent over
122 * @param msg The MAVLink message to compress the data into
123 * @param named_value_float C-struct to read the message contents from
125 static inline uint16_t mavlink_msg_named_value_float_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_named_value_float_t
* named_value_float
)
127 return mavlink_msg_named_value_float_pack_chan(system_id
, component_id
, chan
, msg
, named_value_float
->time_boot_ms
, named_value_float
->name
, named_value_float
->value
);
131 * @brief Send a named_value_float message
132 * @param chan MAVLink channel to send the message
134 * @param time_boot_ms Timestamp (milliseconds since system boot)
135 * @param name Name of the debug variable
136 * @param value Floating point value
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
140 static inline void mavlink_msg_named_value_float_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, const char *name
, float value
)
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
143 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
];
144 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
145 _mav_put_float(buf
, 4, value
);
146 _mav_put_char_array(buf
, 8, name
, 10);
147 #if MAVLINK_CRC_EXTRA
148 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
150 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
153 mavlink_named_value_float_t packet
;
154 packet
.time_boot_ms
= time_boot_ms
;
155 packet
.value
= value
;
156 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
157 #if MAVLINK_CRC_EXTRA
158 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, (const char *)&packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
160 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, (const char *)&packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
165 #if MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
167 This varient of _send() can be used to save stack space by re-using
168 memory from the receive buffer. The caller provides a
169 mavlink_message_t which is the size of a full mavlink message. This
170 is usually the receive buffer for the channel, and allows a reply to an
171 incoming message with minimum stack space usage.
173 static inline void mavlink_msg_named_value_float_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint32_t time_boot_ms
, const char *name
, float value
)
175 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176 char *buf
= (char *)msgbuf
;
177 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
178 _mav_put_float(buf
, 4, value
);
179 _mav_put_char_array(buf
, 8, name
, 10);
180 #if MAVLINK_CRC_EXTRA
181 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
183 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
186 mavlink_named_value_float_t
*packet
= (mavlink_named_value_float_t
*)msgbuf
;
187 packet
->time_boot_ms
= time_boot_ms
;
188 packet
->value
= value
;
189 mav_array_memcpy(packet
->name
, name
, sizeof(char)*10);
190 #if MAVLINK_CRC_EXTRA
191 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, (const char *)packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_CRC
);
193 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT
, (const char *)packet
, MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);
201 // MESSAGE NAMED_VALUE_FLOAT UNPACKING
205 * @brief Get field time_boot_ms from named_value_float message
207 * @return Timestamp (milliseconds since system boot)
209 static inline uint32_t mavlink_msg_named_value_float_get_time_boot_ms(const mavlink_message_t
* msg
)
211 return _MAV_RETURN_uint32_t(msg
, 0);
215 * @brief Get field name from named_value_float message
217 * @return Name of the debug variable
219 static inline uint16_t mavlink_msg_named_value_float_get_name(const mavlink_message_t
* msg
, char *name
)
221 return _MAV_RETURN_char_array(msg
, name
, 10, 8);
225 * @brief Get field value from named_value_float message
227 * @return Floating point value
229 static inline float mavlink_msg_named_value_float_get_value(const mavlink_message_t
* msg
)
231 return _MAV_RETURN_float(msg
, 4);
235 * @brief Decode a named_value_float message into a struct
237 * @param msg The message to decode
238 * @param named_value_float C-struct to decode the message contents into
240 static inline void mavlink_msg_named_value_float_decode(const mavlink_message_t
* msg
, mavlink_named_value_float_t
* named_value_float
)
242 #if MAVLINK_NEED_BYTE_SWAP
243 named_value_float
->time_boot_ms
= mavlink_msg_named_value_float_get_time_boot_ms(msg
);
244 named_value_float
->value
= mavlink_msg_named_value_float_get_value(msg
);
245 mavlink_msg_named_value_float_get_name(msg
, named_value_float
->name
);
247 memcpy(named_value_float
, _MAV_PAYLOAD(msg
), MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_LEN
);