Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE PARAM_SET PACKING
2
 
3
#define MAVLINK_MSG_ID_PARAM_SET 23
4
 
5
typedef struct __mavlink_param_set_t
6
{
7
 float param_value; ///< Onboard parameter value
8
 uint8_t target_system; ///< System ID
9
 uint8_t target_component; ///< Component ID
10
 char param_id[16]; ///< Onboard parameter id
11
 uint8_t param_type; ///< Onboard parameter type: see MAV_VAR enum
12
} mavlink_param_set_t;
13
 
14
#define MAVLINK_MSG_ID_PARAM_SET_LEN 23
15
#define MAVLINK_MSG_ID_23_LEN 23
16
 
17
#define MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN 16
18
 
19
#define MAVLINK_MESSAGE_INFO_PARAM_SET { \
20
        "PARAM_SET", \
21
        5, \
22
        {  { "param_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_param_set_t, param_value) }, \
23
         { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_param_set_t, target_system) }, \
24
         { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_param_set_t, target_component) }, \
25
         { "param_id", NULL, MAVLINK_TYPE_CHAR, 16, 6, offsetof(mavlink_param_set_t, param_id) }, \
26
         { "param_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 22, offsetof(mavlink_param_set_t, param_type) }, \
27
         } \
28
}
29
 
30
 
31
/**
32
 * @brief Pack a param_set message
33
 * @param system_id ID of this system
34
 * @param component_id ID of this component (e.g. 200 for IMU)
35
 * @param msg The MAVLink message to compress the data into
36
 *
37
 * @param target_system System ID
38
 * @param target_component Component ID
39
 * @param param_id Onboard parameter id
40
 * @param param_value Onboard parameter value
41
 * @param param_type Onboard parameter type: see MAV_VAR enum
42
 * @return length of the message in bytes (excluding serial stream start sign)
43
 */
44
static inline uint16_t mavlink_msg_param_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
45
                                                       uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type)
46
{
47
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
48
        char buf[23];
49
        _mav_put_float(buf, 0, param_value);
50
        _mav_put_uint8_t(buf, 4, target_system);
51
        _mav_put_uint8_t(buf, 5, target_component);
52
        _mav_put_uint8_t(buf, 22, param_type);
53
        _mav_put_char_array(buf, 6, param_id, 16);
54
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 23);
55
#else
56
        mavlink_param_set_t packet;
57
        packet.param_value = param_value;
58
        packet.target_system = target_system;
59
        packet.target_component = target_component;
60
        packet.param_type = param_type;
61
        mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
62
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 23);
63
#endif
64
 
65
        msg->msgid = MAVLINK_MSG_ID_PARAM_SET;
66
        return mavlink_finalize_message(msg, system_id, component_id, 23, 168);
67
}
68
 
69
/**
70
 * @brief Pack a param_set message on a channel
71
 * @param system_id ID of this system
72
 * @param component_id ID of this component (e.g. 200 for IMU)
73
 * @param chan The MAVLink channel this message was sent over
74
 * @param msg The MAVLink message to compress the data into
75
 * @param target_system System ID
76
 * @param target_component Component ID
77
 * @param param_id Onboard parameter id
78
 * @param param_value Onboard parameter value
79
 * @param param_type Onboard parameter type: see MAV_VAR enum
80
 * @return length of the message in bytes (excluding serial stream start sign)
81
 */
82
static inline uint16_t mavlink_msg_param_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
83
                                                           mavlink_message_t* msg,
84
                                                           uint8_t target_system,uint8_t target_component,const char *param_id,float param_value,uint8_t param_type)
85
{
86
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
87
        char buf[23];
88
        _mav_put_float(buf, 0, param_value);
89
        _mav_put_uint8_t(buf, 4, target_system);
90
        _mav_put_uint8_t(buf, 5, target_component);
91
        _mav_put_uint8_t(buf, 22, param_type);
92
        _mav_put_char_array(buf, 6, param_id, 16);
93
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 23);
94
#else
95
        mavlink_param_set_t packet;
96
        packet.param_value = param_value;
97
        packet.target_system = target_system;
98
        packet.target_component = target_component;
99
        packet.param_type = param_type;
100
        mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
101
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 23);
102
#endif
103
 
104
        msg->msgid = MAVLINK_MSG_ID_PARAM_SET;
105
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 23, 168);
106
}
107
 
108
/**
109
 * @brief Encode a param_set struct into a message
110
 *
111
 * @param system_id ID of this system
112
 * @param component_id ID of this component (e.g. 200 for IMU)
113
 * @param msg The MAVLink message to compress the data into
114
 * @param param_set C-struct to read the message contents from
115
 */
116
static inline uint16_t mavlink_msg_param_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_param_set_t* param_set)
117
{
118
        return mavlink_msg_param_set_pack(system_id, component_id, msg, param_set->target_system, param_set->target_component, param_set->param_id, param_set->param_value, param_set->param_type);
119
}
120
 
121
/**
122
 * @brief Send a param_set message
123
 * @param chan MAVLink channel to send the message
124
 *
125
 * @param target_system System ID
126
 * @param target_component Component ID
127
 * @param param_id Onboard parameter id
128
 * @param param_value Onboard parameter value
129
 * @param param_type Onboard parameter type: see MAV_VAR enum
130
 */
131
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
132
 
133
static inline void mavlink_msg_param_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, const char *param_id, float param_value, uint8_t param_type)
134
{
135
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
136
        char buf[23];
137
        _mav_put_float(buf, 0, param_value);
138
        _mav_put_uint8_t(buf, 4, target_system);
139
        _mav_put_uint8_t(buf, 5, target_component);
140
        _mav_put_uint8_t(buf, 22, param_type);
141
        _mav_put_char_array(buf, 6, param_id, 16);
142
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, buf, 23, 168);
143
#else
144
        mavlink_param_set_t packet;
145
        packet.param_value = param_value;
146
        packet.target_system = target_system;
147
        packet.target_component = target_component;
148
        packet.param_type = param_type;
149
        mav_array_memcpy(packet.param_id, param_id, sizeof(char)*16);
150
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_PARAM_SET, (const char *)&packet, 23, 168);
151
#endif
152
}
153
 
154
#endif
155
 
156
// MESSAGE PARAM_SET UNPACKING
157
 
158
 
159
/**
160
 * @brief Get field target_system from param_set message
161
 *
162
 * @return System ID
163
 */
164
static inline uint8_t mavlink_msg_param_set_get_target_system(const mavlink_message_t* msg)
165
{
166
        return _MAV_RETURN_uint8_t(msg,  4);
167
}
168
 
169
/**
170
 * @brief Get field target_component from param_set message
171
 *
172
 * @return Component ID
173
 */
174
static inline uint8_t mavlink_msg_param_set_get_target_component(const mavlink_message_t* msg)
175
{
176
        return _MAV_RETURN_uint8_t(msg,  5);
177
}
178
 
179
/**
180
 * @brief Get field param_id from param_set message
181
 *
182
 * @return Onboard parameter id
183
 */
184
static inline uint16_t mavlink_msg_param_set_get_param_id(const mavlink_message_t* msg, char *param_id)
185
{
186
        return _MAV_RETURN_char_array(msg, param_id, 16,  6);
187
}
188
 
189
/**
190
 * @brief Get field param_value from param_set message
191
 *
192
 * @return Onboard parameter value
193
 */
194
static inline float mavlink_msg_param_set_get_param_value(const mavlink_message_t* msg)
195
{
196
        return _MAV_RETURN_float(msg,  0);
197
}
198
 
199
/**
200
 * @brief Get field param_type from param_set message
201
 *
202
 * @return Onboard parameter type: see MAV_VAR enum
203
 */
204
static inline uint8_t mavlink_msg_param_set_get_param_type(const mavlink_message_t* msg)
205
{
206
        return _MAV_RETURN_uint8_t(msg,  22);
207
}
208
 
209
/**
210
 * @brief Decode a param_set message into a struct
211
 *
212
 * @param msg The message to decode
213
 * @param param_set C-struct to decode the message contents into
214
 */
215
static inline void mavlink_msg_param_set_decode(const mavlink_message_t* msg, mavlink_param_set_t* param_set)
216
{
217
#if MAVLINK_NEED_BYTE_SWAP
218
        param_set->param_value = mavlink_msg_param_set_get_param_value(msg);
219
        param_set->target_system = mavlink_msg_param_set_get_target_system(msg);
220
        param_set->target_component = mavlink_msg_param_set_get_target_component(msg);
221
        mavlink_msg_param_set_get_param_id(msg, param_set->param_id);
222
        param_set->param_type = mavlink_msg_param_set_get_param_type(msg);
223
#else
224
        memcpy(param_set, _MAV_PAYLOAD(msg), 23);
225
#endif
226
}