source: flair-src/branches/mavlink/tools/Controller/Mavlink/src/include/common/mavlink_msg_param_request_read.h@ 75

Last change on this file since 75 was 75, checked in by Thomas Fuhrmann, 8 years ago

Change the version of mavlink generated messages and rename it to include

File size: 13.7 KB
Line 
1// MESSAGE PARAM_REQUEST_READ PACKING
2
3#define MAVLINK_MSG_ID_PARAM_REQUEST_READ 20
4
5typedef struct MAVLINK_PACKED __mavlink_param_request_read_t
6{
7 int16_t param_index; /*< Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)*/
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} mavlink_param_request_read_t;
12
13#define MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN 20
14#define MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN 20
15#define MAVLINK_MSG_ID_20_LEN 20
16#define MAVLINK_MSG_ID_20_MIN_LEN 20
17
18#define MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC 214
19#define MAVLINK_MSG_ID_20_CRC 214
20
21#define MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_PARAM_ID_LEN 16
22
23#if MAVLINK_COMMAND_24BIT
24#define MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ { \
25 20, \
26 "PARAM_REQUEST_READ", \
27 4, \
28 { { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_request_read_t, param_index) }, \
29 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_request_read_t, target_system) }, \
30 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_request_read_t, target_component) }, \
31 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_request_read_t, param_id) }, \
32 } \
33}
34#else
35#define MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ { \
36 "PARAM_REQUEST_READ", \
37 4, \
38 { { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_request_read_t, param_index) }, \
39 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_request_read_t, target_system) }, \
40 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_request_read_t, target_component) }, \
41 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_request_read_t, param_id) }, \
42 } \
43}
44#endif
45
46/**
47 * @brief Pack a param_request_read message
48 * @param system_id ID of this system
49 * @param component_id ID of this component (e.g. 200 for IMU)
50 * @param msg The MAVLink message to compress the data into
51 *
52 * @param target_system System ID
53 * @param target_component Component ID
54 * @param param_id 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
55 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
56 * @return length of the message in bytes (excluding serial stream start sign)
57 */
58static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
59 uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
60{
61#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
62 char buf[MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN];
63 _mav_put_int16_t(buf, 0, param_index);
64 _mav_put_uint8_t(buf, 2, target_system);
65 _mav_put_uint8_t(buf, 3, target_component);
66 _mav_put_char_array(buf, 4, param_id, 16);
67 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN);
68#else
69 mavlink_param_request_read_t packet;
70 packet.param_index = param_index;
71 packet.target_system = target_system;
72 packet.target_component = target_component;
73 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
74 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN);
75#endif
76
77 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
78 return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
79}
80
81/**
82 * @brief Pack a param_request_read message on a channel
83 * @param system_id ID of this system
84 * @param component_id ID of this component (e.g. 200 for IMU)
85 * @param chan The MAVLink channel this message will be sent over
86 * @param msg The MAVLink message to compress the data into
87 * @param target_system System ID
88 * @param target_component Component ID
89 * @param param_id 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
90 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
91 * @return length of the message in bytes (excluding serial stream start sign)
92 */
93static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
94 mavlink_message_t* msg,
95 uint8_t target_system,uint8_t target_component,const char *param_id,int16_t param_index)
96{
97#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
98 char buf[MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN];
99 _mav_put_int16_t(buf, 0, param_index);
100 _mav_put_uint8_t(buf, 2, target_system);
101 _mav_put_uint8_t(buf, 3, target_component);
102 _mav_put_char_array(buf, 4, param_id, 16);
103 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN);
104#else
105 mavlink_param_request_read_t packet;
106 packet.param_index = param_index;
107 packet.target_system = target_system;
108 packet.target_component = target_component;
109 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
110 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN);
111#endif
112
113 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
114 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
115}
116
117/**
118 * @brief Encode a param_request_read struct
119 *
120 * @param system_id ID of this system
121 * @param component_id ID of this component (e.g. 200 for IMU)
122 * @param msg The MAVLink message to compress the data into
123 * @param param_request_read C-struct to read the message contents from
124 */
125static inline uint16_t mavlink_msg_param_request_read_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_request_read_t* param_request_read)
126{
127 return mavlink_msg_param_request_read_pack(system_id, component_id, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index);
128}
129
130/**
131 * @brief Encode a param_request_read struct on a channel
132 *
133 * @param system_id ID of this system
134 * @param component_id ID of this component (e.g. 200 for IMU)
135 * @param chan The MAVLink channel this message will be sent over
136 * @param msg The MAVLink message to compress the data into
137 * @param param_request_read C-struct to read the message contents from
138 */
139static inline uint16_t mavlink_msg_param_request_read_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_param_request_read_t* param_request_read)
140{
141 return mavlink_msg_param_request_read_pack_chan(system_id, component_id, chan, msg, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index);
142}
143
144/**
145 * @brief Send a param_request_read message
146 * @param chan MAVLink channel to send the message
147 *
148 * @param target_system System ID
149 * @param target_component Component ID
150 * @param param_id 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
151 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
152 */
153#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
154
155static inline void mavlink_msg_param_request_read_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
156{
157#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
158 char buf[MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN];
159 _mav_put_int16_t(buf, 0, param_index);
160 _mav_put_uint8_t(buf, 2, target_system);
161 _mav_put_uint8_t(buf, 3, target_component);
162 _mav_put_char_array(buf, 4, param_id, 16);
163 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, buf, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
164#else
165 mavlink_param_request_read_t packet;
166 packet.param_index = param_index;
167 packet.target_system = target_system;
168 packet.target_component = target_component;
169 mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
170 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
171#endif
172}
173
174/**
175 * @brief Send a param_request_read message
176 * @param chan MAVLink channel to send the message
177 * @param struct The MAVLink struct to serialize
178 */
179static inline void mavlink_msg_param_request_read_send_struct(mavlink_channel_t chan, const mavlink_param_request_read_t* param_request_read)
180{
181#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
182 mavlink_msg_param_request_read_send(chan, param_request_read->target_system, param_request_read->target_component, param_request_read->param_id, param_request_read->param_index);
183#else
184 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)param_request_read, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
185#endif
186}
187
188#if MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN <= MAVLINK_MAX_PAYLOAD_LEN
189/*
190 This varient of _send() can be used to save stack space by re-using
191 memory from the receive buffer. The caller provides a
192 mavlink_message_t which is the size of a full mavlink message. This
193 is usually the receive buffer for the channel, and allows a reply to an
194 incoming message with minimum stack space usage.
195 */
196static inline void mavlink_msg_param_request_read_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
197{
198#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
199 char *buf = (char *)msgbuf;
200 _mav_put_int16_t(buf, 0, param_index);
201 _mav_put_uint8_t(buf, 2, target_system);
202 _mav_put_uint8_t(buf, 3, target_component);
203 _mav_put_char_array(buf, 4, param_id, 16);
204 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, buf, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
205#else
206 mavlink_param_request_read_t *packet = (mavlink_param_request_read_t *)msgbuf;
207 packet->param_index = param_index;
208 packet->target_system = target_system;
209 packet->target_component = target_component;
210 mav_array_memcpy(packet->param_id, param_id, sizeof(char)*16);
211 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)packet, MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN, MAVLINK_MSG_ID_PARAM_REQUEST_READ_CRC);
212#endif
213}
214#endif
215
216#endif
217
218// MESSAGE PARAM_REQUEST_READ UNPACKING
219
220
221/**
222 * @brief Get field target_system from param_request_read message
223 *
224 * @return System ID
225 */
226static inline uint8_t mavlink_msg_param_request_read_get_target_system(const mavlink_message_t* msg)
227{
228 return _MAV_RETURN_uint8_t(msg, 2);
229}
230
231/**
232 * @brief Get field target_component from param_request_read message
233 *
234 * @return Component ID
235 */
236static inline uint8_t mavlink_msg_param_request_read_get_target_component(const mavlink_message_t* msg)
237{
238 return _MAV_RETURN_uint8_t(msg, 3);
239}
240
241/**
242 * @brief Get field param_id from param_request_read message
243 *
244 * @return 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
245 */
246static inline uint16_t mavlink_msg_param_request_read_get_param_id(const mavlink_message_t* msg, char *param_id)
247{
248 return _MAV_RETURN_char_array(msg, param_id, 16, 4);
249}
250
251/**
252 * @brief Get field param_index from param_request_read message
253 *
254 * @return Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
255 */
256static inline int16_t mavlink_msg_param_request_read_get_param_index(const mavlink_message_t* msg)
257{
258 return _MAV_RETURN_int16_t(msg, 0);
259}
260
261/**
262 * @brief Decode a param_request_read message into a struct
263 *
264 * @param msg The message to decode
265 * @param param_request_read C-struct to decode the message contents into
266 */
267static inline void mavlink_msg_param_request_read_decode(const mavlink_message_t* msg, mavlink_param_request_read_t* param_request_read)
268{
269#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
270 param_request_read->param_index = mavlink_msg_param_request_read_get_param_index(msg);
271 param_request_read->target_system = mavlink_msg_param_request_read_get_target_system(msg);
272 param_request_read->target_component = mavlink_msg_param_request_read_get_target_component(msg);
273 mavlink_msg_param_request_read_get_param_id(msg, param_request_read->param_id);
274#else
275 uint8_t len = msg->len < MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN? msg->len : MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN;
276 memset(param_request_read, 0, MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN);
277 memcpy(param_request_read, _MAV_PAYLOAD(msg), len);
278#endif
279}
Note: See TracBrowser for help on using the repository browser.