Arduino Mavlink
Loading...
Searching...
No Matches
mavlink_msg_param_ext_value.h
Go to the documentation of this file.
1#pragma once
2// MESSAGE PARAM_EXT_VALUE PACKING
3
4#define MAVLINK_MSG_ID_PARAM_EXT_VALUE 322
5
6
8 uint16_t param_count; /*< Total number of parameters*/
9 uint16_t param_index; /*< Index of this parameter*/
10 char param_id[16]; /*< 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 char param_value[128]; /*< Parameter value*/
12 uint8_t param_type; /*< Parameter type.*/
13} mavlink_param_ext_value_t;
14
15#define MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN 149
16#define MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN 149
17#define MAVLINK_MSG_ID_322_LEN 149
18#define MAVLINK_MSG_ID_322_MIN_LEN 149
19
20#define MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC 243
21#define MAVLINK_MSG_ID_322_CRC 243
22
23#define MAVLINK_MSG_PARAM_EXT_VALUE_FIELD_PARAM_ID_LEN 16
24#define MAVLINK_MSG_PARAM_EXT_VALUE_FIELD_PARAM_VALUE_LEN 128
25
26#if MAVLINK_COMMAND_24BIT
27#define MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE {
28 322,
29 "PARAM_EXT_VALUE",
30 5,
31 { { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_ext_value_t, param_id) },
32 { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 20, offsetof(mavlink_param_ext_value_t, param_value) },
33 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 148, offsetof(mavlink_param_ext_value_t, param_type) },
34 { "param_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_param_ext_value_t, param_count) },
35 { "param_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_param_ext_value_t, param_index) },
36 } \
37}
38#else
39#define MAVLINK_MESSAGE_INFO_PARAM_EXT_VALUE {
40 "PARAM_EXT_VALUE",
41 5,
42 { { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_ext_value_t, param_id) },
43 { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 20, offsetof(mavlink_param_ext_value_t, param_value) },
44 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 148, offsetof(mavlink_param_ext_value_t, param_type) },
45 { "param_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_param_ext_value_t, param_count) },
46 { "param_index", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_param_ext_value_t, param_index) },
47 } \
48}
49#endif
50
51/**
52 * @brief Pack a param_ext_value message
53 * @param system_id ID of this system
54 * @param component_id ID of this component (e.g. 200 for IMU)
55 * @param msg The MAVLink message to compress the data into
56 *
57 * @param param_id 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
58 * @param param_value Parameter value
59 * @param param_type Parameter type.
60 * @param param_count Total number of parameters
61 * @param param_index Index of this parameter
62 * @return length of the message in bytes (excluding serial stream start sign)
63 */
64static inline uint16_t mavlink_msg_param_ext_value_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
65 const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index)
66{
67#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
69 _mav_put_uint16_t(buf, 0, param_count);
70 _mav_put_uint16_t(buf, 2, param_index);
71 _mav_put_uint8_t(buf, 148, param_type);
72 _mav_put_char_array(buf, 4, param_id, 16);
73 _mav_put_char_array(buf, 20, param_value, 128);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
75#else
76 mavlink_param_ext_value_t packet;
77 packet.param_count = param_count;
78 packet.param_index = param_index;
79 packet.param_type = param_type;
80 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
81 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
82 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
83#endif
84
86 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
87}
88
89/**
90 * @brief Pack a param_ext_value message
91 * @param system_id ID of this system
92 * @param component_id ID of this component (e.g. 200 for IMU)
93 * @param status MAVLink status structure
94 * @param msg The MAVLink message to compress the data into
95 *
96 * @param param_id 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
97 * @param param_value Parameter value
98 * @param param_type Parameter type.
99 * @param param_count Total number of parameters
100 * @param param_index Index of this parameter
101 * @return length of the message in bytes (excluding serial stream start sign)
102 */
103static inline uint16_t mavlink_msg_param_ext_value_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
104 const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index)
105{
106#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
108 _mav_put_uint16_t(buf, 0, param_count);
109 _mav_put_uint16_t(buf, 2, param_index);
110 _mav_put_uint8_t(buf, 148, param_type);
111 _mav_put_char_array(buf, 4, param_id, 16);
112 _mav_put_char_array(buf, 20, param_value, 128);
113 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
114#else
115 mavlink_param_ext_value_t packet;
116 packet.param_count = param_count;
117 packet.param_index = param_index;
118 packet.param_type = param_type;
119 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
120 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
121 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
122#endif
123
125#if MAVLINK_CRC_EXTRA
126 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
127#else
128 return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
129#endif
130}
131
132/**
133 * @brief Pack a param_ext_value message on a channel
134 * @param system_id ID of this system
135 * @param component_id ID of this component (e.g. 200 for IMU)
136 * @param chan The MAVLink channel this message will be sent over
137 * @param msg The MAVLink message to compress the data into
138 * @param param_id 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
139 * @param param_value Parameter value
140 * @param param_type Parameter type.
141 * @param param_count Total number of parameters
142 * @param param_index Index of this parameter
143 * @return length of the message in bytes (excluding serial stream start sign)
144 */
145static inline uint16_t mavlink_msg_param_ext_value_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
146 mavlink_message_t* msg,
147 const char *param_id,const char *param_value,uint8_t param_type,uint16_t param_count,uint16_t param_index)
148{
149#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
151 _mav_put_uint16_t(buf, 0, param_count);
152 _mav_put_uint16_t(buf, 2, param_index);
153 _mav_put_uint8_t(buf, 148, param_type);
154 _mav_put_char_array(buf, 4, param_id, 16);
155 _mav_put_char_array(buf, 20, param_value, 128);
156 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
157#else
158 mavlink_param_ext_value_t packet;
159 packet.param_count = param_count;
160 packet.param_index = param_index;
161 packet.param_type = param_type;
162 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
163 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
164 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
165#endif
166
168 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
169}
170
171/**
172 * @brief Encode a param_ext_value struct
173 *
174 * @param system_id ID of this system
175 * @param component_id ID of this component (e.g. 200 for IMU)
176 * @param msg The MAVLink message to compress the data into
177 * @param param_ext_value C-struct to read the message contents from
178 */
179static inline uint16_t mavlink_msg_param_ext_value_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_ext_value_t* param_ext_value)
180{
181 return mavlink_msg_param_ext_value_pack(system_id, component_id, msg, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index);
182}
183
184/**
185 * @brief Encode a param_ext_value struct on a channel
186 *
187 * @param system_id ID of this system
188 * @param component_id ID of this component (e.g. 200 for IMU)
189 * @param chan The MAVLink channel this message will be sent over
190 * @param msg The MAVLink message to compress the data into
191 * @param param_ext_value C-struct to read the message contents from
192 */
193static inline uint16_t mavlink_msg_param_ext_value_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_ext_value_t* param_ext_value)
194{
195 return mavlink_msg_param_ext_value_pack_chan(system_id, component_id, chan, msg, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index);
196}
197
198/**
199 * @brief Encode a param_ext_value struct with provided status structure
200 *
201 * @param system_id ID of this system
202 * @param component_id ID of this component (e.g. 200 for IMU)
203 * @param status MAVLink status structure
204 * @param msg The MAVLink message to compress the data into
205 * @param param_ext_value C-struct to read the message contents from
206 */
207static inline uint16_t mavlink_msg_param_ext_value_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_param_ext_value_t* param_ext_value)
208{
209 return mavlink_msg_param_ext_value_pack_status(system_id, component_id, _status, msg, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index);
210}
211
212/**
213 * @brief Send a param_ext_value message
214 * @param chan MAVLink channel to send the message
215 *
216 * @param param_id 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
217 * @param param_value Parameter value
218 * @param param_type Parameter type.
219 * @param param_count Total number of parameters
220 * @param param_index Index of this parameter
221 */
222#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
223
224static inline void mavlink_msg_param_ext_value_send(mavlink_channel_t chan, const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index)
225{
226#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
227 char buf[MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN];
228 _mav_put_uint16_t(buf, 0, param_count);
229 _mav_put_uint16_t(buf, 2, param_index);
230 _mav_put_uint8_t(buf, 148, param_type);
231 _mav_put_char_array(buf, 4, param_id, 16);
232 _mav_put_char_array(buf, 20, param_value, 128);
233 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
234#else
235 mavlink_param_ext_value_t packet;
236 packet.param_count = param_count;
237 packet.param_index = param_index;
238 packet.param_type = param_type;
239 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
240 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
241 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
242#endif
243}
244
245/**
246 * @brief Send a param_ext_value message
247 * @param chan MAVLink channel to send the message
248 * @param struct The MAVLink struct to serialize
249 */
250static inline void mavlink_msg_param_ext_value_send_struct(mavlink_channel_t chan, const mavlink_param_ext_value_t* param_ext_value)
251{
252#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
253 mavlink_msg_param_ext_value_send(chan, param_ext_value->param_id, param_ext_value->param_value, param_ext_value->param_type, param_ext_value->param_count, param_ext_value->param_index);
254#else
255 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, (const char *)param_ext_value, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
256#endif
257}
258
259#if MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN <= MAVLINK_MAX_PAYLOAD_LEN
260/*
261 This variant of _send() can be used to save stack space by reusing
262 memory from the receive buffer. The caller provides a
263 mavlink_message_t which is the size of a full mavlink message. This
264 is usually the receive buffer for the channel, and allows a reply to an
265 incoming message with minimum stack space usage.
266 */
267static inline void mavlink_msg_param_ext_value_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *param_id, const char *param_value, uint8_t param_type, uint16_t param_count, uint16_t param_index)
268{
269#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 char *buf = (char *)msgbuf;
271 _mav_put_uint16_t(buf, 0, param_count);
272 _mav_put_uint16_t(buf, 2, param_index);
273 _mav_put_uint8_t(buf, 148, param_type);
274 _mav_put_char_array(buf, 4, param_id, 16);
275 _mav_put_char_array(buf, 20, param_value, 128);
276 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, buf, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
277#else
278 mavlink_param_ext_value_t *packet = (mavlink_param_ext_value_t *)msgbuf;
279 packet->param_count = param_count;
280 packet->param_index = param_index;
281 packet->param_type = param_type;
282 mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
283 mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128);
284 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_VALUE, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_VALUE_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN, MAVLINK_MSG_ID_PARAM_EXT_VALUE_CRC);
285#endif
286}
287#endif
288
289#endif
290
291// MESSAGE PARAM_EXT_VALUE UNPACKING
292
293
294/**
295 * @brief Get field param_id from param_ext_value message
296 *
297 * @return 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
298 */
299static inline uint16_t mavlink_msg_param_ext_value_get_param_id(const mavlink_message_t* msg, char *param_id)
300{
301 return _MAV_RETURN_char_array(msg, param_id, 16, 4);
302}
303
304/**
305 * @brief Get field param_value from param_ext_value message
306 *
307 * @return Parameter value
308 */
309static inline uint16_t mavlink_msg_param_ext_value_get_param_value(const mavlink_message_t* msg, char *param_value)
310{
311 return _MAV_RETURN_char_array(msg, param_value, 128, 20);
312}
313
314/**
315 * @brief Get field param_type from param_ext_value message
316 *
317 * @return Parameter type.
318 */
319static inline uint8_t mavlink_msg_param_ext_value_get_param_type(const mavlink_message_t* msg)
320{
321 return _MAV_RETURN_uint8_t(msg, 148);
322}
323
324/**
325 * @brief Get field param_count from param_ext_value message
326 *
327 * @return Total number of parameters
328 */
329static inline uint16_t mavlink_msg_param_ext_value_get_param_count(const mavlink_message_t* msg)
330{
331 return _MAV_RETURN_uint16_t(msg, 0);
332}
333
334/**
335 * @brief Get field param_index from param_ext_value message
336 *
337 * @return Index of this parameter
338 */
339static inline uint16_t mavlink_msg_param_ext_value_get_param_index(const mavlink_message_t* msg)
340{
341 return _MAV_RETURN_uint16_t(msg, 2);
342}
343
344/**
345 * @brief Decode a param_ext_value message into a struct
346 *
347 * @param msg The message to decode
348 * @param param_ext_value C-struct to decode the message contents into
349 */
350static inline void mavlink_msg_param_ext_value_decode(const mavlink_message_t* msg, mavlink_param_ext_value_t* param_ext_value)
351{
352#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
353 param_ext_value->param_count = mavlink_msg_param_ext_value_get_param_count(msg);
354 param_ext_value->param_index = mavlink_msg_param_ext_value_get_param_index(msg);
355 mavlink_msg_param_ext_value_get_param_id(msg, param_ext_value->param_id);
356 mavlink_msg_param_ext_value_get_param_value(msg, param_ext_value->param_value);
357 param_ext_value->param_type = mavlink_msg_param_ext_value_get_param_type(msg);
358#else
359 uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN? msg->len : MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN;
360 memset(param_ext_value, 0, MAVLINK_MSG_ID_PARAM_EXT_VALUE_LEN);
361 memcpy(param_ext_value, _MAV_PAYLOAD(msg), len);
362#endif
363}