2011-08-31 02:23:18 -03:00
|
|
|
/** @file
|
|
|
|
* @brief MAVLink comm protocol testsuite generated from ardupilotmega.xml
|
|
|
|
* @see http://qgroundcontrol.org/mavlink/
|
|
|
|
*/
|
|
|
|
#ifndef ARDUPILOTMEGA_TESTSUITE_H
|
|
|
|
#define ARDUPILOTMEGA_TESTSUITE_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAVLINK_TEST_ALL
|
|
|
|
#define MAVLINK_TEST_ALL
|
|
|
|
static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
|
|
|
|
static void mavlink_test_ardupilotmega(uint8_t, uint8_t, mavlink_message_t *last_msg);
|
|
|
|
|
|
|
|
static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_test_common(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_ardupilotmega(system_id, component_id, last_msg);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "../common/testsuite.h"
|
|
|
|
|
|
|
|
|
|
|
|
static void mavlink_test_sensor_offsets(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_sensor_offsets_t packet_in = {
|
|
|
|
17235,
|
|
|
|
17339,
|
|
|
|
17443,
|
|
|
|
59.0,
|
|
|
|
963497984,
|
|
|
|
963498192,
|
|
|
|
143.0,
|
|
|
|
171.0,
|
|
|
|
199.0,
|
|
|
|
227.0,
|
|
|
|
255.0,
|
|
|
|
283.0,
|
|
|
|
};
|
|
|
|
mavlink_sensor_offsets_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.mag_ofs_x = packet_in.mag_ofs_x;
|
|
|
|
packet1.mag_ofs_y = packet_in.mag_ofs_y;
|
|
|
|
packet1.mag_ofs_z = packet_in.mag_ofs_z;
|
|
|
|
packet1.mag_declination = packet_in.mag_declination;
|
|
|
|
packet1.raw_press = packet_in.raw_press;
|
|
|
|
packet1.raw_temp = packet_in.raw_temp;
|
|
|
|
packet1.gyro_cal_x = packet_in.gyro_cal_x;
|
|
|
|
packet1.gyro_cal_y = packet_in.gyro_cal_y;
|
|
|
|
packet1.gyro_cal_z = packet_in.gyro_cal_z;
|
|
|
|
packet1.accel_cal_x = packet_in.accel_cal_x;
|
|
|
|
packet1.accel_cal_y = packet_in.accel_cal_y;
|
|
|
|
packet1.accel_cal_z = packet_in.accel_cal_z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_sensor_offsets_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_sensor_offsets_pack(system_id, component_id, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
|
|
|
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_sensor_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
|
|
|
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_sensor_offsets_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_sensor_offsets_send(MAVLINK_COMM_1 , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
|
|
|
mavlink_msg_sensor_offsets_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_set_mag_offsets(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_set_mag_offsets_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
17339,
|
|
|
|
17443,
|
|
|
|
17547,
|
|
|
|
};
|
|
|
|
mavlink_set_mag_offsets_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.mag_ofs_x = packet_in.mag_ofs_x;
|
|
|
|
packet1.mag_ofs_y = packet_in.mag_ofs_y;
|
|
|
|
packet1.mag_ofs_z = packet_in.mag_ofs_z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_set_mag_offsets_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_set_mag_offsets_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
|
|
|
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_set_mag_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
|
|
|
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_set_mag_offsets_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_set_mag_offsets_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
|
|
|
mavlink_msg_set_mag_offsets_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
2011-08-31 21:50:13 -03:00
|
|
|
static void mavlink_test_meminfo(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_meminfo_t packet_in = {
|
|
|
|
17235,
|
|
|
|
17339,
|
|
|
|
};
|
|
|
|
mavlink_meminfo_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.brkval = packet_in.brkval;
|
|
|
|
packet1.freemem = packet_in.freemem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_meminfo_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_meminfo_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_meminfo_pack(system_id, component_id, &msg , packet1.brkval , packet1.freemem );
|
|
|
|
mavlink_msg_meminfo_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_meminfo_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.brkval , packet1.freemem );
|
|
|
|
mavlink_msg_meminfo_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_meminfo_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_meminfo_send(MAVLINK_COMM_1 , packet1.brkval , packet1.freemem );
|
|
|
|
mavlink_msg_meminfo_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
2011-10-16 03:59:52 -03:00
|
|
|
static void mavlink_test_ap_adc(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_ap_adc_t packet_in = {
|
|
|
|
17235,
|
|
|
|
17339,
|
|
|
|
17443,
|
|
|
|
17547,
|
|
|
|
17651,
|
|
|
|
17755,
|
|
|
|
};
|
|
|
|
mavlink_ap_adc_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
2011-10-29 04:07:09 -03:00
|
|
|
packet1.adc1 = packet_in.adc1;
|
|
|
|
packet1.adc2 = packet_in.adc2;
|
|
|
|
packet1.adc3 = packet_in.adc3;
|
|
|
|
packet1.adc4 = packet_in.adc4;
|
|
|
|
packet1.adc5 = packet_in.adc5;
|
|
|
|
packet1.adc6 = packet_in.adc6;
|
|
|
|
|
|
|
|
|
2011-10-16 03:59:52 -03:00
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_ap_adc_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_ap_adc_pack(system_id, component_id, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
|
|
|
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_ap_adc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
|
|
|
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_to_send_buffer(buffer, &msg);
|
|
|
|
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
2011-10-29 04:07:09 -03:00
|
|
|
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
2011-10-16 03:59:52 -03:00
|
|
|
}
|
|
|
|
mavlink_msg_ap_adc_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
2011-10-29 04:07:09 -03:00
|
|
|
|
2011-10-16 03:59:52 -03:00
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_ap_adc_send(MAVLINK_COMM_1 , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
|
|
|
mavlink_msg_ap_adc_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
2011-10-29 04:07:09 -03:00
|
|
|
static void mavlink_test_digicam_configure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_digicam_configure_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
139,
|
|
|
|
17391,
|
|
|
|
84,
|
|
|
|
151,
|
|
|
|
218,
|
|
|
|
29,
|
|
|
|
96,
|
|
|
|
163,
|
|
|
|
94.0,
|
|
|
|
};
|
|
|
|
mavlink_digicam_configure_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.mode = packet_in.mode;
|
|
|
|
packet1.shutter_speed = packet_in.shutter_speed;
|
|
|
|
packet1.aperture = packet_in.aperture;
|
|
|
|
packet1.iso = packet_in.iso;
|
|
|
|
packet1.exposure_type = packet_in.exposure_type;
|
|
|
|
packet1.command_id = packet_in.command_id;
|
|
|
|
packet1.engine_cut_off = packet_in.engine_cut_off;
|
|
|
|
packet1.extra_param = packet_in.extra_param;
|
|
|
|
packet1.extra_value = packet_in.extra_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_configure_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_digicam_configure_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_configure_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_configure_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_digicam_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_digicam_control_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
139,
|
|
|
|
206,
|
|
|
|
17,
|
|
|
|
84,
|
|
|
|
151,
|
|
|
|
218,
|
|
|
|
29,
|
|
|
|
80.0,
|
|
|
|
};
|
|
|
|
mavlink_digicam_control_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.session = packet_in.session;
|
|
|
|
packet1.zoom_pos = packet_in.zoom_pos;
|
|
|
|
packet1.zoom_step = packet_in.zoom_step;
|
|
|
|
packet1.focus_lock = packet_in.focus_lock;
|
|
|
|
packet1.shot = packet_in.shot;
|
|
|
|
packet1.command_id = packet_in.command_id;
|
|
|
|
packet1.extra_param = packet_in.extra_param;
|
|
|
|
packet1.extra_value = packet_in.extra_value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_control_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_digicam_control_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_digicam_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
|
|
|
mavlink_msg_digicam_control_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_mount_configure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_mount_configure_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
139,
|
|
|
|
206,
|
|
|
|
17,
|
|
|
|
84,
|
|
|
|
};
|
|
|
|
mavlink_mount_configure_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.mount_mode = packet_in.mount_mode;
|
|
|
|
packet1.stab_roll = packet_in.stab_roll;
|
|
|
|
packet1.stab_pitch = packet_in.stab_pitch;
|
|
|
|
packet1.stab_yaw = packet_in.stab_yaw;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_configure_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
|
|
|
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
|
|
|
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_mount_configure_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_configure_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
|
|
|
mavlink_msg_mount_configure_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_mount_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_mount_control_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
963497568,
|
|
|
|
963497776,
|
|
|
|
963497984,
|
|
|
|
175,
|
|
|
|
};
|
|
|
|
mavlink_mount_control_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.input_a = packet_in.input_a;
|
|
|
|
packet1.input_b = packet_in.input_b;
|
|
|
|
packet1.input_c = packet_in.input_c;
|
|
|
|
packet1.save_position = packet_in.save_position;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_control_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_mount_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
|
|
|
mavlink_msg_mount_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
|
|
|
mavlink_msg_mount_control_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_mount_control_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
|
|
|
mavlink_msg_mount_control_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_mount_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_mount_status_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
963497568,
|
|
|
|
963497776,
|
|
|
|
963497984,
|
|
|
|
};
|
|
|
|
mavlink_mount_status_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.target_system = packet_in.target_system;
|
|
|
|
packet1.target_component = packet_in.target_component;
|
|
|
|
packet1.pointing_a = packet_in.pointing_a;
|
|
|
|
packet1.pointing_b = packet_in.pointing_b;
|
|
|
|
packet1.pointing_c = packet_in.pointing_c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_status_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_mount_status_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
|
|
|
mavlink_msg_mount_status_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
|
|
|
mavlink_msg_mount_status_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_mount_status_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_mount_status_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
|
|
|
mavlink_msg_mount_status_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
2011-12-15 03:01:14 -04:00
|
|
|
static void mavlink_test_fence_point(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_fence_point_t packet_in = {
|
|
|
|
5,
|
|
|
|
72,
|
|
|
|
31.0,
|
|
|
|
59.0,
|
|
|
|
};
|
|
|
|
mavlink_fence_point_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.idx = packet_in.idx;
|
|
|
|
packet1.count = packet_in.count;
|
|
|
|
packet1.lat = packet_in.lat;
|
|
|
|
packet1.lng = packet_in.lng;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_point_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_fence_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_point_pack(system_id, component_id, &msg , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
|
|
|
mavlink_msg_fence_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
|
|
|
mavlink_msg_fence_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_fence_point_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_point_send(MAVLINK_COMM_1 , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
|
|
|
mavlink_msg_fence_point_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mavlink_test_fence_fetch_point(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_message_t msg;
|
|
|
|
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
|
|
|
uint16_t i;
|
|
|
|
mavlink_fence_fetch_point_t packet_in = {
|
|
|
|
5,
|
|
|
|
};
|
|
|
|
mavlink_fence_fetch_point_t packet1, packet2;
|
|
|
|
memset(&packet1, 0, sizeof(packet1));
|
|
|
|
packet1.idx = packet_in.idx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_fetch_point_encode(system_id, component_id, &msg, &packet1);
|
|
|
|
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_fetch_point_pack(system_id, component_id, &msg , packet1.idx );
|
|
|
|
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_fetch_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.idx );
|
|
|
|
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
mavlink_msg_fence_fetch_point_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
|
|
|
|
memset(&packet2, 0, sizeof(packet2));
|
|
|
|
mavlink_msg_fence_fetch_point_send(MAVLINK_COMM_1 , packet1.idx );
|
|
|
|
mavlink_msg_fence_fetch_point_decode(last_msg, &packet2);
|
|
|
|
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
|
|
|
}
|
|
|
|
|
2011-08-31 02:23:18 -03:00
|
|
|
static void mavlink_test_ardupilotmega(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
|
|
|
{
|
|
|
|
mavlink_test_sensor_offsets(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_set_mag_offsets(system_id, component_id, last_msg);
|
2011-08-31 21:50:13 -03:00
|
|
|
mavlink_test_meminfo(system_id, component_id, last_msg);
|
2011-10-16 03:59:52 -03:00
|
|
|
mavlink_test_ap_adc(system_id, component_id, last_msg);
|
2011-10-29 04:07:09 -03:00
|
|
|
mavlink_test_digicam_configure(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_digicam_control(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_mount_configure(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_mount_control(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_mount_status(system_id, component_id, last_msg);
|
2011-12-15 03:01:14 -04:00
|
|
|
mavlink_test_fence_point(system_id, component_id, last_msg);
|
|
|
|
mavlink_test_fence_fetch_point(system_id, component_id, last_msg);
|
2011-08-31 02:23:18 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif // __cplusplus
|
|
|
|
#endif // ARDUPILOTMEGA_TESTSUITE_H
|