testsuite.h 49.9 KB
Newer Older
lm's avatar
lm committed
1 2 3 4 5 6 7 8 9 10 11 12 13
/** @file
 *	@brief MAVLink comm protocol testsuite generated from pixhawk.xml
 *	@see http://qgroundcontrol.org/mavlink/
 */
#ifndef PIXHAWK_TESTSUITE_H
#define PIXHAWK_TESTSUITE_H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef MAVLINK_TEST_ALL
#define MAVLINK_TEST_ALL
LM's avatar
LM committed
14 15
static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
static void mavlink_test_pixhawk(uint8_t, uint8_t, mavlink_message_t *last_msg);
lm's avatar
lm committed
16

LM's avatar
LM committed
17
static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
18
{
LM's avatar
LM committed
19 20
	mavlink_test_common(system_id, component_id, last_msg);
	mavlink_test_pixhawk(system_id, component_id, last_msg);
lm's avatar
lm committed
21 22 23 24 25 26
}
#endif

#include "../common/testsuite.h"


LM's avatar
LM committed
27
static void mavlink_test_set_cam_shutter(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
28 29 30 31
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
32
	mavlink_set_cam_shutter_t packet_in = {
lm's avatar
lm committed
33 34 35 36 37 38 39
		17.0,
	17443,
	17547,
	29,
	96,
	163,
	};
LM's avatar
LM committed
40 41 42 43 44 45 46 47 48 49 50 51
	mavlink_set_cam_shutter_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.gain = packet_in.gain;
        	packet1.interval = packet_in.interval;
        	packet1.exposure = packet_in.exposure;
        	packet1.cam_no = packet_in.cam_no;
        	packet1.cam_mode = packet_in.cam_mode;
        	packet1.trigger_pin = packet_in.trigger_pin;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
52 53 54
	mavlink_msg_set_cam_shutter_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
55 56

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
57
	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 );
LM's avatar
LM committed
58 59 60 61
	mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
62
	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 );
LM's avatar
LM committed
63 64 65 66
	mavlink_msg_set_cam_shutter_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
67 68 69 70
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
71 72 73 74
	mavlink_msg_set_cam_shutter_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
75
	mavlink_msg_set_cam_shutter_send(MAVLINK_COMM_1 , packet1.cam_no , packet1.cam_mode , packet1.trigger_pin , packet1.interval , packet1.exposure , packet1.gain );
LM's avatar
LM committed
76 77
	mavlink_msg_set_cam_shutter_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
78 79
}

LM's avatar
LM committed
80
static void mavlink_test_image_triggered(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
81 82 83 84
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
85
	mavlink_image_triggered_t packet_in = {
lm's avatar
lm committed
86 87 88 89 90 91 92 93 94 95 96 97 98
		93372036854775807ULL,
	963497880,
	101.0,
	129.0,
	157.0,
	185.0,
	213.0,
	241.0,
	269.0,
	297.0,
	325.0,
	353.0,
	};
LM's avatar
LM committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
	mavlink_image_triggered_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.timestamp = packet_in.timestamp;
        	packet1.seq = packet_in.seq;
        	packet1.roll = packet_in.roll;
        	packet1.pitch = packet_in.pitch;
        	packet1.yaw = packet_in.yaw;
        	packet1.local_z = packet_in.local_z;
        	packet1.lat = packet_in.lat;
        	packet1.lon = packet_in.lon;
        	packet1.alt = packet_in.alt;
        	packet1.ground_x = packet_in.ground_x;
        	packet1.ground_y = packet_in.ground_y;
        	packet1.ground_z = packet_in.ground_z;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
117 118 119
	mavlink_msg_image_triggered_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_image_triggered_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
120 121

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
122
	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 );
LM's avatar
LM committed
123 124 125 126
	mavlink_msg_image_triggered_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
127
	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 );
LM's avatar
LM committed
128 129 130 131
	mavlink_msg_image_triggered_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
132 133 134 135
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
136 137 138 139
	mavlink_msg_image_triggered_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
140
	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 );
LM's avatar
LM committed
141 142
	mavlink_msg_image_triggered_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
143 144
}

LM's avatar
LM committed
145
static void mavlink_test_image_trigger_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
146 147 148 149
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
150
	mavlink_image_trigger_control_t packet_in = {
lm's avatar
lm committed
151 152
		5,
	};
LM's avatar
LM committed
153 154 155 156 157 158 159
	mavlink_image_trigger_control_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.enable = packet_in.enable;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
160 161 162
	mavlink_msg_image_trigger_control_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_image_trigger_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
163 164

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
165
	mavlink_msg_image_trigger_control_pack(system_id, component_id, &msg , packet1.enable );
LM's avatar
LM committed
166 167 168 169
	mavlink_msg_image_trigger_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
170
	mavlink_msg_image_trigger_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.enable );
LM's avatar
LM committed
171 172 173 174
	mavlink_msg_image_trigger_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
175 176 177 178
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
179 180 181 182
	mavlink_msg_image_trigger_control_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
183
	mavlink_msg_image_trigger_control_send(MAVLINK_COMM_1 , packet1.enable );
LM's avatar
LM committed
184 185
	mavlink_msg_image_trigger_control_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
186 187
}

LM's avatar
LM committed
188
static void mavlink_test_image_available(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
189 190 191 192
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
193
	mavlink_image_available_t packet_in = {
lm's avatar
lm committed
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
		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,
	};
LM's avatar
LM committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
	mavlink_image_available_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.cam_id = packet_in.cam_id;
        	packet1.timestamp = packet_in.timestamp;
        	packet1.valid_until = packet_in.valid_until;
        	packet1.img_seq = packet_in.img_seq;
        	packet1.img_buf_index = packet_in.img_buf_index;
        	packet1.key = packet_in.key;
        	packet1.exposure = packet_in.exposure;
        	packet1.gain = packet_in.gain;
        	packet1.roll = packet_in.roll;
        	packet1.pitch = packet_in.pitch;
        	packet1.yaw = packet_in.yaw;
        	packet1.local_z = packet_in.local_z;
        	packet1.lat = packet_in.lat;
        	packet1.lon = packet_in.lon;
        	packet1.alt = packet_in.alt;
        	packet1.ground_x = packet_in.ground_x;
        	packet1.ground_y = packet_in.ground_y;
        	packet1.ground_z = packet_in.ground_z;
        	packet1.width = packet_in.width;
        	packet1.height = packet_in.height;
        	packet1.depth = packet_in.depth;
        	packet1.cam_no = packet_in.cam_no;
        	packet1.channels = packet_in.channels;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
247 248 249
	mavlink_msg_image_available_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_image_available_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
250 251

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
252
	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 );
LM's avatar
LM committed
253 254 255 256
	mavlink_msg_image_available_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
257
	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 );
LM's avatar
LM committed
258 259 260 261
	mavlink_msg_image_available_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
262 263 264 265
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
266 267 268 269
	mavlink_msg_image_available_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
270
	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 );
LM's avatar
LM committed
271 272
	mavlink_msg_image_available_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
273 274
}

275
static void mavlink_test_set_position_control_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
276 277 278 279
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
280
	mavlink_set_position_control_offset_t packet_in = {
lm's avatar
lm committed
281 282 283 284 285 286 287
		17.0,
	45.0,
	73.0,
	101.0,
	53,
	120,
	};
288
	mavlink_set_position_control_offset_t packet1, packet2;
LM's avatar
LM committed
289 290 291 292 293 294 295 296 297 298 299
        memset(&packet1, 0, sizeof(packet1));
        	packet1.x = packet_in.x;
        	packet1.y = packet_in.y;
        	packet1.z = packet_in.z;
        	packet1.yaw = packet_in.yaw;
        	packet1.target_system = packet_in.target_system;
        	packet1.target_component = packet_in.target_component;
        
        

        memset(&packet2, 0, sizeof(packet2));
300 301
	mavlink_msg_set_position_control_offset_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
lm's avatar
lm committed
302
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
303 304

        memset(&packet2, 0, sizeof(packet2));
305 306
	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 );
	mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
LM's avatar
LM committed
307 308 309
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
310 311
	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 );
	mavlink_msg_set_position_control_offset_decode(&msg, &packet2);
LM's avatar
LM committed
312 313 314
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
315 316 317 318
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
319
	mavlink_msg_set_position_control_offset_decode(last_msg, &packet2);
LM's avatar
LM committed
320 321 322
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
323 324
	mavlink_msg_set_position_control_offset_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.x , packet1.y , packet1.z , packet1.yaw );
	mavlink_msg_set_position_control_offset_decode(last_msg, &packet2);
LM's avatar
LM committed
325
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
326 327
}

LM's avatar
LM committed
328
static void mavlink_test_position_control_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
329 330 331 332
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
333
	mavlink_position_control_setpoint_t packet_in = {
lm's avatar
lm committed
334 335 336 337 338 339
		17.0,
	45.0,
	73.0,
	101.0,
	18067,
	};
LM's avatar
LM committed
340 341 342 343 344 345 346 347 348 349 350
	mavlink_position_control_setpoint_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.x = packet_in.x;
        	packet1.y = packet_in.y;
        	packet1.z = packet_in.z;
        	packet1.yaw = packet_in.yaw;
        	packet1.id = packet_in.id;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
351 352 353
	mavlink_msg_position_control_setpoint_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
354 355

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
356
	mavlink_msg_position_control_setpoint_pack(system_id, component_id, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.yaw );
LM's avatar
LM committed
357 358 359 360
	mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
361
	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 );
LM's avatar
LM committed
362 363 364 365
	mavlink_msg_position_control_setpoint_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
366 367 368 369
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
370 371 372 373
	mavlink_msg_position_control_setpoint_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
374
	mavlink_msg_position_control_setpoint_send(MAVLINK_COMM_1 , packet1.id , packet1.x , packet1.y , packet1.z , packet1.yaw );
LM's avatar
LM committed
375 376
	mavlink_msg_position_control_setpoint_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
377 378
}

LM's avatar
LM committed
379
static void mavlink_test_marker(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
380 381 382 383
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
384
	mavlink_marker_t packet_in = {
lm's avatar
lm committed
385 386 387 388 389 390 391 392
		17.0,
	45.0,
	73.0,
	101.0,
	129.0,
	157.0,
	18483,
	};
LM's avatar
LM committed
393 394 395 396 397 398 399 400 401 402 403 404 405
	mavlink_marker_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.x = packet_in.x;
        	packet1.y = packet_in.y;
        	packet1.z = packet_in.z;
        	packet1.roll = packet_in.roll;
        	packet1.pitch = packet_in.pitch;
        	packet1.yaw = packet_in.yaw;
        	packet1.id = packet_in.id;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
406 407 408
	mavlink_msg_marker_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_marker_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
409 410

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
411
	mavlink_msg_marker_pack(system_id, component_id, &msg , packet1.id , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
LM's avatar
LM committed
412 413 414 415
	mavlink_msg_marker_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
416
	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 );
LM's avatar
LM committed
417 418 419 420
	mavlink_msg_marker_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
421 422 423 424
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
425 426 427 428
	mavlink_msg_marker_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
429
	mavlink_msg_marker_send(MAVLINK_COMM_1 , packet1.id , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw );
LM's avatar
LM committed
430 431
	mavlink_msg_marker_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
432 433
}

LM's avatar
LM committed
434
static void mavlink_test_raw_aux(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
435 436 437 438
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
439
	mavlink_raw_aux_t packet_in = {
lm's avatar
lm committed
440 441 442 443 444 445 446 447
		963497464,
	17443,
	17547,
	17651,
	17755,
	17859,
	17963,
	};
LM's avatar
LM committed
448 449 450 451 452 453 454 455 456 457 458 459 460
	mavlink_raw_aux_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.baro = packet_in.baro;
        	packet1.adc1 = packet_in.adc1;
        	packet1.adc2 = packet_in.adc2;
        	packet1.adc3 = packet_in.adc3;
        	packet1.adc4 = packet_in.adc4;
        	packet1.vbat = packet_in.vbat;
        	packet1.temp = packet_in.temp;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
461 462 463
	mavlink_msg_raw_aux_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_raw_aux_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
464 465

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
466
	mavlink_msg_raw_aux_pack(system_id, component_id, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.vbat , packet1.temp , packet1.baro );
LM's avatar
LM committed
467 468 469 470
	mavlink_msg_raw_aux_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
471
	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 );
LM's avatar
LM committed
472 473 474 475
	mavlink_msg_raw_aux_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
476 477 478 479
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
480 481 482 483
	mavlink_msg_raw_aux_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
484
	mavlink_msg_raw_aux_send(MAVLINK_COMM_1 , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.vbat , packet1.temp , packet1.baro );
LM's avatar
LM committed
485 486
	mavlink_msg_raw_aux_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
487 488
}

LM's avatar
LM committed
489
static void mavlink_test_watchdog_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
490 491 492 493
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
494
	mavlink_watchdog_heartbeat_t packet_in = {
lm's avatar
lm committed
495 496 497
		17235,
	17339,
	};
LM's avatar
LM committed
498 499 500 501 502 503 504 505
	mavlink_watchdog_heartbeat_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.watchdog_id = packet_in.watchdog_id;
        	packet1.process_count = packet_in.process_count;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
506 507 508
	mavlink_msg_watchdog_heartbeat_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
509 510

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
511
	mavlink_msg_watchdog_heartbeat_pack(system_id, component_id, &msg , packet1.watchdog_id , packet1.process_count );
LM's avatar
LM committed
512 513 514 515
	mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
516
	mavlink_msg_watchdog_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.watchdog_id , packet1.process_count );
LM's avatar
LM committed
517 518 519 520
	mavlink_msg_watchdog_heartbeat_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
521 522 523 524
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
525 526 527 528
	mavlink_msg_watchdog_heartbeat_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
529
	mavlink_msg_watchdog_heartbeat_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_count );
LM's avatar
LM committed
530 531
	mavlink_msg_watchdog_heartbeat_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
532 533
}

LM's avatar
LM committed
534
static void mavlink_test_watchdog_process_info(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
535 536 537 538
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
539
	mavlink_watchdog_process_info_t packet_in = {
lm's avatar
lm committed
540 541 542 543 544 545
		963497464,
	17443,
	17547,
	"IJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABC",
	"EFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRST",
	};
LM's avatar
LM committed
546 547 548 549 550 551
	mavlink_watchdog_process_info_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.timeout = packet_in.timeout;
        	packet1.watchdog_id = packet_in.watchdog_id;
        	packet1.process_id = packet_in.process_id;
        
552 553
        	mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*100);
        	mav_array_memcpy(packet1.arguments, packet_in.arguments, sizeof(char)*147);
LM's avatar
LM committed
554 555 556
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
557 558 559
	mavlink_msg_watchdog_process_info_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_watchdog_process_info_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
560 561

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
562
	mavlink_msg_watchdog_process_info_pack(system_id, component_id, &msg , packet1.watchdog_id , packet1.process_id , packet1.name , packet1.arguments , packet1.timeout );
LM's avatar
LM committed
563 564 565 566
	mavlink_msg_watchdog_process_info_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
567
	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 );
LM's avatar
LM committed
568 569 570 571
	mavlink_msg_watchdog_process_info_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
572 573 574 575
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
576 577 578 579
	mavlink_msg_watchdog_process_info_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
580
	mavlink_msg_watchdog_process_info_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_id , packet1.name , packet1.arguments , packet1.timeout );
LM's avatar
LM committed
581 582
	mavlink_msg_watchdog_process_info_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
583 584
}

LM's avatar
LM committed
585
static void mavlink_test_watchdog_process_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
586 587 588 589
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
590
	mavlink_watchdog_process_status_t packet_in = {
lm's avatar
lm committed
591 592 593 594 595 596 597
		963497464,
	17443,
	17547,
	17651,
	163,
	230,
	};
LM's avatar
LM committed
598 599 600 601 602 603 604 605 606 607 608 609
	mavlink_watchdog_process_status_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.pid = packet_in.pid;
        	packet1.watchdog_id = packet_in.watchdog_id;
        	packet1.process_id = packet_in.process_id;
        	packet1.crashes = packet_in.crashes;
        	packet1.state = packet_in.state;
        	packet1.muted = packet_in.muted;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
610 611 612
	mavlink_msg_watchdog_process_status_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
613 614

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
615
	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 );
LM's avatar
LM committed
616 617 618 619
	mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
620
	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 );
LM's avatar
LM committed
621 622 623 624
	mavlink_msg_watchdog_process_status_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
625 626 627 628
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
629 630 631 632
	mavlink_msg_watchdog_process_status_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
633
	mavlink_msg_watchdog_process_status_send(MAVLINK_COMM_1 , packet1.watchdog_id , packet1.process_id , packet1.state , packet1.muted , packet1.pid , packet1.crashes );
LM's avatar
LM committed
634 635
	mavlink_msg_watchdog_process_status_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
636 637
}

LM's avatar
LM committed
638
static void mavlink_test_watchdog_command(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
639 640 641 642
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
643
	mavlink_watchdog_command_t packet_in = {
lm's avatar
lm committed
644 645 646 647 648
		17235,
	17339,
	17,
	84,
	};
LM's avatar
LM committed
649 650 651 652 653 654 655 656 657 658
	mavlink_watchdog_command_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.watchdog_id = packet_in.watchdog_id;
        	packet1.process_id = packet_in.process_id;
        	packet1.target_system_id = packet_in.target_system_id;
        	packet1.command_id = packet_in.command_id;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
659 660 661
	mavlink_msg_watchdog_command_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_watchdog_command_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
662 663

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
664
	mavlink_msg_watchdog_command_pack(system_id, component_id, &msg , packet1.target_system_id , packet1.watchdog_id , packet1.process_id , packet1.command_id );
LM's avatar
LM committed
665 666 667 668
	mavlink_msg_watchdog_command_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
669
	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 );
LM's avatar
LM committed
670 671 672 673
	mavlink_msg_watchdog_command_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
674 675 676 677
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
678 679 680 681
	mavlink_msg_watchdog_command_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
682
	mavlink_msg_watchdog_command_send(MAVLINK_COMM_1 , packet1.target_system_id , packet1.watchdog_id , packet1.process_id , packet1.command_id );
LM's avatar
LM committed
683 684
	mavlink_msg_watchdog_command_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
685 686
}

LM's avatar
LM committed
687
static void mavlink_test_pattern_detected(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
688 689 690 691
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
692
	mavlink_pattern_detected_t packet_in = {
lm's avatar
lm committed
693 694 695 696 697
		17.0,
	17,
	"FGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ",
	128,
	};
LM's avatar
LM committed
698 699 700 701 702 703
	mavlink_pattern_detected_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.confidence = packet_in.confidence;
        	packet1.type = packet_in.type;
        	packet1.detected = packet_in.detected;
        
704
        	mav_array_memcpy(packet1.file, packet_in.file, sizeof(char)*100);
LM's avatar
LM committed
705 706 707
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
708 709 710
	mavlink_msg_pattern_detected_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_pattern_detected_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
711 712

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
713
	mavlink_msg_pattern_detected_pack(system_id, component_id, &msg , packet1.type , packet1.confidence , packet1.file , packet1.detected );
LM's avatar
LM committed
714 715 716 717
	mavlink_msg_pattern_detected_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
718
	mavlink_msg_pattern_detected_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.confidence , packet1.file , packet1.detected );
LM's avatar
LM committed
719 720 721 722
	mavlink_msg_pattern_detected_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
723 724 725 726
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
727 728 729 730
	mavlink_msg_pattern_detected_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
731
	mavlink_msg_pattern_detected_send(MAVLINK_COMM_1 , packet1.type , packet1.confidence , packet1.file , packet1.detected );
LM's avatar
LM committed
732 733
	mavlink_msg_pattern_detected_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
734 735
}

LM's avatar
LM committed
736
static void mavlink_test_point_of_interest(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
737 738 739 740
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
741
	mavlink_point_of_interest_t packet_in = {
lm's avatar
lm committed
742 743 744 745 746 747 748 749 750
		17.0,
	45.0,
	73.0,
	17859,
	175,
	242,
	53,
	"RSTUVWXYZABCDEFGHIJKLMNOP",
	};
LM's avatar
LM committed
751 752 753 754 755 756 757 758 759 760
	mavlink_point_of_interest_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.x = packet_in.x;
        	packet1.y = packet_in.y;
        	packet1.z = packet_in.z;
        	packet1.timeout = packet_in.timeout;
        	packet1.type = packet_in.type;
        	packet1.color = packet_in.color;
        	packet1.coordinate_system = packet_in.coordinate_system;
        
761
        	mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*26);
LM's avatar
LM committed
762 763 764
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
765 766 767
	mavlink_msg_point_of_interest_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_point_of_interest_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
768 769

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
770
	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 );
LM's avatar
LM committed
771 772 773 774
	mavlink_msg_point_of_interest_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
775
	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 );
LM's avatar
LM committed
776 777 778 779
	mavlink_msg_point_of_interest_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
780 781 782 783
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
784 785 786 787
	mavlink_msg_point_of_interest_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
788
	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 );
LM's avatar
LM committed
789 790
	mavlink_msg_point_of_interest_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
791 792
}

LM's avatar
LM committed
793
static void mavlink_test_point_of_interest_connection(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
794 795 796 797
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
798
	mavlink_point_of_interest_connection_t packet_in = {
lm's avatar
lm committed
799 800 801 802 803 804 805 806 807 808 809 810
		17.0,
	45.0,
	73.0,
	101.0,
	129.0,
	157.0,
	18483,
	211,
	22,
	89,
	"DEFGHIJKLMNOPQRSTUVWXYZAB",
	};
LM's avatar
LM committed
811 812 813 814 815 816 817 818 819 820 821 822 823
	mavlink_point_of_interest_connection_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.xp1 = packet_in.xp1;
        	packet1.yp1 = packet_in.yp1;
        	packet1.zp1 = packet_in.zp1;
        	packet1.xp2 = packet_in.xp2;
        	packet1.yp2 = packet_in.yp2;
        	packet1.zp2 = packet_in.zp2;
        	packet1.timeout = packet_in.timeout;
        	packet1.type = packet_in.type;
        	packet1.color = packet_in.color;
        	packet1.coordinate_system = packet_in.coordinate_system;
        
824
        	mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*26);
LM's avatar
LM committed
825 826 827
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
828 829 830
	mavlink_msg_point_of_interest_connection_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
831 832

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
833
	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 );
LM's avatar
LM committed
834 835 836 837
	mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
838
	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 );
LM's avatar
LM committed
839 840 841 842
	mavlink_msg_point_of_interest_connection_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
843 844 845 846
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
847 848 849 850
	mavlink_msg_point_of_interest_connection_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
851
	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 );
LM's avatar
LM committed
852 853
	mavlink_msg_point_of_interest_connection_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
854 855
}

LM's avatar
LM committed
856
static void mavlink_test_data_transmission_handshake(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
857 858 859 860
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
861
	mavlink_data_transmission_handshake_t packet_in = {
lm's avatar
lm committed
862
		963497464,
LM's avatar
LM committed
863 864 865 866 867 868
	17443,
	17547,
	29,
	96,
	163,
	230,
lm's avatar
lm committed
869
	};
LM's avatar
LM committed
870 871 872
	mavlink_data_transmission_handshake_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.size = packet_in.size;
LM's avatar
LM committed
873 874
        	packet1.width = packet_in.width;
        	packet1.height = packet_in.height;
LM's avatar
LM committed
875 876 877 878 879 880 881 882
        	packet1.type = packet_in.type;
        	packet1.packets = packet_in.packets;
        	packet1.payload = packet_in.payload;
        	packet1.jpg_quality = packet_in.jpg_quality;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
883 884 885
	mavlink_msg_data_transmission_handshake_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
886 887

        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
888
	mavlink_msg_data_transmission_handshake_pack(system_id, component_id, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
LM's avatar
LM committed
889 890 891 892
	mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
893
	mavlink_msg_data_transmission_handshake_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
LM's avatar
LM committed
894 895 896 897
	mavlink_msg_data_transmission_handshake_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
898 899 900 901
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
902 903 904 905
	mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
906
	mavlink_msg_data_transmission_handshake_send(MAVLINK_COMM_1 , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality );
LM's avatar
LM committed
907 908
	mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
909 910
}

LM's avatar
LM committed
911
static void mavlink_test_encapsulated_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
912 913 914 915
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
916
	mavlink_encapsulated_data_t packet_in = {
lm's avatar
lm committed
917 918 919
		17235,
	{ 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, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135 },
	};
LM's avatar
LM committed
920 921 922 923
	mavlink_encapsulated_data_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.seqnr = packet_in.seqnr;
        
924
        	mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*253);
LM's avatar
LM committed
925 926 927
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
928 929 930
	mavlink_msg_encapsulated_data_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_encapsulated_data_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
931 932

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
933
	mavlink_msg_encapsulated_data_pack(system_id, component_id, &msg , packet1.seqnr , packet1.data );
LM's avatar
LM committed
934 935 936 937
	mavlink_msg_encapsulated_data_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
938
	mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seqnr , packet1.data );
LM's avatar
LM committed
939 940 941 942
	mavlink_msg_encapsulated_data_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
943 944 945 946
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
947 948 949 950
	mavlink_msg_encapsulated_data_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
951
	mavlink_msg_encapsulated_data_send(MAVLINK_COMM_1 , packet1.seqnr , packet1.data );
LM's avatar
LM committed
952 953
	mavlink_msg_encapsulated_data_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
954 955
}

LM's avatar
LM committed
956
static void mavlink_test_brief_feature(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
957 958 959 960
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
961
	mavlink_brief_feature_t packet_in = {
lm's avatar
lm committed
962 963 964 965 966 967 968 969 970
		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 },
	};
LM's avatar
LM committed
971 972 973 974 975 976 977 978 979 980
	mavlink_brief_feature_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.x = packet_in.x;
        	packet1.y = packet_in.y;
        	packet1.z = packet_in.z;
        	packet1.response = packet_in.response;
        	packet1.size = packet_in.size;
        	packet1.orientation = packet_in.orientation;
        	packet1.orientation_assignment = packet_in.orientation_assignment;
        
981
        	mav_array_memcpy(packet1.descriptor, packet_in.descriptor, sizeof(uint8_t)*32);
LM's avatar
LM committed
982 983 984
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
985 986 987
	mavlink_msg_brief_feature_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_brief_feature_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
988 989

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
990
	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 );
LM's avatar
LM committed
991 992 993 994
	mavlink_msg_brief_feature_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
995
	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 );
LM's avatar
LM committed
996 997 998 999
	mavlink_msg_brief_feature_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
1000 1001 1002 1003
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
1004 1005 1006 1007
	mavlink_msg_brief_feature_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
1008
	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 );
LM's avatar
LM committed
1009 1010
	mavlink_msg_brief_feature_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
1011 1012
}

LM's avatar
LM committed
1013
static void mavlink_test_attitude_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
1014 1015 1016 1017
{
	mavlink_message_t msg;
        uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
        uint16_t i;
LM's avatar
LM committed
1018
	mavlink_attitude_control_t packet_in = {
lm's avatar
lm committed
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
		17.0,
	45.0,
	73.0,
	101.0,
	53,
	120,
	187,
	254,
	65,
	};
LM's avatar
LM committed
1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043
	mavlink_attitude_control_t packet1, packet2;
        memset(&packet1, 0, sizeof(packet1));
        	packet1.roll = packet_in.roll;
        	packet1.pitch = packet_in.pitch;
        	packet1.yaw = packet_in.yaw;
        	packet1.thrust = packet_in.thrust;
        	packet1.target = packet_in.target;
        	packet1.roll_manual = packet_in.roll_manual;
        	packet1.pitch_manual = packet_in.pitch_manual;
        	packet1.yaw_manual = packet_in.yaw_manual;
        	packet1.thrust_manual = packet_in.thrust_manual;
        
        

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
1044 1045 1046
	mavlink_msg_attitude_control_encode(system_id, component_id, &msg, &packet1);
	mavlink_msg_attitude_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
LM's avatar
LM committed
1047 1048

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
1049
	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 );
LM's avatar
LM committed
1050 1051 1052 1053
	mavlink_msg_attitude_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
1054
	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 );
LM's avatar
LM committed
1055 1056 1057 1058
	mavlink_msg_attitude_control_decode(&msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);

        memset(&packet2, 0, sizeof(packet2));
lm's avatar
lm committed
1059 1060 1061 1062
        mavlink_msg_to_send_buffer(buffer, &msg);
        for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
        	comm_send_ch(MAVLINK_COMM_0, buffer[i]);
        }
LM's avatar
LM committed
1063 1064 1065 1066
	mavlink_msg_attitude_control_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
        
        memset(&packet2, 0, sizeof(packet2));
LM's avatar
LM committed
1067
	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 );
LM's avatar
LM committed
1068 1069
	mavlink_msg_attitude_control_decode(last_msg, &packet2);
        MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
lm's avatar
lm committed
1070 1071
}

LM's avatar
LM committed
1072
static void mavlink_test_pixhawk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
lm's avatar
lm committed
1073
{
LM's avatar
LM committed
1074 1075 1076 1077
	mavlink_test_set_cam_shutter(system_id, component_id, last_msg);
	mavlink_test_image_triggered(system_id, component_id, last_msg);
	mavlink_test_image_trigger_control(system_id, component_id, last_msg);
	mavlink_test_image_available(system_id, component_id, last_msg);
1078
	mavlink_test_set_position_control_offset(system_id, component_id, last_msg);
LM's avatar
LM committed
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
	mavlink_test_position_control_setpoint(system_id, component_id, last_msg);
	mavlink_test_marker(system_id, component_id, last_msg);
	mavlink_test_raw_aux(system_id, component_id, last_msg);
	mavlink_test_watchdog_heartbeat(system_id, component_id, last_msg);
	mavlink_test_watchdog_process_info(system_id, component_id, last_msg);
	mavlink_test_watchdog_process_status(system_id, component_id, last_msg);
	mavlink_test_watchdog_command(system_id, component_id, last_msg);
	mavlink_test_pattern_detected(system_id, component_id, last_msg);
	mavlink_test_point_of_interest(system_id, component_id, last_msg);
	mavlink_test_point_of_interest_connection(system_id, component_id, last_msg);
	mavlink_test_data_transmission_handshake(system_id, component_id, last_msg);
	mavlink_test_encapsulated_data(system_id, component_id, last_msg);
	mavlink_test_brief_feature(system_id, component_id, last_msg);
	mavlink_test_attitude_control(system_id, component_id, last_msg);
lm's avatar
lm committed
1093 1094 1095 1096 1097 1098
}

#ifdef __cplusplus
}
#endif // __cplusplus
#endif // PIXHAWK_TESTSUITE_H