Merge remote-tracking branch 'upstream/master' into abo_fw_alt_vel_control
[inav.git] / lib / main / MAVLink / common / mavlink_msg_param_ack_transaction.h
blob404b084ab9393a19b6a95ef446664ccb8b632907
1 #pragma once
2 // MESSAGE PARAM_ACK_TRANSACTION PACKING
4 #define MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION 19
7 typedef struct __mavlink_param_ack_transaction_t {
8 float param_value; /*< Parameter value (new value if PARAM_ACCEPTED, current value otherwise)*/
9 uint8_t target_system; /*< Id of system that sent PARAM_SET message.*/
10 uint8_t target_component; /*< Id of system that sent PARAM_SET message.*/
11 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*/
12 uint8_t param_type; /*< Parameter type.*/
13 uint8_t param_result; /*< Result code.*/
14 } mavlink_param_ack_transaction_t;
16 #define MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN 24
17 #define MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN 24
18 #define MAVLINK_MSG_ID_19_LEN 24
19 #define MAVLINK_MSG_ID_19_MIN_LEN 24
21 #define MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC 137
22 #define MAVLINK_MSG_ID_19_CRC 137
24 #define MAVLINK_MSG_PARAM_ACK_TRANSACTION_FIELD_PARAM_ID_LEN 16
26 #if MAVLINK_COMMAND_24BIT
27 #define MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION { \
28 19, \
29 "PARAM_ACK_TRANSACTION", \
30 6, \
31 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_param_ack_transaction_t, target_system) }, \
32 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_param_ack_transaction_t, target_component) }, \
33 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 6, offsetof(mavlink_param_ack_transaction_t, param_id) }, \
34 { "param_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_ack_transaction_t, param_value) }, \
35 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_param_ack_transaction_t, param_type) }, \
36 { "param_result", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_param_ack_transaction_t, param_result) }, \
37 } \
39 #else
40 #define MAVLINK_MESSAGE_INFO_PARAM_ACK_TRANSACTION { \
41 "PARAM_ACK_TRANSACTION", \
42 6, \
43 { { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_param_ack_transaction_t, target_system) }, \
44 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_param_ack_transaction_t, target_component) }, \
45 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 6, offsetof(mavlink_param_ack_transaction_t, param_id) }, \
46 { "param_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_ack_transaction_t, param_value) }, \
47 { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_param_ack_transaction_t, param_type) }, \
48 { "param_result", NULL, MAVLINK_TYPE_UINT8_T, 0, 23, offsetof(mavlink_param_ack_transaction_t, param_result) }, \
49 } \
51 #endif
53 /**
54 * @brief Pack a param_ack_transaction message
55 * @param system_id ID of this system
56 * @param component_id ID of this component (e.g. 200 for IMU)
57 * @param msg The MAVLink message to compress the data into
59 * @param target_system Id of system that sent PARAM_SET message.
60 * @param target_component Id of system that sent PARAM_SET message.
61 * @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
62 * @param param_value Parameter value (new value if PARAM_ACCEPTED, current value otherwise)
63 * @param param_type Parameter type.
64 * @param param_result Result code.
65 * @return length of the message in bytes (excluding serial stream start sign)
67 static inline uint16_t mavlink_msg_param_ack_transaction_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
68 uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type, uint8_t param_result)
70 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
71 char buf[MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN];
72 _mav_put_float(buf, 0, param_value);
73 _mav_put_uint8_t(buf, 4, target_system);
74 _mav_put_uint8_t(buf, 5, target_component);
75 _mav_put_uint8_t(buf, 22, param_type);
76 _mav_put_uint8_t(buf, 23, param_result);
77 _mav_put_char_array(buf, 6, param_id, 16);
78 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN);
79 #else
80 mavlink_param_ack_transaction_t packet;
81 packet.param_value = param_value;
82 packet.target_system = target_system;
83 packet.target_component = target_component;
84 packet.param_type = param_type;
85 packet.param_result = param_result;
86 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN);
88 #endif
90 msg->msgid = MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION;
91 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
94 /**
95 * @brief Pack a param_ack_transaction message on a channel
96 * @param system_id ID of this system
97 * @param component_id ID of this component (e.g. 200 for IMU)
98 * @param chan The MAVLink channel this message will be sent over
99 * @param msg The MAVLink message to compress the data into
100 * @param target_system Id of system that sent PARAM_SET message.
101 * @param target_component Id of system that sent PARAM_SET message.
102 * @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
103 * @param param_value Parameter value (new value if PARAM_ACCEPTED, current value otherwise)
104 * @param param_type Parameter type.
105 * @param param_result Result code.
106 * @return length of the message in bytes (excluding serial stream start sign)
108 static inline uint16_t mavlink_msg_param_ack_transaction_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
109 mavlink_message_t* msg,
110 uint8_t target_system,uint8_t target_component,const char *param_id,float param_value,uint8_t param_type,uint8_t param_result)
112 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
113 char buf[MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN];
114 _mav_put_float(buf, 0, param_value);
115 _mav_put_uint8_t(buf, 4, target_system);
116 _mav_put_uint8_t(buf, 5, target_component);
117 _mav_put_uint8_t(buf, 22, param_type);
118 _mav_put_uint8_t(buf, 23, param_result);
119 _mav_put_char_array(buf, 6, param_id, 16);
120 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN);
121 #else
122 mavlink_param_ack_transaction_t packet;
123 packet.param_value = param_value;
124 packet.target_system = target_system;
125 packet.target_component = target_component;
126 packet.param_type = param_type;
127 packet.param_result = param_result;
128 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
129 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN);
130 #endif
132 msg->msgid = MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION;
133 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
137 * @brief Encode a param_ack_transaction struct
139 * @param system_id ID of this system
140 * @param component_id ID of this component (e.g. 200 for IMU)
141 * @param msg The MAVLink message to compress the data into
142 * @param param_ack_transaction C-struct to read the message contents from
144 static inline uint16_t mavlink_msg_param_ack_transaction_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_ack_transaction_t* param_ack_transaction)
146 return mavlink_msg_param_ack_transaction_pack(system_id, component_id, msg, param_ack_transaction->target_system, param_ack_transaction->target_component, param_ack_transaction->param_id, param_ack_transaction->param_value, param_ack_transaction->param_type, param_ack_transaction->param_result);
150 * @brief Encode a param_ack_transaction struct on a channel
152 * @param system_id ID of this system
153 * @param component_id ID of this component (e.g. 200 for IMU)
154 * @param chan The MAVLink channel this message will be sent over
155 * @param msg The MAVLink message to compress the data into
156 * @param param_ack_transaction C-struct to read the message contents from
158 static inline uint16_t mavlink_msg_param_ack_transaction_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_ack_transaction_t* param_ack_transaction)
160 return mavlink_msg_param_ack_transaction_pack_chan(system_id, component_id, chan, msg, param_ack_transaction->target_system, param_ack_transaction->target_component, param_ack_transaction->param_id, param_ack_transaction->param_value, param_ack_transaction->param_type, param_ack_transaction->param_result);
164 * @brief Send a param_ack_transaction message
165 * @param chan MAVLink channel to send the message
167 * @param target_system Id of system that sent PARAM_SET message.
168 * @param target_component Id of system that sent PARAM_SET message.
169 * @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
170 * @param param_value Parameter value (new value if PARAM_ACCEPTED, current value otherwise)
171 * @param param_type Parameter type.
172 * @param param_result Result code.
174 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
176 static inline void mavlink_msg_param_ack_transaction_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type, uint8_t param_result)
178 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
179 char buf[MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN];
180 _mav_put_float(buf, 0, param_value);
181 _mav_put_uint8_t(buf, 4, target_system);
182 _mav_put_uint8_t(buf, 5, target_component);
183 _mav_put_uint8_t(buf, 22, param_type);
184 _mav_put_uint8_t(buf, 23, param_result);
185 _mav_put_char_array(buf, 6, param_id, 16);
186 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, buf, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
187 #else
188 mavlink_param_ack_transaction_t packet;
189 packet.param_value = param_value;
190 packet.target_system = target_system;
191 packet.target_component = target_component;
192 packet.param_type = param_type;
193 packet.param_result = param_result;
194 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
195 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, (const char *)&packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
196 #endif
200 * @brief Send a param_ack_transaction message
201 * @param chan MAVLink channel to send the message
202 * @param struct The MAVLink struct to serialize
204 static inline void mavlink_msg_param_ack_transaction_send_struct(mavlink_channel_t chan, const mavlink_param_ack_transaction_t* param_ack_transaction)
206 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
207 mavlink_msg_param_ack_transaction_send(chan, param_ack_transaction->target_system, param_ack_transaction->target_component, param_ack_transaction->param_id, param_ack_transaction->param_value, param_ack_transaction->param_type, param_ack_transaction->param_result);
208 #else
209 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, (const char *)param_ack_transaction, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
210 #endif
213 #if MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN <= MAVLINK_MAX_PAYLOAD_LEN
215 This varient of _send() can be used to save stack space by re-using
216 memory from the receive buffer. The caller provides a
217 mavlink_message_t which is the size of a full mavlink message. This
218 is usually the receive buffer for the channel, and allows a reply to an
219 incoming message with minimum stack space usage.
221 static inline void mavlink_msg_param_ack_transaction_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, uint8_t param_result)
223 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
224 char *buf = (char *)msgbuf;
225 _mav_put_float(buf, 0, param_value);
226 _mav_put_uint8_t(buf, 4, target_system);
227 _mav_put_uint8_t(buf, 5, target_component);
228 _mav_put_uint8_t(buf, 22, param_type);
229 _mav_put_uint8_t(buf, 23, param_result);
230 _mav_put_char_array(buf, 6, param_id, 16);
231 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, buf, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
232 #else
233 mavlink_param_ack_transaction_t *packet = (mavlink_param_ack_transaction_t *)msgbuf;
234 packet->param_value = param_value;
235 packet->target_system = target_system;
236 packet->target_component = target_component;
237 packet->param_type = param_type;
238 packet->param_result = param_result;
239 mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
240 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION, (const char *)packet, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_MIN_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_CRC);
241 #endif
243 #endif
245 #endif
247 // MESSAGE PARAM_ACK_TRANSACTION UNPACKING
251 * @brief Get field target_system from param_ack_transaction message
253 * @return Id of system that sent PARAM_SET message.
255 static inline uint8_t mavlink_msg_param_ack_transaction_get_target_system(const mavlink_message_t* msg)
257 return _MAV_RETURN_uint8_t(msg, 4);
261 * @brief Get field target_component from param_ack_transaction message
263 * @return Id of system that sent PARAM_SET message.
265 static inline uint8_t mavlink_msg_param_ack_transaction_get_target_component(const mavlink_message_t* msg)
267 return _MAV_RETURN_uint8_t(msg, 5);
271 * @brief Get field param_id from param_ack_transaction message
273 * @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
275 static inline uint16_t mavlink_msg_param_ack_transaction_get_param_id(const mavlink_message_t* msg, char *param_id)
277 return _MAV_RETURN_char_array(msg, param_id, 16, 6);
281 * @brief Get field param_value from param_ack_transaction message
283 * @return Parameter value (new value if PARAM_ACCEPTED, current value otherwise)
285 static inline float mavlink_msg_param_ack_transaction_get_param_value(const mavlink_message_t* msg)
287 return _MAV_RETURN_float(msg, 0);
291 * @brief Get field param_type from param_ack_transaction message
293 * @return Parameter type.
295 static inline uint8_t mavlink_msg_param_ack_transaction_get_param_type(const mavlink_message_t* msg)
297 return _MAV_RETURN_uint8_t(msg, 22);
301 * @brief Get field param_result from param_ack_transaction message
303 * @return Result code.
305 static inline uint8_t mavlink_msg_param_ack_transaction_get_param_result(const mavlink_message_t* msg)
307 return _MAV_RETURN_uint8_t(msg, 23);
311 * @brief Decode a param_ack_transaction message into a struct
313 * @param msg The message to decode
314 * @param param_ack_transaction C-struct to decode the message contents into
316 static inline void mavlink_msg_param_ack_transaction_decode(const mavlink_message_t* msg, mavlink_param_ack_transaction_t* param_ack_transaction)
318 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
319 param_ack_transaction->param_value = mavlink_msg_param_ack_transaction_get_param_value(msg);
320 param_ack_transaction->target_system = mavlink_msg_param_ack_transaction_get_target_system(msg);
321 param_ack_transaction->target_component = mavlink_msg_param_ack_transaction_get_target_component(msg);
322 mavlink_msg_param_ack_transaction_get_param_id(msg, param_ack_transaction->param_id);
323 param_ack_transaction->param_type = mavlink_msg_param_ack_transaction_get_param_type(msg);
324 param_ack_transaction->param_result = mavlink_msg_param_ack_transaction_get_param_result(msg);
325 #else
326 uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN? msg->len : MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN;
327 memset(param_ack_transaction, 0, MAVLINK_MSG_ID_PARAM_ACK_TRANSACTION_LEN);
328 memcpy(param_ack_transaction, _MAV_PAYLOAD(msg), len);
329 #endif