RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
testsuite.h
浏览该文件的文档.
1
5#pragma once
6#ifndef ASLUAV_TESTSUITE_H
7#define ASLUAV_TESTSUITE_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#ifndef MAVLINK_TEST_ALL
14#define MAVLINK_TEST_ALL
15static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
16static void mavlink_test_ASLUAV(uint8_t, uint8_t, mavlink_message_t *last_msg);
17
18static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
19{
20 mavlink_test_common(system_id, component_id, last_msg);
21 mavlink_test_ASLUAV(system_id, component_id, last_msg);
22}
23#endif
24
25#include "../common/testsuite.h"
26
27
28static void mavlink_test_sens_power(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
29{
30#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
31 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
32 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER >= 256) {
33 return;
34 }
35#endif
36 mavlink_message_t msg;
37 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
38 uint16_t i;
39 mavlink_sens_power_t packet_in = {
40 17.0,45.0,73.0,101.0
41 };
42 mavlink_sens_power_t packet1, packet2;
43 memset(&packet1, 0, sizeof(packet1));
44 packet1.adc121_vspb_volt = packet_in.adc121_vspb_volt;
45 packet1.adc121_cspb_amp = packet_in.adc121_cspb_amp;
46 packet1.adc121_cs1_amp = packet_in.adc121_cs1_amp;
47 packet1.adc121_cs2_amp = packet_in.adc121_cs2_amp;
48
49
50#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
51 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
52 // cope with extensions
53 memset(MAVLINK_MSG_ID_SENS_POWER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_MIN_LEN);
54 }
55#endif
56 memset(&packet2, 0, sizeof(packet2));
57 mavlink_msg_sens_power_encode(system_id, component_id, &msg, &packet1);
58 mavlink_msg_sens_power_decode(&msg, &packet2);
59 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
60
61 memset(&packet2, 0, sizeof(packet2));
62 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 );
63 mavlink_msg_sens_power_decode(&msg, &packet2);
64 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
65
66 memset(&packet2, 0, sizeof(packet2));
67 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 );
68 mavlink_msg_sens_power_decode(&msg, &packet2);
69 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
70
71 memset(&packet2, 0, sizeof(packet2));
72 mavlink_msg_to_send_buffer(buffer, &msg);
73 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
74 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
75 }
76 mavlink_msg_sens_power_decode(last_msg, &packet2);
77 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
78
79 memset(&packet2, 0, sizeof(packet2));
80 mavlink_msg_sens_power_send(MAVLINK_COMM_1 , packet1.adc121_vspb_volt , packet1.adc121_cspb_amp , packet1.adc121_cs1_amp , packet1.adc121_cs2_amp );
81 mavlink_msg_sens_power_decode(last_msg, &packet2);
82 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
83}
84
85static void mavlink_test_sens_mppt(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
86{
87#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
88 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
89 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_MPPT >= 256) {
90 return;
91 }
92#endif
93 mavlink_message_t msg;
94 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
95 uint16_t i;
96 mavlink_sens_mppt_t packet_in = {
97 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,18899,19003,19107,247,58,125
98 };
99 mavlink_sens_mppt_t packet1, packet2;
100 memset(&packet1, 0, sizeof(packet1));
101 packet1.mppt_timestamp = packet_in.mppt_timestamp;
102 packet1.mppt1_volt = packet_in.mppt1_volt;
103 packet1.mppt1_amp = packet_in.mppt1_amp;
104 packet1.mppt2_volt = packet_in.mppt2_volt;
105 packet1.mppt2_amp = packet_in.mppt2_amp;
106 packet1.mppt3_volt = packet_in.mppt3_volt;
107 packet1.mppt3_amp = packet_in.mppt3_amp;
108 packet1.mppt1_pwm = packet_in.mppt1_pwm;
109 packet1.mppt2_pwm = packet_in.mppt2_pwm;
110 packet1.mppt3_pwm = packet_in.mppt3_pwm;
111 packet1.mppt1_status = packet_in.mppt1_status;
112 packet1.mppt2_status = packet_in.mppt2_status;
113 packet1.mppt3_status = packet_in.mppt3_status;
114
115
116#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
117 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
118 // cope with extensions
119 memset(MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_MPPT_MIN_LEN);
120 }
121#endif
122 memset(&packet2, 0, sizeof(packet2));
123 mavlink_msg_sens_mppt_encode(system_id, component_id, &msg, &packet1);
124 mavlink_msg_sens_mppt_decode(&msg, &packet2);
125 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
126
127 memset(&packet2, 0, sizeof(packet2));
128 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 );
129 mavlink_msg_sens_mppt_decode(&msg, &packet2);
130 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
131
132 memset(&packet2, 0, sizeof(packet2));
133 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 );
134 mavlink_msg_sens_mppt_decode(&msg, &packet2);
135 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
136
137 memset(&packet2, 0, sizeof(packet2));
138 mavlink_msg_to_send_buffer(buffer, &msg);
139 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
140 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
141 }
142 mavlink_msg_sens_mppt_decode(last_msg, &packet2);
143 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
144
145 memset(&packet2, 0, sizeof(packet2));
146 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 );
147 mavlink_msg_sens_mppt_decode(last_msg, &packet2);
148 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
149}
150
151static void mavlink_test_aslctrl_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
152{
153#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
154 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
155 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DATA >= 256) {
156 return;
157 }
158#endif
159 mavlink_message_t msg;
160 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
161 uint16_t i;
162 mavlink_aslctrl_data_t packet_in = {
163 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
164 };
165 mavlink_aslctrl_data_t packet1, packet2;
166 memset(&packet1, 0, sizeof(packet1));
167 packet1.timestamp = packet_in.timestamp;
168 packet1.h = packet_in.h;
169 packet1.hRef = packet_in.hRef;
170 packet1.hRef_t = packet_in.hRef_t;
171 packet1.PitchAngle = packet_in.PitchAngle;
172 packet1.PitchAngleRef = packet_in.PitchAngleRef;
173 packet1.q = packet_in.q;
174 packet1.qRef = packet_in.qRef;
175 packet1.uElev = packet_in.uElev;
176 packet1.uThrot = packet_in.uThrot;
177 packet1.uThrot2 = packet_in.uThrot2;
178 packet1.nZ = packet_in.nZ;
179 packet1.AirspeedRef = packet_in.AirspeedRef;
180 packet1.YawAngle = packet_in.YawAngle;
181 packet1.YawAngleRef = packet_in.YawAngleRef;
182 packet1.RollAngle = packet_in.RollAngle;
183 packet1.RollAngleRef = packet_in.RollAngleRef;
184 packet1.p = packet_in.p;
185 packet1.pRef = packet_in.pRef;
186 packet1.r = packet_in.r;
187 packet1.rRef = packet_in.rRef;
188 packet1.uAil = packet_in.uAil;
189 packet1.uRud = packet_in.uRud;
190 packet1.aslctrl_mode = packet_in.aslctrl_mode;
191 packet1.SpoilersEngaged = packet_in.SpoilersEngaged;
192
193
194#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
195 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
196 // cope with extensions
197 memset(MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DATA_MIN_LEN);
198 }
199#endif
200 memset(&packet2, 0, sizeof(packet2));
201 mavlink_msg_aslctrl_data_encode(system_id, component_id, &msg, &packet1);
202 mavlink_msg_aslctrl_data_decode(&msg, &packet2);
203 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
204
205 memset(&packet2, 0, sizeof(packet2));
206 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.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
207 mavlink_msg_aslctrl_data_decode(&msg, &packet2);
208 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
209
210 memset(&packet2, 0, sizeof(packet2));
211 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.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
212 mavlink_msg_aslctrl_data_decode(&msg, &packet2);
213 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
214
215 memset(&packet2, 0, sizeof(packet2));
216 mavlink_msg_to_send_buffer(buffer, &msg);
217 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
218 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
219 }
220 mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
221 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
222
223 memset(&packet2, 0, sizeof(packet2));
224 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.nZ , packet1.AirspeedRef , packet1.SpoilersEngaged , packet1.YawAngle , packet1.YawAngleRef , packet1.RollAngle , packet1.RollAngleRef , packet1.p , packet1.pRef , packet1.r , packet1.rRef , packet1.uAil , packet1.uRud );
225 mavlink_msg_aslctrl_data_decode(last_msg, &packet2);
226 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
227}
228
229static void mavlink_test_aslctrl_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
230{
231#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
232 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
233 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLCTRL_DEBUG >= 256) {
234 return;
235 }
236#endif
237 mavlink_message_t msg;
238 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
239 uint16_t i;
240 mavlink_aslctrl_debug_t packet_in = {
241 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,113,180
242 };
243 mavlink_aslctrl_debug_t packet1, packet2;
244 memset(&packet1, 0, sizeof(packet1));
245 packet1.i32_1 = packet_in.i32_1;
246 packet1.f_1 = packet_in.f_1;
247 packet1.f_2 = packet_in.f_2;
248 packet1.f_3 = packet_in.f_3;
249 packet1.f_4 = packet_in.f_4;
250 packet1.f_5 = packet_in.f_5;
251 packet1.f_6 = packet_in.f_6;
252 packet1.f_7 = packet_in.f_7;
253 packet1.f_8 = packet_in.f_8;
254 packet1.i8_1 = packet_in.i8_1;
255 packet1.i8_2 = packet_in.i8_2;
256
257
258#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
259 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
260 // cope with extensions
261 memset(MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLCTRL_DEBUG_MIN_LEN);
262 }
263#endif
264 memset(&packet2, 0, sizeof(packet2));
265 mavlink_msg_aslctrl_debug_encode(system_id, component_id, &msg, &packet1);
266 mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
267 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
268
269 memset(&packet2, 0, sizeof(packet2));
270 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 );
271 mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
272 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
273
274 memset(&packet2, 0, sizeof(packet2));
275 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 );
276 mavlink_msg_aslctrl_debug_decode(&msg, &packet2);
277 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
278
279 memset(&packet2, 0, sizeof(packet2));
280 mavlink_msg_to_send_buffer(buffer, &msg);
281 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
282 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
283 }
284 mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
285 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
286
287 memset(&packet2, 0, sizeof(packet2));
288 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 );
289 mavlink_msg_aslctrl_debug_decode(last_msg, &packet2);
290 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
291}
292
293static void mavlink_test_asluav_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
294{
295#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
296 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
297 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASLUAV_STATUS >= 256) {
298 return;
299 }
300#endif
301 mavlink_message_t msg;
302 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
303 uint16_t i;
304 mavlink_asluav_status_t packet_in = {
305 17.0,17,84,{ 151, 152, 153, 154, 155, 156, 157, 158 }
306 };
307 mavlink_asluav_status_t packet1, packet2;
308 memset(&packet1, 0, sizeof(packet1));
309 packet1.Motor_rpm = packet_in.Motor_rpm;
310 packet1.LED_status = packet_in.LED_status;
311 packet1.SATCOM_status = packet_in.SATCOM_status;
312
313 mav_array_memcpy(packet1.Servo_status, packet_in.Servo_status, sizeof(uint8_t)*8);
314
315#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
316 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
317 // cope with extensions
318 memset(MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASLUAV_STATUS_MIN_LEN);
319 }
320#endif
321 memset(&packet2, 0, sizeof(packet2));
322 mavlink_msg_asluav_status_encode(system_id, component_id, &msg, &packet1);
323 mavlink_msg_asluav_status_decode(&msg, &packet2);
324 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
325
326 memset(&packet2, 0, sizeof(packet2));
327 mavlink_msg_asluav_status_pack(system_id, component_id, &msg , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
328 mavlink_msg_asluav_status_decode(&msg, &packet2);
329 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
330
331 memset(&packet2, 0, sizeof(packet2));
332 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 );
333 mavlink_msg_asluav_status_decode(&msg, &packet2);
334 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
335
336 memset(&packet2, 0, sizeof(packet2));
337 mavlink_msg_to_send_buffer(buffer, &msg);
338 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
339 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
340 }
341 mavlink_msg_asluav_status_decode(last_msg, &packet2);
342 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
343
344 memset(&packet2, 0, sizeof(packet2));
345 mavlink_msg_asluav_status_send(MAVLINK_COMM_1 , packet1.LED_status , packet1.SATCOM_status , packet1.Servo_status , packet1.Motor_rpm );
346 mavlink_msg_asluav_status_decode(last_msg, &packet2);
347 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
348}
349
350static void mavlink_test_ekf_ext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
351{
352#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
353 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
354 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EKF_EXT >= 256) {
355 return;
356 }
357#endif
358 mavlink_message_t msg;
359 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
360 uint16_t i;
361 mavlink_ekf_ext_t packet_in = {
362 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0
363 };
364 mavlink_ekf_ext_t packet1, packet2;
365 memset(&packet1, 0, sizeof(packet1));
366 packet1.timestamp = packet_in.timestamp;
367 packet1.Windspeed = packet_in.Windspeed;
368 packet1.WindDir = packet_in.WindDir;
369 packet1.WindZ = packet_in.WindZ;
370 packet1.Airspeed = packet_in.Airspeed;
371 packet1.beta = packet_in.beta;
372 packet1.alpha = packet_in.alpha;
373
374
375#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
376 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
377 // cope with extensions
378 memset(MAVLINK_MSG_ID_EKF_EXT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EKF_EXT_MIN_LEN);
379 }
380#endif
381 memset(&packet2, 0, sizeof(packet2));
382 mavlink_msg_ekf_ext_encode(system_id, component_id, &msg, &packet1);
383 mavlink_msg_ekf_ext_decode(&msg, &packet2);
384 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
385
386 memset(&packet2, 0, sizeof(packet2));
387 mavlink_msg_ekf_ext_pack(system_id, component_id, &msg , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
388 mavlink_msg_ekf_ext_decode(&msg, &packet2);
389 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
390
391 memset(&packet2, 0, sizeof(packet2));
392 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 );
393 mavlink_msg_ekf_ext_decode(&msg, &packet2);
394 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
395
396 memset(&packet2, 0, sizeof(packet2));
397 mavlink_msg_to_send_buffer(buffer, &msg);
398 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
399 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
400 }
401 mavlink_msg_ekf_ext_decode(last_msg, &packet2);
402 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
403
404 memset(&packet2, 0, sizeof(packet2));
405 mavlink_msg_ekf_ext_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.Windspeed , packet1.WindDir , packet1.WindZ , packet1.Airspeed , packet1.beta , packet1.alpha );
406 mavlink_msg_ekf_ext_decode(last_msg, &packet2);
407 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
408}
409
410static void mavlink_test_asl_obctrl(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
411{
412#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
413 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
414 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ASL_OBCTRL >= 256) {
415 return;
416 }
417#endif
418 mavlink_message_t msg;
419 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
420 uint16_t i;
421 mavlink_asl_obctrl_t packet_in = {
422 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,101
423 };
424 mavlink_asl_obctrl_t packet1, packet2;
425 memset(&packet1, 0, sizeof(packet1));
426 packet1.timestamp = packet_in.timestamp;
427 packet1.uElev = packet_in.uElev;
428 packet1.uThrot = packet_in.uThrot;
429 packet1.uThrot2 = packet_in.uThrot2;
430 packet1.uAilL = packet_in.uAilL;
431 packet1.uAilR = packet_in.uAilR;
432 packet1.uRud = packet_in.uRud;
433 packet1.obctrl_status = packet_in.obctrl_status;
434
435
436#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
437 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
438 // cope with extensions
439 memset(MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ASL_OBCTRL_MIN_LEN);
440 }
441#endif
442 memset(&packet2, 0, sizeof(packet2));
443 mavlink_msg_asl_obctrl_encode(system_id, component_id, &msg, &packet1);
444 mavlink_msg_asl_obctrl_decode(&msg, &packet2);
445 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
446
447 memset(&packet2, 0, sizeof(packet2));
448 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 );
449 mavlink_msg_asl_obctrl_decode(&msg, &packet2);
450 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
451
452 memset(&packet2, 0, sizeof(packet2));
453 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 );
454 mavlink_msg_asl_obctrl_decode(&msg, &packet2);
455 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
456
457 memset(&packet2, 0, sizeof(packet2));
458 mavlink_msg_to_send_buffer(buffer, &msg);
459 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
460 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
461 }
462 mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
463 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
464
465 memset(&packet2, 0, sizeof(packet2));
466 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 );
467 mavlink_msg_asl_obctrl_decode(last_msg, &packet2);
468 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
469}
470
471static void mavlink_test_sens_atmos(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
472{
473#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
474 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
475 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_ATMOS >= 256) {
476 return;
477 }
478#endif
479 mavlink_message_t msg;
480 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
481 uint16_t i;
482 mavlink_sens_atmos_t packet_in = {
483 17.0,45.0
484 };
485 mavlink_sens_atmos_t packet1, packet2;
486 memset(&packet1, 0, sizeof(packet1));
487 packet1.TempAmbient = packet_in.TempAmbient;
488 packet1.Humidity = packet_in.Humidity;
489
490
491#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
492 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
493 // cope with extensions
494 memset(MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_ATMOS_MIN_LEN);
495 }
496#endif
497 memset(&packet2, 0, sizeof(packet2));
498 mavlink_msg_sens_atmos_encode(system_id, component_id, &msg, &packet1);
499 mavlink_msg_sens_atmos_decode(&msg, &packet2);
500 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
501
502 memset(&packet2, 0, sizeof(packet2));
503 mavlink_msg_sens_atmos_pack(system_id, component_id, &msg , packet1.TempAmbient , packet1.Humidity );
504 mavlink_msg_sens_atmos_decode(&msg, &packet2);
505 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
506
507 memset(&packet2, 0, sizeof(packet2));
508 mavlink_msg_sens_atmos_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.TempAmbient , packet1.Humidity );
509 mavlink_msg_sens_atmos_decode(&msg, &packet2);
510 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
511
512 memset(&packet2, 0, sizeof(packet2));
513 mavlink_msg_to_send_buffer(buffer, &msg);
514 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
515 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
516 }
517 mavlink_msg_sens_atmos_decode(last_msg, &packet2);
518 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
519
520 memset(&packet2, 0, sizeof(packet2));
521 mavlink_msg_sens_atmos_send(MAVLINK_COMM_1 , packet1.TempAmbient , packet1.Humidity );
522 mavlink_msg_sens_atmos_decode(last_msg, &packet2);
523 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
524}
525
526static void mavlink_test_sens_batmon(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
527{
528#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
529 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
530 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_BATMON >= 256) {
531 return;
532 }
533#endif
534 mavlink_message_t msg;
535 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
536 uint16_t i;
537 mavlink_sens_batmon_t packet_in = {
538 17.0,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379,18483,211
539 };
540 mavlink_sens_batmon_t packet1, packet2;
541 memset(&packet1, 0, sizeof(packet1));
542 packet1.temperature = packet_in.temperature;
543 packet1.voltage = packet_in.voltage;
544 packet1.current = packet_in.current;
545 packet1.batterystatus = packet_in.batterystatus;
546 packet1.serialnumber = packet_in.serialnumber;
547 packet1.hostfetcontrol = packet_in.hostfetcontrol;
548 packet1.cellvoltage1 = packet_in.cellvoltage1;
549 packet1.cellvoltage2 = packet_in.cellvoltage2;
550 packet1.cellvoltage3 = packet_in.cellvoltage3;
551 packet1.cellvoltage4 = packet_in.cellvoltage4;
552 packet1.cellvoltage5 = packet_in.cellvoltage5;
553 packet1.cellvoltage6 = packet_in.cellvoltage6;
554 packet1.SoC = packet_in.SoC;
555
556
557#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
558 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
559 // cope with extensions
560 memset(MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_BATMON_MIN_LEN);
561 }
562#endif
563 memset(&packet2, 0, sizeof(packet2));
564 mavlink_msg_sens_batmon_encode(system_id, component_id, &msg, &packet1);
565 mavlink_msg_sens_batmon_decode(&msg, &packet2);
566 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
567
568 memset(&packet2, 0, sizeof(packet2));
569 mavlink_msg_sens_batmon_pack(system_id, component_id, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
570 mavlink_msg_sens_batmon_decode(&msg, &packet2);
571 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
572
573 memset(&packet2, 0, sizeof(packet2));
574 mavlink_msg_sens_batmon_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
575 mavlink_msg_sens_batmon_decode(&msg, &packet2);
576 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
577
578 memset(&packet2, 0, sizeof(packet2));
579 mavlink_msg_to_send_buffer(buffer, &msg);
580 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
581 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
582 }
583 mavlink_msg_sens_batmon_decode(last_msg, &packet2);
584 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
585
586 memset(&packet2, 0, sizeof(packet2));
587 mavlink_msg_sens_batmon_send(MAVLINK_COMM_1 , packet1.temperature , packet1.voltage , packet1.current , packet1.SoC , packet1.batterystatus , packet1.serialnumber , packet1.hostfetcontrol , packet1.cellvoltage1 , packet1.cellvoltage2 , packet1.cellvoltage3 , packet1.cellvoltage4 , packet1.cellvoltage5 , packet1.cellvoltage6 );
588 mavlink_msg_sens_batmon_decode(last_msg, &packet2);
589 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
590}
591
592static void mavlink_test_fw_soaring_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
593{
594#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
595 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
596 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FW_SOARING_DATA >= 256) {
597 return;
598 }
599#endif
600 mavlink_message_t msg;
601 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
602 uint16_t i;
603 mavlink_fw_soaring_data_t packet_in = {
604 93372036854775807ULL,93372036854776311ULL,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,689.0,49,116
605 };
606 mavlink_fw_soaring_data_t packet1, packet2;
607 memset(&packet1, 0, sizeof(packet1));
608 packet1.timestamp = packet_in.timestamp;
609 packet1.timestampModeChanged = packet_in.timestampModeChanged;
610 packet1.xW = packet_in.xW;
611 packet1.xR = packet_in.xR;
612 packet1.xLat = packet_in.xLat;
613 packet1.xLon = packet_in.xLon;
614 packet1.VarW = packet_in.VarW;
615 packet1.VarR = packet_in.VarR;
616 packet1.VarLat = packet_in.VarLat;
617 packet1.VarLon = packet_in.VarLon;
618 packet1.LoiterRadius = packet_in.LoiterRadius;
619 packet1.LoiterDirection = packet_in.LoiterDirection;
620 packet1.DistToSoarPoint = packet_in.DistToSoarPoint;
621 packet1.vSinkExp = packet_in.vSinkExp;
622 packet1.z1_LocalUpdraftSpeed = packet_in.z1_LocalUpdraftSpeed;
623 packet1.z2_DeltaRoll = packet_in.z2_DeltaRoll;
624 packet1.z1_exp = packet_in.z1_exp;
625 packet1.z2_exp = packet_in.z2_exp;
626 packet1.ThermalGSNorth = packet_in.ThermalGSNorth;
627 packet1.ThermalGSEast = packet_in.ThermalGSEast;
628 packet1.TSE_dot = packet_in.TSE_dot;
629 packet1.DebugVar1 = packet_in.DebugVar1;
630 packet1.DebugVar2 = packet_in.DebugVar2;
631 packet1.ControlMode = packet_in.ControlMode;
632 packet1.valid = packet_in.valid;
633
634
635#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
636 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
637 // cope with extensions
638 memset(MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FW_SOARING_DATA_MIN_LEN);
639 }
640#endif
641 memset(&packet2, 0, sizeof(packet2));
642 mavlink_msg_fw_soaring_data_encode(system_id, component_id, &msg, &packet1);
643 mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
644 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
645
646 memset(&packet2, 0, sizeof(packet2));
647 mavlink_msg_fw_soaring_data_pack(system_id, component_id, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
648 mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
649 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
650
651 memset(&packet2, 0, sizeof(packet2));
652 mavlink_msg_fw_soaring_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
653 mavlink_msg_fw_soaring_data_decode(&msg, &packet2);
654 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
655
656 memset(&packet2, 0, sizeof(packet2));
657 mavlink_msg_to_send_buffer(buffer, &msg);
658 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
659 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
660 }
661 mavlink_msg_fw_soaring_data_decode(last_msg, &packet2);
662 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
663
664 memset(&packet2, 0, sizeof(packet2));
665 mavlink_msg_fw_soaring_data_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.timestampModeChanged , packet1.xW , packet1.xR , packet1.xLat , packet1.xLon , packet1.VarW , packet1.VarR , packet1.VarLat , packet1.VarLon , packet1.LoiterRadius , packet1.LoiterDirection , packet1.DistToSoarPoint , packet1.vSinkExp , packet1.z1_LocalUpdraftSpeed , packet1.z2_DeltaRoll , packet1.z1_exp , packet1.z2_exp , packet1.ThermalGSNorth , packet1.ThermalGSEast , packet1.TSE_dot , packet1.DebugVar1 , packet1.DebugVar2 , packet1.ControlMode , packet1.valid );
666 mavlink_msg_fw_soaring_data_decode(last_msg, &packet2);
667 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
668}
669
670static void mavlink_test_sensorpod_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
671{
672#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
673 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
674 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENSORPOD_STATUS >= 256) {
675 return;
676 }
677#endif
678 mavlink_message_t msg;
679 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
680 uint16_t i;
681 mavlink_sensorpod_status_t packet_in = {
682 93372036854775807ULL,17651,163,230,41,108,175,242
683 };
684 mavlink_sensorpod_status_t packet1, packet2;
685 memset(&packet1, 0, sizeof(packet1));
686 packet1.timestamp = packet_in.timestamp;
687 packet1.free_space = packet_in.free_space;
688 packet1.visensor_rate_1 = packet_in.visensor_rate_1;
689 packet1.visensor_rate_2 = packet_in.visensor_rate_2;
690 packet1.visensor_rate_3 = packet_in.visensor_rate_3;
691 packet1.visensor_rate_4 = packet_in.visensor_rate_4;
692 packet1.recording_nodes_count = packet_in.recording_nodes_count;
693 packet1.cpu_temp = packet_in.cpu_temp;
694
695
696#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
697 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
698 // cope with extensions
699 memset(MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENSORPOD_STATUS_MIN_LEN);
700 }
701#endif
702 memset(&packet2, 0, sizeof(packet2));
703 mavlink_msg_sensorpod_status_encode(system_id, component_id, &msg, &packet1);
704 mavlink_msg_sensorpod_status_decode(&msg, &packet2);
705 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
706
707 memset(&packet2, 0, sizeof(packet2));
708 mavlink_msg_sensorpod_status_pack(system_id, component_id, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
709 mavlink_msg_sensorpod_status_decode(&msg, &packet2);
710 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
711
712 memset(&packet2, 0, sizeof(packet2));
713 mavlink_msg_sensorpod_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
714 mavlink_msg_sensorpod_status_decode(&msg, &packet2);
715 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
716
717 memset(&packet2, 0, sizeof(packet2));
718 mavlink_msg_to_send_buffer(buffer, &msg);
719 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
720 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
721 }
722 mavlink_msg_sensorpod_status_decode(last_msg, &packet2);
723 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
724
725 memset(&packet2, 0, sizeof(packet2));
726 mavlink_msg_sensorpod_status_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.visensor_rate_1 , packet1.visensor_rate_2 , packet1.visensor_rate_3 , packet1.visensor_rate_4 , packet1.recording_nodes_count , packet1.cpu_temp , packet1.free_space );
727 mavlink_msg_sensorpod_status_decode(last_msg, &packet2);
728 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
729}
730
731static void mavlink_test_sens_power_board(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
732{
733#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
734 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0);
735 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SENS_POWER_BOARD >= 256) {
736 return;
737 }
738#endif
739 mavlink_message_t msg;
740 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
741 uint16_t i;
742 mavlink_sens_power_board_t packet_in = {
743 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,137,204
744 };
745 mavlink_sens_power_board_t packet1, packet2;
746 memset(&packet1, 0, sizeof(packet1));
747 packet1.timestamp = packet_in.timestamp;
748 packet1.pwr_brd_system_volt = packet_in.pwr_brd_system_volt;
749 packet1.pwr_brd_servo_volt = packet_in.pwr_brd_servo_volt;
750 packet1.pwr_brd_mot_l_amp = packet_in.pwr_brd_mot_l_amp;
751 packet1.pwr_brd_mot_r_amp = packet_in.pwr_brd_mot_r_amp;
752 packet1.pwr_brd_servo_1_amp = packet_in.pwr_brd_servo_1_amp;
753 packet1.pwr_brd_servo_2_amp = packet_in.pwr_brd_servo_2_amp;
754 packet1.pwr_brd_servo_3_amp = packet_in.pwr_brd_servo_3_amp;
755 packet1.pwr_brd_servo_4_amp = packet_in.pwr_brd_servo_4_amp;
756 packet1.pwr_brd_aux_amp = packet_in.pwr_brd_aux_amp;
757 packet1.pwr_brd_status = packet_in.pwr_brd_status;
758 packet1.pwr_brd_led_status = packet_in.pwr_brd_led_status;
759
760
761#ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1
762 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) {
763 // cope with extensions
764 memset(MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SENS_POWER_BOARD_MIN_LEN);
765 }
766#endif
767 memset(&packet2, 0, sizeof(packet2));
768 mavlink_msg_sens_power_board_encode(system_id, component_id, &msg, &packet1);
769 mavlink_msg_sens_power_board_decode(&msg, &packet2);
770 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
771
772 memset(&packet2, 0, sizeof(packet2));
773 mavlink_msg_sens_power_board_pack(system_id, component_id, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_servo_1_amp , packet1.pwr_brd_servo_2_amp , packet1.pwr_brd_servo_3_amp , packet1.pwr_brd_servo_4_amp , packet1.pwr_brd_aux_amp );
774 mavlink_msg_sens_power_board_decode(&msg, &packet2);
775 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
776
777 memset(&packet2, 0, sizeof(packet2));
778 mavlink_msg_sens_power_board_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_servo_1_amp , packet1.pwr_brd_servo_2_amp , packet1.pwr_brd_servo_3_amp , packet1.pwr_brd_servo_4_amp , packet1.pwr_brd_aux_amp );
779 mavlink_msg_sens_power_board_decode(&msg, &packet2);
780 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
781
782 memset(&packet2, 0, sizeof(packet2));
783 mavlink_msg_to_send_buffer(buffer, &msg);
784 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
785 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
786 }
787 mavlink_msg_sens_power_board_decode(last_msg, &packet2);
788 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
789
790 memset(&packet2, 0, sizeof(packet2));
791 mavlink_msg_sens_power_board_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.pwr_brd_status , packet1.pwr_brd_led_status , packet1.pwr_brd_system_volt , packet1.pwr_brd_servo_volt , packet1.pwr_brd_mot_l_amp , packet1.pwr_brd_mot_r_amp , packet1.pwr_brd_servo_1_amp , packet1.pwr_brd_servo_2_amp , packet1.pwr_brd_servo_3_amp , packet1.pwr_brd_servo_4_amp , packet1.pwr_brd_aux_amp );
792 mavlink_msg_sens_power_board_decode(last_msg, &packet2);
793 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
794}
795
796static void mavlink_test_ASLUAV(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
797{
798 mavlink_test_sens_power(system_id, component_id, last_msg);
799 mavlink_test_sens_mppt(system_id, component_id, last_msg);
800 mavlink_test_aslctrl_data(system_id, component_id, last_msg);
801 mavlink_test_aslctrl_debug(system_id, component_id, last_msg);
802 mavlink_test_asluav_status(system_id, component_id, last_msg);
803 mavlink_test_ekf_ext(system_id, component_id, last_msg);
804 mavlink_test_asl_obctrl(system_id, component_id, last_msg);
805 mavlink_test_sens_atmos(system_id, component_id, last_msg);
806 mavlink_test_sens_batmon(system_id, component_id, last_msg);
807 mavlink_test_fw_soaring_data(system_id, component_id, last_msg);
808 mavlink_test_sensorpod_status(system_id, component_id, last_msg);
809 mavlink_test_sens_power_board(system_id, component_id, last_msg);
810}
811
812#ifdef __cplusplus
813}
814#endif // __cplusplus
815#endif // ASLUAV_TESTSUITE_H
MAVLink comm protocol testsuite generated from common.xml