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 PIXHAWK_TESTSUITE_H
6 #define PIXHAWK_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_pixhawk(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_pixhawk(system_id, component_id, last_msg);
21 }
22 #endif
23 
24 #include "../common/testsuite.h"
25 
26 
27 static void mavlink_test_set_cam_shutter(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_set_cam_shutter_t packet_in = {
33  17.0,17443,17547,29,96,163
34  };
35  mavlink_set_cam_shutter_t packet1, packet2;
36  memset(&packet1, 0, sizeof(packet1));
37  packet1.gain = packet_in.gain;
38  packet1.interval = packet_in.interval;
39  packet1.exposure = packet_in.exposure;
40  packet1.cam_no = packet_in.cam_no;
41  packet1.cam_mode = packet_in.cam_mode;
42  packet1.trigger_pin = packet_in.trigger_pin;
43 
44 
45 
46  memset(&packet2, 0, sizeof(packet2));
47  mavlink_msg_set_cam_shutter_encode(system_id, component_id, &msg, &packet1);
48  mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
49  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
50 
51  memset(&packet2, 0, sizeof(packet2));
52  mavlink_msg_set_cam_shutter_pack(system_id, component_id, &msg , packet1.cam_no , packet1.cam_mode , packet1.trigger_pin , packet1.interval , packet1.exposure , packet1.gain );
53  mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
54  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
55 
56  memset(&packet2, 0, sizeof(packet2));
57  mavlink_msg_set_cam_shutter_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.cam_no , packet1.cam_mode , packet1.trigger_pin , packet1.interval , packet1.exposure , packet1.gain );
58  mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
59  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
60 
61  memset(&packet2, 0, sizeof(packet2));
62  mavlink_msg_to_send_buffer(buffer, &msg);
63  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
64  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
65  }
66  mavlink_msg_set_cam_shutter_decode(last_msg, &packet2);
67  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
68 
69  memset(&packet2, 0, sizeof(packet2));
70  mavlink_msg_set_cam_shutter_send(MAVLINK_COMM_1 , packet1.cam_no , packet1.cam_mode , packet1.trigger_pin , packet1.interval , packet1.exposure , packet1.gain );
71  mavlink_msg_set_cam_shutter_decode(last_msg, &packet2);
72  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
73 }
74 
75 static void mavlink_test_image_triggered(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
76 {
77  mavlink_message_t msg;
78  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
79  uint16_t i;
80  mavlink_image_triggered_t packet_in = {
81  93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0
82  };
83  mavlink_image_triggered_t packet1, packet2;
84  memset(&packet1, 0, sizeof(packet1));
85  packet1.timestamp = packet_in.timestamp;
86  packet1.seq = packet_in.seq;
87  packet1.roll = packet_in.roll;
88  packet1.pitch = packet_in.pitch;
89  packet1.yaw = packet_in.yaw;
90  packet1.local_z = packet_in.local_z;
91  packet1.lat = packet_in.lat;
92  packet1.lon = packet_in.lon;
93  packet1.alt = packet_in.alt;
94  packet1.ground_x = packet_in.ground_x;
95  packet1.ground_y = packet_in.ground_y;
96  packet1.ground_z = packet_in.ground_z;
97 
98 
99 
100  memset(&packet2, 0, sizeof(packet2));
101  mavlink_msg_image_triggered_encode(system_id, component_id, &msg, &packet1);
102  mavlink_msg_image_triggered_decode(&msg, &packet2);
103  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
104 
105  memset(&packet2, 0, sizeof(packet2));
106  mavlink_msg_image_triggered_pack(system_id, component_id, &msg , packet1.timestamp , packet1.seq , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
107  mavlink_msg_image_triggered_decode(&msg, &packet2);
108  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
109 
110  memset(&packet2, 0, sizeof(packet2));
111  mavlink_msg_image_triggered_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.seq , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
112  mavlink_msg_image_triggered_decode(&msg, &packet2);
113  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
114 
115  memset(&packet2, 0, sizeof(packet2));
116  mavlink_msg_to_send_buffer(buffer, &msg);
117  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
118  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
119  }
120  mavlink_msg_image_triggered_decode(last_msg, &packet2);
121  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
122 
123  memset(&packet2, 0, sizeof(packet2));
124  mavlink_msg_image_triggered_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.seq , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
125  mavlink_msg_image_triggered_decode(last_msg, &packet2);
126  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
127 }
128 
129 static void mavlink_test_image_trigger_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
130 {
131  mavlink_message_t msg;
132  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
133  uint16_t i;
134  mavlink_image_trigger_control_t packet_in = {
135  5
136  };
137  mavlink_image_trigger_control_t packet1, packet2;
138  memset(&packet1, 0, sizeof(packet1));
139  packet1.enable = packet_in.enable;
140 
141 
142 
143  memset(&packet2, 0, sizeof(packet2));
144  mavlink_msg_image_trigger_control_encode(system_id, component_id, &msg, &packet1);
145  mavlink_msg_image_trigger_control_decode(&msg, &packet2);
146  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
147 
148  memset(&packet2, 0, sizeof(packet2));
149  mavlink_msg_image_trigger_control_pack(system_id, component_id, &msg , packet1.enable );
150  mavlink_msg_image_trigger_control_decode(&msg, &packet2);
151  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
152 
153  memset(&packet2, 0, sizeof(packet2));
154  mavlink_msg_image_trigger_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.enable );
155  mavlink_msg_image_trigger_control_decode(&msg, &packet2);
156  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
157 
158  memset(&packet2, 0, sizeof(packet2));
159  mavlink_msg_to_send_buffer(buffer, &msg);
160  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
161  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
162  }
163  mavlink_msg_image_trigger_control_decode(last_msg, &packet2);
164  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
165 
166  memset(&packet2, 0, sizeof(packet2));
167  mavlink_msg_image_trigger_control_send(MAVLINK_COMM_1 , packet1.enable );
168  mavlink_msg_image_trigger_control_decode(last_msg, &packet2);
169  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
170 }
171 
172 static void mavlink_test_image_available(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
173 {
174  mavlink_message_t msg;
175  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
176  uint16_t i;
177  mavlink_image_available_t packet_in = {
178  93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,963498712,963498920,963499128,963499336,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,21603,21707,21811,147,214
179  };
180  mavlink_image_available_t packet1, packet2;
181  memset(&packet1, 0, sizeof(packet1));
182  packet1.cam_id = packet_in.cam_id;
183  packet1.timestamp = packet_in.timestamp;
184  packet1.valid_until = packet_in.valid_until;
185  packet1.img_seq = packet_in.img_seq;
186  packet1.img_buf_index = packet_in.img_buf_index;
187  packet1.key = packet_in.key;
188  packet1.exposure = packet_in.exposure;
189  packet1.gain = packet_in.gain;
190  packet1.roll = packet_in.roll;
191  packet1.pitch = packet_in.pitch;
192  packet1.yaw = packet_in.yaw;
193  packet1.local_z = packet_in.local_z;
194  packet1.lat = packet_in.lat;
195  packet1.lon = packet_in.lon;
196  packet1.alt = packet_in.alt;
197  packet1.ground_x = packet_in.ground_x;
198  packet1.ground_y = packet_in.ground_y;
199  packet1.ground_z = packet_in.ground_z;
200  packet1.width = packet_in.width;
201  packet1.height = packet_in.height;
202  packet1.depth = packet_in.depth;
203  packet1.cam_no = packet_in.cam_no;
204  packet1.channels = packet_in.channels;
205 
206 
207 
208  memset(&packet2, 0, sizeof(packet2));
209  mavlink_msg_image_available_encode(system_id, component_id, &msg, &packet1);
210  mavlink_msg_image_available_decode(&msg, &packet2);
211  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
212 
213  memset(&packet2, 0, sizeof(packet2));
214  mavlink_msg_image_available_pack(system_id, component_id, &msg , packet1.cam_id , packet1.cam_no , packet1.timestamp , packet1.valid_until , packet1.img_seq , packet1.img_buf_index , packet1.width , packet1.height , packet1.depth , packet1.channels , packet1.key , packet1.exposure , packet1.gain , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
215  mavlink_msg_image_available_decode(&msg, &packet2);
216  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
217 
218  memset(&packet2, 0, sizeof(packet2));
219  mavlink_msg_image_available_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.cam_id , packet1.cam_no , packet1.timestamp , packet1.valid_until , packet1.img_seq , packet1.img_buf_index , packet1.width , packet1.height , packet1.depth , packet1.channels , packet1.key , packet1.exposure , packet1.gain , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
220  mavlink_msg_image_available_decode(&msg, &packet2);
221  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
222 
223  memset(&packet2, 0, sizeof(packet2));
224  mavlink_msg_to_send_buffer(buffer, &msg);
225  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
226  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
227  }
228  mavlink_msg_image_available_decode(last_msg, &packet2);
229  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
230 
231  memset(&packet2, 0, sizeof(packet2));
232  mavlink_msg_image_available_send(MAVLINK_COMM_1 , packet1.cam_id , packet1.cam_no , packet1.timestamp , packet1.valid_until , packet1.img_seq , packet1.img_buf_index , packet1.width , packet1.height , packet1.depth , packet1.channels , packet1.key , packet1.exposure , packet1.gain , packet1.roll , packet1.pitch , packet1.yaw , packet1.local_z , packet1.lat , packet1.lon , packet1.alt , packet1.ground_x , packet1.ground_y , packet1.ground_z );
233  mavlink_msg_image_available_decode(last_msg, &packet2);
234  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
235 }
236 
237 static void mavlink_test_set_position_control_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
238 {
239  mavlink_message_t msg;
240  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
241  uint16_t i;
243  17.0,45.0,73.0,101.0,53,120
244  };
245  mavlink_set_position_control_offset_t packet1, packet2;
246  memset(&packet1, 0, sizeof(packet1));
247  packet1.x = packet_in.x;
248  packet1.y = packet_in.y;
249  packet1.z = packet_in.z;
250  packet1.yaw = packet_in.yaw;
251  packet1.target_system = packet_in.target_system;
252  packet1.target_component = packet_in.target_component;
253 
254 
255 
256  memset(&packet2, 0, sizeof(packet2));
257  mavlink_msg_set_position_control_offset_encode(system_id, component_id, &msg, &packet1);
258  mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
259  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
260 
261  memset(&packet2, 0, sizeof(packet2));
262  mavlink_msg_set_position_control_offset_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.x , packet1.y , packet1.z , packet1.yaw );
263  mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
264  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
265 
266  memset(&packet2, 0, sizeof(packet2));
267  mavlink_msg_set_position_control_offset_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.x , packet1.y , packet1.z , packet1.yaw );
268  mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
269  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
270 
271  memset(&packet2, 0, sizeof(packet2));
272  mavlink_msg_to_send_buffer(buffer, &msg);
273  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
274  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
275  }
276  mavlink_msg_set_position_control_offset_decode(last_msg, &packet2);
277  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
278 
279  memset(&packet2, 0, sizeof(packet2));
280  mavlink_msg_set_position_control_offset_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.x , packet1.y , packet1.z , packet1.yaw );
281  mavlink_msg_set_position_control_offset_decode(last_msg, &packet2);
282  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
283 }
284 
285 static void mavlink_test_position_control_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
286 {
287  mavlink_message_t msg;
288  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
289  uint16_t i;
291  17.0,45.0,73.0,101.0,18067
292  };
293  mavlink_position_control_setpoint_t packet1, packet2;
294  memset(&packet1, 0, sizeof(packet1));
295  packet1.x = packet_in.x;
296  packet1.y = packet_in.y;
297  packet1.z = packet_in.z;
298  packet1.yaw = packet_in.yaw;
299  packet1.id = packet_in.id;
300 
301 
302 
303  memset(&packet2, 0, sizeof(packet2));
304  mavlink_msg_position_control_setpoint_encode(system_id, component_id, &msg, &packet1);
305  mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
306  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
307 
308  memset(&packet2, 0, sizeof(packet2));
309  mavlink_msg_position_control_setpoint_pack(system_id, component_id, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.yaw );
310  mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
311  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
312 
313  memset(&packet2, 0, sizeof(packet2));
314  mavlink_msg_position_control_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.yaw );
315  mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
316  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
317 
318  memset(&packet2, 0, sizeof(packet2));
319  mavlink_msg_to_send_buffer(buffer, &msg);
320  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
321  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
322  }
323  mavlink_msg_position_control_setpoint_decode(last_msg, &packet2);
324  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
325 
326  memset(&packet2, 0, sizeof(packet2));
327  mavlink_msg_position_control_setpoint_send(MAVLINK_COMM_1 , packet1.id , packet1.x , packet1.y , packet1.z , packet1.yaw );
328  mavlink_msg_position_control_setpoint_decode(last_msg, &packet2);
329  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
330 }
331 
332 static void mavlink_test_marker(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
333 {
334  mavlink_message_t msg;
335  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
336  uint16_t i;
337  mavlink_marker_t packet_in = {
338  17.0,45.0,73.0,101.0,129.0,157.0,18483
339  };
340  mavlink_marker_t packet1, packet2;
341  memset(&packet1, 0, sizeof(packet1));
342  packet1.x = packet_in.x;
343  packet1.y = packet_in.y;
344  packet1.z = packet_in.z;
345  packet1.roll = packet_in.roll;
346  packet1.pitch = packet_in.pitch;
347  packet1.yaw = packet_in.yaw;
348  packet1.id = packet_in.id;
349 
350 
351 
352  memset(&packet2, 0, sizeof(packet2));
353  mavlink_msg_marker_encode(system_id, component_id, &msg, &packet1);
354  mavlink_msg_marker_decode(&msg, &packet2);
355  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
356 
357  memset(&packet2, 0, sizeof(packet2));
358  mavlink_msg_marker_pack(system_id, component_id, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
359  mavlink_msg_marker_decode(&msg, &packet2);
360  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
361 
362  memset(&packet2, 0, sizeof(packet2));
363  mavlink_msg_marker_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
364  mavlink_msg_marker_decode(&msg, &packet2);
365  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
366 
367  memset(&packet2, 0, sizeof(packet2));
368  mavlink_msg_to_send_buffer(buffer, &msg);
369  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
370  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
371  }
372  mavlink_msg_marker_decode(last_msg, &packet2);
373  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
374 
375  memset(&packet2, 0, sizeof(packet2));
376  mavlink_msg_marker_send(MAVLINK_COMM_1 , packet1.id , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
377  mavlink_msg_marker_decode(last_msg, &packet2);
378  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
379 }
380 
381 static void mavlink_test_raw_aux(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
382 {
383  mavlink_message_t msg;
384  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
385  uint16_t i;
386  mavlink_raw_aux_t packet_in = {
387  963497464,17443,17547,17651,17755,17859,17963
388  };
389  mavlink_raw_aux_t packet1, packet2;
390  memset(&packet1, 0, sizeof(packet1));
391  packet1.baro = packet_in.baro;
392  packet1.adc1 = packet_in.adc1;
393  packet1.adc2 = packet_in.adc2;
394  packet1.adc3 = packet_in.adc3;
395  packet1.adc4 = packet_in.adc4;
396  packet1.vbat = packet_in.vbat;
397  packet1.temp = packet_in.temp;
398 
399 
400 
401  memset(&packet2, 0, sizeof(packet2));
402  mavlink_msg_raw_aux_encode(system_id, component_id, &msg, &packet1);
403  mavlink_msg_raw_aux_decode(&msg, &packet2);
404  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
405 
406  memset(&packet2, 0, sizeof(packet2));
407  mavlink_msg_raw_aux_pack(system_id, component_id, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.vbat , packet1.temp , packet1.baro );
408  mavlink_msg_raw_aux_decode(&msg, &packet2);
409  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
410 
411  memset(&packet2, 0, sizeof(packet2));
412  mavlink_msg_raw_aux_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.vbat , packet1.temp , packet1.baro );
413  mavlink_msg_raw_aux_decode(&msg, &packet2);
414  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
415 
416  memset(&packet2, 0, sizeof(packet2));
417  mavlink_msg_to_send_buffer(buffer, &msg);
418  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
419  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
420  }
421  mavlink_msg_raw_aux_decode(last_msg, &packet2);
422  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
423 
424  memset(&packet2, 0, sizeof(packet2));
425  mavlink_msg_raw_aux_send(MAVLINK_COMM_1 , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.vbat , packet1.temp , packet1.baro );
426  mavlink_msg_raw_aux_decode(last_msg, &packet2);
427  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
428 }
429 
430 static void mavlink_test_watchdog_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
431 {
432  mavlink_message_t msg;
433  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
434  uint16_t i;
435  mavlink_watchdog_heartbeat_t packet_in = {
436  17235,17339
437  };
438  mavlink_watchdog_heartbeat_t packet1, packet2;
439  memset(&packet1, 0, sizeof(packet1));
440  packet1.watchdog_id = packet_in.watchdog_id;
441  packet1.process_count = packet_in.process_count;
442 
443 
444 
445  memset(&packet2, 0, sizeof(packet2));
446  mavlink_msg_watchdog_heartbeat_encode(system_id, component_id, &msg, &packet1);
447  mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
448  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
449 
450  memset(&packet2, 0, sizeof(packet2));
451  mavlink_msg_watchdog_heartbeat_pack(system_id, component_id, &msg , packet1.watchdog_id , packet1.process_count );
452  mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
453  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
454 
455  memset(&packet2, 0, sizeof(packet2));
456  mavlink_msg_watchdog_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.watchdog_id , packet1.process_count );
457  mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
458  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
459 
460  memset(&packet2, 0, sizeof(packet2));
461  mavlink_msg_to_send_buffer(buffer, &msg);
462  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
463  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
464  }
465  mavlink_msg_watchdog_heartbeat_decode(last_msg, &packet2);
466  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
467 
468  memset(&packet2, 0, sizeof(packet2));
469  mavlink_msg_watchdog_heartbeat_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_count );
470  mavlink_msg_watchdog_heartbeat_decode(last_msg, &packet2);
471  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
472 }
473 
474 static void mavlink_test_watchdog_process_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
475 {
476  mavlink_message_t msg;
477  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
478  uint16_t i;
479  mavlink_watchdog_process_info_t packet_in = {
480  963497464,17443,17547,"IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC","EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST"
481  };
482  mavlink_watchdog_process_info_t packet1, packet2;
483  memset(&packet1, 0, sizeof(packet1));
484  packet1.timeout = packet_in.timeout;
485  packet1.watchdog_id = packet_in.watchdog_id;
486  packet1.process_id = packet_in.process_id;
487 
488  mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*100);
489  mav_array_memcpy(packet1.arguments, packet_in.arguments, sizeof(char)*147);
490 
491 
492  memset(&packet2, 0, sizeof(packet2));
493  mavlink_msg_watchdog_process_info_encode(system_id, component_id, &msg, &packet1);
494  mavlink_msg_watchdog_process_info_decode(&msg, &packet2);
495  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
496 
497  memset(&packet2, 0, sizeof(packet2));
498  mavlink_msg_watchdog_process_info_pack(system_id, component_id, &msg , packet1.watchdog_id , packet1.process_id , packet1.name , packet1.arguments , packet1.timeout );
499  mavlink_msg_watchdog_process_info_decode(&msg, &packet2);
500  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
501 
502  memset(&packet2, 0, sizeof(packet2));
503  mavlink_msg_watchdog_process_info_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.watchdog_id , packet1.process_id , packet1.name , packet1.arguments , packet1.timeout );
504  mavlink_msg_watchdog_process_info_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_watchdog_process_info_decode(last_msg, &packet2);
513  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
514 
515  memset(&packet2, 0, sizeof(packet2));
516  mavlink_msg_watchdog_process_info_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_id , packet1.name , packet1.arguments , packet1.timeout );
517  mavlink_msg_watchdog_process_info_decode(last_msg, &packet2);
518  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
519 }
520 
521 static void mavlink_test_watchdog_process_status(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;
527  963497464,17443,17547,17651,163,230
528  };
529  mavlink_watchdog_process_status_t packet1, packet2;
530  memset(&packet1, 0, sizeof(packet1));
531  packet1.pid = packet_in.pid;
532  packet1.watchdog_id = packet_in.watchdog_id;
533  packet1.process_id = packet_in.process_id;
534  packet1.crashes = packet_in.crashes;
535  packet1.state = packet_in.state;
536  packet1.muted = packet_in.muted;
537 
538 
539 
540  memset(&packet2, 0, sizeof(packet2));
541  mavlink_msg_watchdog_process_status_encode(system_id, component_id, &msg, &packet1);
542  mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
543  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
544 
545  memset(&packet2, 0, sizeof(packet2));
546  mavlink_msg_watchdog_process_status_pack(system_id, component_id, &msg , packet1.watchdog_id , packet1.process_id , packet1.state , packet1.muted , packet1.pid , packet1.crashes );
547  mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
548  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
549 
550  memset(&packet2, 0, sizeof(packet2));
551  mavlink_msg_watchdog_process_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.watchdog_id , packet1.process_id , packet1.state , packet1.muted , packet1.pid , packet1.crashes );
552  mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
553  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
554 
555  memset(&packet2, 0, sizeof(packet2));
556  mavlink_msg_to_send_buffer(buffer, &msg);
557  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
558  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
559  }
560  mavlink_msg_watchdog_process_status_decode(last_msg, &packet2);
561  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
562 
563  memset(&packet2, 0, sizeof(packet2));
564  mavlink_msg_watchdog_process_status_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_id , packet1.state , packet1.muted , packet1.pid , packet1.crashes );
565  mavlink_msg_watchdog_process_status_decode(last_msg, &packet2);
566  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
567 }
568 
569 static void mavlink_test_watchdog_command(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
570 {
571  mavlink_message_t msg;
572  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
573  uint16_t i;
574  mavlink_watchdog_command_t packet_in = {
575  17235,17339,17,84
576  };
577  mavlink_watchdog_command_t packet1, packet2;
578  memset(&packet1, 0, sizeof(packet1));
579  packet1.watchdog_id = packet_in.watchdog_id;
580  packet1.process_id = packet_in.process_id;
581  packet1.target_system_id = packet_in.target_system_id;
582  packet1.command_id = packet_in.command_id;
583 
584 
585 
586  memset(&packet2, 0, sizeof(packet2));
587  mavlink_msg_watchdog_command_encode(system_id, component_id, &msg, &packet1);
588  mavlink_msg_watchdog_command_decode(&msg, &packet2);
589  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
590 
591  memset(&packet2, 0, sizeof(packet2));
592  mavlink_msg_watchdog_command_pack(system_id, component_id, &msg , packet1.target_system_id , packet1.watchdog_id , packet1.process_id , packet1.command_id );
593  mavlink_msg_watchdog_command_decode(&msg, &packet2);
594  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
595 
596  memset(&packet2, 0, sizeof(packet2));
597  mavlink_msg_watchdog_command_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system_id , packet1.watchdog_id , packet1.process_id , packet1.command_id );
598  mavlink_msg_watchdog_command_decode(&msg, &packet2);
599  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
600 
601  memset(&packet2, 0, sizeof(packet2));
602  mavlink_msg_to_send_buffer(buffer, &msg);
603  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
604  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
605  }
606  mavlink_msg_watchdog_command_decode(last_msg, &packet2);
607  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
608 
609  memset(&packet2, 0, sizeof(packet2));
610  mavlink_msg_watchdog_command_send(MAVLINK_COMM_1 , packet1.target_system_id , packet1.watchdog_id , packet1.process_id , packet1.command_id );
611  mavlink_msg_watchdog_command_decode(last_msg, &packet2);
612  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
613 }
614 
615 static void mavlink_test_pattern_detected(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
616 {
617  mavlink_message_t msg;
618  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
619  uint16_t i;
620  mavlink_pattern_detected_t packet_in = {
621  17.0,17,"FGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ",128
622  };
623  mavlink_pattern_detected_t packet1, packet2;
624  memset(&packet1, 0, sizeof(packet1));
625  packet1.confidence = packet_in.confidence;
626  packet1.type = packet_in.type;
627  packet1.detected = packet_in.detected;
628 
629  mav_array_memcpy(packet1.file, packet_in.file, sizeof(char)*100);
630 
631 
632  memset(&packet2, 0, sizeof(packet2));
633  mavlink_msg_pattern_detected_encode(system_id, component_id, &msg, &packet1);
634  mavlink_msg_pattern_detected_decode(&msg, &packet2);
635  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
636 
637  memset(&packet2, 0, sizeof(packet2));
638  mavlink_msg_pattern_detected_pack(system_id, component_id, &msg , packet1.type , packet1.confidence , packet1.file , packet1.detected );
639  mavlink_msg_pattern_detected_decode(&msg, &packet2);
640  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
641 
642  memset(&packet2, 0, sizeof(packet2));
643  mavlink_msg_pattern_detected_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.confidence , packet1.file , packet1.detected );
644  mavlink_msg_pattern_detected_decode(&msg, &packet2);
645  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
646 
647  memset(&packet2, 0, sizeof(packet2));
648  mavlink_msg_to_send_buffer(buffer, &msg);
649  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
650  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
651  }
652  mavlink_msg_pattern_detected_decode(last_msg, &packet2);
653  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
654 
655  memset(&packet2, 0, sizeof(packet2));
656  mavlink_msg_pattern_detected_send(MAVLINK_COMM_1 , packet1.type , packet1.confidence , packet1.file , packet1.detected );
657  mavlink_msg_pattern_detected_decode(last_msg, &packet2);
658  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
659 }
660 
661 static void mavlink_test_point_of_interest(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
662 {
663  mavlink_message_t msg;
664  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
665  uint16_t i;
666  mavlink_point_of_interest_t packet_in = {
667  17.0,45.0,73.0,17859,175,242,53,"RSTUVWXYZABCDEFGHIJKLMNOP"
668  };
669  mavlink_point_of_interest_t packet1, packet2;
670  memset(&packet1, 0, sizeof(packet1));
671  packet1.x = packet_in.x;
672  packet1.y = packet_in.y;
673  packet1.z = packet_in.z;
674  packet1.timeout = packet_in.timeout;
675  packet1.type = packet_in.type;
676  packet1.color = packet_in.color;
677  packet1.coordinate_system = packet_in.coordinate_system;
678 
679  mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*26);
680 
681 
682  memset(&packet2, 0, sizeof(packet2));
683  mavlink_msg_point_of_interest_encode(system_id, component_id, &msg, &packet1);
684  mavlink_msg_point_of_interest_decode(&msg, &packet2);
685  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
686 
687  memset(&packet2, 0, sizeof(packet2));
688  mavlink_msg_point_of_interest_pack(system_id, component_id, &msg , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.x , packet1.y , packet1.z , packet1.name );
689  mavlink_msg_point_of_interest_decode(&msg, &packet2);
690  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
691 
692  memset(&packet2, 0, sizeof(packet2));
693  mavlink_msg_point_of_interest_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.x , packet1.y , packet1.z , packet1.name );
694  mavlink_msg_point_of_interest_decode(&msg, &packet2);
695  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
696 
697  memset(&packet2, 0, sizeof(packet2));
698  mavlink_msg_to_send_buffer(buffer, &msg);
699  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
700  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
701  }
702  mavlink_msg_point_of_interest_decode(last_msg, &packet2);
703  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
704 
705  memset(&packet2, 0, sizeof(packet2));
706  mavlink_msg_point_of_interest_send(MAVLINK_COMM_1 , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.x , packet1.y , packet1.z , packet1.name );
707  mavlink_msg_point_of_interest_decode(last_msg, &packet2);
708  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
709 }
710 
711 static void mavlink_test_point_of_interest_connection(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
712 {
713  mavlink_message_t msg;
714  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
715  uint16_t i;
717  17.0,45.0,73.0,101.0,129.0,157.0,18483,211,22,89,"DEFGHIJKLMNOPQRSTUVWXYZAB"
718  };
720  memset(&packet1, 0, sizeof(packet1));
721  packet1.xp1 = packet_in.xp1;
722  packet1.yp1 = packet_in.yp1;
723  packet1.zp1 = packet_in.zp1;
724  packet1.xp2 = packet_in.xp2;
725  packet1.yp2 = packet_in.yp2;
726  packet1.zp2 = packet_in.zp2;
727  packet1.timeout = packet_in.timeout;
728  packet1.type = packet_in.type;
729  packet1.color = packet_in.color;
730  packet1.coordinate_system = packet_in.coordinate_system;
731 
732  mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*26);
733 
734 
735  memset(&packet2, 0, sizeof(packet2));
736  mavlink_msg_point_of_interest_connection_encode(system_id, component_id, &msg, &packet1);
737  mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
738  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
739 
740  memset(&packet2, 0, sizeof(packet2));
741  mavlink_msg_point_of_interest_connection_pack(system_id, component_id, &msg , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.xp1 , packet1.yp1 , packet1.zp1 , packet1.xp2 , packet1.yp2 , packet1.zp2 , packet1.name );
742  mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
743  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
744 
745  memset(&packet2, 0, sizeof(packet2));
746  mavlink_msg_point_of_interest_connection_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.xp1 , packet1.yp1 , packet1.zp1 , packet1.xp2 , packet1.yp2 , packet1.zp2 , packet1.name );
747  mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
748  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
749 
750  memset(&packet2, 0, sizeof(packet2));
751  mavlink_msg_to_send_buffer(buffer, &msg);
752  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
753  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
754  }
755  mavlink_msg_point_of_interest_connection_decode(last_msg, &packet2);
756  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
757 
758  memset(&packet2, 0, sizeof(packet2));
759  mavlink_msg_point_of_interest_connection_send(MAVLINK_COMM_1 , packet1.type , packet1.color , packet1.coordinate_system , packet1.timeout , packet1.xp1 , packet1.yp1 , packet1.zp1 , packet1.xp2 , packet1.yp2 , packet1.zp2 , packet1.name );
760  mavlink_msg_point_of_interest_connection_decode(last_msg, &packet2);
761  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
762 }
763 
764 static void mavlink_test_brief_feature(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
765 {
766  mavlink_message_t msg;
767  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
768  uint16_t i;
769  mavlink_brief_feature_t packet_in = {
770  17.0,45.0,73.0,101.0,18067,18171,65,{ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163 }
771  };
772  mavlink_brief_feature_t packet1, packet2;
773  memset(&packet1, 0, sizeof(packet1));
774  packet1.x = packet_in.x;
775  packet1.y = packet_in.y;
776  packet1.z = packet_in.z;
777  packet1.response = packet_in.response;
778  packet1.size = packet_in.size;
779  packet1.orientation = packet_in.orientation;
781 
782  mav_array_memcpy(packet1.descriptor, packet_in.descriptor, sizeof(uint8_t)*32);
783 
784 
785  memset(&packet2, 0, sizeof(packet2));
786  mavlink_msg_brief_feature_encode(system_id, component_id, &msg, &packet1);
787  mavlink_msg_brief_feature_decode(&msg, &packet2);
788  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
789 
790  memset(&packet2, 0, sizeof(packet2));
791  mavlink_msg_brief_feature_pack(system_id, component_id, &msg , packet1.x , packet1.y , packet1.z , packet1.orientation_assignment , packet1.size , packet1.orientation , packet1.descriptor , packet1.response );
792  mavlink_msg_brief_feature_decode(&msg, &packet2);
793  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
794 
795  memset(&packet2, 0, sizeof(packet2));
796  mavlink_msg_brief_feature_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.x , packet1.y , packet1.z , packet1.orientation_assignment , packet1.size , packet1.orientation , packet1.descriptor , packet1.response );
797  mavlink_msg_brief_feature_decode(&msg, &packet2);
798  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
799 
800  memset(&packet2, 0, sizeof(packet2));
801  mavlink_msg_to_send_buffer(buffer, &msg);
802  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
803  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
804  }
805  mavlink_msg_brief_feature_decode(last_msg, &packet2);
806  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
807 
808  memset(&packet2, 0, sizeof(packet2));
809  mavlink_msg_brief_feature_send(MAVLINK_COMM_1 , packet1.x , packet1.y , packet1.z , packet1.orientation_assignment , packet1.size , packet1.orientation , packet1.descriptor , packet1.response );
810  mavlink_msg_brief_feature_decode(last_msg, &packet2);
811  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
812 }
813 
814 static void mavlink_test_attitude_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
815 {
816  mavlink_message_t msg;
817  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
818  uint16_t i;
819  mavlink_attitude_control_t packet_in = {
820  17.0,45.0,73.0,101.0,53,120,187,254,65
821  };
822  mavlink_attitude_control_t packet1, packet2;
823  memset(&packet1, 0, sizeof(packet1));
824  packet1.roll = packet_in.roll;
825  packet1.pitch = packet_in.pitch;
826  packet1.yaw = packet_in.yaw;
827  packet1.thrust = packet_in.thrust;
828  packet1.target = packet_in.target;
829  packet1.roll_manual = packet_in.roll_manual;
830  packet1.pitch_manual = packet_in.pitch_manual;
831  packet1.yaw_manual = packet_in.yaw_manual;
832  packet1.thrust_manual = packet_in.thrust_manual;
833 
834 
835 
836  memset(&packet2, 0, sizeof(packet2));
837  mavlink_msg_attitude_control_encode(system_id, component_id, &msg, &packet1);
838  mavlink_msg_attitude_control_decode(&msg, &packet2);
839  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
840 
841  memset(&packet2, 0, sizeof(packet2));
842  mavlink_msg_attitude_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 );
843  mavlink_msg_attitude_control_decode(&msg, &packet2);
844  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
845 
846  memset(&packet2, 0, sizeof(packet2));
847  mavlink_msg_attitude_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 );
848  mavlink_msg_attitude_control_decode(&msg, &packet2);
849  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
850 
851  memset(&packet2, 0, sizeof(packet2));
852  mavlink_msg_to_send_buffer(buffer, &msg);
853  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
854  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
855  }
856  mavlink_msg_attitude_control_decode(last_msg, &packet2);
857  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
858 
859  memset(&packet2, 0, sizeof(packet2));
860  mavlink_msg_attitude_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 );
861  mavlink_msg_attitude_control_decode(last_msg, &packet2);
862  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
863 }
864 
865 static void mavlink_test_detection_stats(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
866 {
867  mavlink_message_t msg;
868  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
869  uint16_t i;
870  mavlink_detection_stats_t packet_in = {
871  963497464,963497672,73.0,963498088,963498296,963498504,963498712,963498920,963499128,963499336,963499544,325.0
872  };
873  mavlink_detection_stats_t packet1, packet2;
874  memset(&packet1, 0, sizeof(packet1));
875  packet1.detections = packet_in.detections;
876  packet1.cluster_iters = packet_in.cluster_iters;
877  packet1.best_score = packet_in.best_score;
878  packet1.best_lat = packet_in.best_lat;
879  packet1.best_lon = packet_in.best_lon;
880  packet1.best_alt = packet_in.best_alt;
881  packet1.best_detection_id = packet_in.best_detection_id;
882  packet1.best_cluster_id = packet_in.best_cluster_id;
883  packet1.best_cluster_iter_id = packet_in.best_cluster_iter_id;
884  packet1.images_done = packet_in.images_done;
885  packet1.images_todo = packet_in.images_todo;
886  packet1.fps = packet_in.fps;
887 
888 
889 
890  memset(&packet2, 0, sizeof(packet2));
891  mavlink_msg_detection_stats_encode(system_id, component_id, &msg, &packet1);
892  mavlink_msg_detection_stats_decode(&msg, &packet2);
893  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
894 
895  memset(&packet2, 0, sizeof(packet2));
896  mavlink_msg_detection_stats_pack(system_id, component_id, &msg , packet1.detections , packet1.cluster_iters , packet1.best_score , packet1.best_lat , packet1.best_lon , packet1.best_alt , packet1.best_detection_id , packet1.best_cluster_id , packet1.best_cluster_iter_id , packet1.images_done , packet1.images_todo , packet1.fps );
897  mavlink_msg_detection_stats_decode(&msg, &packet2);
898  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
899 
900  memset(&packet2, 0, sizeof(packet2));
901  mavlink_msg_detection_stats_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.detections , packet1.cluster_iters , packet1.best_score , packet1.best_lat , packet1.best_lon , packet1.best_alt , packet1.best_detection_id , packet1.best_cluster_id , packet1.best_cluster_iter_id , packet1.images_done , packet1.images_todo , packet1.fps );
902  mavlink_msg_detection_stats_decode(&msg, &packet2);
903  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
904 
905  memset(&packet2, 0, sizeof(packet2));
906  mavlink_msg_to_send_buffer(buffer, &msg);
907  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
908  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
909  }
910  mavlink_msg_detection_stats_decode(last_msg, &packet2);
911  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
912 
913  memset(&packet2, 0, sizeof(packet2));
914  mavlink_msg_detection_stats_send(MAVLINK_COMM_1 , packet1.detections , packet1.cluster_iters , packet1.best_score , packet1.best_lat , packet1.best_lon , packet1.best_alt , packet1.best_detection_id , packet1.best_cluster_id , packet1.best_cluster_iter_id , packet1.images_done , packet1.images_todo , packet1.fps );
915  mavlink_msg_detection_stats_decode(last_msg, &packet2);
916  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
917 }
918 
919 static void mavlink_test_onboard_health(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
920 {
921  mavlink_message_t msg;
922  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
923  uint16_t i;
924  mavlink_onboard_health_t packet_in = {
925  963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,18899,235,46,113,180,247
926  };
927  mavlink_onboard_health_t packet1, packet2;
928  memset(&packet1, 0, sizeof(packet1));
929  packet1.uptime = packet_in.uptime;
930  packet1.ram_total = packet_in.ram_total;
931  packet1.swap_total = packet_in.swap_total;
932  packet1.disk_total = packet_in.disk_total;
933  packet1.temp = packet_in.temp;
934  packet1.voltage = packet_in.voltage;
935  packet1.network_load_in = packet_in.network_load_in;
936  packet1.network_load_out = packet_in.network_load_out;
937  packet1.cpu_freq = packet_in.cpu_freq;
938  packet1.cpu_load = packet_in.cpu_load;
939  packet1.ram_usage = packet_in.ram_usage;
940  packet1.swap_usage = packet_in.swap_usage;
941  packet1.disk_health = packet_in.disk_health;
942  packet1.disk_usage = packet_in.disk_usage;
943 
944 
945 
946  memset(&packet2, 0, sizeof(packet2));
947  mavlink_msg_onboard_health_encode(system_id, component_id, &msg, &packet1);
948  mavlink_msg_onboard_health_decode(&msg, &packet2);
949  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
950 
951  memset(&packet2, 0, sizeof(packet2));
952  mavlink_msg_onboard_health_pack(system_id, component_id, &msg , packet1.uptime , packet1.cpu_freq , packet1.cpu_load , packet1.ram_usage , packet1.ram_total , packet1.swap_usage , packet1.swap_total , packet1.disk_health , packet1.disk_usage , packet1.disk_total , packet1.temp , packet1.voltage , packet1.network_load_in , packet1.network_load_out );
953  mavlink_msg_onboard_health_decode(&msg, &packet2);
954  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
955 
956  memset(&packet2, 0, sizeof(packet2));
957  mavlink_msg_onboard_health_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.uptime , packet1.cpu_freq , packet1.cpu_load , packet1.ram_usage , packet1.ram_total , packet1.swap_usage , packet1.swap_total , packet1.disk_health , packet1.disk_usage , packet1.disk_total , packet1.temp , packet1.voltage , packet1.network_load_in , packet1.network_load_out );
958  mavlink_msg_onboard_health_decode(&msg, &packet2);
959  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
960 
961  memset(&packet2, 0, sizeof(packet2));
962  mavlink_msg_to_send_buffer(buffer, &msg);
963  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
964  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
965  }
966  mavlink_msg_onboard_health_decode(last_msg, &packet2);
967  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
968 
969  memset(&packet2, 0, sizeof(packet2));
970  mavlink_msg_onboard_health_send(MAVLINK_COMM_1 , packet1.uptime , packet1.cpu_freq , packet1.cpu_load , packet1.ram_usage , packet1.ram_total , packet1.swap_usage , packet1.swap_total , packet1.disk_health , packet1.disk_usage , packet1.disk_total , packet1.temp , packet1.voltage , packet1.network_load_in , packet1.network_load_out );
971  mavlink_msg_onboard_health_decode(last_msg, &packet2);
972  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
973 }
974 
975 static void mavlink_test_pixhawk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
976 {
977  mavlink_test_set_cam_shutter(system_id, component_id, last_msg);
978  mavlink_test_image_triggered(system_id, component_id, last_msg);
979  mavlink_test_image_trigger_control(system_id, component_id, last_msg);
980  mavlink_test_image_available(system_id, component_id, last_msg);
981  mavlink_test_set_position_control_offset(system_id, component_id, last_msg);
982  mavlink_test_position_control_setpoint(system_id, component_id, last_msg);
983  mavlink_test_marker(system_id, component_id, last_msg);
984  mavlink_test_raw_aux(system_id, component_id, last_msg);
985  mavlink_test_watchdog_heartbeat(system_id, component_id, last_msg);
986  mavlink_test_watchdog_process_info(system_id, component_id, last_msg);
987  mavlink_test_watchdog_process_status(system_id, component_id, last_msg);
988  mavlink_test_watchdog_command(system_id, component_id, last_msg);
989  mavlink_test_pattern_detected(system_id, component_id, last_msg);
990  mavlink_test_point_of_interest(system_id, component_id, last_msg);
991  mavlink_test_point_of_interest_connection(system_id, component_id, last_msg);
992  mavlink_test_brief_feature(system_id, component_id, last_msg);
993  mavlink_test_attitude_control(system_id, component_id, last_msg);
994  mavlink_test_detection_stats(system_id, component_id, last_msg);
995  mavlink_test_onboard_health(system_id, component_id, last_msg);
996 }
997 
998 #ifdef __cplusplus
999 }
1000 #endif // __cplusplus
1001 #endif // PIXHAWK_TESTSUITE_H
#define MAVLINK_ASSERT(x)
Definition: protocol.h:26