Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
// MESSAGE DIGICAM_CONTROL PACKING
2
 
3
#define MAVLINK_MSG_ID_DIGICAM_CONTROL 155
4
 
5
typedef struct __mavlink_digicam_control_t
6
{
7
 float extra_value; ///< Correspondent value to given extra_param
8
 uint8_t target_system; ///< System ID
9
 uint8_t target_component; ///< Component ID
10
 uint8_t session; ///< 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
11
 uint8_t zoom_pos; ///< 1 to N //Zoom's absolute position (0 means ignore)
12
 int8_t zoom_step; ///< -100 to 100 //Zooming step value to offset zoom from the current position
13
 uint8_t focus_lock; ///< 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
14
 uint8_t shot; ///< 0: ignore, 1: shot or start filming
15
 uint8_t command_id; ///< Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
16
 uint8_t extra_param; ///< Extra parameters enumeration (0 means ignore)
17
} mavlink_digicam_control_t;
18
 
19
#define MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN 13
20
#define MAVLINK_MSG_ID_155_LEN 13
21
 
22
 
23
 
24
#define MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL { \
25
        "DIGICAM_CONTROL", \
26
        10, \
27
        {  { "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_digicam_control_t, extra_value) }, \
28
         { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_digicam_control_t, target_system) }, \
29
         { "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_digicam_control_t, target_component) }, \
30
         { "session", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_control_t, session) }, \
31
         { "zoom_pos", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_control_t, zoom_pos) }, \
32
         { "zoom_step", NULL, MAVLINK_TYPE_INT8_T, 0, 8, offsetof(mavlink_digicam_control_t, zoom_step) }, \
33
         { "focus_lock", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_control_t, focus_lock) }, \
34
         { "shot", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_control_t, shot) }, \
35
         { "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 11, offsetof(mavlink_digicam_control_t, command_id) }, \
36
         { "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 12, offsetof(mavlink_digicam_control_t, extra_param) }, \
37
         } \
38
}
39
 
40
 
41
/**
42
 * @brief Pack a digicam_control message
43
 * @param system_id ID of this system
44
 * @param component_id ID of this component (e.g. 200 for IMU)
45
 * @param msg The MAVLink message to compress the data into
46
 *
47
 * @param target_system System ID
48
 * @param target_component Component ID
49
 * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
50
 * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
51
 * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
52
 * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
53
 * @param shot 0: ignore, 1: shot or start filming
54
 * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
55
 * @param extra_param Extra parameters enumeration (0 means ignore)
56
 * @param extra_value Correspondent value to given extra_param
57
 * @return length of the message in bytes (excluding serial stream start sign)
58
 */
59
static inline uint16_t mavlink_msg_digicam_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
60
                                                       uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value)
61
{
62
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
63
        char buf[13];
64
        _mav_put_float(buf, 0, extra_value);
65
        _mav_put_uint8_t(buf, 4, target_system);
66
        _mav_put_uint8_t(buf, 5, target_component);
67
        _mav_put_uint8_t(buf, 6, session);
68
        _mav_put_uint8_t(buf, 7, zoom_pos);
69
        _mav_put_int8_t(buf, 8, zoom_step);
70
        _mav_put_uint8_t(buf, 9, focus_lock);
71
        _mav_put_uint8_t(buf, 10, shot);
72
        _mav_put_uint8_t(buf, 11, command_id);
73
        _mav_put_uint8_t(buf, 12, extra_param);
74
 
75
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 13);
76
#else
77
        mavlink_digicam_control_t packet;
78
        packet.extra_value = extra_value;
79
        packet.target_system = target_system;
80
        packet.target_component = target_component;
81
        packet.session = session;
82
        packet.zoom_pos = zoom_pos;
83
        packet.zoom_step = zoom_step;
84
        packet.focus_lock = focus_lock;
85
        packet.shot = shot;
86
        packet.command_id = command_id;
87
        packet.extra_param = extra_param;
88
 
89
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 13);
90
#endif
91
 
92
        msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL;
93
        return mavlink_finalize_message(msg, system_id, component_id, 13, 22);
94
}
95
 
96
/**
97
 * @brief Pack a digicam_control message on a channel
98
 * @param system_id ID of this system
99
 * @param component_id ID of this component (e.g. 200 for IMU)
100
 * @param chan The MAVLink channel this message was sent over
101
 * @param msg The MAVLink message to compress the data into
102
 * @param target_system System ID
103
 * @param target_component Component ID
104
 * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
105
 * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
106
 * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
107
 * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
108
 * @param shot 0: ignore, 1: shot or start filming
109
 * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
110
 * @param extra_param Extra parameters enumeration (0 means ignore)
111
 * @param extra_value Correspondent value to given extra_param
112
 * @return length of the message in bytes (excluding serial stream start sign)
113
 */
114
static inline uint16_t mavlink_msg_digicam_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
115
                                                           mavlink_message_t* msg,
116
                                                           uint8_t target_system,uint8_t target_component,uint8_t session,uint8_t zoom_pos,int8_t zoom_step,uint8_t focus_lock,uint8_t shot,uint8_t command_id,uint8_t extra_param,float extra_value)
117
{
118
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
119
        char buf[13];
120
        _mav_put_float(buf, 0, extra_value);
121
        _mav_put_uint8_t(buf, 4, target_system);
122
        _mav_put_uint8_t(buf, 5, target_component);
123
        _mav_put_uint8_t(buf, 6, session);
124
        _mav_put_uint8_t(buf, 7, zoom_pos);
125
        _mav_put_int8_t(buf, 8, zoom_step);
126
        _mav_put_uint8_t(buf, 9, focus_lock);
127
        _mav_put_uint8_t(buf, 10, shot);
128
        _mav_put_uint8_t(buf, 11, command_id);
129
        _mav_put_uint8_t(buf, 12, extra_param);
130
 
131
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, 13);
132
#else
133
        mavlink_digicam_control_t packet;
134
        packet.extra_value = extra_value;
135
        packet.target_system = target_system;
136
        packet.target_component = target_component;
137
        packet.session = session;
138
        packet.zoom_pos = zoom_pos;
139
        packet.zoom_step = zoom_step;
140
        packet.focus_lock = focus_lock;
141
        packet.shot = shot;
142
        packet.command_id = command_id;
143
        packet.extra_param = extra_param;
144
 
145
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, 13);
146
#endif
147
 
148
        msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL;
149
        return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 13, 22);
150
}
151
 
152
/**
153
 * @brief Encode a digicam_control struct into a message
154
 *
155
 * @param system_id ID of this system
156
 * @param component_id ID of this component (e.g. 200 for IMU)
157
 * @param msg The MAVLink message to compress the data into
158
 * @param digicam_control C-struct to read the message contents from
159
 */
160
static inline uint16_t mavlink_msg_digicam_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_digicam_control_t* digicam_control)
161
{
162
        return mavlink_msg_digicam_control_pack(system_id, component_id, msg, digicam_control->target_system, digicam_control->target_component, digicam_control->session, digicam_control->zoom_pos, digicam_control->zoom_step, digicam_control->focus_lock, digicam_control->shot, digicam_control->command_id, digicam_control->extra_param, digicam_control->extra_value);
163
}
164
 
165
/**
166
 * @brief Send a digicam_control message
167
 * @param chan MAVLink channel to send the message
168
 *
169
 * @param target_system System ID
170
 * @param target_component Component ID
171
 * @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
172
 * @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
173
 * @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
174
 * @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
175
 * @param shot 0: ignore, 1: shot or start filming
176
 * @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
177
 * @param extra_param Extra parameters enumeration (0 means ignore)
178
 * @param extra_value Correspondent value to given extra_param
179
 */
180
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
181
 
182
static inline void mavlink_msg_digicam_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value)
183
{
184
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
185
        char buf[13];
186
        _mav_put_float(buf, 0, extra_value);
187
        _mav_put_uint8_t(buf, 4, target_system);
188
        _mav_put_uint8_t(buf, 5, target_component);
189
        _mav_put_uint8_t(buf, 6, session);
190
        _mav_put_uint8_t(buf, 7, zoom_pos);
191
        _mav_put_int8_t(buf, 8, zoom_step);
192
        _mav_put_uint8_t(buf, 9, focus_lock);
193
        _mav_put_uint8_t(buf, 10, shot);
194
        _mav_put_uint8_t(buf, 11, command_id);
195
        _mav_put_uint8_t(buf, 12, extra_param);
196
 
197
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, buf, 13, 22);
198
#else
199
        mavlink_digicam_control_t packet;
200
        packet.extra_value = extra_value;
201
        packet.target_system = target_system;
202
        packet.target_component = target_component;
203
        packet.session = session;
204
        packet.zoom_pos = zoom_pos;
205
        packet.zoom_step = zoom_step;
206
        packet.focus_lock = focus_lock;
207
        packet.shot = shot;
208
        packet.command_id = command_id;
209
        packet.extra_param = extra_param;
210
 
211
        _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, (const char *)&packet, 13, 22);
212
#endif
213
}
214
 
215
#endif
216
 
217
// MESSAGE DIGICAM_CONTROL UNPACKING
218
 
219
 
220
/**
221
 * @brief Get field target_system from digicam_control message
222
 *
223
 * @return System ID
224
 */
225
static inline uint8_t mavlink_msg_digicam_control_get_target_system(const mavlink_message_t* msg)
226
{
227
        return _MAV_RETURN_uint8_t(msg,  4);
228
}
229
 
230
/**
231
 * @brief Get field target_component from digicam_control message
232
 *
233
 * @return Component ID
234
 */
235
static inline uint8_t mavlink_msg_digicam_control_get_target_component(const mavlink_message_t* msg)
236
{
237
        return _MAV_RETURN_uint8_t(msg,  5);
238
}
239
 
240
/**
241
 * @brief Get field session from digicam_control message
242
 *
243
 * @return 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
244
 */
245
static inline uint8_t mavlink_msg_digicam_control_get_session(const mavlink_message_t* msg)
246
{
247
        return _MAV_RETURN_uint8_t(msg,  6);
248
}
249
 
250
/**
251
 * @brief Get field zoom_pos from digicam_control message
252
 *
253
 * @return 1 to N //Zoom's absolute position (0 means ignore)
254
 */
255
static inline uint8_t mavlink_msg_digicam_control_get_zoom_pos(const mavlink_message_t* msg)
256
{
257
        return _MAV_RETURN_uint8_t(msg,  7);
258
}
259
 
260
/**
261
 * @brief Get field zoom_step from digicam_control message
262
 *
263
 * @return -100 to 100 //Zooming step value to offset zoom from the current position
264
 */
265
static inline int8_t mavlink_msg_digicam_control_get_zoom_step(const mavlink_message_t* msg)
266
{
267
        return _MAV_RETURN_int8_t(msg,  8);
268
}
269
 
270
/**
271
 * @brief Get field focus_lock from digicam_control message
272
 *
273
 * @return 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
274
 */
275
static inline uint8_t mavlink_msg_digicam_control_get_focus_lock(const mavlink_message_t* msg)
276
{
277
        return _MAV_RETURN_uint8_t(msg,  9);
278
}
279
 
280
/**
281
 * @brief Get field shot from digicam_control message
282
 *
283
 * @return 0: ignore, 1: shot or start filming
284
 */
285
static inline uint8_t mavlink_msg_digicam_control_get_shot(const mavlink_message_t* msg)
286
{
287
        return _MAV_RETURN_uint8_t(msg,  10);
288
}
289
 
290
/**
291
 * @brief Get field command_id from digicam_control message
292
 *
293
 * @return Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
294
 */
295
static inline uint8_t mavlink_msg_digicam_control_get_command_id(const mavlink_message_t* msg)
296
{
297
        return _MAV_RETURN_uint8_t(msg,  11);
298
}
299
 
300
/**
301
 * @brief Get field extra_param from digicam_control message
302
 *
303
 * @return Extra parameters enumeration (0 means ignore)
304
 */
305
static inline uint8_t mavlink_msg_digicam_control_get_extra_param(const mavlink_message_t* msg)
306
{
307
        return _MAV_RETURN_uint8_t(msg,  12);
308
}
309
 
310
/**
311
 * @brief Get field extra_value from digicam_control message
312
 *
313
 * @return Correspondent value to given extra_param
314
 */
315
static inline float mavlink_msg_digicam_control_get_extra_value(const mavlink_message_t* msg)
316
{
317
        return _MAV_RETURN_float(msg,  0);
318
}
319
 
320
/**
321
 * @brief Decode a digicam_control message into a struct
322
 *
323
 * @param msg The message to decode
324
 * @param digicam_control C-struct to decode the message contents into
325
 */
326
static inline void mavlink_msg_digicam_control_decode(const mavlink_message_t* msg, mavlink_digicam_control_t* digicam_control)
327
{
328
#if MAVLINK_NEED_BYTE_SWAP
329
        digicam_control->extra_value = mavlink_msg_digicam_control_get_extra_value(msg);
330
        digicam_control->target_system = mavlink_msg_digicam_control_get_target_system(msg);
331
        digicam_control->target_component = mavlink_msg_digicam_control_get_target_component(msg);
332
        digicam_control->session = mavlink_msg_digicam_control_get_session(msg);
333
        digicam_control->zoom_pos = mavlink_msg_digicam_control_get_zoom_pos(msg);
334
        digicam_control->zoom_step = mavlink_msg_digicam_control_get_zoom_step(msg);
335
        digicam_control->focus_lock = mavlink_msg_digicam_control_get_focus_lock(msg);
336
        digicam_control->shot = mavlink_msg_digicam_control_get_shot(msg);
337
        digicam_control->command_id = mavlink_msg_digicam_control_get_command_id(msg);
338
        digicam_control->extra_param = mavlink_msg_digicam_control_get_extra_param(msg);
339
#else
340
        memcpy(digicam_control, _MAV_PAYLOAD(msg), 13);
341
#endif
342
}