mavlink library
Dependents: mavlink F429ZI_LCD_demo
Fork of mavlink_bridge by
mavlink/v10/uwb/testsuite.h@9:6f782c9f1850, 2016-03-29 (annotated)
- Committer:
- bhepp
- Date:
- Tue Mar 29 10:00:09 2016 +0000
- Revision:
- 9:6f782c9f1850
nop
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bhepp | 9:6f782c9f1850 | 1 | /** @file |
bhepp | 9:6f782c9f1850 | 2 | * @brief MAVLink comm protocol testsuite generated from uwb.xml |
bhepp | 9:6f782c9f1850 | 3 | * @see http://qgroundcontrol.org/mavlink/ |
bhepp | 9:6f782c9f1850 | 4 | */ |
bhepp | 9:6f782c9f1850 | 5 | #ifndef UWB_TESTSUITE_H |
bhepp | 9:6f782c9f1850 | 6 | #define UWB_TESTSUITE_H |
bhepp | 9:6f782c9f1850 | 7 | |
bhepp | 9:6f782c9f1850 | 8 | #ifdef __cplusplus |
bhepp | 9:6f782c9f1850 | 9 | extern "C" { |
bhepp | 9:6f782c9f1850 | 10 | #endif |
bhepp | 9:6f782c9f1850 | 11 | |
bhepp | 9:6f782c9f1850 | 12 | #ifndef MAVLINK_TEST_ALL |
bhepp | 9:6f782c9f1850 | 13 | #define MAVLINK_TEST_ALL |
bhepp | 9:6f782c9f1850 | 14 | static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); |
bhepp | 9:6f782c9f1850 | 15 | static void mavlink_test_uwb(uint8_t, uint8_t, mavlink_message_t *last_msg); |
bhepp | 9:6f782c9f1850 | 16 | |
bhepp | 9:6f782c9f1850 | 17 | static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 18 | { |
bhepp | 9:6f782c9f1850 | 19 | mavlink_test_common(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 20 | mavlink_test_uwb(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 21 | } |
bhepp | 9:6f782c9f1850 | 22 | #endif |
bhepp | 9:6f782c9f1850 | 23 | |
bhepp | 9:6f782c9f1850 | 24 | #include "../common/testsuite.h" |
bhepp | 9:6f782c9f1850 | 25 | |
bhepp | 9:6f782c9f1850 | 26 | |
bhepp | 9:6f782c9f1850 | 27 | static void mavlink_test_uwb_multi_range_raw_4(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 28 | { |
bhepp | 9:6f782c9f1850 | 29 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 30 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 31 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 32 | mavlink_uwb_multi_range_raw_4_t packet_in = { |
bhepp | 9:6f782c9f1850 | 33 | 93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,{ 93372036854777319, 93372036854777320, 93372036854777321, 93372036854777322 },{ 93372036854779335, 93372036854779336, 93372036854779337, 93372036854779338 },{ 93372036854781351, 93372036854781352, 93372036854781353, 93372036854781354 },109,176,243 |
bhepp | 9:6f782c9f1850 | 34 | }; |
bhepp | 9:6f782c9f1850 | 35 | mavlink_uwb_multi_range_raw_4_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 36 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 37 | packet1.timestamp_master_request_recv = packet_in.timestamp_master_request_recv; |
bhepp | 9:6f782c9f1850 | 38 | packet1.timestamp_slave_reply_send_1 = packet_in.timestamp_slave_reply_send_1; |
bhepp | 9:6f782c9f1850 | 39 | packet1.timestamp_slave_reply_send_2 = packet_in.timestamp_slave_reply_send_2; |
bhepp | 9:6f782c9f1850 | 40 | packet1.num_of_units = packet_in.num_of_units; |
bhepp | 9:6f782c9f1850 | 41 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 42 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 43 | |
bhepp | 9:6f782c9f1850 | 44 | mav_array_memcpy(packet1.timestamp_master_request, packet_in.timestamp_master_request, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 45 | mav_array_memcpy(packet1.timestamp_slave_reply_1, packet_in.timestamp_slave_reply_1, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 46 | mav_array_memcpy(packet1.timestamp_slave_reply_2, packet_in.timestamp_slave_reply_2, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 47 | |
bhepp | 9:6f782c9f1850 | 48 | |
bhepp | 9:6f782c9f1850 | 49 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 50 | mavlink_msg_uwb_multi_range_raw_4_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 51 | mavlink_msg_uwb_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 52 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 53 | |
bhepp | 9:6f782c9f1850 | 54 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 55 | mavlink_msg_uwb_multi_range_raw_4_pack(system_id, component_id, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_recv , packet1.timestamp_slave_reply_send_1 , packet1.timestamp_slave_reply_send_2 , packet1.timestamp_master_request , packet1.timestamp_slave_reply_1 , packet1.timestamp_slave_reply_2 ); |
bhepp | 9:6f782c9f1850 | 56 | mavlink_msg_uwb_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 57 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 58 | |
bhepp | 9:6f782c9f1850 | 59 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 60 | mavlink_msg_uwb_multi_range_raw_4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_recv , packet1.timestamp_slave_reply_send_1 , packet1.timestamp_slave_reply_send_2 , packet1.timestamp_master_request , packet1.timestamp_slave_reply_1 , packet1.timestamp_slave_reply_2 ); |
bhepp | 9:6f782c9f1850 | 61 | mavlink_msg_uwb_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 62 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 63 | |
bhepp | 9:6f782c9f1850 | 64 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 65 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 66 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 67 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 68 | } |
bhepp | 9:6f782c9f1850 | 69 | mavlink_msg_uwb_multi_range_raw_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 70 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 71 | |
bhepp | 9:6f782c9f1850 | 72 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 73 | mavlink_msg_uwb_multi_range_raw_4_send(MAVLINK_COMM_1 , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_recv , packet1.timestamp_slave_reply_send_1 , packet1.timestamp_slave_reply_send_2 , packet1.timestamp_master_request , packet1.timestamp_slave_reply_1 , packet1.timestamp_slave_reply_2 ); |
bhepp | 9:6f782c9f1850 | 74 | mavlink_msg_uwb_multi_range_raw_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 75 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 76 | } |
bhepp | 9:6f782c9f1850 | 77 | |
bhepp | 9:6f782c9f1850 | 78 | static void mavlink_test_uwb_2way_multi_range_raw_10(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 79 | { |
bhepp | 9:6f782c9f1850 | 80 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 81 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 82 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 83 | mavlink_uwb_2way_multi_range_raw_10_t packet_in = { |
bhepp | 9:6f782c9f1850 | 84 | 93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,{ 93372036854777319, 93372036854777320, 93372036854777321, 93372036854777322, 93372036854777323, 93372036854777324, 93372036854777325, 93372036854777326, 93372036854777327, 93372036854777328 },{ 93372036854782359, 93372036854782360, 93372036854782361, 93372036854782362, 93372036854782363, 93372036854782364, 93372036854782365, 93372036854782366, 93372036854782367, 93372036854782368 },{ 93372036854787399, 93372036854787400, 93372036854787401, 93372036854787402, 93372036854787403, 93372036854787404, 93372036854787405, 93372036854787406, 93372036854787407, 93372036854787408 },29,96,163 |
bhepp | 9:6f782c9f1850 | 85 | }; |
bhepp | 9:6f782c9f1850 | 86 | mavlink_uwb_2way_multi_range_raw_10_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 87 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 88 | packet1.timestamp_master_request_1_recv = packet_in.timestamp_master_request_1_recv; |
bhepp | 9:6f782c9f1850 | 89 | packet1.timestamp_slave_reply_send = packet_in.timestamp_slave_reply_send; |
bhepp | 9:6f782c9f1850 | 90 | packet1.timestamp_master_request_2_recv = packet_in.timestamp_master_request_2_recv; |
bhepp | 9:6f782c9f1850 | 91 | packet1.num_of_units = packet_in.num_of_units; |
bhepp | 9:6f782c9f1850 | 92 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 93 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 94 | |
bhepp | 9:6f782c9f1850 | 95 | mav_array_memcpy(packet1.timestamp_master_request_1, packet_in.timestamp_master_request_1, sizeof(uint64_t)*10); |
bhepp | 9:6f782c9f1850 | 96 | mav_array_memcpy(packet1.timestamp_slave_reply, packet_in.timestamp_slave_reply, sizeof(uint64_t)*10); |
bhepp | 9:6f782c9f1850 | 97 | mav_array_memcpy(packet1.timestamp_master_request_2, packet_in.timestamp_master_request_2, sizeof(uint64_t)*10); |
bhepp | 9:6f782c9f1850 | 98 | |
bhepp | 9:6f782c9f1850 | 99 | |
bhepp | 9:6f782c9f1850 | 100 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 101 | mavlink_msg_uwb_2way_multi_range_raw_10_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 102 | mavlink_msg_uwb_2way_multi_range_raw_10_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 103 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 104 | |
bhepp | 9:6f782c9f1850 | 105 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 106 | mavlink_msg_uwb_2way_multi_range_raw_10_pack(system_id, component_id, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 107 | mavlink_msg_uwb_2way_multi_range_raw_10_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 108 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 109 | |
bhepp | 9:6f782c9f1850 | 110 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 111 | mavlink_msg_uwb_2way_multi_range_raw_10_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 112 | mavlink_msg_uwb_2way_multi_range_raw_10_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 113 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 114 | |
bhepp | 9:6f782c9f1850 | 115 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 116 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 117 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 118 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 119 | } |
bhepp | 9:6f782c9f1850 | 120 | mavlink_msg_uwb_2way_multi_range_raw_10_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 121 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 122 | |
bhepp | 9:6f782c9f1850 | 123 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 124 | mavlink_msg_uwb_2way_multi_range_raw_10_send(MAVLINK_COMM_1 , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 125 | mavlink_msg_uwb_2way_multi_range_raw_10_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 126 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 127 | } |
bhepp | 9:6f782c9f1850 | 128 | |
bhepp | 9:6f782c9f1850 | 129 | static void mavlink_test_uwb_2way_multi_range_raw_4(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 130 | { |
bhepp | 9:6f782c9f1850 | 131 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 132 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 133 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 134 | mavlink_uwb_2way_multi_range_raw_4_t packet_in = { |
bhepp | 9:6f782c9f1850 | 135 | 93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,{ 93372036854777319, 93372036854777320, 93372036854777321, 93372036854777322 },{ 93372036854779335, 93372036854779336, 93372036854779337, 93372036854779338 },{ 93372036854781351, 93372036854781352, 93372036854781353, 93372036854781354 },109,176,243 |
bhepp | 9:6f782c9f1850 | 136 | }; |
bhepp | 9:6f782c9f1850 | 137 | mavlink_uwb_2way_multi_range_raw_4_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 138 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 139 | packet1.timestamp_master_request_1_recv = packet_in.timestamp_master_request_1_recv; |
bhepp | 9:6f782c9f1850 | 140 | packet1.timestamp_slave_reply_send = packet_in.timestamp_slave_reply_send; |
bhepp | 9:6f782c9f1850 | 141 | packet1.timestamp_master_request_2_recv = packet_in.timestamp_master_request_2_recv; |
bhepp | 9:6f782c9f1850 | 142 | packet1.num_of_units = packet_in.num_of_units; |
bhepp | 9:6f782c9f1850 | 143 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 144 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 145 | |
bhepp | 9:6f782c9f1850 | 146 | mav_array_memcpy(packet1.timestamp_master_request_1, packet_in.timestamp_master_request_1, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 147 | mav_array_memcpy(packet1.timestamp_slave_reply, packet_in.timestamp_slave_reply, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 148 | mav_array_memcpy(packet1.timestamp_master_request_2, packet_in.timestamp_master_request_2, sizeof(uint64_t)*4); |
bhepp | 9:6f782c9f1850 | 149 | |
bhepp | 9:6f782c9f1850 | 150 | |
bhepp | 9:6f782c9f1850 | 151 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 152 | mavlink_msg_uwb_2way_multi_range_raw_4_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 153 | mavlink_msg_uwb_2way_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 154 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 155 | |
bhepp | 9:6f782c9f1850 | 156 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 157 | mavlink_msg_uwb_2way_multi_range_raw_4_pack(system_id, component_id, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 158 | mavlink_msg_uwb_2way_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 159 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 160 | |
bhepp | 9:6f782c9f1850 | 161 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 162 | mavlink_msg_uwb_2way_multi_range_raw_4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 163 | mavlink_msg_uwb_2way_multi_range_raw_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 164 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 165 | |
bhepp | 9:6f782c9f1850 | 166 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 167 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 168 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 169 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 170 | } |
bhepp | 9:6f782c9f1850 | 171 | mavlink_msg_uwb_2way_multi_range_raw_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 172 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 173 | |
bhepp | 9:6f782c9f1850 | 174 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 175 | mavlink_msg_uwb_2way_multi_range_raw_4_send(MAVLINK_COMM_1 , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 176 | mavlink_msg_uwb_2way_multi_range_raw_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 177 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 178 | } |
bhepp | 9:6f782c9f1850 | 179 | |
bhepp | 9:6f782c9f1850 | 180 | static void mavlink_test_uwb_2way_multi_range_raw_5(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 181 | { |
bhepp | 9:6f782c9f1850 | 182 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 183 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 184 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 185 | mavlink_uwb_2way_multi_range_raw_5_t packet_in = { |
bhepp | 9:6f782c9f1850 | 186 | 93372036854775807ULL,93372036854776311ULL,93372036854776815ULL,{ 93372036854777319, 93372036854777320, 93372036854777321, 93372036854777322, 93372036854777323 },{ 93372036854779839, 93372036854779840, 93372036854779841, 93372036854779842, 93372036854779843 },{ 93372036854782359, 93372036854782360, 93372036854782361, 93372036854782362, 93372036854782363 },181,248,59 |
bhepp | 9:6f782c9f1850 | 187 | }; |
bhepp | 9:6f782c9f1850 | 188 | mavlink_uwb_2way_multi_range_raw_5_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 189 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 190 | packet1.timestamp_master_request_1_recv = packet_in.timestamp_master_request_1_recv; |
bhepp | 9:6f782c9f1850 | 191 | packet1.timestamp_slave_reply_send = packet_in.timestamp_slave_reply_send; |
bhepp | 9:6f782c9f1850 | 192 | packet1.timestamp_master_request_2_recv = packet_in.timestamp_master_request_2_recv; |
bhepp | 9:6f782c9f1850 | 193 | packet1.num_of_units = packet_in.num_of_units; |
bhepp | 9:6f782c9f1850 | 194 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 195 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 196 | |
bhepp | 9:6f782c9f1850 | 197 | mav_array_memcpy(packet1.timestamp_master_request_1, packet_in.timestamp_master_request_1, sizeof(uint64_t)*5); |
bhepp | 9:6f782c9f1850 | 198 | mav_array_memcpy(packet1.timestamp_slave_reply, packet_in.timestamp_slave_reply, sizeof(uint64_t)*5); |
bhepp | 9:6f782c9f1850 | 199 | mav_array_memcpy(packet1.timestamp_master_request_2, packet_in.timestamp_master_request_2, sizeof(uint64_t)*5); |
bhepp | 9:6f782c9f1850 | 200 | |
bhepp | 9:6f782c9f1850 | 201 | |
bhepp | 9:6f782c9f1850 | 202 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 203 | mavlink_msg_uwb_2way_multi_range_raw_5_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 204 | mavlink_msg_uwb_2way_multi_range_raw_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 205 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 206 | |
bhepp | 9:6f782c9f1850 | 207 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 208 | mavlink_msg_uwb_2way_multi_range_raw_5_pack(system_id, component_id, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 209 | mavlink_msg_uwb_2way_multi_range_raw_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 210 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 211 | |
bhepp | 9:6f782c9f1850 | 212 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 213 | mavlink_msg_uwb_2way_multi_range_raw_5_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 214 | mavlink_msg_uwb_2way_multi_range_raw_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 215 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 216 | |
bhepp | 9:6f782c9f1850 | 217 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 218 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 219 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 220 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 221 | } |
bhepp | 9:6f782c9f1850 | 222 | mavlink_msg_uwb_2way_multi_range_raw_5_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 223 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 224 | |
bhepp | 9:6f782c9f1850 | 225 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 226 | mavlink_msg_uwb_2way_multi_range_raw_5_send(MAVLINK_COMM_1 , packet1.num_of_units , packet1.address , packet1.remote_address , packet1.timestamp_master_request_1_recv , packet1.timestamp_slave_reply_send , packet1.timestamp_master_request_2_recv , packet1.timestamp_master_request_1 , packet1.timestamp_slave_reply , packet1.timestamp_master_request_2 ); |
bhepp | 9:6f782c9f1850 | 227 | mavlink_msg_uwb_2way_multi_range_raw_5_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 228 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 229 | } |
bhepp | 9:6f782c9f1850 | 230 | |
bhepp | 9:6f782c9f1850 | 231 | static void mavlink_test_uwb_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 232 | { |
bhepp | 9:6f782c9f1850 | 233 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 234 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 235 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 236 | mavlink_uwb_status_t packet_in = { |
bhepp | 9:6f782c9f1850 | 237 | 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVW" |
bhepp | 9:6f782c9f1850 | 238 | }; |
bhepp | 9:6f782c9f1850 | 239 | mavlink_uwb_status_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 240 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 241 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 242 | |
bhepp | 9:6f782c9f1850 | 243 | mav_array_memcpy(packet1.description, packet_in.description, sizeof(char)*127); |
bhepp | 9:6f782c9f1850 | 244 | |
bhepp | 9:6f782c9f1850 | 245 | |
bhepp | 9:6f782c9f1850 | 246 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 247 | mavlink_msg_uwb_status_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 248 | mavlink_msg_uwb_status_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 249 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 250 | |
bhepp | 9:6f782c9f1850 | 251 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 252 | mavlink_msg_uwb_status_pack(system_id, component_id, &msg , packet1.address , packet1.description ); |
bhepp | 9:6f782c9f1850 | 253 | mavlink_msg_uwb_status_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 254 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 255 | |
bhepp | 9:6f782c9f1850 | 256 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 257 | mavlink_msg_uwb_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.description ); |
bhepp | 9:6f782c9f1850 | 258 | mavlink_msg_uwb_status_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 259 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 260 | |
bhepp | 9:6f782c9f1850 | 261 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 262 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 263 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 264 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 265 | } |
bhepp | 9:6f782c9f1850 | 266 | mavlink_msg_uwb_status_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 267 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 268 | |
bhepp | 9:6f782c9f1850 | 269 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 270 | mavlink_msg_uwb_status_send(MAVLINK_COMM_1 , packet1.address , packet1.description ); |
bhepp | 9:6f782c9f1850 | 271 | mavlink_msg_uwb_status_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 272 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 273 | } |
bhepp | 9:6f782c9f1850 | 274 | |
bhepp | 9:6f782c9f1850 | 275 | static void mavlink_test_uwb_prototyping(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 276 | { |
bhepp | 9:6f782c9f1850 | 277 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 278 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 279 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 280 | mavlink_uwb_prototyping_t packet_in = { |
bhepp | 9:6f782c9f1850 | 281 | { 93372036854775807, 93372036854775808, 93372036854775809, 93372036854775810, 93372036854775811, 93372036854775812, 93372036854775813, 93372036854775814, 93372036854775815, 93372036854775816 },{ 577.0, 578.0, 579.0, 580.0, 581.0, 582.0, 583.0, 584.0, 585.0, 586.0 },109 |
bhepp | 9:6f782c9f1850 | 282 | }; |
bhepp | 9:6f782c9f1850 | 283 | mavlink_uwb_prototyping_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 284 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 285 | packet1.type = packet_in.type; |
bhepp | 9:6f782c9f1850 | 286 | |
bhepp | 9:6f782c9f1850 | 287 | mav_array_memcpy(packet1.integers, packet_in.integers, sizeof(uint64_t)*10); |
bhepp | 9:6f782c9f1850 | 288 | mav_array_memcpy(packet1.floats, packet_in.floats, sizeof(float)*10); |
bhepp | 9:6f782c9f1850 | 289 | |
bhepp | 9:6f782c9f1850 | 290 | |
bhepp | 9:6f782c9f1850 | 291 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 292 | mavlink_msg_uwb_prototyping_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 293 | mavlink_msg_uwb_prototyping_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 294 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 295 | |
bhepp | 9:6f782c9f1850 | 296 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 297 | mavlink_msg_uwb_prototyping_pack(system_id, component_id, &msg , packet1.type , packet1.integers , packet1.floats ); |
bhepp | 9:6f782c9f1850 | 298 | mavlink_msg_uwb_prototyping_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 299 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 300 | |
bhepp | 9:6f782c9f1850 | 301 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 302 | mavlink_msg_uwb_prototyping_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.integers , packet1.floats ); |
bhepp | 9:6f782c9f1850 | 303 | mavlink_msg_uwb_prototyping_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 304 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 305 | |
bhepp | 9:6f782c9f1850 | 306 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 307 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 308 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 309 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 310 | } |
bhepp | 9:6f782c9f1850 | 311 | mavlink_msg_uwb_prototyping_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 312 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 313 | |
bhepp | 9:6f782c9f1850 | 314 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 315 | mavlink_msg_uwb_prototyping_send(MAVLINK_COMM_1 , packet1.type , packet1.integers , packet1.floats ); |
bhepp | 9:6f782c9f1850 | 316 | mavlink_msg_uwb_prototyping_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 317 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 318 | } |
bhepp | 9:6f782c9f1850 | 319 | |
bhepp | 9:6f782c9f1850 | 320 | static void mavlink_test_uwb_range(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 321 | { |
bhepp | 9:6f782c9f1850 | 322 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 323 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 324 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 325 | mavlink_uwb_range_t packet_in = { |
bhepp | 9:6f782c9f1850 | 326 | 963497464,45.0,73.0,41,108 |
bhepp | 9:6f782c9f1850 | 327 | }; |
bhepp | 9:6f782c9f1850 | 328 | mavlink_uwb_range_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 329 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 330 | packet1.stamp_us = packet_in.stamp_us; |
bhepp | 9:6f782c9f1850 | 331 | packet1.round_trip_time = packet_in.round_trip_time; |
bhepp | 9:6f782c9f1850 | 332 | packet1.range = packet_in.range; |
bhepp | 9:6f782c9f1850 | 333 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 334 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 335 | |
bhepp | 9:6f782c9f1850 | 336 | |
bhepp | 9:6f782c9f1850 | 337 | |
bhepp | 9:6f782c9f1850 | 338 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 339 | mavlink_msg_uwb_range_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 340 | mavlink_msg_uwb_range_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 341 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 342 | |
bhepp | 9:6f782c9f1850 | 343 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 344 | 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 | 9:6f782c9f1850 | 345 | mavlink_msg_uwb_range_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 346 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 347 | |
bhepp | 9:6f782c9f1850 | 348 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 349 | 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 | 9:6f782c9f1850 | 350 | mavlink_msg_uwb_range_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 351 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 352 | |
bhepp | 9:6f782c9f1850 | 353 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 354 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 355 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 356 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 357 | } |
bhepp | 9:6f782c9f1850 | 358 | mavlink_msg_uwb_range_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 359 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 360 | |
bhepp | 9:6f782c9f1850 | 361 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 362 | mavlink_msg_uwb_range_send(MAVLINK_COMM_1 , packet1.address , packet1.remote_address , packet1.stamp_us , packet1.round_trip_time , packet1.range ); |
bhepp | 9:6f782c9f1850 | 363 | mavlink_msg_uwb_range_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 364 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 365 | } |
bhepp | 9:6f782c9f1850 | 366 | |
bhepp | 9:6f782c9f1850 | 367 | static void mavlink_test_uwb_range_stats(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 368 | { |
bhepp | 9:6f782c9f1850 | 369 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 370 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 371 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 372 | mavlink_uwb_range_stats_t packet_in = { |
bhepp | 9:6f782c9f1850 | 373 | 963497464,45.0,73.0,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,19315,19419,137,204 |
bhepp | 9:6f782c9f1850 | 374 | }; |
bhepp | 9:6f782c9f1850 | 375 | mavlink_uwb_range_stats_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 376 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 377 | packet1.stamp_us = packet_in.stamp_us; |
bhepp | 9:6f782c9f1850 | 378 | packet1.round_trip_time = packet_in.round_trip_time; |
bhepp | 9:6f782c9f1850 | 379 | packet1.range = packet_in.range; |
bhepp | 9:6f782c9f1850 | 380 | packet1.std_noise_1 = packet_in.std_noise_1; |
bhepp | 9:6f782c9f1850 | 381 | packet1.std_noise_2 = packet_in.std_noise_2; |
bhepp | 9:6f782c9f1850 | 382 | packet1.preamble_acc_count_1 = packet_in.preamble_acc_count_1; |
bhepp | 9:6f782c9f1850 | 383 | packet1.preamble_acc_count_2 = packet_in.preamble_acc_count_2; |
bhepp | 9:6f782c9f1850 | 384 | packet1.first_path_index_1 = packet_in.first_path_index_1; |
bhepp | 9:6f782c9f1850 | 385 | packet1.first_path_index_2 = packet_in.first_path_index_2; |
bhepp | 9:6f782c9f1850 | 386 | packet1.first_path_amp_1_1 = packet_in.first_path_amp_1_1; |
bhepp | 9:6f782c9f1850 | 387 | packet1.first_path_amp_1_2 = packet_in.first_path_amp_1_2; |
bhepp | 9:6f782c9f1850 | 388 | packet1.first_path_amp_2_1 = packet_in.first_path_amp_2_1; |
bhepp | 9:6f782c9f1850 | 389 | packet1.first_path_amp_2_2 = packet_in.first_path_amp_2_2; |
bhepp | 9:6f782c9f1850 | 390 | packet1.first_path_amp_3_1 = packet_in.first_path_amp_3_1; |
bhepp | 9:6f782c9f1850 | 391 | packet1.first_path_amp_3_2 = packet_in.first_path_amp_3_2; |
bhepp | 9:6f782c9f1850 | 392 | packet1.channel_impulse_response_power_1 = packet_in.channel_impulse_response_power_1; |
bhepp | 9:6f782c9f1850 | 393 | packet1.channel_impulse_response_power_2 = packet_in.channel_impulse_response_power_2; |
bhepp | 9:6f782c9f1850 | 394 | packet1.prf_1 = packet_in.prf_1; |
bhepp | 9:6f782c9f1850 | 395 | packet1.prf_2 = packet_in.prf_2; |
bhepp | 9:6f782c9f1850 | 396 | packet1.address = packet_in.address; |
bhepp | 9:6f782c9f1850 | 397 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 398 | |
bhepp | 9:6f782c9f1850 | 399 | |
bhepp | 9:6f782c9f1850 | 400 | |
bhepp | 9:6f782c9f1850 | 401 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 402 | mavlink_msg_uwb_range_stats_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 403 | mavlink_msg_uwb_range_stats_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 404 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 405 | |
bhepp | 9:6f782c9f1850 | 406 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 407 | 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 | 9:6f782c9f1850 | 408 | mavlink_msg_uwb_range_stats_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 409 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 410 | |
bhepp | 9:6f782c9f1850 | 411 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 412 | 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 | 9:6f782c9f1850 | 413 | mavlink_msg_uwb_range_stats_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 414 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 415 | |
bhepp | 9:6f782c9f1850 | 416 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 417 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 418 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 419 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 420 | } |
bhepp | 9:6f782c9f1850 | 421 | mavlink_msg_uwb_range_stats_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 422 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 423 | |
bhepp | 9:6f782c9f1850 | 424 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 425 | 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 | 9:6f782c9f1850 | 426 | mavlink_msg_uwb_range_stats_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 427 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 428 | } |
bhepp | 9:6f782c9f1850 | 429 | |
bhepp | 9:6f782c9f1850 | 430 | static void mavlink_test_uwb_range_batch_2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 431 | { |
bhepp | 9:6f782c9f1850 | 432 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 433 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 434 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 435 | mavlink_uwb_range_batch_2_t packet_in = { |
bhepp | 9:6f782c9f1850 | 436 | { 17.0, 18.0 },{ 29, 30 },163 |
bhepp | 9:6f782c9f1850 | 437 | }; |
bhepp | 9:6f782c9f1850 | 438 | mavlink_uwb_range_batch_2_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 439 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 440 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 441 | |
bhepp | 9:6f782c9f1850 | 442 | mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*2); |
bhepp | 9:6f782c9f1850 | 443 | mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*2); |
bhepp | 9:6f782c9f1850 | 444 | |
bhepp | 9:6f782c9f1850 | 445 | |
bhepp | 9:6f782c9f1850 | 446 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 447 | mavlink_msg_uwb_range_batch_2_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 448 | mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 449 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 450 | |
bhepp | 9:6f782c9f1850 | 451 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 452 | mavlink_msg_uwb_range_batch_2_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 453 | mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 454 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 455 | |
bhepp | 9:6f782c9f1850 | 456 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 457 | mavlink_msg_uwb_range_batch_2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 458 | mavlink_msg_uwb_range_batch_2_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 459 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 460 | |
bhepp | 9:6f782c9f1850 | 461 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 462 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 463 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 464 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 465 | } |
bhepp | 9:6f782c9f1850 | 466 | mavlink_msg_uwb_range_batch_2_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 467 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 468 | |
bhepp | 9:6f782c9f1850 | 469 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 470 | mavlink_msg_uwb_range_batch_2_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 471 | mavlink_msg_uwb_range_batch_2_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 472 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 473 | } |
bhepp | 9:6f782c9f1850 | 474 | |
bhepp | 9:6f782c9f1850 | 475 | static void mavlink_test_uwb_range_batch_3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 476 | { |
bhepp | 9:6f782c9f1850 | 477 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 478 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 479 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 480 | mavlink_uwb_range_batch_3_t packet_in = { |
bhepp | 9:6f782c9f1850 | 481 | { 17.0, 18.0, 19.0 },{ 41, 42, 43 },242 |
bhepp | 9:6f782c9f1850 | 482 | }; |
bhepp | 9:6f782c9f1850 | 483 | mavlink_uwb_range_batch_3_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 484 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 485 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 486 | |
bhepp | 9:6f782c9f1850 | 487 | mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*3); |
bhepp | 9:6f782c9f1850 | 488 | mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*3); |
bhepp | 9:6f782c9f1850 | 489 | |
bhepp | 9:6f782c9f1850 | 490 | |
bhepp | 9:6f782c9f1850 | 491 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 492 | mavlink_msg_uwb_range_batch_3_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 493 | mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 494 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 495 | |
bhepp | 9:6f782c9f1850 | 496 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 497 | mavlink_msg_uwb_range_batch_3_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 498 | mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 499 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 500 | |
bhepp | 9:6f782c9f1850 | 501 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 502 | mavlink_msg_uwb_range_batch_3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 503 | mavlink_msg_uwb_range_batch_3_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 504 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 505 | |
bhepp | 9:6f782c9f1850 | 506 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 507 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 508 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 509 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 510 | } |
bhepp | 9:6f782c9f1850 | 511 | mavlink_msg_uwb_range_batch_3_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 512 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 513 | |
bhepp | 9:6f782c9f1850 | 514 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 515 | mavlink_msg_uwb_range_batch_3_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 516 | mavlink_msg_uwb_range_batch_3_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 517 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 518 | } |
bhepp | 9:6f782c9f1850 | 519 | |
bhepp | 9:6f782c9f1850 | 520 | static void mavlink_test_uwb_range_batch_4(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 521 | { |
bhepp | 9:6f782c9f1850 | 522 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 523 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 524 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 525 | mavlink_uwb_range_batch_4_t packet_in = { |
bhepp | 9:6f782c9f1850 | 526 | { 17.0, 18.0, 19.0, 20.0 },{ 53, 54, 55, 56 },65 |
bhepp | 9:6f782c9f1850 | 527 | }; |
bhepp | 9:6f782c9f1850 | 528 | mavlink_uwb_range_batch_4_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 529 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 530 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 531 | |
bhepp | 9:6f782c9f1850 | 532 | mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*4); |
bhepp | 9:6f782c9f1850 | 533 | mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*4); |
bhepp | 9:6f782c9f1850 | 534 | |
bhepp | 9:6f782c9f1850 | 535 | |
bhepp | 9:6f782c9f1850 | 536 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 537 | mavlink_msg_uwb_range_batch_4_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 538 | mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 539 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 540 | |
bhepp | 9:6f782c9f1850 | 541 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 542 | mavlink_msg_uwb_range_batch_4_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 543 | mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 544 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 545 | |
bhepp | 9:6f782c9f1850 | 546 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 547 | mavlink_msg_uwb_range_batch_4_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 548 | mavlink_msg_uwb_range_batch_4_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 549 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 550 | |
bhepp | 9:6f782c9f1850 | 551 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 552 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 553 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 554 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 555 | } |
bhepp | 9:6f782c9f1850 | 556 | mavlink_msg_uwb_range_batch_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 557 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 558 | |
bhepp | 9:6f782c9f1850 | 559 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 560 | mavlink_msg_uwb_range_batch_4_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 561 | mavlink_msg_uwb_range_batch_4_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 562 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 563 | } |
bhepp | 9:6f782c9f1850 | 564 | |
bhepp | 9:6f782c9f1850 | 565 | static void mavlink_test_uwb_range_batch_5(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 566 | { |
bhepp | 9:6f782c9f1850 | 567 | mavlink_message_t msg; |
bhepp | 9:6f782c9f1850 | 568 | uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; |
bhepp | 9:6f782c9f1850 | 569 | uint16_t i; |
bhepp | 9:6f782c9f1850 | 570 | mavlink_uwb_range_batch_5_t packet_in = { |
bhepp | 9:6f782c9f1850 | 571 | { 17.0, 18.0, 19.0, 20.0, 21.0 },{ 65, 66, 67, 68, 69 },144 |
bhepp | 9:6f782c9f1850 | 572 | }; |
bhepp | 9:6f782c9f1850 | 573 | mavlink_uwb_range_batch_5_t packet1, packet2; |
bhepp | 9:6f782c9f1850 | 574 | memset(&packet1, 0, sizeof(packet1)); |
bhepp | 9:6f782c9f1850 | 575 | packet1.remote_address = packet_in.remote_address; |
bhepp | 9:6f782c9f1850 | 576 | |
bhepp | 9:6f782c9f1850 | 577 | mav_array_memcpy(packet1.range, packet_in.range, sizeof(float)*5); |
bhepp | 9:6f782c9f1850 | 578 | mav_array_memcpy(packet1.addresses, packet_in.addresses, sizeof(uint8_t)*5); |
bhepp | 9:6f782c9f1850 | 579 | |
bhepp | 9:6f782c9f1850 | 580 | |
bhepp | 9:6f782c9f1850 | 581 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 582 | mavlink_msg_uwb_range_batch_5_encode(system_id, component_id, &msg, &packet1); |
bhepp | 9:6f782c9f1850 | 583 | mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 584 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 585 | |
bhepp | 9:6f782c9f1850 | 586 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 587 | mavlink_msg_uwb_range_batch_5_pack(system_id, component_id, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 588 | mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 589 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 590 | |
bhepp | 9:6f782c9f1850 | 591 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 592 | mavlink_msg_uwb_range_batch_5_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 593 | mavlink_msg_uwb_range_batch_5_decode(&msg, &packet2); |
bhepp | 9:6f782c9f1850 | 594 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 595 | |
bhepp | 9:6f782c9f1850 | 596 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 597 | mavlink_msg_to_send_buffer(buffer, &msg); |
bhepp | 9:6f782c9f1850 | 598 | for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { |
bhepp | 9:6f782c9f1850 | 599 | comm_send_ch(MAVLINK_COMM_0, buffer[i]); |
bhepp | 9:6f782c9f1850 | 600 | } |
bhepp | 9:6f782c9f1850 | 601 | mavlink_msg_uwb_range_batch_5_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 602 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 603 | |
bhepp | 9:6f782c9f1850 | 604 | memset(&packet2, 0, sizeof(packet2)); |
bhepp | 9:6f782c9f1850 | 605 | mavlink_msg_uwb_range_batch_5_send(MAVLINK_COMM_1 , packet1.addresses , packet1.remote_address , packet1.range ); |
bhepp | 9:6f782c9f1850 | 606 | mavlink_msg_uwb_range_batch_5_decode(last_msg, &packet2); |
bhepp | 9:6f782c9f1850 | 607 | MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); |
bhepp | 9:6f782c9f1850 | 608 | } |
bhepp | 9:6f782c9f1850 | 609 | |
bhepp | 9:6f782c9f1850 | 610 | static void mavlink_test_uwb(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) |
bhepp | 9:6f782c9f1850 | 611 | { |
bhepp | 9:6f782c9f1850 | 612 | mavlink_test_uwb_multi_range_raw_4(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 613 | mavlink_test_uwb_2way_multi_range_raw_10(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 614 | mavlink_test_uwb_2way_multi_range_raw_4(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 615 | mavlink_test_uwb_2way_multi_range_raw_5(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 616 | mavlink_test_uwb_status(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 617 | mavlink_test_uwb_prototyping(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 618 | mavlink_test_uwb_range(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 619 | mavlink_test_uwb_range_stats(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 620 | mavlink_test_uwb_range_batch_2(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 621 | mavlink_test_uwb_range_batch_3(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 622 | mavlink_test_uwb_range_batch_4(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 623 | mavlink_test_uwb_range_batch_5(system_id, component_id, last_msg); |
bhepp | 9:6f782c9f1850 | 624 | } |
bhepp | 9:6f782c9f1850 | 625 | |
bhepp | 9:6f782c9f1850 | 626 | #ifdef __cplusplus |
bhepp | 9:6f782c9f1850 | 627 | } |
bhepp | 9:6f782c9f1850 | 628 | #endif // __cplusplus |
bhepp | 9:6f782c9f1850 | 629 | #endif // UWB_TESTSUITE_H |