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 ASLUAV_TESTSUITE_H
6 #define ASLUAV_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_ASLUAV(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_ASLUAV(system_id, component_id, last_msg);
21 }
22 #endif
23 
24 #include "../common/testsuite.h"
25 
26 
27 static void mavlink_test_sens_power(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_sens_power_t packet_in = {
33  17.0,45.0,73.0,101.0
34  };
35  mavlink_sens_power_t packet1, packet2;
36  memset(&packet1, 0, sizeof(packet1));
37  packet1.adc121_vspb_volt = packet_in.adc121_vspb_volt;
38  packet1.adc121_cspb_amp = packet_in.adc121_cspb_amp;
39  packet1.adc121_cs1_amp = packet_in.adc121_cs1_amp;
40  packet1.adc121_cs2_amp = packet_in.adc121_cs2_amp;
41 
42 
43 
44  memset(&packet2, 0, sizeof(packet2));
45  mavlink_msg_sens_power_encode(system_id, component_id, &msg, &packet1);
46  mavlink_msg_sens_power_decode(&msg, &packet2);
47  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
48 
49  memset(&packet2, 0, sizeof(packet2));
50  mavlink_msg_sens_power_pack(system_id, component_id, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
51  mavlink_msg_sens_power_decode(&msg, &packet2);
52  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
53 
54  memset(&packet2, 0, sizeof(packet2));
55  mavlink_msg_sens_power_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
56  mavlink_msg_sens_power_decode(&msg, &packet2);
57  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
58 
59  memset(&packet2, 0, sizeof(packet2));
60  mavlink_msg_to_send_buffer(buffer, &msg);
61  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
62  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
63  }
64  mavlink_msg_sens_power_decode(last_msg, &packet2);
65  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
66 
67  memset(&packet2, 0, sizeof(packet2));
68  mavlink_msg_sens_power_send(MAVLINK_COMM_1 , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
69  mavlink_msg_sens_power_decode(last_msg, &packet2);
70  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
71 }
72 
73 static void mavlink_test_sens_mppt(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
74 {
75  mavlink_message_t msg;
76  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
77  uint16_t i;
78  mavlink_sens_mppt_t packet_in = {
79  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,18899,19003,19107,247,58,125
80  };
81  mavlink_sens_mppt_t packet1, packet2;
82  memset(&packet1, 0, sizeof(packet1));
83  packet1.mppt_timestamp = packet_in.mppt_timestamp;
84  packet1.mppt1_volt = packet_in.mppt1_volt;
85  packet1.mppt1_amp = packet_in.mppt1_amp;
86  packet1.mppt2_volt = packet_in.mppt2_volt;
87  packet1.mppt2_amp = packet_in.mppt2_amp;
88  packet1.mppt3_volt = packet_in.mppt3_volt;
89  packet1.mppt3_amp = packet_in.mppt3_amp;
90  packet1.mppt1_pwm = packet_in.mppt1_pwm;
91  packet1.mppt2_pwm = packet_in.mppt2_pwm;
92  packet1.mppt3_pwm = packet_in.mppt3_pwm;
93  packet1.mppt1_status = packet_in.mppt1_status;
94  packet1.mppt2_status = packet_in.mppt2_status;
95  packet1.mppt3_status = packet_in.mppt3_status;
96 
97 
98 
99  memset(&packet2, 0, sizeof(packet2));
100  mavlink_msg_sens_mppt_encode(system_id, component_id, &msg, &packet1);
101  mavlink_msg_sens_mppt_decode(&msg, &packet2);
102  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
103 
104  memset(&packet2, 0, sizeof(packet2));
105  mavlink_msg_sens_mppt_pack(system_id, component_id, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
106  mavlink_msg_sens_mppt_decode(&msg, &packet2);
107  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
108 
109  memset(&packet2, 0, sizeof(packet2));
110  mavlink_msg_sens_mppt_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
111  mavlink_msg_sens_mppt_decode(&msg, &packet2);
112  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
113 
114  memset(&packet2, 0, sizeof(packet2));
115  mavlink_msg_to_send_buffer(buffer, &msg);
116  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
117  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
118  }
119  mavlink_msg_sens_mppt_decode(last_msg, &packet2);
120  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
121 
122  memset(&packet2, 0, sizeof(packet2));
123  mavlink_msg_sens_mppt_send(MAVLINK_COMM_1 , packet1.mppt_timestamp , packet1.mppt1_volt , packet1.mppt1_amp , packet1.mppt1_pwm , packet1.mppt1_status , packet1.mppt2_volt , packet1.mppt2_amp , packet1.mppt2_pwm , packet1.mppt2_status , packet1.mppt3_volt , packet1.mppt3_amp , packet1.mppt3_pwm , packet1.mppt3_status );
124  mavlink_msg_sens_mppt_decode(last_msg, &packet2);
125  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
126 }
127 
128 static void mavlink_test_aslctrl_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
129 {
130  mavlink_message_t msg;
131  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
132  uint16_t i;
133  mavlink_aslctrl_data_t packet_in = {
134  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0,605.0,633.0,661.0,37,104
135  };
136  mavlink_aslctrl_data_t packet1, packet2;
137  memset(&packet1, 0, sizeof(packet1));
138  packet1.timestamp = packet_in.timestamp;
139  packet1.h = packet_in.h;
140  packet1.hRef = packet_in.hRef;
141  packet1.hRef_t = packet_in.hRef_t;
142  packet1.PitchAngle = packet_in.PitchAngle;
143  packet1.PitchAngleRef = packet_in.PitchAngleRef;
144  packet1.q = packet_in.q;
145  packet1.qRef = packet_in.qRef;
146  packet1.uElev = packet_in.uElev;
147  packet1.uThrot = packet_in.uThrot;
148  packet1.uThrot2 = packet_in.uThrot2;
149  packet1.aZ = packet_in.aZ;
150  packet1.AirspeedRef = packet_in.AirspeedRef;
151  packet1.YawAngle = packet_in.YawAngle;
152  packet1.YawAngleRef = packet_in.YawAngleRef;
153  packet1.RollAngle = packet_in.RollAngle;
154  packet1.RollAngleRef = packet_in.RollAngleRef;
155  packet1.p = packet_in.p;
156  packet1.pRef = packet_in.pRef;
157  packet1.r = packet_in.r;
158  packet1.rRef = packet_in.rRef;
159  packet1.uAil = packet_in.uAil;
160  packet1.uRud = packet_in.uRud;
161  packet1.aslctrl_mode = packet_in.aslctrl_mode;
162  packet1.SpoilersEngaged = packet_in.SpoilersEngaged;
163 
164 
165 
166  memset(&packet2, 0, sizeof(packet2));
167  mavlink_msg_aslctrl_data_encode(system_id, component_id, &msg, &packet1);
168  mavlink_msg_aslctrl_data_decode(&msg, &packet2);
169  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
170 
171  memset(&packet2, 0, sizeof(packet2));
172  mavlink_msg_aslctrl_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.aZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
173  mavlink_msg_aslctrl_data_decode(&msg, &packet2);
174  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
175 
176  memset(&packet2, 0, sizeof(packet2));
177  mavlink_msg_aslctrl_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.aZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
178  mavlink_msg_aslctrl_data_decode(&msg, &packet2);
179  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
180 
181  memset(&packet2, 0, sizeof(packet2));
182  mavlink_msg_to_send_buffer(buffer, &msg);
183  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
184  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
185  }
186  mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
187  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
188 
189  memset(&packet2, 0, sizeof(packet2));
190  mavlink_msg_aslctrl_data_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.aslctrl_mode , packet1.h , packet1.hRef , packet1.hRef_t , packet1.PitchAngle , packet1.PitchAngleRef , packet1.q , packet1.qRef , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.aZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
191  mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
192  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
193 }
194 
195 static void mavlink_test_aslctrl_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
196 {
197  mavlink_message_t msg;
198  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
199  uint16_t i;
200  mavlink_aslctrl_debug_t packet_in = {
201  963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,113,180
202  };
203  mavlink_aslctrl_debug_t packet1, packet2;
204  memset(&packet1, 0, sizeof(packet1));
205  packet1.i32_1 = packet_in.i32_1;
206  packet1.f_1 = packet_in.f_1;
207  packet1.f_2 = packet_in.f_2;
208  packet1.f_3 = packet_in.f_3;
209  packet1.f_4 = packet_in.f_4;
210  packet1.f_5 = packet_in.f_5;
211  packet1.f_6 = packet_in.f_6;
212  packet1.f_7 = packet_in.f_7;
213  packet1.f_8 = packet_in.f_8;
214  packet1.i8_1 = packet_in.i8_1;
215  packet1.i8_2 = packet_in.i8_2;
216 
217 
218 
219  memset(&packet2, 0, sizeof(packet2));
220  mavlink_msg_aslctrl_debug_encode(system_id, component_id, &msg, &packet1);
221  mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
222  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
223 
224  memset(&packet2, 0, sizeof(packet2));
225  mavlink_msg_aslctrl_debug_pack(system_id, component_id, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
226  mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
227  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
228 
229  memset(&packet2, 0, sizeof(packet2));
230  mavlink_msg_aslctrl_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
231  mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
232  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
233 
234  memset(&packet2, 0, sizeof(packet2));
235  mavlink_msg_to_send_buffer(buffer, &msg);
236  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
237  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
238  }
239  mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
240  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
241 
242  memset(&packet2, 0, sizeof(packet2));
243  mavlink_msg_aslctrl_debug_send(MAVLINK_COMM_1 , packet1.i32_1 , packet1.i8_1 , packet1.i8_2 , packet1.f_1 , packet1.f_2 , packet1.f_3 , packet1.f_4 , packet1.f_5 , packet1.f_6 , packet1.f_7 , packet1.f_8 );
244  mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
245  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
246 }
247 
248 static void mavlink_test_asluav_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
249 {
250  mavlink_message_t msg;
251  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
252  uint16_t i;
253  mavlink_asluav_status_t packet_in = {
254  17.0,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158 }
255  };
256  mavlink_asluav_status_t packet1, packet2;
257  memset(&packet1, 0, sizeof(packet1));
258  packet1.Motor_rpm = packet_in.Motor_rpm;
259  packet1.LED_status = packet_in.LED_status;
260  packet1.SATCOM_status = packet_in.SATCOM_status;
261 
262  mav_array_memcpy(packet1.Servo_status, packet_in.Servo_status, sizeof(uint8_t)*8);
263 
264 
265  memset(&packet2, 0, sizeof(packet2));
266  mavlink_msg_asluav_status_encode(system_id, component_id, &msg, &packet1);
267  mavlink_msg_asluav_status_decode(&msg, &packet2);
268  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
269 
270  memset(&packet2, 0, sizeof(packet2));
271  mavlink_msg_asluav_status_pack(system_id, component_id, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
272  mavlink_msg_asluav_status_decode(&msg, &packet2);
273  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
274 
275  memset(&packet2, 0, sizeof(packet2));
276  mavlink_msg_asluav_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
277  mavlink_msg_asluav_status_decode(&msg, &packet2);
278  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
279 
280  memset(&packet2, 0, sizeof(packet2));
281  mavlink_msg_to_send_buffer(buffer, &msg);
282  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
283  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
284  }
285  mavlink_msg_asluav_status_decode(last_msg, &packet2);
286  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
287 
288  memset(&packet2, 0, sizeof(packet2));
289  mavlink_msg_asluav_status_send(MAVLINK_COMM_1 , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
290  mavlink_msg_asluav_status_decode(last_msg, &packet2);
291  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
292 }
293 
294 static void mavlink_test_ekf_ext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
295 {
296  mavlink_message_t msg;
297  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
298  uint16_t i;
299  mavlink_ekf_ext_t packet_in = {
300  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0
301  };
302  mavlink_ekf_ext_t packet1, packet2;
303  memset(&packet1, 0, sizeof(packet1));
304  packet1.timestamp = packet_in.timestamp;
305  packet1.Windspeed = packet_in.Windspeed;
306  packet1.WindDir = packet_in.WindDir;
307  packet1.WindZ = packet_in.WindZ;
308  packet1.Airspeed = packet_in.Airspeed;
309  packet1.beta = packet_in.beta;
310  packet1.alpha = packet_in.alpha;
311 
312 
313 
314  memset(&packet2, 0, sizeof(packet2));
315  mavlink_msg_ekf_ext_encode(system_id, component_id, &msg, &packet1);
316  mavlink_msg_ekf_ext_decode(&msg, &packet2);
317  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
318 
319  memset(&packet2, 0, sizeof(packet2));
320  mavlink_msg_ekf_ext_pack(system_id, component_id, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
321  mavlink_msg_ekf_ext_decode(&msg, &packet2);
322  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
323 
324  memset(&packet2, 0, sizeof(packet2));
325  mavlink_msg_ekf_ext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
326  mavlink_msg_ekf_ext_decode(&msg, &packet2);
327  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
328 
329  memset(&packet2, 0, sizeof(packet2));
330  mavlink_msg_to_send_buffer(buffer, &msg);
331  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
332  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
333  }
334  mavlink_msg_ekf_ext_decode(last_msg, &packet2);
335  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
336 
337  memset(&packet2, 0, sizeof(packet2));
338  mavlink_msg_ekf_ext_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
339  mavlink_msg_ekf_ext_decode(last_msg, &packet2);
340  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
341 }
342 
343 static void mavlink_test_asl_obctrl(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
344 {
345  mavlink_message_t msg;
346  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
347  uint16_t i;
348  mavlink_asl_obctrl_t packet_in = {
349  93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,101
350  };
351  mavlink_asl_obctrl_t packet1, packet2;
352  memset(&packet1, 0, sizeof(packet1));
353  packet1.timestamp = packet_in.timestamp;
354  packet1.uElev = packet_in.uElev;
355  packet1.uThrot = packet_in.uThrot;
356  packet1.uThrot2 = packet_in.uThrot2;
357  packet1.uAilL = packet_in.uAilL;
358  packet1.uAilR = packet_in.uAilR;
359  packet1.uRud = packet_in.uRud;
360  packet1.obctrl_status = packet_in.obctrl_status;
361 
362 
363 
364  memset(&packet2, 0, sizeof(packet2));
365  mavlink_msg_asl_obctrl_encode(system_id, component_id, &msg, &packet1);
366  mavlink_msg_asl_obctrl_decode(&msg, &packet2);
367  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
368 
369  memset(&packet2, 0, sizeof(packet2));
370  mavlink_msg_asl_obctrl_pack(system_id, component_id, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
371  mavlink_msg_asl_obctrl_decode(&msg, &packet2);
372  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
373 
374  memset(&packet2, 0, sizeof(packet2));
375  mavlink_msg_asl_obctrl_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
376  mavlink_msg_asl_obctrl_decode(&msg, &packet2);
377  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
378 
379  memset(&packet2, 0, sizeof(packet2));
380  mavlink_msg_to_send_buffer(buffer, &msg);
381  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
382  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
383  }
384  mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
385  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
386 
387  memset(&packet2, 0, sizeof(packet2));
388  mavlink_msg_asl_obctrl_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.uElev , packet1.uThrot , packet1.uThrot2 , packet1.uAilL , packet1.uAilR , packet1.uRud , packet1.obctrl_status );
389  mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
390  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
391 }
392 
393 static void mavlink_test_sens_atmos(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
394 {
395  mavlink_message_t msg;
396  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
397  uint16_t i;
398  mavlink_sens_atmos_t packet_in = {
399  17.0,45.0
400  };
401  mavlink_sens_atmos_t packet1, packet2;
402  memset(&packet1, 0, sizeof(packet1));
403  packet1.TempAmbient = packet_in.TempAmbient;
404  packet1.Humidity = packet_in.Humidity;
405 
406 
407 
408  memset(&packet2, 0, sizeof(packet2));
409  mavlink_msg_sens_atmos_encode(system_id, component_id, &msg, &packet1);
410  mavlink_msg_sens_atmos_decode(&msg, &packet2);
411  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
412 
413  memset(&packet2, 0, sizeof(packet2));
414  mavlink_msg_sens_atmos_pack(system_id, component_id, &msg , packet1.TempAmbient , packet1.Humidity );
415  mavlink_msg_sens_atmos_decode(&msg, &packet2);
416  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
417 
418  memset(&packet2, 0, sizeof(packet2));
419  mavlink_msg_sens_atmos_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.TempAmbient , packet1.Humidity );
420  mavlink_msg_sens_atmos_decode(&msg, &packet2);
421  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
422 
423  memset(&packet2, 0, sizeof(packet2));
424  mavlink_msg_to_send_buffer(buffer, &msg);
425  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
426  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
427  }
428  mavlink_msg_sens_atmos_decode(last_msg, &packet2);
429  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
430 
431  memset(&packet2, 0, sizeof(packet2));
432  mavlink_msg_sens_atmos_send(MAVLINK_COMM_1 , packet1.TempAmbient , packet1.Humidity );
433  mavlink_msg_sens_atmos_decode(last_msg, &packet2);
434  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
435 }
436 
437 static void mavlink_test_sens_batmon(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
438 {
439  mavlink_message_t msg;
440  uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
441  uint16_t i;
442  mavlink_sens_batmon_t packet_in = {
443  17235,17339,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379
444  };
445  mavlink_sens_batmon_t packet1, packet2;
446  memset(&packet1, 0, sizeof(packet1));
447  packet1.temperature = packet_in.temperature;
448  packet1.voltage = packet_in.voltage;
449  packet1.current = packet_in.current;
450  packet1.batterystatus = packet_in.batterystatus;
451  packet1.serialnumber = packet_in.serialnumber;
452  packet1.hostfetcontrol = packet_in.hostfetcontrol;
453  packet1.cellvoltage1 = packet_in.cellvoltage1;
454  packet1.cellvoltage2 = packet_in.cellvoltage2;
455  packet1.cellvoltage3 = packet_in.cellvoltage3;
456  packet1.cellvoltage4 = packet_in.cellvoltage4;
457  packet1.cellvoltage5 = packet_in.cellvoltage5;
458  packet1.cellvoltage6 = packet_in.cellvoltage6;
459 
460 
461 
462  memset(&packet2, 0, sizeof(packet2));
463  mavlink_msg_sens_batmon_encode(system_id, component_id, &msg, &packet1);
464  mavlink_msg_sens_batmon_decode(&msg, &packet2);
465  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
466 
467  memset(&packet2, 0, sizeof(packet2));
468  mavlink_msg_sens_batmon_pack(system_id, component_id, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
469  mavlink_msg_sens_batmon_decode(&msg, &packet2);
470  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
471 
472  memset(&packet2, 0, sizeof(packet2));
473  mavlink_msg_sens_batmon_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
474  mavlink_msg_sens_batmon_decode(&msg, &packet2);
475  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
476 
477  memset(&packet2, 0, sizeof(packet2));
478  mavlink_msg_to_send_buffer(buffer, &msg);
479  for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
480  comm_send_ch(MAVLINK_COMM_0, buffer[i]);
481  }
482  mavlink_msg_sens_batmon_decode(last_msg, &packet2);
483  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
484 
485  memset(&packet2, 0, sizeof(packet2));
486  mavlink_msg_sens_batmon_send(MAVLINK_COMM_1 , packet1.temperature , packet1.voltage , packet1.current , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
487  mavlink_msg_sens_batmon_decode(last_msg, &packet2);
488  MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
489 }
490 
491 static void mavlink_test_ASLUAV(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
492 {
493  mavlink_test_sens_power(system_id, component_id, last_msg);
494  mavlink_test_sens_mppt(system_id, component_id, last_msg);
495  mavlink_test_aslctrl_data(system_id, component_id, last_msg);
496  mavlink_test_aslctrl_debug(system_id, component_id, last_msg);
497  mavlink_test_asluav_status(system_id, component_id, last_msg);
498  mavlink_test_ekf_ext(system_id, component_id, last_msg);
499  mavlink_test_asl_obctrl(system_id, component_id, last_msg);
500  mavlink_test_sens_atmos(system_id, component_id, last_msg);
501  mavlink_test_sens_batmon(system_id, component_id, last_msg);
502 }
503 
504 #ifdef __cplusplus
505 }
506 #endif // __cplusplus
507 #endif // ASLUAV_TESTSUITE_H
#define MAVLINK_ASSERT(x)
Definition: protocol.h:26