mavlink_msg_param_set.h
Go to the documentation of this file.
1 // MESSAGE PARAM_SET PACKING
2 
3 #define MAVLINK_MSG_ID_PARAM_SET 23
4 
5 typedef struct __mavlink_param_set_t
6 {
7  float param_value; /*< Onboard parameter value*/
8  uint8_t target_system; /*< System ID*/
9  uint8_t target_component; /*< Component ID*/
10  char param_id[16]; /*< Onboard parameter id, terminated by NULL if the length is less than 16 human-readable chars and WITHOUT null termination (NULL) byte if the length is exactly 16 chars - applications have to provide 16+1 bytes storage if the ID is stored as string*/
11  uint8_t param_type; /*< Onboard parameter type: see the MAV_PARAM_TYPE enum for supported data types.*/
13 
14 #define MAVLINK_MSG_ID_PARAM_SET_LEN 23
15 #define MAVLINK_MSG_ID_23_LEN 23
16 
17 #define MAVLINK_MSG_ID_PARAM_SET_CRC 168
18 #define MAVLINK_MSG_ID_23_CRC 168
19 
20 #define MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN 16
21 
22 #define MAVLINK_MESSAGE_INFO_PARAM_SET { \
23  "PARAM_SET", \
24  5, \
25  { { "param_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_set_t, param_value) }, \
26  { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_param_set_t, target_system) }, \
27  { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_param_set_t, target_component) }, \
28  { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 6, offsetof(mavlink_param_set_t, param_id) }, \
29  { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_param_set_t, param_type) }, \
30  } \
31 }
32 
33 
47 static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
48  uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type)
49 {
50 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
52  _mav_put_float(buf, 0, param_value);
53  _mav_put_uint8_t(buf, 4, target_system);
54  _mav_put_uint8_t(buf, 5, target_component);
55  _mav_put_uint8_t(buf, 22, param_type);
56  _mav_put_char_array(buf, 6, param_id, 16);
58 #else
59  mavlink_param_set_t packet;
60  packet.param_value = param_value;
63  packet.param_type = param_type;
64  mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
66 #endif
67 
68  msg->msgid = MAVLINK_MSG_ID_PARAM_SET;
69 #if MAVLINK_CRC_EXTRA
71 #else
72  return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_SET_LEN);
73 #endif
74 }
75 
89 static inline uint16_t mavlink_msg_param_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
90  mavlink_message_t* msg,
91  uint8_t target_system,uint8_t target_component,const char *param_id,float param_value,uint8_t param_type)
92 {
93 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
95  _mav_put_float(buf, 0, param_value);
96  _mav_put_uint8_t(buf, 4, target_system);
97  _mav_put_uint8_t(buf, 5, target_component);
98  _mav_put_uint8_t(buf, 22, param_type);
99  _mav_put_char_array(buf, 6, param_id, 16);
101 #else
102  mavlink_param_set_t packet;
103  packet.param_value = param_value;
104  packet.target_system = target_system;
106  packet.param_type = param_type;
107  mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
109 #endif
110 
111  msg->msgid = MAVLINK_MSG_ID_PARAM_SET;
112 #if MAVLINK_CRC_EXTRA
114 #else
115  return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_SET_LEN);
116 #endif
117 }
118 
127 static inline uint16_t mavlink_msg_param_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_set_t* param_set)
128 {
129  return mavlink_msg_param_set_pack(system_id, component_id, msg, param_set->target_system, param_set->target_component, param_set->param_id, param_set->param_value, param_set->param_type);
130 }
131 
141 static inline uint16_t mavlink_msg_param_set_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_set_t* param_set)
142 {
143  return mavlink_msg_param_set_pack_chan(system_id, component_id, chan, msg, param_set->target_system, param_set->target_component, param_set->param_id, param_set->param_value, param_set->param_type);
144 }
145 
156 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
157 
158 static inline void mavlink_msg_param_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type)
159 {
160 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
162  _mav_put_float(buf, 0, param_value);
165  _mav_put_uint8_t(buf, 22, param_type);
166  _mav_put_char_array(buf, 6, param_id, 16);
167 #if MAVLINK_CRC_EXTRA
168  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, buf, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC);
169 #else
170  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, buf, MAVLINK_MSG_ID_PARAM_SET_LEN);
171 #endif
172 #else
173  mavlink_param_set_t packet;
174  packet.param_value = param_value;
175  packet.target_system = target_system;
177  packet.param_type = param_type;
178  mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
179 #if MAVLINK_CRC_EXTRA
180  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC);
181 #else
182  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, MAVLINK_MSG_ID_PARAM_SET_LEN);
183 #endif
184 #endif
185 }
186 
187 #if MAVLINK_MSG_ID_PARAM_SET_LEN <= MAVLINK_MAX_PAYLOAD_LEN
188 /*
189  This varient of _send() can be used to save stack space by re-using
190  memory from the receive buffer. The caller provides a
191  mavlink_message_t which is the size of a full mavlink message. This
192  is usually the receive buffer for the channel, and allows a reply to an
193  incoming message with minimum stack space usage.
194  */
195 static inline void mavlink_msg_param_set_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type)
196 {
197 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
198  char *buf = (char *)msgbuf;
199  _mav_put_float(buf, 0, param_value);
202  _mav_put_uint8_t(buf, 22, param_type);
203  _mav_put_char_array(buf, 6, param_id, 16);
204 #if MAVLINK_CRC_EXTRA
205  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, buf, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC);
206 #else
207  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, buf, MAVLINK_MSG_ID_PARAM_SET_LEN);
208 #endif
209 #else
210  mavlink_param_set_t *packet = (mavlink_param_set_t *)msgbuf;
211  packet->param_value = param_value;
212  packet->target_system = target_system;
214  packet->param_type = param_type;
215  mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
216 #if MAVLINK_CRC_EXTRA
217  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)packet, MAVLINK_MSG_ID_PARAM_SET_LEN, MAVLINK_MSG_ID_PARAM_SET_CRC);
218 #else
219  _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)packet, MAVLINK_MSG_ID_PARAM_SET_LEN);
220 #endif
221 #endif
222 }
223 #endif
224 
225 #endif
226 
227 // MESSAGE PARAM_SET UNPACKING
228 
229 
235 static inline uint8_t mavlink_msg_param_set_get_target_system(const mavlink_message_t* msg)
236 {
237  return _MAV_RETURN_uint8_t(msg, 4);
238 }
239 
245 static inline uint8_t mavlink_msg_param_set_get_target_component(const mavlink_message_t* msg)
246 {
247  return _MAV_RETURN_uint8_t(msg, 5);
248 }
249 
255 static inline uint16_t mavlink_msg_param_set_get_param_id(const mavlink_message_t* msg, char *param_id)
256 {
257  return _MAV_RETURN_char_array(msg, param_id, 16, 6);
258 }
259 
265 static inline float mavlink_msg_param_set_get_param_value(const mavlink_message_t* msg)
266 {
267  return _MAV_RETURN_float(msg, 0);
268 }
269 
275 static inline uint8_t mavlink_msg_param_set_get_param_type(const mavlink_message_t* msg)
276 {
277  return _MAV_RETURN_uint8_t(msg, 22);
278 }
279 
286 static inline void mavlink_msg_param_set_decode(const mavlink_message_t* msg, mavlink_param_set_t* param_set)
287 {
288 #if MAVLINK_NEED_BYTE_SWAP
294 #else
295  memcpy(param_set, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_PARAM_SET_LEN);
296 #endif
297 }
#define _mav_put_float(buf, wire_offset, b)
Definition: protocol.h:151
#define _MAV_RETURN_uint8_t(msg, wire_offset)
Definition: protocol.h:244
#define _mav_put_uint8_t(buf, wire_offset, b)
Definition: protocol.h:140
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


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:47