Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_param_ext_ack.h
blob3a560d2b8fe7acdb677cb6575ef5d03ad43d4b5d
1 #pragma once
2 // MESSAGE PARAM_EXT_ACK PACKING
4 #define MAVLINK_MSG_ID_PARAM_EXT_ACK 324
7 typedef struct __mavlink_param_ext_ack_t {
8 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*/
9 char param_value[128]; /*< Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise)*/
10 uint8_t param_type; /*< Parameter type.*/
11 uint8_t param_result; /*< Result code.*/
12 } mavlink_param_ext_ack_t;
14 #define MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN 146
15 #define MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN 146
16 #define MAVLINK_MSG_ID_324_LEN 146
17 #define MAVLINK_MSG_ID_324_MIN_LEN 146
19 #define MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC 132
20 #define MAVLINK_MSG_ID_324_CRC 132
22 #define MAVLINK_MSG_PARAM_EXT_ACK_FIELD_PARAM_ID_LEN 16
23 #define MAVLINK_MSG_PARAM_EXT_ACK_FIELD_PARAM_VALUE_LEN 128
25 #if MAVLINK_COMMAND_24BIT
26 #define MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK { \
27 324, \
28 "PARAM_EXT_ACK", \
29 4, \
30 { { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 0, offsetof(mavlink_param_ext_ack_t, param_id) }, \
31 { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 16, offsetof(mavlink_param_ext_ack_t, param_value) }, \
32 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 144, offsetof(mavlink_param_ext_ack_t, param_type) }, \
33 { "param_result", NULL, MAVLINK_TYPE_UINT8_T, 0, 145, offsetof(mavlink_param_ext_ack_t, param_result) }, \
34 } \
36 #else
37 #define MAVLINK_MESSAGE_INFO_PARAM_EXT_ACK { \
38 "PARAM_EXT_ACK", \
39 4, \
40 { { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 0, offsetof(mavlink_param_ext_ack_t, param_id) }, \
41 { "param_value", NULL, MAVLINK_TYPE_CHAR, 128, 16, offsetof(mavlink_param_ext_ack_t, param_value) }, \
42 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 144, offsetof(mavlink_param_ext_ack_t, param_type) }, \
43 { "param_result", NULL, MAVLINK_TYPE_UINT8_T, 0, 145, offsetof(mavlink_param_ext_ack_t, param_result) }, \
44 } \
46 #endif
48 /**
49 * @brief Pack a param_ext_ack message
50 * @param system_id ID of this system
51 * @param component_id ID of this component (e.g. 200 for IMU)
52 * @param msg The MAVLink message to compress the data into
54 * @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
55 * @param param_value Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise)
56 * @param param_type Parameter type.
57 * @param param_result Result code.
58 * @return length of the message in bytes (excluding serial stream start sign)
60 static inline uint16_t mavlink_msg_param_ext_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
61 const char *param_id, const char *param_value, uint8_t param_type, uint8_t param_result)
63 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
64 char buf[MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN];
65 _mav_put_uint8_t(buf, 144, param_type);
66 _mav_put_uint8_t(buf, 145, param_result);
67 _mav_put_char_array(buf, 0, param_id, 16);
68 _mav_put_char_array(buf, 16, param_value, 128);
69 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN);
70 #else
71 mavlink_param_ext_ack_t packet;
72 packet.param_type = param_type;
73 packet.param_result = param_result;
74 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
75 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
76 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN);
77 #endif
79 msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK;
80 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
83 /**
84 * @brief Pack a param_ext_ack message on a channel
85 * @param system_id ID of this system
86 * @param component_id ID of this component (e.g. 200 for IMU)
87 * @param chan The MAVLink channel this message will be sent over
88 * @param msg The MAVLink message to compress the data into
89 * @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
90 * @param param_value Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise)
91 * @param param_type Parameter type.
92 * @param param_result Result code.
93 * @return length of the message in bytes (excluding serial stream start sign)
95 static inline uint16_t mavlink_msg_param_ext_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
96 mavlink_message_t* msg,
97 const char *param_id,const char *param_value,uint8_t param_type,uint8_t param_result)
99 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
100 char buf[MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN];
101 _mav_put_uint8_t(buf, 144, param_type);
102 _mav_put_uint8_t(buf, 145, param_result);
103 _mav_put_char_array(buf, 0, param_id, 16);
104 _mav_put_char_array(buf, 16, param_value, 128);
105 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN);
106 #else
107 mavlink_param_ext_ack_t packet;
108 packet.param_type = param_type;
109 packet.param_result = param_result;
110 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
111 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
112 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN);
113 #endif
115 msg->msgid = MAVLINK_MSG_ID_PARAM_EXT_ACK;
116 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
120 * @brief Encode a param_ext_ack struct
122 * @param system_id ID of this system
123 * @param component_id ID of this component (e.g. 200 for IMU)
124 * @param msg The MAVLink message to compress the data into
125 * @param param_ext_ack C-struct to read the message contents from
127 static inline uint16_t mavlink_msg_param_ext_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_ext_ack_t* param_ext_ack)
129 return mavlink_msg_param_ext_ack_pack(system_id, component_id, msg, param_ext_ack->param_id, param_ext_ack->param_value, param_ext_ack->param_type, param_ext_ack->param_result);
133 * @brief Encode a param_ext_ack struct on a channel
135 * @param system_id ID of this system
136 * @param component_id ID of this component (e.g. 200 for IMU)
137 * @param chan The MAVLink channel this message will be sent over
138 * @param msg The MAVLink message to compress the data into
139 * @param param_ext_ack C-struct to read the message contents from
141 static inline uint16_t mavlink_msg_param_ext_ack_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_ext_ack_t* param_ext_ack)
143 return mavlink_msg_param_ext_ack_pack_chan(system_id, component_id, chan, msg, param_ext_ack->param_id, param_ext_ack->param_value, param_ext_ack->param_type, param_ext_ack->param_result);
147 * @brief Send a param_ext_ack message
148 * @param chan MAVLink channel to send the message
150 * @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
151 * @param param_value Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise)
152 * @param param_type Parameter type.
153 * @param param_result Result code.
155 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
157 static inline void mavlink_msg_param_ext_ack_send(mavlink_channel_t chan, const char *param_id, const char *param_value, uint8_t param_type, uint8_t param_result)
159 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
160 char buf[MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN];
161 _mav_put_uint8_t(buf, 144, param_type);
162 _mav_put_uint8_t(buf, 145, param_result);
163 _mav_put_char_array(buf, 0, param_id, 16);
164 _mav_put_char_array(buf, 16, param_value, 128);
165 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, buf, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
166 #else
167 mavlink_param_ext_ack_t packet;
168 packet.param_type = param_type;
169 packet.param_result = param_result;
170 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
171 mav_array_memcpy(packet.param_value, param_value, sizeof(char)*128);
172 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, (const char *)&packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
173 #endif
177 * @brief Send a param_ext_ack message
178 * @param chan MAVLink channel to send the message
179 * @param struct The MAVLink struct to serialize
181 static inline void mavlink_msg_param_ext_ack_send_struct(mavlink_channel_t chan, const mavlink_param_ext_ack_t* param_ext_ack)
183 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
184 mavlink_msg_param_ext_ack_send(chan, param_ext_ack->param_id, param_ext_ack->param_value, param_ext_ack->param_type, param_ext_ack->param_result);
185 #else
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, (const char *)param_ext_ack, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
187 #endif
190 #if MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN <= MAVLINK_MAX_PAYLOAD_LEN
192 This varient of _send() can be used to save stack space by re-using
193 memory from the receive buffer. The caller provides a
194 mavlink_message_t which is the size of a full mavlink message. This
195 is usually the receive buffer for the channel, and allows a reply to an
196 incoming message with minimum stack space usage.
198 static inline void mavlink_msg_param_ext_ack_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, const char *param_id, const char *param_value, uint8_t param_type, uint8_t param_result)
200 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
201 char *buf = (char *)msgbuf;
202 _mav_put_uint8_t(buf, 144, param_type);
203 _mav_put_uint8_t(buf, 145, param_result);
204 _mav_put_char_array(buf, 0, param_id, 16);
205 _mav_put_char_array(buf, 16, param_value, 128);
206 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, buf, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
207 #else
208 mavlink_param_ext_ack_t *packet = (mavlink_param_ext_ack_t *)msgbuf;
209 packet->param_type = param_type;
210 packet->param_result = param_result;
211 mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
212 mav_array_memcpy(packet->param_value, param_value, sizeof(char)*128);
213 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_EXT_ACK, (const char *)packet, MAVLINK_MSG_ID_PARAM_EXT_ACK_MIN_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN, MAVLINK_MSG_ID_PARAM_EXT_ACK_CRC);
214 #endif
216 #endif
218 #endif
220 // MESSAGE PARAM_EXT_ACK UNPACKING
224 * @brief Get field param_id from param_ext_ack message
226 * @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
228 static inline uint16_t mavlink_msg_param_ext_ack_get_param_id(const mavlink_message_t* msg, char *param_id)
230 return _MAV_RETURN_char_array(msg, param_id, 16, 0);
234 * @brief Get field param_value from param_ext_ack message
236 * @return Parameter value (new value if PARAM_ACK_ACCEPTED, current value otherwise)
238 static inline uint16_t mavlink_msg_param_ext_ack_get_param_value(const mavlink_message_t* msg, char *param_value)
240 return _MAV_RETURN_char_array(msg, param_value, 128, 16);
244 * @brief Get field param_type from param_ext_ack message
246 * @return Parameter type.
248 static inline uint8_t mavlink_msg_param_ext_ack_get_param_type(const mavlink_message_t* msg)
250 return _MAV_RETURN_uint8_t(msg, 144);
254 * @brief Get field param_result from param_ext_ack message
256 * @return Result code.
258 static inline uint8_t mavlink_msg_param_ext_ack_get_param_result(const mavlink_message_t* msg)
260 return _MAV_RETURN_uint8_t(msg, 145);
264 * @brief Decode a param_ext_ack message into a struct
266 * @param msg The message to decode
267 * @param param_ext_ack C-struct to decode the message contents into
269 static inline void mavlink_msg_param_ext_ack_decode(const mavlink_message_t* msg, mavlink_param_ext_ack_t* param_ext_ack)
271 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
272 mavlink_msg_param_ext_ack_get_param_id(msg, param_ext_ack->param_id);
273 mavlink_msg_param_ext_ack_get_param_value(msg, param_ext_ack->param_value);
274 param_ext_ack->param_type = mavlink_msg_param_ext_ack_get_param_type(msg);
275 param_ext_ack->param_result = mavlink_msg_param_ext_ack_get_param_result(msg);
276 #else
277 uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN? msg->len : MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN;
278 memset(param_ext_ack, 0, MAVLINK_MSG_ID_PARAM_EXT_ACK_LEN);
279 memcpy(param_ext_ack, _MAV_PAYLOAD(msg), len);
280 #endif