Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / flight / libraries / mavlink / v1.0 / common / mavlink_msg_param_request_read.h
blobe144cf443bbf42c51a8c2ec8a0c9f88568db2651
1 // MESSAGE PARAM_REQUEST_READ PACKING
3 #define MAVLINK_MSG_ID_PARAM_REQUEST_READ 20
5 typedef struct __mavlink_param_request_read_t {
6 int16_t param_index; ///< Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
7 uint8_t target_system; ///< System ID
8 uint8_t target_component; ///< Component ID
9 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
10 } mavlink_param_request_read_t;
12 #define MAVLINK_MSG_ID_PARAM_REQUEST_READ_LEN 20
13 #define MAVLINK_MSG_ID_20_LEN 20
15 #define MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_PARAM_ID_LEN 16
17 #define MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ \
18 { \
19 "PARAM_REQUEST_READ", \
20 4, \
21 { \
22 { "param_index", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_param_request_read_t, param_index) }, \
23 { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_param_request_read_t, target_system) }, \
24 { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_param_request_read_t, target_component) }, \
25 { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 4, offsetof(mavlink_param_request_read_t, param_id) }, \
26 } \
30 /**
31 * @brief Pack a param_request_read message
32 * @param system_id ID of this system
33 * @param component_id ID of this component (e.g. 200 for IMU)
34 * @param msg The MAVLink message to compress the data into
36 * @param target_system System ID
37 * @param target_component Component ID
38 * @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
39 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
40 * @return length of the message in bytes (excluding serial stream start sign)
42 static inline uint16_t mavlink_msg_param_request_read_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t *msg,
43 uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
45 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
46 char buf[20];
47 _mav_put_int16_t(buf, 0, param_index);
48 _mav_put_uint8_t(buf, 2, target_system);
49 _mav_put_uint8_t(buf, 3, target_component);
50 _mav_put_char_array(buf, 4, param_id, 16);
51 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 20);
52 #else
53 mavlink_param_request_read_t packet;
54 packet.param_index = param_index;
55 packet.target_system = target_system;
56 packet.target_component = target_component;
57 mav_array_memcpy(packet.param_id, param_id, sizeof(char) * 16);
58 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 20);
59 #endif
61 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
62 return mavlink_finalize_message(msg, system_id, component_id, 20, 214);
65 /**
66 * @brief Pack a param_request_read message on a channel
67 * @param system_id ID of this system
68 * @param component_id ID of this component (e.g. 200 for IMU)
69 * @param chan The MAVLink channel this message was sent over
70 * @param msg The MAVLink message to compress the data into
71 * @param target_system System ID
72 * @param target_component Component ID
73 * @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
74 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
75 * @return length of the message in bytes (excluding serial stream start sign)
77 static inline uint16_t mavlink_msg_param_request_read_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
78 mavlink_message_t *msg,
79 uint8_t target_system, uint8_t target_component, const char *param_id, int16_t param_index)
81 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
82 char buf[20];
83 _mav_put_int16_t(buf, 0, param_index);
84 _mav_put_uint8_t(buf, 2, target_system);
85 _mav_put_uint8_t(buf, 3, target_component);
86 _mav_put_char_array(buf, 4, param_id, 16);
87 memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 20);
88 #else
89 mavlink_param_request_read_t packet;
90 packet.param_index = param_index;
91 packet.target_system = target_system;
92 packet.target_component = target_component;
93 mav_array_memcpy(packet.param_id, param_id, sizeof(char) * 16);
94 memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 20);
95 #endif
97 msg->msgid = MAVLINK_MSG_ID_PARAM_REQUEST_READ;
98 return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 20, 214);
102 * @brief Encode a param_request_read struct into a message
104 * @param system_id ID of this system
105 * @param component_id ID of this component (e.g. 200 for IMU)
106 * @param msg The MAVLink message to compress the data into
107 * @param param_request_read C-struct to read the message contents from
109 static 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)
111 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);
115 * @brief Send a param_request_read message
116 * @param chan MAVLink channel to send the message
118 * @param target_system System ID
119 * @param target_component Component ID
120 * @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
121 * @param param_index Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
123 #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
125 static 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)
127 #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
128 char buf[20];
129 _mav_put_int16_t(buf, 0, param_index);
130 _mav_put_uint8_t(buf, 2, target_system);
131 _mav_put_uint8_t(buf, 3, target_component);
132 _mav_put_char_array(buf, 4, param_id, 16);
133 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, buf, 20, 214);
134 #else
135 mavlink_param_request_read_t packet;
136 packet.param_index = param_index;
137 packet.target_system = target_system;
138 packet.target_component = target_component;
139 mav_array_memcpy(packet.param_id, param_id, sizeof(char) * 16);
140 _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_REQUEST_READ, (const char *)&packet, 20, 214);
141 #endif
144 #endif // ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
146 // MESSAGE PARAM_REQUEST_READ UNPACKING
150 * @brief Get field target_system from param_request_read message
152 * @return System ID
154 static inline uint8_t mavlink_msg_param_request_read_get_target_system(const mavlink_message_t *msg)
156 return _MAV_RETURN_uint8_t(msg, 2);
160 * @brief Get field target_component from param_request_read message
162 * @return Component ID
164 static inline uint8_t mavlink_msg_param_request_read_get_target_component(const mavlink_message_t *msg)
166 return _MAV_RETURN_uint8_t(msg, 3);
170 * @brief Get field param_id from param_request_read message
172 * @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
174 static inline uint16_t mavlink_msg_param_request_read_get_param_id(const mavlink_message_t *msg, char *param_id)
176 return _MAV_RETURN_char_array(msg, param_id, 16, 4);
180 * @brief Get field param_index from param_request_read message
182 * @return Parameter index. Send -1 to use the param ID field as identifier (else the param id will be ignored)
184 static inline int16_t mavlink_msg_param_request_read_get_param_index(const mavlink_message_t *msg)
186 return _MAV_RETURN_int16_t(msg, 0);
190 * @brief Decode a param_request_read message into a struct
192 * @param msg The message to decode
193 * @param param_request_read C-struct to decode the message contents into
195 static inline void mavlink_msg_param_request_read_decode(const mavlink_message_t *msg, mavlink_param_request_read_t *param_request_read)
197 #if MAVLINK_NEED_BYTE_SWAP
198 param_request_read->param_index = mavlink_msg_param_request_read_get_param_index(msg);
199 param_request_read->target_system = mavlink_msg_param_request_read_get_target_system(msg);
200 param_request_read->target_component = mavlink_msg_param_request_read_get_target_component(msg);
201 mavlink_msg_param_request_read_get_param_id(msg, param_request_read->param_id);
202 #else
203 memcpy(param_request_read, _MAV_PAYLOAD(msg), 20);
204 #endif