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