2 // MESSAGE NAMED_VALUE_INT PACKING
4 #define MAVLINK_MSG_ID_NAMED_VALUE_INT 252
7 typedef struct __mavlink_named_value_int_t
{
8 uint32_t time_boot_ms
; /*< [ms] Timestamp (time since system boot).*/
9 int32_t value
; /*< Signed integer value*/
10 char name
[10]; /*< Name of the debug variable*/
11 } mavlink_named_value_int_t
;
13 #define MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN 18
14 #define MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN 18
15 #define MAVLINK_MSG_ID_252_LEN 18
16 #define MAVLINK_MSG_ID_252_MIN_LEN 18
18 #define MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC 44
19 #define MAVLINK_MSG_ID_252_CRC 44
21 #define MAVLINK_MSG_NAMED_VALUE_INT_FIELD_NAME_LEN 10
23 #if MAVLINK_COMMAND_24BIT
24 #define MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT { \
28 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_named_value_int_t, time_boot_ms) }, \
29 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 8, offsetof(mavlink_named_value_int_t, name) }, \
30 { "value", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_named_value_int_t, value) }, \
34 #define MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT { \
37 { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_named_value_int_t, time_boot_ms) }, \
38 { "name", NULL, MAVLINK_TYPE_CHAR, 10, 8, offsetof(mavlink_named_value_int_t, name) }, \
39 { "value", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_named_value_int_t, value) }, \
45 * @brief Pack a named_value_int message
46 * @param system_id ID of this system
47 * @param component_id ID of this component (e.g. 200 for IMU)
48 * @param msg The MAVLink message to compress the data into
50 * @param time_boot_ms [ms] Timestamp (time since system boot).
51 * @param name Name of the debug variable
52 * @param value Signed integer value
53 * @return length of the message in bytes (excluding serial stream start sign)
55 static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
,
56 uint32_t time_boot_ms
, const char *name
, int32_t value
)
58 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
59 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
];
60 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
61 _mav_put_int32_t(buf
, 4, value
);
62 _mav_put_char_array(buf
, 8, name
, 10);
63 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
);
65 mavlink_named_value_int_t packet
;
66 packet
.time_boot_ms
= time_boot_ms
;
68 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
);
72 msg
->msgid
= MAVLINK_MSG_ID_NAMED_VALUE_INT
;
73 return mavlink_finalize_message(msg
, system_id
, component_id
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
77 * @brief Pack a named_value_int message on a channel
78 * @param system_id ID of this system
79 * @param component_id ID of this component (e.g. 200 for IMU)
80 * @param chan The MAVLink channel this message will be sent over
81 * @param msg The MAVLink message to compress the data into
82 * @param time_boot_ms [ms] Timestamp (time since system boot).
83 * @param name Name of the debug variable
84 * @param value Signed integer value
85 * @return length of the message in bytes (excluding serial stream start sign)
87 static inline uint16_t mavlink_msg_named_value_int_pack_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
,
88 mavlink_message_t
* msg
,
89 uint32_t time_boot_ms
,const char *name
,int32_t value
)
91 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
92 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
];
93 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
94 _mav_put_int32_t(buf
, 4, value
);
95 _mav_put_char_array(buf
, 8, name
, 10);
96 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), buf
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
);
98 mavlink_named_value_int_t packet
;
99 packet
.time_boot_ms
= time_boot_ms
;
100 packet
.value
= value
;
101 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
102 memcpy(_MAV_PAYLOAD_NON_CONST(msg
), &packet
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
);
105 msg
->msgid
= MAVLINK_MSG_ID_NAMED_VALUE_INT
;
106 return mavlink_finalize_message_chan(msg
, system_id
, component_id
, chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
110 * @brief Encode a named_value_int struct
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 named_value_int C-struct to read the message contents from
117 static inline uint16_t mavlink_msg_named_value_int_encode(uint8_t system_id
, uint8_t component_id
, mavlink_message_t
* msg
, const mavlink_named_value_int_t
* named_value_int
)
119 return mavlink_msg_named_value_int_pack(system_id
, component_id
, msg
, named_value_int
->time_boot_ms
, named_value_int
->name
, named_value_int
->value
);
123 * @brief Encode a named_value_int struct on a channel
125 * @param system_id ID of this system
126 * @param component_id ID of this component (e.g. 200 for IMU)
127 * @param chan The MAVLink channel this message will be sent over
128 * @param msg The MAVLink message to compress the data into
129 * @param named_value_int C-struct to read the message contents from
131 static inline uint16_t mavlink_msg_named_value_int_encode_chan(uint8_t system_id
, uint8_t component_id
, uint8_t chan
, mavlink_message_t
* msg
, const mavlink_named_value_int_t
* named_value_int
)
133 return mavlink_msg_named_value_int_pack_chan(system_id
, component_id
, chan
, msg
, named_value_int
->time_boot_ms
, named_value_int
->name
, named_value_int
->value
);
137 * @brief Send a named_value_int message
138 * @param chan MAVLink channel to send the message
140 * @param time_boot_ms [ms] Timestamp (time since system boot).
141 * @param name Name of the debug variable
142 * @param value Signed integer value
144 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
146 static inline void mavlink_msg_named_value_int_send(mavlink_channel_t chan
, uint32_t time_boot_ms
, const char *name
, int32_t value
)
148 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
149 char buf
[MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
];
150 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
151 _mav_put_int32_t(buf
, 4, value
);
152 _mav_put_char_array(buf
, 8, name
, 10);
153 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
155 mavlink_named_value_int_t packet
;
156 packet
.time_boot_ms
= time_boot_ms
;
157 packet
.value
= value
;
158 mav_array_memcpy(packet
.name
, name
, sizeof(char)*10);
159 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT
, (const char *)&packet
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
164 * @brief Send a named_value_int message
165 * @param chan MAVLink channel to send the message
166 * @param struct The MAVLink struct to serialize
168 static inline void mavlink_msg_named_value_int_send_struct(mavlink_channel_t chan
, const mavlink_named_value_int_t
* named_value_int
)
170 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
171 mavlink_msg_named_value_int_send(chan
, named_value_int
->time_boot_ms
, named_value_int
->name
, named_value_int
->value
);
173 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT
, (const char *)named_value_int
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
177 #if MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
179 This varient of _send() can be used to save stack space by re-using
180 memory from the receive buffer. The caller provides a
181 mavlink_message_t which is the size of a full mavlink message. This
182 is usually the receive buffer for the channel, and allows a reply to an
183 incoming message with minimum stack space usage.
185 static inline void mavlink_msg_named_value_int_send_buf(mavlink_message_t
*msgbuf
, mavlink_channel_t chan
, uint32_t time_boot_ms
, const char *name
, int32_t value
)
187 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
188 char *buf
= (char *)msgbuf
;
189 _mav_put_uint32_t(buf
, 0, time_boot_ms
);
190 _mav_put_int32_t(buf
, 4, value
);
191 _mav_put_char_array(buf
, 8, name
, 10);
192 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT
, buf
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
194 mavlink_named_value_int_t
*packet
= (mavlink_named_value_int_t
*)msgbuf
;
195 packet
->time_boot_ms
= time_boot_ms
;
196 packet
->value
= value
;
197 mav_array_memcpy(packet
->name
, name
, sizeof(char)*10);
198 _mav_finalize_message_chan_send(chan
, MAVLINK_MSG_ID_NAMED_VALUE_INT
, (const char *)packet
, MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC
);
205 // MESSAGE NAMED_VALUE_INT UNPACKING
209 * @brief Get field time_boot_ms from named_value_int message
211 * @return [ms] Timestamp (time since system boot).
213 static inline uint32_t mavlink_msg_named_value_int_get_time_boot_ms(const mavlink_message_t
* msg
)
215 return _MAV_RETURN_uint32_t(msg
, 0);
219 * @brief Get field name from named_value_int message
221 * @return Name of the debug variable
223 static inline uint16_t mavlink_msg_named_value_int_get_name(const mavlink_message_t
* msg
, char *name
)
225 return _MAV_RETURN_char_array(msg
, name
, 10, 8);
229 * @brief Get field value from named_value_int message
231 * @return Signed integer value
233 static inline int32_t mavlink_msg_named_value_int_get_value(const mavlink_message_t
* msg
)
235 return _MAV_RETURN_int32_t(msg
, 4);
239 * @brief Decode a named_value_int message into a struct
241 * @param msg The message to decode
242 * @param named_value_int C-struct to decode the message contents into
244 static inline void mavlink_msg_named_value_int_decode(const mavlink_message_t
* msg
, mavlink_named_value_int_t
* named_value_int
)
246 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
247 named_value_int
->time_boot_ms
= mavlink_msg_named_value_int_get_time_boot_ms(msg
);
248 named_value_int
->value
= mavlink_msg_named_value_int_get_value(msg
);
249 mavlink_msg_named_value_int_get_name(msg
, named_value_int
->name
);
251 uint8_t len
= msg
->len
< MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
? msg
->len
: MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
;
252 memset(named_value_int
, 0, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN
);
253 memcpy(named_value_int
, _MAV_PAYLOAD(msg
), len
);