NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
testsuite.h
Go to the documentation of this file.
1 
5 #ifndef SLUGS_TESTSUITE_H
6 #define SLUGS_TESTSUITE_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #ifndef MAVLINK_TEST_ALL
13 #define MAVLINK_TEST_ALL
14 static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
15 static void mavlink_test_slugs(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  mavlink_test_common(system_id, component_id, last_msg);
20  mavlink_test_slugs(system_id, component_id, last_msg);
21 }
22 #endif
23 
24 #include "../common/testsuite.h"
25 
26 
27 static void mavlink_test_cpu_load(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_cpu_load_t packet_in = {
33  17235,139,206
34  };
35  mavlink_cpu_load_t packet1, packet2;
36  memset(&packet1, 0, sizeof(packet1));
37  packet1.batVolt = packet_in.batVolt;
38  packet1.sensLoad = packet_in.sensLoad;
39  packet1.ctrlLoad = packet_in.ctrlLoad;
40 
41 
42 
43  memset(&packet2, 0, sizeof(packet2));
44  mavlink_msg_cpu_load_encode(system_id, component_id, &msg, &packet1);
45  mavlink_msg_cpu_load_decode(&msg, &packet2);
46  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
47 
48  memset(&packet2, 0, sizeof(packet2));
49  mavlink_msg_cpu_load_pack(system_id, component_id, &msg , packet1.sensLoad , packet1.ctrlLoad , packet1.batVolt );
50  mavlink_msg_cpu_load_decode(&msg, &packet2);
51  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
52 
53  memset(&packet2, 0, sizeof(packet2));
54  mavlink_msg_cpu_load_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.sensLoad , packet1.ctrlLoad , packet1.batVolt );
55  mavlink_msg_cpu_load_decode(&msg, &packet2);
56  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
57 
58  memset(&packet2, 0, sizeof(packet2));
59  mavlink_msg_to_send_buffer(buffer, &msg);
60  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
61  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
62  }
63  mavlink_msg_cpu_load_decode(last_msg, &packet2);
64  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
65 
66  memset(&packet2, 0, sizeof(packet2));
67  mavlink_msg_cpu_load_send(MAVLINK_COMM_1 , packet1.sensLoad , packet1.ctrlLoad , packet1.batVolt );
68  mavlink_msg_cpu_load_decode(last_msg, &packet2);
69  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
70 }
71 
72 static void mavlink_test_sensor_bias(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
73 {
74  mavlink_message_t msg;
75  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
76  uint16_t i;
77  mavlink_sensor_bias_t packet_in = {
78  17.0,45.0,73.0,101.0,129.0,157.0
79  };
80  mavlink_sensor_bias_t packet1, packet2;
81  memset(&packet1, 0, sizeof(packet1));
82  packet1.axBias = packet_in.axBias;
83  packet1.ayBias = packet_in.ayBias;
84  packet1.azBias = packet_in.azBias;
85  packet1.gxBias = packet_in.gxBias;
86  packet1.gyBias = packet_in.gyBias;
87  packet1.gzBias = packet_in.gzBias;
88 
89 
90 
91  memset(&packet2, 0, sizeof(packet2));
92  mavlink_msg_sensor_bias_encode(system_id, component_id, &msg, &packet1);
93  mavlink_msg_sensor_bias_decode(&msg, &packet2);
94  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
95 
96  memset(&packet2, 0, sizeof(packet2));
97  mavlink_msg_sensor_bias_pack(system_id, component_id, &msg , packet1.axBias , packet1.ayBias , packet1.azBias , packet1.gxBias , packet1.gyBias , packet1.gzBias );
98  mavlink_msg_sensor_bias_decode(&msg, &packet2);
99  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
100 
101  memset(&packet2, 0, sizeof(packet2));
102  mavlink_msg_sensor_bias_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.axBias , packet1.ayBias , packet1.azBias , packet1.gxBias , packet1.gyBias , packet1.gzBias );
103  mavlink_msg_sensor_bias_decode(&msg, &packet2);
104  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
105 
106  memset(&packet2, 0, sizeof(packet2));
107  mavlink_msg_to_send_buffer(buffer, &msg);
108  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
109  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
110  }
111  mavlink_msg_sensor_bias_decode(last_msg, &packet2);
112  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
113 
114  memset(&packet2, 0, sizeof(packet2));
115  mavlink_msg_sensor_bias_send(MAVLINK_COMM_1 , packet1.axBias , packet1.ayBias , packet1.azBias , packet1.gxBias , packet1.gyBias , packet1.gzBias );
116  mavlink_msg_sensor_bias_decode(last_msg, &packet2);
117  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
118 }
119 
120 static void mavlink_test_diagnostic(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
121 {
122  mavlink_message_t msg;
123  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
124  uint16_t i;
125  mavlink_diagnostic_t packet_in = {
126  17.0,45.0,73.0,17859,17963,18067
127  };
128  mavlink_diagnostic_t packet1, packet2;
129  memset(&packet1, 0, sizeof(packet1));
130  packet1.diagFl1 = packet_in.diagFl1;
131  packet1.diagFl2 = packet_in.diagFl2;
132  packet1.diagFl3 = packet_in.diagFl3;
133  packet1.diagSh1 = packet_in.diagSh1;
134  packet1.diagSh2 = packet_in.diagSh2;
135  packet1.diagSh3 = packet_in.diagSh3;
136 
137 
138 
139  memset(&packet2, 0, sizeof(packet2));
140  mavlink_msg_diagnostic_encode(system_id, component_id, &msg, &packet1);
141  mavlink_msg_diagnostic_decode(&msg, &packet2);
142  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
143 
144  memset(&packet2, 0, sizeof(packet2));
145  mavlink_msg_diagnostic_pack(system_id, component_id, &msg , packet1.diagFl1 , packet1.diagFl2 , packet1.diagFl3 , packet1.diagSh1 , packet1.diagSh2 , packet1.diagSh3 );
146  mavlink_msg_diagnostic_decode(&msg, &packet2);
147  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
148 
149  memset(&packet2, 0, sizeof(packet2));
150  mavlink_msg_diagnostic_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.diagFl1 , packet1.diagFl2 , packet1.diagFl3 , packet1.diagSh1 , packet1.diagSh2 , packet1.diagSh3 );
151  mavlink_msg_diagnostic_decode(&msg, &packet2);
152  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
153 
154  memset(&packet2, 0, sizeof(packet2));
155  mavlink_msg_to_send_buffer(buffer, &msg);
156  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
157  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
158  }
159  mavlink_msg_diagnostic_decode(last_msg, &packet2);
160  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
161 
162  memset(&packet2, 0, sizeof(packet2));
163  mavlink_msg_diagnostic_send(MAVLINK_COMM_1 , packet1.diagFl1 , packet1.diagFl2 , packet1.diagFl3 , packet1.diagSh1 , packet1.diagSh2 , packet1.diagSh3 );
164  mavlink_msg_diagnostic_decode(last_msg, &packet2);
165  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
166 }
167 
168 static void mavlink_test_slugs_navigation(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
169 {
170  mavlink_message_t msg;
171  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
172  uint16_t i;
173  mavlink_slugs_navigation_t packet_in = {
174  17.0,45.0,73.0,101.0,129.0,157.0,185.0,18691,223,34
175  };
176  mavlink_slugs_navigation_t packet1, packet2;
177  memset(&packet1, 0, sizeof(packet1));
178  packet1.u_m = packet_in.u_m;
179  packet1.phi_c = packet_in.phi_c;
180  packet1.theta_c = packet_in.theta_c;
181  packet1.psiDot_c = packet_in.psiDot_c;
182  packet1.ay_body = packet_in.ay_body;
183  packet1.totalDist = packet_in.totalDist;
184  packet1.dist2Go = packet_in.dist2Go;
185  packet1.h_c = packet_in.h_c;
186  packet1.fromWP = packet_in.fromWP;
187  packet1.toWP = packet_in.toWP;
188 
189 
190 
191  memset(&packet2, 0, sizeof(packet2));
192  mavlink_msg_slugs_navigation_encode(system_id, component_id, &msg, &packet1);
193  mavlink_msg_slugs_navigation_decode(&msg, &packet2);
194  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
195 
196  memset(&packet2, 0, sizeof(packet2));
197  mavlink_msg_slugs_navigation_pack(system_id, component_id, &msg , packet1.u_m , packet1.phi_c , packet1.theta_c , packet1.psiDot_c , packet1.ay_body , packet1.totalDist , packet1.dist2Go , packet1.fromWP , packet1.toWP , packet1.h_c );
198  mavlink_msg_slugs_navigation_decode(&msg, &packet2);
199  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
200 
201  memset(&packet2, 0, sizeof(packet2));
202  mavlink_msg_slugs_navigation_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.u_m , packet1.phi_c , packet1.theta_c , packet1.psiDot_c , packet1.ay_body , packet1.totalDist , packet1.dist2Go , packet1.fromWP , packet1.toWP , packet1.h_c );
203  mavlink_msg_slugs_navigation_decode(&msg, &packet2);
204  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
205 
206  memset(&packet2, 0, sizeof(packet2));
207  mavlink_msg_to_send_buffer(buffer, &msg);
208  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
209  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
210  }
211  mavlink_msg_slugs_navigation_decode(last_msg, &packet2);
212  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
213 
214  memset(&packet2, 0, sizeof(packet2));
215  mavlink_msg_slugs_navigation_send(MAVLINK_COMM_1 , packet1.u_m , packet1.phi_c , packet1.theta_c , packet1.psiDot_c , packet1.ay_body , packet1.totalDist , packet1.dist2Go , packet1.fromWP , packet1.toWP , packet1.h_c );
216  mavlink_msg_slugs_navigation_decode(last_msg, &packet2);
217  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
218 }
219 
220 static void mavlink_test_data_log(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
221 {
222  mavlink_message_t msg;
223  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
224  uint16_t i;
225  mavlink_data_log_t packet_in = {
226  17.0,45.0,73.0,101.0,129.0,157.0
227  };
228  mavlink_data_log_t packet1, packet2;
229  memset(&packet1, 0, sizeof(packet1));
230  packet1.fl_1 = packet_in.fl_1;
231  packet1.fl_2 = packet_in.fl_2;
232  packet1.fl_3 = packet_in.fl_3;
233  packet1.fl_4 = packet_in.fl_4;
234  packet1.fl_5 = packet_in.fl_5;
235  packet1.fl_6 = packet_in.fl_6;
236 
237 
238 
239  memset(&packet2, 0, sizeof(packet2));
240  mavlink_msg_data_log_encode(system_id, component_id, &msg, &packet1);
241  mavlink_msg_data_log_decode(&msg, &packet2);
242  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
243 
244  memset(&packet2, 0, sizeof(packet2));
245  mavlink_msg_data_log_pack(system_id, component_id, &msg , packet1.fl_1 , packet1.fl_2 , packet1.fl_3 , packet1.fl_4 , packet1.fl_5 , packet1.fl_6 );
246  mavlink_msg_data_log_decode(&msg, &packet2);
247  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
248 
249  memset(&packet2, 0, sizeof(packet2));
250  mavlink_msg_data_log_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.fl_1 , packet1.fl_2 , packet1.fl_3 , packet1.fl_4 , packet1.fl_5 , packet1.fl_6 );
251  mavlink_msg_data_log_decode(&msg, &packet2);
252  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
253 
254  memset(&packet2, 0, sizeof(packet2));
255  mavlink_msg_to_send_buffer(buffer, &msg);
256  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
257  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
258  }
259  mavlink_msg_data_log_decode(last_msg, &packet2);
260  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
261 
262  memset(&packet2, 0, sizeof(packet2));
263  mavlink_msg_data_log_send(MAVLINK_COMM_1 , packet1.fl_1 , packet1.fl_2 , packet1.fl_3 , packet1.fl_4 , packet1.fl_5 , packet1.fl_6 );
264  mavlink_msg_data_log_decode(last_msg, &packet2);
265  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
266 }
267 
268 static void mavlink_test_gps_date_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
269 {
270  mavlink_message_t msg;
271  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
272  uint16_t i;
273  mavlink_gps_date_time_t packet_in = {
274  5,72,139,206,17,84,151,218,29,96,163,230
275  };
276  mavlink_gps_date_time_t packet1, packet2;
277  memset(&packet1, 0, sizeof(packet1));
278  packet1.year = packet_in.year;
279  packet1.month = packet_in.month;
280  packet1.day = packet_in.day;
281  packet1.hour = packet_in.hour;
282  packet1.min = packet_in.min;
283  packet1.sec = packet_in.sec;
284  packet1.clockStat = packet_in.clockStat;
285  packet1.visSat = packet_in.visSat;
286  packet1.useSat = packet_in.useSat;
287  packet1.GppGl = packet_in.GppGl;
288  packet1.sigUsedMask = packet_in.sigUsedMask;
289  packet1.percentUsed = packet_in.percentUsed;
290 
291 
292 
293  memset(&packet2, 0, sizeof(packet2));
294  mavlink_msg_gps_date_time_encode(system_id, component_id, &msg, &packet1);
295  mavlink_msg_gps_date_time_decode(&msg, &packet2);
296  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
297 
298  memset(&packet2, 0, sizeof(packet2));
299  mavlink_msg_gps_date_time_pack(system_id, component_id, &msg , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.clockStat , packet1.visSat , packet1.useSat , packet1.GppGl , packet1.sigUsedMask , packet1.percentUsed );
300  mavlink_msg_gps_date_time_decode(&msg, &packet2);
301  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
302 
303  memset(&packet2, 0, sizeof(packet2));
304  mavlink_msg_gps_date_time_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.clockStat , packet1.visSat , packet1.useSat , packet1.GppGl , packet1.sigUsedMask , packet1.percentUsed );
305  mavlink_msg_gps_date_time_decode(&msg, &packet2);
306  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
307 
308  memset(&packet2, 0, sizeof(packet2));
309  mavlink_msg_to_send_buffer(buffer, &msg);
310  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
311  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
312  }
313  mavlink_msg_gps_date_time_decode(last_msg, &packet2);
314  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
315 
316  memset(&packet2, 0, sizeof(packet2));
317  mavlink_msg_gps_date_time_send(MAVLINK_COMM_1 , packet1.year , packet1.month , packet1.day , packet1.hour , packet1.min , packet1.sec , packet1.clockStat , packet1.visSat , packet1.useSat , packet1.GppGl , packet1.sigUsedMask , packet1.percentUsed );
318  mavlink_msg_gps_date_time_decode(last_msg, &packet2);
319  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
320 }
321 
322 static void mavlink_test_mid_lvl_cmds(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
323 {
324  mavlink_message_t msg;
325  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
326  uint16_t i;
327  mavlink_mid_lvl_cmds_t packet_in = {
328  17.0,45.0,73.0,41
329  };
330  mavlink_mid_lvl_cmds_t packet1, packet2;
331  memset(&packet1, 0, sizeof(packet1));
332  packet1.hCommand = packet_in.hCommand;
333  packet1.uCommand = packet_in.uCommand;
334  packet1.rCommand = packet_in.rCommand;
335  packet1.target = packet_in.target;
336 
337 
338 
339  memset(&packet2, 0, sizeof(packet2));
340  mavlink_msg_mid_lvl_cmds_encode(system_id, component_id, &msg, &packet1);
341  mavlink_msg_mid_lvl_cmds_decode(&msg, &packet2);
342  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
343 
344  memset(&packet2, 0, sizeof(packet2));
345  mavlink_msg_mid_lvl_cmds_pack(system_id, component_id, &msg , packet1.target , packet1.hCommand , packet1.uCommand , packet1.rCommand );
346  mavlink_msg_mid_lvl_cmds_decode(&msg, &packet2);
347  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
348 
349  memset(&packet2, 0, sizeof(packet2));
350  mavlink_msg_mid_lvl_cmds_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.hCommand , packet1.uCommand , packet1.rCommand );
351  mavlink_msg_mid_lvl_cmds_decode(&msg, &packet2);
352  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
353 
354  memset(&packet2, 0, sizeof(packet2));
355  mavlink_msg_to_send_buffer(buffer, &msg);
356  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
357  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
358  }
359  mavlink_msg_mid_lvl_cmds_decode(last_msg, &packet2);
360  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
361 
362  memset(&packet2, 0, sizeof(packet2));
363  mavlink_msg_mid_lvl_cmds_send(MAVLINK_COMM_1 , packet1.target , packet1.hCommand , packet1.uCommand , packet1.rCommand );
364  mavlink_msg_mid_lvl_cmds_decode(last_msg, &packet2);
365  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
366 }
367 
368 static void mavlink_test_ctrl_srfc_pt(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
369 {
370  mavlink_message_t msg;
371  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
372  uint16_t i;
373  mavlink_ctrl_srfc_pt_t packet_in = {
374  17235,139
375  };
376  mavlink_ctrl_srfc_pt_t packet1, packet2;
377  memset(&packet1, 0, sizeof(packet1));
378  packet1.bitfieldPt = packet_in.bitfieldPt;
379  packet1.target = packet_in.target;
380 
381 
382 
383  memset(&packet2, 0, sizeof(packet2));
384  mavlink_msg_ctrl_srfc_pt_encode(system_id, component_id, &msg, &packet1);
385  mavlink_msg_ctrl_srfc_pt_decode(&msg, &packet2);
386  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
387 
388  memset(&packet2, 0, sizeof(packet2));
389  mavlink_msg_ctrl_srfc_pt_pack(system_id, component_id, &msg , packet1.target , packet1.bitfieldPt );
390  mavlink_msg_ctrl_srfc_pt_decode(&msg, &packet2);
391  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
392 
393  memset(&packet2, 0, sizeof(packet2));
394  mavlink_msg_ctrl_srfc_pt_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.bitfieldPt );
395  mavlink_msg_ctrl_srfc_pt_decode(&msg, &packet2);
396  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
397 
398  memset(&packet2, 0, sizeof(packet2));
399  mavlink_msg_to_send_buffer(buffer, &msg);
400  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
401  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
402  }
403  mavlink_msg_ctrl_srfc_pt_decode(last_msg, &packet2);
404  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
405 
406  memset(&packet2, 0, sizeof(packet2));
407  mavlink_msg_ctrl_srfc_pt_send(MAVLINK_COMM_1 , packet1.target , packet1.bitfieldPt );
408  mavlink_msg_ctrl_srfc_pt_decode(last_msg, &packet2);
409  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
410 }
411 
412 static void mavlink_test_slugs_camera_order(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
413 {
414  mavlink_message_t msg;
415  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
416  uint16_t i;
417  mavlink_slugs_camera_order_t packet_in = {
418  5,72,139,206,17
419  };
420  mavlink_slugs_camera_order_t packet1, packet2;
421  memset(&packet1, 0, sizeof(packet1));
422  packet1.target = packet_in.target;
423  packet1.pan = packet_in.pan;
424  packet1.tilt = packet_in.tilt;
425  packet1.zoom = packet_in.zoom;
426  packet1.moveHome = packet_in.moveHome;
427 
428 
429 
430  memset(&packet2, 0, sizeof(packet2));
431  mavlink_msg_slugs_camera_order_encode(system_id, component_id, &msg, &packet1);
432  mavlink_msg_slugs_camera_order_decode(&msg, &packet2);
433  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
434 
435  memset(&packet2, 0, sizeof(packet2));
436  mavlink_msg_slugs_camera_order_pack(system_id, component_id, &msg , packet1.target , packet1.pan , packet1.tilt , packet1.zoom , packet1.moveHome );
437  mavlink_msg_slugs_camera_order_decode(&msg, &packet2);
438  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
439 
440  memset(&packet2, 0, sizeof(packet2));
441  mavlink_msg_slugs_camera_order_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.pan , packet1.tilt , packet1.zoom , packet1.moveHome );
442  mavlink_msg_slugs_camera_order_decode(&msg, &packet2);
443  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
444 
445  memset(&packet2, 0, sizeof(packet2));
446  mavlink_msg_to_send_buffer(buffer, &msg);
447  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
448  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
449  }
450  mavlink_msg_slugs_camera_order_decode(last_msg, &packet2);
451  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
452 
453  memset(&packet2, 0, sizeof(packet2));
454  mavlink_msg_slugs_camera_order_send(MAVLINK_COMM_1 , packet1.target , packet1.pan , packet1.tilt , packet1.zoom , packet1.moveHome );
455  mavlink_msg_slugs_camera_order_decode(last_msg, &packet2);
456  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
457 }
458 
459 static void mavlink_test_control_surface(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
460 {
461  mavlink_message_t msg;
462  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
463  uint16_t i;
464  mavlink_control_surface_t packet_in = {
465  17.0,45.0,29,96
466  };
467  mavlink_control_surface_t packet1, packet2;
468  memset(&packet1, 0, sizeof(packet1));
469  packet1.mControl = packet_in.mControl;
470  packet1.bControl = packet_in.bControl;
471  packet1.target = packet_in.target;
472  packet1.idSurface = packet_in.idSurface;
473 
474 
475 
476  memset(&packet2, 0, sizeof(packet2));
477  mavlink_msg_control_surface_encode(system_id, component_id, &msg, &packet1);
478  mavlink_msg_control_surface_decode(&msg, &packet2);
479  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
480 
481  memset(&packet2, 0, sizeof(packet2));
482  mavlink_msg_control_surface_pack(system_id, component_id, &msg , packet1.target , packet1.idSurface , packet1.mControl , packet1.bControl );
483  mavlink_msg_control_surface_decode(&msg, &packet2);
484  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
485 
486  memset(&packet2, 0, sizeof(packet2));
487  mavlink_msg_control_surface_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.idSurface , packet1.mControl , packet1.bControl );
488  mavlink_msg_control_surface_decode(&msg, &packet2);
489  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
490 
491  memset(&packet2, 0, sizeof(packet2));
492  mavlink_msg_to_send_buffer(buffer, &msg);
493  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
494  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
495  }
496  mavlink_msg_control_surface_decode(last_msg, &packet2);
497  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
498 
499  memset(&packet2, 0, sizeof(packet2));
500  mavlink_msg_control_surface_send(MAVLINK_COMM_1 , packet1.target , packet1.idSurface , packet1.mControl , packet1.bControl );
501  mavlink_msg_control_surface_decode(last_msg, &packet2);
502  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
503 }
504 
505 static void mavlink_test_slugs_mobile_location(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
506 {
507  mavlink_message_t msg;
508  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
509  uint16_t i;
510  mavlink_slugs_mobile_location_t packet_in = {
511  17.0,45.0,29
512  };
513  mavlink_slugs_mobile_location_t packet1, packet2;
514  memset(&packet1, 0, sizeof(packet1));
515  packet1.latitude = packet_in.latitude;
516  packet1.longitude = packet_in.longitude;
517  packet1.target = packet_in.target;
518 
519 
520 
521  memset(&packet2, 0, sizeof(packet2));
522  mavlink_msg_slugs_mobile_location_encode(system_id, component_id, &msg, &packet1);
523  mavlink_msg_slugs_mobile_location_decode(&msg, &packet2);
524  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
525 
526  memset(&packet2, 0, sizeof(packet2));
527  mavlink_msg_slugs_mobile_location_pack(system_id, component_id, &msg , packet1.target , packet1.latitude , packet1.longitude );
528  mavlink_msg_slugs_mobile_location_decode(&msg, &packet2);
529  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
530 
531  memset(&packet2, 0, sizeof(packet2));
532  mavlink_msg_slugs_mobile_location_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.latitude , packet1.longitude );
533  mavlink_msg_slugs_mobile_location_decode(&msg, &packet2);
534  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
535 
536  memset(&packet2, 0, sizeof(packet2));
537  mavlink_msg_to_send_buffer(buffer, &msg);
538  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
539  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
540  }
541  mavlink_msg_slugs_mobile_location_decode(last_msg, &packet2);
542  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
543 
544  memset(&packet2, 0, sizeof(packet2));
545  mavlink_msg_slugs_mobile_location_send(MAVLINK_COMM_1 , packet1.target , packet1.latitude , packet1.longitude );
546  mavlink_msg_slugs_mobile_location_decode(last_msg, &packet2);
547  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
548 }
549 
550 static void mavlink_test_slugs_configuration_camera(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
551 {
552  mavlink_message_t msg;
553  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
554  uint16_t i;
556  5,72,139
557  };
558  mavlink_slugs_configuration_camera_t packet1, packet2;
559  memset(&packet1, 0, sizeof(packet1));
560  packet1.target = packet_in.target;
561  packet1.idOrder = packet_in.idOrder;
562  packet1.order = packet_in.order;
563 
564 
565 
566  memset(&packet2, 0, sizeof(packet2));
567  mavlink_msg_slugs_configuration_camera_encode(system_id, component_id, &msg, &packet1);
568  mavlink_msg_slugs_configuration_camera_decode(&msg, &packet2);
569  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
570 
571  memset(&packet2, 0, sizeof(packet2));
572  mavlink_msg_slugs_configuration_camera_pack(system_id, component_id, &msg , packet1.target , packet1.idOrder , packet1.order );
573  mavlink_msg_slugs_configuration_camera_decode(&msg, &packet2);
574  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
575 
576  memset(&packet2, 0, sizeof(packet2));
577  mavlink_msg_slugs_configuration_camera_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.idOrder , packet1.order );
578  mavlink_msg_slugs_configuration_camera_decode(&msg, &packet2);
579  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
580 
581  memset(&packet2, 0, sizeof(packet2));
582  mavlink_msg_to_send_buffer(buffer, &msg);
583  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
584  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
585  }
586  mavlink_msg_slugs_configuration_camera_decode(last_msg, &packet2);
587  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
588 
589  memset(&packet2, 0, sizeof(packet2));
590  mavlink_msg_slugs_configuration_camera_send(MAVLINK_COMM_1 , packet1.target , packet1.idOrder , packet1.order );
591  mavlink_msg_slugs_configuration_camera_decode(last_msg, &packet2);
592  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
593 }
594 
595 static void mavlink_test_isr_location(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
596 {
597  mavlink_message_t msg;
598  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
599  uint16_t i;
600  mavlink_isr_location_t packet_in = {
601  17.0,45.0,73.0,41,108,175,242
602  };
603  mavlink_isr_location_t packet1, packet2;
604  memset(&packet1, 0, sizeof(packet1));
605  packet1.latitude = packet_in.latitude;
606  packet1.longitude = packet_in.longitude;
607  packet1.height = packet_in.height;
608  packet1.target = packet_in.target;
609  packet1.option1 = packet_in.option1;
610  packet1.option2 = packet_in.option2;
611  packet1.option3 = packet_in.option3;
612 
613 
614 
615  memset(&packet2, 0, sizeof(packet2));
616  mavlink_msg_isr_location_encode(system_id, component_id, &msg, &packet1);
617  mavlink_msg_isr_location_decode(&msg, &packet2);
618  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
619 
620  memset(&packet2, 0, sizeof(packet2));
621  mavlink_msg_isr_location_pack(system_id, component_id, &msg , packet1.target , packet1.latitude , packet1.longitude , packet1.height , packet1.option1 , packet1.option2 , packet1.option3 );
622  mavlink_msg_isr_location_decode(&msg, &packet2);
623  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
624 
625  memset(&packet2, 0, sizeof(packet2));
626  mavlink_msg_isr_location_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.latitude , packet1.longitude , packet1.height , packet1.option1 , packet1.option2 , packet1.option3 );
627  mavlink_msg_isr_location_decode(&msg, &packet2);
628  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
629 
630  memset(&packet2, 0, sizeof(packet2));
631  mavlink_msg_to_send_buffer(buffer, &msg);
632  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
633  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
634  }
635  mavlink_msg_isr_location_decode(last_msg, &packet2);
636  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
637 
638  memset(&packet2, 0, sizeof(packet2));
639  mavlink_msg_isr_location_send(MAVLINK_COMM_1 , packet1.target , packet1.latitude , packet1.longitude , packet1.height , packet1.option1 , packet1.option2 , packet1.option3 );
640  mavlink_msg_isr_location_decode(last_msg, &packet2);
641  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
642 }
643 
644 static void mavlink_test_volt_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
645 {
646  mavlink_message_t msg;
647  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
648  uint16_t i;
649  mavlink_volt_sensor_t packet_in = {
650  17235,17339,17
651  };
652  mavlink_volt_sensor_t packet1, packet2;
653  memset(&packet1, 0, sizeof(packet1));
654  packet1.voltage = packet_in.voltage;
655  packet1.reading2 = packet_in.reading2;
656  packet1.r2Type = packet_in.r2Type;
657 
658 
659 
660  memset(&packet2, 0, sizeof(packet2));
661  mavlink_msg_volt_sensor_encode(system_id, component_id, &msg, &packet1);
662  mavlink_msg_volt_sensor_decode(&msg, &packet2);
663  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
664 
665  memset(&packet2, 0, sizeof(packet2));
666  mavlink_msg_volt_sensor_pack(system_id, component_id, &msg , packet1.r2Type , packet1.voltage , packet1.reading2 );
667  mavlink_msg_volt_sensor_decode(&msg, &packet2);
668  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
669 
670  memset(&packet2, 0, sizeof(packet2));
671  mavlink_msg_volt_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.r2Type , packet1.voltage , packet1.reading2 );
672  mavlink_msg_volt_sensor_decode(&msg, &packet2);
673  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
674 
675  memset(&packet2, 0, sizeof(packet2));
676  mavlink_msg_to_send_buffer(buffer, &msg);
677  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
678  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
679  }
680  mavlink_msg_volt_sensor_decode(last_msg, &packet2);
681  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
682 
683  memset(&packet2, 0, sizeof(packet2));
684  mavlink_msg_volt_sensor_send(MAVLINK_COMM_1 , packet1.r2Type , packet1.voltage , packet1.reading2 );
685  mavlink_msg_volt_sensor_decode(last_msg, &packet2);
686  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
687 }
688 
689 static void mavlink_test_ptz_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
690 {
691  mavlink_message_t msg;
692  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
693  uint16_t i;
694  mavlink_ptz_status_t packet_in = {
695  17235,17339,17
696  };
697  mavlink_ptz_status_t packet1, packet2;
698  memset(&packet1, 0, sizeof(packet1));
699  packet1.pan = packet_in.pan;
700  packet1.tilt = packet_in.tilt;
701  packet1.zoom = packet_in.zoom;
702 
703 
704 
705  memset(&packet2, 0, sizeof(packet2));
706  mavlink_msg_ptz_status_encode(system_id, component_id, &msg, &packet1);
707  mavlink_msg_ptz_status_decode(&msg, &packet2);
708  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
709 
710  memset(&packet2, 0, sizeof(packet2));
711  mavlink_msg_ptz_status_pack(system_id, component_id, &msg , packet1.zoom , packet1.pan , packet1.tilt );
712  mavlink_msg_ptz_status_decode(&msg, &packet2);
713  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
714 
715  memset(&packet2, 0, sizeof(packet2));
716  mavlink_msg_ptz_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.zoom , packet1.pan , packet1.tilt );
717  mavlink_msg_ptz_status_decode(&msg, &packet2);
718  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
719 
720  memset(&packet2, 0, sizeof(packet2));
721  mavlink_msg_to_send_buffer(buffer, &msg);
722  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
723  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
724  }
725  mavlink_msg_ptz_status_decode(last_msg, &packet2);
726  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
727 
728  memset(&packet2, 0, sizeof(packet2));
729  mavlink_msg_ptz_status_send(MAVLINK_COMM_1 , packet1.zoom , packet1.pan , packet1.tilt );
730  mavlink_msg_ptz_status_decode(last_msg, &packet2);
731  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
732 }
733 
734 static void mavlink_test_uav_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
735 {
736  mavlink_message_t msg;
737  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
738  uint16_t i;
739  mavlink_uav_status_t packet_in = {
740  17.0,45.0,73.0,101.0,129.0,65
741  };
742  mavlink_uav_status_t packet1, packet2;
743  memset(&packet1, 0, sizeof(packet1));
744  packet1.latitude = packet_in.latitude;
745  packet1.longitude = packet_in.longitude;
746  packet1.altitude = packet_in.altitude;
747  packet1.speed = packet_in.speed;
748  packet1.course = packet_in.course;
749  packet1.target = packet_in.target;
750 
751 
752 
753  memset(&packet2, 0, sizeof(packet2));
754  mavlink_msg_uav_status_encode(system_id, component_id, &msg, &packet1);
755  mavlink_msg_uav_status_decode(&msg, &packet2);
756  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
757 
758  memset(&packet2, 0, sizeof(packet2));
759  mavlink_msg_uav_status_pack(system_id, component_id, &msg , packet1.target , packet1.latitude , packet1.longitude , packet1.altitude , packet1.speed , packet1.course );
760  mavlink_msg_uav_status_decode(&msg, &packet2);
761  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
762 
763  memset(&packet2, 0, sizeof(packet2));
764  mavlink_msg_uav_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.latitude , packet1.longitude , packet1.altitude , packet1.speed , packet1.course );
765  mavlink_msg_uav_status_decode(&msg, &packet2);
766  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
767 
768  memset(&packet2, 0, sizeof(packet2));
769  mavlink_msg_to_send_buffer(buffer, &msg);
770  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
771  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
772  }
773  mavlink_msg_uav_status_decode(last_msg, &packet2);
774  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
775 
776  memset(&packet2, 0, sizeof(packet2));
777  mavlink_msg_uav_status_send(MAVLINK_COMM_1 , packet1.target , packet1.latitude , packet1.longitude , packet1.altitude , packet1.speed , packet1.course );
778  mavlink_msg_uav_status_decode(last_msg, &packet2);
779  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
780 }
781 
782 static void mavlink_test_status_gps(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
783 {
784  mavlink_message_t msg;
785  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
786  uint16_t i;
787  mavlink_status_gps_t packet_in = {
788  17.0,17443,151,218,29,96,163
789  };
790  mavlink_status_gps_t packet1, packet2;
791  memset(&packet1, 0, sizeof(packet1));
792  packet1.magVar = packet_in.magVar;
793  packet1.csFails = packet_in.csFails;
794  packet1.gpsQuality = packet_in.gpsQuality;
795  packet1.msgsType = packet_in.msgsType;
796  packet1.posStatus = packet_in.posStatus;
797  packet1.magDir = packet_in.magDir;
798  packet1.modeInd = packet_in.modeInd;
799 
800 
801 
802  memset(&packet2, 0, sizeof(packet2));
803  mavlink_msg_status_gps_encode(system_id, component_id, &msg, &packet1);
804  mavlink_msg_status_gps_decode(&msg, &packet2);
805  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
806 
807  memset(&packet2, 0, sizeof(packet2));
808  mavlink_msg_status_gps_pack(system_id, component_id, &msg , packet1.csFails , packet1.gpsQuality , packet1.msgsType , packet1.posStatus , packet1.magVar , packet1.magDir , packet1.modeInd );
809  mavlink_msg_status_gps_decode(&msg, &packet2);
810  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
811 
812  memset(&packet2, 0, sizeof(packet2));
813  mavlink_msg_status_gps_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.csFails , packet1.gpsQuality , packet1.msgsType , packet1.posStatus , packet1.magVar , packet1.magDir , packet1.modeInd );
814  mavlink_msg_status_gps_decode(&msg, &packet2);
815  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
816 
817  memset(&packet2, 0, sizeof(packet2));
818  mavlink_msg_to_send_buffer(buffer, &msg);
819  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
820  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
821  }
822  mavlink_msg_status_gps_decode(last_msg, &packet2);
823  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
824 
825  memset(&packet2, 0, sizeof(packet2));
826  mavlink_msg_status_gps_send(MAVLINK_COMM_1 , packet1.csFails , packet1.gpsQuality , packet1.msgsType , packet1.posStatus , packet1.magVar , packet1.magDir , packet1.modeInd );
827  mavlink_msg_status_gps_decode(last_msg, &packet2);
828  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
829 }
830 
831 static void mavlink_test_novatel_diag(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
832 {
833  mavlink_message_t msg;
834  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
835  uint16_t i;
836  mavlink_novatel_diag_t packet_in = {
837  963497464,45.0,17651,163,230,41,108
838  };
839  mavlink_novatel_diag_t packet1, packet2;
840  memset(&packet1, 0, sizeof(packet1));
841  packet1.receiverStatus = packet_in.receiverStatus;
842  packet1.posSolAge = packet_in.posSolAge;
843  packet1.csFails = packet_in.csFails;
844  packet1.timeStatus = packet_in.timeStatus;
845  packet1.solStatus = packet_in.solStatus;
846  packet1.posType = packet_in.posType;
847  packet1.velType = packet_in.velType;
848 
849 
850 
851  memset(&packet2, 0, sizeof(packet2));
852  mavlink_msg_novatel_diag_encode(system_id, component_id, &msg, &packet1);
853  mavlink_msg_novatel_diag_decode(&msg, &packet2);
854  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
855 
856  memset(&packet2, 0, sizeof(packet2));
857  mavlink_msg_novatel_diag_pack(system_id, component_id, &msg , packet1.timeStatus , packet1.receiverStatus , packet1.solStatus , packet1.posType , packet1.velType , packet1.posSolAge , packet1.csFails );
858  mavlink_msg_novatel_diag_decode(&msg, &packet2);
859  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
860 
861  memset(&packet2, 0, sizeof(packet2));
862  mavlink_msg_novatel_diag_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timeStatus , packet1.receiverStatus , packet1.solStatus , packet1.posType , packet1.velType , packet1.posSolAge , packet1.csFails );
863  mavlink_msg_novatel_diag_decode(&msg, &packet2);
864  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
865 
866  memset(&packet2, 0, sizeof(packet2));
867  mavlink_msg_to_send_buffer(buffer, &msg);
868  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
869  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
870  }
871  mavlink_msg_novatel_diag_decode(last_msg, &packet2);
872  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
873 
874  memset(&packet2, 0, sizeof(packet2));
875  mavlink_msg_novatel_diag_send(MAVLINK_COMM_1 , packet1.timeStatus , packet1.receiverStatus , packet1.solStatus , packet1.posType , packet1.velType , packet1.posSolAge , packet1.csFails );
876  mavlink_msg_novatel_diag_decode(last_msg, &packet2);
877  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
878 }
879 
880 static void mavlink_test_sensor_diag(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
881 {
882  mavlink_message_t msg;
883  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
884  uint16_t i;
885  mavlink_sensor_diag_t packet_in = {
886  17.0,45.0,17651,163
887  };
888  mavlink_sensor_diag_t packet1, packet2;
889  memset(&packet1, 0, sizeof(packet1));
890  packet1.float1 = packet_in.float1;
891  packet1.float2 = packet_in.float2;
892  packet1.int1 = packet_in.int1;
893  packet1.char1 = packet_in.char1;
894 
895 
896 
897  memset(&packet2, 0, sizeof(packet2));
898  mavlink_msg_sensor_diag_encode(system_id, component_id, &msg, &packet1);
899  mavlink_msg_sensor_diag_decode(&msg, &packet2);
900  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
901 
902  memset(&packet2, 0, sizeof(packet2));
903  mavlink_msg_sensor_diag_pack(system_id, component_id, &msg , packet1.float1 , packet1.float2 , packet1.int1 , packet1.char1 );
904  mavlink_msg_sensor_diag_decode(&msg, &packet2);
905  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
906 
907  memset(&packet2, 0, sizeof(packet2));
908  mavlink_msg_sensor_diag_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.float1 , packet1.float2 , packet1.int1 , packet1.char1 );
909  mavlink_msg_sensor_diag_decode(&msg, &packet2);
910  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
911 
912  memset(&packet2, 0, sizeof(packet2));
913  mavlink_msg_to_send_buffer(buffer, &msg);
914  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
915  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
916  }
917  mavlink_msg_sensor_diag_decode(last_msg, &packet2);
918  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
919 
920  memset(&packet2, 0, sizeof(packet2));
921  mavlink_msg_sensor_diag_send(MAVLINK_COMM_1 , packet1.float1 , packet1.float2 , packet1.int1 , packet1.char1 );
922  mavlink_msg_sensor_diag_decode(last_msg, &packet2);
923  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
924 }
925 
926 static void mavlink_test_boot(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
927 {
928  mavlink_message_t msg;
929  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
930  uint16_t i;
931  mavlink_boot_t packet_in = {
932  963497464
933  };
934  mavlink_boot_t packet1, packet2;
935  memset(&packet1, 0, sizeof(packet1));
936  packet1.version = packet_in.version;
937 
938 
939 
940  memset(&packet2, 0, sizeof(packet2));
941  mavlink_msg_boot_encode(system_id, component_id, &msg, &packet1);
942  mavlink_msg_boot_decode(&msg, &packet2);
943  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
944 
945  memset(&packet2, 0, sizeof(packet2));
946  mavlink_msg_boot_pack(system_id, component_id, &msg , packet1.version );
947  mavlink_msg_boot_decode(&msg, &packet2);
948  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
949 
950  memset(&packet2, 0, sizeof(packet2));
951  mavlink_msg_boot_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.version );
952  mavlink_msg_boot_decode(&msg, &packet2);
953  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
954 
955  memset(&packet2, 0, sizeof(packet2));
956  mavlink_msg_to_send_buffer(buffer, &msg);
957  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
958  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
959  }
960  mavlink_msg_boot_decode(last_msg, &packet2);
961  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
962 
963  memset(&packet2, 0, sizeof(packet2));
964  mavlink_msg_boot_send(MAVLINK_COMM_1 , packet1.version );
965  mavlink_msg_boot_decode(last_msg, &packet2);
966  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
967 }
968 
969 static void mavlink_test_slugs(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
970 {
971  mavlink_test_cpu_load(system_id, component_id, last_msg);
972  mavlink_test_sensor_bias(system_id, component_id, last_msg);
973  mavlink_test_diagnostic(system_id, component_id, last_msg);
974  mavlink_test_slugs_navigation(system_id, component_id, last_msg);
975  mavlink_test_data_log(system_id, component_id, last_msg);
976  mavlink_test_gps_date_time(system_id, component_id, last_msg);
977  mavlink_test_mid_lvl_cmds(system_id, component_id, last_msg);
978  mavlink_test_ctrl_srfc_pt(system_id, component_id, last_msg);
979  mavlink_test_slugs_camera_order(system_id, component_id, last_msg);
980  mavlink_test_control_surface(system_id, component_id, last_msg);
981  mavlink_test_slugs_mobile_location(system_id, component_id, last_msg);
982  mavlink_test_slugs_configuration_camera(system_id, component_id, last_msg);
983  mavlink_test_isr_location(system_id, component_id, last_msg);
984  mavlink_test_volt_sensor(system_id, component_id, last_msg);
985  mavlink_test_ptz_status(system_id, component_id, last_msg);
986  mavlink_test_uav_status(system_id, component_id, last_msg);
987  mavlink_test_status_gps(system_id, component_id, last_msg);
988  mavlink_test_novatel_diag(system_id, component_id, last_msg);
989  mavlink_test_sensor_diag(system_id, component_id, last_msg);
990  mavlink_test_boot(system_id, component_id, last_msg);
991 }
992 
993 #ifdef __cplusplus
994 }
995 #endif // __cplusplus
996 #endif // SLUGS_TESTSUITE_H
#define MAVLINK_ASSERT(x)
Definition: protocol.h:26