mavlink_msg_named_value_int.h
Go to the documentation of this file.
1 // MESSAGE NAMED_VALUE_INT PACKING
2 
3 #define MAVLINK_MSG_ID_NAMED_VALUE_INT 252
4 
6 {
7  uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
8  int32_t value; /*< Signed integer value*/
9  char name[10]; /*< Name of the debug variable*/
11 
12 #define MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN 18
13 #define MAVLINK_MSG_ID_252_LEN 18
14 
15 #define MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC 44
16 #define MAVLINK_MSG_ID_252_CRC 44
17 
18 #define MAVLINK_MSG_NAMED_VALUE_INT_FIELD_NAME_LEN 10
19 
20 #define MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT { \
21  "NAMED_VALUE_INT", \
22  3, \
23  { { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_named_value_int_t, time_boot_ms) }, \
24  { "value", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_named_value_int_t, value) }, \
25  { "name", NULL, MAVLINK_TYPE_CHAR, 10, 8, offsetof(mavlink_named_value_int_t, name) }, \
26  } \
27 }
28 
29 
41 static inline uint16_t mavlink_msg_named_value_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
42  uint32_t time_boot_ms, const char *name, int32_t value)
43 {
44 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
46  _mav_put_uint32_t(buf, 0, time_boot_ms);
47  _mav_put_int32_t(buf, 4, value);
48  _mav_put_char_array(buf, 8, name, 10);
50 #else
52  packet.time_boot_ms = time_boot_ms;
53  packet.value = value;
54  mav_array_memcpy(packet.name, name, sizeof(char)*10);
56 #endif
57 
58  msg->msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT;
59 #if MAVLINK_CRC_EXTRA
61 #else
62  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
63 #endif
64 }
65 
77 static inline uint16_t mavlink_msg_named_value_int_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,int32_t value)
80 {
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
83  _mav_put_uint32_t(buf, 0, time_boot_ms);
84  _mav_put_int32_t(buf, 4, value);
85  _mav_put_char_array(buf, 8, name, 10);
87 #else
89  packet.time_boot_ms = time_boot_ms;
90  packet.value = value;
91  mav_array_memcpy(packet.name, name, sizeof(char)*10);
93 #endif
94 
95  msg->msgid = MAVLINK_MSG_ID_NAMED_VALUE_INT;
96 #if MAVLINK_CRC_EXTRA
98 #else
99  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
100 #endif
101 }
102 
111 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)
112 {
113  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);
114 }
115 
125 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)
126 {
127  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);
128 }
129 
138 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
139 
140 static inline void mavlink_msg_named_value_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, const char *name, int32_t value)
141 {
142 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
145  _mav_put_int32_t(buf, 4, value);
146  _mav_put_char_array(buf, 8, name, 10);
147 #if MAVLINK_CRC_EXTRA
149 #else
150  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, buf, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
151 #endif
152 #else
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_INT, (const char *)&packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC);
159 #else
160  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)&packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
161 #endif
162 #endif
163 }
164 
165 #if MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN <= MAVLINK_MAX_PAYLOAD_LEN
166 /*
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.
172  */
173 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)
174 {
175 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
176  char *buf = (char *)msgbuf;
178  _mav_put_int32_t(buf, 4, value);
179  _mav_put_char_array(buf, 8, name, 10);
180 #if MAVLINK_CRC_EXTRA
182 #else
183  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, buf, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
184 #endif
185 #else
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_INT, (const char *)packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN, MAVLINK_MSG_ID_NAMED_VALUE_INT_CRC);
192 #else
193  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_NAMED_VALUE_INT, (const char *)packet, MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
194 #endif
195 #endif
196 }
197 #endif
198 
199 #endif
200 
201 // MESSAGE NAMED_VALUE_INT UNPACKING
202 
203 
209 static inline uint32_t mavlink_msg_named_value_int_get_time_boot_ms(const mavlink_message_t* msg)
210 {
211  return _MAV_RETURN_uint32_t(msg, 0);
212 }
213 
219 static inline uint16_t mavlink_msg_named_value_int_get_name(const mavlink_message_t* msg, char *name)
220 {
221  return _MAV_RETURN_char_array(msg, name, 10, 8);
222 }
223 
229 static inline int32_t mavlink_msg_named_value_int_get_value(const mavlink_message_t* msg)
230 {
231  return _MAV_RETURN_int32_t(msg, 4);
232 }
233 
240 static inline void mavlink_msg_named_value_int_decode(const mavlink_message_t* msg, mavlink_named_value_int_t* named_value_int)
241 {
242 #if MAVLINK_NEED_BYTE_SWAP
244  named_value_int->value = mavlink_msg_named_value_int_get_value(msg);
245  mavlink_msg_named_value_int_get_name(msg, named_value_int->name);
246 #else
247  memcpy(named_value_int, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_NAMED_VALUE_INT_LEN);
248 #endif
249 }
#define _mav_put_int32_t(buf, wire_offset, b)
Definition: protocol.h:148
static void mav_array_memcpy(void *dest, const void *src, size_t n)
Definition: protocol.h:176
static uint16_t _MAV_RETURN_char_array(const mavlink_message_t *msg, char *value, uint8_t array_length, uint8_t wire_offset)
Definition: protocol.h:288
static void _mav_put_char_array(char *buf, uint8_t wire_offset, const char *b, uint8_t array_length)
Definition: protocol.h:188
#define _mav_put_uint32_t(buf, wire_offset, b)
Definition: protocol.h:147


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Wed Jul 3 2019 19:59:25