Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
/** @file
2
 *      @brief MAVLink comm protocol testsuite generated from common.xml
3
 *      @see http://qgroundcontrol.org/mavlink/
4
 */
5
#ifndef COMMON_TESTSUITE_H
6
#define COMMON_TESTSUITE_H
7
 
8
#ifdef __cplusplus
9
extern "C" {
10
#endif
11
 
12
#ifndef MAVLINK_TEST_ALL
13
#define MAVLINK_TEST_ALL
14
 
15
static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
16
 
17
static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
18
{
19
 
20
        mavlink_test_common(system_id, component_id, last_msg);
21
}
22
#endif
23
 
24
 
25
 
26
 
27
static void mavlink_test_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
28
{
29
        mavlink_message_t msg;
30
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
31
        uint16_t i;
32
        mavlink_heartbeat_t packet_in = {
33
                963497464,
34
        17,
35
        84,
36
        151,
37
        218,
38
        3,
39
        };
40
        mavlink_heartbeat_t packet1, packet2;
41
        memset(&packet1, 0, sizeof(packet1));
42
                packet1.custom_mode = packet_in.custom_mode;
43
                packet1.type = packet_in.type;
44
                packet1.autopilot = packet_in.autopilot;
45
                packet1.base_mode = packet_in.base_mode;
46
                packet1.system_status = packet_in.system_status;
47
                packet1.mavlink_version = packet_in.mavlink_version;
48
 
49
 
50
 
51
        memset(&packet2, 0, sizeof(packet2));
52
        mavlink_msg_heartbeat_encode(system_id, component_id, &msg, &packet1);
53
        mavlink_msg_heartbeat_decode(&msg, &packet2);
54
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
55
 
56
        memset(&packet2, 0, sizeof(packet2));
57
        mavlink_msg_heartbeat_pack(system_id, component_id, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
58
        mavlink_msg_heartbeat_decode(&msg, &packet2);
59
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
60
 
61
        memset(&packet2, 0, sizeof(packet2));
62
        mavlink_msg_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
63
        mavlink_msg_heartbeat_decode(&msg, &packet2);
64
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
65
 
66
        memset(&packet2, 0, sizeof(packet2));
67
        mavlink_msg_to_send_buffer(buffer, &msg);
68
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
69
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
70
        }
71
        mavlink_msg_heartbeat_decode(last_msg, &packet2);
72
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
73
 
74
        memset(&packet2, 0, sizeof(packet2));
75
        mavlink_msg_heartbeat_send(MAVLINK_COMM_1 , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status );
76
        mavlink_msg_heartbeat_decode(last_msg, &packet2);
77
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
78
}
79
 
80
static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
81
{
82
        mavlink_message_t msg;
83
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
84
        uint16_t i;
85
        mavlink_sys_status_t packet_in = {
86
                963497464,
87
        963497672,
88
        963497880,
89
        17859,
90
        17963,
91
        18067,
92
        18171,
93
        18275,
94
        18379,
95
        18483,
96
        18587,
97
        18691,
98
        223,
99
        };
100
        mavlink_sys_status_t packet1, packet2;
101
        memset(&packet1, 0, sizeof(packet1));
102
                packet1.onboard_control_sensors_present = packet_in.onboard_control_sensors_present;
103
                packet1.onboard_control_sensors_enabled = packet_in.onboard_control_sensors_enabled;
104
                packet1.onboard_control_sensors_health = packet_in.onboard_control_sensors_health;
105
                packet1.load = packet_in.load;
106
                packet1.voltage_battery = packet_in.voltage_battery;
107
                packet1.current_battery = packet_in.current_battery;
108
                packet1.drop_rate_comm = packet_in.drop_rate_comm;
109
                packet1.errors_comm = packet_in.errors_comm;
110
                packet1.errors_count1 = packet_in.errors_count1;
111
                packet1.errors_count2 = packet_in.errors_count2;
112
                packet1.errors_count3 = packet_in.errors_count3;
113
                packet1.errors_count4 = packet_in.errors_count4;
114
                packet1.battery_remaining = packet_in.battery_remaining;
115
 
116
 
117
 
118
        memset(&packet2, 0, sizeof(packet2));
119
        mavlink_msg_sys_status_encode(system_id, component_id, &msg, &packet1);
120
        mavlink_msg_sys_status_decode(&msg, &packet2);
121
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
122
 
123
        memset(&packet2, 0, sizeof(packet2));
124
        mavlink_msg_sys_status_pack(system_id, component_id, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
125
        mavlink_msg_sys_status_decode(&msg, &packet2);
126
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
127
 
128
        memset(&packet2, 0, sizeof(packet2));
129
        mavlink_msg_sys_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
130
        mavlink_msg_sys_status_decode(&msg, &packet2);
131
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
132
 
133
        memset(&packet2, 0, sizeof(packet2));
134
        mavlink_msg_to_send_buffer(buffer, &msg);
135
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
136
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
137
        }
138
        mavlink_msg_sys_status_decode(last_msg, &packet2);
139
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
140
 
141
        memset(&packet2, 0, sizeof(packet2));
142
        mavlink_msg_sys_status_send(MAVLINK_COMM_1 , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 );
143
        mavlink_msg_sys_status_decode(last_msg, &packet2);
144
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
145
}
146
 
147
static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
148
{
149
        mavlink_message_t msg;
150
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
151
        uint16_t i;
152
        mavlink_system_time_t packet_in = {
153
                93372036854775807ULL,
154
        963497880,
155
        };
156
        mavlink_system_time_t packet1, packet2;
157
        memset(&packet1, 0, sizeof(packet1));
158
                packet1.time_unix_usec = packet_in.time_unix_usec;
159
                packet1.time_boot_ms = packet_in.time_boot_ms;
160
 
161
 
162
 
163
        memset(&packet2, 0, sizeof(packet2));
164
        mavlink_msg_system_time_encode(system_id, component_id, &msg, &packet1);
165
        mavlink_msg_system_time_decode(&msg, &packet2);
166
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
167
 
168
        memset(&packet2, 0, sizeof(packet2));
169
        mavlink_msg_system_time_pack(system_id, component_id, &msg , packet1.time_unix_usec , packet1.time_boot_ms );
170
        mavlink_msg_system_time_decode(&msg, &packet2);
171
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
172
 
173
        memset(&packet2, 0, sizeof(packet2));
174
        mavlink_msg_system_time_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_unix_usec , packet1.time_boot_ms );
175
        mavlink_msg_system_time_decode(&msg, &packet2);
176
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
177
 
178
        memset(&packet2, 0, sizeof(packet2));
179
        mavlink_msg_to_send_buffer(buffer, &msg);
180
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
181
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
182
        }
183
        mavlink_msg_system_time_decode(last_msg, &packet2);
184
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
185
 
186
        memset(&packet2, 0, sizeof(packet2));
187
        mavlink_msg_system_time_send(MAVLINK_COMM_1 , packet1.time_unix_usec , packet1.time_boot_ms );
188
        mavlink_msg_system_time_decode(last_msg, &packet2);
189
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
190
}
191
 
192
static void mavlink_test_ping(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
193
{
194
        mavlink_message_t msg;
195
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
196
        uint16_t i;
197
        mavlink_ping_t packet_in = {
198
                93372036854775807ULL,
199
        963497880,
200
        41,
201
        108,
202
        };
203
        mavlink_ping_t packet1, packet2;
204
        memset(&packet1, 0, sizeof(packet1));
205
                packet1.time_usec = packet_in.time_usec;
206
                packet1.seq = packet_in.seq;
207
                packet1.target_system = packet_in.target_system;
208
                packet1.target_component = packet_in.target_component;
209
 
210
 
211
 
212
        memset(&packet2, 0, sizeof(packet2));
213
        mavlink_msg_ping_encode(system_id, component_id, &msg, &packet1);
214
        mavlink_msg_ping_decode(&msg, &packet2);
215
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
216
 
217
        memset(&packet2, 0, sizeof(packet2));
218
        mavlink_msg_ping_pack(system_id, component_id, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
219
        mavlink_msg_ping_decode(&msg, &packet2);
220
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
221
 
222
        memset(&packet2, 0, sizeof(packet2));
223
        mavlink_msg_ping_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
224
        mavlink_msg_ping_decode(&msg, &packet2);
225
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
226
 
227
        memset(&packet2, 0, sizeof(packet2));
228
        mavlink_msg_to_send_buffer(buffer, &msg);
229
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
230
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
231
        }
232
        mavlink_msg_ping_decode(last_msg, &packet2);
233
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
234
 
235
        memset(&packet2, 0, sizeof(packet2));
236
        mavlink_msg_ping_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component );
237
        mavlink_msg_ping_decode(last_msg, &packet2);
238
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
239
}
240
 
241
static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
242
{
243
        mavlink_message_t msg;
244
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
245
        uint16_t i;
246
        mavlink_change_operator_control_t packet_in = {
247
                5,
248
        72,
249
        139,
250
        "DEFGHIJKLMNOPQRSTUVWXYZA",
251
        };
252
        mavlink_change_operator_control_t packet1, packet2;
253
        memset(&packet1, 0, sizeof(packet1));
254
                packet1.target_system = packet_in.target_system;
255
                packet1.control_request = packet_in.control_request;
256
                packet1.version = packet_in.version;
257
 
258
                mav_array_memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25);
259
 
260
 
261
        memset(&packet2, 0, sizeof(packet2));
262
        mavlink_msg_change_operator_control_encode(system_id, component_id, &msg, &packet1);
263
        mavlink_msg_change_operator_control_decode(&msg, &packet2);
264
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
265
 
266
        memset(&packet2, 0, sizeof(packet2));
267
        mavlink_msg_change_operator_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
268
        mavlink_msg_change_operator_control_decode(&msg, &packet2);
269
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
270
 
271
        memset(&packet2, 0, sizeof(packet2));
272
        mavlink_msg_change_operator_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
273
        mavlink_msg_change_operator_control_decode(&msg, &packet2);
274
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
275
 
276
        memset(&packet2, 0, sizeof(packet2));
277
        mavlink_msg_to_send_buffer(buffer, &msg);
278
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
279
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
280
        }
281
        mavlink_msg_change_operator_control_decode(last_msg, &packet2);
282
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
283
 
284
        memset(&packet2, 0, sizeof(packet2));
285
        mavlink_msg_change_operator_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey );
286
        mavlink_msg_change_operator_control_decode(last_msg, &packet2);
287
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
288
}
289
 
290
static void mavlink_test_change_operator_control_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
291
{
292
        mavlink_message_t msg;
293
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
294
        uint16_t i;
295
        mavlink_change_operator_control_ack_t packet_in = {
296
                5,
297
        72,
298
        139,
299
        };
300
        mavlink_change_operator_control_ack_t packet1, packet2;
301
        memset(&packet1, 0, sizeof(packet1));
302
                packet1.gcs_system_id = packet_in.gcs_system_id;
303
                packet1.control_request = packet_in.control_request;
304
                packet1.ack = packet_in.ack;
305
 
306
 
307
 
308
        memset(&packet2, 0, sizeof(packet2));
309
        mavlink_msg_change_operator_control_ack_encode(system_id, component_id, &msg, &packet1);
310
        mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
311
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
312
 
313
        memset(&packet2, 0, sizeof(packet2));
314
        mavlink_msg_change_operator_control_ack_pack(system_id, component_id, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack );
315
        mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
316
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
317
 
318
        memset(&packet2, 0, sizeof(packet2));
319
        mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack );
320
        mavlink_msg_change_operator_control_ack_decode(&msg, &packet2);
321
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
322
 
323
        memset(&packet2, 0, sizeof(packet2));
324
        mavlink_msg_to_send_buffer(buffer, &msg);
325
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
326
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
327
        }
328
        mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2);
329
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
330
 
331
        memset(&packet2, 0, sizeof(packet2));
332
        mavlink_msg_change_operator_control_ack_send(MAVLINK_COMM_1 , packet1.gcs_system_id , packet1.control_request , packet1.ack );
333
        mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2);
334
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
335
}
336
 
337
static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
338
{
339
        mavlink_message_t msg;
340
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
341
        uint16_t i;
342
        mavlink_auth_key_t packet_in = {
343
                "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE",
344
        };
345
        mavlink_auth_key_t packet1, packet2;
346
        memset(&packet1, 0, sizeof(packet1));
347
 
348
                mav_array_memcpy(packet1.key, packet_in.key, sizeof(char)*32);
349
 
350
 
351
        memset(&packet2, 0, sizeof(packet2));
352
        mavlink_msg_auth_key_encode(system_id, component_id, &msg, &packet1);
353
        mavlink_msg_auth_key_decode(&msg, &packet2);
354
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
355
 
356
        memset(&packet2, 0, sizeof(packet2));
357
        mavlink_msg_auth_key_pack(system_id, component_id, &msg , packet1.key );
358
        mavlink_msg_auth_key_decode(&msg, &packet2);
359
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
360
 
361
        memset(&packet2, 0, sizeof(packet2));
362
        mavlink_msg_auth_key_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.key );
363
        mavlink_msg_auth_key_decode(&msg, &packet2);
364
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
365
 
366
        memset(&packet2, 0, sizeof(packet2));
367
        mavlink_msg_to_send_buffer(buffer, &msg);
368
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
369
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
370
        }
371
        mavlink_msg_auth_key_decode(last_msg, &packet2);
372
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
373
 
374
        memset(&packet2, 0, sizeof(packet2));
375
        mavlink_msg_auth_key_send(MAVLINK_COMM_1 , packet1.key );
376
        mavlink_msg_auth_key_decode(last_msg, &packet2);
377
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
378
}
379
 
380
static void mavlink_test_set_mode(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
381
{
382
        mavlink_message_t msg;
383
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
384
        uint16_t i;
385
        mavlink_set_mode_t packet_in = {
386
                963497464,
387
        17,
388
        84,
389
        };
390
        mavlink_set_mode_t packet1, packet2;
391
        memset(&packet1, 0, sizeof(packet1));
392
                packet1.custom_mode = packet_in.custom_mode;
393
                packet1.target_system = packet_in.target_system;
394
                packet1.base_mode = packet_in.base_mode;
395
 
396
 
397
 
398
        memset(&packet2, 0, sizeof(packet2));
399
        mavlink_msg_set_mode_encode(system_id, component_id, &msg, &packet1);
400
        mavlink_msg_set_mode_decode(&msg, &packet2);
401
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
402
 
403
        memset(&packet2, 0, sizeof(packet2));
404
        mavlink_msg_set_mode_pack(system_id, component_id, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode );
405
        mavlink_msg_set_mode_decode(&msg, &packet2);
406
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
407
 
408
        memset(&packet2, 0, sizeof(packet2));
409
        mavlink_msg_set_mode_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode );
410
        mavlink_msg_set_mode_decode(&msg, &packet2);
411
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
412
 
413
        memset(&packet2, 0, sizeof(packet2));
414
        mavlink_msg_to_send_buffer(buffer, &msg);
415
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
416
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
417
        }
418
        mavlink_msg_set_mode_decode(last_msg, &packet2);
419
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
420
 
421
        memset(&packet2, 0, sizeof(packet2));
422
        mavlink_msg_set_mode_send(MAVLINK_COMM_1 , packet1.target_system , packet1.base_mode , packet1.custom_mode );
423
        mavlink_msg_set_mode_decode(last_msg, &packet2);
424
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
425
}
426
 
427
static void mavlink_test_param_request_read(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
428
{
429
        mavlink_message_t msg;
430
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
431
        uint16_t i;
432
        mavlink_param_request_read_t packet_in = {
433
                17235,
434
        139,
435
        206,
436
        "EFGHIJKLMNOPQRS",
437
        };
438
        mavlink_param_request_read_t packet1, packet2;
439
        memset(&packet1, 0, sizeof(packet1));
440
                packet1.param_index = packet_in.param_index;
441
                packet1.target_system = packet_in.target_system;
442
                packet1.target_component = packet_in.target_component;
443
 
444
                mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
445
 
446
 
447
        memset(&packet2, 0, sizeof(packet2));
448
        mavlink_msg_param_request_read_encode(system_id, component_id, &msg, &packet1);
449
        mavlink_msg_param_request_read_decode(&msg, &packet2);
450
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
451
 
452
        memset(&packet2, 0, sizeof(packet2));
453
        mavlink_msg_param_request_read_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
454
        mavlink_msg_param_request_read_decode(&msg, &packet2);
455
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
456
 
457
        memset(&packet2, 0, sizeof(packet2));
458
        mavlink_msg_param_request_read_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
459
        mavlink_msg_param_request_read_decode(&msg, &packet2);
460
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
461
 
462
        memset(&packet2, 0, sizeof(packet2));
463
        mavlink_msg_to_send_buffer(buffer, &msg);
464
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
465
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
466
        }
467
        mavlink_msg_param_request_read_decode(last_msg, &packet2);
468
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
469
 
470
        memset(&packet2, 0, sizeof(packet2));
471
        mavlink_msg_param_request_read_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index );
472
        mavlink_msg_param_request_read_decode(last_msg, &packet2);
473
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
474
}
475
 
476
static void mavlink_test_param_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
477
{
478
        mavlink_message_t msg;
479
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
480
        uint16_t i;
481
        mavlink_param_request_list_t packet_in = {
482
                5,
483
        72,
484
        };
485
        mavlink_param_request_list_t packet1, packet2;
486
        memset(&packet1, 0, sizeof(packet1));
487
                packet1.target_system = packet_in.target_system;
488
                packet1.target_component = packet_in.target_component;
489
 
490
 
491
 
492
        memset(&packet2, 0, sizeof(packet2));
493
        mavlink_msg_param_request_list_encode(system_id, component_id, &msg, &packet1);
494
        mavlink_msg_param_request_list_decode(&msg, &packet2);
495
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
496
 
497
        memset(&packet2, 0, sizeof(packet2));
498
        mavlink_msg_param_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
499
        mavlink_msg_param_request_list_decode(&msg, &packet2);
500
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
501
 
502
        memset(&packet2, 0, sizeof(packet2));
503
        mavlink_msg_param_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
504
        mavlink_msg_param_request_list_decode(&msg, &packet2);
505
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
506
 
507
        memset(&packet2, 0, sizeof(packet2));
508
        mavlink_msg_to_send_buffer(buffer, &msg);
509
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
510
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
511
        }
512
        mavlink_msg_param_request_list_decode(last_msg, &packet2);
513
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
514
 
515
        memset(&packet2, 0, sizeof(packet2));
516
        mavlink_msg_param_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
517
        mavlink_msg_param_request_list_decode(last_msg, &packet2);
518
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
519
}
520
 
521
static void mavlink_test_param_value(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
522
{
523
        mavlink_message_t msg;
524
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
525
        uint16_t i;
526
        mavlink_param_value_t packet_in = {
527
                17.0,
528
        17443,
529
        17547,
530
        "IJKLMNOPQRSTUVW",
531
        77,
532
        };
533
        mavlink_param_value_t packet1, packet2;
534
        memset(&packet1, 0, sizeof(packet1));
535
                packet1.param_value = packet_in.param_value;
536
                packet1.param_count = packet_in.param_count;
537
                packet1.param_index = packet_in.param_index;
538
                packet1.param_type = packet_in.param_type;
539
 
540
                mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
541
 
542
 
543
        memset(&packet2, 0, sizeof(packet2));
544
        mavlink_msg_param_value_encode(system_id, component_id, &msg, &packet1);
545
        mavlink_msg_param_value_decode(&msg, &packet2);
546
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
547
 
548
        memset(&packet2, 0, sizeof(packet2));
549
        mavlink_msg_param_value_pack(system_id, component_id, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
550
        mavlink_msg_param_value_decode(&msg, &packet2);
551
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
552
 
553
        memset(&packet2, 0, sizeof(packet2));
554
        mavlink_msg_param_value_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
555
        mavlink_msg_param_value_decode(&msg, &packet2);
556
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
557
 
558
        memset(&packet2, 0, sizeof(packet2));
559
        mavlink_msg_to_send_buffer(buffer, &msg);
560
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
561
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
562
        }
563
        mavlink_msg_param_value_decode(last_msg, &packet2);
564
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
565
 
566
        memset(&packet2, 0, sizeof(packet2));
567
        mavlink_msg_param_value_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index );
568
        mavlink_msg_param_value_decode(last_msg, &packet2);
569
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
570
}
571
 
572
static void mavlink_test_param_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
573
{
574
        mavlink_message_t msg;
575
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
576
        uint16_t i;
577
        mavlink_param_set_t packet_in = {
578
                17.0,
579
        17,
580
        84,
581
        "GHIJKLMNOPQRSTU",
582
        199,
583
        };
584
        mavlink_param_set_t packet1, packet2;
585
        memset(&packet1, 0, sizeof(packet1));
586
                packet1.param_value = packet_in.param_value;
587
                packet1.target_system = packet_in.target_system;
588
                packet1.target_component = packet_in.target_component;
589
                packet1.param_type = packet_in.param_type;
590
 
591
                mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16);
592
 
593
 
594
        memset(&packet2, 0, sizeof(packet2));
595
        mavlink_msg_param_set_encode(system_id, component_id, &msg, &packet1);
596
        mavlink_msg_param_set_decode(&msg, &packet2);
597
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
598
 
599
        memset(&packet2, 0, sizeof(packet2));
600
        mavlink_msg_param_set_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
601
        mavlink_msg_param_set_decode(&msg, &packet2);
602
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
603
 
604
        memset(&packet2, 0, sizeof(packet2));
605
        mavlink_msg_param_set_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
606
        mavlink_msg_param_set_decode(&msg, &packet2);
607
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
608
 
609
        memset(&packet2, 0, sizeof(packet2));
610
        mavlink_msg_to_send_buffer(buffer, &msg);
611
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
612
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
613
        }
614
        mavlink_msg_param_set_decode(last_msg, &packet2);
615
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
616
 
617
        memset(&packet2, 0, sizeof(packet2));
618
        mavlink_msg_param_set_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type );
619
        mavlink_msg_param_set_decode(last_msg, &packet2);
620
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
621
}
622
 
623
static void mavlink_test_gps_raw_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
624
{
625
        mavlink_message_t msg;
626
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
627
        uint16_t i;
628
        mavlink_gps_raw_int_t packet_in = {
629
                93372036854775807ULL,
630
        963497880,
631
        963498088,
632
        963498296,
633
        18275,
634
        18379,
635
        18483,
636
        18587,
637
        89,
638
        156,
639
        };
640
        mavlink_gps_raw_int_t packet1, packet2;
641
        memset(&packet1, 0, sizeof(packet1));
642
                packet1.time_usec = packet_in.time_usec;
643
                packet1.lat = packet_in.lat;
644
                packet1.lon = packet_in.lon;
645
                packet1.alt = packet_in.alt;
646
                packet1.eph = packet_in.eph;
647
                packet1.epv = packet_in.epv;
648
                packet1.vel = packet_in.vel;
649
                packet1.cog = packet_in.cog;
650
                packet1.fix_type = packet_in.fix_type;
651
                packet1.satellites_visible = packet_in.satellites_visible;
652
 
653
 
654
 
655
        memset(&packet2, 0, sizeof(packet2));
656
        mavlink_msg_gps_raw_int_encode(system_id, component_id, &msg, &packet1);
657
        mavlink_msg_gps_raw_int_decode(&msg, &packet2);
658
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
659
 
660
        memset(&packet2, 0, sizeof(packet2));
661
        mavlink_msg_gps_raw_int_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible );
662
        mavlink_msg_gps_raw_int_decode(&msg, &packet2);
663
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
664
 
665
        memset(&packet2, 0, sizeof(packet2));
666
        mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible );
667
        mavlink_msg_gps_raw_int_decode(&msg, &packet2);
668
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
669
 
670
        memset(&packet2, 0, sizeof(packet2));
671
        mavlink_msg_to_send_buffer(buffer, &msg);
672
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
673
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
674
        }
675
        mavlink_msg_gps_raw_int_decode(last_msg, &packet2);
676
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
677
 
678
        memset(&packet2, 0, sizeof(packet2));
679
        mavlink_msg_gps_raw_int_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible );
680
        mavlink_msg_gps_raw_int_decode(last_msg, &packet2);
681
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
682
}
683
 
684
static void mavlink_test_gps_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
685
{
686
        mavlink_message_t msg;
687
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
688
        uint16_t i;
689
        mavlink_gps_status_t packet_in = {
690
                5,
691
        { 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 },
692
        { 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151 },
693
        { 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 },
694
        { 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
695
        { 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 },
696
        };
697
        mavlink_gps_status_t packet1, packet2;
698
        memset(&packet1, 0, sizeof(packet1));
699
                packet1.satellites_visible = packet_in.satellites_visible;
700
 
701
                mav_array_memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(uint8_t)*20);
702
                mav_array_memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(uint8_t)*20);
703
                mav_array_memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(uint8_t)*20);
704
                mav_array_memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(uint8_t)*20);
705
                mav_array_memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(uint8_t)*20);
706
 
707
 
708
        memset(&packet2, 0, sizeof(packet2));
709
        mavlink_msg_gps_status_encode(system_id, component_id, &msg, &packet1);
710
        mavlink_msg_gps_status_decode(&msg, &packet2);
711
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
712
 
713
        memset(&packet2, 0, sizeof(packet2));
714
        mavlink_msg_gps_status_pack(system_id, component_id, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
715
        mavlink_msg_gps_status_decode(&msg, &packet2);
716
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
717
 
718
        memset(&packet2, 0, sizeof(packet2));
719
        mavlink_msg_gps_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
720
        mavlink_msg_gps_status_decode(&msg, &packet2);
721
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
722
 
723
        memset(&packet2, 0, sizeof(packet2));
724
        mavlink_msg_to_send_buffer(buffer, &msg);
725
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
726
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
727
        }
728
        mavlink_msg_gps_status_decode(last_msg, &packet2);
729
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
730
 
731
        memset(&packet2, 0, sizeof(packet2));
732
        mavlink_msg_gps_status_send(MAVLINK_COMM_1 , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr );
733
        mavlink_msg_gps_status_decode(last_msg, &packet2);
734
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
735
}
736
 
737
static void mavlink_test_scaled_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
738
{
739
        mavlink_message_t msg;
740
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
741
        uint16_t i;
742
        mavlink_scaled_imu_t packet_in = {
743
                963497464,
744
        17443,
745
        17547,
746
        17651,
747
        17755,
748
        17859,
749
        17963,
750
        18067,
751
        18171,
752
        18275,
753
        };
754
        mavlink_scaled_imu_t packet1, packet2;
755
        memset(&packet1, 0, sizeof(packet1));
756
                packet1.time_boot_ms = packet_in.time_boot_ms;
757
                packet1.xacc = packet_in.xacc;
758
                packet1.yacc = packet_in.yacc;
759
                packet1.zacc = packet_in.zacc;
760
                packet1.xgyro = packet_in.xgyro;
761
                packet1.ygyro = packet_in.ygyro;
762
                packet1.zgyro = packet_in.zgyro;
763
                packet1.xmag = packet_in.xmag;
764
                packet1.ymag = packet_in.ymag;
765
                packet1.zmag = packet_in.zmag;
766
 
767
 
768
 
769
        memset(&packet2, 0, sizeof(packet2));
770
        mavlink_msg_scaled_imu_encode(system_id, component_id, &msg, &packet1);
771
        mavlink_msg_scaled_imu_decode(&msg, &packet2);
772
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
773
 
774
        memset(&packet2, 0, sizeof(packet2));
775
        mavlink_msg_scaled_imu_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
776
        mavlink_msg_scaled_imu_decode(&msg, &packet2);
777
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
778
 
779
        memset(&packet2, 0, sizeof(packet2));
780
        mavlink_msg_scaled_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
781
        mavlink_msg_scaled_imu_decode(&msg, &packet2);
782
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
783
 
784
        memset(&packet2, 0, sizeof(packet2));
785
        mavlink_msg_to_send_buffer(buffer, &msg);
786
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
787
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
788
        }
789
        mavlink_msg_scaled_imu_decode(last_msg, &packet2);
790
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
791
 
792
        memset(&packet2, 0, sizeof(packet2));
793
        mavlink_msg_scaled_imu_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
794
        mavlink_msg_scaled_imu_decode(last_msg, &packet2);
795
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
796
}
797
 
798
static void mavlink_test_raw_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
799
{
800
        mavlink_message_t msg;
801
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
802
        uint16_t i;
803
        mavlink_raw_imu_t packet_in = {
804
                93372036854775807ULL,
805
        17651,
806
        17755,
807
        17859,
808
        17963,
809
        18067,
810
        18171,
811
        18275,
812
        18379,
813
        18483,
814
        };
815
        mavlink_raw_imu_t packet1, packet2;
816
        memset(&packet1, 0, sizeof(packet1));
817
                packet1.time_usec = packet_in.time_usec;
818
                packet1.xacc = packet_in.xacc;
819
                packet1.yacc = packet_in.yacc;
820
                packet1.zacc = packet_in.zacc;
821
                packet1.xgyro = packet_in.xgyro;
822
                packet1.ygyro = packet_in.ygyro;
823
                packet1.zgyro = packet_in.zgyro;
824
                packet1.xmag = packet_in.xmag;
825
                packet1.ymag = packet_in.ymag;
826
                packet1.zmag = packet_in.zmag;
827
 
828
 
829
 
830
        memset(&packet2, 0, sizeof(packet2));
831
        mavlink_msg_raw_imu_encode(system_id, component_id, &msg, &packet1);
832
        mavlink_msg_raw_imu_decode(&msg, &packet2);
833
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
834
 
835
        memset(&packet2, 0, sizeof(packet2));
836
        mavlink_msg_raw_imu_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
837
        mavlink_msg_raw_imu_decode(&msg, &packet2);
838
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
839
 
840
        memset(&packet2, 0, sizeof(packet2));
841
        mavlink_msg_raw_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
842
        mavlink_msg_raw_imu_decode(&msg, &packet2);
843
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
844
 
845
        memset(&packet2, 0, sizeof(packet2));
846
        mavlink_msg_to_send_buffer(buffer, &msg);
847
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
848
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
849
        }
850
        mavlink_msg_raw_imu_decode(last_msg, &packet2);
851
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
852
 
853
        memset(&packet2, 0, sizeof(packet2));
854
        mavlink_msg_raw_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag );
855
        mavlink_msg_raw_imu_decode(last_msg, &packet2);
856
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
857
}
858
 
859
static void mavlink_test_raw_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
860
{
861
        mavlink_message_t msg;
862
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
863
        uint16_t i;
864
        mavlink_raw_pressure_t packet_in = {
865
                93372036854775807ULL,
866
        17651,
867
        17755,
868
        17859,
869
        17963,
870
        };
871
        mavlink_raw_pressure_t packet1, packet2;
872
        memset(&packet1, 0, sizeof(packet1));
873
                packet1.time_usec = packet_in.time_usec;
874
                packet1.press_abs = packet_in.press_abs;
875
                packet1.press_diff1 = packet_in.press_diff1;
876
                packet1.press_diff2 = packet_in.press_diff2;
877
                packet1.temperature = packet_in.temperature;
878
 
879
 
880
 
881
        memset(&packet2, 0, sizeof(packet2));
882
        mavlink_msg_raw_pressure_encode(system_id, component_id, &msg, &packet1);
883
        mavlink_msg_raw_pressure_decode(&msg, &packet2);
884
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
885
 
886
        memset(&packet2, 0, sizeof(packet2));
887
        mavlink_msg_raw_pressure_pack(system_id, component_id, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
888
        mavlink_msg_raw_pressure_decode(&msg, &packet2);
889
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
890
 
891
        memset(&packet2, 0, sizeof(packet2));
892
        mavlink_msg_raw_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
893
        mavlink_msg_raw_pressure_decode(&msg, &packet2);
894
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
895
 
896
        memset(&packet2, 0, sizeof(packet2));
897
        mavlink_msg_to_send_buffer(buffer, &msg);
898
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
899
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
900
        }
901
        mavlink_msg_raw_pressure_decode(last_msg, &packet2);
902
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
903
 
904
        memset(&packet2, 0, sizeof(packet2));
905
        mavlink_msg_raw_pressure_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature );
906
        mavlink_msg_raw_pressure_decode(last_msg, &packet2);
907
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
908
}
909
 
910
static void mavlink_test_scaled_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
911
{
912
        mavlink_message_t msg;
913
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
914
        uint16_t i;
915
        mavlink_scaled_pressure_t packet_in = {
916
                963497464,
917
        45.0,
918
        73.0,
919
        17859,
920
        };
921
        mavlink_scaled_pressure_t packet1, packet2;
922
        memset(&packet1, 0, sizeof(packet1));
923
                packet1.time_boot_ms = packet_in.time_boot_ms;
924
                packet1.press_abs = packet_in.press_abs;
925
                packet1.press_diff = packet_in.press_diff;
926
                packet1.temperature = packet_in.temperature;
927
 
928
 
929
 
930
        memset(&packet2, 0, sizeof(packet2));
931
        mavlink_msg_scaled_pressure_encode(system_id, component_id, &msg, &packet1);
932
        mavlink_msg_scaled_pressure_decode(&msg, &packet2);
933
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
934
 
935
        memset(&packet2, 0, sizeof(packet2));
936
        mavlink_msg_scaled_pressure_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
937
        mavlink_msg_scaled_pressure_decode(&msg, &packet2);
938
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
939
 
940
        memset(&packet2, 0, sizeof(packet2));
941
        mavlink_msg_scaled_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
942
        mavlink_msg_scaled_pressure_decode(&msg, &packet2);
943
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
944
 
945
        memset(&packet2, 0, sizeof(packet2));
946
        mavlink_msg_to_send_buffer(buffer, &msg);
947
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
948
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
949
        }
950
        mavlink_msg_scaled_pressure_decode(last_msg, &packet2);
951
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
952
 
953
        memset(&packet2, 0, sizeof(packet2));
954
        mavlink_msg_scaled_pressure_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature );
955
        mavlink_msg_scaled_pressure_decode(last_msg, &packet2);
956
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
957
}
958
 
959
static void mavlink_test_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
960
{
961
        mavlink_message_t msg;
962
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
963
        uint16_t i;
964
        mavlink_attitude_t packet_in = {
965
                963497464,
966
        45.0,
967
        73.0,
968
        101.0,
969
        129.0,
970
        157.0,
971
        185.0,
972
        };
973
        mavlink_attitude_t packet1, packet2;
974
        memset(&packet1, 0, sizeof(packet1));
975
                packet1.time_boot_ms = packet_in.time_boot_ms;
976
                packet1.roll = packet_in.roll;
977
                packet1.pitch = packet_in.pitch;
978
                packet1.yaw = packet_in.yaw;
979
                packet1.rollspeed = packet_in.rollspeed;
980
                packet1.pitchspeed = packet_in.pitchspeed;
981
                packet1.yawspeed = packet_in.yawspeed;
982
 
983
 
984
 
985
        memset(&packet2, 0, sizeof(packet2));
986
        mavlink_msg_attitude_encode(system_id, component_id, &msg, &packet1);
987
        mavlink_msg_attitude_decode(&msg, &packet2);
988
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
989
 
990
        memset(&packet2, 0, sizeof(packet2));
991
        mavlink_msg_attitude_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
992
        mavlink_msg_attitude_decode(&msg, &packet2);
993
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
994
 
995
        memset(&packet2, 0, sizeof(packet2));
996
        mavlink_msg_attitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
997
        mavlink_msg_attitude_decode(&msg, &packet2);
998
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
999
 
1000
        memset(&packet2, 0, sizeof(packet2));
1001
        mavlink_msg_to_send_buffer(buffer, &msg);
1002
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1003
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1004
        }
1005
        mavlink_msg_attitude_decode(last_msg, &packet2);
1006
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1007
 
1008
        memset(&packet2, 0, sizeof(packet2));
1009
        mavlink_msg_attitude_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
1010
        mavlink_msg_attitude_decode(last_msg, &packet2);
1011
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1012
}
1013
 
1014
static void mavlink_test_attitude_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1015
{
1016
        mavlink_message_t msg;
1017
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1018
        uint16_t i;
1019
        mavlink_attitude_quaternion_t packet_in = {
1020
                963497464,
1021
        45.0,
1022
        73.0,
1023
        101.0,
1024
        129.0,
1025
        157.0,
1026
        185.0,
1027
        213.0,
1028
        };
1029
        mavlink_attitude_quaternion_t packet1, packet2;
1030
        memset(&packet1, 0, sizeof(packet1));
1031
                packet1.time_boot_ms = packet_in.time_boot_ms;
1032
                packet1.q1 = packet_in.q1;
1033
                packet1.q2 = packet_in.q2;
1034
                packet1.q3 = packet_in.q3;
1035
                packet1.q4 = packet_in.q4;
1036
                packet1.rollspeed = packet_in.rollspeed;
1037
                packet1.pitchspeed = packet_in.pitchspeed;
1038
                packet1.yawspeed = packet_in.yawspeed;
1039
 
1040
 
1041
 
1042
        memset(&packet2, 0, sizeof(packet2));
1043
        mavlink_msg_attitude_quaternion_encode(system_id, component_id, &msg, &packet1);
1044
        mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
1045
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1046
 
1047
        memset(&packet2, 0, sizeof(packet2));
1048
        mavlink_msg_attitude_quaternion_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
1049
        mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
1050
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1051
 
1052
        memset(&packet2, 0, sizeof(packet2));
1053
        mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
1054
        mavlink_msg_attitude_quaternion_decode(&msg, &packet2);
1055
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1056
 
1057
        memset(&packet2, 0, sizeof(packet2));
1058
        mavlink_msg_to_send_buffer(buffer, &msg);
1059
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1060
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1061
        }
1062
        mavlink_msg_attitude_quaternion_decode(last_msg, &packet2);
1063
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1064
 
1065
        memset(&packet2, 0, sizeof(packet2));
1066
        mavlink_msg_attitude_quaternion_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed );
1067
        mavlink_msg_attitude_quaternion_decode(last_msg, &packet2);
1068
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1069
}
1070
 
1071
static void mavlink_test_local_position_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1072
{
1073
        mavlink_message_t msg;
1074
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1075
        uint16_t i;
1076
        mavlink_local_position_ned_t packet_in = {
1077
                963497464,
1078
        45.0,
1079
        73.0,
1080
        101.0,
1081
        129.0,
1082
        157.0,
1083
        185.0,
1084
        };
1085
        mavlink_local_position_ned_t packet1, packet2;
1086
        memset(&packet1, 0, sizeof(packet1));
1087
                packet1.time_boot_ms = packet_in.time_boot_ms;
1088
                packet1.x = packet_in.x;
1089
                packet1.y = packet_in.y;
1090
                packet1.z = packet_in.z;
1091
                packet1.vx = packet_in.vx;
1092
                packet1.vy = packet_in.vy;
1093
                packet1.vz = packet_in.vz;
1094
 
1095
 
1096
 
1097
        memset(&packet2, 0, sizeof(packet2));
1098
        mavlink_msg_local_position_ned_encode(system_id, component_id, &msg, &packet1);
1099
        mavlink_msg_local_position_ned_decode(&msg, &packet2);
1100
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1101
 
1102
        memset(&packet2, 0, sizeof(packet2));
1103
        mavlink_msg_local_position_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
1104
        mavlink_msg_local_position_ned_decode(&msg, &packet2);
1105
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1106
 
1107
        memset(&packet2, 0, sizeof(packet2));
1108
        mavlink_msg_local_position_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
1109
        mavlink_msg_local_position_ned_decode(&msg, &packet2);
1110
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1111
 
1112
        memset(&packet2, 0, sizeof(packet2));
1113
        mavlink_msg_to_send_buffer(buffer, &msg);
1114
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1115
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1116
        }
1117
        mavlink_msg_local_position_ned_decode(last_msg, &packet2);
1118
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1119
 
1120
        memset(&packet2, 0, sizeof(packet2));
1121
        mavlink_msg_local_position_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz );
1122
        mavlink_msg_local_position_ned_decode(last_msg, &packet2);
1123
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1124
}
1125
 
1126
static void mavlink_test_global_position_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1127
{
1128
        mavlink_message_t msg;
1129
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1130
        uint16_t i;
1131
        mavlink_global_position_int_t packet_in = {
1132
                963497464,
1133
        963497672,
1134
        963497880,
1135
        963498088,
1136
        963498296,
1137
        18275,
1138
        18379,
1139
        18483,
1140
        18587,
1141
        };
1142
        mavlink_global_position_int_t packet1, packet2;
1143
        memset(&packet1, 0, sizeof(packet1));
1144
                packet1.time_boot_ms = packet_in.time_boot_ms;
1145
                packet1.lat = packet_in.lat;
1146
                packet1.lon = packet_in.lon;
1147
                packet1.alt = packet_in.alt;
1148
                packet1.relative_alt = packet_in.relative_alt;
1149
                packet1.vx = packet_in.vx;
1150
                packet1.vy = packet_in.vy;
1151
                packet1.vz = packet_in.vz;
1152
                packet1.hdg = packet_in.hdg;
1153
 
1154
 
1155
 
1156
        memset(&packet2, 0, sizeof(packet2));
1157
        mavlink_msg_global_position_int_encode(system_id, component_id, &msg, &packet1);
1158
        mavlink_msg_global_position_int_decode(&msg, &packet2);
1159
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1160
 
1161
        memset(&packet2, 0, sizeof(packet2));
1162
        mavlink_msg_global_position_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
1163
        mavlink_msg_global_position_int_decode(&msg, &packet2);
1164
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1165
 
1166
        memset(&packet2, 0, sizeof(packet2));
1167
        mavlink_msg_global_position_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
1168
        mavlink_msg_global_position_int_decode(&msg, &packet2);
1169
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1170
 
1171
        memset(&packet2, 0, sizeof(packet2));
1172
        mavlink_msg_to_send_buffer(buffer, &msg);
1173
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1174
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1175
        }
1176
        mavlink_msg_global_position_int_decode(last_msg, &packet2);
1177
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1178
 
1179
        memset(&packet2, 0, sizeof(packet2));
1180
        mavlink_msg_global_position_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg );
1181
        mavlink_msg_global_position_int_decode(last_msg, &packet2);
1182
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1183
}
1184
 
1185
static void mavlink_test_rc_channels_scaled(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1186
{
1187
        mavlink_message_t msg;
1188
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1189
        uint16_t i;
1190
        mavlink_rc_channels_scaled_t packet_in = {
1191
                963497464,
1192
        17443,
1193
        17547,
1194
        17651,
1195
        17755,
1196
        17859,
1197
        17963,
1198
        18067,
1199
        18171,
1200
        65,
1201
        132,
1202
        };
1203
        mavlink_rc_channels_scaled_t packet1, packet2;
1204
        memset(&packet1, 0, sizeof(packet1));
1205
                packet1.time_boot_ms = packet_in.time_boot_ms;
1206
                packet1.chan1_scaled = packet_in.chan1_scaled;
1207
                packet1.chan2_scaled = packet_in.chan2_scaled;
1208
                packet1.chan3_scaled = packet_in.chan3_scaled;
1209
                packet1.chan4_scaled = packet_in.chan4_scaled;
1210
                packet1.chan5_scaled = packet_in.chan5_scaled;
1211
                packet1.chan6_scaled = packet_in.chan6_scaled;
1212
                packet1.chan7_scaled = packet_in.chan7_scaled;
1213
                packet1.chan8_scaled = packet_in.chan8_scaled;
1214
                packet1.port = packet_in.port;
1215
                packet1.rssi = packet_in.rssi;
1216
 
1217
 
1218
 
1219
        memset(&packet2, 0, sizeof(packet2));
1220
        mavlink_msg_rc_channels_scaled_encode(system_id, component_id, &msg, &packet1);
1221
        mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
1222
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1223
 
1224
        memset(&packet2, 0, sizeof(packet2));
1225
        mavlink_msg_rc_channels_scaled_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
1226
        mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
1227
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1228
 
1229
        memset(&packet2, 0, sizeof(packet2));
1230
        mavlink_msg_rc_channels_scaled_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
1231
        mavlink_msg_rc_channels_scaled_decode(&msg, &packet2);
1232
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1233
 
1234
        memset(&packet2, 0, sizeof(packet2));
1235
        mavlink_msg_to_send_buffer(buffer, &msg);
1236
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1237
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1238
        }
1239
        mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2);
1240
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1241
 
1242
        memset(&packet2, 0, sizeof(packet2));
1243
        mavlink_msg_rc_channels_scaled_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi );
1244
        mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2);
1245
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1246
}
1247
 
1248
static void mavlink_test_rc_channels_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1249
{
1250
        mavlink_message_t msg;
1251
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1252
        uint16_t i;
1253
        mavlink_rc_channels_raw_t packet_in = {
1254
                963497464,
1255
        17443,
1256
        17547,
1257
        17651,
1258
        17755,
1259
        17859,
1260
        17963,
1261
        18067,
1262
        18171,
1263
        65,
1264
        132,
1265
        };
1266
        mavlink_rc_channels_raw_t packet1, packet2;
1267
        memset(&packet1, 0, sizeof(packet1));
1268
                packet1.time_boot_ms = packet_in.time_boot_ms;
1269
                packet1.chan1_raw = packet_in.chan1_raw;
1270
                packet1.chan2_raw = packet_in.chan2_raw;
1271
                packet1.chan3_raw = packet_in.chan3_raw;
1272
                packet1.chan4_raw = packet_in.chan4_raw;
1273
                packet1.chan5_raw = packet_in.chan5_raw;
1274
                packet1.chan6_raw = packet_in.chan6_raw;
1275
                packet1.chan7_raw = packet_in.chan7_raw;
1276
                packet1.chan8_raw = packet_in.chan8_raw;
1277
                packet1.port = packet_in.port;
1278
                packet1.rssi = packet_in.rssi;
1279
 
1280
 
1281
 
1282
        memset(&packet2, 0, sizeof(packet2));
1283
        mavlink_msg_rc_channels_raw_encode(system_id, component_id, &msg, &packet1);
1284
        mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
1285
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1286
 
1287
        memset(&packet2, 0, sizeof(packet2));
1288
        mavlink_msg_rc_channels_raw_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
1289
        mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
1290
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1291
 
1292
        memset(&packet2, 0, sizeof(packet2));
1293
        mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
1294
        mavlink_msg_rc_channels_raw_decode(&msg, &packet2);
1295
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1296
 
1297
        memset(&packet2, 0, sizeof(packet2));
1298
        mavlink_msg_to_send_buffer(buffer, &msg);
1299
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1300
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1301
        }
1302
        mavlink_msg_rc_channels_raw_decode(last_msg, &packet2);
1303
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1304
 
1305
        memset(&packet2, 0, sizeof(packet2));
1306
        mavlink_msg_rc_channels_raw_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi );
1307
        mavlink_msg_rc_channels_raw_decode(last_msg, &packet2);
1308
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1309
}
1310
 
1311
static void mavlink_test_servo_output_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1312
{
1313
        mavlink_message_t msg;
1314
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1315
        uint16_t i;
1316
        mavlink_servo_output_raw_t packet_in = {
1317
                963497464,
1318
        17443,
1319
        17547,
1320
        17651,
1321
        17755,
1322
        17859,
1323
        17963,
1324
        18067,
1325
        18171,
1326
        65,
1327
        };
1328
        mavlink_servo_output_raw_t packet1, packet2;
1329
        memset(&packet1, 0, sizeof(packet1));
1330
                packet1.time_usec = packet_in.time_usec;
1331
                packet1.servo1_raw = packet_in.servo1_raw;
1332
                packet1.servo2_raw = packet_in.servo2_raw;
1333
                packet1.servo3_raw = packet_in.servo3_raw;
1334
                packet1.servo4_raw = packet_in.servo4_raw;
1335
                packet1.servo5_raw = packet_in.servo5_raw;
1336
                packet1.servo6_raw = packet_in.servo6_raw;
1337
                packet1.servo7_raw = packet_in.servo7_raw;
1338
                packet1.servo8_raw = packet_in.servo8_raw;
1339
                packet1.port = packet_in.port;
1340
 
1341
 
1342
 
1343
        memset(&packet2, 0, sizeof(packet2));
1344
        mavlink_msg_servo_output_raw_encode(system_id, component_id, &msg, &packet1);
1345
        mavlink_msg_servo_output_raw_decode(&msg, &packet2);
1346
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1347
 
1348
        memset(&packet2, 0, sizeof(packet2));
1349
        mavlink_msg_servo_output_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw );
1350
        mavlink_msg_servo_output_raw_decode(&msg, &packet2);
1351
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1352
 
1353
        memset(&packet2, 0, sizeof(packet2));
1354
        mavlink_msg_servo_output_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw );
1355
        mavlink_msg_servo_output_raw_decode(&msg, &packet2);
1356
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1357
 
1358
        memset(&packet2, 0, sizeof(packet2));
1359
        mavlink_msg_to_send_buffer(buffer, &msg);
1360
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1361
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1362
        }
1363
        mavlink_msg_servo_output_raw_decode(last_msg, &packet2);
1364
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1365
 
1366
        memset(&packet2, 0, sizeof(packet2));
1367
        mavlink_msg_servo_output_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw );
1368
        mavlink_msg_servo_output_raw_decode(last_msg, &packet2);
1369
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1370
}
1371
 
1372
static void mavlink_test_mission_request_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1373
{
1374
        mavlink_message_t msg;
1375
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1376
        uint16_t i;
1377
        mavlink_mission_request_partial_list_t packet_in = {
1378
                17235,
1379
        17339,
1380
        17,
1381
        84,
1382
        };
1383
        mavlink_mission_request_partial_list_t packet1, packet2;
1384
        memset(&packet1, 0, sizeof(packet1));
1385
                packet1.start_index = packet_in.start_index;
1386
                packet1.end_index = packet_in.end_index;
1387
                packet1.target_system = packet_in.target_system;
1388
                packet1.target_component = packet_in.target_component;
1389
 
1390
 
1391
 
1392
        memset(&packet2, 0, sizeof(packet2));
1393
        mavlink_msg_mission_request_partial_list_encode(system_id, component_id, &msg, &packet1);
1394
        mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
1395
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1396
 
1397
        memset(&packet2, 0, sizeof(packet2));
1398
        mavlink_msg_mission_request_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1399
        mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
1400
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1401
 
1402
        memset(&packet2, 0, sizeof(packet2));
1403
        mavlink_msg_mission_request_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1404
        mavlink_msg_mission_request_partial_list_decode(&msg, &packet2);
1405
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1406
 
1407
        memset(&packet2, 0, sizeof(packet2));
1408
        mavlink_msg_to_send_buffer(buffer, &msg);
1409
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1410
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1411
        }
1412
        mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2);
1413
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1414
 
1415
        memset(&packet2, 0, sizeof(packet2));
1416
        mavlink_msg_mission_request_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1417
        mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2);
1418
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1419
}
1420
 
1421
static void mavlink_test_mission_write_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1422
{
1423
        mavlink_message_t msg;
1424
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1425
        uint16_t i;
1426
        mavlink_mission_write_partial_list_t packet_in = {
1427
                17235,
1428
        17339,
1429
        17,
1430
        84,
1431
        };
1432
        mavlink_mission_write_partial_list_t packet1, packet2;
1433
        memset(&packet1, 0, sizeof(packet1));
1434
                packet1.start_index = packet_in.start_index;
1435
                packet1.end_index = packet_in.end_index;
1436
                packet1.target_system = packet_in.target_system;
1437
                packet1.target_component = packet_in.target_component;
1438
 
1439
 
1440
 
1441
        memset(&packet2, 0, sizeof(packet2));
1442
        mavlink_msg_mission_write_partial_list_encode(system_id, component_id, &msg, &packet1);
1443
        mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
1444
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1445
 
1446
        memset(&packet2, 0, sizeof(packet2));
1447
        mavlink_msg_mission_write_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1448
        mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
1449
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1450
 
1451
        memset(&packet2, 0, sizeof(packet2));
1452
        mavlink_msg_mission_write_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1453
        mavlink_msg_mission_write_partial_list_decode(&msg, &packet2);
1454
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1455
 
1456
        memset(&packet2, 0, sizeof(packet2));
1457
        mavlink_msg_to_send_buffer(buffer, &msg);
1458
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1459
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1460
        }
1461
        mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2);
1462
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1463
 
1464
        memset(&packet2, 0, sizeof(packet2));
1465
        mavlink_msg_mission_write_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index );
1466
        mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2);
1467
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1468
}
1469
 
1470
static void mavlink_test_mission_item(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1471
{
1472
        mavlink_message_t msg;
1473
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1474
        uint16_t i;
1475
        mavlink_mission_item_t packet_in = {
1476
                17.0,
1477
        45.0,
1478
        73.0,
1479
        101.0,
1480
        129.0,
1481
        157.0,
1482
        185.0,
1483
        18691,
1484
        18795,
1485
        101,
1486
        168,
1487
        235,
1488
        46,
1489
        113,
1490
        };
1491
        mavlink_mission_item_t packet1, packet2;
1492
        memset(&packet1, 0, sizeof(packet1));
1493
                packet1.param1 = packet_in.param1;
1494
                packet1.param2 = packet_in.param2;
1495
                packet1.param3 = packet_in.param3;
1496
                packet1.param4 = packet_in.param4;
1497
                packet1.x = packet_in.x;
1498
                packet1.y = packet_in.y;
1499
                packet1.z = packet_in.z;
1500
                packet1.seq = packet_in.seq;
1501
                packet1.command = packet_in.command;
1502
                packet1.target_system = packet_in.target_system;
1503
                packet1.target_component = packet_in.target_component;
1504
                packet1.frame = packet_in.frame;
1505
                packet1.current = packet_in.current;
1506
                packet1.autocontinue = packet_in.autocontinue;
1507
 
1508
 
1509
 
1510
        memset(&packet2, 0, sizeof(packet2));
1511
        mavlink_msg_mission_item_encode(system_id, component_id, &msg, &packet1);
1512
        mavlink_msg_mission_item_decode(&msg, &packet2);
1513
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1514
 
1515
        memset(&packet2, 0, sizeof(packet2));
1516
        mavlink_msg_mission_item_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
1517
        mavlink_msg_mission_item_decode(&msg, &packet2);
1518
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1519
 
1520
        memset(&packet2, 0, sizeof(packet2));
1521
        mavlink_msg_mission_item_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
1522
        mavlink_msg_mission_item_decode(&msg, &packet2);
1523
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1524
 
1525
        memset(&packet2, 0, sizeof(packet2));
1526
        mavlink_msg_to_send_buffer(buffer, &msg);
1527
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1528
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1529
        }
1530
        mavlink_msg_mission_item_decode(last_msg, &packet2);
1531
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1532
 
1533
        memset(&packet2, 0, sizeof(packet2));
1534
        mavlink_msg_mission_item_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z );
1535
        mavlink_msg_mission_item_decode(last_msg, &packet2);
1536
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1537
}
1538
 
1539
static void mavlink_test_mission_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1540
{
1541
        mavlink_message_t msg;
1542
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1543
        uint16_t i;
1544
        mavlink_mission_request_t packet_in = {
1545
                17235,
1546
        139,
1547
        206,
1548
        };
1549
        mavlink_mission_request_t packet1, packet2;
1550
        memset(&packet1, 0, sizeof(packet1));
1551
                packet1.seq = packet_in.seq;
1552
                packet1.target_system = packet_in.target_system;
1553
                packet1.target_component = packet_in.target_component;
1554
 
1555
 
1556
 
1557
        memset(&packet2, 0, sizeof(packet2));
1558
        mavlink_msg_mission_request_encode(system_id, component_id, &msg, &packet1);
1559
        mavlink_msg_mission_request_decode(&msg, &packet2);
1560
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1561
 
1562
        memset(&packet2, 0, sizeof(packet2));
1563
        mavlink_msg_mission_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq );
1564
        mavlink_msg_mission_request_decode(&msg, &packet2);
1565
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1566
 
1567
        memset(&packet2, 0, sizeof(packet2));
1568
        mavlink_msg_mission_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq );
1569
        mavlink_msg_mission_request_decode(&msg, &packet2);
1570
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1571
 
1572
        memset(&packet2, 0, sizeof(packet2));
1573
        mavlink_msg_to_send_buffer(buffer, &msg);
1574
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1575
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1576
        }
1577
        mavlink_msg_mission_request_decode(last_msg, &packet2);
1578
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1579
 
1580
        memset(&packet2, 0, sizeof(packet2));
1581
        mavlink_msg_mission_request_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq );
1582
        mavlink_msg_mission_request_decode(last_msg, &packet2);
1583
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1584
}
1585
 
1586
static void mavlink_test_mission_set_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1587
{
1588
        mavlink_message_t msg;
1589
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1590
        uint16_t i;
1591
        mavlink_mission_set_current_t packet_in = {
1592
                17235,
1593
        139,
1594
        206,
1595
        };
1596
        mavlink_mission_set_current_t packet1, packet2;
1597
        memset(&packet1, 0, sizeof(packet1));
1598
                packet1.seq = packet_in.seq;
1599
                packet1.target_system = packet_in.target_system;
1600
                packet1.target_component = packet_in.target_component;
1601
 
1602
 
1603
 
1604
        memset(&packet2, 0, sizeof(packet2));
1605
        mavlink_msg_mission_set_current_encode(system_id, component_id, &msg, &packet1);
1606
        mavlink_msg_mission_set_current_decode(&msg, &packet2);
1607
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1608
 
1609
        memset(&packet2, 0, sizeof(packet2));
1610
        mavlink_msg_mission_set_current_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq );
1611
        mavlink_msg_mission_set_current_decode(&msg, &packet2);
1612
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1613
 
1614
        memset(&packet2, 0, sizeof(packet2));
1615
        mavlink_msg_mission_set_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq );
1616
        mavlink_msg_mission_set_current_decode(&msg, &packet2);
1617
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1618
 
1619
        memset(&packet2, 0, sizeof(packet2));
1620
        mavlink_msg_to_send_buffer(buffer, &msg);
1621
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1622
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1623
        }
1624
        mavlink_msg_mission_set_current_decode(last_msg, &packet2);
1625
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1626
 
1627
        memset(&packet2, 0, sizeof(packet2));
1628
        mavlink_msg_mission_set_current_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq );
1629
        mavlink_msg_mission_set_current_decode(last_msg, &packet2);
1630
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1631
}
1632
 
1633
static void mavlink_test_mission_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1634
{
1635
        mavlink_message_t msg;
1636
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1637
        uint16_t i;
1638
        mavlink_mission_current_t packet_in = {
1639
                17235,
1640
        };
1641
        mavlink_mission_current_t packet1, packet2;
1642
        memset(&packet1, 0, sizeof(packet1));
1643
                packet1.seq = packet_in.seq;
1644
 
1645
 
1646
 
1647
        memset(&packet2, 0, sizeof(packet2));
1648
        mavlink_msg_mission_current_encode(system_id, component_id, &msg, &packet1);
1649
        mavlink_msg_mission_current_decode(&msg, &packet2);
1650
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1651
 
1652
        memset(&packet2, 0, sizeof(packet2));
1653
        mavlink_msg_mission_current_pack(system_id, component_id, &msg , packet1.seq );
1654
        mavlink_msg_mission_current_decode(&msg, &packet2);
1655
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1656
 
1657
        memset(&packet2, 0, sizeof(packet2));
1658
        mavlink_msg_mission_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq );
1659
        mavlink_msg_mission_current_decode(&msg, &packet2);
1660
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1661
 
1662
        memset(&packet2, 0, sizeof(packet2));
1663
        mavlink_msg_to_send_buffer(buffer, &msg);
1664
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1665
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1666
        }
1667
        mavlink_msg_mission_current_decode(last_msg, &packet2);
1668
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1669
 
1670
        memset(&packet2, 0, sizeof(packet2));
1671
        mavlink_msg_mission_current_send(MAVLINK_COMM_1 , packet1.seq );
1672
        mavlink_msg_mission_current_decode(last_msg, &packet2);
1673
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1674
}
1675
 
1676
static void mavlink_test_mission_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1677
{
1678
        mavlink_message_t msg;
1679
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1680
        uint16_t i;
1681
        mavlink_mission_request_list_t packet_in = {
1682
                5,
1683
        72,
1684
        };
1685
        mavlink_mission_request_list_t packet1, packet2;
1686
        memset(&packet1, 0, sizeof(packet1));
1687
                packet1.target_system = packet_in.target_system;
1688
                packet1.target_component = packet_in.target_component;
1689
 
1690
 
1691
 
1692
        memset(&packet2, 0, sizeof(packet2));
1693
        mavlink_msg_mission_request_list_encode(system_id, component_id, &msg, &packet1);
1694
        mavlink_msg_mission_request_list_decode(&msg, &packet2);
1695
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1696
 
1697
        memset(&packet2, 0, sizeof(packet2));
1698
        mavlink_msg_mission_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
1699
        mavlink_msg_mission_request_list_decode(&msg, &packet2);
1700
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1701
 
1702
        memset(&packet2, 0, sizeof(packet2));
1703
        mavlink_msg_mission_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
1704
        mavlink_msg_mission_request_list_decode(&msg, &packet2);
1705
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1706
 
1707
        memset(&packet2, 0, sizeof(packet2));
1708
        mavlink_msg_to_send_buffer(buffer, &msg);
1709
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1710
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1711
        }
1712
        mavlink_msg_mission_request_list_decode(last_msg, &packet2);
1713
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1714
 
1715
        memset(&packet2, 0, sizeof(packet2));
1716
        mavlink_msg_mission_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
1717
        mavlink_msg_mission_request_list_decode(last_msg, &packet2);
1718
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1719
}
1720
 
1721
static void mavlink_test_mission_count(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1722
{
1723
        mavlink_message_t msg;
1724
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1725
        uint16_t i;
1726
        mavlink_mission_count_t packet_in = {
1727
                17235,
1728
        139,
1729
        206,
1730
        };
1731
        mavlink_mission_count_t packet1, packet2;
1732
        memset(&packet1, 0, sizeof(packet1));
1733
                packet1.count = packet_in.count;
1734
                packet1.target_system = packet_in.target_system;
1735
                packet1.target_component = packet_in.target_component;
1736
 
1737
 
1738
 
1739
        memset(&packet2, 0, sizeof(packet2));
1740
        mavlink_msg_mission_count_encode(system_id, component_id, &msg, &packet1);
1741
        mavlink_msg_mission_count_decode(&msg, &packet2);
1742
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1743
 
1744
        memset(&packet2, 0, sizeof(packet2));
1745
        mavlink_msg_mission_count_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.count );
1746
        mavlink_msg_mission_count_decode(&msg, &packet2);
1747
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1748
 
1749
        memset(&packet2, 0, sizeof(packet2));
1750
        mavlink_msg_mission_count_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.count );
1751
        mavlink_msg_mission_count_decode(&msg, &packet2);
1752
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1753
 
1754
        memset(&packet2, 0, sizeof(packet2));
1755
        mavlink_msg_to_send_buffer(buffer, &msg);
1756
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1757
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1758
        }
1759
        mavlink_msg_mission_count_decode(last_msg, &packet2);
1760
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1761
 
1762
        memset(&packet2, 0, sizeof(packet2));
1763
        mavlink_msg_mission_count_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.count );
1764
        mavlink_msg_mission_count_decode(last_msg, &packet2);
1765
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1766
}
1767
 
1768
static void mavlink_test_mission_clear_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1769
{
1770
        mavlink_message_t msg;
1771
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1772
        uint16_t i;
1773
        mavlink_mission_clear_all_t packet_in = {
1774
                5,
1775
        72,
1776
        };
1777
        mavlink_mission_clear_all_t packet1, packet2;
1778
        memset(&packet1, 0, sizeof(packet1));
1779
                packet1.target_system = packet_in.target_system;
1780
                packet1.target_component = packet_in.target_component;
1781
 
1782
 
1783
 
1784
        memset(&packet2, 0, sizeof(packet2));
1785
        mavlink_msg_mission_clear_all_encode(system_id, component_id, &msg, &packet1);
1786
        mavlink_msg_mission_clear_all_decode(&msg, &packet2);
1787
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1788
 
1789
        memset(&packet2, 0, sizeof(packet2));
1790
        mavlink_msg_mission_clear_all_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component );
1791
        mavlink_msg_mission_clear_all_decode(&msg, &packet2);
1792
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1793
 
1794
        memset(&packet2, 0, sizeof(packet2));
1795
        mavlink_msg_mission_clear_all_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component );
1796
        mavlink_msg_mission_clear_all_decode(&msg, &packet2);
1797
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1798
 
1799
        memset(&packet2, 0, sizeof(packet2));
1800
        mavlink_msg_to_send_buffer(buffer, &msg);
1801
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1802
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1803
        }
1804
        mavlink_msg_mission_clear_all_decode(last_msg, &packet2);
1805
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1806
 
1807
        memset(&packet2, 0, sizeof(packet2));
1808
        mavlink_msg_mission_clear_all_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component );
1809
        mavlink_msg_mission_clear_all_decode(last_msg, &packet2);
1810
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1811
}
1812
 
1813
static void mavlink_test_mission_item_reached(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1814
{
1815
        mavlink_message_t msg;
1816
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1817
        uint16_t i;
1818
        mavlink_mission_item_reached_t packet_in = {
1819
                17235,
1820
        };
1821
        mavlink_mission_item_reached_t packet1, packet2;
1822
        memset(&packet1, 0, sizeof(packet1));
1823
                packet1.seq = packet_in.seq;
1824
 
1825
 
1826
 
1827
        memset(&packet2, 0, sizeof(packet2));
1828
        mavlink_msg_mission_item_reached_encode(system_id, component_id, &msg, &packet1);
1829
        mavlink_msg_mission_item_reached_decode(&msg, &packet2);
1830
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1831
 
1832
        memset(&packet2, 0, sizeof(packet2));
1833
        mavlink_msg_mission_item_reached_pack(system_id, component_id, &msg , packet1.seq );
1834
        mavlink_msg_mission_item_reached_decode(&msg, &packet2);
1835
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1836
 
1837
        memset(&packet2, 0, sizeof(packet2));
1838
        mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq );
1839
        mavlink_msg_mission_item_reached_decode(&msg, &packet2);
1840
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1841
 
1842
        memset(&packet2, 0, sizeof(packet2));
1843
        mavlink_msg_to_send_buffer(buffer, &msg);
1844
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1845
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1846
        }
1847
        mavlink_msg_mission_item_reached_decode(last_msg, &packet2);
1848
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1849
 
1850
        memset(&packet2, 0, sizeof(packet2));
1851
        mavlink_msg_mission_item_reached_send(MAVLINK_COMM_1 , packet1.seq );
1852
        mavlink_msg_mission_item_reached_decode(last_msg, &packet2);
1853
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1854
}
1855
 
1856
static void mavlink_test_mission_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1857
{
1858
        mavlink_message_t msg;
1859
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1860
        uint16_t i;
1861
        mavlink_mission_ack_t packet_in = {
1862
                5,
1863
        72,
1864
        139,
1865
        };
1866
        mavlink_mission_ack_t packet1, packet2;
1867
        memset(&packet1, 0, sizeof(packet1));
1868
                packet1.target_system = packet_in.target_system;
1869
                packet1.target_component = packet_in.target_component;
1870
                packet1.type = packet_in.type;
1871
 
1872
 
1873
 
1874
        memset(&packet2, 0, sizeof(packet2));
1875
        mavlink_msg_mission_ack_encode(system_id, component_id, &msg, &packet1);
1876
        mavlink_msg_mission_ack_decode(&msg, &packet2);
1877
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1878
 
1879
        memset(&packet2, 0, sizeof(packet2));
1880
        mavlink_msg_mission_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.type );
1881
        mavlink_msg_mission_ack_decode(&msg, &packet2);
1882
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1883
 
1884
        memset(&packet2, 0, sizeof(packet2));
1885
        mavlink_msg_mission_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.type );
1886
        mavlink_msg_mission_ack_decode(&msg, &packet2);
1887
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1888
 
1889
        memset(&packet2, 0, sizeof(packet2));
1890
        mavlink_msg_to_send_buffer(buffer, &msg);
1891
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1892
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1893
        }
1894
        mavlink_msg_mission_ack_decode(last_msg, &packet2);
1895
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1896
 
1897
        memset(&packet2, 0, sizeof(packet2));
1898
        mavlink_msg_mission_ack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.type );
1899
        mavlink_msg_mission_ack_decode(last_msg, &packet2);
1900
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1901
}
1902
 
1903
static void mavlink_test_set_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1904
{
1905
        mavlink_message_t msg;
1906
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1907
        uint16_t i;
1908
        mavlink_set_gps_global_origin_t packet_in = {
1909
                963497464,
1910
        963497672,
1911
        963497880,
1912
        41,
1913
        };
1914
        mavlink_set_gps_global_origin_t packet1, packet2;
1915
        memset(&packet1, 0, sizeof(packet1));
1916
                packet1.latitude = packet_in.latitude;
1917
                packet1.longitude = packet_in.longitude;
1918
                packet1.altitude = packet_in.altitude;
1919
                packet1.target_system = packet_in.target_system;
1920
 
1921
 
1922
 
1923
        memset(&packet2, 0, sizeof(packet2));
1924
        mavlink_msg_set_gps_global_origin_encode(system_id, component_id, &msg, &packet1);
1925
        mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
1926
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1927
 
1928
        memset(&packet2, 0, sizeof(packet2));
1929
        mavlink_msg_set_gps_global_origin_pack(system_id, component_id, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude );
1930
        mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
1931
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1932
 
1933
        memset(&packet2, 0, sizeof(packet2));
1934
        mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude );
1935
        mavlink_msg_set_gps_global_origin_decode(&msg, &packet2);
1936
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1937
 
1938
        memset(&packet2, 0, sizeof(packet2));
1939
        mavlink_msg_to_send_buffer(buffer, &msg);
1940
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1941
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1942
        }
1943
        mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2);
1944
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1945
 
1946
        memset(&packet2, 0, sizeof(packet2));
1947
        mavlink_msg_set_gps_global_origin_send(MAVLINK_COMM_1 , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude );
1948
        mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2);
1949
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1950
}
1951
 
1952
static void mavlink_test_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
1953
{
1954
        mavlink_message_t msg;
1955
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
1956
        uint16_t i;
1957
        mavlink_gps_global_origin_t packet_in = {
1958
                963497464,
1959
        963497672,
1960
        963497880,
1961
        };
1962
        mavlink_gps_global_origin_t packet1, packet2;
1963
        memset(&packet1, 0, sizeof(packet1));
1964
                packet1.latitude = packet_in.latitude;
1965
                packet1.longitude = packet_in.longitude;
1966
                packet1.altitude = packet_in.altitude;
1967
 
1968
 
1969
 
1970
        memset(&packet2, 0, sizeof(packet2));
1971
        mavlink_msg_gps_global_origin_encode(system_id, component_id, &msg, &packet1);
1972
        mavlink_msg_gps_global_origin_decode(&msg, &packet2);
1973
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1974
 
1975
        memset(&packet2, 0, sizeof(packet2));
1976
        mavlink_msg_gps_global_origin_pack(system_id, component_id, &msg , packet1.latitude , packet1.longitude , packet1.altitude );
1977
        mavlink_msg_gps_global_origin_decode(&msg, &packet2);
1978
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1979
 
1980
        memset(&packet2, 0, sizeof(packet2));
1981
        mavlink_msg_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.latitude , packet1.longitude , packet1.altitude );
1982
        mavlink_msg_gps_global_origin_decode(&msg, &packet2);
1983
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1984
 
1985
        memset(&packet2, 0, sizeof(packet2));
1986
        mavlink_msg_to_send_buffer(buffer, &msg);
1987
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
1988
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
1989
        }
1990
        mavlink_msg_gps_global_origin_decode(last_msg, &packet2);
1991
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1992
 
1993
        memset(&packet2, 0, sizeof(packet2));
1994
        mavlink_msg_gps_global_origin_send(MAVLINK_COMM_1 , packet1.latitude , packet1.longitude , packet1.altitude );
1995
        mavlink_msg_gps_global_origin_decode(last_msg, &packet2);
1996
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
1997
}
1998
 
1999
static void mavlink_test_set_local_position_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2000
{
2001
        mavlink_message_t msg;
2002
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2003
        uint16_t i;
2004
        mavlink_set_local_position_setpoint_t packet_in = {
2005
                17.0,
2006
        45.0,
2007
        73.0,
2008
        101.0,
2009
        53,
2010
        120,
2011
        187,
2012
        };
2013
        mavlink_set_local_position_setpoint_t packet1, packet2;
2014
        memset(&packet1, 0, sizeof(packet1));
2015
                packet1.x = packet_in.x;
2016
                packet1.y = packet_in.y;
2017
                packet1.z = packet_in.z;
2018
                packet1.yaw = packet_in.yaw;
2019
                packet1.target_system = packet_in.target_system;
2020
                packet1.target_component = packet_in.target_component;
2021
                packet1.coordinate_frame = packet_in.coordinate_frame;
2022
 
2023
 
2024
 
2025
        memset(&packet2, 0, sizeof(packet2));
2026
        mavlink_msg_set_local_position_setpoint_encode(system_id, component_id, &msg, &packet1);
2027
        mavlink_msg_set_local_position_setpoint_decode(&msg, &packet2);
2028
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2029
 
2030
        memset(&packet2, 0, sizeof(packet2));
2031
        mavlink_msg_set_local_position_setpoint_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2032
        mavlink_msg_set_local_position_setpoint_decode(&msg, &packet2);
2033
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2034
 
2035
        memset(&packet2, 0, sizeof(packet2));
2036
        mavlink_msg_set_local_position_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2037
        mavlink_msg_set_local_position_setpoint_decode(&msg, &packet2);
2038
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2039
 
2040
        memset(&packet2, 0, sizeof(packet2));
2041
        mavlink_msg_to_send_buffer(buffer, &msg);
2042
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2043
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2044
        }
2045
        mavlink_msg_set_local_position_setpoint_decode(last_msg, &packet2);
2046
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2047
 
2048
        memset(&packet2, 0, sizeof(packet2));
2049
        mavlink_msg_set_local_position_setpoint_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2050
        mavlink_msg_set_local_position_setpoint_decode(last_msg, &packet2);
2051
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2052
}
2053
 
2054
static void mavlink_test_local_position_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2055
{
2056
        mavlink_message_t msg;
2057
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2058
        uint16_t i;
2059
        mavlink_local_position_setpoint_t packet_in = {
2060
                17.0,
2061
        45.0,
2062
        73.0,
2063
        101.0,
2064
        53,
2065
        };
2066
        mavlink_local_position_setpoint_t packet1, packet2;
2067
        memset(&packet1, 0, sizeof(packet1));
2068
                packet1.x = packet_in.x;
2069
                packet1.y = packet_in.y;
2070
                packet1.z = packet_in.z;
2071
                packet1.yaw = packet_in.yaw;
2072
                packet1.coordinate_frame = packet_in.coordinate_frame;
2073
 
2074
 
2075
 
2076
        memset(&packet2, 0, sizeof(packet2));
2077
        mavlink_msg_local_position_setpoint_encode(system_id, component_id, &msg, &packet1);
2078
        mavlink_msg_local_position_setpoint_decode(&msg, &packet2);
2079
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2080
 
2081
        memset(&packet2, 0, sizeof(packet2));
2082
        mavlink_msg_local_position_setpoint_pack(system_id, component_id, &msg , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2083
        mavlink_msg_local_position_setpoint_decode(&msg, &packet2);
2084
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2085
 
2086
        memset(&packet2, 0, sizeof(packet2));
2087
        mavlink_msg_local_position_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2088
        mavlink_msg_local_position_setpoint_decode(&msg, &packet2);
2089
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2090
 
2091
        memset(&packet2, 0, sizeof(packet2));
2092
        mavlink_msg_to_send_buffer(buffer, &msg);
2093
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2094
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2095
        }
2096
        mavlink_msg_local_position_setpoint_decode(last_msg, &packet2);
2097
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2098
 
2099
        memset(&packet2, 0, sizeof(packet2));
2100
        mavlink_msg_local_position_setpoint_send(MAVLINK_COMM_1 , packet1.coordinate_frame , packet1.x , packet1.y , packet1.z , packet1.yaw );
2101
        mavlink_msg_local_position_setpoint_decode(last_msg, &packet2);
2102
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2103
}
2104
 
2105
static void mavlink_test_global_position_setpoint_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2106
{
2107
        mavlink_message_t msg;
2108
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2109
        uint16_t i;
2110
        mavlink_global_position_setpoint_int_t packet_in = {
2111
                963497464,
2112
        963497672,
2113
        963497880,
2114
        17859,
2115
        175,
2116
        };
2117
        mavlink_global_position_setpoint_int_t packet1, packet2;
2118
        memset(&packet1, 0, sizeof(packet1));
2119
                packet1.latitude = packet_in.latitude;
2120
                packet1.longitude = packet_in.longitude;
2121
                packet1.altitude = packet_in.altitude;
2122
                packet1.yaw = packet_in.yaw;
2123
                packet1.coordinate_frame = packet_in.coordinate_frame;
2124
 
2125
 
2126
 
2127
        memset(&packet2, 0, sizeof(packet2));
2128
        mavlink_msg_global_position_setpoint_int_encode(system_id, component_id, &msg, &packet1);
2129
        mavlink_msg_global_position_setpoint_int_decode(&msg, &packet2);
2130
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2131
 
2132
        memset(&packet2, 0, sizeof(packet2));
2133
        mavlink_msg_global_position_setpoint_int_pack(system_id, component_id, &msg , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2134
        mavlink_msg_global_position_setpoint_int_decode(&msg, &packet2);
2135
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2136
 
2137
        memset(&packet2, 0, sizeof(packet2));
2138
        mavlink_msg_global_position_setpoint_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2139
        mavlink_msg_global_position_setpoint_int_decode(&msg, &packet2);
2140
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2141
 
2142
        memset(&packet2, 0, sizeof(packet2));
2143
        mavlink_msg_to_send_buffer(buffer, &msg);
2144
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2145
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2146
        }
2147
        mavlink_msg_global_position_setpoint_int_decode(last_msg, &packet2);
2148
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2149
 
2150
        memset(&packet2, 0, sizeof(packet2));
2151
        mavlink_msg_global_position_setpoint_int_send(MAVLINK_COMM_1 , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2152
        mavlink_msg_global_position_setpoint_int_decode(last_msg, &packet2);
2153
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2154
}
2155
 
2156
static void mavlink_test_set_global_position_setpoint_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2157
{
2158
        mavlink_message_t msg;
2159
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2160
        uint16_t i;
2161
        mavlink_set_global_position_setpoint_int_t packet_in = {
2162
                963497464,
2163
        963497672,
2164
        963497880,
2165
        17859,
2166
        175,
2167
        };
2168
        mavlink_set_global_position_setpoint_int_t packet1, packet2;
2169
        memset(&packet1, 0, sizeof(packet1));
2170
                packet1.latitude = packet_in.latitude;
2171
                packet1.longitude = packet_in.longitude;
2172
                packet1.altitude = packet_in.altitude;
2173
                packet1.yaw = packet_in.yaw;
2174
                packet1.coordinate_frame = packet_in.coordinate_frame;
2175
 
2176
 
2177
 
2178
        memset(&packet2, 0, sizeof(packet2));
2179
        mavlink_msg_set_global_position_setpoint_int_encode(system_id, component_id, &msg, &packet1);
2180
        mavlink_msg_set_global_position_setpoint_int_decode(&msg, &packet2);
2181
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2182
 
2183
        memset(&packet2, 0, sizeof(packet2));
2184
        mavlink_msg_set_global_position_setpoint_int_pack(system_id, component_id, &msg , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2185
        mavlink_msg_set_global_position_setpoint_int_decode(&msg, &packet2);
2186
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2187
 
2188
        memset(&packet2, 0, sizeof(packet2));
2189
        mavlink_msg_set_global_position_setpoint_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2190
        mavlink_msg_set_global_position_setpoint_int_decode(&msg, &packet2);
2191
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2192
 
2193
        memset(&packet2, 0, sizeof(packet2));
2194
        mavlink_msg_to_send_buffer(buffer, &msg);
2195
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2196
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2197
        }
2198
        mavlink_msg_set_global_position_setpoint_int_decode(last_msg, &packet2);
2199
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2200
 
2201
        memset(&packet2, 0, sizeof(packet2));
2202
        mavlink_msg_set_global_position_setpoint_int_send(MAVLINK_COMM_1 , packet1.coordinate_frame , packet1.latitude , packet1.longitude , packet1.altitude , packet1.yaw );
2203
        mavlink_msg_set_global_position_setpoint_int_decode(last_msg, &packet2);
2204
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2205
}
2206
 
2207
static void mavlink_test_safety_set_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2208
{
2209
        mavlink_message_t msg;
2210
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2211
        uint16_t i;
2212
        mavlink_safety_set_allowed_area_t packet_in = {
2213
                17.0,
2214
        45.0,
2215
        73.0,
2216
        101.0,
2217
        129.0,
2218
        157.0,
2219
        77,
2220
        144,
2221
        211,
2222
        };
2223
        mavlink_safety_set_allowed_area_t packet1, packet2;
2224
        memset(&packet1, 0, sizeof(packet1));
2225
                packet1.p1x = packet_in.p1x;
2226
                packet1.p1y = packet_in.p1y;
2227
                packet1.p1z = packet_in.p1z;
2228
                packet1.p2x = packet_in.p2x;
2229
                packet1.p2y = packet_in.p2y;
2230
                packet1.p2z = packet_in.p2z;
2231
                packet1.target_system = packet_in.target_system;
2232
                packet1.target_component = packet_in.target_component;
2233
                packet1.frame = packet_in.frame;
2234
 
2235
 
2236
 
2237
        memset(&packet2, 0, sizeof(packet2));
2238
        mavlink_msg_safety_set_allowed_area_encode(system_id, component_id, &msg, &packet1);
2239
        mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
2240
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2241
 
2242
        memset(&packet2, 0, sizeof(packet2));
2243
        mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2244
        mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
2245
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2246
 
2247
        memset(&packet2, 0, sizeof(packet2));
2248
        mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2249
        mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2);
2250
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2251
 
2252
        memset(&packet2, 0, sizeof(packet2));
2253
        mavlink_msg_to_send_buffer(buffer, &msg);
2254
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2255
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2256
        }
2257
        mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2);
2258
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2259
 
2260
        memset(&packet2, 0, sizeof(packet2));
2261
        mavlink_msg_safety_set_allowed_area_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2262
        mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2);
2263
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2264
}
2265
 
2266
static void mavlink_test_safety_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2267
{
2268
        mavlink_message_t msg;
2269
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2270
        uint16_t i;
2271
        mavlink_safety_allowed_area_t packet_in = {
2272
                17.0,
2273
        45.0,
2274
        73.0,
2275
        101.0,
2276
        129.0,
2277
        157.0,
2278
        77,
2279
        };
2280
        mavlink_safety_allowed_area_t packet1, packet2;
2281
        memset(&packet1, 0, sizeof(packet1));
2282
                packet1.p1x = packet_in.p1x;
2283
                packet1.p1y = packet_in.p1y;
2284
                packet1.p1z = packet_in.p1z;
2285
                packet1.p2x = packet_in.p2x;
2286
                packet1.p2y = packet_in.p2y;
2287
                packet1.p2z = packet_in.p2z;
2288
                packet1.frame = packet_in.frame;
2289
 
2290
 
2291
 
2292
        memset(&packet2, 0, sizeof(packet2));
2293
        mavlink_msg_safety_allowed_area_encode(system_id, component_id, &msg, &packet1);
2294
        mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
2295
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2296
 
2297
        memset(&packet2, 0, sizeof(packet2));
2298
        mavlink_msg_safety_allowed_area_pack(system_id, component_id, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2299
        mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
2300
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2301
 
2302
        memset(&packet2, 0, sizeof(packet2));
2303
        mavlink_msg_safety_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2304
        mavlink_msg_safety_allowed_area_decode(&msg, &packet2);
2305
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2306
 
2307
        memset(&packet2, 0, sizeof(packet2));
2308
        mavlink_msg_to_send_buffer(buffer, &msg);
2309
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2310
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2311
        }
2312
        mavlink_msg_safety_allowed_area_decode(last_msg, &packet2);
2313
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2314
 
2315
        memset(&packet2, 0, sizeof(packet2));
2316
        mavlink_msg_safety_allowed_area_send(MAVLINK_COMM_1 , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z );
2317
        mavlink_msg_safety_allowed_area_decode(last_msg, &packet2);
2318
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2319
}
2320
 
2321
static void mavlink_test_set_roll_pitch_yaw_thrust(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2322
{
2323
        mavlink_message_t msg;
2324
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2325
        uint16_t i;
2326
        mavlink_set_roll_pitch_yaw_thrust_t packet_in = {
2327
                17.0,
2328
        45.0,
2329
        73.0,
2330
        101.0,
2331
        53,
2332
        120,
2333
        };
2334
        mavlink_set_roll_pitch_yaw_thrust_t packet1, packet2;
2335
        memset(&packet1, 0, sizeof(packet1));
2336
                packet1.roll = packet_in.roll;
2337
                packet1.pitch = packet_in.pitch;
2338
                packet1.yaw = packet_in.yaw;
2339
                packet1.thrust = packet_in.thrust;
2340
                packet1.target_system = packet_in.target_system;
2341
                packet1.target_component = packet_in.target_component;
2342
 
2343
 
2344
 
2345
        memset(&packet2, 0, sizeof(packet2));
2346
        mavlink_msg_set_roll_pitch_yaw_thrust_encode(system_id, component_id, &msg, &packet1);
2347
        mavlink_msg_set_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2348
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2349
 
2350
        memset(&packet2, 0, sizeof(packet2));
2351
        mavlink_msg_set_roll_pitch_yaw_thrust_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2352
        mavlink_msg_set_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2353
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2354
 
2355
        memset(&packet2, 0, sizeof(packet2));
2356
        mavlink_msg_set_roll_pitch_yaw_thrust_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2357
        mavlink_msg_set_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2358
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2359
 
2360
        memset(&packet2, 0, sizeof(packet2));
2361
        mavlink_msg_to_send_buffer(buffer, &msg);
2362
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2363
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2364
        }
2365
        mavlink_msg_set_roll_pitch_yaw_thrust_decode(last_msg, &packet2);
2366
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2367
 
2368
        memset(&packet2, 0, sizeof(packet2));
2369
        mavlink_msg_set_roll_pitch_yaw_thrust_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2370
        mavlink_msg_set_roll_pitch_yaw_thrust_decode(last_msg, &packet2);
2371
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2372
}
2373
 
2374
static void mavlink_test_set_roll_pitch_yaw_speed_thrust(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2375
{
2376
        mavlink_message_t msg;
2377
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2378
        uint16_t i;
2379
        mavlink_set_roll_pitch_yaw_speed_thrust_t packet_in = {
2380
                17.0,
2381
        45.0,
2382
        73.0,
2383
        101.0,
2384
        53,
2385
        120,
2386
        };
2387
        mavlink_set_roll_pitch_yaw_speed_thrust_t packet1, packet2;
2388
        memset(&packet1, 0, sizeof(packet1));
2389
                packet1.roll_speed = packet_in.roll_speed;
2390
                packet1.pitch_speed = packet_in.pitch_speed;
2391
                packet1.yaw_speed = packet_in.yaw_speed;
2392
                packet1.thrust = packet_in.thrust;
2393
                packet1.target_system = packet_in.target_system;
2394
                packet1.target_component = packet_in.target_component;
2395
 
2396
 
2397
 
2398
        memset(&packet2, 0, sizeof(packet2));
2399
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_encode(system_id, component_id, &msg, &packet1);
2400
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_decode(&msg, &packet2);
2401
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2402
 
2403
        memset(&packet2, 0, sizeof(packet2));
2404
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2405
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_decode(&msg, &packet2);
2406
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2407
 
2408
        memset(&packet2, 0, sizeof(packet2));
2409
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2410
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_decode(&msg, &packet2);
2411
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2412
 
2413
        memset(&packet2, 0, sizeof(packet2));
2414
        mavlink_msg_to_send_buffer(buffer, &msg);
2415
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2416
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2417
        }
2418
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_decode(last_msg, &packet2);
2419
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2420
 
2421
        memset(&packet2, 0, sizeof(packet2));
2422
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2423
        mavlink_msg_set_roll_pitch_yaw_speed_thrust_decode(last_msg, &packet2);
2424
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2425
}
2426
 
2427
static void mavlink_test_roll_pitch_yaw_thrust_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2428
{
2429
        mavlink_message_t msg;
2430
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2431
        uint16_t i;
2432
        mavlink_roll_pitch_yaw_thrust_setpoint_t packet_in = {
2433
                963497464,
2434
        45.0,
2435
        73.0,
2436
        101.0,
2437
        129.0,
2438
        };
2439
        mavlink_roll_pitch_yaw_thrust_setpoint_t packet1, packet2;
2440
        memset(&packet1, 0, sizeof(packet1));
2441
                packet1.time_boot_ms = packet_in.time_boot_ms;
2442
                packet1.roll = packet_in.roll;
2443
                packet1.pitch = packet_in.pitch;
2444
                packet1.yaw = packet_in.yaw;
2445
                packet1.thrust = packet_in.thrust;
2446
 
2447
 
2448
 
2449
        memset(&packet2, 0, sizeof(packet2));
2450
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_encode(system_id, component_id, &msg, &packet1);
2451
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(&msg, &packet2);
2452
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2453
 
2454
        memset(&packet2, 0, sizeof(packet2));
2455
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2456
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(&msg, &packet2);
2457
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2458
 
2459
        memset(&packet2, 0, sizeof(packet2));
2460
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2461
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(&msg, &packet2);
2462
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2463
 
2464
        memset(&packet2, 0, sizeof(packet2));
2465
        mavlink_msg_to_send_buffer(buffer, &msg);
2466
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2467
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2468
        }
2469
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(last_msg, &packet2);
2470
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2471
 
2472
        memset(&packet2, 0, sizeof(packet2));
2473
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2474
        mavlink_msg_roll_pitch_yaw_thrust_setpoint_decode(last_msg, &packet2);
2475
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2476
}
2477
 
2478
static void mavlink_test_roll_pitch_yaw_speed_thrust_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2479
{
2480
        mavlink_message_t msg;
2481
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2482
        uint16_t i;
2483
        mavlink_roll_pitch_yaw_speed_thrust_setpoint_t packet_in = {
2484
                963497464,
2485
        45.0,
2486
        73.0,
2487
        101.0,
2488
        129.0,
2489
        };
2490
        mavlink_roll_pitch_yaw_speed_thrust_setpoint_t packet1, packet2;
2491
        memset(&packet1, 0, sizeof(packet1));
2492
                packet1.time_boot_ms = packet_in.time_boot_ms;
2493
                packet1.roll_speed = packet_in.roll_speed;
2494
                packet1.pitch_speed = packet_in.pitch_speed;
2495
                packet1.yaw_speed = packet_in.yaw_speed;
2496
                packet1.thrust = packet_in.thrust;
2497
 
2498
 
2499
 
2500
        memset(&packet2, 0, sizeof(packet2));
2501
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_encode(system_id, component_id, &msg, &packet1);
2502
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(&msg, &packet2);
2503
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2504
 
2505
        memset(&packet2, 0, sizeof(packet2));
2506
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2507
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(&msg, &packet2);
2508
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2509
 
2510
        memset(&packet2, 0, sizeof(packet2));
2511
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2512
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(&msg, &packet2);
2513
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2514
 
2515
        memset(&packet2, 0, sizeof(packet2));
2516
        mavlink_msg_to_send_buffer(buffer, &msg);
2517
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2518
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2519
        }
2520
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(last_msg, &packet2);
2521
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2522
 
2523
        memset(&packet2, 0, sizeof(packet2));
2524
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll_speed , packet1.pitch_speed , packet1.yaw_speed , packet1.thrust );
2525
        mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint_decode(last_msg, &packet2);
2526
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2527
}
2528
 
2529
static void mavlink_test_set_quad_motors_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2530
{
2531
        mavlink_message_t msg;
2532
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2533
        uint16_t i;
2534
        mavlink_set_quad_motors_setpoint_t packet_in = {
2535
                17235,
2536
        17339,
2537
        17443,
2538
        17547,
2539
        29,
2540
        };
2541
        mavlink_set_quad_motors_setpoint_t packet1, packet2;
2542
        memset(&packet1, 0, sizeof(packet1));
2543
                packet1.motor_front_nw = packet_in.motor_front_nw;
2544
                packet1.motor_right_ne = packet_in.motor_right_ne;
2545
                packet1.motor_back_se = packet_in.motor_back_se;
2546
                packet1.motor_left_sw = packet_in.motor_left_sw;
2547
                packet1.target_system = packet_in.target_system;
2548
 
2549
 
2550
 
2551
        memset(&packet2, 0, sizeof(packet2));
2552
        mavlink_msg_set_quad_motors_setpoint_encode(system_id, component_id, &msg, &packet1);
2553
        mavlink_msg_set_quad_motors_setpoint_decode(&msg, &packet2);
2554
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2555
 
2556
        memset(&packet2, 0, sizeof(packet2));
2557
        mavlink_msg_set_quad_motors_setpoint_pack(system_id, component_id, &msg , packet1.target_system , packet1.motor_front_nw , packet1.motor_right_ne , packet1.motor_back_se , packet1.motor_left_sw );
2558
        mavlink_msg_set_quad_motors_setpoint_decode(&msg, &packet2);
2559
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2560
 
2561
        memset(&packet2, 0, sizeof(packet2));
2562
        mavlink_msg_set_quad_motors_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.motor_front_nw , packet1.motor_right_ne , packet1.motor_back_se , packet1.motor_left_sw );
2563
        mavlink_msg_set_quad_motors_setpoint_decode(&msg, &packet2);
2564
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2565
 
2566
        memset(&packet2, 0, sizeof(packet2));
2567
        mavlink_msg_to_send_buffer(buffer, &msg);
2568
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2569
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2570
        }
2571
        mavlink_msg_set_quad_motors_setpoint_decode(last_msg, &packet2);
2572
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2573
 
2574
        memset(&packet2, 0, sizeof(packet2));
2575
        mavlink_msg_set_quad_motors_setpoint_send(MAVLINK_COMM_1 , packet1.target_system , packet1.motor_front_nw , packet1.motor_right_ne , packet1.motor_back_se , packet1.motor_left_sw );
2576
        mavlink_msg_set_quad_motors_setpoint_decode(last_msg, &packet2);
2577
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2578
}
2579
 
2580
static void mavlink_test_set_quad_swarm_roll_pitch_yaw_thrust(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2581
{
2582
        mavlink_message_t msg;
2583
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2584
        uint16_t i;
2585
        mavlink_set_quad_swarm_roll_pitch_yaw_thrust_t packet_in = {
2586
                { 17235, 17236, 17237, 17238, 17239, 17240 },
2587
        { 17859, 17860, 17861, 17862, 17863, 17864 },
2588
        { 18483, 18484, 18485, 18486, 18487, 18488 },
2589
        { 19107, 19108, 19109, 19110, 19111, 19112 },
2590
        { 149, 150, 151, 152, 153, 154 },
2591
        };
2592
        mavlink_set_quad_swarm_roll_pitch_yaw_thrust_t packet1, packet2;
2593
        memset(&packet1, 0, sizeof(packet1));
2594
 
2595
                mav_array_memcpy(packet1.roll, packet_in.roll, sizeof(int16_t)*6);
2596
                mav_array_memcpy(packet1.pitch, packet_in.pitch, sizeof(int16_t)*6);
2597
                mav_array_memcpy(packet1.yaw, packet_in.yaw, sizeof(int16_t)*6);
2598
                mav_array_memcpy(packet1.thrust, packet_in.thrust, sizeof(uint16_t)*6);
2599
                mav_array_memcpy(packet1.target_systems, packet_in.target_systems, sizeof(uint8_t)*6);
2600
 
2601
 
2602
        memset(&packet2, 0, sizeof(packet2));
2603
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_encode(system_id, component_id, &msg, &packet1);
2604
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2605
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2606
 
2607
        memset(&packet2, 0, sizeof(packet2));
2608
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_pack(system_id, component_id, &msg , packet1.target_systems , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2609
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2610
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2611
 
2612
        memset(&packet2, 0, sizeof(packet2));
2613
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_systems , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2614
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_decode(&msg, &packet2);
2615
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2616
 
2617
        memset(&packet2, 0, sizeof(packet2));
2618
        mavlink_msg_to_send_buffer(buffer, &msg);
2619
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2620
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2621
        }
2622
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_decode(last_msg, &packet2);
2623
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2624
 
2625
        memset(&packet2, 0, sizeof(packet2));
2626
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_send(MAVLINK_COMM_1 , packet1.target_systems , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust );
2627
        mavlink_msg_set_quad_swarm_roll_pitch_yaw_thrust_decode(last_msg, &packet2);
2628
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2629
}
2630
 
2631
static void mavlink_test_nav_controller_output(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2632
{
2633
        mavlink_message_t msg;
2634
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2635
        uint16_t i;
2636
        mavlink_nav_controller_output_t packet_in = {
2637
                17.0,
2638
        45.0,
2639
        73.0,
2640
        101.0,
2641
        129.0,
2642
        18275,
2643
        18379,
2644
        18483,
2645
        };
2646
        mavlink_nav_controller_output_t packet1, packet2;
2647
        memset(&packet1, 0, sizeof(packet1));
2648
                packet1.nav_roll = packet_in.nav_roll;
2649
                packet1.nav_pitch = packet_in.nav_pitch;
2650
                packet1.alt_error = packet_in.alt_error;
2651
                packet1.aspd_error = packet_in.aspd_error;
2652
                packet1.xtrack_error = packet_in.xtrack_error;
2653
                packet1.nav_bearing = packet_in.nav_bearing;
2654
                packet1.target_bearing = packet_in.target_bearing;
2655
                packet1.wp_dist = packet_in.wp_dist;
2656
 
2657
 
2658
 
2659
        memset(&packet2, 0, sizeof(packet2));
2660
        mavlink_msg_nav_controller_output_encode(system_id, component_id, &msg, &packet1);
2661
        mavlink_msg_nav_controller_output_decode(&msg, &packet2);
2662
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2663
 
2664
        memset(&packet2, 0, sizeof(packet2));
2665
        mavlink_msg_nav_controller_output_pack(system_id, component_id, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
2666
        mavlink_msg_nav_controller_output_decode(&msg, &packet2);
2667
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2668
 
2669
        memset(&packet2, 0, sizeof(packet2));
2670
        mavlink_msg_nav_controller_output_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
2671
        mavlink_msg_nav_controller_output_decode(&msg, &packet2);
2672
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2673
 
2674
        memset(&packet2, 0, sizeof(packet2));
2675
        mavlink_msg_to_send_buffer(buffer, &msg);
2676
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2677
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2678
        }
2679
        mavlink_msg_nav_controller_output_decode(last_msg, &packet2);
2680
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2681
 
2682
        memset(&packet2, 0, sizeof(packet2));
2683
        mavlink_msg_nav_controller_output_send(MAVLINK_COMM_1 , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error );
2684
        mavlink_msg_nav_controller_output_decode(last_msg, &packet2);
2685
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2686
}
2687
 
2688
static void mavlink_test_state_correction(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2689
{
2690
        mavlink_message_t msg;
2691
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2692
        uint16_t i;
2693
        mavlink_state_correction_t packet_in = {
2694
                17.0,
2695
        45.0,
2696
        73.0,
2697
        101.0,
2698
        129.0,
2699
        157.0,
2700
        185.0,
2701
        213.0,
2702
        241.0,
2703
        };
2704
        mavlink_state_correction_t packet1, packet2;
2705
        memset(&packet1, 0, sizeof(packet1));
2706
                packet1.xErr = packet_in.xErr;
2707
                packet1.yErr = packet_in.yErr;
2708
                packet1.zErr = packet_in.zErr;
2709
                packet1.rollErr = packet_in.rollErr;
2710
                packet1.pitchErr = packet_in.pitchErr;
2711
                packet1.yawErr = packet_in.yawErr;
2712
                packet1.vxErr = packet_in.vxErr;
2713
                packet1.vyErr = packet_in.vyErr;
2714
                packet1.vzErr = packet_in.vzErr;
2715
 
2716
 
2717
 
2718
        memset(&packet2, 0, sizeof(packet2));
2719
        mavlink_msg_state_correction_encode(system_id, component_id, &msg, &packet1);
2720
        mavlink_msg_state_correction_decode(&msg, &packet2);
2721
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2722
 
2723
        memset(&packet2, 0, sizeof(packet2));
2724
        mavlink_msg_state_correction_pack(system_id, component_id, &msg , packet1.xErr , packet1.yErr , packet1.zErr , packet1.rollErr , packet1.pitchErr , packet1.yawErr , packet1.vxErr , packet1.vyErr , packet1.vzErr );
2725
        mavlink_msg_state_correction_decode(&msg, &packet2);
2726
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2727
 
2728
        memset(&packet2, 0, sizeof(packet2));
2729
        mavlink_msg_state_correction_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.xErr , packet1.yErr , packet1.zErr , packet1.rollErr , packet1.pitchErr , packet1.yawErr , packet1.vxErr , packet1.vyErr , packet1.vzErr );
2730
        mavlink_msg_state_correction_decode(&msg, &packet2);
2731
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2732
 
2733
        memset(&packet2, 0, sizeof(packet2));
2734
        mavlink_msg_to_send_buffer(buffer, &msg);
2735
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2736
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2737
        }
2738
        mavlink_msg_state_correction_decode(last_msg, &packet2);
2739
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2740
 
2741
        memset(&packet2, 0, sizeof(packet2));
2742
        mavlink_msg_state_correction_send(MAVLINK_COMM_1 , packet1.xErr , packet1.yErr , packet1.zErr , packet1.rollErr , packet1.pitchErr , packet1.yawErr , packet1.vxErr , packet1.vyErr , packet1.vzErr );
2743
        mavlink_msg_state_correction_decode(last_msg, &packet2);
2744
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2745
}
2746
 
2747
static void mavlink_test_request_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2748
{
2749
        mavlink_message_t msg;
2750
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2751
        uint16_t i;
2752
        mavlink_request_data_stream_t packet_in = {
2753
                17235,
2754
        139,
2755
        206,
2756
        17,
2757
        84,
2758
        };
2759
        mavlink_request_data_stream_t packet1, packet2;
2760
        memset(&packet1, 0, sizeof(packet1));
2761
                packet1.req_message_rate = packet_in.req_message_rate;
2762
                packet1.target_system = packet_in.target_system;
2763
                packet1.target_component = packet_in.target_component;
2764
                packet1.req_stream_id = packet_in.req_stream_id;
2765
                packet1.start_stop = packet_in.start_stop;
2766
 
2767
 
2768
 
2769
        memset(&packet2, 0, sizeof(packet2));
2770
        mavlink_msg_request_data_stream_encode(system_id, component_id, &msg, &packet1);
2771
        mavlink_msg_request_data_stream_decode(&msg, &packet2);
2772
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2773
 
2774
        memset(&packet2, 0, sizeof(packet2));
2775
        mavlink_msg_request_data_stream_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
2776
        mavlink_msg_request_data_stream_decode(&msg, &packet2);
2777
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2778
 
2779
        memset(&packet2, 0, sizeof(packet2));
2780
        mavlink_msg_request_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
2781
        mavlink_msg_request_data_stream_decode(&msg, &packet2);
2782
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2783
 
2784
        memset(&packet2, 0, sizeof(packet2));
2785
        mavlink_msg_to_send_buffer(buffer, &msg);
2786
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2787
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2788
        }
2789
        mavlink_msg_request_data_stream_decode(last_msg, &packet2);
2790
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2791
 
2792
        memset(&packet2, 0, sizeof(packet2));
2793
        mavlink_msg_request_data_stream_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop );
2794
        mavlink_msg_request_data_stream_decode(last_msg, &packet2);
2795
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2796
}
2797
 
2798
static void mavlink_test_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2799
{
2800
        mavlink_message_t msg;
2801
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2802
        uint16_t i;
2803
        mavlink_data_stream_t packet_in = {
2804
                17235,
2805
        139,
2806
        206,
2807
        };
2808
        mavlink_data_stream_t packet1, packet2;
2809
        memset(&packet1, 0, sizeof(packet1));
2810
                packet1.message_rate = packet_in.message_rate;
2811
                packet1.stream_id = packet_in.stream_id;
2812
                packet1.on_off = packet_in.on_off;
2813
 
2814
 
2815
 
2816
        memset(&packet2, 0, sizeof(packet2));
2817
        mavlink_msg_data_stream_encode(system_id, component_id, &msg, &packet1);
2818
        mavlink_msg_data_stream_decode(&msg, &packet2);
2819
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2820
 
2821
        memset(&packet2, 0, sizeof(packet2));
2822
        mavlink_msg_data_stream_pack(system_id, component_id, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off );
2823
        mavlink_msg_data_stream_decode(&msg, &packet2);
2824
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2825
 
2826
        memset(&packet2, 0, sizeof(packet2));
2827
        mavlink_msg_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off );
2828
        mavlink_msg_data_stream_decode(&msg, &packet2);
2829
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2830
 
2831
        memset(&packet2, 0, sizeof(packet2));
2832
        mavlink_msg_to_send_buffer(buffer, &msg);
2833
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2834
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2835
        }
2836
        mavlink_msg_data_stream_decode(last_msg, &packet2);
2837
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2838
 
2839
        memset(&packet2, 0, sizeof(packet2));
2840
        mavlink_msg_data_stream_send(MAVLINK_COMM_1 , packet1.stream_id , packet1.message_rate , packet1.on_off );
2841
        mavlink_msg_data_stream_decode(last_msg, &packet2);
2842
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2843
}
2844
 
2845
static void mavlink_test_manual_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2846
{
2847
        mavlink_message_t msg;
2848
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2849
        uint16_t i;
2850
        mavlink_manual_control_t packet_in = {
2851
                17.0,
2852
        45.0,
2853
        73.0,
2854
        101.0,
2855
        53,
2856
        120,
2857
        187,
2858
        254,
2859
        65,
2860
        };
2861
        mavlink_manual_control_t packet1, packet2;
2862
        memset(&packet1, 0, sizeof(packet1));
2863
                packet1.roll = packet_in.roll;
2864
                packet1.pitch = packet_in.pitch;
2865
                packet1.yaw = packet_in.yaw;
2866
                packet1.thrust = packet_in.thrust;
2867
                packet1.target = packet_in.target;
2868
                packet1.roll_manual = packet_in.roll_manual;
2869
                packet1.pitch_manual = packet_in.pitch_manual;
2870
                packet1.yaw_manual = packet_in.yaw_manual;
2871
                packet1.thrust_manual = packet_in.thrust_manual;
2872
 
2873
 
2874
 
2875
        memset(&packet2, 0, sizeof(packet2));
2876
        mavlink_msg_manual_control_encode(system_id, component_id, &msg, &packet1);
2877
        mavlink_msg_manual_control_decode(&msg, &packet2);
2878
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2879
 
2880
        memset(&packet2, 0, sizeof(packet2));
2881
        mavlink_msg_manual_control_pack(system_id, component_id, &msg , packet1.target , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.roll_manual , packet1.pitch_manual , packet1.yaw_manual , packet1.thrust_manual );
2882
        mavlink_msg_manual_control_decode(&msg, &packet2);
2883
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2884
 
2885
        memset(&packet2, 0, sizeof(packet2));
2886
        mavlink_msg_manual_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.roll_manual , packet1.pitch_manual , packet1.yaw_manual , packet1.thrust_manual );
2887
        mavlink_msg_manual_control_decode(&msg, &packet2);
2888
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2889
 
2890
        memset(&packet2, 0, sizeof(packet2));
2891
        mavlink_msg_to_send_buffer(buffer, &msg);
2892
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2893
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2894
        }
2895
        mavlink_msg_manual_control_decode(last_msg, &packet2);
2896
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2897
 
2898
        memset(&packet2, 0, sizeof(packet2));
2899
        mavlink_msg_manual_control_send(MAVLINK_COMM_1 , packet1.target , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.roll_manual , packet1.pitch_manual , packet1.yaw_manual , packet1.thrust_manual );
2900
        mavlink_msg_manual_control_decode(last_msg, &packet2);
2901
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2902
}
2903
 
2904
static void mavlink_test_rc_channels_override(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2905
{
2906
        mavlink_message_t msg;
2907
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2908
        uint16_t i;
2909
        mavlink_rc_channels_override_t packet_in = {
2910
                17235,
2911
        17339,
2912
        17443,
2913
        17547,
2914
        17651,
2915
        17755,
2916
        17859,
2917
        17963,
2918
        53,
2919
        120,
2920
        };
2921
        mavlink_rc_channels_override_t packet1, packet2;
2922
        memset(&packet1, 0, sizeof(packet1));
2923
                packet1.chan1_raw = packet_in.chan1_raw;
2924
                packet1.chan2_raw = packet_in.chan2_raw;
2925
                packet1.chan3_raw = packet_in.chan3_raw;
2926
                packet1.chan4_raw = packet_in.chan4_raw;
2927
                packet1.chan5_raw = packet_in.chan5_raw;
2928
                packet1.chan6_raw = packet_in.chan6_raw;
2929
                packet1.chan7_raw = packet_in.chan7_raw;
2930
                packet1.chan8_raw = packet_in.chan8_raw;
2931
                packet1.target_system = packet_in.target_system;
2932
                packet1.target_component = packet_in.target_component;
2933
 
2934
 
2935
 
2936
        memset(&packet2, 0, sizeof(packet2));
2937
        mavlink_msg_rc_channels_override_encode(system_id, component_id, &msg, &packet1);
2938
        mavlink_msg_rc_channels_override_decode(&msg, &packet2);
2939
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2940
 
2941
        memset(&packet2, 0, sizeof(packet2));
2942
        mavlink_msg_rc_channels_override_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw );
2943
        mavlink_msg_rc_channels_override_decode(&msg, &packet2);
2944
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2945
 
2946
        memset(&packet2, 0, sizeof(packet2));
2947
        mavlink_msg_rc_channels_override_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw );
2948
        mavlink_msg_rc_channels_override_decode(&msg, &packet2);
2949
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2950
 
2951
        memset(&packet2, 0, sizeof(packet2));
2952
        mavlink_msg_to_send_buffer(buffer, &msg);
2953
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
2954
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
2955
        }
2956
        mavlink_msg_rc_channels_override_decode(last_msg, &packet2);
2957
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2958
 
2959
        memset(&packet2, 0, sizeof(packet2));
2960
        mavlink_msg_rc_channels_override_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw );
2961
        mavlink_msg_rc_channels_override_decode(last_msg, &packet2);
2962
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2963
}
2964
 
2965
static void mavlink_test_vfr_hud(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
2966
{
2967
        mavlink_message_t msg;
2968
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
2969
        uint16_t i;
2970
        mavlink_vfr_hud_t packet_in = {
2971
                17.0,
2972
        45.0,
2973
        73.0,
2974
        101.0,
2975
        18067,
2976
        18171,
2977
        };
2978
        mavlink_vfr_hud_t packet1, packet2;
2979
        memset(&packet1, 0, sizeof(packet1));
2980
                packet1.airspeed = packet_in.airspeed;
2981
                packet1.groundspeed = packet_in.groundspeed;
2982
                packet1.alt = packet_in.alt;
2983
                packet1.climb = packet_in.climb;
2984
                packet1.heading = packet_in.heading;
2985
                packet1.throttle = packet_in.throttle;
2986
 
2987
 
2988
 
2989
        memset(&packet2, 0, sizeof(packet2));
2990
        mavlink_msg_vfr_hud_encode(system_id, component_id, &msg, &packet1);
2991
        mavlink_msg_vfr_hud_decode(&msg, &packet2);
2992
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2993
 
2994
        memset(&packet2, 0, sizeof(packet2));
2995
        mavlink_msg_vfr_hud_pack(system_id, component_id, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
2996
        mavlink_msg_vfr_hud_decode(&msg, &packet2);
2997
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
2998
 
2999
        memset(&packet2, 0, sizeof(packet2));
3000
        mavlink_msg_vfr_hud_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
3001
        mavlink_msg_vfr_hud_decode(&msg, &packet2);
3002
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3003
 
3004
        memset(&packet2, 0, sizeof(packet2));
3005
        mavlink_msg_to_send_buffer(buffer, &msg);
3006
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3007
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3008
        }
3009
        mavlink_msg_vfr_hud_decode(last_msg, &packet2);
3010
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3011
 
3012
        memset(&packet2, 0, sizeof(packet2));
3013
        mavlink_msg_vfr_hud_send(MAVLINK_COMM_1 , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb );
3014
        mavlink_msg_vfr_hud_decode(last_msg, &packet2);
3015
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3016
}
3017
 
3018
static void mavlink_test_command_long(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3019
{
3020
        mavlink_message_t msg;
3021
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3022
        uint16_t i;
3023
        mavlink_command_long_t packet_in = {
3024
                17.0,
3025
        45.0,
3026
        73.0,
3027
        101.0,
3028
        129.0,
3029
        157.0,
3030
        185.0,
3031
        18691,
3032
        223,
3033
        34,
3034
        101,
3035
        };
3036
        mavlink_command_long_t packet1, packet2;
3037
        memset(&packet1, 0, sizeof(packet1));
3038
                packet1.param1 = packet_in.param1;
3039
                packet1.param2 = packet_in.param2;
3040
                packet1.param3 = packet_in.param3;
3041
                packet1.param4 = packet_in.param4;
3042
                packet1.param5 = packet_in.param5;
3043
                packet1.param6 = packet_in.param6;
3044
                packet1.param7 = packet_in.param7;
3045
                packet1.command = packet_in.command;
3046
                packet1.target_system = packet_in.target_system;
3047
                packet1.target_component = packet_in.target_component;
3048
                packet1.confirmation = packet_in.confirmation;
3049
 
3050
 
3051
 
3052
        memset(&packet2, 0, sizeof(packet2));
3053
        mavlink_msg_command_long_encode(system_id, component_id, &msg, &packet1);
3054
        mavlink_msg_command_long_decode(&msg, &packet2);
3055
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3056
 
3057
        memset(&packet2, 0, sizeof(packet2));
3058
        mavlink_msg_command_long_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
3059
        mavlink_msg_command_long_decode(&msg, &packet2);
3060
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3061
 
3062
        memset(&packet2, 0, sizeof(packet2));
3063
        mavlink_msg_command_long_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
3064
        mavlink_msg_command_long_decode(&msg, &packet2);
3065
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3066
 
3067
        memset(&packet2, 0, sizeof(packet2));
3068
        mavlink_msg_to_send_buffer(buffer, &msg);
3069
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3070
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3071
        }
3072
        mavlink_msg_command_long_decode(last_msg, &packet2);
3073
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3074
 
3075
        memset(&packet2, 0, sizeof(packet2));
3076
        mavlink_msg_command_long_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 );
3077
        mavlink_msg_command_long_decode(last_msg, &packet2);
3078
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3079
}
3080
 
3081
static void mavlink_test_command_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3082
{
3083
        mavlink_message_t msg;
3084
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3085
        uint16_t i;
3086
        mavlink_command_ack_t packet_in = {
3087
                17235,
3088
        139,
3089
        };
3090
        mavlink_command_ack_t packet1, packet2;
3091
        memset(&packet1, 0, sizeof(packet1));
3092
                packet1.command = packet_in.command;
3093
                packet1.result = packet_in.result;
3094
 
3095
 
3096
 
3097
        memset(&packet2, 0, sizeof(packet2));
3098
        mavlink_msg_command_ack_encode(system_id, component_id, &msg, &packet1);
3099
        mavlink_msg_command_ack_decode(&msg, &packet2);
3100
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3101
 
3102
        memset(&packet2, 0, sizeof(packet2));
3103
        mavlink_msg_command_ack_pack(system_id, component_id, &msg , packet1.command , packet1.result );
3104
        mavlink_msg_command_ack_decode(&msg, &packet2);
3105
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3106
 
3107
        memset(&packet2, 0, sizeof(packet2));
3108
        mavlink_msg_command_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command , packet1.result );
3109
        mavlink_msg_command_ack_decode(&msg, &packet2);
3110
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3111
 
3112
        memset(&packet2, 0, sizeof(packet2));
3113
        mavlink_msg_to_send_buffer(buffer, &msg);
3114
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3115
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3116
        }
3117
        mavlink_msg_command_ack_decode(last_msg, &packet2);
3118
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3119
 
3120
        memset(&packet2, 0, sizeof(packet2));
3121
        mavlink_msg_command_ack_send(MAVLINK_COMM_1 , packet1.command , packet1.result );
3122
        mavlink_msg_command_ack_decode(last_msg, &packet2);
3123
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3124
}
3125
 
3126
static void mavlink_test_local_position_ned_system_global_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3127
{
3128
        mavlink_message_t msg;
3129
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3130
        uint16_t i;
3131
        mavlink_local_position_ned_system_global_offset_t packet_in = {
3132
                963497464,
3133
        45.0,
3134
        73.0,
3135
        101.0,
3136
        129.0,
3137
        157.0,
3138
        185.0,
3139
        };
3140
        mavlink_local_position_ned_system_global_offset_t packet1, packet2;
3141
        memset(&packet1, 0, sizeof(packet1));
3142
                packet1.time_boot_ms = packet_in.time_boot_ms;
3143
                packet1.x = packet_in.x;
3144
                packet1.y = packet_in.y;
3145
                packet1.z = packet_in.z;
3146
                packet1.roll = packet_in.roll;
3147
                packet1.pitch = packet_in.pitch;
3148
                packet1.yaw = packet_in.yaw;
3149
 
3150
 
3151
 
3152
        memset(&packet2, 0, sizeof(packet2));
3153
        mavlink_msg_local_position_ned_system_global_offset_encode(system_id, component_id, &msg, &packet1);
3154
        mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
3155
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3156
 
3157
        memset(&packet2, 0, sizeof(packet2));
3158
        mavlink_msg_local_position_ned_system_global_offset_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3159
        mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
3160
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3161
 
3162
        memset(&packet2, 0, sizeof(packet2));
3163
        mavlink_msg_local_position_ned_system_global_offset_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3164
        mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2);
3165
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3166
 
3167
        memset(&packet2, 0, sizeof(packet2));
3168
        mavlink_msg_to_send_buffer(buffer, &msg);
3169
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3170
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3171
        }
3172
        mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2);
3173
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3174
 
3175
        memset(&packet2, 0, sizeof(packet2));
3176
        mavlink_msg_local_position_ned_system_global_offset_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3177
        mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2);
3178
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3179
}
3180
 
3181
static void mavlink_test_hil_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3182
{
3183
        mavlink_message_t msg;
3184
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3185
        uint16_t i;
3186
        mavlink_hil_state_t packet_in = {
3187
                93372036854775807ULL,
3188
        73.0,
3189
        101.0,
3190
        129.0,
3191
        157.0,
3192
        185.0,
3193
        213.0,
3194
        963499128,
3195
        963499336,
3196
        963499544,
3197
        19523,
3198
        19627,
3199
        19731,
3200
        19835,
3201
        19939,
3202
        20043,
3203
        };
3204
        mavlink_hil_state_t packet1, packet2;
3205
        memset(&packet1, 0, sizeof(packet1));
3206
                packet1.time_usec = packet_in.time_usec;
3207
                packet1.roll = packet_in.roll;
3208
                packet1.pitch = packet_in.pitch;
3209
                packet1.yaw = packet_in.yaw;
3210
                packet1.rollspeed = packet_in.rollspeed;
3211
                packet1.pitchspeed = packet_in.pitchspeed;
3212
                packet1.yawspeed = packet_in.yawspeed;
3213
                packet1.lat = packet_in.lat;
3214
                packet1.lon = packet_in.lon;
3215
                packet1.alt = packet_in.alt;
3216
                packet1.vx = packet_in.vx;
3217
                packet1.vy = packet_in.vy;
3218
                packet1.vz = packet_in.vz;
3219
                packet1.xacc = packet_in.xacc;
3220
                packet1.yacc = packet_in.yacc;
3221
                packet1.zacc = packet_in.zacc;
3222
 
3223
 
3224
 
3225
        memset(&packet2, 0, sizeof(packet2));
3226
        mavlink_msg_hil_state_encode(system_id, component_id, &msg, &packet1);
3227
        mavlink_msg_hil_state_decode(&msg, &packet2);
3228
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3229
 
3230
        memset(&packet2, 0, sizeof(packet2));
3231
        mavlink_msg_hil_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
3232
        mavlink_msg_hil_state_decode(&msg, &packet2);
3233
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3234
 
3235
        memset(&packet2, 0, sizeof(packet2));
3236
        mavlink_msg_hil_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
3237
        mavlink_msg_hil_state_decode(&msg, &packet2);
3238
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3239
 
3240
        memset(&packet2, 0, sizeof(packet2));
3241
        mavlink_msg_to_send_buffer(buffer, &msg);
3242
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3243
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3244
        }
3245
        mavlink_msg_hil_state_decode(last_msg, &packet2);
3246
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3247
 
3248
        memset(&packet2, 0, sizeof(packet2));
3249
        mavlink_msg_hil_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc );
3250
        mavlink_msg_hil_state_decode(last_msg, &packet2);
3251
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3252
}
3253
 
3254
static void mavlink_test_hil_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3255
{
3256
        mavlink_message_t msg;
3257
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3258
        uint16_t i;
3259
        mavlink_hil_controls_t packet_in = {
3260
                93372036854775807ULL,
3261
        73.0,
3262
        101.0,
3263
        129.0,
3264
        157.0,
3265
        185.0,
3266
        213.0,
3267
        241.0,
3268
        269.0,
3269
        125,
3270
        192,
3271
        };
3272
        mavlink_hil_controls_t packet1, packet2;
3273
        memset(&packet1, 0, sizeof(packet1));
3274
                packet1.time_usec = packet_in.time_usec;
3275
                packet1.roll_ailerons = packet_in.roll_ailerons;
3276
                packet1.pitch_elevator = packet_in.pitch_elevator;
3277
                packet1.yaw_rudder = packet_in.yaw_rudder;
3278
                packet1.throttle = packet_in.throttle;
3279
                packet1.aux1 = packet_in.aux1;
3280
                packet1.aux2 = packet_in.aux2;
3281
                packet1.aux3 = packet_in.aux3;
3282
                packet1.aux4 = packet_in.aux4;
3283
                packet1.mode = packet_in.mode;
3284
                packet1.nav_mode = packet_in.nav_mode;
3285
 
3286
 
3287
 
3288
        memset(&packet2, 0, sizeof(packet2));
3289
        mavlink_msg_hil_controls_encode(system_id, component_id, &msg, &packet1);
3290
        mavlink_msg_hil_controls_decode(&msg, &packet2);
3291
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3292
 
3293
        memset(&packet2, 0, sizeof(packet2));
3294
        mavlink_msg_hil_controls_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
3295
        mavlink_msg_hil_controls_decode(&msg, &packet2);
3296
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3297
 
3298
        memset(&packet2, 0, sizeof(packet2));
3299
        mavlink_msg_hil_controls_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
3300
        mavlink_msg_hil_controls_decode(&msg, &packet2);
3301
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3302
 
3303
        memset(&packet2, 0, sizeof(packet2));
3304
        mavlink_msg_to_send_buffer(buffer, &msg);
3305
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3306
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3307
        }
3308
        mavlink_msg_hil_controls_decode(last_msg, &packet2);
3309
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3310
 
3311
        memset(&packet2, 0, sizeof(packet2));
3312
        mavlink_msg_hil_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode );
3313
        mavlink_msg_hil_controls_decode(last_msg, &packet2);
3314
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3315
}
3316
 
3317
static void mavlink_test_hil_rc_inputs_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3318
{
3319
        mavlink_message_t msg;
3320
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3321
        uint16_t i;
3322
        mavlink_hil_rc_inputs_raw_t packet_in = {
3323
                93372036854775807ULL,
3324
        17651,
3325
        17755,
3326
        17859,
3327
        17963,
3328
        18067,
3329
        18171,
3330
        18275,
3331
        18379,
3332
        18483,
3333
        18587,
3334
        18691,
3335
        18795,
3336
        101,
3337
        };
3338
        mavlink_hil_rc_inputs_raw_t packet1, packet2;
3339
        memset(&packet1, 0, sizeof(packet1));
3340
                packet1.time_usec = packet_in.time_usec;
3341
                packet1.chan1_raw = packet_in.chan1_raw;
3342
                packet1.chan2_raw = packet_in.chan2_raw;
3343
                packet1.chan3_raw = packet_in.chan3_raw;
3344
                packet1.chan4_raw = packet_in.chan4_raw;
3345
                packet1.chan5_raw = packet_in.chan5_raw;
3346
                packet1.chan6_raw = packet_in.chan6_raw;
3347
                packet1.chan7_raw = packet_in.chan7_raw;
3348
                packet1.chan8_raw = packet_in.chan8_raw;
3349
                packet1.chan9_raw = packet_in.chan9_raw;
3350
                packet1.chan10_raw = packet_in.chan10_raw;
3351
                packet1.chan11_raw = packet_in.chan11_raw;
3352
                packet1.chan12_raw = packet_in.chan12_raw;
3353
                packet1.rssi = packet_in.rssi;
3354
 
3355
 
3356
 
3357
        memset(&packet2, 0, sizeof(packet2));
3358
        mavlink_msg_hil_rc_inputs_raw_encode(system_id, component_id, &msg, &packet1);
3359
        mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
3360
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3361
 
3362
        memset(&packet2, 0, sizeof(packet2));
3363
        mavlink_msg_hil_rc_inputs_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
3364
        mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
3365
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3366
 
3367
        memset(&packet2, 0, sizeof(packet2));
3368
        mavlink_msg_hil_rc_inputs_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
3369
        mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2);
3370
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3371
 
3372
        memset(&packet2, 0, sizeof(packet2));
3373
        mavlink_msg_to_send_buffer(buffer, &msg);
3374
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3375
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3376
        }
3377
        mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2);
3378
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3379
 
3380
        memset(&packet2, 0, sizeof(packet2));
3381
        mavlink_msg_hil_rc_inputs_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi );
3382
        mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2);
3383
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3384
}
3385
 
3386
static void mavlink_test_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3387
{
3388
        mavlink_message_t msg;
3389
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3390
        uint16_t i;
3391
        mavlink_optical_flow_t packet_in = {
3392
                93372036854775807ULL,
3393
        73.0,
3394
        101.0,
3395
        129.0,
3396
        18275,
3397
        18379,
3398
        77,
3399
        144,
3400
        };
3401
        mavlink_optical_flow_t packet1, packet2;
3402
        memset(&packet1, 0, sizeof(packet1));
3403
                packet1.time_usec = packet_in.time_usec;
3404
                packet1.flow_comp_m_x = packet_in.flow_comp_m_x;
3405
                packet1.flow_comp_m_y = packet_in.flow_comp_m_y;
3406
                packet1.ground_distance = packet_in.ground_distance;
3407
                packet1.flow_x = packet_in.flow_x;
3408
                packet1.flow_y = packet_in.flow_y;
3409
                packet1.sensor_id = packet_in.sensor_id;
3410
                packet1.quality = packet_in.quality;
3411
 
3412
 
3413
 
3414
        memset(&packet2, 0, sizeof(packet2));
3415
        mavlink_msg_optical_flow_encode(system_id, component_id, &msg, &packet1);
3416
        mavlink_msg_optical_flow_decode(&msg, &packet2);
3417
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3418
 
3419
        memset(&packet2, 0, sizeof(packet2));
3420
        mavlink_msg_optical_flow_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance );
3421
        mavlink_msg_optical_flow_decode(&msg, &packet2);
3422
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3423
 
3424
        memset(&packet2, 0, sizeof(packet2));
3425
        mavlink_msg_optical_flow_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance );
3426
        mavlink_msg_optical_flow_decode(&msg, &packet2);
3427
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3428
 
3429
        memset(&packet2, 0, sizeof(packet2));
3430
        mavlink_msg_to_send_buffer(buffer, &msg);
3431
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3432
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3433
        }
3434
        mavlink_msg_optical_flow_decode(last_msg, &packet2);
3435
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3436
 
3437
        memset(&packet2, 0, sizeof(packet2));
3438
        mavlink_msg_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance );
3439
        mavlink_msg_optical_flow_decode(last_msg, &packet2);
3440
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3441
}
3442
 
3443
static void mavlink_test_global_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3444
{
3445
        mavlink_message_t msg;
3446
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3447
        uint16_t i;
3448
        mavlink_global_vision_position_estimate_t packet_in = {
3449
                93372036854775807ULL,
3450
        73.0,
3451
        101.0,
3452
        129.0,
3453
        157.0,
3454
        185.0,
3455
        213.0,
3456
        };
3457
        mavlink_global_vision_position_estimate_t packet1, packet2;
3458
        memset(&packet1, 0, sizeof(packet1));
3459
                packet1.usec = packet_in.usec;
3460
                packet1.x = packet_in.x;
3461
                packet1.y = packet_in.y;
3462
                packet1.z = packet_in.z;
3463
                packet1.roll = packet_in.roll;
3464
                packet1.pitch = packet_in.pitch;
3465
                packet1.yaw = packet_in.yaw;
3466
 
3467
 
3468
 
3469
        memset(&packet2, 0, sizeof(packet2));
3470
        mavlink_msg_global_vision_position_estimate_encode(system_id, component_id, &msg, &packet1);
3471
        mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
3472
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3473
 
3474
        memset(&packet2, 0, sizeof(packet2));
3475
        mavlink_msg_global_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3476
        mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
3477
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3478
 
3479
        memset(&packet2, 0, sizeof(packet2));
3480
        mavlink_msg_global_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3481
        mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2);
3482
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3483
 
3484
        memset(&packet2, 0, sizeof(packet2));
3485
        mavlink_msg_to_send_buffer(buffer, &msg);
3486
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3487
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3488
        }
3489
        mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2);
3490
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3491
 
3492
        memset(&packet2, 0, sizeof(packet2));
3493
        mavlink_msg_global_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3494
        mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2);
3495
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3496
}
3497
 
3498
static void mavlink_test_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3499
{
3500
        mavlink_message_t msg;
3501
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3502
        uint16_t i;
3503
        mavlink_vision_position_estimate_t packet_in = {
3504
                93372036854775807ULL,
3505
        73.0,
3506
        101.0,
3507
        129.0,
3508
        157.0,
3509
        185.0,
3510
        213.0,
3511
        };
3512
        mavlink_vision_position_estimate_t packet1, packet2;
3513
        memset(&packet1, 0, sizeof(packet1));
3514
                packet1.usec = packet_in.usec;
3515
                packet1.x = packet_in.x;
3516
                packet1.y = packet_in.y;
3517
                packet1.z = packet_in.z;
3518
                packet1.roll = packet_in.roll;
3519
                packet1.pitch = packet_in.pitch;
3520
                packet1.yaw = packet_in.yaw;
3521
 
3522
 
3523
 
3524
        memset(&packet2, 0, sizeof(packet2));
3525
        mavlink_msg_vision_position_estimate_encode(system_id, component_id, &msg, &packet1);
3526
        mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
3527
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3528
 
3529
        memset(&packet2, 0, sizeof(packet2));
3530
        mavlink_msg_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3531
        mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
3532
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3533
 
3534
        memset(&packet2, 0, sizeof(packet2));
3535
        mavlink_msg_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3536
        mavlink_msg_vision_position_estimate_decode(&msg, &packet2);
3537
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3538
 
3539
        memset(&packet2, 0, sizeof(packet2));
3540
        mavlink_msg_to_send_buffer(buffer, &msg);
3541
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3542
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3543
        }
3544
        mavlink_msg_vision_position_estimate_decode(last_msg, &packet2);
3545
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3546
 
3547
        memset(&packet2, 0, sizeof(packet2));
3548
        mavlink_msg_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3549
        mavlink_msg_vision_position_estimate_decode(last_msg, &packet2);
3550
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3551
}
3552
 
3553
static void mavlink_test_vision_speed_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3554
{
3555
        mavlink_message_t msg;
3556
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3557
        uint16_t i;
3558
        mavlink_vision_speed_estimate_t packet_in = {
3559
                93372036854775807ULL,
3560
        73.0,
3561
        101.0,
3562
        129.0,
3563
        };
3564
        mavlink_vision_speed_estimate_t packet1, packet2;
3565
        memset(&packet1, 0, sizeof(packet1));
3566
                packet1.usec = packet_in.usec;
3567
                packet1.x = packet_in.x;
3568
                packet1.y = packet_in.y;
3569
                packet1.z = packet_in.z;
3570
 
3571
 
3572
 
3573
        memset(&packet2, 0, sizeof(packet2));
3574
        mavlink_msg_vision_speed_estimate_encode(system_id, component_id, &msg, &packet1);
3575
        mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
3576
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3577
 
3578
        memset(&packet2, 0, sizeof(packet2));
3579
        mavlink_msg_vision_speed_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z );
3580
        mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
3581
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3582
 
3583
        memset(&packet2, 0, sizeof(packet2));
3584
        mavlink_msg_vision_speed_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z );
3585
        mavlink_msg_vision_speed_estimate_decode(&msg, &packet2);
3586
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3587
 
3588
        memset(&packet2, 0, sizeof(packet2));
3589
        mavlink_msg_to_send_buffer(buffer, &msg);
3590
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3591
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3592
        }
3593
        mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2);
3594
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3595
 
3596
        memset(&packet2, 0, sizeof(packet2));
3597
        mavlink_msg_vision_speed_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z );
3598
        mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2);
3599
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3600
}
3601
 
3602
static void mavlink_test_vicon_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3603
{
3604
        mavlink_message_t msg;
3605
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3606
        uint16_t i;
3607
        mavlink_vicon_position_estimate_t packet_in = {
3608
                93372036854775807ULL,
3609
        73.0,
3610
        101.0,
3611
        129.0,
3612
        157.0,
3613
        185.0,
3614
        213.0,
3615
        };
3616
        mavlink_vicon_position_estimate_t packet1, packet2;
3617
        memset(&packet1, 0, sizeof(packet1));
3618
                packet1.usec = packet_in.usec;
3619
                packet1.x = packet_in.x;
3620
                packet1.y = packet_in.y;
3621
                packet1.z = packet_in.z;
3622
                packet1.roll = packet_in.roll;
3623
                packet1.pitch = packet_in.pitch;
3624
                packet1.yaw = packet_in.yaw;
3625
 
3626
 
3627
 
3628
        memset(&packet2, 0, sizeof(packet2));
3629
        mavlink_msg_vicon_position_estimate_encode(system_id, component_id, &msg, &packet1);
3630
        mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
3631
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3632
 
3633
        memset(&packet2, 0, sizeof(packet2));
3634
        mavlink_msg_vicon_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3635
        mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
3636
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3637
 
3638
        memset(&packet2, 0, sizeof(packet2));
3639
        mavlink_msg_vicon_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3640
        mavlink_msg_vicon_position_estimate_decode(&msg, &packet2);
3641
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3642
 
3643
        memset(&packet2, 0, sizeof(packet2));
3644
        mavlink_msg_to_send_buffer(buffer, &msg);
3645
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3646
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3647
        }
3648
        mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2);
3649
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3650
 
3651
        memset(&packet2, 0, sizeof(packet2));
3652
        mavlink_msg_vicon_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
3653
        mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2);
3654
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3655
}
3656
 
3657
static void mavlink_test_memory_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3658
{
3659
        mavlink_message_t msg;
3660
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3661
        uint16_t i;
3662
        mavlink_memory_vect_t packet_in = {
3663
                17235,
3664
        139,
3665
        206,
3666
        { 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 },
3667
        };
3668
        mavlink_memory_vect_t packet1, packet2;
3669
        memset(&packet1, 0, sizeof(packet1));
3670
                packet1.address = packet_in.address;
3671
                packet1.ver = packet_in.ver;
3672
                packet1.type = packet_in.type;
3673
 
3674
                mav_array_memcpy(packet1.value, packet_in.value, sizeof(int8_t)*32);
3675
 
3676
 
3677
        memset(&packet2, 0, sizeof(packet2));
3678
        mavlink_msg_memory_vect_encode(system_id, component_id, &msg, &packet1);
3679
        mavlink_msg_memory_vect_decode(&msg, &packet2);
3680
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3681
 
3682
        memset(&packet2, 0, sizeof(packet2));
3683
        mavlink_msg_memory_vect_pack(system_id, component_id, &msg , packet1.address , packet1.ver , packet1.type , packet1.value );
3684
        mavlink_msg_memory_vect_decode(&msg, &packet2);
3685
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3686
 
3687
        memset(&packet2, 0, sizeof(packet2));
3688
        mavlink_msg_memory_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.ver , packet1.type , packet1.value );
3689
        mavlink_msg_memory_vect_decode(&msg, &packet2);
3690
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3691
 
3692
        memset(&packet2, 0, sizeof(packet2));
3693
        mavlink_msg_to_send_buffer(buffer, &msg);
3694
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3695
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3696
        }
3697
        mavlink_msg_memory_vect_decode(last_msg, &packet2);
3698
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3699
 
3700
        memset(&packet2, 0, sizeof(packet2));
3701
        mavlink_msg_memory_vect_send(MAVLINK_COMM_1 , packet1.address , packet1.ver , packet1.type , packet1.value );
3702
        mavlink_msg_memory_vect_decode(last_msg, &packet2);
3703
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3704
}
3705
 
3706
static void mavlink_test_debug_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3707
{
3708
        mavlink_message_t msg;
3709
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3710
        uint16_t i;
3711
        mavlink_debug_vect_t packet_in = {
3712
                93372036854775807ULL,
3713
        73.0,
3714
        101.0,
3715
        129.0,
3716
        "UVWXYZABC",
3717
        };
3718
        mavlink_debug_vect_t packet1, packet2;
3719
        memset(&packet1, 0, sizeof(packet1));
3720
                packet1.time_usec = packet_in.time_usec;
3721
                packet1.x = packet_in.x;
3722
                packet1.y = packet_in.y;
3723
                packet1.z = packet_in.z;
3724
 
3725
                mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
3726
 
3727
 
3728
        memset(&packet2, 0, sizeof(packet2));
3729
        mavlink_msg_debug_vect_encode(system_id, component_id, &msg, &packet1);
3730
        mavlink_msg_debug_vect_decode(&msg, &packet2);
3731
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3732
 
3733
        memset(&packet2, 0, sizeof(packet2));
3734
        mavlink_msg_debug_vect_pack(system_id, component_id, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
3735
        mavlink_msg_debug_vect_decode(&msg, &packet2);
3736
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3737
 
3738
        memset(&packet2, 0, sizeof(packet2));
3739
        mavlink_msg_debug_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
3740
        mavlink_msg_debug_vect_decode(&msg, &packet2);
3741
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3742
 
3743
        memset(&packet2, 0, sizeof(packet2));
3744
        mavlink_msg_to_send_buffer(buffer, &msg);
3745
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3746
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3747
        }
3748
        mavlink_msg_debug_vect_decode(last_msg, &packet2);
3749
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3750
 
3751
        memset(&packet2, 0, sizeof(packet2));
3752
        mavlink_msg_debug_vect_send(MAVLINK_COMM_1 , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z );
3753
        mavlink_msg_debug_vect_decode(last_msg, &packet2);
3754
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3755
}
3756
 
3757
static void mavlink_test_named_value_float(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3758
{
3759
        mavlink_message_t msg;
3760
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3761
        uint16_t i;
3762
        mavlink_named_value_float_t packet_in = {
3763
                963497464,
3764
        45.0,
3765
        "IJKLMNOPQ",
3766
        };
3767
        mavlink_named_value_float_t packet1, packet2;
3768
        memset(&packet1, 0, sizeof(packet1));
3769
                packet1.time_boot_ms = packet_in.time_boot_ms;
3770
                packet1.value = packet_in.value;
3771
 
3772
                mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
3773
 
3774
 
3775
        memset(&packet2, 0, sizeof(packet2));
3776
        mavlink_msg_named_value_float_encode(system_id, component_id, &msg, &packet1);
3777
        mavlink_msg_named_value_float_decode(&msg, &packet2);
3778
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3779
 
3780
        memset(&packet2, 0, sizeof(packet2));
3781
        mavlink_msg_named_value_float_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
3782
        mavlink_msg_named_value_float_decode(&msg, &packet2);
3783
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3784
 
3785
        memset(&packet2, 0, sizeof(packet2));
3786
        mavlink_msg_named_value_float_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
3787
        mavlink_msg_named_value_float_decode(&msg, &packet2);
3788
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3789
 
3790
        memset(&packet2, 0, sizeof(packet2));
3791
        mavlink_msg_to_send_buffer(buffer, &msg);
3792
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3793
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3794
        }
3795
        mavlink_msg_named_value_float_decode(last_msg, &packet2);
3796
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3797
 
3798
        memset(&packet2, 0, sizeof(packet2));
3799
        mavlink_msg_named_value_float_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value );
3800
        mavlink_msg_named_value_float_decode(last_msg, &packet2);
3801
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3802
}
3803
 
3804
static void mavlink_test_named_value_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3805
{
3806
        mavlink_message_t msg;
3807
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3808
        uint16_t i;
3809
        mavlink_named_value_int_t packet_in = {
3810
                963497464,
3811
        963497672,
3812
        "IJKLMNOPQ",
3813
        };
3814
        mavlink_named_value_int_t packet1, packet2;
3815
        memset(&packet1, 0, sizeof(packet1));
3816
                packet1.time_boot_ms = packet_in.time_boot_ms;
3817
                packet1.value = packet_in.value;
3818
 
3819
                mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10);
3820
 
3821
 
3822
        memset(&packet2, 0, sizeof(packet2));
3823
        mavlink_msg_named_value_int_encode(system_id, component_id, &msg, &packet1);
3824
        mavlink_msg_named_value_int_decode(&msg, &packet2);
3825
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3826
 
3827
        memset(&packet2, 0, sizeof(packet2));
3828
        mavlink_msg_named_value_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
3829
        mavlink_msg_named_value_int_decode(&msg, &packet2);
3830
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3831
 
3832
        memset(&packet2, 0, sizeof(packet2));
3833
        mavlink_msg_named_value_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value );
3834
        mavlink_msg_named_value_int_decode(&msg, &packet2);
3835
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3836
 
3837
        memset(&packet2, 0, sizeof(packet2));
3838
        mavlink_msg_to_send_buffer(buffer, &msg);
3839
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3840
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3841
        }
3842
        mavlink_msg_named_value_int_decode(last_msg, &packet2);
3843
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3844
 
3845
        memset(&packet2, 0, sizeof(packet2));
3846
        mavlink_msg_named_value_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value );
3847
        mavlink_msg_named_value_int_decode(last_msg, &packet2);
3848
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3849
}
3850
 
3851
static void mavlink_test_statustext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3852
{
3853
        mavlink_message_t msg;
3854
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3855
        uint16_t i;
3856
        mavlink_statustext_t packet_in = {
3857
                5,
3858
        "BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX",
3859
        };
3860
        mavlink_statustext_t packet1, packet2;
3861
        memset(&packet1, 0, sizeof(packet1));
3862
                packet1.severity = packet_in.severity;
3863
 
3864
                mav_array_memcpy(packet1.text, packet_in.text, sizeof(char)*50);
3865
 
3866
 
3867
        memset(&packet2, 0, sizeof(packet2));
3868
        mavlink_msg_statustext_encode(system_id, component_id, &msg, &packet1);
3869
        mavlink_msg_statustext_decode(&msg, &packet2);
3870
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3871
 
3872
        memset(&packet2, 0, sizeof(packet2));
3873
        mavlink_msg_statustext_pack(system_id, component_id, &msg , packet1.severity , packet1.text );
3874
        mavlink_msg_statustext_decode(&msg, &packet2);
3875
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3876
 
3877
        memset(&packet2, 0, sizeof(packet2));
3878
        mavlink_msg_statustext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.severity , packet1.text );
3879
        mavlink_msg_statustext_decode(&msg, &packet2);
3880
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3881
 
3882
        memset(&packet2, 0, sizeof(packet2));
3883
        mavlink_msg_to_send_buffer(buffer, &msg);
3884
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3885
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3886
        }
3887
        mavlink_msg_statustext_decode(last_msg, &packet2);
3888
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3889
 
3890
        memset(&packet2, 0, sizeof(packet2));
3891
        mavlink_msg_statustext_send(MAVLINK_COMM_1 , packet1.severity , packet1.text );
3892
        mavlink_msg_statustext_decode(last_msg, &packet2);
3893
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3894
}
3895
 
3896
static void mavlink_test_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3897
{
3898
        mavlink_message_t msg;
3899
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
3900
        uint16_t i;
3901
        mavlink_debug_t packet_in = {
3902
                963497464,
3903
        45.0,
3904
        29,
3905
        };
3906
        mavlink_debug_t packet1, packet2;
3907
        memset(&packet1, 0, sizeof(packet1));
3908
                packet1.time_boot_ms = packet_in.time_boot_ms;
3909
                packet1.value = packet_in.value;
3910
                packet1.ind = packet_in.ind;
3911
 
3912
 
3913
 
3914
        memset(&packet2, 0, sizeof(packet2));
3915
        mavlink_msg_debug_encode(system_id, component_id, &msg, &packet1);
3916
        mavlink_msg_debug_decode(&msg, &packet2);
3917
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3918
 
3919
        memset(&packet2, 0, sizeof(packet2));
3920
        mavlink_msg_debug_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.ind , packet1.value );
3921
        mavlink_msg_debug_decode(&msg, &packet2);
3922
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3923
 
3924
        memset(&packet2, 0, sizeof(packet2));
3925
        mavlink_msg_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.ind , packet1.value );
3926
        mavlink_msg_debug_decode(&msg, &packet2);
3927
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3928
 
3929
        memset(&packet2, 0, sizeof(packet2));
3930
        mavlink_msg_to_send_buffer(buffer, &msg);
3931
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
3932
                comm_send_ch(MAVLINK_COMM_0, buffer[i]);
3933
        }
3934
        mavlink_msg_debug_decode(last_msg, &packet2);
3935
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3936
 
3937
        memset(&packet2, 0, sizeof(packet2));
3938
        mavlink_msg_debug_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.ind , packet1.value );
3939
        mavlink_msg_debug_decode(last_msg, &packet2);
3940
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
3941
}
3942
 
3943
static void mavlink_test_common(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
3944
{
3945
        mavlink_test_heartbeat(system_id, component_id, last_msg);
3946
        mavlink_test_sys_status(system_id, component_id, last_msg);
3947
        mavlink_test_system_time(system_id, component_id, last_msg);
3948
        mavlink_test_ping(system_id, component_id, last_msg);
3949
        mavlink_test_change_operator_control(system_id, component_id, last_msg);
3950
        mavlink_test_change_operator_control_ack(system_id, component_id, last_msg);
3951
        mavlink_test_auth_key(system_id, component_id, last_msg);
3952
        mavlink_test_set_mode(system_id, component_id, last_msg);
3953
        mavlink_test_param_request_read(system_id, component_id, last_msg);
3954
        mavlink_test_param_request_list(system_id, component_id, last_msg);
3955
        mavlink_test_param_value(system_id, component_id, last_msg);
3956
        mavlink_test_param_set(system_id, component_id, last_msg);
3957
        mavlink_test_gps_raw_int(system_id, component_id, last_msg);
3958
        mavlink_test_gps_status(system_id, component_id, last_msg);
3959
        mavlink_test_scaled_imu(system_id, component_id, last_msg);
3960
        mavlink_test_raw_imu(system_id, component_id, last_msg);
3961
        mavlink_test_raw_pressure(system_id, component_id, last_msg);
3962
        mavlink_test_scaled_pressure(system_id, component_id, last_msg);
3963
        mavlink_test_attitude(system_id, component_id, last_msg);
3964
        mavlink_test_attitude_quaternion(system_id, component_id, last_msg);
3965
        mavlink_test_local_position_ned(system_id, component_id, last_msg);
3966
        mavlink_test_global_position_int(system_id, component_id, last_msg);
3967
        mavlink_test_rc_channels_scaled(system_id, component_id, last_msg);
3968
        mavlink_test_rc_channels_raw(system_id, component_id, last_msg);
3969
        mavlink_test_servo_output_raw(system_id, component_id, last_msg);
3970
        mavlink_test_mission_request_partial_list(system_id, component_id, last_msg);
3971
        mavlink_test_mission_write_partial_list(system_id, component_id, last_msg);
3972
        mavlink_test_mission_item(system_id, component_id, last_msg);
3973
        mavlink_test_mission_request(system_id, component_id, last_msg);
3974
        mavlink_test_mission_set_current(system_id, component_id, last_msg);
3975
        mavlink_test_mission_current(system_id, component_id, last_msg);
3976
        mavlink_test_mission_request_list(system_id, component_id, last_msg);
3977
        mavlink_test_mission_count(system_id, component_id, last_msg);
3978
        mavlink_test_mission_clear_all(system_id, component_id, last_msg);
3979
        mavlink_test_mission_item_reached(system_id, component_id, last_msg);
3980
        mavlink_test_mission_ack(system_id, component_id, last_msg);
3981
        mavlink_test_set_gps_global_origin(system_id, component_id, last_msg);
3982
        mavlink_test_gps_global_origin(system_id, component_id, last_msg);
3983
        mavlink_test_set_local_position_setpoint(system_id, component_id, last_msg);
3984
        mavlink_test_local_position_setpoint(system_id, component_id, last_msg);
3985
        mavlink_test_global_position_setpoint_int(system_id, component_id, last_msg);
3986
        mavlink_test_set_global_position_setpoint_int(system_id, component_id, last_msg);
3987
        mavlink_test_safety_set_allowed_area(system_id, component_id, last_msg);
3988
        mavlink_test_safety_allowed_area(system_id, component_id, last_msg);
3989
        mavlink_test_set_roll_pitch_yaw_thrust(system_id, component_id, last_msg);
3990
        mavlink_test_set_roll_pitch_yaw_speed_thrust(system_id, component_id, last_msg);
3991
        mavlink_test_roll_pitch_yaw_thrust_setpoint(system_id, component_id, last_msg);
3992
        mavlink_test_roll_pitch_yaw_speed_thrust_setpoint(system_id, component_id, last_msg);
3993
        mavlink_test_set_quad_motors_setpoint(system_id, component_id, last_msg);
3994
        mavlink_test_set_quad_swarm_roll_pitch_yaw_thrust(system_id, component_id, last_msg);
3995
        mavlink_test_nav_controller_output(system_id, component_id, last_msg);
3996
        mavlink_test_state_correction(system_id, component_id, last_msg);
3997
        mavlink_test_request_data_stream(system_id, component_id, last_msg);
3998
        mavlink_test_data_stream(system_id, component_id, last_msg);
3999
        mavlink_test_manual_control(system_id, component_id, last_msg);
4000
        mavlink_test_rc_channels_override(system_id, component_id, last_msg);
4001
        mavlink_test_vfr_hud(system_id, component_id, last_msg);
4002
        mavlink_test_command_long(system_id, component_id, last_msg);
4003
        mavlink_test_command_ack(system_id, component_id, last_msg);
4004
        mavlink_test_local_position_ned_system_global_offset(system_id, component_id, last_msg);
4005
        mavlink_test_hil_state(system_id, component_id, last_msg);
4006
        mavlink_test_hil_controls(system_id, component_id, last_msg);
4007
        mavlink_test_hil_rc_inputs_raw(system_id, component_id, last_msg);
4008
        mavlink_test_optical_flow(system_id, component_id, last_msg);
4009
        mavlink_test_global_vision_position_estimate(system_id, component_id, last_msg);
4010
        mavlink_test_vision_position_estimate(system_id, component_id, last_msg);
4011
        mavlink_test_vision_speed_estimate(system_id, component_id, last_msg);
4012
        mavlink_test_vicon_position_estimate(system_id, component_id, last_msg);
4013
        mavlink_test_memory_vect(system_id, component_id, last_msg);
4014
        mavlink_test_debug_vect(system_id, component_id, last_msg);
4015
        mavlink_test_named_value_float(system_id, component_id, last_msg);
4016
        mavlink_test_named_value_int(system_id, component_id, last_msg);
4017
        mavlink_test_statustext(system_id, component_id, last_msg);
4018
        mavlink_test_debug(system_id, component_id, last_msg);
4019
}
4020
 
4021
#ifdef __cplusplus
4022
}
4023
#endif // __cplusplus
4024
#endif // COMMON_TESTSUITE_H