mavlink library

Dependents:   mavlink F429ZI_LCD_demo

Fork of mavlink_bridge by Benjamin Hepp

Committer:
bhepp
Date:
Sat Jan 23 15:21:13 2016 +0000
Revision:
2:0f4dfdec5fd1
Modified messages

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bhepp 2:0f4dfdec5fd1 1 /** @file
bhepp 2:0f4dfdec5fd1 2 * @brief MAVLink comm protocol testsuite generated from uwb.xml
bhepp 2:0f4dfdec5fd1 3 * @see http://qgroundcontrol.org/mavlink/
bhepp 2:0f4dfdec5fd1 4 */
bhepp 2:0f4dfdec5fd1 5 #ifndef UWB_TESTSUITE_H
bhepp 2:0f4dfdec5fd1 6 #define UWB_TESTSUITE_H
bhepp 2:0f4dfdec5fd1 7
bhepp 2:0f4dfdec5fd1 8 #ifdef __cplusplus
bhepp 2:0f4dfdec5fd1 9 extern "C" {
bhepp 2:0f4dfdec5fd1 10 #endif
bhepp 2:0f4dfdec5fd1 11
bhepp 2:0f4dfdec5fd1 12 #ifndef MAVLINK_TEST_ALL
bhepp 2:0f4dfdec5fd1 13 #define MAVLINK_TEST_ALL
bhepp 2:0f4dfdec5fd1 14 static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
bhepp 2:0f4dfdec5fd1 15 static void mavlink_test_uwb(uint8_t, uint8_t, mavlink_message_t *last_msg);
bhepp 2:0f4dfdec5fd1 16
bhepp 2:0f4dfdec5fd1 17 static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 18 {
bhepp 2:0f4dfdec5fd1 19 mavlink_test_common(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 20 mavlink_test_uwb(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 21 }
bhepp 2:0f4dfdec5fd1 22 #endif
bhepp 2:0f4dfdec5fd1 23
bhepp 2:0f4dfdec5fd1 24 #include "../common/testsuite.h"
bhepp 2:0f4dfdec5fd1 25
bhepp 2:0f4dfdec5fd1 26
bhepp 2:0f4dfdec5fd1 27 static void mavlink_test_uwb_range(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 28 {
bhepp 2:0f4dfdec5fd1 29 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 30 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 31 uint16_t i;
bhepp 2:0f4dfdec5fd1 32 mavlink_uwb_range_t packet_in = {
bhepp 2:0f4dfdec5fd1 33 963497464,45.0,73.0,41,108
bhepp 2:0f4dfdec5fd1 34 };
bhepp 2:0f4dfdec5fd1 35 mavlink_uwb_range_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 36 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 37 packet1.stamp_us = packet_in.stamp_us;
bhepp 2:0f4dfdec5fd1 38 packet1.round_trip_time = packet_in.round_trip_time;
bhepp 2:0f4dfdec5fd1 39 packet1.range = packet_in.range;
bhepp 2:0f4dfdec5fd1 40 packet1.address = packet_in.address;
bhepp 2:0f4dfdec5fd1 41 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 42
bhepp 2:0f4dfdec5fd1 43
bhepp 2:0f4dfdec5fd1 44
bhepp 2:0f4dfdec5fd1 45 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 46 mavlink_msg_uwb_range_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 47 mavlink_msg_uwb_range_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 48 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 49
bhepp 2:0f4dfdec5fd1 50 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 51 mavlink_msg_uwb_range_pack(system_id, component_id, &msg , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range );
bhepp 2:0f4dfdec5fd1 52 mavlink_msg_uwb_range_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 53 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 54
bhepp 2:0f4dfdec5fd1 55 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 56 mavlink_msg_uwb_range_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range );
bhepp 2:0f4dfdec5fd1 57 mavlink_msg_uwb_range_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 58 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 59
bhepp 2:0f4dfdec5fd1 60 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 61 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 62 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 63 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 64 }
bhepp 2:0f4dfdec5fd1 65 mavlink_msg_uwb_range_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 66 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 67
bhepp 2:0f4dfdec5fd1 68 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 69 mavlink_msg_uwb_range_send(MAVLINK_COMM_1 , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range );
bhepp 2:0f4dfdec5fd1 70 mavlink_msg_uwb_range_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 71 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 72 }
bhepp 2:0f4dfdec5fd1 73
bhepp 2:0f4dfdec5fd1 74 static void mavlink_test_uwb_range_stats(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 75 {
bhepp 2:0f4dfdec5fd1 76 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 77 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 78 uint16_t i;
bhepp 2:0f4dfdec5fd1 79 mavlink_uwb_range_stats_t packet_in = {
bhepp 2:0f4dfdec5fd1 80 963497464,45.0,73.0,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,19315,19419,137,204
bhepp 2:0f4dfdec5fd1 81 };
bhepp 2:0f4dfdec5fd1 82 mavlink_uwb_range_stats_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 83 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 84 packet1.stamp_us = packet_in.stamp_us;
bhepp 2:0f4dfdec5fd1 85 packet1.round_trip_time = packet_in.round_trip_time;
bhepp 2:0f4dfdec5fd1 86 packet1.range = packet_in.range;
bhepp 2:0f4dfdec5fd1 87 packet1.std_noise_1 = packet_in.std_noise_1;
bhepp 2:0f4dfdec5fd1 88 packet1.std_noise_2 = packet_in.std_noise_2;
bhepp 2:0f4dfdec5fd1 89 packet1.preamble_acc_count_1 = packet_in.preamble_acc_count_1;
bhepp 2:0f4dfdec5fd1 90 packet1.preamble_acc_count_2 = packet_in.preamble_acc_count_2;
bhepp 2:0f4dfdec5fd1 91 packet1.first_path_index_1 = packet_in.first_path_index_1;
bhepp 2:0f4dfdec5fd1 92 packet1.first_path_index_2 = packet_in.first_path_index_2;
bhepp 2:0f4dfdec5fd1 93 packet1.first_path_amp_1_1 = packet_in.first_path_amp_1_1;
bhepp 2:0f4dfdec5fd1 94 packet1.first_path_amp_1_2 = packet_in.first_path_amp_1_2;
bhepp 2:0f4dfdec5fd1 95 packet1.first_path_amp_2_1 = packet_in.first_path_amp_2_1;
bhepp 2:0f4dfdec5fd1 96 packet1.first_path_amp_2_2 = packet_in.first_path_amp_2_2;
bhepp 2:0f4dfdec5fd1 97 packet1.first_path_amp_3_1 = packet_in.first_path_amp_3_1;
bhepp 2:0f4dfdec5fd1 98 packet1.first_path_amp_3_2 = packet_in.first_path_amp_3_2;
bhepp 2:0f4dfdec5fd1 99 packet1.channel_impulse_response_power_1 = packet_in.channel_impulse_response_power_1;
bhepp 2:0f4dfdec5fd1 100 packet1.channel_impulse_response_power_2 = packet_in.channel_impulse_response_power_2;
bhepp 2:0f4dfdec5fd1 101 packet1.prf_1 = packet_in.prf_1;
bhepp 2:0f4dfdec5fd1 102 packet1.prf_2 = packet_in.prf_2;
bhepp 2:0f4dfdec5fd1 103 packet1.address = packet_in.address;
bhepp 2:0f4dfdec5fd1 104 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 105
bhepp 2:0f4dfdec5fd1 106
bhepp 2:0f4dfdec5fd1 107
bhepp 2:0f4dfdec5fd1 108 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 109 mavlink_msg_uwb_range_stats_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 110 mavlink_msg_uwb_range_stats_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 111 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 112
bhepp 2:0f4dfdec5fd1 113 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 114 mavlink_msg_uwb_range_stats_pack(system_id, component_id, &msg , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range , packet1.std_noise_1 , packet1.std_noise_2 , packet1.preamble_acc_count_1 , packet1.preamble_acc_count_2 , packet1.first_path_index_1 , packet1.first_path_index_2 , packet1.first_path_amp_1_1 , packet1.first_path_amp_1_2 , packet1.first_path_amp_2_1 , packet1.first_path_amp_2_2 , packet1.first_path_amp_3_1 , packet1.first_path_amp_3_2 , packet1.channel_impulse_response_power_1 , packet1.channel_impulse_response_power_2 , packet1.prf_1 , packet1.prf_2 );
bhepp 2:0f4dfdec5fd1 115 mavlink_msg_uwb_range_stats_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 116 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 117
bhepp 2:0f4dfdec5fd1 118 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 119 mavlink_msg_uwb_range_stats_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range , packet1.std_noise_1 , packet1.std_noise_2 , packet1.preamble_acc_count_1 , packet1.preamble_acc_count_2 , packet1.first_path_index_1 , packet1.first_path_index_2 , packet1.first_path_amp_1_1 , packet1.first_path_amp_1_2 , packet1.first_path_amp_2_1 , packet1.first_path_amp_2_2 , packet1.first_path_amp_3_1 , packet1.first_path_amp_3_2 , packet1.channel_impulse_response_power_1 , packet1.channel_impulse_response_power_2 , packet1.prf_1 , packet1.prf_2 );
bhepp 2:0f4dfdec5fd1 120 mavlink_msg_uwb_range_stats_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 121 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 122
bhepp 2:0f4dfdec5fd1 123 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 124 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 125 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 126 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 127 }
bhepp 2:0f4dfdec5fd1 128 mavlink_msg_uwb_range_stats_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 129 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 130
bhepp 2:0f4dfdec5fd1 131 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 132 mavlink_msg_uwb_range_stats_send(MAVLINK_COMM_1 , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range , packet1.std_noise_1 , packet1.std_noise_2 , packet1.preamble_acc_count_1 , packet1.preamble_acc_count_2 , packet1.first_path_index_1 , packet1.first_path_index_2 , packet1.first_path_amp_1_1 , packet1.first_path_amp_1_2 , packet1.first_path_amp_2_1 , packet1.first_path_amp_2_2 , packet1.first_path_amp_3_1 , packet1.first_path_amp_3_2 , packet1.channel_impulse_response_power_1 , packet1.channel_impulse_response_power_2 , packet1.prf_1 , packet1.prf_2 );
bhepp 2:0f4dfdec5fd1 133 mavlink_msg_uwb_range_stats_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 134 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 135 }
bhepp 2:0f4dfdec5fd1 136
bhepp 2:0f4dfdec5fd1 137 static void mavlink_test_uwb_range_batch_2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 138 {
bhepp 2:0f4dfdec5fd1 139 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 140 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 141 uint16_t i;
bhepp 2:0f4dfdec5fd1 142 mavlink_uwb_range_batch_2_t packet_in = {
bhepp 2:0f4dfdec5fd1 143 { 17.0, 18.0 },{ 29, 30 },163
bhepp 2:0f4dfdec5fd1 144 };
bhepp 2:0f4dfdec5fd1 145 mavlink_uwb_range_batch_2_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 146 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 147 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 148
bhepp 2:0f4dfdec5fd1 149 mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*2);
bhepp 2:0f4dfdec5fd1 150 mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*2);
bhepp 2:0f4dfdec5fd1 151
bhepp 2:0f4dfdec5fd1 152
bhepp 2:0f4dfdec5fd1 153 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 154 mavlink_msg_uwb_range_batch_2_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 155 mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 156 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 157
bhepp 2:0f4dfdec5fd1 158 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 159 mavlink_msg_uwb_range_batch_2_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 160 mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 161 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 162
bhepp 2:0f4dfdec5fd1 163 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 164 mavlink_msg_uwb_range_batch_2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 165 mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 166 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 167
bhepp 2:0f4dfdec5fd1 168 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 169 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 170 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 171 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 172 }
bhepp 2:0f4dfdec5fd1 173 mavlink_msg_uwb_range_batch_2_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 174 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 175
bhepp 2:0f4dfdec5fd1 176 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 177 mavlink_msg_uwb_range_batch_2_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 178 mavlink_msg_uwb_range_batch_2_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 179 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 180 }
bhepp 2:0f4dfdec5fd1 181
bhepp 2:0f4dfdec5fd1 182 static void mavlink_test_uwb_range_batch_3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 183 {
bhepp 2:0f4dfdec5fd1 184 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 185 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 186 uint16_t i;
bhepp 2:0f4dfdec5fd1 187 mavlink_uwb_range_batch_3_t packet_in = {
bhepp 2:0f4dfdec5fd1 188 { 17.0, 18.0, 19.0 },{ 41, 42, 43 },242
bhepp 2:0f4dfdec5fd1 189 };
bhepp 2:0f4dfdec5fd1 190 mavlink_uwb_range_batch_3_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 191 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 192 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 193
bhepp 2:0f4dfdec5fd1 194 mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*3);
bhepp 2:0f4dfdec5fd1 195 mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*3);
bhepp 2:0f4dfdec5fd1 196
bhepp 2:0f4dfdec5fd1 197
bhepp 2:0f4dfdec5fd1 198 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 199 mavlink_msg_uwb_range_batch_3_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 200 mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 201 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 202
bhepp 2:0f4dfdec5fd1 203 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 204 mavlink_msg_uwb_range_batch_3_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 205 mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 206 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 207
bhepp 2:0f4dfdec5fd1 208 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 209 mavlink_msg_uwb_range_batch_3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 210 mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 211 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 212
bhepp 2:0f4dfdec5fd1 213 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 214 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 215 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 216 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 217 }
bhepp 2:0f4dfdec5fd1 218 mavlink_msg_uwb_range_batch_3_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 219 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 220
bhepp 2:0f4dfdec5fd1 221 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 222 mavlink_msg_uwb_range_batch_3_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 223 mavlink_msg_uwb_range_batch_3_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 224 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 225 }
bhepp 2:0f4dfdec5fd1 226
bhepp 2:0f4dfdec5fd1 227 static void mavlink_test_uwb_range_batch_4(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 228 {
bhepp 2:0f4dfdec5fd1 229 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 230 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 231 uint16_t i;
bhepp 2:0f4dfdec5fd1 232 mavlink_uwb_range_batch_4_t packet_in = {
bhepp 2:0f4dfdec5fd1 233 { 17.0, 18.0, 19.0, 20.0 },{ 53, 54, 55, 56 },65
bhepp 2:0f4dfdec5fd1 234 };
bhepp 2:0f4dfdec5fd1 235 mavlink_uwb_range_batch_4_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 236 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 237 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 238
bhepp 2:0f4dfdec5fd1 239 mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*4);
bhepp 2:0f4dfdec5fd1 240 mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*4);
bhepp 2:0f4dfdec5fd1 241
bhepp 2:0f4dfdec5fd1 242
bhepp 2:0f4dfdec5fd1 243 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 244 mavlink_msg_uwb_range_batch_4_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 245 mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 246 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 247
bhepp 2:0f4dfdec5fd1 248 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 249 mavlink_msg_uwb_range_batch_4_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 250 mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 251 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 252
bhepp 2:0f4dfdec5fd1 253 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 254 mavlink_msg_uwb_range_batch_4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 255 mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 256 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 257
bhepp 2:0f4dfdec5fd1 258 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 259 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 260 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 261 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 262 }
bhepp 2:0f4dfdec5fd1 263 mavlink_msg_uwb_range_batch_4_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 264 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 265
bhepp 2:0f4dfdec5fd1 266 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 267 mavlink_msg_uwb_range_batch_4_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 268 mavlink_msg_uwb_range_batch_4_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 269 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 270 }
bhepp 2:0f4dfdec5fd1 271
bhepp 2:0f4dfdec5fd1 272 static void mavlink_test_uwb_range_batch_5(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 273 {
bhepp 2:0f4dfdec5fd1 274 mavlink_message_t msg;
bhepp 2:0f4dfdec5fd1 275 uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
bhepp 2:0f4dfdec5fd1 276 uint16_t i;
bhepp 2:0f4dfdec5fd1 277 mavlink_uwb_range_batch_5_t packet_in = {
bhepp 2:0f4dfdec5fd1 278 { 17.0, 18.0, 19.0, 20.0, 21.0 },{ 65, 66, 67, 68, 69 },144
bhepp 2:0f4dfdec5fd1 279 };
bhepp 2:0f4dfdec5fd1 280 mavlink_uwb_range_batch_5_t packet1, packet2;
bhepp 2:0f4dfdec5fd1 281 memset(&packet1, 0, sizeof(packet1));
bhepp 2:0f4dfdec5fd1 282 packet1.remote_address = packet_in.remote_address;
bhepp 2:0f4dfdec5fd1 283
bhepp 2:0f4dfdec5fd1 284 mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*5);
bhepp 2:0f4dfdec5fd1 285 mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*5);
bhepp 2:0f4dfdec5fd1 286
bhepp 2:0f4dfdec5fd1 287
bhepp 2:0f4dfdec5fd1 288 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 289 mavlink_msg_uwb_range_batch_5_encode(system_id, component_id, &msg, &packet1);
bhepp 2:0f4dfdec5fd1 290 mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 291 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 292
bhepp 2:0f4dfdec5fd1 293 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 294 mavlink_msg_uwb_range_batch_5_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 295 mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 296 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 297
bhepp 2:0f4dfdec5fd1 298 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 299 mavlink_msg_uwb_range_batch_5_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 300 mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2);
bhepp 2:0f4dfdec5fd1 301 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 302
bhepp 2:0f4dfdec5fd1 303 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 304 mavlink_msg_to_send_buffer(buffer, &msg);
bhepp 2:0f4dfdec5fd1 305 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
bhepp 2:0f4dfdec5fd1 306 comm_send_ch(MAVLINK_COMM_0, buffer[i]);
bhepp 2:0f4dfdec5fd1 307 }
bhepp 2:0f4dfdec5fd1 308 mavlink_msg_uwb_range_batch_5_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 309 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 310
bhepp 2:0f4dfdec5fd1 311 memset(&packet2, 0, sizeof(packet2));
bhepp 2:0f4dfdec5fd1 312 mavlink_msg_uwb_range_batch_5_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range );
bhepp 2:0f4dfdec5fd1 313 mavlink_msg_uwb_range_batch_5_decode(last_msg, &packet2);
bhepp 2:0f4dfdec5fd1 314 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
bhepp 2:0f4dfdec5fd1 315 }
bhepp 2:0f4dfdec5fd1 316
bhepp 2:0f4dfdec5fd1 317 static void mavlink_test_uwb(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
bhepp 2:0f4dfdec5fd1 318 {
bhepp 2:0f4dfdec5fd1 319 mavlink_test_uwb_range(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 320 mavlink_test_uwb_range_stats(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 321 mavlink_test_uwb_range_batch_2(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 322 mavlink_test_uwb_range_batch_3(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 323 mavlink_test_uwb_range_batch_4(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 324 mavlink_test_uwb_range_batch_5(system_id, component_id, last_msg);
bhepp 2:0f4dfdec5fd1 325 }
bhepp 2:0f4dfdec5fd1 326
bhepp 2:0f4dfdec5fd1 327 #ifdef __cplusplus
bhepp 2:0f4dfdec5fd1 328 }
bhepp 2:0f4dfdec5fd1 329 #endif // __cplusplus
bhepp 2:0f4dfdec5fd1 330 #endif // UWB_TESTSUITE_H
bhepp 2:0f4dfdec5fd1 331