Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
testsuite.h
00001 /** @file 00002 * @brief MAVLink comm protocol testsuite generated from common.xml 00003 * @see http://qgroundcontrol.org/mavlink/ 00004 */ 00005 #pragma once 00006 #ifndef COMMON_TESTSUITE_H 00007 #define COMMON_TESTSUITE_H 00008 00009 #ifdef __cplusplus 00010 extern "C" { 00011 #endif 00012 00013 #ifndef MAVLINK_TEST_ALL 00014 #define MAVLINK_TEST_ALL 00015 00016 static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); 00017 00018 static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00019 { 00020 00021 mavlink_test_common(system_id, component_id, last_msg); 00022 } 00023 #endif 00024 00025 00026 00027 00028 static void mavlink_test_heartbeat(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00029 { 00030 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00031 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00032 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HEARTBEAT >= 256) { 00033 return; 00034 } 00035 #endif 00036 mavlink_message_t msg; 00037 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00038 uint16_t i; 00039 mavlink_heartbeat_t packet_in = { 00040 963497464,17,84,151,218,3 00041 }; 00042 mavlink_heartbeat_t packet1, packet2; 00043 memset(&packet1, 0, sizeof(packet1)); 00044 packet1.custom_mode = packet_in.custom_mode; 00045 packet1.type = packet_in.type; 00046 packet1.autopilot = packet_in.autopilot; 00047 packet1.base_mode = packet_in.base_mode; 00048 packet1.system_status = packet_in.system_status; 00049 packet1.mavlink_version = packet_in.mavlink_version; 00050 00051 00052 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00053 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00054 // cope with extensions 00055 memset(MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HEARTBEAT_MIN_LEN); 00056 } 00057 #endif 00058 memset(&packet2, 0, sizeof(packet2)); 00059 mavlink_msg_heartbeat_encode(system_id, component_id, &msg, &packet1); 00060 mavlink_msg_heartbeat_decode(&msg, &packet2); 00061 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00062 00063 memset(&packet2, 0, sizeof(packet2)); 00064 mavlink_msg_heartbeat_pack(system_id, component_id, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); 00065 mavlink_msg_heartbeat_decode(&msg, &packet2); 00066 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00067 00068 memset(&packet2, 0, sizeof(packet2)); 00069 mavlink_msg_heartbeat_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); 00070 mavlink_msg_heartbeat_decode(&msg, &packet2); 00071 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00072 00073 memset(&packet2, 0, sizeof(packet2)); 00074 mavlink_msg_to_send_buffer(buffer, &msg); 00075 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00076 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00077 } 00078 mavlink_msg_heartbeat_decode(last_msg, &packet2); 00079 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00080 00081 memset(&packet2, 0, sizeof(packet2)); 00082 mavlink_msg_heartbeat_send(MAVLINK_COMM_1 , packet1.type , packet1.autopilot , packet1.base_mode , packet1.custom_mode , packet1.system_status ); 00083 mavlink_msg_heartbeat_decode(last_msg, &packet2); 00084 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00085 } 00086 00087 static void mavlink_test_sys_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00088 { 00089 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00090 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00091 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYS_STATUS >= 256) { 00092 return; 00093 } 00094 #endif 00095 mavlink_message_t msg; 00096 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00097 uint16_t i; 00098 mavlink_sys_status_t packet_in = { 00099 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,18587,18691,223 00100 }; 00101 mavlink_sys_status_t packet1, packet2; 00102 memset(&packet1, 0, sizeof(packet1)); 00103 packet1.onboard_control_sensors_present = packet_in.onboard_control_sensors_present; 00104 packet1.onboard_control_sensors_enabled = packet_in.onboard_control_sensors_enabled; 00105 packet1.onboard_control_sensors_health = packet_in.onboard_control_sensors_health; 00106 packet1.load = packet_in.load; 00107 packet1.voltage_battery = packet_in.voltage_battery; 00108 packet1.current_battery = packet_in.current_battery; 00109 packet1.drop_rate_comm = packet_in.drop_rate_comm; 00110 packet1.errors_comm = packet_in.errors_comm; 00111 packet1.errors_count1 = packet_in.errors_count1; 00112 packet1.errors_count2 = packet_in.errors_count2; 00113 packet1.errors_count3 = packet_in.errors_count3; 00114 packet1.errors_count4 = packet_in.errors_count4; 00115 packet1.battery_remaining = packet_in.battery_remaining; 00116 00117 00118 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00119 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00120 // cope with extensions 00121 memset(MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYS_STATUS_MIN_LEN); 00122 } 00123 #endif 00124 memset(&packet2, 0, sizeof(packet2)); 00125 mavlink_msg_sys_status_encode(system_id, component_id, &msg, &packet1); 00126 mavlink_msg_sys_status_decode(&msg, &packet2); 00127 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00128 00129 memset(&packet2, 0, sizeof(packet2)); 00130 mavlink_msg_sys_status_pack(system_id, component_id, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); 00131 mavlink_msg_sys_status_decode(&msg, &packet2); 00132 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00133 00134 memset(&packet2, 0, sizeof(packet2)); 00135 mavlink_msg_sys_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); 00136 mavlink_msg_sys_status_decode(&msg, &packet2); 00137 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00138 00139 memset(&packet2, 0, sizeof(packet2)); 00140 mavlink_msg_to_send_buffer(buffer, &msg); 00141 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00142 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00143 } 00144 mavlink_msg_sys_status_decode(last_msg, &packet2); 00145 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00146 00147 memset(&packet2, 0, sizeof(packet2)); 00148 mavlink_msg_sys_status_send(MAVLINK_COMM_1 , packet1.onboard_control_sensors_present , packet1.onboard_control_sensors_enabled , packet1.onboard_control_sensors_health , packet1.load , packet1.voltage_battery , packet1.current_battery , packet1.battery_remaining , packet1.drop_rate_comm , packet1.errors_comm , packet1.errors_count1 , packet1.errors_count2 , packet1.errors_count3 , packet1.errors_count4 ); 00149 mavlink_msg_sys_status_decode(last_msg, &packet2); 00150 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00151 } 00152 00153 static void mavlink_test_system_time(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00154 { 00155 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00156 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00157 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SYSTEM_TIME >= 256) { 00158 return; 00159 } 00160 #endif 00161 mavlink_message_t msg; 00162 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00163 uint16_t i; 00164 mavlink_system_time_t packet_in = { 00165 93372036854775807ULL,963497880 00166 }; 00167 mavlink_system_time_t packet1, packet2; 00168 memset(&packet1, 0, sizeof(packet1)); 00169 packet1.time_unix_usec = packet_in.time_unix_usec; 00170 packet1.time_boot_ms = packet_in.time_boot_ms; 00171 00172 00173 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00174 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00175 // cope with extensions 00176 memset(MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SYSTEM_TIME_MIN_LEN); 00177 } 00178 #endif 00179 memset(&packet2, 0, sizeof(packet2)); 00180 mavlink_msg_system_time_encode(system_id, component_id, &msg, &packet1); 00181 mavlink_msg_system_time_decode(&msg, &packet2); 00182 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00183 00184 memset(&packet2, 0, sizeof(packet2)); 00185 mavlink_msg_system_time_pack(system_id, component_id, &msg , packet1.time_unix_usec , packet1.time_boot_ms ); 00186 mavlink_msg_system_time_decode(&msg, &packet2); 00187 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00188 00189 memset(&packet2, 0, sizeof(packet2)); 00190 mavlink_msg_system_time_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_unix_usec , packet1.time_boot_ms ); 00191 mavlink_msg_system_time_decode(&msg, &packet2); 00192 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00193 00194 memset(&packet2, 0, sizeof(packet2)); 00195 mavlink_msg_to_send_buffer(buffer, &msg); 00196 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00197 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00198 } 00199 mavlink_msg_system_time_decode(last_msg, &packet2); 00200 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00201 00202 memset(&packet2, 0, sizeof(packet2)); 00203 mavlink_msg_system_time_send(MAVLINK_COMM_1 , packet1.time_unix_usec , packet1.time_boot_ms ); 00204 mavlink_msg_system_time_decode(last_msg, &packet2); 00205 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00206 } 00207 00208 static void mavlink_test_ping(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00209 { 00210 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00211 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00212 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PING >= 256) { 00213 return; 00214 } 00215 #endif 00216 mavlink_message_t msg; 00217 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00218 uint16_t i; 00219 mavlink_ping_t packet_in = { 00220 93372036854775807ULL,963497880,41,108 00221 }; 00222 mavlink_ping_t packet1, packet2; 00223 memset(&packet1, 0, sizeof(packet1)); 00224 packet1.time_usec = packet_in.time_usec; 00225 packet1.seq = packet_in.seq; 00226 packet1.target_system = packet_in.target_system; 00227 packet1.target_component = packet_in.target_component; 00228 00229 00230 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00231 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00232 // cope with extensions 00233 memset(MAVLINK_MSG_ID_PING_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PING_MIN_LEN); 00234 } 00235 #endif 00236 memset(&packet2, 0, sizeof(packet2)); 00237 mavlink_msg_ping_encode(system_id, component_id, &msg, &packet1); 00238 mavlink_msg_ping_decode(&msg, &packet2); 00239 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00240 00241 memset(&packet2, 0, sizeof(packet2)); 00242 mavlink_msg_ping_pack(system_id, component_id, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component ); 00243 mavlink_msg_ping_decode(&msg, &packet2); 00244 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00245 00246 memset(&packet2, 0, sizeof(packet2)); 00247 mavlink_msg_ping_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component ); 00248 mavlink_msg_ping_decode(&msg, &packet2); 00249 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00250 00251 memset(&packet2, 0, sizeof(packet2)); 00252 mavlink_msg_to_send_buffer(buffer, &msg); 00253 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00254 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00255 } 00256 mavlink_msg_ping_decode(last_msg, &packet2); 00257 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00258 00259 memset(&packet2, 0, sizeof(packet2)); 00260 mavlink_msg_ping_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq , packet1.target_system , packet1.target_component ); 00261 mavlink_msg_ping_decode(last_msg, &packet2); 00262 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00263 } 00264 00265 static void mavlink_test_change_operator_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00266 { 00267 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00268 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00269 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL >= 256) { 00270 return; 00271 } 00272 #endif 00273 mavlink_message_t msg; 00274 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00275 uint16_t i; 00276 mavlink_change_operator_control_t packet_in = { 00277 5,72,139,"DEFGHIJKLMNOPQRSTUVWXYZA" 00278 }; 00279 mavlink_change_operator_control_t packet1, packet2; 00280 memset(&packet1, 0, sizeof(packet1)); 00281 packet1.target_system = packet_in.target_system; 00282 packet1.control_request = packet_in.control_request; 00283 packet1.version = packet_in.version; 00284 00285 mav_array_memcpy(packet1.passkey, packet_in.passkey, sizeof(char)*25); 00286 00287 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00288 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00289 // cope with extensions 00290 memset(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_MIN_LEN); 00291 } 00292 #endif 00293 memset(&packet2, 0, sizeof(packet2)); 00294 mavlink_msg_change_operator_control_encode(system_id, component_id, &msg, &packet1); 00295 mavlink_msg_change_operator_control_decode(&msg, &packet2); 00296 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00297 00298 memset(&packet2, 0, sizeof(packet2)); 00299 mavlink_msg_change_operator_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey ); 00300 mavlink_msg_change_operator_control_decode(&msg, &packet2); 00301 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00302 00303 memset(&packet2, 0, sizeof(packet2)); 00304 mavlink_msg_change_operator_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey ); 00305 mavlink_msg_change_operator_control_decode(&msg, &packet2); 00306 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00307 00308 memset(&packet2, 0, sizeof(packet2)); 00309 mavlink_msg_to_send_buffer(buffer, &msg); 00310 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00311 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00312 } 00313 mavlink_msg_change_operator_control_decode(last_msg, &packet2); 00314 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00315 00316 memset(&packet2, 0, sizeof(packet2)); 00317 mavlink_msg_change_operator_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.control_request , packet1.version , packet1.passkey ); 00318 mavlink_msg_change_operator_control_decode(last_msg, &packet2); 00319 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00320 } 00321 00322 static void mavlink_test_change_operator_control_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00323 { 00324 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00325 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00326 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK >= 256) { 00327 return; 00328 } 00329 #endif 00330 mavlink_message_t msg; 00331 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00332 uint16_t i; 00333 mavlink_change_operator_control_ack_t packet_in = { 00334 5,72,139 00335 }; 00336 mavlink_change_operator_control_ack_t packet1, packet2; 00337 memset(&packet1, 0, sizeof(packet1)); 00338 packet1.gcs_system_id = packet_in.gcs_system_id; 00339 packet1.control_request = packet_in.control_request; 00340 packet1.ack = packet_in.ack; 00341 00342 00343 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00344 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00345 // cope with extensions 00346 memset(MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_MIN_LEN); 00347 } 00348 #endif 00349 memset(&packet2, 0, sizeof(packet2)); 00350 mavlink_msg_change_operator_control_ack_encode(system_id, component_id, &msg, &packet1); 00351 mavlink_msg_change_operator_control_ack_decode(&msg, &packet2); 00352 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00353 00354 memset(&packet2, 0, sizeof(packet2)); 00355 mavlink_msg_change_operator_control_ack_pack(system_id, component_id, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack ); 00356 mavlink_msg_change_operator_control_ack_decode(&msg, &packet2); 00357 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00358 00359 memset(&packet2, 0, sizeof(packet2)); 00360 mavlink_msg_change_operator_control_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.gcs_system_id , packet1.control_request , packet1.ack ); 00361 mavlink_msg_change_operator_control_ack_decode(&msg, &packet2); 00362 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00363 00364 memset(&packet2, 0, sizeof(packet2)); 00365 mavlink_msg_to_send_buffer(buffer, &msg); 00366 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00367 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00368 } 00369 mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2); 00370 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00371 00372 memset(&packet2, 0, sizeof(packet2)); 00373 mavlink_msg_change_operator_control_ack_send(MAVLINK_COMM_1 , packet1.gcs_system_id , packet1.control_request , packet1.ack ); 00374 mavlink_msg_change_operator_control_ack_decode(last_msg, &packet2); 00375 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00376 } 00377 00378 static void mavlink_test_auth_key(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00379 { 00380 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00381 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00382 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTH_KEY >= 256) { 00383 return; 00384 } 00385 #endif 00386 mavlink_message_t msg; 00387 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00388 uint16_t i; 00389 mavlink_auth_key_t packet_in = { 00390 "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE" 00391 }; 00392 mavlink_auth_key_t packet1, packet2; 00393 memset(&packet1, 0, sizeof(packet1)); 00394 00395 mav_array_memcpy(packet1.key, packet_in.key, sizeof(char)*32); 00396 00397 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00398 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00399 // cope with extensions 00400 memset(MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTH_KEY_MIN_LEN); 00401 } 00402 #endif 00403 memset(&packet2, 0, sizeof(packet2)); 00404 mavlink_msg_auth_key_encode(system_id, component_id, &msg, &packet1); 00405 mavlink_msg_auth_key_decode(&msg, &packet2); 00406 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00407 00408 memset(&packet2, 0, sizeof(packet2)); 00409 mavlink_msg_auth_key_pack(system_id, component_id, &msg , packet1.key ); 00410 mavlink_msg_auth_key_decode(&msg, &packet2); 00411 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00412 00413 memset(&packet2, 0, sizeof(packet2)); 00414 mavlink_msg_auth_key_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.key ); 00415 mavlink_msg_auth_key_decode(&msg, &packet2); 00416 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00417 00418 memset(&packet2, 0, sizeof(packet2)); 00419 mavlink_msg_to_send_buffer(buffer, &msg); 00420 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00421 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00422 } 00423 mavlink_msg_auth_key_decode(last_msg, &packet2); 00424 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00425 00426 memset(&packet2, 0, sizeof(packet2)); 00427 mavlink_msg_auth_key_send(MAVLINK_COMM_1 , packet1.key ); 00428 mavlink_msg_auth_key_decode(last_msg, &packet2); 00429 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00430 } 00431 00432 static void mavlink_test_set_mode(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00433 { 00434 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00435 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00436 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_MODE >= 256) { 00437 return; 00438 } 00439 #endif 00440 mavlink_message_t msg; 00441 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00442 uint16_t i; 00443 mavlink_set_mode_t packet_in = { 00444 963497464,17,84 00445 }; 00446 mavlink_set_mode_t packet1, packet2; 00447 memset(&packet1, 0, sizeof(packet1)); 00448 packet1.custom_mode = packet_in.custom_mode; 00449 packet1.target_system = packet_in.target_system; 00450 packet1.base_mode = packet_in.base_mode; 00451 00452 00453 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00454 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00455 // cope with extensions 00456 memset(MAVLINK_MSG_ID_SET_MODE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_MODE_MIN_LEN); 00457 } 00458 #endif 00459 memset(&packet2, 0, sizeof(packet2)); 00460 mavlink_msg_set_mode_encode(system_id, component_id, &msg, &packet1); 00461 mavlink_msg_set_mode_decode(&msg, &packet2); 00462 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00463 00464 memset(&packet2, 0, sizeof(packet2)); 00465 mavlink_msg_set_mode_pack(system_id, component_id, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode ); 00466 mavlink_msg_set_mode_decode(&msg, &packet2); 00467 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00468 00469 memset(&packet2, 0, sizeof(packet2)); 00470 mavlink_msg_set_mode_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.base_mode , packet1.custom_mode ); 00471 mavlink_msg_set_mode_decode(&msg, &packet2); 00472 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00473 00474 memset(&packet2, 0, sizeof(packet2)); 00475 mavlink_msg_to_send_buffer(buffer, &msg); 00476 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00477 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00478 } 00479 mavlink_msg_set_mode_decode(last_msg, &packet2); 00480 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00481 00482 memset(&packet2, 0, sizeof(packet2)); 00483 mavlink_msg_set_mode_send(MAVLINK_COMM_1 , packet1.target_system , packet1.base_mode , packet1.custom_mode ); 00484 mavlink_msg_set_mode_decode(last_msg, &packet2); 00485 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00486 } 00487 00488 static void mavlink_test_param_request_read(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00489 { 00490 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00491 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00492 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_REQUEST_READ >= 256) { 00493 return; 00494 } 00495 #endif 00496 mavlink_message_t msg; 00497 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00498 uint16_t i; 00499 mavlink_param_request_read_t packet_in = { 00500 17235,139,206,"EFGHIJKLMNOPQRS" 00501 }; 00502 mavlink_param_request_read_t packet1, packet2; 00503 memset(&packet1, 0, sizeof(packet1)); 00504 packet1.param_index = packet_in.param_index; 00505 packet1.target_system = packet_in.target_system; 00506 packet1.target_component = packet_in.target_component; 00507 00508 mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); 00509 00510 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00511 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00512 // cope with extensions 00513 memset(MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_REQUEST_READ_MIN_LEN); 00514 } 00515 #endif 00516 memset(&packet2, 0, sizeof(packet2)); 00517 mavlink_msg_param_request_read_encode(system_id, component_id, &msg, &packet1); 00518 mavlink_msg_param_request_read_decode(&msg, &packet2); 00519 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00520 00521 memset(&packet2, 0, sizeof(packet2)); 00522 mavlink_msg_param_request_read_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index ); 00523 mavlink_msg_param_request_read_decode(&msg, &packet2); 00524 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00525 00526 memset(&packet2, 0, sizeof(packet2)); 00527 mavlink_msg_param_request_read_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index ); 00528 mavlink_msg_param_request_read_decode(&msg, &packet2); 00529 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00530 00531 memset(&packet2, 0, sizeof(packet2)); 00532 mavlink_msg_to_send_buffer(buffer, &msg); 00533 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00534 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00535 } 00536 mavlink_msg_param_request_read_decode(last_msg, &packet2); 00537 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00538 00539 memset(&packet2, 0, sizeof(packet2)); 00540 mavlink_msg_param_request_read_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index ); 00541 mavlink_msg_param_request_read_decode(last_msg, &packet2); 00542 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00543 } 00544 00545 static void mavlink_test_param_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00546 { 00547 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00548 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00549 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_REQUEST_LIST >= 256) { 00550 return; 00551 } 00552 #endif 00553 mavlink_message_t msg; 00554 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00555 uint16_t i; 00556 mavlink_param_request_list_t packet_in = { 00557 5,72 00558 }; 00559 mavlink_param_request_list_t packet1, packet2; 00560 memset(&packet1, 0, sizeof(packet1)); 00561 packet1.target_system = packet_in.target_system; 00562 packet1.target_component = packet_in.target_component; 00563 00564 00565 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00566 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00567 // cope with extensions 00568 memset(MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_REQUEST_LIST_MIN_LEN); 00569 } 00570 #endif 00571 memset(&packet2, 0, sizeof(packet2)); 00572 mavlink_msg_param_request_list_encode(system_id, component_id, &msg, &packet1); 00573 mavlink_msg_param_request_list_decode(&msg, &packet2); 00574 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00575 00576 memset(&packet2, 0, sizeof(packet2)); 00577 mavlink_msg_param_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); 00578 mavlink_msg_param_request_list_decode(&msg, &packet2); 00579 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00580 00581 memset(&packet2, 0, sizeof(packet2)); 00582 mavlink_msg_param_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); 00583 mavlink_msg_param_request_list_decode(&msg, &packet2); 00584 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00585 00586 memset(&packet2, 0, sizeof(packet2)); 00587 mavlink_msg_to_send_buffer(buffer, &msg); 00588 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00589 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00590 } 00591 mavlink_msg_param_request_list_decode(last_msg, &packet2); 00592 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00593 00594 memset(&packet2, 0, sizeof(packet2)); 00595 mavlink_msg_param_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); 00596 mavlink_msg_param_request_list_decode(last_msg, &packet2); 00597 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00598 } 00599 00600 static void mavlink_test_param_value(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00601 { 00602 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00603 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00604 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_VALUE >= 256) { 00605 return; 00606 } 00607 #endif 00608 mavlink_message_t msg; 00609 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00610 uint16_t i; 00611 mavlink_param_value_t packet_in = { 00612 17.0,17443,17547,"IJKLMNOPQRSTUVW",77 00613 }; 00614 mavlink_param_value_t packet1, packet2; 00615 memset(&packet1, 0, sizeof(packet1)); 00616 packet1.param_value = packet_in.param_value; 00617 packet1.param_count = packet_in.param_count; 00618 packet1.param_index = packet_in.param_index; 00619 packet1.param_type = packet_in.param_type; 00620 00621 mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); 00622 00623 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00624 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00625 // cope with extensions 00626 memset(MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_VALUE_MIN_LEN); 00627 } 00628 #endif 00629 memset(&packet2, 0, sizeof(packet2)); 00630 mavlink_msg_param_value_encode(system_id, component_id, &msg, &packet1); 00631 mavlink_msg_param_value_decode(&msg, &packet2); 00632 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00633 00634 memset(&packet2, 0, sizeof(packet2)); 00635 mavlink_msg_param_value_pack(system_id, component_id, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index ); 00636 mavlink_msg_param_value_decode(&msg, &packet2); 00637 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00638 00639 memset(&packet2, 0, sizeof(packet2)); 00640 mavlink_msg_param_value_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index ); 00641 mavlink_msg_param_value_decode(&msg, &packet2); 00642 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00643 00644 memset(&packet2, 0, sizeof(packet2)); 00645 mavlink_msg_to_send_buffer(buffer, &msg); 00646 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00647 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00648 } 00649 mavlink_msg_param_value_decode(last_msg, &packet2); 00650 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00651 00652 memset(&packet2, 0, sizeof(packet2)); 00653 mavlink_msg_param_value_send(MAVLINK_COMM_1 , packet1.param_id , packet1.param_value , packet1.param_type , packet1.param_count , packet1.param_index ); 00654 mavlink_msg_param_value_decode(last_msg, &packet2); 00655 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00656 } 00657 00658 static void mavlink_test_param_set(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00659 { 00660 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00661 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00662 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_SET >= 256) { 00663 return; 00664 } 00665 #endif 00666 mavlink_message_t msg; 00667 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00668 uint16_t i; 00669 mavlink_param_set_t packet_in = { 00670 17.0,17,84,"GHIJKLMNOPQRSTU",199 00671 }; 00672 mavlink_param_set_t packet1, packet2; 00673 memset(&packet1, 0, sizeof(packet1)); 00674 packet1.param_value = packet_in.param_value; 00675 packet1.target_system = packet_in.target_system; 00676 packet1.target_component = packet_in.target_component; 00677 packet1.param_type = packet_in.param_type; 00678 00679 mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); 00680 00681 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00682 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00683 // cope with extensions 00684 memset(MAVLINK_MSG_ID_PARAM_SET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_SET_MIN_LEN); 00685 } 00686 #endif 00687 memset(&packet2, 0, sizeof(packet2)); 00688 mavlink_msg_param_set_encode(system_id, component_id, &msg, &packet1); 00689 mavlink_msg_param_set_decode(&msg, &packet2); 00690 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00691 00692 memset(&packet2, 0, sizeof(packet2)); 00693 mavlink_msg_param_set_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type ); 00694 mavlink_msg_param_set_decode(&msg, &packet2); 00695 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00696 00697 memset(&packet2, 0, sizeof(packet2)); 00698 mavlink_msg_param_set_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type ); 00699 mavlink_msg_param_set_decode(&msg, &packet2); 00700 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00701 00702 memset(&packet2, 0, sizeof(packet2)); 00703 mavlink_msg_to_send_buffer(buffer, &msg); 00704 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00705 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00706 } 00707 mavlink_msg_param_set_decode(last_msg, &packet2); 00708 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00709 00710 memset(&packet2, 0, sizeof(packet2)); 00711 mavlink_msg_param_set_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_value , packet1.param_type ); 00712 mavlink_msg_param_set_decode(last_msg, &packet2); 00713 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00714 } 00715 00716 static void mavlink_test_gps_raw_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00717 { 00718 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00719 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00720 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RAW_INT >= 256) { 00721 return; 00722 } 00723 #endif 00724 mavlink_message_t msg; 00725 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00726 uint16_t i; 00727 mavlink_gps_raw_int_t packet_in = { 00728 93372036854775807ULL,963497880,963498088,963498296,18275,18379,18483,18587,89,156 00729 }; 00730 mavlink_gps_raw_int_t packet1, packet2; 00731 memset(&packet1, 0, sizeof(packet1)); 00732 packet1.time_usec = packet_in.time_usec; 00733 packet1.lat = packet_in.lat; 00734 packet1.lon = packet_in.lon; 00735 packet1.alt = packet_in.alt; 00736 packet1.eph = packet_in.eph; 00737 packet1.epv = packet_in.epv; 00738 packet1.vel = packet_in.vel; 00739 packet1.cog = packet_in.cog; 00740 packet1.fix_type = packet_in.fix_type; 00741 packet1.satellites_visible = packet_in.satellites_visible; 00742 00743 00744 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00745 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00746 // cope with extensions 00747 memset(MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RAW_INT_MIN_LEN); 00748 } 00749 #endif 00750 memset(&packet2, 0, sizeof(packet2)); 00751 mavlink_msg_gps_raw_int_encode(system_id, component_id, &msg, &packet1); 00752 mavlink_msg_gps_raw_int_decode(&msg, &packet2); 00753 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00754 00755 memset(&packet2, 0, sizeof(packet2)); 00756 mavlink_msg_gps_raw_int_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); 00757 mavlink_msg_gps_raw_int_decode(&msg, &packet2); 00758 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00759 00760 memset(&packet2, 0, sizeof(packet2)); 00761 mavlink_msg_gps_raw_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); 00762 mavlink_msg_gps_raw_int_decode(&msg, &packet2); 00763 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00764 00765 memset(&packet2, 0, sizeof(packet2)); 00766 mavlink_msg_to_send_buffer(buffer, &msg); 00767 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00768 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00769 } 00770 mavlink_msg_gps_raw_int_decode(last_msg, &packet2); 00771 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00772 00773 memset(&packet2, 0, sizeof(packet2)); 00774 mavlink_msg_gps_raw_int_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible ); 00775 mavlink_msg_gps_raw_int_decode(last_msg, &packet2); 00776 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00777 } 00778 00779 static void mavlink_test_gps_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00780 { 00781 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00782 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00783 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_STATUS >= 256) { 00784 return; 00785 } 00786 #endif 00787 mavlink_message_t msg; 00788 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00789 uint16_t i; 00790 mavlink_gps_status_t packet_in = { 00791 5,{ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 },{ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151 },{ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211 },{ 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },{ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 } 00792 }; 00793 mavlink_gps_status_t packet1, packet2; 00794 memset(&packet1, 0, sizeof(packet1)); 00795 packet1.satellites_visible = packet_in.satellites_visible; 00796 00797 mav_array_memcpy(packet1.satellite_prn, packet_in.satellite_prn, sizeof(uint8_t)*20); 00798 mav_array_memcpy(packet1.satellite_used, packet_in.satellite_used, sizeof(uint8_t)*20); 00799 mav_array_memcpy(packet1.satellite_elevation, packet_in.satellite_elevation, sizeof(uint8_t)*20); 00800 mav_array_memcpy(packet1.satellite_azimuth, packet_in.satellite_azimuth, sizeof(uint8_t)*20); 00801 mav_array_memcpy(packet1.satellite_snr, packet_in.satellite_snr, sizeof(uint8_t)*20); 00802 00803 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00804 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00805 // cope with extensions 00806 memset(MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_STATUS_MIN_LEN); 00807 } 00808 #endif 00809 memset(&packet2, 0, sizeof(packet2)); 00810 mavlink_msg_gps_status_encode(system_id, component_id, &msg, &packet1); 00811 mavlink_msg_gps_status_decode(&msg, &packet2); 00812 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00813 00814 memset(&packet2, 0, sizeof(packet2)); 00815 mavlink_msg_gps_status_pack(system_id, component_id, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr ); 00816 mavlink_msg_gps_status_decode(&msg, &packet2); 00817 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00818 00819 memset(&packet2, 0, sizeof(packet2)); 00820 mavlink_msg_gps_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr ); 00821 mavlink_msg_gps_status_decode(&msg, &packet2); 00822 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00823 00824 memset(&packet2, 0, sizeof(packet2)); 00825 mavlink_msg_to_send_buffer(buffer, &msg); 00826 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00827 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00828 } 00829 mavlink_msg_gps_status_decode(last_msg, &packet2); 00830 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00831 00832 memset(&packet2, 0, sizeof(packet2)); 00833 mavlink_msg_gps_status_send(MAVLINK_COMM_1 , packet1.satellites_visible , packet1.satellite_prn , packet1.satellite_used , packet1.satellite_elevation , packet1.satellite_azimuth , packet1.satellite_snr ); 00834 mavlink_msg_gps_status_decode(last_msg, &packet2); 00835 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00836 } 00837 00838 static void mavlink_test_scaled_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00839 { 00840 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00841 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00842 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU >= 256) { 00843 return; 00844 } 00845 #endif 00846 mavlink_message_t msg; 00847 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00848 uint16_t i; 00849 mavlink_scaled_imu_t packet_in = { 00850 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275 00851 }; 00852 mavlink_scaled_imu_t packet1, packet2; 00853 memset(&packet1, 0, sizeof(packet1)); 00854 packet1.time_boot_ms = packet_in.time_boot_ms; 00855 packet1.xacc = packet_in.xacc; 00856 packet1.yacc = packet_in.yacc; 00857 packet1.zacc = packet_in.zacc; 00858 packet1.xgyro = packet_in.xgyro; 00859 packet1.ygyro = packet_in.ygyro; 00860 packet1.zgyro = packet_in.zgyro; 00861 packet1.xmag = packet_in.xmag; 00862 packet1.ymag = packet_in.ymag; 00863 packet1.zmag = packet_in.zmag; 00864 00865 00866 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00867 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00868 // cope with extensions 00869 memset(MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU_MIN_LEN); 00870 } 00871 #endif 00872 memset(&packet2, 0, sizeof(packet2)); 00873 mavlink_msg_scaled_imu_encode(system_id, component_id, &msg, &packet1); 00874 mavlink_msg_scaled_imu_decode(&msg, &packet2); 00875 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00876 00877 memset(&packet2, 0, sizeof(packet2)); 00878 mavlink_msg_scaled_imu_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00879 mavlink_msg_scaled_imu_decode(&msg, &packet2); 00880 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00881 00882 memset(&packet2, 0, sizeof(packet2)); 00883 mavlink_msg_scaled_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00884 mavlink_msg_scaled_imu_decode(&msg, &packet2); 00885 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00886 00887 memset(&packet2, 0, sizeof(packet2)); 00888 mavlink_msg_to_send_buffer(buffer, &msg); 00889 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00890 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00891 } 00892 mavlink_msg_scaled_imu_decode(last_msg, &packet2); 00893 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00894 00895 memset(&packet2, 0, sizeof(packet2)); 00896 mavlink_msg_scaled_imu_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00897 mavlink_msg_scaled_imu_decode(last_msg, &packet2); 00898 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00899 } 00900 00901 static void mavlink_test_raw_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00902 { 00903 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00904 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00905 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RAW_IMU >= 256) { 00906 return; 00907 } 00908 #endif 00909 mavlink_message_t msg; 00910 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00911 uint16_t i; 00912 mavlink_raw_imu_t packet_in = { 00913 93372036854775807ULL,17651,17755,17859,17963,18067,18171,18275,18379,18483 00914 }; 00915 mavlink_raw_imu_t packet1, packet2; 00916 memset(&packet1, 0, sizeof(packet1)); 00917 packet1.time_usec = packet_in.time_usec; 00918 packet1.xacc = packet_in.xacc; 00919 packet1.yacc = packet_in.yacc; 00920 packet1.zacc = packet_in.zacc; 00921 packet1.xgyro = packet_in.xgyro; 00922 packet1.ygyro = packet_in.ygyro; 00923 packet1.zgyro = packet_in.zgyro; 00924 packet1.xmag = packet_in.xmag; 00925 packet1.ymag = packet_in.ymag; 00926 packet1.zmag = packet_in.zmag; 00927 00928 00929 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00930 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00931 // cope with extensions 00932 memset(MAVLINK_MSG_ID_RAW_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RAW_IMU_MIN_LEN); 00933 } 00934 #endif 00935 memset(&packet2, 0, sizeof(packet2)); 00936 mavlink_msg_raw_imu_encode(system_id, component_id, &msg, &packet1); 00937 mavlink_msg_raw_imu_decode(&msg, &packet2); 00938 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00939 00940 memset(&packet2, 0, sizeof(packet2)); 00941 mavlink_msg_raw_imu_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00942 mavlink_msg_raw_imu_decode(&msg, &packet2); 00943 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00944 00945 memset(&packet2, 0, sizeof(packet2)); 00946 mavlink_msg_raw_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00947 mavlink_msg_raw_imu_decode(&msg, &packet2); 00948 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00949 00950 memset(&packet2, 0, sizeof(packet2)); 00951 mavlink_msg_to_send_buffer(buffer, &msg); 00952 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 00953 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 00954 } 00955 mavlink_msg_raw_imu_decode(last_msg, &packet2); 00956 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00957 00958 memset(&packet2, 0, sizeof(packet2)); 00959 mavlink_msg_raw_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 00960 mavlink_msg_raw_imu_decode(last_msg, &packet2); 00961 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00962 } 00963 00964 static void mavlink_test_raw_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 00965 { 00966 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00967 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 00968 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RAW_PRESSURE >= 256) { 00969 return; 00970 } 00971 #endif 00972 mavlink_message_t msg; 00973 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 00974 uint16_t i; 00975 mavlink_raw_pressure_t packet_in = { 00976 93372036854775807ULL,17651,17755,17859,17963 00977 }; 00978 mavlink_raw_pressure_t packet1, packet2; 00979 memset(&packet1, 0, sizeof(packet1)); 00980 packet1.time_usec = packet_in.time_usec; 00981 packet1.press_abs = packet_in.press_abs; 00982 packet1.press_diff1 = packet_in.press_diff1; 00983 packet1.press_diff2 = packet_in.press_diff2; 00984 packet1.temperature = packet_in.temperature; 00985 00986 00987 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 00988 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 00989 // cope with extensions 00990 memset(MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RAW_PRESSURE_MIN_LEN); 00991 } 00992 #endif 00993 memset(&packet2, 0, sizeof(packet2)); 00994 mavlink_msg_raw_pressure_encode(system_id, component_id, &msg, &packet1); 00995 mavlink_msg_raw_pressure_decode(&msg, &packet2); 00996 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 00997 00998 memset(&packet2, 0, sizeof(packet2)); 00999 mavlink_msg_raw_pressure_pack(system_id, component_id, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature ); 01000 mavlink_msg_raw_pressure_decode(&msg, &packet2); 01001 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01002 01003 memset(&packet2, 0, sizeof(packet2)); 01004 mavlink_msg_raw_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature ); 01005 mavlink_msg_raw_pressure_decode(&msg, &packet2); 01006 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01007 01008 memset(&packet2, 0, sizeof(packet2)); 01009 mavlink_msg_to_send_buffer(buffer, &msg); 01010 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01011 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01012 } 01013 mavlink_msg_raw_pressure_decode(last_msg, &packet2); 01014 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01015 01016 memset(&packet2, 0, sizeof(packet2)); 01017 mavlink_msg_raw_pressure_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.press_abs , packet1.press_diff1 , packet1.press_diff2 , packet1.temperature ); 01018 mavlink_msg_raw_pressure_decode(last_msg, &packet2); 01019 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01020 } 01021 01022 static void mavlink_test_scaled_pressure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01023 { 01024 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01025 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01026 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE >= 256) { 01027 return; 01028 } 01029 #endif 01030 mavlink_message_t msg; 01031 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01032 uint16_t i; 01033 mavlink_scaled_pressure_t packet_in = { 01034 963497464,45.0,73.0,17859 01035 }; 01036 mavlink_scaled_pressure_t packet1, packet2; 01037 memset(&packet1, 0, sizeof(packet1)); 01038 packet1.time_boot_ms = packet_in.time_boot_ms; 01039 packet1.press_abs = packet_in.press_abs; 01040 packet1.press_diff = packet_in.press_diff; 01041 packet1.temperature = packet_in.temperature; 01042 01043 01044 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01045 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01046 // cope with extensions 01047 memset(MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE_MIN_LEN); 01048 } 01049 #endif 01050 memset(&packet2, 0, sizeof(packet2)); 01051 mavlink_msg_scaled_pressure_encode(system_id, component_id, &msg, &packet1); 01052 mavlink_msg_scaled_pressure_decode(&msg, &packet2); 01053 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01054 01055 memset(&packet2, 0, sizeof(packet2)); 01056 mavlink_msg_scaled_pressure_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 01057 mavlink_msg_scaled_pressure_decode(&msg, &packet2); 01058 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01059 01060 memset(&packet2, 0, sizeof(packet2)); 01061 mavlink_msg_scaled_pressure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 01062 mavlink_msg_scaled_pressure_decode(&msg, &packet2); 01063 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01064 01065 memset(&packet2, 0, sizeof(packet2)); 01066 mavlink_msg_to_send_buffer(buffer, &msg); 01067 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01068 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01069 } 01070 mavlink_msg_scaled_pressure_decode(last_msg, &packet2); 01071 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01072 01073 memset(&packet2, 0, sizeof(packet2)); 01074 mavlink_msg_scaled_pressure_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 01075 mavlink_msg_scaled_pressure_decode(last_msg, &packet2); 01076 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01077 } 01078 01079 static void mavlink_test_attitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01080 { 01081 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01082 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01083 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE >= 256) { 01084 return; 01085 } 01086 #endif 01087 mavlink_message_t msg; 01088 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01089 uint16_t i; 01090 mavlink_attitude_t packet_in = { 01091 963497464,45.0,73.0,101.0,129.0,157.0,185.0 01092 }; 01093 mavlink_attitude_t packet1, packet2; 01094 memset(&packet1, 0, sizeof(packet1)); 01095 packet1.time_boot_ms = packet_in.time_boot_ms; 01096 packet1.roll = packet_in.roll; 01097 packet1.pitch = packet_in.pitch; 01098 packet1.yaw = packet_in.yaw; 01099 packet1.rollspeed = packet_in.rollspeed; 01100 packet1.pitchspeed = packet_in.pitchspeed; 01101 packet1.yawspeed = packet_in.yawspeed; 01102 01103 01104 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01105 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01106 // cope with extensions 01107 memset(MAVLINK_MSG_ID_ATTITUDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_MIN_LEN); 01108 } 01109 #endif 01110 memset(&packet2, 0, sizeof(packet2)); 01111 mavlink_msg_attitude_encode(system_id, component_id, &msg, &packet1); 01112 mavlink_msg_attitude_decode(&msg, &packet2); 01113 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01114 01115 memset(&packet2, 0, sizeof(packet2)); 01116 mavlink_msg_attitude_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01117 mavlink_msg_attitude_decode(&msg, &packet2); 01118 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01119 01120 memset(&packet2, 0, sizeof(packet2)); 01121 mavlink_msg_attitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01122 mavlink_msg_attitude_decode(&msg, &packet2); 01123 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01124 01125 memset(&packet2, 0, sizeof(packet2)); 01126 mavlink_msg_to_send_buffer(buffer, &msg); 01127 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01128 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01129 } 01130 mavlink_msg_attitude_decode(last_msg, &packet2); 01131 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01132 01133 memset(&packet2, 0, sizeof(packet2)); 01134 mavlink_msg_attitude_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01135 mavlink_msg_attitude_decode(last_msg, &packet2); 01136 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01137 } 01138 01139 static void mavlink_test_attitude_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01140 { 01141 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01142 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01143 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_QUATERNION >= 256) { 01144 return; 01145 } 01146 #endif 01147 mavlink_message_t msg; 01148 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01149 uint16_t i; 01150 mavlink_attitude_quaternion_t packet_in = { 01151 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0 01152 }; 01153 mavlink_attitude_quaternion_t packet1, packet2; 01154 memset(&packet1, 0, sizeof(packet1)); 01155 packet1.time_boot_ms = packet_in.time_boot_ms; 01156 packet1.q1 = packet_in.q1; 01157 packet1.q2 = packet_in.q2; 01158 packet1.q3 = packet_in.q3; 01159 packet1.q4 = packet_in.q4; 01160 packet1.rollspeed = packet_in.rollspeed; 01161 packet1.pitchspeed = packet_in.pitchspeed; 01162 packet1.yawspeed = packet_in.yawspeed; 01163 01164 01165 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01166 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01167 // cope with extensions 01168 memset(MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_QUATERNION_MIN_LEN); 01169 } 01170 #endif 01171 memset(&packet2, 0, sizeof(packet2)); 01172 mavlink_msg_attitude_quaternion_encode(system_id, component_id, &msg, &packet1); 01173 mavlink_msg_attitude_quaternion_decode(&msg, &packet2); 01174 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01175 01176 memset(&packet2, 0, sizeof(packet2)); 01177 mavlink_msg_attitude_quaternion_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01178 mavlink_msg_attitude_quaternion_decode(&msg, &packet2); 01179 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01180 01181 memset(&packet2, 0, sizeof(packet2)); 01182 mavlink_msg_attitude_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01183 mavlink_msg_attitude_quaternion_decode(&msg, &packet2); 01184 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01185 01186 memset(&packet2, 0, sizeof(packet2)); 01187 mavlink_msg_to_send_buffer(buffer, &msg); 01188 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01189 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01190 } 01191 mavlink_msg_attitude_quaternion_decode(last_msg, &packet2); 01192 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01193 01194 memset(&packet2, 0, sizeof(packet2)); 01195 mavlink_msg_attitude_quaternion_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed ); 01196 mavlink_msg_attitude_quaternion_decode(last_msg, &packet2); 01197 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01198 } 01199 01200 static void mavlink_test_local_position_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01201 { 01202 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01203 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01204 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED >= 256) { 01205 return; 01206 } 01207 #endif 01208 mavlink_message_t msg; 01209 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01210 uint16_t i; 01211 mavlink_local_position_ned_t packet_in = { 01212 963497464,45.0,73.0,101.0,129.0,157.0,185.0 01213 }; 01214 mavlink_local_position_ned_t packet1, packet2; 01215 memset(&packet1, 0, sizeof(packet1)); 01216 packet1.time_boot_ms = packet_in.time_boot_ms; 01217 packet1.x = packet_in.x; 01218 packet1.y = packet_in.y; 01219 packet1.z = packet_in.z; 01220 packet1.vx = packet_in.vx; 01221 packet1.vy = packet_in.vy; 01222 packet1.vz = packet_in.vz; 01223 01224 01225 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01226 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01227 // cope with extensions 01228 memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_MIN_LEN); 01229 } 01230 #endif 01231 memset(&packet2, 0, sizeof(packet2)); 01232 mavlink_msg_local_position_ned_encode(system_id, component_id, &msg, &packet1); 01233 mavlink_msg_local_position_ned_decode(&msg, &packet2); 01234 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01235 01236 memset(&packet2, 0, sizeof(packet2)); 01237 mavlink_msg_local_position_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); 01238 mavlink_msg_local_position_ned_decode(&msg, &packet2); 01239 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01240 01241 memset(&packet2, 0, sizeof(packet2)); 01242 mavlink_msg_local_position_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); 01243 mavlink_msg_local_position_ned_decode(&msg, &packet2); 01244 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01245 01246 memset(&packet2, 0, sizeof(packet2)); 01247 mavlink_msg_to_send_buffer(buffer, &msg); 01248 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01249 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01250 } 01251 mavlink_msg_local_position_ned_decode(last_msg, &packet2); 01252 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01253 01254 memset(&packet2, 0, sizeof(packet2)); 01255 mavlink_msg_local_position_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz ); 01256 mavlink_msg_local_position_ned_decode(last_msg, &packet2); 01257 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01258 } 01259 01260 static void mavlink_test_global_position_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01261 { 01262 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01263 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01264 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT >= 256) { 01265 return; 01266 } 01267 #endif 01268 mavlink_message_t msg; 01269 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01270 uint16_t i; 01271 mavlink_global_position_int_t packet_in = { 01272 963497464,963497672,963497880,963498088,963498296,18275,18379,18483,18587 01273 }; 01274 mavlink_global_position_int_t packet1, packet2; 01275 memset(&packet1, 0, sizeof(packet1)); 01276 packet1.time_boot_ms = packet_in.time_boot_ms; 01277 packet1.lat = packet_in.lat; 01278 packet1.lon = packet_in.lon; 01279 packet1.alt = packet_in.alt; 01280 packet1.relative_alt = packet_in.relative_alt; 01281 packet1.vx = packet_in.vx; 01282 packet1.vy = packet_in.vy; 01283 packet1.vz = packet_in.vz; 01284 packet1.hdg = packet_in.hdg; 01285 01286 01287 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01288 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01289 // cope with extensions 01290 memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_MIN_LEN); 01291 } 01292 #endif 01293 memset(&packet2, 0, sizeof(packet2)); 01294 mavlink_msg_global_position_int_encode(system_id, component_id, &msg, &packet1); 01295 mavlink_msg_global_position_int_decode(&msg, &packet2); 01296 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01297 01298 memset(&packet2, 0, sizeof(packet2)); 01299 mavlink_msg_global_position_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); 01300 mavlink_msg_global_position_int_decode(&msg, &packet2); 01301 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01302 01303 memset(&packet2, 0, sizeof(packet2)); 01304 mavlink_msg_global_position_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); 01305 mavlink_msg_global_position_int_decode(&msg, &packet2); 01306 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01307 01308 memset(&packet2, 0, sizeof(packet2)); 01309 mavlink_msg_to_send_buffer(buffer, &msg); 01310 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01311 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01312 } 01313 mavlink_msg_global_position_int_decode(last_msg, &packet2); 01314 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01315 01316 memset(&packet2, 0, sizeof(packet2)); 01317 mavlink_msg_global_position_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.hdg ); 01318 mavlink_msg_global_position_int_decode(last_msg, &packet2); 01319 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01320 } 01321 01322 static void mavlink_test_rc_channels_scaled(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01323 { 01324 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01325 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01326 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_SCALED >= 256) { 01327 return; 01328 } 01329 #endif 01330 mavlink_message_t msg; 01331 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01332 uint16_t i; 01333 mavlink_rc_channels_scaled_t packet_in = { 01334 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65,132 01335 }; 01336 mavlink_rc_channels_scaled_t packet1, packet2; 01337 memset(&packet1, 0, sizeof(packet1)); 01338 packet1.time_boot_ms = packet_in.time_boot_ms; 01339 packet1.chan1_scaled = packet_in.chan1_scaled; 01340 packet1.chan2_scaled = packet_in.chan2_scaled; 01341 packet1.chan3_scaled = packet_in.chan3_scaled; 01342 packet1.chan4_scaled = packet_in.chan4_scaled; 01343 packet1.chan5_scaled = packet_in.chan5_scaled; 01344 packet1.chan6_scaled = packet_in.chan6_scaled; 01345 packet1.chan7_scaled = packet_in.chan7_scaled; 01346 packet1.chan8_scaled = packet_in.chan8_scaled; 01347 packet1.port = packet_in.port; 01348 packet1.rssi = packet_in.rssi; 01349 01350 01351 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01352 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01353 // cope with extensions 01354 memset(MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_SCALED_MIN_LEN); 01355 } 01356 #endif 01357 memset(&packet2, 0, sizeof(packet2)); 01358 mavlink_msg_rc_channels_scaled_encode(system_id, component_id, &msg, &packet1); 01359 mavlink_msg_rc_channels_scaled_decode(&msg, &packet2); 01360 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01361 01362 memset(&packet2, 0, sizeof(packet2)); 01363 mavlink_msg_rc_channels_scaled_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi ); 01364 mavlink_msg_rc_channels_scaled_decode(&msg, &packet2); 01365 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01366 01367 memset(&packet2, 0, sizeof(packet2)); 01368 mavlink_msg_rc_channels_scaled_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi ); 01369 mavlink_msg_rc_channels_scaled_decode(&msg, &packet2); 01370 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01371 01372 memset(&packet2, 0, sizeof(packet2)); 01373 mavlink_msg_to_send_buffer(buffer, &msg); 01374 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01375 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01376 } 01377 mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2); 01378 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01379 01380 memset(&packet2, 0, sizeof(packet2)); 01381 mavlink_msg_rc_channels_scaled_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_scaled , packet1.chan2_scaled , packet1.chan3_scaled , packet1.chan4_scaled , packet1.chan5_scaled , packet1.chan6_scaled , packet1.chan7_scaled , packet1.chan8_scaled , packet1.rssi ); 01382 mavlink_msg_rc_channels_scaled_decode(last_msg, &packet2); 01383 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01384 } 01385 01386 static void mavlink_test_rc_channels_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01387 { 01388 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01389 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01390 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_RAW >= 256) { 01391 return; 01392 } 01393 #endif 01394 mavlink_message_t msg; 01395 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01396 uint16_t i; 01397 mavlink_rc_channels_raw_t packet_in = { 01398 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65,132 01399 }; 01400 mavlink_rc_channels_raw_t packet1, packet2; 01401 memset(&packet1, 0, sizeof(packet1)); 01402 packet1.time_boot_ms = packet_in.time_boot_ms; 01403 packet1.chan1_raw = packet_in.chan1_raw; 01404 packet1.chan2_raw = packet_in.chan2_raw; 01405 packet1.chan3_raw = packet_in.chan3_raw; 01406 packet1.chan4_raw = packet_in.chan4_raw; 01407 packet1.chan5_raw = packet_in.chan5_raw; 01408 packet1.chan6_raw = packet_in.chan6_raw; 01409 packet1.chan7_raw = packet_in.chan7_raw; 01410 packet1.chan8_raw = packet_in.chan8_raw; 01411 packet1.port = packet_in.port; 01412 packet1.rssi = packet_in.rssi; 01413 01414 01415 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01416 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01417 // cope with extensions 01418 memset(MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_RAW_MIN_LEN); 01419 } 01420 #endif 01421 memset(&packet2, 0, sizeof(packet2)); 01422 mavlink_msg_rc_channels_raw_encode(system_id, component_id, &msg, &packet1); 01423 mavlink_msg_rc_channels_raw_decode(&msg, &packet2); 01424 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01425 01426 memset(&packet2, 0, sizeof(packet2)); 01427 mavlink_msg_rc_channels_raw_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi ); 01428 mavlink_msg_rc_channels_raw_decode(&msg, &packet2); 01429 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01430 01431 memset(&packet2, 0, sizeof(packet2)); 01432 mavlink_msg_rc_channels_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi ); 01433 mavlink_msg_rc_channels_raw_decode(&msg, &packet2); 01434 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01435 01436 memset(&packet2, 0, sizeof(packet2)); 01437 mavlink_msg_to_send_buffer(buffer, &msg); 01438 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01439 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01440 } 01441 mavlink_msg_rc_channels_raw_decode(last_msg, &packet2); 01442 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01443 01444 memset(&packet2, 0, sizeof(packet2)); 01445 mavlink_msg_rc_channels_raw_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.port , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.rssi ); 01446 mavlink_msg_rc_channels_raw_decode(last_msg, &packet2); 01447 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01448 } 01449 01450 static void mavlink_test_servo_output_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01451 { 01452 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01453 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01454 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERVO_OUTPUT_RAW >= 256) { 01455 return; 01456 } 01457 #endif 01458 mavlink_message_t msg; 01459 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01460 uint16_t i; 01461 mavlink_servo_output_raw_t packet_in = { 01462 963497464,17443,17547,17651,17755,17859,17963,18067,18171,65 01463 }; 01464 mavlink_servo_output_raw_t packet1, packet2; 01465 memset(&packet1, 0, sizeof(packet1)); 01466 packet1.time_usec = packet_in.time_usec; 01467 packet1.servo1_raw = packet_in.servo1_raw; 01468 packet1.servo2_raw = packet_in.servo2_raw; 01469 packet1.servo3_raw = packet_in.servo3_raw; 01470 packet1.servo4_raw = packet_in.servo4_raw; 01471 packet1.servo5_raw = packet_in.servo5_raw; 01472 packet1.servo6_raw = packet_in.servo6_raw; 01473 packet1.servo7_raw = packet_in.servo7_raw; 01474 packet1.servo8_raw = packet_in.servo8_raw; 01475 packet1.port = packet_in.port; 01476 01477 01478 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01479 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01480 // cope with extensions 01481 memset(MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERVO_OUTPUT_RAW_MIN_LEN); 01482 } 01483 #endif 01484 memset(&packet2, 0, sizeof(packet2)); 01485 mavlink_msg_servo_output_raw_encode(system_id, component_id, &msg, &packet1); 01486 mavlink_msg_servo_output_raw_decode(&msg, &packet2); 01487 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01488 01489 memset(&packet2, 0, sizeof(packet2)); 01490 mavlink_msg_servo_output_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw ); 01491 mavlink_msg_servo_output_raw_decode(&msg, &packet2); 01492 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01493 01494 memset(&packet2, 0, sizeof(packet2)); 01495 mavlink_msg_servo_output_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw ); 01496 mavlink_msg_servo_output_raw_decode(&msg, &packet2); 01497 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01498 01499 memset(&packet2, 0, sizeof(packet2)); 01500 mavlink_msg_to_send_buffer(buffer, &msg); 01501 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01502 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01503 } 01504 mavlink_msg_servo_output_raw_decode(last_msg, &packet2); 01505 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01506 01507 memset(&packet2, 0, sizeof(packet2)); 01508 mavlink_msg_servo_output_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.port , packet1.servo1_raw , packet1.servo2_raw , packet1.servo3_raw , packet1.servo4_raw , packet1.servo5_raw , packet1.servo6_raw , packet1.servo7_raw , packet1.servo8_raw ); 01509 mavlink_msg_servo_output_raw_decode(last_msg, &packet2); 01510 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01511 } 01512 01513 static void mavlink_test_mission_request_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01514 { 01515 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01516 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01517 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST >= 256) { 01518 return; 01519 } 01520 #endif 01521 mavlink_message_t msg; 01522 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01523 uint16_t i; 01524 mavlink_mission_request_partial_list_t packet_in = { 01525 17235,17339,17,84 01526 }; 01527 mavlink_mission_request_partial_list_t packet1, packet2; 01528 memset(&packet1, 0, sizeof(packet1)); 01529 packet1.start_index = packet_in.start_index; 01530 packet1.end_index = packet_in.end_index; 01531 packet1.target_system = packet_in.target_system; 01532 packet1.target_component = packet_in.target_component; 01533 01534 01535 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01536 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01537 // cope with extensions 01538 memset(MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_PARTIAL_LIST_MIN_LEN); 01539 } 01540 #endif 01541 memset(&packet2, 0, sizeof(packet2)); 01542 mavlink_msg_mission_request_partial_list_encode(system_id, component_id, &msg, &packet1); 01543 mavlink_msg_mission_request_partial_list_decode(&msg, &packet2); 01544 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01545 01546 memset(&packet2, 0, sizeof(packet2)); 01547 mavlink_msg_mission_request_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01548 mavlink_msg_mission_request_partial_list_decode(&msg, &packet2); 01549 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01550 01551 memset(&packet2, 0, sizeof(packet2)); 01552 mavlink_msg_mission_request_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01553 mavlink_msg_mission_request_partial_list_decode(&msg, &packet2); 01554 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01555 01556 memset(&packet2, 0, sizeof(packet2)); 01557 mavlink_msg_to_send_buffer(buffer, &msg); 01558 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01559 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01560 } 01561 mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2); 01562 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01563 01564 memset(&packet2, 0, sizeof(packet2)); 01565 mavlink_msg_mission_request_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01566 mavlink_msg_mission_request_partial_list_decode(last_msg, &packet2); 01567 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01568 } 01569 01570 static void mavlink_test_mission_write_partial_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01571 { 01572 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01573 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01574 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST >= 256) { 01575 return; 01576 } 01577 #endif 01578 mavlink_message_t msg; 01579 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01580 uint16_t i; 01581 mavlink_mission_write_partial_list_t packet_in = { 01582 17235,17339,17,84 01583 }; 01584 mavlink_mission_write_partial_list_t packet1, packet2; 01585 memset(&packet1, 0, sizeof(packet1)); 01586 packet1.start_index = packet_in.start_index; 01587 packet1.end_index = packet_in.end_index; 01588 packet1.target_system = packet_in.target_system; 01589 packet1.target_component = packet_in.target_component; 01590 01591 01592 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01593 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01594 // cope with extensions 01595 memset(MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_WRITE_PARTIAL_LIST_MIN_LEN); 01596 } 01597 #endif 01598 memset(&packet2, 0, sizeof(packet2)); 01599 mavlink_msg_mission_write_partial_list_encode(system_id, component_id, &msg, &packet1); 01600 mavlink_msg_mission_write_partial_list_decode(&msg, &packet2); 01601 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01602 01603 memset(&packet2, 0, sizeof(packet2)); 01604 mavlink_msg_mission_write_partial_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01605 mavlink_msg_mission_write_partial_list_decode(&msg, &packet2); 01606 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01607 01608 memset(&packet2, 0, sizeof(packet2)); 01609 mavlink_msg_mission_write_partial_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01610 mavlink_msg_mission_write_partial_list_decode(&msg, &packet2); 01611 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01612 01613 memset(&packet2, 0, sizeof(packet2)); 01614 mavlink_msg_to_send_buffer(buffer, &msg); 01615 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01616 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01617 } 01618 mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2); 01619 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01620 01621 memset(&packet2, 0, sizeof(packet2)); 01622 mavlink_msg_mission_write_partial_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start_index , packet1.end_index ); 01623 mavlink_msg_mission_write_partial_list_decode(last_msg, &packet2); 01624 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01625 } 01626 01627 static void mavlink_test_mission_item(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01628 { 01629 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01630 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01631 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM >= 256) { 01632 return; 01633 } 01634 #endif 01635 mavlink_message_t msg; 01636 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01637 uint16_t i; 01638 mavlink_mission_item_t packet_in = { 01639 17.0,45.0,73.0,101.0,129.0,157.0,185.0,18691,18795,101,168,235,46,113 01640 }; 01641 mavlink_mission_item_t packet1, packet2; 01642 memset(&packet1, 0, sizeof(packet1)); 01643 packet1.param1 = packet_in.param1; 01644 packet1.param2 = packet_in.param2; 01645 packet1.param3 = packet_in.param3; 01646 packet1.param4 = packet_in.param4; 01647 packet1.x = packet_in.x; 01648 packet1.y = packet_in.y; 01649 packet1.z = packet_in.z; 01650 packet1.seq = packet_in.seq; 01651 packet1.command = packet_in.command; 01652 packet1.target_system = packet_in.target_system; 01653 packet1.target_component = packet_in.target_component; 01654 packet1.frame = packet_in.frame; 01655 packet1.current = packet_in.current; 01656 packet1.autocontinue = packet_in.autocontinue; 01657 01658 01659 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01660 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01661 // cope with extensions 01662 memset(MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_MIN_LEN); 01663 } 01664 #endif 01665 memset(&packet2, 0, sizeof(packet2)); 01666 mavlink_msg_mission_item_encode(system_id, component_id, &msg, &packet1); 01667 mavlink_msg_mission_item_decode(&msg, &packet2); 01668 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01669 01670 memset(&packet2, 0, sizeof(packet2)); 01671 mavlink_msg_mission_item_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 01672 mavlink_msg_mission_item_decode(&msg, &packet2); 01673 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01674 01675 memset(&packet2, 0, sizeof(packet2)); 01676 mavlink_msg_mission_item_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 01677 mavlink_msg_mission_item_decode(&msg, &packet2); 01678 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01679 01680 memset(&packet2, 0, sizeof(packet2)); 01681 mavlink_msg_to_send_buffer(buffer, &msg); 01682 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01683 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01684 } 01685 mavlink_msg_mission_item_decode(last_msg, &packet2); 01686 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01687 01688 memset(&packet2, 0, sizeof(packet2)); 01689 mavlink_msg_mission_item_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 01690 mavlink_msg_mission_item_decode(last_msg, &packet2); 01691 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01692 } 01693 01694 static void mavlink_test_mission_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01695 { 01696 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01697 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01698 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST >= 256) { 01699 return; 01700 } 01701 #endif 01702 mavlink_message_t msg; 01703 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01704 uint16_t i; 01705 mavlink_mission_request_t packet_in = { 01706 17235,139,206 01707 }; 01708 mavlink_mission_request_t packet1, packet2; 01709 memset(&packet1, 0, sizeof(packet1)); 01710 packet1.seq = packet_in.seq; 01711 packet1.target_system = packet_in.target_system; 01712 packet1.target_component = packet_in.target_component; 01713 01714 01715 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01716 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01717 // cope with extensions 01718 memset(MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_MIN_LEN); 01719 } 01720 #endif 01721 memset(&packet2, 0, sizeof(packet2)); 01722 mavlink_msg_mission_request_encode(system_id, component_id, &msg, &packet1); 01723 mavlink_msg_mission_request_decode(&msg, &packet2); 01724 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01725 01726 memset(&packet2, 0, sizeof(packet2)); 01727 mavlink_msg_mission_request_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 01728 mavlink_msg_mission_request_decode(&msg, &packet2); 01729 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01730 01731 memset(&packet2, 0, sizeof(packet2)); 01732 mavlink_msg_mission_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 01733 mavlink_msg_mission_request_decode(&msg, &packet2); 01734 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01735 01736 memset(&packet2, 0, sizeof(packet2)); 01737 mavlink_msg_to_send_buffer(buffer, &msg); 01738 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01739 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01740 } 01741 mavlink_msg_mission_request_decode(last_msg, &packet2); 01742 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01743 01744 memset(&packet2, 0, sizeof(packet2)); 01745 mavlink_msg_mission_request_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq ); 01746 mavlink_msg_mission_request_decode(last_msg, &packet2); 01747 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01748 } 01749 01750 static void mavlink_test_mission_set_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01751 { 01752 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01753 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01754 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_SET_CURRENT >= 256) { 01755 return; 01756 } 01757 #endif 01758 mavlink_message_t msg; 01759 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01760 uint16_t i; 01761 mavlink_mission_set_current_t packet_in = { 01762 17235,139,206 01763 }; 01764 mavlink_mission_set_current_t packet1, packet2; 01765 memset(&packet1, 0, sizeof(packet1)); 01766 packet1.seq = packet_in.seq; 01767 packet1.target_system = packet_in.target_system; 01768 packet1.target_component = packet_in.target_component; 01769 01770 01771 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01772 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01773 // cope with extensions 01774 memset(MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_SET_CURRENT_MIN_LEN); 01775 } 01776 #endif 01777 memset(&packet2, 0, sizeof(packet2)); 01778 mavlink_msg_mission_set_current_encode(system_id, component_id, &msg, &packet1); 01779 mavlink_msg_mission_set_current_decode(&msg, &packet2); 01780 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01781 01782 memset(&packet2, 0, sizeof(packet2)); 01783 mavlink_msg_mission_set_current_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 01784 mavlink_msg_mission_set_current_decode(&msg, &packet2); 01785 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01786 01787 memset(&packet2, 0, sizeof(packet2)); 01788 mavlink_msg_mission_set_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 01789 mavlink_msg_mission_set_current_decode(&msg, &packet2); 01790 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01791 01792 memset(&packet2, 0, sizeof(packet2)); 01793 mavlink_msg_to_send_buffer(buffer, &msg); 01794 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01795 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01796 } 01797 mavlink_msg_mission_set_current_decode(last_msg, &packet2); 01798 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01799 01800 memset(&packet2, 0, sizeof(packet2)); 01801 mavlink_msg_mission_set_current_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq ); 01802 mavlink_msg_mission_set_current_decode(last_msg, &packet2); 01803 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01804 } 01805 01806 static void mavlink_test_mission_current(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01807 { 01808 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01809 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01810 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CURRENT >= 256) { 01811 return; 01812 } 01813 #endif 01814 mavlink_message_t msg; 01815 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01816 uint16_t i; 01817 mavlink_mission_current_t packet_in = { 01818 17235 01819 }; 01820 mavlink_mission_current_t packet1, packet2; 01821 memset(&packet1, 0, sizeof(packet1)); 01822 packet1.seq = packet_in.seq; 01823 01824 01825 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01826 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01827 // cope with extensions 01828 memset(MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CURRENT_MIN_LEN); 01829 } 01830 #endif 01831 memset(&packet2, 0, sizeof(packet2)); 01832 mavlink_msg_mission_current_encode(system_id, component_id, &msg, &packet1); 01833 mavlink_msg_mission_current_decode(&msg, &packet2); 01834 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01835 01836 memset(&packet2, 0, sizeof(packet2)); 01837 mavlink_msg_mission_current_pack(system_id, component_id, &msg , packet1.seq ); 01838 mavlink_msg_mission_current_decode(&msg, &packet2); 01839 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01840 01841 memset(&packet2, 0, sizeof(packet2)); 01842 mavlink_msg_mission_current_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq ); 01843 mavlink_msg_mission_current_decode(&msg, &packet2); 01844 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01845 01846 memset(&packet2, 0, sizeof(packet2)); 01847 mavlink_msg_to_send_buffer(buffer, &msg); 01848 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01849 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01850 } 01851 mavlink_msg_mission_current_decode(last_msg, &packet2); 01852 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01853 01854 memset(&packet2, 0, sizeof(packet2)); 01855 mavlink_msg_mission_current_send(MAVLINK_COMM_1 , packet1.seq ); 01856 mavlink_msg_mission_current_decode(last_msg, &packet2); 01857 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01858 } 01859 01860 static void mavlink_test_mission_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01861 { 01862 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01863 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01864 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_LIST >= 256) { 01865 return; 01866 } 01867 #endif 01868 mavlink_message_t msg; 01869 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01870 uint16_t i; 01871 mavlink_mission_request_list_t packet_in = { 01872 5,72 01873 }; 01874 mavlink_mission_request_list_t packet1, packet2; 01875 memset(&packet1, 0, sizeof(packet1)); 01876 packet1.target_system = packet_in.target_system; 01877 packet1.target_component = packet_in.target_component; 01878 01879 01880 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01881 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01882 // cope with extensions 01883 memset(MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_LIST_MIN_LEN); 01884 } 01885 #endif 01886 memset(&packet2, 0, sizeof(packet2)); 01887 mavlink_msg_mission_request_list_encode(system_id, component_id, &msg, &packet1); 01888 mavlink_msg_mission_request_list_decode(&msg, &packet2); 01889 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01890 01891 memset(&packet2, 0, sizeof(packet2)); 01892 mavlink_msg_mission_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); 01893 mavlink_msg_mission_request_list_decode(&msg, &packet2); 01894 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01895 01896 memset(&packet2, 0, sizeof(packet2)); 01897 mavlink_msg_mission_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); 01898 mavlink_msg_mission_request_list_decode(&msg, &packet2); 01899 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01900 01901 memset(&packet2, 0, sizeof(packet2)); 01902 mavlink_msg_to_send_buffer(buffer, &msg); 01903 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01904 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01905 } 01906 mavlink_msg_mission_request_list_decode(last_msg, &packet2); 01907 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01908 01909 memset(&packet2, 0, sizeof(packet2)); 01910 mavlink_msg_mission_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); 01911 mavlink_msg_mission_request_list_decode(last_msg, &packet2); 01912 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01913 } 01914 01915 static void mavlink_test_mission_count(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01916 { 01917 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01918 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01919 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_COUNT >= 256) { 01920 return; 01921 } 01922 #endif 01923 mavlink_message_t msg; 01924 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01925 uint16_t i; 01926 mavlink_mission_count_t packet_in = { 01927 17235,139,206 01928 }; 01929 mavlink_mission_count_t packet1, packet2; 01930 memset(&packet1, 0, sizeof(packet1)); 01931 packet1.count = packet_in.count; 01932 packet1.target_system = packet_in.target_system; 01933 packet1.target_component = packet_in.target_component; 01934 01935 01936 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01937 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01938 // cope with extensions 01939 memset(MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_COUNT_MIN_LEN); 01940 } 01941 #endif 01942 memset(&packet2, 0, sizeof(packet2)); 01943 mavlink_msg_mission_count_encode(system_id, component_id, &msg, &packet1); 01944 mavlink_msg_mission_count_decode(&msg, &packet2); 01945 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01946 01947 memset(&packet2, 0, sizeof(packet2)); 01948 mavlink_msg_mission_count_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.count ); 01949 mavlink_msg_mission_count_decode(&msg, &packet2); 01950 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01951 01952 memset(&packet2, 0, sizeof(packet2)); 01953 mavlink_msg_mission_count_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.count ); 01954 mavlink_msg_mission_count_decode(&msg, &packet2); 01955 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01956 01957 memset(&packet2, 0, sizeof(packet2)); 01958 mavlink_msg_to_send_buffer(buffer, &msg); 01959 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 01960 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 01961 } 01962 mavlink_msg_mission_count_decode(last_msg, &packet2); 01963 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01964 01965 memset(&packet2, 0, sizeof(packet2)); 01966 mavlink_msg_mission_count_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.count ); 01967 mavlink_msg_mission_count_decode(last_msg, &packet2); 01968 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 01969 } 01970 01971 static void mavlink_test_mission_clear_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 01972 { 01973 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01974 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 01975 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_CLEAR_ALL >= 256) { 01976 return; 01977 } 01978 #endif 01979 mavlink_message_t msg; 01980 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 01981 uint16_t i; 01982 mavlink_mission_clear_all_t packet_in = { 01983 5,72 01984 }; 01985 mavlink_mission_clear_all_t packet1, packet2; 01986 memset(&packet1, 0, sizeof(packet1)); 01987 packet1.target_system = packet_in.target_system; 01988 packet1.target_component = packet_in.target_component; 01989 01990 01991 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 01992 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 01993 // cope with extensions 01994 memset(MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_CLEAR_ALL_MIN_LEN); 01995 } 01996 #endif 01997 memset(&packet2, 0, sizeof(packet2)); 01998 mavlink_msg_mission_clear_all_encode(system_id, component_id, &msg, &packet1); 01999 mavlink_msg_mission_clear_all_decode(&msg, &packet2); 02000 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02001 02002 memset(&packet2, 0, sizeof(packet2)); 02003 mavlink_msg_mission_clear_all_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); 02004 mavlink_msg_mission_clear_all_decode(&msg, &packet2); 02005 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02006 02007 memset(&packet2, 0, sizeof(packet2)); 02008 mavlink_msg_mission_clear_all_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); 02009 mavlink_msg_mission_clear_all_decode(&msg, &packet2); 02010 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02011 02012 memset(&packet2, 0, sizeof(packet2)); 02013 mavlink_msg_to_send_buffer(buffer, &msg); 02014 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02015 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02016 } 02017 mavlink_msg_mission_clear_all_decode(last_msg, &packet2); 02018 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02019 02020 memset(&packet2, 0, sizeof(packet2)); 02021 mavlink_msg_mission_clear_all_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); 02022 mavlink_msg_mission_clear_all_decode(last_msg, &packet2); 02023 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02024 } 02025 02026 static void mavlink_test_mission_item_reached(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02027 { 02028 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02029 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02030 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM_REACHED >= 256) { 02031 return; 02032 } 02033 #endif 02034 mavlink_message_t msg; 02035 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02036 uint16_t i; 02037 mavlink_mission_item_reached_t packet_in = { 02038 17235 02039 }; 02040 mavlink_mission_item_reached_t packet1, packet2; 02041 memset(&packet1, 0, sizeof(packet1)); 02042 packet1.seq = packet_in.seq; 02043 02044 02045 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02046 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02047 // cope with extensions 02048 memset(MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_REACHED_MIN_LEN); 02049 } 02050 #endif 02051 memset(&packet2, 0, sizeof(packet2)); 02052 mavlink_msg_mission_item_reached_encode(system_id, component_id, &msg, &packet1); 02053 mavlink_msg_mission_item_reached_decode(&msg, &packet2); 02054 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02055 02056 memset(&packet2, 0, sizeof(packet2)); 02057 mavlink_msg_mission_item_reached_pack(system_id, component_id, &msg , packet1.seq ); 02058 mavlink_msg_mission_item_reached_decode(&msg, &packet2); 02059 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02060 02061 memset(&packet2, 0, sizeof(packet2)); 02062 mavlink_msg_mission_item_reached_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seq ); 02063 mavlink_msg_mission_item_reached_decode(&msg, &packet2); 02064 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02065 02066 memset(&packet2, 0, sizeof(packet2)); 02067 mavlink_msg_to_send_buffer(buffer, &msg); 02068 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02069 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02070 } 02071 mavlink_msg_mission_item_reached_decode(last_msg, &packet2); 02072 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02073 02074 memset(&packet2, 0, sizeof(packet2)); 02075 mavlink_msg_mission_item_reached_send(MAVLINK_COMM_1 , packet1.seq ); 02076 mavlink_msg_mission_item_reached_decode(last_msg, &packet2); 02077 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02078 } 02079 02080 static void mavlink_test_mission_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02081 { 02082 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02083 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02084 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ACK >= 256) { 02085 return; 02086 } 02087 #endif 02088 mavlink_message_t msg; 02089 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02090 uint16_t i; 02091 mavlink_mission_ack_t packet_in = { 02092 5,72,139 02093 }; 02094 mavlink_mission_ack_t packet1, packet2; 02095 memset(&packet1, 0, sizeof(packet1)); 02096 packet1.target_system = packet_in.target_system; 02097 packet1.target_component = packet_in.target_component; 02098 packet1.type = packet_in.type; 02099 02100 02101 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02102 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02103 // cope with extensions 02104 memset(MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ACK_MIN_LEN); 02105 } 02106 #endif 02107 memset(&packet2, 0, sizeof(packet2)); 02108 mavlink_msg_mission_ack_encode(system_id, component_id, &msg, &packet1); 02109 mavlink_msg_mission_ack_decode(&msg, &packet2); 02110 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02111 02112 memset(&packet2, 0, sizeof(packet2)); 02113 mavlink_msg_mission_ack_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.type ); 02114 mavlink_msg_mission_ack_decode(&msg, &packet2); 02115 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02116 02117 memset(&packet2, 0, sizeof(packet2)); 02118 mavlink_msg_mission_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.type ); 02119 mavlink_msg_mission_ack_decode(&msg, &packet2); 02120 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02121 02122 memset(&packet2, 0, sizeof(packet2)); 02123 mavlink_msg_to_send_buffer(buffer, &msg); 02124 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02125 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02126 } 02127 mavlink_msg_mission_ack_decode(last_msg, &packet2); 02128 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02129 02130 memset(&packet2, 0, sizeof(packet2)); 02131 mavlink_msg_mission_ack_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.type ); 02132 mavlink_msg_mission_ack_decode(last_msg, &packet2); 02133 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02134 } 02135 02136 static void mavlink_test_set_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02137 { 02138 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02139 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02140 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN >= 256) { 02141 return; 02142 } 02143 #endif 02144 mavlink_message_t msg; 02145 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02146 uint16_t i; 02147 mavlink_set_gps_global_origin_t packet_in = { 02148 963497464,963497672,963497880,41 02149 }; 02150 mavlink_set_gps_global_origin_t packet1, packet2; 02151 memset(&packet1, 0, sizeof(packet1)); 02152 packet1.latitude = packet_in.latitude; 02153 packet1.longitude = packet_in.longitude; 02154 packet1.altitude = packet_in.altitude; 02155 packet1.target_system = packet_in.target_system; 02156 02157 02158 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02159 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02160 // cope with extensions 02161 memset(MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN_MIN_LEN); 02162 } 02163 #endif 02164 memset(&packet2, 0, sizeof(packet2)); 02165 mavlink_msg_set_gps_global_origin_encode(system_id, component_id, &msg, &packet1); 02166 mavlink_msg_set_gps_global_origin_decode(&msg, &packet2); 02167 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02168 02169 memset(&packet2, 0, sizeof(packet2)); 02170 mavlink_msg_set_gps_global_origin_pack(system_id, component_id, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude ); 02171 mavlink_msg_set_gps_global_origin_decode(&msg, &packet2); 02172 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02173 02174 memset(&packet2, 0, sizeof(packet2)); 02175 mavlink_msg_set_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude ); 02176 mavlink_msg_set_gps_global_origin_decode(&msg, &packet2); 02177 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02178 02179 memset(&packet2, 0, sizeof(packet2)); 02180 mavlink_msg_to_send_buffer(buffer, &msg); 02181 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02182 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02183 } 02184 mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2); 02185 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02186 02187 memset(&packet2, 0, sizeof(packet2)); 02188 mavlink_msg_set_gps_global_origin_send(MAVLINK_COMM_1 , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude ); 02189 mavlink_msg_set_gps_global_origin_decode(last_msg, &packet2); 02190 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02191 } 02192 02193 static void mavlink_test_gps_global_origin(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02194 { 02195 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02196 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02197 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN >= 256) { 02198 return; 02199 } 02200 #endif 02201 mavlink_message_t msg; 02202 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02203 uint16_t i; 02204 mavlink_gps_global_origin_t packet_in = { 02205 963497464,963497672,963497880 02206 }; 02207 mavlink_gps_global_origin_t packet1, packet2; 02208 memset(&packet1, 0, sizeof(packet1)); 02209 packet1.latitude = packet_in.latitude; 02210 packet1.longitude = packet_in.longitude; 02211 packet1.altitude = packet_in.altitude; 02212 02213 02214 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02215 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02216 // cope with extensions 02217 memset(MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_GLOBAL_ORIGIN_MIN_LEN); 02218 } 02219 #endif 02220 memset(&packet2, 0, sizeof(packet2)); 02221 mavlink_msg_gps_global_origin_encode(system_id, component_id, &msg, &packet1); 02222 mavlink_msg_gps_global_origin_decode(&msg, &packet2); 02223 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02224 02225 memset(&packet2, 0, sizeof(packet2)); 02226 mavlink_msg_gps_global_origin_pack(system_id, component_id, &msg , packet1.latitude , packet1.longitude , packet1.altitude ); 02227 mavlink_msg_gps_global_origin_decode(&msg, &packet2); 02228 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02229 02230 memset(&packet2, 0, sizeof(packet2)); 02231 mavlink_msg_gps_global_origin_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.latitude , packet1.longitude , packet1.altitude ); 02232 mavlink_msg_gps_global_origin_decode(&msg, &packet2); 02233 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02234 02235 memset(&packet2, 0, sizeof(packet2)); 02236 mavlink_msg_to_send_buffer(buffer, &msg); 02237 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02238 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02239 } 02240 mavlink_msg_gps_global_origin_decode(last_msg, &packet2); 02241 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02242 02243 memset(&packet2, 0, sizeof(packet2)); 02244 mavlink_msg_gps_global_origin_send(MAVLINK_COMM_1 , packet1.latitude , packet1.longitude , packet1.altitude ); 02245 mavlink_msg_gps_global_origin_decode(last_msg, &packet2); 02246 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02247 } 02248 02249 static void mavlink_test_param_map_rc(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02250 { 02251 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02252 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02253 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_PARAM_MAP_RC >= 256) { 02254 return; 02255 } 02256 #endif 02257 mavlink_message_t msg; 02258 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02259 uint16_t i; 02260 mavlink_param_map_rc_t packet_in = { 02261 17.0,45.0,73.0,101.0,18067,187,254,"UVWXYZABCDEFGHI",113 02262 }; 02263 mavlink_param_map_rc_t packet1, packet2; 02264 memset(&packet1, 0, sizeof(packet1)); 02265 packet1.param_value0 = packet_in.param_value0; 02266 packet1.scale = packet_in.scale; 02267 packet1.param_value_min = packet_in.param_value_min; 02268 packet1.param_value_max = packet_in.param_value_max; 02269 packet1.param_index = packet_in.param_index; 02270 packet1.target_system = packet_in.target_system; 02271 packet1.target_component = packet_in.target_component; 02272 packet1.parameter_rc_channel_index = packet_in.parameter_rc_channel_index; 02273 02274 mav_array_memcpy(packet1.param_id, packet_in.param_id, sizeof(char)*16); 02275 02276 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02277 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02278 // cope with extensions 02279 memset(MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_PARAM_MAP_RC_MIN_LEN); 02280 } 02281 #endif 02282 memset(&packet2, 0, sizeof(packet2)); 02283 mavlink_msg_param_map_rc_encode(system_id, component_id, &msg, &packet1); 02284 mavlink_msg_param_map_rc_decode(&msg, &packet2); 02285 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02286 02287 memset(&packet2, 0, sizeof(packet2)); 02288 mavlink_msg_param_map_rc_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max ); 02289 mavlink_msg_param_map_rc_decode(&msg, &packet2); 02290 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02291 02292 memset(&packet2, 0, sizeof(packet2)); 02293 mavlink_msg_param_map_rc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max ); 02294 mavlink_msg_param_map_rc_decode(&msg, &packet2); 02295 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02296 02297 memset(&packet2, 0, sizeof(packet2)); 02298 mavlink_msg_to_send_buffer(buffer, &msg); 02299 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02300 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02301 } 02302 mavlink_msg_param_map_rc_decode(last_msg, &packet2); 02303 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02304 02305 memset(&packet2, 0, sizeof(packet2)); 02306 mavlink_msg_param_map_rc_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.param_id , packet1.param_index , packet1.parameter_rc_channel_index , packet1.param_value0 , packet1.scale , packet1.param_value_min , packet1.param_value_max ); 02307 mavlink_msg_param_map_rc_decode(last_msg, &packet2); 02308 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02309 } 02310 02311 static void mavlink_test_mission_request_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02312 { 02313 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02314 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02315 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_REQUEST_INT >= 256) { 02316 return; 02317 } 02318 #endif 02319 mavlink_message_t msg; 02320 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02321 uint16_t i; 02322 mavlink_mission_request_int_t packet_in = { 02323 17235,139,206 02324 }; 02325 mavlink_mission_request_int_t packet1, packet2; 02326 memset(&packet1, 0, sizeof(packet1)); 02327 packet1.seq = packet_in.seq; 02328 packet1.target_system = packet_in.target_system; 02329 packet1.target_component = packet_in.target_component; 02330 02331 02332 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02333 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02334 // cope with extensions 02335 memset(MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_REQUEST_INT_MIN_LEN); 02336 } 02337 #endif 02338 memset(&packet2, 0, sizeof(packet2)); 02339 mavlink_msg_mission_request_int_encode(system_id, component_id, &msg, &packet1); 02340 mavlink_msg_mission_request_int_decode(&msg, &packet2); 02341 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02342 02343 memset(&packet2, 0, sizeof(packet2)); 02344 mavlink_msg_mission_request_int_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 02345 mavlink_msg_mission_request_int_decode(&msg, &packet2); 02346 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02347 02348 memset(&packet2, 0, sizeof(packet2)); 02349 mavlink_msg_mission_request_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq ); 02350 mavlink_msg_mission_request_int_decode(&msg, &packet2); 02351 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02352 02353 memset(&packet2, 0, sizeof(packet2)); 02354 mavlink_msg_to_send_buffer(buffer, &msg); 02355 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02356 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02357 } 02358 mavlink_msg_mission_request_int_decode(last_msg, &packet2); 02359 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02360 02361 memset(&packet2, 0, sizeof(packet2)); 02362 mavlink_msg_mission_request_int_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq ); 02363 mavlink_msg_mission_request_int_decode(last_msg, &packet2); 02364 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02365 } 02366 02367 static void mavlink_test_safety_set_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02368 { 02369 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02370 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02371 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA >= 256) { 02372 return; 02373 } 02374 #endif 02375 mavlink_message_t msg; 02376 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02377 uint16_t i; 02378 mavlink_safety_set_allowed_area_t packet_in = { 02379 17.0,45.0,73.0,101.0,129.0,157.0,77,144,211 02380 }; 02381 mavlink_safety_set_allowed_area_t packet1, packet2; 02382 memset(&packet1, 0, sizeof(packet1)); 02383 packet1.p1x = packet_in.p1x; 02384 packet1.p1y = packet_in.p1y; 02385 packet1.p1z = packet_in.p1z; 02386 packet1.p2x = packet_in.p2x; 02387 packet1.p2y = packet_in.p2y; 02388 packet1.p2z = packet_in.p2z; 02389 packet1.target_system = packet_in.target_system; 02390 packet1.target_component = packet_in.target_component; 02391 packet1.frame = packet_in.frame; 02392 02393 02394 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02395 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02396 // cope with extensions 02397 memset(MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SAFETY_SET_ALLOWED_AREA_MIN_LEN); 02398 } 02399 #endif 02400 memset(&packet2, 0, sizeof(packet2)); 02401 mavlink_msg_safety_set_allowed_area_encode(system_id, component_id, &msg, &packet1); 02402 mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2); 02403 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02404 02405 memset(&packet2, 0, sizeof(packet2)); 02406 mavlink_msg_safety_set_allowed_area_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02407 mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2); 02408 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02409 02410 memset(&packet2, 0, sizeof(packet2)); 02411 mavlink_msg_safety_set_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02412 mavlink_msg_safety_set_allowed_area_decode(&msg, &packet2); 02413 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02414 02415 memset(&packet2, 0, sizeof(packet2)); 02416 mavlink_msg_to_send_buffer(buffer, &msg); 02417 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02418 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02419 } 02420 mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2); 02421 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02422 02423 memset(&packet2, 0, sizeof(packet2)); 02424 mavlink_msg_safety_set_allowed_area_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02425 mavlink_msg_safety_set_allowed_area_decode(last_msg, &packet2); 02426 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02427 } 02428 02429 static void mavlink_test_safety_allowed_area(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02430 { 02431 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02432 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02433 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA >= 256) { 02434 return; 02435 } 02436 #endif 02437 mavlink_message_t msg; 02438 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02439 uint16_t i; 02440 mavlink_safety_allowed_area_t packet_in = { 02441 17.0,45.0,73.0,101.0,129.0,157.0,77 02442 }; 02443 mavlink_safety_allowed_area_t packet1, packet2; 02444 memset(&packet1, 0, sizeof(packet1)); 02445 packet1.p1x = packet_in.p1x; 02446 packet1.p1y = packet_in.p1y; 02447 packet1.p1z = packet_in.p1z; 02448 packet1.p2x = packet_in.p2x; 02449 packet1.p2y = packet_in.p2y; 02450 packet1.p2z = packet_in.p2z; 02451 packet1.frame = packet_in.frame; 02452 02453 02454 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02455 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02456 // cope with extensions 02457 memset(MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SAFETY_ALLOWED_AREA_MIN_LEN); 02458 } 02459 #endif 02460 memset(&packet2, 0, sizeof(packet2)); 02461 mavlink_msg_safety_allowed_area_encode(system_id, component_id, &msg, &packet1); 02462 mavlink_msg_safety_allowed_area_decode(&msg, &packet2); 02463 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02464 02465 memset(&packet2, 0, sizeof(packet2)); 02466 mavlink_msg_safety_allowed_area_pack(system_id, component_id, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02467 mavlink_msg_safety_allowed_area_decode(&msg, &packet2); 02468 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02469 02470 memset(&packet2, 0, sizeof(packet2)); 02471 mavlink_msg_safety_allowed_area_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02472 mavlink_msg_safety_allowed_area_decode(&msg, &packet2); 02473 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02474 02475 memset(&packet2, 0, sizeof(packet2)); 02476 mavlink_msg_to_send_buffer(buffer, &msg); 02477 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02478 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02479 } 02480 mavlink_msg_safety_allowed_area_decode(last_msg, &packet2); 02481 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02482 02483 memset(&packet2, 0, sizeof(packet2)); 02484 mavlink_msg_safety_allowed_area_send(MAVLINK_COMM_1 , packet1.frame , packet1.p1x , packet1.p1y , packet1.p1z , packet1.p2x , packet1.p2y , packet1.p2z ); 02485 mavlink_msg_safety_allowed_area_decode(last_msg, &packet2); 02486 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02487 } 02488 02489 static void mavlink_test_attitude_quaternion_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02490 { 02491 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02492 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02493 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV >= 256) { 02494 return; 02495 } 02496 #endif 02497 mavlink_message_t msg; 02498 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02499 uint16_t i; 02500 mavlink_attitude_quaternion_cov_t packet_in = { 02501 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0,{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0 } 02502 }; 02503 mavlink_attitude_quaternion_cov_t packet1, packet2; 02504 memset(&packet1, 0, sizeof(packet1)); 02505 packet1.time_usec = packet_in.time_usec; 02506 packet1.rollspeed = packet_in.rollspeed; 02507 packet1.pitchspeed = packet_in.pitchspeed; 02508 packet1.yawspeed = packet_in.yawspeed; 02509 02510 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 02511 mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*9); 02512 02513 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02514 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02515 // cope with extensions 02516 memset(MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_QUATERNION_COV_MIN_LEN); 02517 } 02518 #endif 02519 memset(&packet2, 0, sizeof(packet2)); 02520 mavlink_msg_attitude_quaternion_cov_encode(system_id, component_id, &msg, &packet1); 02521 mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2); 02522 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02523 02524 memset(&packet2, 0, sizeof(packet2)); 02525 mavlink_msg_attitude_quaternion_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance ); 02526 mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2); 02527 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02528 02529 memset(&packet2, 0, sizeof(packet2)); 02530 mavlink_msg_attitude_quaternion_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance ); 02531 mavlink_msg_attitude_quaternion_cov_decode(&msg, &packet2); 02532 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02533 02534 memset(&packet2, 0, sizeof(packet2)); 02535 mavlink_msg_to_send_buffer(buffer, &msg); 02536 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02537 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02538 } 02539 mavlink_msg_attitude_quaternion_cov_decode(last_msg, &packet2); 02540 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02541 02542 memset(&packet2, 0, sizeof(packet2)); 02543 mavlink_msg_attitude_quaternion_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.q , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.covariance ); 02544 mavlink_msg_attitude_quaternion_cov_decode(last_msg, &packet2); 02545 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02546 } 02547 02548 static void mavlink_test_nav_controller_output(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02549 { 02550 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02551 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02552 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT >= 256) { 02553 return; 02554 } 02555 #endif 02556 mavlink_message_t msg; 02557 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02558 uint16_t i; 02559 mavlink_nav_controller_output_t packet_in = { 02560 17.0,45.0,73.0,101.0,129.0,18275,18379,18483 02561 }; 02562 mavlink_nav_controller_output_t packet1, packet2; 02563 memset(&packet1, 0, sizeof(packet1)); 02564 packet1.nav_roll = packet_in.nav_roll; 02565 packet1.nav_pitch = packet_in.nav_pitch; 02566 packet1.alt_error = packet_in.alt_error; 02567 packet1.aspd_error = packet_in.aspd_error; 02568 packet1.xtrack_error = packet_in.xtrack_error; 02569 packet1.nav_bearing = packet_in.nav_bearing; 02570 packet1.target_bearing = packet_in.target_bearing; 02571 packet1.wp_dist = packet_in.wp_dist; 02572 02573 02574 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02575 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02576 // cope with extensions 02577 memset(MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT_MIN_LEN); 02578 } 02579 #endif 02580 memset(&packet2, 0, sizeof(packet2)); 02581 mavlink_msg_nav_controller_output_encode(system_id, component_id, &msg, &packet1); 02582 mavlink_msg_nav_controller_output_decode(&msg, &packet2); 02583 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02584 02585 memset(&packet2, 0, sizeof(packet2)); 02586 mavlink_msg_nav_controller_output_pack(system_id, component_id, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error ); 02587 mavlink_msg_nav_controller_output_decode(&msg, &packet2); 02588 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02589 02590 memset(&packet2, 0, sizeof(packet2)); 02591 mavlink_msg_nav_controller_output_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error ); 02592 mavlink_msg_nav_controller_output_decode(&msg, &packet2); 02593 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02594 02595 memset(&packet2, 0, sizeof(packet2)); 02596 mavlink_msg_to_send_buffer(buffer, &msg); 02597 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02598 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02599 } 02600 mavlink_msg_nav_controller_output_decode(last_msg, &packet2); 02601 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02602 02603 memset(&packet2, 0, sizeof(packet2)); 02604 mavlink_msg_nav_controller_output_send(MAVLINK_COMM_1 , packet1.nav_roll , packet1.nav_pitch , packet1.nav_bearing , packet1.target_bearing , packet1.wp_dist , packet1.alt_error , packet1.aspd_error , packet1.xtrack_error ); 02605 mavlink_msg_nav_controller_output_decode(last_msg, &packet2); 02606 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02607 } 02608 02609 static void mavlink_test_global_position_int_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02610 { 02611 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02612 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02613 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV >= 256) { 02614 return; 02615 } 02616 #endif 02617 mavlink_message_t msg; 02618 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02619 uint16_t i; 02620 mavlink_global_position_int_cov_t packet_in = { 02621 93372036854775807ULL,963497880,963498088,963498296,963498504,185.0,213.0,241.0,{ 269.0, 270.0, 271.0, 272.0, 273.0, 274.0, 275.0, 276.0, 277.0, 278.0, 279.0, 280.0, 281.0, 282.0, 283.0, 284.0, 285.0, 286.0, 287.0, 288.0, 289.0, 290.0, 291.0, 292.0, 293.0, 294.0, 295.0, 296.0, 297.0, 298.0, 299.0, 300.0, 301.0, 302.0, 303.0, 304.0 },33 02622 }; 02623 mavlink_global_position_int_cov_t packet1, packet2; 02624 memset(&packet1, 0, sizeof(packet1)); 02625 packet1.time_usec = packet_in.time_usec; 02626 packet1.lat = packet_in.lat; 02627 packet1.lon = packet_in.lon; 02628 packet1.alt = packet_in.alt; 02629 packet1.relative_alt = packet_in.relative_alt; 02630 packet1.vx = packet_in.vx; 02631 packet1.vy = packet_in.vy; 02632 packet1.vz = packet_in.vz; 02633 packet1.estimator_type = packet_in.estimator_type; 02634 02635 mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*36); 02636 02637 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02638 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02639 // cope with extensions 02640 memset(MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_POSITION_INT_COV_MIN_LEN); 02641 } 02642 #endif 02643 memset(&packet2, 0, sizeof(packet2)); 02644 mavlink_msg_global_position_int_cov_encode(system_id, component_id, &msg, &packet1); 02645 mavlink_msg_global_position_int_cov_decode(&msg, &packet2); 02646 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02647 02648 memset(&packet2, 0, sizeof(packet2)); 02649 mavlink_msg_global_position_int_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance ); 02650 mavlink_msg_global_position_int_cov_decode(&msg, &packet2); 02651 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02652 02653 memset(&packet2, 0, sizeof(packet2)); 02654 mavlink_msg_global_position_int_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance ); 02655 mavlink_msg_global_position_int_cov_decode(&msg, &packet2); 02656 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02657 02658 memset(&packet2, 0, sizeof(packet2)); 02659 mavlink_msg_to_send_buffer(buffer, &msg); 02660 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02661 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02662 } 02663 mavlink_msg_global_position_int_cov_decode(last_msg, &packet2); 02664 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02665 02666 memset(&packet2, 0, sizeof(packet2)); 02667 mavlink_msg_global_position_int_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.estimator_type , packet1.lat , packet1.lon , packet1.alt , packet1.relative_alt , packet1.vx , packet1.vy , packet1.vz , packet1.covariance ); 02668 mavlink_msg_global_position_int_cov_decode(last_msg, &packet2); 02669 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02670 } 02671 02672 static void mavlink_test_local_position_ned_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02673 { 02674 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02675 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02676 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV >= 256) { 02677 return; 02678 } 02679 #endif 02680 mavlink_message_t msg; 02681 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02682 uint16_t i; 02683 mavlink_local_position_ned_cov_t packet_in = { 02684 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,{ 325.0, 326.0, 327.0, 328.0, 329.0, 330.0, 331.0, 332.0, 333.0, 334.0, 335.0, 336.0, 337.0, 338.0, 339.0, 340.0, 341.0, 342.0, 343.0, 344.0, 345.0, 346.0, 347.0, 348.0, 349.0, 350.0, 351.0, 352.0, 353.0, 354.0, 355.0, 356.0, 357.0, 358.0, 359.0, 360.0, 361.0, 362.0, 363.0, 364.0, 365.0, 366.0, 367.0, 368.0, 369.0 },165 02685 }; 02686 mavlink_local_position_ned_cov_t packet1, packet2; 02687 memset(&packet1, 0, sizeof(packet1)); 02688 packet1.time_usec = packet_in.time_usec; 02689 packet1.x = packet_in.x; 02690 packet1.y = packet_in.y; 02691 packet1.z = packet_in.z; 02692 packet1.vx = packet_in.vx; 02693 packet1.vy = packet_in.vy; 02694 packet1.vz = packet_in.vz; 02695 packet1.ax = packet_in.ax; 02696 packet1.ay = packet_in.ay; 02697 packet1.az = packet_in.az; 02698 packet1.estimator_type = packet_in.estimator_type; 02699 02700 mav_array_memcpy(packet1.covariance, packet_in.covariance, sizeof(float)*45); 02701 02702 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02703 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02704 // cope with extensions 02705 memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_COV_MIN_LEN); 02706 } 02707 #endif 02708 memset(&packet2, 0, sizeof(packet2)); 02709 mavlink_msg_local_position_ned_cov_encode(system_id, component_id, &msg, &packet1); 02710 mavlink_msg_local_position_ned_cov_decode(&msg, &packet2); 02711 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02712 02713 memset(&packet2, 0, sizeof(packet2)); 02714 mavlink_msg_local_position_ned_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance ); 02715 mavlink_msg_local_position_ned_cov_decode(&msg, &packet2); 02716 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02717 02718 memset(&packet2, 0, sizeof(packet2)); 02719 mavlink_msg_local_position_ned_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance ); 02720 mavlink_msg_local_position_ned_cov_decode(&msg, &packet2); 02721 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02722 02723 memset(&packet2, 0, sizeof(packet2)); 02724 mavlink_msg_to_send_buffer(buffer, &msg); 02725 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02726 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02727 } 02728 mavlink_msg_local_position_ned_cov_decode(last_msg, &packet2); 02729 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02730 02731 memset(&packet2, 0, sizeof(packet2)); 02732 mavlink_msg_local_position_ned_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.estimator_type , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.ax , packet1.ay , packet1.az , packet1.covariance ); 02733 mavlink_msg_local_position_ned_cov_decode(last_msg, &packet2); 02734 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02735 } 02736 02737 static void mavlink_test_rc_channels(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02738 { 02739 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02740 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02741 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS >= 256) { 02742 return; 02743 } 02744 #endif 02745 mavlink_message_t msg; 02746 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02747 uint16_t i; 02748 mavlink_rc_channels_t packet_in = { 02749 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,18899,19003,19107,19211,125,192 02750 }; 02751 mavlink_rc_channels_t packet1, packet2; 02752 memset(&packet1, 0, sizeof(packet1)); 02753 packet1.time_boot_ms = packet_in.time_boot_ms; 02754 packet1.chan1_raw = packet_in.chan1_raw; 02755 packet1.chan2_raw = packet_in.chan2_raw; 02756 packet1.chan3_raw = packet_in.chan3_raw; 02757 packet1.chan4_raw = packet_in.chan4_raw; 02758 packet1.chan5_raw = packet_in.chan5_raw; 02759 packet1.chan6_raw = packet_in.chan6_raw; 02760 packet1.chan7_raw = packet_in.chan7_raw; 02761 packet1.chan8_raw = packet_in.chan8_raw; 02762 packet1.chan9_raw = packet_in.chan9_raw; 02763 packet1.chan10_raw = packet_in.chan10_raw; 02764 packet1.chan11_raw = packet_in.chan11_raw; 02765 packet1.chan12_raw = packet_in.chan12_raw; 02766 packet1.chan13_raw = packet_in.chan13_raw; 02767 packet1.chan14_raw = packet_in.chan14_raw; 02768 packet1.chan15_raw = packet_in.chan15_raw; 02769 packet1.chan16_raw = packet_in.chan16_raw; 02770 packet1.chan17_raw = packet_in.chan17_raw; 02771 packet1.chan18_raw = packet_in.chan18_raw; 02772 packet1.chancount = packet_in.chancount; 02773 packet1.rssi = packet_in.rssi; 02774 02775 02776 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02777 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02778 // cope with extensions 02779 memset(MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_MIN_LEN); 02780 } 02781 #endif 02782 memset(&packet2, 0, sizeof(packet2)); 02783 mavlink_msg_rc_channels_encode(system_id, component_id, &msg, &packet1); 02784 mavlink_msg_rc_channels_decode(&msg, &packet2); 02785 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02786 02787 memset(&packet2, 0, sizeof(packet2)); 02788 mavlink_msg_rc_channels_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi ); 02789 mavlink_msg_rc_channels_decode(&msg, &packet2); 02790 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02791 02792 memset(&packet2, 0, sizeof(packet2)); 02793 mavlink_msg_rc_channels_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi ); 02794 mavlink_msg_rc_channels_decode(&msg, &packet2); 02795 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02796 02797 memset(&packet2, 0, sizeof(packet2)); 02798 mavlink_msg_to_send_buffer(buffer, &msg); 02799 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02800 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02801 } 02802 mavlink_msg_rc_channels_decode(last_msg, &packet2); 02803 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02804 02805 memset(&packet2, 0, sizeof(packet2)); 02806 mavlink_msg_rc_channels_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.chancount , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.chan13_raw , packet1.chan14_raw , packet1.chan15_raw , packet1.chan16_raw , packet1.chan17_raw , packet1.chan18_raw , packet1.rssi ); 02807 mavlink_msg_rc_channels_decode(last_msg, &packet2); 02808 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02809 } 02810 02811 static void mavlink_test_request_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02812 { 02813 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02814 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02815 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_REQUEST_DATA_STREAM >= 256) { 02816 return; 02817 } 02818 #endif 02819 mavlink_message_t msg; 02820 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02821 uint16_t i; 02822 mavlink_request_data_stream_t packet_in = { 02823 17235,139,206,17,84 02824 }; 02825 mavlink_request_data_stream_t packet1, packet2; 02826 memset(&packet1, 0, sizeof(packet1)); 02827 packet1.req_message_rate = packet_in.req_message_rate; 02828 packet1.target_system = packet_in.target_system; 02829 packet1.target_component = packet_in.target_component; 02830 packet1.req_stream_id = packet_in.req_stream_id; 02831 packet1.start_stop = packet_in.start_stop; 02832 02833 02834 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02835 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02836 // cope with extensions 02837 memset(MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_REQUEST_DATA_STREAM_MIN_LEN); 02838 } 02839 #endif 02840 memset(&packet2, 0, sizeof(packet2)); 02841 mavlink_msg_request_data_stream_encode(system_id, component_id, &msg, &packet1); 02842 mavlink_msg_request_data_stream_decode(&msg, &packet2); 02843 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02844 02845 memset(&packet2, 0, sizeof(packet2)); 02846 mavlink_msg_request_data_stream_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop ); 02847 mavlink_msg_request_data_stream_decode(&msg, &packet2); 02848 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02849 02850 memset(&packet2, 0, sizeof(packet2)); 02851 mavlink_msg_request_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop ); 02852 mavlink_msg_request_data_stream_decode(&msg, &packet2); 02853 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02854 02855 memset(&packet2, 0, sizeof(packet2)); 02856 mavlink_msg_to_send_buffer(buffer, &msg); 02857 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02858 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02859 } 02860 mavlink_msg_request_data_stream_decode(last_msg, &packet2); 02861 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02862 02863 memset(&packet2, 0, sizeof(packet2)); 02864 mavlink_msg_request_data_stream_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.req_stream_id , packet1.req_message_rate , packet1.start_stop ); 02865 mavlink_msg_request_data_stream_decode(last_msg, &packet2); 02866 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02867 } 02868 02869 static void mavlink_test_data_stream(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02870 { 02871 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02872 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02873 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA_STREAM >= 256) { 02874 return; 02875 } 02876 #endif 02877 mavlink_message_t msg; 02878 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02879 uint16_t i; 02880 mavlink_data_stream_t packet_in = { 02881 17235,139,206 02882 }; 02883 mavlink_data_stream_t packet1, packet2; 02884 memset(&packet1, 0, sizeof(packet1)); 02885 packet1.message_rate = packet_in.message_rate; 02886 packet1.stream_id = packet_in.stream_id; 02887 packet1.on_off = packet_in.on_off; 02888 02889 02890 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02891 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02892 // cope with extensions 02893 memset(MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA_STREAM_MIN_LEN); 02894 } 02895 #endif 02896 memset(&packet2, 0, sizeof(packet2)); 02897 mavlink_msg_data_stream_encode(system_id, component_id, &msg, &packet1); 02898 mavlink_msg_data_stream_decode(&msg, &packet2); 02899 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02900 02901 memset(&packet2, 0, sizeof(packet2)); 02902 mavlink_msg_data_stream_pack(system_id, component_id, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off ); 02903 mavlink_msg_data_stream_decode(&msg, &packet2); 02904 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02905 02906 memset(&packet2, 0, sizeof(packet2)); 02907 mavlink_msg_data_stream_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.stream_id , packet1.message_rate , packet1.on_off ); 02908 mavlink_msg_data_stream_decode(&msg, &packet2); 02909 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02910 02911 memset(&packet2, 0, sizeof(packet2)); 02912 mavlink_msg_to_send_buffer(buffer, &msg); 02913 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02914 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02915 } 02916 mavlink_msg_data_stream_decode(last_msg, &packet2); 02917 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02918 02919 memset(&packet2, 0, sizeof(packet2)); 02920 mavlink_msg_data_stream_send(MAVLINK_COMM_1 , packet1.stream_id , packet1.message_rate , packet1.on_off ); 02921 mavlink_msg_data_stream_decode(last_msg, &packet2); 02922 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02923 } 02924 02925 static void mavlink_test_manual_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02926 { 02927 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02928 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02929 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MANUAL_CONTROL >= 256) { 02930 return; 02931 } 02932 #endif 02933 mavlink_message_t msg; 02934 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02935 uint16_t i; 02936 mavlink_manual_control_t packet_in = { 02937 17235,17339,17443,17547,17651,163 02938 }; 02939 mavlink_manual_control_t packet1, packet2; 02940 memset(&packet1, 0, sizeof(packet1)); 02941 packet1.x = packet_in.x; 02942 packet1.y = packet_in.y; 02943 packet1.z = packet_in.z; 02944 packet1.r = packet_in.r; 02945 packet1.buttons = packet_in.buttons; 02946 packet1.target = packet_in.target; 02947 02948 02949 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02950 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 02951 // cope with extensions 02952 memset(MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MANUAL_CONTROL_MIN_LEN); 02953 } 02954 #endif 02955 memset(&packet2, 0, sizeof(packet2)); 02956 mavlink_msg_manual_control_encode(system_id, component_id, &msg, &packet1); 02957 mavlink_msg_manual_control_decode(&msg, &packet2); 02958 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02959 02960 memset(&packet2, 0, sizeof(packet2)); 02961 mavlink_msg_manual_control_pack(system_id, component_id, &msg , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons ); 02962 mavlink_msg_manual_control_decode(&msg, &packet2); 02963 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02964 02965 memset(&packet2, 0, sizeof(packet2)); 02966 mavlink_msg_manual_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons ); 02967 mavlink_msg_manual_control_decode(&msg, &packet2); 02968 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02969 02970 memset(&packet2, 0, sizeof(packet2)); 02971 mavlink_msg_to_send_buffer(buffer, &msg); 02972 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 02973 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 02974 } 02975 mavlink_msg_manual_control_decode(last_msg, &packet2); 02976 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02977 02978 memset(&packet2, 0, sizeof(packet2)); 02979 mavlink_msg_manual_control_send(MAVLINK_COMM_1 , packet1.target , packet1.x , packet1.y , packet1.z , packet1.r , packet1.buttons ); 02980 mavlink_msg_manual_control_decode(last_msg, &packet2); 02981 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 02982 } 02983 02984 static void mavlink_test_rc_channels_override(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 02985 { 02986 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 02987 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 02988 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE >= 256) { 02989 return; 02990 } 02991 #endif 02992 mavlink_message_t msg; 02993 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 02994 uint16_t i; 02995 mavlink_rc_channels_override_t packet_in = { 02996 17235,17339,17443,17547,17651,17755,17859,17963,53,120 02997 }; 02998 mavlink_rc_channels_override_t packet1, packet2; 02999 memset(&packet1, 0, sizeof(packet1)); 03000 packet1.chan1_raw = packet_in.chan1_raw; 03001 packet1.chan2_raw = packet_in.chan2_raw; 03002 packet1.chan3_raw = packet_in.chan3_raw; 03003 packet1.chan4_raw = packet_in.chan4_raw; 03004 packet1.chan5_raw = packet_in.chan5_raw; 03005 packet1.chan6_raw = packet_in.chan6_raw; 03006 packet1.chan7_raw = packet_in.chan7_raw; 03007 packet1.chan8_raw = packet_in.chan8_raw; 03008 packet1.target_system = packet_in.target_system; 03009 packet1.target_component = packet_in.target_component; 03010 03011 03012 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03013 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03014 // cope with extensions 03015 memset(MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE_MIN_LEN); 03016 } 03017 #endif 03018 memset(&packet2, 0, sizeof(packet2)); 03019 mavlink_msg_rc_channels_override_encode(system_id, component_id, &msg, &packet1); 03020 mavlink_msg_rc_channels_override_decode(&msg, &packet2); 03021 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03022 03023 memset(&packet2, 0, sizeof(packet2)); 03024 mavlink_msg_rc_channels_override_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw ); 03025 mavlink_msg_rc_channels_override_decode(&msg, &packet2); 03026 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03027 03028 memset(&packet2, 0, sizeof(packet2)); 03029 mavlink_msg_rc_channels_override_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw ); 03030 mavlink_msg_rc_channels_override_decode(&msg, &packet2); 03031 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03032 03033 memset(&packet2, 0, sizeof(packet2)); 03034 mavlink_msg_to_send_buffer(buffer, &msg); 03035 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03036 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03037 } 03038 mavlink_msg_rc_channels_override_decode(last_msg, &packet2); 03039 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03040 03041 memset(&packet2, 0, sizeof(packet2)); 03042 mavlink_msg_rc_channels_override_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw ); 03043 mavlink_msg_rc_channels_override_decode(last_msg, &packet2); 03044 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03045 } 03046 03047 static void mavlink_test_mission_item_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03048 { 03049 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03050 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03051 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MISSION_ITEM_INT >= 256) { 03052 return; 03053 } 03054 #endif 03055 mavlink_message_t msg; 03056 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03057 uint16_t i; 03058 mavlink_mission_item_int_t packet_in = { 03059 17.0,45.0,73.0,101.0,963498296,963498504,185.0,18691,18795,101,168,235,46,113 03060 }; 03061 mavlink_mission_item_int_t packet1, packet2; 03062 memset(&packet1, 0, sizeof(packet1)); 03063 packet1.param1 = packet_in.param1; 03064 packet1.param2 = packet_in.param2; 03065 packet1.param3 = packet_in.param3; 03066 packet1.param4 = packet_in.param4; 03067 packet1.x = packet_in.x; 03068 packet1.y = packet_in.y; 03069 packet1.z = packet_in.z; 03070 packet1.seq = packet_in.seq; 03071 packet1.command = packet_in.command; 03072 packet1.target_system = packet_in.target_system; 03073 packet1.target_component = packet_in.target_component; 03074 packet1.frame = packet_in.frame; 03075 packet1.current = packet_in.current; 03076 packet1.autocontinue = packet_in.autocontinue; 03077 03078 03079 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03080 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03081 // cope with extensions 03082 memset(MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MISSION_ITEM_INT_MIN_LEN); 03083 } 03084 #endif 03085 memset(&packet2, 0, sizeof(packet2)); 03086 mavlink_msg_mission_item_int_encode(system_id, component_id, &msg, &packet1); 03087 mavlink_msg_mission_item_int_decode(&msg, &packet2); 03088 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03089 03090 memset(&packet2, 0, sizeof(packet2)); 03091 mavlink_msg_mission_item_int_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03092 mavlink_msg_mission_item_int_decode(&msg, &packet2); 03093 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03094 03095 memset(&packet2, 0, sizeof(packet2)); 03096 mavlink_msg_mission_item_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03097 mavlink_msg_mission_item_int_decode(&msg, &packet2); 03098 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03099 03100 memset(&packet2, 0, sizeof(packet2)); 03101 mavlink_msg_to_send_buffer(buffer, &msg); 03102 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03103 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03104 } 03105 mavlink_msg_mission_item_int_decode(last_msg, &packet2); 03106 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03107 03108 memset(&packet2, 0, sizeof(packet2)); 03109 mavlink_msg_mission_item_int_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.seq , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03110 mavlink_msg_mission_item_int_decode(last_msg, &packet2); 03111 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03112 } 03113 03114 static void mavlink_test_vfr_hud(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03115 { 03116 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03117 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03118 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VFR_HUD >= 256) { 03119 return; 03120 } 03121 #endif 03122 mavlink_message_t msg; 03123 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03124 uint16_t i; 03125 mavlink_vfr_hud_t packet_in = { 03126 17.0,45.0,73.0,101.0,18067,18171 03127 }; 03128 mavlink_vfr_hud_t packet1, packet2; 03129 memset(&packet1, 0, sizeof(packet1)); 03130 packet1.airspeed = packet_in.airspeed; 03131 packet1.groundspeed = packet_in.groundspeed; 03132 packet1.alt = packet_in.alt; 03133 packet1.climb = packet_in.climb; 03134 packet1.heading = packet_in.heading; 03135 packet1.throttle = packet_in.throttle; 03136 03137 03138 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03139 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03140 // cope with extensions 03141 memset(MAVLINK_MSG_ID_VFR_HUD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VFR_HUD_MIN_LEN); 03142 } 03143 #endif 03144 memset(&packet2, 0, sizeof(packet2)); 03145 mavlink_msg_vfr_hud_encode(system_id, component_id, &msg, &packet1); 03146 mavlink_msg_vfr_hud_decode(&msg, &packet2); 03147 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03148 03149 memset(&packet2, 0, sizeof(packet2)); 03150 mavlink_msg_vfr_hud_pack(system_id, component_id, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb ); 03151 mavlink_msg_vfr_hud_decode(&msg, &packet2); 03152 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03153 03154 memset(&packet2, 0, sizeof(packet2)); 03155 mavlink_msg_vfr_hud_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb ); 03156 mavlink_msg_vfr_hud_decode(&msg, &packet2); 03157 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03158 03159 memset(&packet2, 0, sizeof(packet2)); 03160 mavlink_msg_to_send_buffer(buffer, &msg); 03161 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03162 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03163 } 03164 mavlink_msg_vfr_hud_decode(last_msg, &packet2); 03165 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03166 03167 memset(&packet2, 0, sizeof(packet2)); 03168 mavlink_msg_vfr_hud_send(MAVLINK_COMM_1 , packet1.airspeed , packet1.groundspeed , packet1.heading , packet1.throttle , packet1.alt , packet1.climb ); 03169 mavlink_msg_vfr_hud_decode(last_msg, &packet2); 03170 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03171 } 03172 03173 static void mavlink_test_command_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03174 { 03175 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03176 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03177 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_INT >= 256) { 03178 return; 03179 } 03180 #endif 03181 mavlink_message_t msg; 03182 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03183 uint16_t i; 03184 mavlink_command_int_t packet_in = { 03185 17.0,45.0,73.0,101.0,963498296,963498504,185.0,18691,223,34,101,168,235 03186 }; 03187 mavlink_command_int_t packet1, packet2; 03188 memset(&packet1, 0, sizeof(packet1)); 03189 packet1.param1 = packet_in.param1; 03190 packet1.param2 = packet_in.param2; 03191 packet1.param3 = packet_in.param3; 03192 packet1.param4 = packet_in.param4; 03193 packet1.x = packet_in.x; 03194 packet1.y = packet_in.y; 03195 packet1.z = packet_in.z; 03196 packet1.command = packet_in.command; 03197 packet1.target_system = packet_in.target_system; 03198 packet1.target_component = packet_in.target_component; 03199 packet1.frame = packet_in.frame; 03200 packet1.current = packet_in.current; 03201 packet1.autocontinue = packet_in.autocontinue; 03202 03203 03204 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03205 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03206 // cope with extensions 03207 memset(MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_INT_MIN_LEN); 03208 } 03209 #endif 03210 memset(&packet2, 0, sizeof(packet2)); 03211 mavlink_msg_command_int_encode(system_id, component_id, &msg, &packet1); 03212 mavlink_msg_command_int_decode(&msg, &packet2); 03213 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03214 03215 memset(&packet2, 0, sizeof(packet2)); 03216 mavlink_msg_command_int_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03217 mavlink_msg_command_int_decode(&msg, &packet2); 03218 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03219 03220 memset(&packet2, 0, sizeof(packet2)); 03221 mavlink_msg_command_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03222 mavlink_msg_command_int_decode(&msg, &packet2); 03223 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03224 03225 memset(&packet2, 0, sizeof(packet2)); 03226 mavlink_msg_to_send_buffer(buffer, &msg); 03227 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03228 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03229 } 03230 mavlink_msg_command_int_decode(last_msg, &packet2); 03231 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03232 03233 memset(&packet2, 0, sizeof(packet2)); 03234 mavlink_msg_command_int_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.frame , packet1.command , packet1.current , packet1.autocontinue , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.x , packet1.y , packet1.z ); 03235 mavlink_msg_command_int_decode(last_msg, &packet2); 03236 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03237 } 03238 03239 static void mavlink_test_command_long(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03240 { 03241 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03242 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03243 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_LONG >= 256) { 03244 return; 03245 } 03246 #endif 03247 mavlink_message_t msg; 03248 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03249 uint16_t i; 03250 mavlink_command_long_t packet_in = { 03251 17.0,45.0,73.0,101.0,129.0,157.0,185.0,18691,223,34,101 03252 }; 03253 mavlink_command_long_t packet1, packet2; 03254 memset(&packet1, 0, sizeof(packet1)); 03255 packet1.param1 = packet_in.param1; 03256 packet1.param2 = packet_in.param2; 03257 packet1.param3 = packet_in.param3; 03258 packet1.param4 = packet_in.param4; 03259 packet1.param5 = packet_in.param5; 03260 packet1.param6 = packet_in.param6; 03261 packet1.param7 = packet_in.param7; 03262 packet1.command = packet_in.command; 03263 packet1.target_system = packet_in.target_system; 03264 packet1.target_component = packet_in.target_component; 03265 packet1.confirmation = packet_in.confirmation; 03266 03267 03268 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03269 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03270 // cope with extensions 03271 memset(MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_LONG_MIN_LEN); 03272 } 03273 #endif 03274 memset(&packet2, 0, sizeof(packet2)); 03275 mavlink_msg_command_long_encode(system_id, component_id, &msg, &packet1); 03276 mavlink_msg_command_long_decode(&msg, &packet2); 03277 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03278 03279 memset(&packet2, 0, sizeof(packet2)); 03280 mavlink_msg_command_long_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 ); 03281 mavlink_msg_command_long_decode(&msg, &packet2); 03282 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03283 03284 memset(&packet2, 0, sizeof(packet2)); 03285 mavlink_msg_command_long_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 ); 03286 mavlink_msg_command_long_decode(&msg, &packet2); 03287 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03288 03289 memset(&packet2, 0, sizeof(packet2)); 03290 mavlink_msg_to_send_buffer(buffer, &msg); 03291 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03292 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03293 } 03294 mavlink_msg_command_long_decode(last_msg, &packet2); 03295 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03296 03297 memset(&packet2, 0, sizeof(packet2)); 03298 mavlink_msg_command_long_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.command , packet1.confirmation , packet1.param1 , packet1.param2 , packet1.param3 , packet1.param4 , packet1.param5 , packet1.param6 , packet1.param7 ); 03299 mavlink_msg_command_long_decode(last_msg, &packet2); 03300 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03301 } 03302 03303 static void mavlink_test_command_ack(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03304 { 03305 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03306 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03307 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COMMAND_ACK >= 256) { 03308 return; 03309 } 03310 #endif 03311 mavlink_message_t msg; 03312 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03313 uint16_t i; 03314 mavlink_command_ack_t packet_in = { 03315 17235,139 03316 }; 03317 mavlink_command_ack_t packet1, packet2; 03318 memset(&packet1, 0, sizeof(packet1)); 03319 packet1.command = packet_in.command; 03320 packet1.result = packet_in.result; 03321 03322 03323 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03324 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03325 // cope with extensions 03326 memset(MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COMMAND_ACK_MIN_LEN); 03327 } 03328 #endif 03329 memset(&packet2, 0, sizeof(packet2)); 03330 mavlink_msg_command_ack_encode(system_id, component_id, &msg, &packet1); 03331 mavlink_msg_command_ack_decode(&msg, &packet2); 03332 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03333 03334 memset(&packet2, 0, sizeof(packet2)); 03335 mavlink_msg_command_ack_pack(system_id, component_id, &msg , packet1.command , packet1.result ); 03336 mavlink_msg_command_ack_decode(&msg, &packet2); 03337 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03338 03339 memset(&packet2, 0, sizeof(packet2)); 03340 mavlink_msg_command_ack_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.command , packet1.result ); 03341 mavlink_msg_command_ack_decode(&msg, &packet2); 03342 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03343 03344 memset(&packet2, 0, sizeof(packet2)); 03345 mavlink_msg_to_send_buffer(buffer, &msg); 03346 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03347 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03348 } 03349 mavlink_msg_command_ack_decode(last_msg, &packet2); 03350 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03351 03352 memset(&packet2, 0, sizeof(packet2)); 03353 mavlink_msg_command_ack_send(MAVLINK_COMM_1 , packet1.command , packet1.result ); 03354 mavlink_msg_command_ack_decode(last_msg, &packet2); 03355 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03356 } 03357 03358 static void mavlink_test_manual_setpoint(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03359 { 03360 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03361 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03362 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MANUAL_SETPOINT >= 256) { 03363 return; 03364 } 03365 #endif 03366 mavlink_message_t msg; 03367 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03368 uint16_t i; 03369 mavlink_manual_setpoint_t packet_in = { 03370 963497464,45.0,73.0,101.0,129.0,65,132 03371 }; 03372 mavlink_manual_setpoint_t packet1, packet2; 03373 memset(&packet1, 0, sizeof(packet1)); 03374 packet1.time_boot_ms = packet_in.time_boot_ms; 03375 packet1.roll = packet_in.roll; 03376 packet1.pitch = packet_in.pitch; 03377 packet1.yaw = packet_in.yaw; 03378 packet1.thrust = packet_in.thrust; 03379 packet1.mode_switch = packet_in.mode_switch; 03380 packet1.manual_override_switch = packet_in.manual_override_switch; 03381 03382 03383 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03384 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03385 // cope with extensions 03386 memset(MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MANUAL_SETPOINT_MIN_LEN); 03387 } 03388 #endif 03389 memset(&packet2, 0, sizeof(packet2)); 03390 mavlink_msg_manual_setpoint_encode(system_id, component_id, &msg, &packet1); 03391 mavlink_msg_manual_setpoint_decode(&msg, &packet2); 03392 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03393 03394 memset(&packet2, 0, sizeof(packet2)); 03395 mavlink_msg_manual_setpoint_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch ); 03396 mavlink_msg_manual_setpoint_decode(&msg, &packet2); 03397 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03398 03399 memset(&packet2, 0, sizeof(packet2)); 03400 mavlink_msg_manual_setpoint_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch ); 03401 mavlink_msg_manual_setpoint_decode(&msg, &packet2); 03402 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03403 03404 memset(&packet2, 0, sizeof(packet2)); 03405 mavlink_msg_to_send_buffer(buffer, &msg); 03406 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03407 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03408 } 03409 mavlink_msg_manual_setpoint_decode(last_msg, &packet2); 03410 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03411 03412 memset(&packet2, 0, sizeof(packet2)); 03413 mavlink_msg_manual_setpoint_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.roll , packet1.pitch , packet1.yaw , packet1.thrust , packet1.mode_switch , packet1.manual_override_switch ); 03414 mavlink_msg_manual_setpoint_decode(last_msg, &packet2); 03415 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03416 } 03417 03418 static void mavlink_test_set_attitude_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03419 { 03420 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03421 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03422 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_ATTITUDE_TARGET >= 256) { 03423 return; 03424 } 03425 #endif 03426 mavlink_message_t msg; 03427 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03428 uint16_t i; 03429 mavlink_set_attitude_target_t packet_in = { 03430 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,241.0,113,180,247 03431 }; 03432 mavlink_set_attitude_target_t packet1, packet2; 03433 memset(&packet1, 0, sizeof(packet1)); 03434 packet1.time_boot_ms = packet_in.time_boot_ms; 03435 packet1.body_roll_rate = packet_in.body_roll_rate; 03436 packet1.body_pitch_rate = packet_in.body_pitch_rate; 03437 packet1.body_yaw_rate = packet_in.body_yaw_rate; 03438 packet1.thrust = packet_in.thrust; 03439 packet1.target_system = packet_in.target_system; 03440 packet1.target_component = packet_in.target_component; 03441 packet1.type_mask = packet_in.type_mask; 03442 03443 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 03444 03445 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03446 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03447 // cope with extensions 03448 memset(MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_ATTITUDE_TARGET_MIN_LEN); 03449 } 03450 #endif 03451 memset(&packet2, 0, sizeof(packet2)); 03452 mavlink_msg_set_attitude_target_encode(system_id, component_id, &msg, &packet1); 03453 mavlink_msg_set_attitude_target_decode(&msg, &packet2); 03454 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03455 03456 memset(&packet2, 0, sizeof(packet2)); 03457 mavlink_msg_set_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03458 mavlink_msg_set_attitude_target_decode(&msg, &packet2); 03459 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03460 03461 memset(&packet2, 0, sizeof(packet2)); 03462 mavlink_msg_set_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03463 mavlink_msg_set_attitude_target_decode(&msg, &packet2); 03464 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03465 03466 memset(&packet2, 0, sizeof(packet2)); 03467 mavlink_msg_to_send_buffer(buffer, &msg); 03468 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03469 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03470 } 03471 mavlink_msg_set_attitude_target_decode(last_msg, &packet2); 03472 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03473 03474 memset(&packet2, 0, sizeof(packet2)); 03475 mavlink_msg_set_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03476 mavlink_msg_set_attitude_target_decode(last_msg, &packet2); 03477 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03478 } 03479 03480 static void mavlink_test_attitude_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03481 { 03482 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03483 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03484 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATTITUDE_TARGET >= 256) { 03485 return; 03486 } 03487 #endif 03488 mavlink_message_t msg; 03489 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03490 uint16_t i; 03491 mavlink_attitude_target_t packet_in = { 03492 963497464,{ 45.0, 46.0, 47.0, 48.0 },157.0,185.0,213.0,241.0,113 03493 }; 03494 mavlink_attitude_target_t packet1, packet2; 03495 memset(&packet1, 0, sizeof(packet1)); 03496 packet1.time_boot_ms = packet_in.time_boot_ms; 03497 packet1.body_roll_rate = packet_in.body_roll_rate; 03498 packet1.body_pitch_rate = packet_in.body_pitch_rate; 03499 packet1.body_yaw_rate = packet_in.body_yaw_rate; 03500 packet1.thrust = packet_in.thrust; 03501 packet1.type_mask = packet_in.type_mask; 03502 03503 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 03504 03505 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03506 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03507 // cope with extensions 03508 memset(MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATTITUDE_TARGET_MIN_LEN); 03509 } 03510 #endif 03511 memset(&packet2, 0, sizeof(packet2)); 03512 mavlink_msg_attitude_target_encode(system_id, component_id, &msg, &packet1); 03513 mavlink_msg_attitude_target_decode(&msg, &packet2); 03514 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03515 03516 memset(&packet2, 0, sizeof(packet2)); 03517 mavlink_msg_attitude_target_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03518 mavlink_msg_attitude_target_decode(&msg, &packet2); 03519 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03520 03521 memset(&packet2, 0, sizeof(packet2)); 03522 mavlink_msg_attitude_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03523 mavlink_msg_attitude_target_decode(&msg, &packet2); 03524 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03525 03526 memset(&packet2, 0, sizeof(packet2)); 03527 mavlink_msg_to_send_buffer(buffer, &msg); 03528 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03529 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03530 } 03531 mavlink_msg_attitude_target_decode(last_msg, &packet2); 03532 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03533 03534 memset(&packet2, 0, sizeof(packet2)); 03535 mavlink_msg_attitude_target_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.type_mask , packet1.q , packet1.body_roll_rate , packet1.body_pitch_rate , packet1.body_yaw_rate , packet1.thrust ); 03536 mavlink_msg_attitude_target_decode(last_msg, &packet2); 03537 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03538 } 03539 03540 static void mavlink_test_set_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03541 { 03542 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03543 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03544 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED >= 256) { 03545 return; 03546 } 03547 #endif 03548 mavlink_message_t msg; 03549 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03550 uint16_t i; 03551 mavlink_set_position_target_local_ned_t packet_in = { 03552 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27,94,161 03553 }; 03554 mavlink_set_position_target_local_ned_t packet1, packet2; 03555 memset(&packet1, 0, sizeof(packet1)); 03556 packet1.time_boot_ms = packet_in.time_boot_ms; 03557 packet1.x = packet_in.x; 03558 packet1.y = packet_in.y; 03559 packet1.z = packet_in.z; 03560 packet1.vx = packet_in.vx; 03561 packet1.vy = packet_in.vy; 03562 packet1.vz = packet_in.vz; 03563 packet1.afx = packet_in.afx; 03564 packet1.afy = packet_in.afy; 03565 packet1.afz = packet_in.afz; 03566 packet1.yaw = packet_in.yaw; 03567 packet1.yaw_rate = packet_in.yaw_rate; 03568 packet1.type_mask = packet_in.type_mask; 03569 packet1.target_system = packet_in.target_system; 03570 packet1.target_component = packet_in.target_component; 03571 packet1.coordinate_frame = packet_in.coordinate_frame; 03572 03573 03574 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03575 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03576 // cope with extensions 03577 memset(MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_POSITION_TARGET_LOCAL_NED_MIN_LEN); 03578 } 03579 #endif 03580 memset(&packet2, 0, sizeof(packet2)); 03581 mavlink_msg_set_position_target_local_ned_encode(system_id, component_id, &msg, &packet1); 03582 mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2); 03583 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03584 03585 memset(&packet2, 0, sizeof(packet2)); 03586 mavlink_msg_set_position_target_local_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03587 mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2); 03588 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03589 03590 memset(&packet2, 0, sizeof(packet2)); 03591 mavlink_msg_set_position_target_local_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03592 mavlink_msg_set_position_target_local_ned_decode(&msg, &packet2); 03593 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03594 03595 memset(&packet2, 0, sizeof(packet2)); 03596 mavlink_msg_to_send_buffer(buffer, &msg); 03597 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03598 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03599 } 03600 mavlink_msg_set_position_target_local_ned_decode(last_msg, &packet2); 03601 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03602 03603 memset(&packet2, 0, sizeof(packet2)); 03604 mavlink_msg_set_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03605 mavlink_msg_set_position_target_local_ned_decode(last_msg, &packet2); 03606 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03607 } 03608 03609 static void mavlink_test_position_target_local_ned(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03610 { 03611 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03612 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03613 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED >= 256) { 03614 return; 03615 } 03616 #endif 03617 mavlink_message_t msg; 03618 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03619 uint16_t i; 03620 mavlink_position_target_local_ned_t packet_in = { 03621 963497464,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27 03622 }; 03623 mavlink_position_target_local_ned_t packet1, packet2; 03624 memset(&packet1, 0, sizeof(packet1)); 03625 packet1.time_boot_ms = packet_in.time_boot_ms; 03626 packet1.x = packet_in.x; 03627 packet1.y = packet_in.y; 03628 packet1.z = packet_in.z; 03629 packet1.vx = packet_in.vx; 03630 packet1.vy = packet_in.vy; 03631 packet1.vz = packet_in.vz; 03632 packet1.afx = packet_in.afx; 03633 packet1.afy = packet_in.afy; 03634 packet1.afz = packet_in.afz; 03635 packet1.yaw = packet_in.yaw; 03636 packet1.yaw_rate = packet_in.yaw_rate; 03637 packet1.type_mask = packet_in.type_mask; 03638 packet1.coordinate_frame = packet_in.coordinate_frame; 03639 03640 03641 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03642 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03643 // cope with extensions 03644 memset(MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POSITION_TARGET_LOCAL_NED_MIN_LEN); 03645 } 03646 #endif 03647 memset(&packet2, 0, sizeof(packet2)); 03648 mavlink_msg_position_target_local_ned_encode(system_id, component_id, &msg, &packet1); 03649 mavlink_msg_position_target_local_ned_decode(&msg, &packet2); 03650 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03651 03652 memset(&packet2, 0, sizeof(packet2)); 03653 mavlink_msg_position_target_local_ned_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03654 mavlink_msg_position_target_local_ned_decode(&msg, &packet2); 03655 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03656 03657 memset(&packet2, 0, sizeof(packet2)); 03658 mavlink_msg_position_target_local_ned_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03659 mavlink_msg_position_target_local_ned_decode(&msg, &packet2); 03660 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03661 03662 memset(&packet2, 0, sizeof(packet2)); 03663 mavlink_msg_to_send_buffer(buffer, &msg); 03664 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03665 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03666 } 03667 mavlink_msg_position_target_local_ned_decode(last_msg, &packet2); 03668 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03669 03670 memset(&packet2, 0, sizeof(packet2)); 03671 mavlink_msg_position_target_local_ned_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.x , packet1.y , packet1.z , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03672 mavlink_msg_position_target_local_ned_decode(last_msg, &packet2); 03673 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03674 } 03675 03676 static void mavlink_test_set_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03677 { 03678 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03679 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03680 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT >= 256) { 03681 return; 03682 } 03683 #endif 03684 mavlink_message_t msg; 03685 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03686 uint16_t i; 03687 mavlink_set_position_target_global_int_t packet_in = { 03688 963497464,963497672,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27,94,161 03689 }; 03690 mavlink_set_position_target_global_int_t packet1, packet2; 03691 memset(&packet1, 0, sizeof(packet1)); 03692 packet1.time_boot_ms = packet_in.time_boot_ms; 03693 packet1.lat_int = packet_in.lat_int; 03694 packet1.lon_int = packet_in.lon_int; 03695 packet1.alt = packet_in.alt; 03696 packet1.vx = packet_in.vx; 03697 packet1.vy = packet_in.vy; 03698 packet1.vz = packet_in.vz; 03699 packet1.afx = packet_in.afx; 03700 packet1.afy = packet_in.afy; 03701 packet1.afz = packet_in.afz; 03702 packet1.yaw = packet_in.yaw; 03703 packet1.yaw_rate = packet_in.yaw_rate; 03704 packet1.type_mask = packet_in.type_mask; 03705 packet1.target_system = packet_in.target_system; 03706 packet1.target_component = packet_in.target_component; 03707 packet1.coordinate_frame = packet_in.coordinate_frame; 03708 03709 03710 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03711 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03712 // cope with extensions 03713 memset(MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT_MIN_LEN); 03714 } 03715 #endif 03716 memset(&packet2, 0, sizeof(packet2)); 03717 mavlink_msg_set_position_target_global_int_encode(system_id, component_id, &msg, &packet1); 03718 mavlink_msg_set_position_target_global_int_decode(&msg, &packet2); 03719 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03720 03721 memset(&packet2, 0, sizeof(packet2)); 03722 mavlink_msg_set_position_target_global_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03723 mavlink_msg_set_position_target_global_int_decode(&msg, &packet2); 03724 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03725 03726 memset(&packet2, 0, sizeof(packet2)); 03727 mavlink_msg_set_position_target_global_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03728 mavlink_msg_set_position_target_global_int_decode(&msg, &packet2); 03729 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03730 03731 memset(&packet2, 0, sizeof(packet2)); 03732 mavlink_msg_to_send_buffer(buffer, &msg); 03733 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03734 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03735 } 03736 mavlink_msg_set_position_target_global_int_decode(last_msg, &packet2); 03737 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03738 03739 memset(&packet2, 0, sizeof(packet2)); 03740 mavlink_msg_set_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.target_system , packet1.target_component , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03741 mavlink_msg_set_position_target_global_int_decode(last_msg, &packet2); 03742 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03743 } 03744 03745 static void mavlink_test_position_target_global_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03746 { 03747 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03748 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03749 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT >= 256) { 03750 return; 03751 } 03752 #endif 03753 mavlink_message_t msg; 03754 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03755 uint16_t i; 03756 mavlink_position_target_global_int_t packet_in = { 03757 963497464,963497672,963497880,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,19731,27 03758 }; 03759 mavlink_position_target_global_int_t packet1, packet2; 03760 memset(&packet1, 0, sizeof(packet1)); 03761 packet1.time_boot_ms = packet_in.time_boot_ms; 03762 packet1.lat_int = packet_in.lat_int; 03763 packet1.lon_int = packet_in.lon_int; 03764 packet1.alt = packet_in.alt; 03765 packet1.vx = packet_in.vx; 03766 packet1.vy = packet_in.vy; 03767 packet1.vz = packet_in.vz; 03768 packet1.afx = packet_in.afx; 03769 packet1.afy = packet_in.afy; 03770 packet1.afz = packet_in.afz; 03771 packet1.yaw = packet_in.yaw; 03772 packet1.yaw_rate = packet_in.yaw_rate; 03773 packet1.type_mask = packet_in.type_mask; 03774 packet1.coordinate_frame = packet_in.coordinate_frame; 03775 03776 03777 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03778 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03779 // cope with extensions 03780 memset(MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT_MIN_LEN); 03781 } 03782 #endif 03783 memset(&packet2, 0, sizeof(packet2)); 03784 mavlink_msg_position_target_global_int_encode(system_id, component_id, &msg, &packet1); 03785 mavlink_msg_position_target_global_int_decode(&msg, &packet2); 03786 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03787 03788 memset(&packet2, 0, sizeof(packet2)); 03789 mavlink_msg_position_target_global_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03790 mavlink_msg_position_target_global_int_decode(&msg, &packet2); 03791 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03792 03793 memset(&packet2, 0, sizeof(packet2)); 03794 mavlink_msg_position_target_global_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03795 mavlink_msg_position_target_global_int_decode(&msg, &packet2); 03796 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03797 03798 memset(&packet2, 0, sizeof(packet2)); 03799 mavlink_msg_to_send_buffer(buffer, &msg); 03800 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03801 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03802 } 03803 mavlink_msg_position_target_global_int_decode(last_msg, &packet2); 03804 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03805 03806 memset(&packet2, 0, sizeof(packet2)); 03807 mavlink_msg_position_target_global_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.coordinate_frame , packet1.type_mask , packet1.lat_int , packet1.lon_int , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.afx , packet1.afy , packet1.afz , packet1.yaw , packet1.yaw_rate ); 03808 mavlink_msg_position_target_global_int_decode(last_msg, &packet2); 03809 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03810 } 03811 03812 static void mavlink_test_local_position_ned_system_global_offset(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03813 { 03814 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03815 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03816 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET >= 256) { 03817 return; 03818 } 03819 #endif 03820 mavlink_message_t msg; 03821 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03822 uint16_t i; 03823 mavlink_local_position_ned_system_global_offset_t packet_in = { 03824 963497464,45.0,73.0,101.0,129.0,157.0,185.0 03825 }; 03826 mavlink_local_position_ned_system_global_offset_t packet1, packet2; 03827 memset(&packet1, 0, sizeof(packet1)); 03828 packet1.time_boot_ms = packet_in.time_boot_ms; 03829 packet1.x = packet_in.x; 03830 packet1.y = packet_in.y; 03831 packet1.z = packet_in.z; 03832 packet1.roll = packet_in.roll; 03833 packet1.pitch = packet_in.pitch; 03834 packet1.yaw = packet_in.yaw; 03835 03836 03837 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03838 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03839 // cope with extensions 03840 memset(MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET_MIN_LEN); 03841 } 03842 #endif 03843 memset(&packet2, 0, sizeof(packet2)); 03844 mavlink_msg_local_position_ned_system_global_offset_encode(system_id, component_id, &msg, &packet1); 03845 mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2); 03846 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03847 03848 memset(&packet2, 0, sizeof(packet2)); 03849 mavlink_msg_local_position_ned_system_global_offset_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 03850 mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2); 03851 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03852 03853 memset(&packet2, 0, sizeof(packet2)); 03854 mavlink_msg_local_position_ned_system_global_offset_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 03855 mavlink_msg_local_position_ned_system_global_offset_decode(&msg, &packet2); 03856 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03857 03858 memset(&packet2, 0, sizeof(packet2)); 03859 mavlink_msg_to_send_buffer(buffer, &msg); 03860 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03861 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03862 } 03863 mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2); 03864 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03865 03866 memset(&packet2, 0, sizeof(packet2)); 03867 mavlink_msg_local_position_ned_system_global_offset_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 03868 mavlink_msg_local_position_ned_system_global_offset_decode(last_msg, &packet2); 03869 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03870 } 03871 03872 static void mavlink_test_hil_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03873 { 03874 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03875 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03876 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_STATE >= 256) { 03877 return; 03878 } 03879 #endif 03880 mavlink_message_t msg; 03881 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03882 uint16_t i; 03883 mavlink_hil_state_t packet_in = { 03884 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,963499128,963499336,963499544,19523,19627,19731,19835,19939,20043 03885 }; 03886 mavlink_hil_state_t packet1, packet2; 03887 memset(&packet1, 0, sizeof(packet1)); 03888 packet1.time_usec = packet_in.time_usec; 03889 packet1.roll = packet_in.roll; 03890 packet1.pitch = packet_in.pitch; 03891 packet1.yaw = packet_in.yaw; 03892 packet1.rollspeed = packet_in.rollspeed; 03893 packet1.pitchspeed = packet_in.pitchspeed; 03894 packet1.yawspeed = packet_in.yawspeed; 03895 packet1.lat = packet_in.lat; 03896 packet1.lon = packet_in.lon; 03897 packet1.alt = packet_in.alt; 03898 packet1.vx = packet_in.vx; 03899 packet1.vy = packet_in.vy; 03900 packet1.vz = packet_in.vz; 03901 packet1.xacc = packet_in.xacc; 03902 packet1.yacc = packet_in.yacc; 03903 packet1.zacc = packet_in.zacc; 03904 03905 03906 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03907 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03908 // cope with extensions 03909 memset(MAVLINK_MSG_ID_HIL_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_STATE_MIN_LEN); 03910 } 03911 #endif 03912 memset(&packet2, 0, sizeof(packet2)); 03913 mavlink_msg_hil_state_encode(system_id, component_id, &msg, &packet1); 03914 mavlink_msg_hil_state_decode(&msg, &packet2); 03915 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03916 03917 memset(&packet2, 0, sizeof(packet2)); 03918 mavlink_msg_hil_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc ); 03919 mavlink_msg_hil_state_decode(&msg, &packet2); 03920 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03921 03922 memset(&packet2, 0, sizeof(packet2)); 03923 mavlink_msg_hil_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc ); 03924 mavlink_msg_hil_state_decode(&msg, &packet2); 03925 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03926 03927 memset(&packet2, 0, sizeof(packet2)); 03928 mavlink_msg_to_send_buffer(buffer, &msg); 03929 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03930 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03931 } 03932 mavlink_msg_hil_state_decode(last_msg, &packet2); 03933 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03934 03935 memset(&packet2, 0, sizeof(packet2)); 03936 mavlink_msg_hil_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.xacc , packet1.yacc , packet1.zacc ); 03937 mavlink_msg_hil_state_decode(last_msg, &packet2); 03938 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03939 } 03940 03941 static void mavlink_test_hil_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 03942 { 03943 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03944 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 03945 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_CONTROLS >= 256) { 03946 return; 03947 } 03948 #endif 03949 mavlink_message_t msg; 03950 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 03951 uint16_t i; 03952 mavlink_hil_controls_t packet_in = { 03953 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,125,192 03954 }; 03955 mavlink_hil_controls_t packet1, packet2; 03956 memset(&packet1, 0, sizeof(packet1)); 03957 packet1.time_usec = packet_in.time_usec; 03958 packet1.roll_ailerons = packet_in.roll_ailerons; 03959 packet1.pitch_elevator = packet_in.pitch_elevator; 03960 packet1.yaw_rudder = packet_in.yaw_rudder; 03961 packet1.throttle = packet_in.throttle; 03962 packet1.aux1 = packet_in.aux1; 03963 packet1.aux2 = packet_in.aux2; 03964 packet1.aux3 = packet_in.aux3; 03965 packet1.aux4 = packet_in.aux4; 03966 packet1.mode = packet_in.mode; 03967 packet1.nav_mode = packet_in.nav_mode; 03968 03969 03970 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 03971 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 03972 // cope with extensions 03973 memset(MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_CONTROLS_MIN_LEN); 03974 } 03975 #endif 03976 memset(&packet2, 0, sizeof(packet2)); 03977 mavlink_msg_hil_controls_encode(system_id, component_id, &msg, &packet1); 03978 mavlink_msg_hil_controls_decode(&msg, &packet2); 03979 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03980 03981 memset(&packet2, 0, sizeof(packet2)); 03982 mavlink_msg_hil_controls_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode ); 03983 mavlink_msg_hil_controls_decode(&msg, &packet2); 03984 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03985 03986 memset(&packet2, 0, sizeof(packet2)); 03987 mavlink_msg_hil_controls_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode ); 03988 mavlink_msg_hil_controls_decode(&msg, &packet2); 03989 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03990 03991 memset(&packet2, 0, sizeof(packet2)); 03992 mavlink_msg_to_send_buffer(buffer, &msg); 03993 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 03994 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 03995 } 03996 mavlink_msg_hil_controls_decode(last_msg, &packet2); 03997 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 03998 03999 memset(&packet2, 0, sizeof(packet2)); 04000 mavlink_msg_hil_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll_ailerons , packet1.pitch_elevator , packet1.yaw_rudder , packet1.throttle , packet1.aux1 , packet1.aux2 , packet1.aux3 , packet1.aux4 , packet1.mode , packet1.nav_mode ); 04001 mavlink_msg_hil_controls_decode(last_msg, &packet2); 04002 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04003 } 04004 04005 static void mavlink_test_hil_rc_inputs_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04006 { 04007 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04008 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04009 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW >= 256) { 04010 return; 04011 } 04012 #endif 04013 mavlink_message_t msg; 04014 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04015 uint16_t i; 04016 mavlink_hil_rc_inputs_raw_t packet_in = { 04017 93372036854775807ULL,17651,17755,17859,17963,18067,18171,18275,18379,18483,18587,18691,18795,101 04018 }; 04019 mavlink_hil_rc_inputs_raw_t packet1, packet2; 04020 memset(&packet1, 0, sizeof(packet1)); 04021 packet1.time_usec = packet_in.time_usec; 04022 packet1.chan1_raw = packet_in.chan1_raw; 04023 packet1.chan2_raw = packet_in.chan2_raw; 04024 packet1.chan3_raw = packet_in.chan3_raw; 04025 packet1.chan4_raw = packet_in.chan4_raw; 04026 packet1.chan5_raw = packet_in.chan5_raw; 04027 packet1.chan6_raw = packet_in.chan6_raw; 04028 packet1.chan7_raw = packet_in.chan7_raw; 04029 packet1.chan8_raw = packet_in.chan8_raw; 04030 packet1.chan9_raw = packet_in.chan9_raw; 04031 packet1.chan10_raw = packet_in.chan10_raw; 04032 packet1.chan11_raw = packet_in.chan11_raw; 04033 packet1.chan12_raw = packet_in.chan12_raw; 04034 packet1.rssi = packet_in.rssi; 04035 04036 04037 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04038 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04039 // cope with extensions 04040 memset(MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_RC_INPUTS_RAW_MIN_LEN); 04041 } 04042 #endif 04043 memset(&packet2, 0, sizeof(packet2)); 04044 mavlink_msg_hil_rc_inputs_raw_encode(system_id, component_id, &msg, &packet1); 04045 mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2); 04046 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04047 04048 memset(&packet2, 0, sizeof(packet2)); 04049 mavlink_msg_hil_rc_inputs_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi ); 04050 mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2); 04051 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04052 04053 memset(&packet2, 0, sizeof(packet2)); 04054 mavlink_msg_hil_rc_inputs_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi ); 04055 mavlink_msg_hil_rc_inputs_raw_decode(&msg, &packet2); 04056 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04057 04058 memset(&packet2, 0, sizeof(packet2)); 04059 mavlink_msg_to_send_buffer(buffer, &msg); 04060 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04061 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04062 } 04063 mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2); 04064 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04065 04066 memset(&packet2, 0, sizeof(packet2)); 04067 mavlink_msg_hil_rc_inputs_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.chan1_raw , packet1.chan2_raw , packet1.chan3_raw , packet1.chan4_raw , packet1.chan5_raw , packet1.chan6_raw , packet1.chan7_raw , packet1.chan8_raw , packet1.chan9_raw , packet1.chan10_raw , packet1.chan11_raw , packet1.chan12_raw , packet1.rssi ); 04068 mavlink_msg_hil_rc_inputs_raw_decode(last_msg, &packet2); 04069 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04070 } 04071 04072 static void mavlink_test_hil_actuator_controls(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04073 { 04074 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04075 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04076 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS >= 256) { 04077 return; 04078 } 04079 #endif 04080 mavlink_message_t msg; 04081 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04082 uint16_t i; 04083 mavlink_hil_actuator_controls_t packet_in = { 04084 93372036854775807ULL,93372036854776311ULL,{ 129.0, 130.0, 131.0, 132.0, 133.0, 134.0, 135.0, 136.0, 137.0, 138.0, 139.0, 140.0, 141.0, 142.0, 143.0, 144.0 },245 04085 }; 04086 mavlink_hil_actuator_controls_t packet1, packet2; 04087 memset(&packet1, 0, sizeof(packet1)); 04088 packet1.time_usec = packet_in.time_usec; 04089 packet1.flags = packet_in.flags; 04090 packet1.mode = packet_in.mode; 04091 04092 mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*16); 04093 04094 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04095 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04096 // cope with extensions 04097 memset(MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_ACTUATOR_CONTROLS_MIN_LEN); 04098 } 04099 #endif 04100 memset(&packet2, 0, sizeof(packet2)); 04101 mavlink_msg_hil_actuator_controls_encode(system_id, component_id, &msg, &packet1); 04102 mavlink_msg_hil_actuator_controls_decode(&msg, &packet2); 04103 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04104 04105 memset(&packet2, 0, sizeof(packet2)); 04106 mavlink_msg_hil_actuator_controls_pack(system_id, component_id, &msg , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags ); 04107 mavlink_msg_hil_actuator_controls_decode(&msg, &packet2); 04108 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04109 04110 memset(&packet2, 0, sizeof(packet2)); 04111 mavlink_msg_hil_actuator_controls_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags ); 04112 mavlink_msg_hil_actuator_controls_decode(&msg, &packet2); 04113 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04114 04115 memset(&packet2, 0, sizeof(packet2)); 04116 mavlink_msg_to_send_buffer(buffer, &msg); 04117 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04118 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04119 } 04120 mavlink_msg_hil_actuator_controls_decode(last_msg, &packet2); 04121 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04122 04123 memset(&packet2, 0, sizeof(packet2)); 04124 mavlink_msg_hil_actuator_controls_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.controls , packet1.mode , packet1.flags ); 04125 mavlink_msg_hil_actuator_controls_decode(last_msg, &packet2); 04126 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04127 } 04128 04129 static void mavlink_test_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04130 { 04131 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04132 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04133 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPTICAL_FLOW >= 256) { 04134 return; 04135 } 04136 #endif 04137 mavlink_message_t msg; 04138 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04139 uint16_t i; 04140 mavlink_optical_flow_t packet_in = { 04141 93372036854775807ULL,73.0,101.0,129.0,18275,18379,77,144 04142 }; 04143 mavlink_optical_flow_t packet1, packet2; 04144 memset(&packet1, 0, sizeof(packet1)); 04145 packet1.time_usec = packet_in.time_usec; 04146 packet1.flow_comp_m_x = packet_in.flow_comp_m_x; 04147 packet1.flow_comp_m_y = packet_in.flow_comp_m_y; 04148 packet1.ground_distance = packet_in.ground_distance; 04149 packet1.flow_x = packet_in.flow_x; 04150 packet1.flow_y = packet_in.flow_y; 04151 packet1.sensor_id = packet_in.sensor_id; 04152 packet1.quality = packet_in.quality; 04153 04154 04155 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04156 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04157 // cope with extensions 04158 memset(MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPTICAL_FLOW_MIN_LEN); 04159 } 04160 #endif 04161 memset(&packet2, 0, sizeof(packet2)); 04162 mavlink_msg_optical_flow_encode(system_id, component_id, &msg, &packet1); 04163 mavlink_msg_optical_flow_decode(&msg, &packet2); 04164 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04165 04166 memset(&packet2, 0, sizeof(packet2)); 04167 mavlink_msg_optical_flow_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance ); 04168 mavlink_msg_optical_flow_decode(&msg, &packet2); 04169 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04170 04171 memset(&packet2, 0, sizeof(packet2)); 04172 mavlink_msg_optical_flow_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance ); 04173 mavlink_msg_optical_flow_decode(&msg, &packet2); 04174 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04175 04176 memset(&packet2, 0, sizeof(packet2)); 04177 mavlink_msg_to_send_buffer(buffer, &msg); 04178 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04179 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04180 } 04181 mavlink_msg_optical_flow_decode(last_msg, &packet2); 04182 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04183 04184 memset(&packet2, 0, sizeof(packet2)); 04185 mavlink_msg_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.flow_x , packet1.flow_y , packet1.flow_comp_m_x , packet1.flow_comp_m_y , packet1.quality , packet1.ground_distance ); 04186 mavlink_msg_optical_flow_decode(last_msg, &packet2); 04187 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04188 } 04189 04190 static void mavlink_test_global_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04191 { 04192 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04193 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04194 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE >= 256) { 04195 return; 04196 } 04197 #endif 04198 mavlink_message_t msg; 04199 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04200 uint16_t i; 04201 mavlink_global_vision_position_estimate_t packet_in = { 04202 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0 04203 }; 04204 mavlink_global_vision_position_estimate_t packet1, packet2; 04205 memset(&packet1, 0, sizeof(packet1)); 04206 packet1.usec = packet_in.usec; 04207 packet1.x = packet_in.x; 04208 packet1.y = packet_in.y; 04209 packet1.z = packet_in.z; 04210 packet1.roll = packet_in.roll; 04211 packet1.pitch = packet_in.pitch; 04212 packet1.yaw = packet_in.yaw; 04213 04214 04215 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04216 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04217 // cope with extensions 04218 memset(MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GLOBAL_VISION_POSITION_ESTIMATE_MIN_LEN); 04219 } 04220 #endif 04221 memset(&packet2, 0, sizeof(packet2)); 04222 mavlink_msg_global_vision_position_estimate_encode(system_id, component_id, &msg, &packet1); 04223 mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2); 04224 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04225 04226 memset(&packet2, 0, sizeof(packet2)); 04227 mavlink_msg_global_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04228 mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2); 04229 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04230 04231 memset(&packet2, 0, sizeof(packet2)); 04232 mavlink_msg_global_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04233 mavlink_msg_global_vision_position_estimate_decode(&msg, &packet2); 04234 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04235 04236 memset(&packet2, 0, sizeof(packet2)); 04237 mavlink_msg_to_send_buffer(buffer, &msg); 04238 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04239 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04240 } 04241 mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2); 04242 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04243 04244 memset(&packet2, 0, sizeof(packet2)); 04245 mavlink_msg_global_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04246 mavlink_msg_global_vision_position_estimate_decode(last_msg, &packet2); 04247 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04248 } 04249 04250 static void mavlink_test_vision_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04251 { 04252 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04253 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04254 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE >= 256) { 04255 return; 04256 } 04257 #endif 04258 mavlink_message_t msg; 04259 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04260 uint16_t i; 04261 mavlink_vision_position_estimate_t packet_in = { 04262 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0 04263 }; 04264 mavlink_vision_position_estimate_t packet1, packet2; 04265 memset(&packet1, 0, sizeof(packet1)); 04266 packet1.usec = packet_in.usec; 04267 packet1.x = packet_in.x; 04268 packet1.y = packet_in.y; 04269 packet1.z = packet_in.z; 04270 packet1.roll = packet_in.roll; 04271 packet1.pitch = packet_in.pitch; 04272 packet1.yaw = packet_in.yaw; 04273 04274 04275 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04276 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04277 // cope with extensions 04278 memset(MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE_MIN_LEN); 04279 } 04280 #endif 04281 memset(&packet2, 0, sizeof(packet2)); 04282 mavlink_msg_vision_position_estimate_encode(system_id, component_id, &msg, &packet1); 04283 mavlink_msg_vision_position_estimate_decode(&msg, &packet2); 04284 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04285 04286 memset(&packet2, 0, sizeof(packet2)); 04287 mavlink_msg_vision_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04288 mavlink_msg_vision_position_estimate_decode(&msg, &packet2); 04289 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04290 04291 memset(&packet2, 0, sizeof(packet2)); 04292 mavlink_msg_vision_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04293 mavlink_msg_vision_position_estimate_decode(&msg, &packet2); 04294 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04295 04296 memset(&packet2, 0, sizeof(packet2)); 04297 mavlink_msg_to_send_buffer(buffer, &msg); 04298 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04299 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04300 } 04301 mavlink_msg_vision_position_estimate_decode(last_msg, &packet2); 04302 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04303 04304 memset(&packet2, 0, sizeof(packet2)); 04305 mavlink_msg_vision_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04306 mavlink_msg_vision_position_estimate_decode(last_msg, &packet2); 04307 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04308 } 04309 04310 static void mavlink_test_vision_speed_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04311 { 04312 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04313 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04314 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE >= 256) { 04315 return; 04316 } 04317 #endif 04318 mavlink_message_t msg; 04319 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04320 uint16_t i; 04321 mavlink_vision_speed_estimate_t packet_in = { 04322 93372036854775807ULL,73.0,101.0,129.0 04323 }; 04324 mavlink_vision_speed_estimate_t packet1, packet2; 04325 memset(&packet1, 0, sizeof(packet1)); 04326 packet1.usec = packet_in.usec; 04327 packet1.x = packet_in.x; 04328 packet1.y = packet_in.y; 04329 packet1.z = packet_in.z; 04330 04331 04332 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04333 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04334 // cope with extensions 04335 memset(MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VISION_SPEED_ESTIMATE_MIN_LEN); 04336 } 04337 #endif 04338 memset(&packet2, 0, sizeof(packet2)); 04339 mavlink_msg_vision_speed_estimate_encode(system_id, component_id, &msg, &packet1); 04340 mavlink_msg_vision_speed_estimate_decode(&msg, &packet2); 04341 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04342 04343 memset(&packet2, 0, sizeof(packet2)); 04344 mavlink_msg_vision_speed_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z ); 04345 mavlink_msg_vision_speed_estimate_decode(&msg, &packet2); 04346 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04347 04348 memset(&packet2, 0, sizeof(packet2)); 04349 mavlink_msg_vision_speed_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z ); 04350 mavlink_msg_vision_speed_estimate_decode(&msg, &packet2); 04351 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04352 04353 memset(&packet2, 0, sizeof(packet2)); 04354 mavlink_msg_to_send_buffer(buffer, &msg); 04355 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04356 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04357 } 04358 mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2); 04359 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04360 04361 memset(&packet2, 0, sizeof(packet2)); 04362 mavlink_msg_vision_speed_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z ); 04363 mavlink_msg_vision_speed_estimate_decode(last_msg, &packet2); 04364 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04365 } 04366 04367 static void mavlink_test_vicon_position_estimate(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04368 { 04369 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04370 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04371 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE >= 256) { 04372 return; 04373 } 04374 #endif 04375 mavlink_message_t msg; 04376 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04377 uint16_t i; 04378 mavlink_vicon_position_estimate_t packet_in = { 04379 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0 04380 }; 04381 mavlink_vicon_position_estimate_t packet1, packet2; 04382 memset(&packet1, 0, sizeof(packet1)); 04383 packet1.usec = packet_in.usec; 04384 packet1.x = packet_in.x; 04385 packet1.y = packet_in.y; 04386 packet1.z = packet_in.z; 04387 packet1.roll = packet_in.roll; 04388 packet1.pitch = packet_in.pitch; 04389 packet1.yaw = packet_in.yaw; 04390 04391 04392 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04393 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04394 // cope with extensions 04395 memset(MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VICON_POSITION_ESTIMATE_MIN_LEN); 04396 } 04397 #endif 04398 memset(&packet2, 0, sizeof(packet2)); 04399 mavlink_msg_vicon_position_estimate_encode(system_id, component_id, &msg, &packet1); 04400 mavlink_msg_vicon_position_estimate_decode(&msg, &packet2); 04401 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04402 04403 memset(&packet2, 0, sizeof(packet2)); 04404 mavlink_msg_vicon_position_estimate_pack(system_id, component_id, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04405 mavlink_msg_vicon_position_estimate_decode(&msg, &packet2); 04406 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04407 04408 memset(&packet2, 0, sizeof(packet2)); 04409 mavlink_msg_vicon_position_estimate_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04410 mavlink_msg_vicon_position_estimate_decode(&msg, &packet2); 04411 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04412 04413 memset(&packet2, 0, sizeof(packet2)); 04414 mavlink_msg_to_send_buffer(buffer, &msg); 04415 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04416 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04417 } 04418 mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2); 04419 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04420 04421 memset(&packet2, 0, sizeof(packet2)); 04422 mavlink_msg_vicon_position_estimate_send(MAVLINK_COMM_1 , packet1.usec , packet1.x , packet1.y , packet1.z , packet1.roll , packet1.pitch , packet1.yaw ); 04423 mavlink_msg_vicon_position_estimate_decode(last_msg, &packet2); 04424 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04425 } 04426 04427 static void mavlink_test_highres_imu(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04428 { 04429 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04430 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04431 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIGHRES_IMU >= 256) { 04432 return; 04433 } 04434 #endif 04435 mavlink_message_t msg; 04436 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04437 uint16_t i; 04438 mavlink_highres_imu_t packet_in = { 04439 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,20355 04440 }; 04441 mavlink_highres_imu_t packet1, packet2; 04442 memset(&packet1, 0, sizeof(packet1)); 04443 packet1.time_usec = packet_in.time_usec; 04444 packet1.xacc = packet_in.xacc; 04445 packet1.yacc = packet_in.yacc; 04446 packet1.zacc = packet_in.zacc; 04447 packet1.xgyro = packet_in.xgyro; 04448 packet1.ygyro = packet_in.ygyro; 04449 packet1.zgyro = packet_in.zgyro; 04450 packet1.xmag = packet_in.xmag; 04451 packet1.ymag = packet_in.ymag; 04452 packet1.zmag = packet_in.zmag; 04453 packet1.abs_pressure = packet_in.abs_pressure; 04454 packet1.diff_pressure = packet_in.diff_pressure; 04455 packet1.pressure_alt = packet_in.pressure_alt; 04456 packet1.temperature = packet_in.temperature; 04457 packet1.fields_updated = packet_in.fields_updated; 04458 04459 04460 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04461 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04462 // cope with extensions 04463 memset(MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIGHRES_IMU_MIN_LEN); 04464 } 04465 #endif 04466 memset(&packet2, 0, sizeof(packet2)); 04467 mavlink_msg_highres_imu_encode(system_id, component_id, &msg, &packet1); 04468 mavlink_msg_highres_imu_decode(&msg, &packet2); 04469 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04470 04471 memset(&packet2, 0, sizeof(packet2)); 04472 mavlink_msg_highres_imu_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04473 mavlink_msg_highres_imu_decode(&msg, &packet2); 04474 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04475 04476 memset(&packet2, 0, sizeof(packet2)); 04477 mavlink_msg_highres_imu_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04478 mavlink_msg_highres_imu_decode(&msg, &packet2); 04479 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04480 04481 memset(&packet2, 0, sizeof(packet2)); 04482 mavlink_msg_to_send_buffer(buffer, &msg); 04483 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04484 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04485 } 04486 mavlink_msg_highres_imu_decode(last_msg, &packet2); 04487 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04488 04489 memset(&packet2, 0, sizeof(packet2)); 04490 mavlink_msg_highres_imu_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04491 mavlink_msg_highres_imu_decode(last_msg, &packet2); 04492 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04493 } 04494 04495 static void mavlink_test_optical_flow_rad(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04496 { 04497 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04498 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04499 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_OPTICAL_FLOW_RAD >= 256) { 04500 return; 04501 } 04502 #endif 04503 mavlink_message_t msg; 04504 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04505 uint16_t i; 04506 mavlink_optical_flow_rad_t packet_in = { 04507 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,963499128,269.0,19315,3,70 04508 }; 04509 mavlink_optical_flow_rad_t packet1, packet2; 04510 memset(&packet1, 0, sizeof(packet1)); 04511 packet1.time_usec = packet_in.time_usec; 04512 packet1.integration_time_us = packet_in.integration_time_us; 04513 packet1.integrated_x = packet_in.integrated_x; 04514 packet1.integrated_y = packet_in.integrated_y; 04515 packet1.integrated_xgyro = packet_in.integrated_xgyro; 04516 packet1.integrated_ygyro = packet_in.integrated_ygyro; 04517 packet1.integrated_zgyro = packet_in.integrated_zgyro; 04518 packet1.time_delta_distance_us = packet_in.time_delta_distance_us; 04519 packet1.distance = packet_in.distance; 04520 packet1.temperature = packet_in.temperature; 04521 packet1.sensor_id = packet_in.sensor_id; 04522 packet1.quality = packet_in.quality; 04523 04524 04525 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04526 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04527 // cope with extensions 04528 memset(MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_OPTICAL_FLOW_RAD_MIN_LEN); 04529 } 04530 #endif 04531 memset(&packet2, 0, sizeof(packet2)); 04532 mavlink_msg_optical_flow_rad_encode(system_id, component_id, &msg, &packet1); 04533 mavlink_msg_optical_flow_rad_decode(&msg, &packet2); 04534 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04535 04536 memset(&packet2, 0, sizeof(packet2)); 04537 mavlink_msg_optical_flow_rad_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 04538 mavlink_msg_optical_flow_rad_decode(&msg, &packet2); 04539 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04540 04541 memset(&packet2, 0, sizeof(packet2)); 04542 mavlink_msg_optical_flow_rad_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 04543 mavlink_msg_optical_flow_rad_decode(&msg, &packet2); 04544 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04545 04546 memset(&packet2, 0, sizeof(packet2)); 04547 mavlink_msg_to_send_buffer(buffer, &msg); 04548 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04549 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04550 } 04551 mavlink_msg_optical_flow_rad_decode(last_msg, &packet2); 04552 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04553 04554 memset(&packet2, 0, sizeof(packet2)); 04555 mavlink_msg_optical_flow_rad_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 04556 mavlink_msg_optical_flow_rad_decode(last_msg, &packet2); 04557 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04558 } 04559 04560 static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04561 { 04562 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04563 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04564 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_SENSOR >= 256) { 04565 return; 04566 } 04567 #endif 04568 mavlink_message_t msg; 04569 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04570 uint16_t i; 04571 mavlink_hil_sensor_t packet_in = { 04572 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,963500584 04573 }; 04574 mavlink_hil_sensor_t packet1, packet2; 04575 memset(&packet1, 0, sizeof(packet1)); 04576 packet1.time_usec = packet_in.time_usec; 04577 packet1.xacc = packet_in.xacc; 04578 packet1.yacc = packet_in.yacc; 04579 packet1.zacc = packet_in.zacc; 04580 packet1.xgyro = packet_in.xgyro; 04581 packet1.ygyro = packet_in.ygyro; 04582 packet1.zgyro = packet_in.zgyro; 04583 packet1.xmag = packet_in.xmag; 04584 packet1.ymag = packet_in.ymag; 04585 packet1.zmag = packet_in.zmag; 04586 packet1.abs_pressure = packet_in.abs_pressure; 04587 packet1.diff_pressure = packet_in.diff_pressure; 04588 packet1.pressure_alt = packet_in.pressure_alt; 04589 packet1.temperature = packet_in.temperature; 04590 packet1.fields_updated = packet_in.fields_updated; 04591 04592 04593 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04594 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04595 // cope with extensions 04596 memset(MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_SENSOR_MIN_LEN); 04597 } 04598 #endif 04599 memset(&packet2, 0, sizeof(packet2)); 04600 mavlink_msg_hil_sensor_encode(system_id, component_id, &msg, &packet1); 04601 mavlink_msg_hil_sensor_decode(&msg, &packet2); 04602 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04603 04604 memset(&packet2, 0, sizeof(packet2)); 04605 mavlink_msg_hil_sensor_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04606 mavlink_msg_hil_sensor_decode(&msg, &packet2); 04607 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04608 04609 memset(&packet2, 0, sizeof(packet2)); 04610 mavlink_msg_hil_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04611 mavlink_msg_hil_sensor_decode(&msg, &packet2); 04612 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04613 04614 memset(&packet2, 0, sizeof(packet2)); 04615 mavlink_msg_to_send_buffer(buffer, &msg); 04616 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04617 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04618 } 04619 mavlink_msg_hil_sensor_decode(last_msg, &packet2); 04620 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04621 04622 memset(&packet2, 0, sizeof(packet2)); 04623 mavlink_msg_hil_sensor_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); 04624 mavlink_msg_hil_sensor_decode(last_msg, &packet2); 04625 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04626 } 04627 04628 static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04629 { 04630 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04631 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04632 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SIM_STATE >= 256) { 04633 return; 04634 } 04635 #endif 04636 mavlink_message_t msg; 04637 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04638 uint16_t i; 04639 mavlink_sim_state_t packet_in = { 04640 17.0,45.0,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,409.0,437.0,465.0,493.0,521.0,549.0,577.0 04641 }; 04642 mavlink_sim_state_t packet1, packet2; 04643 memset(&packet1, 0, sizeof(packet1)); 04644 packet1.q1 = packet_in.q1; 04645 packet1.q2 = packet_in.q2; 04646 packet1.q3 = packet_in.q3; 04647 packet1.q4 = packet_in.q4; 04648 packet1.roll = packet_in.roll; 04649 packet1.pitch = packet_in.pitch; 04650 packet1.yaw = packet_in.yaw; 04651 packet1.xacc = packet_in.xacc; 04652 packet1.yacc = packet_in.yacc; 04653 packet1.zacc = packet_in.zacc; 04654 packet1.xgyro = packet_in.xgyro; 04655 packet1.ygyro = packet_in.ygyro; 04656 packet1.zgyro = packet_in.zgyro; 04657 packet1.lat = packet_in.lat; 04658 packet1.lon = packet_in.lon; 04659 packet1.alt = packet_in.alt; 04660 packet1.std_dev_horz = packet_in.std_dev_horz; 04661 packet1.std_dev_vert = packet_in.std_dev_vert; 04662 packet1.vn = packet_in.vn; 04663 packet1.ve = packet_in.ve; 04664 packet1.vd = packet_in.vd; 04665 04666 04667 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04668 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04669 // cope with extensions 04670 memset(MAVLINK_MSG_ID_SIM_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SIM_STATE_MIN_LEN); 04671 } 04672 #endif 04673 memset(&packet2, 0, sizeof(packet2)); 04674 mavlink_msg_sim_state_encode(system_id, component_id, &msg, &packet1); 04675 mavlink_msg_sim_state_decode(&msg, &packet2); 04676 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04677 04678 memset(&packet2, 0, sizeof(packet2)); 04679 mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); 04680 mavlink_msg_sim_state_decode(&msg, &packet2); 04681 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04682 04683 memset(&packet2, 0, sizeof(packet2)); 04684 mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); 04685 mavlink_msg_sim_state_decode(&msg, &packet2); 04686 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04687 04688 memset(&packet2, 0, sizeof(packet2)); 04689 mavlink_msg_to_send_buffer(buffer, &msg); 04690 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04691 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04692 } 04693 mavlink_msg_sim_state_decode(last_msg, &packet2); 04694 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04695 04696 memset(&packet2, 0, sizeof(packet2)); 04697 mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); 04698 mavlink_msg_sim_state_decode(last_msg, &packet2); 04699 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04700 } 04701 04702 static void mavlink_test_radio_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04703 { 04704 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04705 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04706 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RADIO_STATUS >= 256) { 04707 return; 04708 } 04709 #endif 04710 mavlink_message_t msg; 04711 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04712 uint16_t i; 04713 mavlink_radio_status_t packet_in = { 04714 17235,17339,17,84,151,218,29 04715 }; 04716 mavlink_radio_status_t packet1, packet2; 04717 memset(&packet1, 0, sizeof(packet1)); 04718 packet1.rxerrors = packet_in.rxerrors; 04719 packet1.fixed = packet_in.fixed; 04720 packet1.rssi = packet_in.rssi; 04721 packet1.remrssi = packet_in.remrssi; 04722 packet1.txbuf = packet_in.txbuf; 04723 packet1.noise = packet_in.noise; 04724 packet1.remnoise = packet_in.remnoise; 04725 04726 04727 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04728 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04729 // cope with extensions 04730 memset(MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RADIO_STATUS_MIN_LEN); 04731 } 04732 #endif 04733 memset(&packet2, 0, sizeof(packet2)); 04734 mavlink_msg_radio_status_encode(system_id, component_id, &msg, &packet1); 04735 mavlink_msg_radio_status_decode(&msg, &packet2); 04736 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04737 04738 memset(&packet2, 0, sizeof(packet2)); 04739 mavlink_msg_radio_status_pack(system_id, component_id, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); 04740 mavlink_msg_radio_status_decode(&msg, &packet2); 04741 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04742 04743 memset(&packet2, 0, sizeof(packet2)); 04744 mavlink_msg_radio_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); 04745 mavlink_msg_radio_status_decode(&msg, &packet2); 04746 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04747 04748 memset(&packet2, 0, sizeof(packet2)); 04749 mavlink_msg_to_send_buffer(buffer, &msg); 04750 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04751 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04752 } 04753 mavlink_msg_radio_status_decode(last_msg, &packet2); 04754 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04755 04756 memset(&packet2, 0, sizeof(packet2)); 04757 mavlink_msg_radio_status_send(MAVLINK_COMM_1 , packet1.rssi , packet1.remrssi , packet1.txbuf , packet1.noise , packet1.remnoise , packet1.rxerrors , packet1.fixed ); 04758 mavlink_msg_radio_status_decode(last_msg, &packet2); 04759 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04760 } 04761 04762 static void mavlink_test_file_transfer_protocol(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04763 { 04764 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04765 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04766 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL >= 256) { 04767 return; 04768 } 04769 #endif 04770 mavlink_message_t msg; 04771 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04772 uint16_t i; 04773 mavlink_file_transfer_protocol_t packet_in = { 04774 5,72,139,{ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200 } 04775 }; 04776 mavlink_file_transfer_protocol_t packet1, packet2; 04777 memset(&packet1, 0, sizeof(packet1)); 04778 packet1.target_network = packet_in.target_network; 04779 packet1.target_system = packet_in.target_system; 04780 packet1.target_component = packet_in.target_component; 04781 04782 mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*251); 04783 04784 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04785 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04786 // cope with extensions 04787 memset(MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL_MIN_LEN); 04788 } 04789 #endif 04790 memset(&packet2, 0, sizeof(packet2)); 04791 mavlink_msg_file_transfer_protocol_encode(system_id, component_id, &msg, &packet1); 04792 mavlink_msg_file_transfer_protocol_decode(&msg, &packet2); 04793 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04794 04795 memset(&packet2, 0, sizeof(packet2)); 04796 mavlink_msg_file_transfer_protocol_pack(system_id, component_id, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload ); 04797 mavlink_msg_file_transfer_protocol_decode(&msg, &packet2); 04798 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04799 04800 memset(&packet2, 0, sizeof(packet2)); 04801 mavlink_msg_file_transfer_protocol_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload ); 04802 mavlink_msg_file_transfer_protocol_decode(&msg, &packet2); 04803 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04804 04805 memset(&packet2, 0, sizeof(packet2)); 04806 mavlink_msg_to_send_buffer(buffer, &msg); 04807 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04808 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04809 } 04810 mavlink_msg_file_transfer_protocol_decode(last_msg, &packet2); 04811 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04812 04813 memset(&packet2, 0, sizeof(packet2)); 04814 mavlink_msg_file_transfer_protocol_send(MAVLINK_COMM_1 , packet1.target_network , packet1.target_system , packet1.target_component , packet1.payload ); 04815 mavlink_msg_file_transfer_protocol_decode(last_msg, &packet2); 04816 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04817 } 04818 04819 static void mavlink_test_timesync(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04820 { 04821 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04822 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04823 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TIMESYNC >= 256) { 04824 return; 04825 } 04826 #endif 04827 mavlink_message_t msg; 04828 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04829 uint16_t i; 04830 mavlink_timesync_t packet_in = { 04831 93372036854775807LL,93372036854776311LL 04832 }; 04833 mavlink_timesync_t packet1, packet2; 04834 memset(&packet1, 0, sizeof(packet1)); 04835 packet1.tc1 = packet_in.tc1; 04836 packet1.ts1 = packet_in.ts1; 04837 04838 04839 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04840 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04841 // cope with extensions 04842 memset(MAVLINK_MSG_ID_TIMESYNC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TIMESYNC_MIN_LEN); 04843 } 04844 #endif 04845 memset(&packet2, 0, sizeof(packet2)); 04846 mavlink_msg_timesync_encode(system_id, component_id, &msg, &packet1); 04847 mavlink_msg_timesync_decode(&msg, &packet2); 04848 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04849 04850 memset(&packet2, 0, sizeof(packet2)); 04851 mavlink_msg_timesync_pack(system_id, component_id, &msg , packet1.tc1 , packet1.ts1 ); 04852 mavlink_msg_timesync_decode(&msg, &packet2); 04853 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04854 04855 memset(&packet2, 0, sizeof(packet2)); 04856 mavlink_msg_timesync_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.tc1 , packet1.ts1 ); 04857 mavlink_msg_timesync_decode(&msg, &packet2); 04858 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04859 04860 memset(&packet2, 0, sizeof(packet2)); 04861 mavlink_msg_to_send_buffer(buffer, &msg); 04862 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04863 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04864 } 04865 mavlink_msg_timesync_decode(last_msg, &packet2); 04866 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04867 04868 memset(&packet2, 0, sizeof(packet2)); 04869 mavlink_msg_timesync_send(MAVLINK_COMM_1 , packet1.tc1 , packet1.ts1 ); 04870 mavlink_msg_timesync_decode(last_msg, &packet2); 04871 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04872 } 04873 04874 static void mavlink_test_camera_trigger(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04875 { 04876 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04877 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04878 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CAMERA_TRIGGER >= 256) { 04879 return; 04880 } 04881 #endif 04882 mavlink_message_t msg; 04883 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04884 uint16_t i; 04885 mavlink_camera_trigger_t packet_in = { 04886 93372036854775807ULL,963497880 04887 }; 04888 mavlink_camera_trigger_t packet1, packet2; 04889 memset(&packet1, 0, sizeof(packet1)); 04890 packet1.time_usec = packet_in.time_usec; 04891 packet1.seq = packet_in.seq; 04892 04893 04894 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04895 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04896 // cope with extensions 04897 memset(MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CAMERA_TRIGGER_MIN_LEN); 04898 } 04899 #endif 04900 memset(&packet2, 0, sizeof(packet2)); 04901 mavlink_msg_camera_trigger_encode(system_id, component_id, &msg, &packet1); 04902 mavlink_msg_camera_trigger_decode(&msg, &packet2); 04903 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04904 04905 memset(&packet2, 0, sizeof(packet2)); 04906 mavlink_msg_camera_trigger_pack(system_id, component_id, &msg , packet1.time_usec , packet1.seq ); 04907 mavlink_msg_camera_trigger_decode(&msg, &packet2); 04908 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04909 04910 memset(&packet2, 0, sizeof(packet2)); 04911 mavlink_msg_camera_trigger_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.seq ); 04912 mavlink_msg_camera_trigger_decode(&msg, &packet2); 04913 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04914 04915 memset(&packet2, 0, sizeof(packet2)); 04916 mavlink_msg_to_send_buffer(buffer, &msg); 04917 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04918 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04919 } 04920 mavlink_msg_camera_trigger_decode(last_msg, &packet2); 04921 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04922 04923 memset(&packet2, 0, sizeof(packet2)); 04924 mavlink_msg_camera_trigger_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.seq ); 04925 mavlink_msg_camera_trigger_decode(last_msg, &packet2); 04926 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04927 } 04928 04929 static void mavlink_test_hil_gps(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04930 { 04931 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04932 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04933 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_GPS >= 256) { 04934 return; 04935 } 04936 #endif 04937 mavlink_message_t msg; 04938 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 04939 uint16_t i; 04940 mavlink_hil_gps_t packet_in = { 04941 93372036854775807ULL,963497880,963498088,963498296,18275,18379,18483,18587,18691,18795,18899,235,46 04942 }; 04943 mavlink_hil_gps_t packet1, packet2; 04944 memset(&packet1, 0, sizeof(packet1)); 04945 packet1.time_usec = packet_in.time_usec; 04946 packet1.lat = packet_in.lat; 04947 packet1.lon = packet_in.lon; 04948 packet1.alt = packet_in.alt; 04949 packet1.eph = packet_in.eph; 04950 packet1.epv = packet_in.epv; 04951 packet1.vel = packet_in.vel; 04952 packet1.vn = packet_in.vn; 04953 packet1.ve = packet_in.ve; 04954 packet1.vd = packet_in.vd; 04955 packet1.cog = packet_in.cog; 04956 packet1.fix_type = packet_in.fix_type; 04957 packet1.satellites_visible = packet_in.satellites_visible; 04958 04959 04960 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04961 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 04962 // cope with extensions 04963 memset(MAVLINK_MSG_ID_HIL_GPS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_GPS_MIN_LEN); 04964 } 04965 #endif 04966 memset(&packet2, 0, sizeof(packet2)); 04967 mavlink_msg_hil_gps_encode(system_id, component_id, &msg, &packet1); 04968 mavlink_msg_hil_gps_decode(&msg, &packet2); 04969 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04970 04971 memset(&packet2, 0, sizeof(packet2)); 04972 mavlink_msg_hil_gps_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible ); 04973 mavlink_msg_hil_gps_decode(&msg, &packet2); 04974 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04975 04976 memset(&packet2, 0, sizeof(packet2)); 04977 mavlink_msg_hil_gps_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible ); 04978 mavlink_msg_hil_gps_decode(&msg, &packet2); 04979 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04980 04981 memset(&packet2, 0, sizeof(packet2)); 04982 mavlink_msg_to_send_buffer(buffer, &msg); 04983 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 04984 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 04985 } 04986 mavlink_msg_hil_gps_decode(last_msg, &packet2); 04987 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04988 04989 memset(&packet2, 0, sizeof(packet2)); 04990 mavlink_msg_hil_gps_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible ); 04991 mavlink_msg_hil_gps_decode(last_msg, &packet2); 04992 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 04993 } 04994 04995 static void mavlink_test_hil_optical_flow(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 04996 { 04997 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 04998 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 04999 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_OPTICAL_FLOW >= 256) { 05000 return; 05001 } 05002 #endif 05003 mavlink_message_t msg; 05004 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05005 uint16_t i; 05006 mavlink_hil_optical_flow_t packet_in = { 05007 93372036854775807ULL,963497880,101.0,129.0,157.0,185.0,213.0,963499128,269.0,19315,3,70 05008 }; 05009 mavlink_hil_optical_flow_t packet1, packet2; 05010 memset(&packet1, 0, sizeof(packet1)); 05011 packet1.time_usec = packet_in.time_usec; 05012 packet1.integration_time_us = packet_in.integration_time_us; 05013 packet1.integrated_x = packet_in.integrated_x; 05014 packet1.integrated_y = packet_in.integrated_y; 05015 packet1.integrated_xgyro = packet_in.integrated_xgyro; 05016 packet1.integrated_ygyro = packet_in.integrated_ygyro; 05017 packet1.integrated_zgyro = packet_in.integrated_zgyro; 05018 packet1.time_delta_distance_us = packet_in.time_delta_distance_us; 05019 packet1.distance = packet_in.distance; 05020 packet1.temperature = packet_in.temperature; 05021 packet1.sensor_id = packet_in.sensor_id; 05022 packet1.quality = packet_in.quality; 05023 05024 05025 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05026 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05027 // cope with extensions 05028 memset(MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_MIN_LEN); 05029 } 05030 #endif 05031 memset(&packet2, 0, sizeof(packet2)); 05032 mavlink_msg_hil_optical_flow_encode(system_id, component_id, &msg, &packet1); 05033 mavlink_msg_hil_optical_flow_decode(&msg, &packet2); 05034 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05035 05036 memset(&packet2, 0, sizeof(packet2)); 05037 mavlink_msg_hil_optical_flow_pack(system_id, component_id, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 05038 mavlink_msg_hil_optical_flow_decode(&msg, &packet2); 05039 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05040 05041 memset(&packet2, 0, sizeof(packet2)); 05042 mavlink_msg_hil_optical_flow_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 05043 mavlink_msg_hil_optical_flow_decode(&msg, &packet2); 05044 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05045 05046 memset(&packet2, 0, sizeof(packet2)); 05047 mavlink_msg_to_send_buffer(buffer, &msg); 05048 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05049 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05050 } 05051 mavlink_msg_hil_optical_flow_decode(last_msg, &packet2); 05052 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05053 05054 memset(&packet2, 0, sizeof(packet2)); 05055 mavlink_msg_hil_optical_flow_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.sensor_id , packet1.integration_time_us , packet1.integrated_x , packet1.integrated_y , packet1.integrated_xgyro , packet1.integrated_ygyro , packet1.integrated_zgyro , packet1.temperature , packet1.quality , packet1.time_delta_distance_us , packet1.distance ); 05056 mavlink_msg_hil_optical_flow_decode(last_msg, &packet2); 05057 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05058 } 05059 05060 static void mavlink_test_hil_state_quaternion(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05061 { 05062 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05063 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05064 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIL_STATE_QUATERNION >= 256) { 05065 return; 05066 } 05067 #endif 05068 mavlink_message_t msg; 05069 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05070 uint16_t i; 05071 mavlink_hil_state_quaternion_t packet_in = { 05072 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0,963499336,963499544,963499752,19731,19835,19939,20043,20147,20251,20355,20459 05073 }; 05074 mavlink_hil_state_quaternion_t packet1, packet2; 05075 memset(&packet1, 0, sizeof(packet1)); 05076 packet1.time_usec = packet_in.time_usec; 05077 packet1.rollspeed = packet_in.rollspeed; 05078 packet1.pitchspeed = packet_in.pitchspeed; 05079 packet1.yawspeed = packet_in.yawspeed; 05080 packet1.lat = packet_in.lat; 05081 packet1.lon = packet_in.lon; 05082 packet1.alt = packet_in.alt; 05083 packet1.vx = packet_in.vx; 05084 packet1.vy = packet_in.vy; 05085 packet1.vz = packet_in.vz; 05086 packet1.ind_airspeed = packet_in.ind_airspeed; 05087 packet1.true_airspeed = packet_in.true_airspeed; 05088 packet1.xacc = packet_in.xacc; 05089 packet1.yacc = packet_in.yacc; 05090 packet1.zacc = packet_in.zacc; 05091 05092 mav_array_memcpy(packet1.attitude_quaternion, packet_in.attitude_quaternion, sizeof(float)*4); 05093 05094 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05095 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05096 // cope with extensions 05097 memset(MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIL_STATE_QUATERNION_MIN_LEN); 05098 } 05099 #endif 05100 memset(&packet2, 0, sizeof(packet2)); 05101 mavlink_msg_hil_state_quaternion_encode(system_id, component_id, &msg, &packet1); 05102 mavlink_msg_hil_state_quaternion_decode(&msg, &packet2); 05103 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05104 05105 memset(&packet2, 0, sizeof(packet2)); 05106 mavlink_msg_hil_state_quaternion_pack(system_id, component_id, &msg , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc ); 05107 mavlink_msg_hil_state_quaternion_decode(&msg, &packet2); 05108 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05109 05110 memset(&packet2, 0, sizeof(packet2)); 05111 mavlink_msg_hil_state_quaternion_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc ); 05112 mavlink_msg_hil_state_quaternion_decode(&msg, &packet2); 05113 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05114 05115 memset(&packet2, 0, sizeof(packet2)); 05116 mavlink_msg_to_send_buffer(buffer, &msg); 05117 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05118 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05119 } 05120 mavlink_msg_hil_state_quaternion_decode(last_msg, &packet2); 05121 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05122 05123 memset(&packet2, 0, sizeof(packet2)); 05124 mavlink_msg_hil_state_quaternion_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.attitude_quaternion , packet1.rollspeed , packet1.pitchspeed , packet1.yawspeed , packet1.lat , packet1.lon , packet1.alt , packet1.vx , packet1.vy , packet1.vz , packet1.ind_airspeed , packet1.true_airspeed , packet1.xacc , packet1.yacc , packet1.zacc ); 05125 mavlink_msg_hil_state_quaternion_decode(last_msg, &packet2); 05126 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05127 } 05128 05129 static void mavlink_test_scaled_imu2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05130 { 05131 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05132 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05133 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU2 >= 256) { 05134 return; 05135 } 05136 #endif 05137 mavlink_message_t msg; 05138 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05139 uint16_t i; 05140 mavlink_scaled_imu2_t packet_in = { 05141 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275 05142 }; 05143 mavlink_scaled_imu2_t packet1, packet2; 05144 memset(&packet1, 0, sizeof(packet1)); 05145 packet1.time_boot_ms = packet_in.time_boot_ms; 05146 packet1.xacc = packet_in.xacc; 05147 packet1.yacc = packet_in.yacc; 05148 packet1.zacc = packet_in.zacc; 05149 packet1.xgyro = packet_in.xgyro; 05150 packet1.ygyro = packet_in.ygyro; 05151 packet1.zgyro = packet_in.zgyro; 05152 packet1.xmag = packet_in.xmag; 05153 packet1.ymag = packet_in.ymag; 05154 packet1.zmag = packet_in.zmag; 05155 05156 05157 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05158 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05159 // cope with extensions 05160 memset(MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU2_MIN_LEN); 05161 } 05162 #endif 05163 memset(&packet2, 0, sizeof(packet2)); 05164 mavlink_msg_scaled_imu2_encode(system_id, component_id, &msg, &packet1); 05165 mavlink_msg_scaled_imu2_decode(&msg, &packet2); 05166 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05167 05168 memset(&packet2, 0, sizeof(packet2)); 05169 mavlink_msg_scaled_imu2_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05170 mavlink_msg_scaled_imu2_decode(&msg, &packet2); 05171 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05172 05173 memset(&packet2, 0, sizeof(packet2)); 05174 mavlink_msg_scaled_imu2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05175 mavlink_msg_scaled_imu2_decode(&msg, &packet2); 05176 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05177 05178 memset(&packet2, 0, sizeof(packet2)); 05179 mavlink_msg_to_send_buffer(buffer, &msg); 05180 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05181 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05182 } 05183 mavlink_msg_scaled_imu2_decode(last_msg, &packet2); 05184 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05185 05186 memset(&packet2, 0, sizeof(packet2)); 05187 mavlink_msg_scaled_imu2_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05188 mavlink_msg_scaled_imu2_decode(last_msg, &packet2); 05189 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05190 } 05191 05192 static void mavlink_test_log_request_list(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05193 { 05194 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05195 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05196 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_LIST >= 256) { 05197 return; 05198 } 05199 #endif 05200 mavlink_message_t msg; 05201 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05202 uint16_t i; 05203 mavlink_log_request_list_t packet_in = { 05204 17235,17339,17,84 05205 }; 05206 mavlink_log_request_list_t packet1, packet2; 05207 memset(&packet1, 0, sizeof(packet1)); 05208 packet1.start = packet_in.start; 05209 packet1.end = packet_in.end; 05210 packet1.target_system = packet_in.target_system; 05211 packet1.target_component = packet_in.target_component; 05212 05213 05214 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05215 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05216 // cope with extensions 05217 memset(MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_LIST_MIN_LEN); 05218 } 05219 #endif 05220 memset(&packet2, 0, sizeof(packet2)); 05221 mavlink_msg_log_request_list_encode(system_id, component_id, &msg, &packet1); 05222 mavlink_msg_log_request_list_decode(&msg, &packet2); 05223 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05224 05225 memset(&packet2, 0, sizeof(packet2)); 05226 mavlink_msg_log_request_list_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.start , packet1.end ); 05227 mavlink_msg_log_request_list_decode(&msg, &packet2); 05228 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05229 05230 memset(&packet2, 0, sizeof(packet2)); 05231 mavlink_msg_log_request_list_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.start , packet1.end ); 05232 mavlink_msg_log_request_list_decode(&msg, &packet2); 05233 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05234 05235 memset(&packet2, 0, sizeof(packet2)); 05236 mavlink_msg_to_send_buffer(buffer, &msg); 05237 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05238 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05239 } 05240 mavlink_msg_log_request_list_decode(last_msg, &packet2); 05241 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05242 05243 memset(&packet2, 0, sizeof(packet2)); 05244 mavlink_msg_log_request_list_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.start , packet1.end ); 05245 mavlink_msg_log_request_list_decode(last_msg, &packet2); 05246 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05247 } 05248 05249 static void mavlink_test_log_entry(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05250 { 05251 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05252 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05253 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_ENTRY >= 256) { 05254 return; 05255 } 05256 #endif 05257 mavlink_message_t msg; 05258 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05259 uint16_t i; 05260 mavlink_log_entry_t packet_in = { 05261 963497464,963497672,17651,17755,17859 05262 }; 05263 mavlink_log_entry_t packet1, packet2; 05264 memset(&packet1, 0, sizeof(packet1)); 05265 packet1.time_utc = packet_in.time_utc; 05266 packet1.size = packet_in.size; 05267 packet1.id = packet_in.id; 05268 packet1.num_logs = packet_in.num_logs; 05269 packet1.last_log_num = packet_in.last_log_num; 05270 05271 05272 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05273 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05274 // cope with extensions 05275 memset(MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_ENTRY_MIN_LEN); 05276 } 05277 #endif 05278 memset(&packet2, 0, sizeof(packet2)); 05279 mavlink_msg_log_entry_encode(system_id, component_id, &msg, &packet1); 05280 mavlink_msg_log_entry_decode(&msg, &packet2); 05281 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05282 05283 memset(&packet2, 0, sizeof(packet2)); 05284 mavlink_msg_log_entry_pack(system_id, component_id, &msg , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size ); 05285 mavlink_msg_log_entry_decode(&msg, &packet2); 05286 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05287 05288 memset(&packet2, 0, sizeof(packet2)); 05289 mavlink_msg_log_entry_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size ); 05290 mavlink_msg_log_entry_decode(&msg, &packet2); 05291 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05292 05293 memset(&packet2, 0, sizeof(packet2)); 05294 mavlink_msg_to_send_buffer(buffer, &msg); 05295 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05296 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05297 } 05298 mavlink_msg_log_entry_decode(last_msg, &packet2); 05299 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05300 05301 memset(&packet2, 0, sizeof(packet2)); 05302 mavlink_msg_log_entry_send(MAVLINK_COMM_1 , packet1.id , packet1.num_logs , packet1.last_log_num , packet1.time_utc , packet1.size ); 05303 mavlink_msg_log_entry_decode(last_msg, &packet2); 05304 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05305 } 05306 05307 static void mavlink_test_log_request_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05308 { 05309 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05310 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05311 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_DATA >= 256) { 05312 return; 05313 } 05314 #endif 05315 mavlink_message_t msg; 05316 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05317 uint16_t i; 05318 mavlink_log_request_data_t packet_in = { 05319 963497464,963497672,17651,163,230 05320 }; 05321 mavlink_log_request_data_t packet1, packet2; 05322 memset(&packet1, 0, sizeof(packet1)); 05323 packet1.ofs = packet_in.ofs; 05324 packet1.count = packet_in.count; 05325 packet1.id = packet_in.id; 05326 packet1.target_system = packet_in.target_system; 05327 packet1.target_component = packet_in.target_component; 05328 05329 05330 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05331 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05332 // cope with extensions 05333 memset(MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_DATA_MIN_LEN); 05334 } 05335 #endif 05336 memset(&packet2, 0, sizeof(packet2)); 05337 mavlink_msg_log_request_data_encode(system_id, component_id, &msg, &packet1); 05338 mavlink_msg_log_request_data_decode(&msg, &packet2); 05339 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05340 05341 memset(&packet2, 0, sizeof(packet2)); 05342 mavlink_msg_log_request_data_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count ); 05343 mavlink_msg_log_request_data_decode(&msg, &packet2); 05344 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05345 05346 memset(&packet2, 0, sizeof(packet2)); 05347 mavlink_msg_log_request_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count ); 05348 mavlink_msg_log_request_data_decode(&msg, &packet2); 05349 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05350 05351 memset(&packet2, 0, sizeof(packet2)); 05352 mavlink_msg_to_send_buffer(buffer, &msg); 05353 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05354 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05355 } 05356 mavlink_msg_log_request_data_decode(last_msg, &packet2); 05357 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05358 05359 memset(&packet2, 0, sizeof(packet2)); 05360 mavlink_msg_log_request_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.id , packet1.ofs , packet1.count ); 05361 mavlink_msg_log_request_data_decode(last_msg, &packet2); 05362 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05363 } 05364 05365 static void mavlink_test_log_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05366 { 05367 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05368 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05369 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_DATA >= 256) { 05370 return; 05371 } 05372 #endif 05373 mavlink_message_t msg; 05374 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05375 uint16_t i; 05376 mavlink_log_data_t packet_in = { 05377 963497464,17443,151,{ 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 } 05378 }; 05379 mavlink_log_data_t packet1, packet2; 05380 memset(&packet1, 0, sizeof(packet1)); 05381 packet1.ofs = packet_in.ofs; 05382 packet1.id = packet_in.id; 05383 packet1.count = packet_in.count; 05384 05385 mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*90); 05386 05387 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05388 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05389 // cope with extensions 05390 memset(MAVLINK_MSG_ID_LOG_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_DATA_MIN_LEN); 05391 } 05392 #endif 05393 memset(&packet2, 0, sizeof(packet2)); 05394 mavlink_msg_log_data_encode(system_id, component_id, &msg, &packet1); 05395 mavlink_msg_log_data_decode(&msg, &packet2); 05396 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05397 05398 memset(&packet2, 0, sizeof(packet2)); 05399 mavlink_msg_log_data_pack(system_id, component_id, &msg , packet1.id , packet1.ofs , packet1.count , packet1.data ); 05400 mavlink_msg_log_data_decode(&msg, &packet2); 05401 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05402 05403 memset(&packet2, 0, sizeof(packet2)); 05404 mavlink_msg_log_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.ofs , packet1.count , packet1.data ); 05405 mavlink_msg_log_data_decode(&msg, &packet2); 05406 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05407 05408 memset(&packet2, 0, sizeof(packet2)); 05409 mavlink_msg_to_send_buffer(buffer, &msg); 05410 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05411 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05412 } 05413 mavlink_msg_log_data_decode(last_msg, &packet2); 05414 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05415 05416 memset(&packet2, 0, sizeof(packet2)); 05417 mavlink_msg_log_data_send(MAVLINK_COMM_1 , packet1.id , packet1.ofs , packet1.count , packet1.data ); 05418 mavlink_msg_log_data_decode(last_msg, &packet2); 05419 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05420 } 05421 05422 static void mavlink_test_log_erase(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05423 { 05424 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05425 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05426 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_ERASE >= 256) { 05427 return; 05428 } 05429 #endif 05430 mavlink_message_t msg; 05431 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05432 uint16_t i; 05433 mavlink_log_erase_t packet_in = { 05434 5,72 05435 }; 05436 mavlink_log_erase_t packet1, packet2; 05437 memset(&packet1, 0, sizeof(packet1)); 05438 packet1.target_system = packet_in.target_system; 05439 packet1.target_component = packet_in.target_component; 05440 05441 05442 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05443 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05444 // cope with extensions 05445 memset(MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_ERASE_MIN_LEN); 05446 } 05447 #endif 05448 memset(&packet2, 0, sizeof(packet2)); 05449 mavlink_msg_log_erase_encode(system_id, component_id, &msg, &packet1); 05450 mavlink_msg_log_erase_decode(&msg, &packet2); 05451 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05452 05453 memset(&packet2, 0, sizeof(packet2)); 05454 mavlink_msg_log_erase_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); 05455 mavlink_msg_log_erase_decode(&msg, &packet2); 05456 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05457 05458 memset(&packet2, 0, sizeof(packet2)); 05459 mavlink_msg_log_erase_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); 05460 mavlink_msg_log_erase_decode(&msg, &packet2); 05461 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05462 05463 memset(&packet2, 0, sizeof(packet2)); 05464 mavlink_msg_to_send_buffer(buffer, &msg); 05465 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05466 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05467 } 05468 mavlink_msg_log_erase_decode(last_msg, &packet2); 05469 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05470 05471 memset(&packet2, 0, sizeof(packet2)); 05472 mavlink_msg_log_erase_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); 05473 mavlink_msg_log_erase_decode(last_msg, &packet2); 05474 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05475 } 05476 05477 static void mavlink_test_log_request_end(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05478 { 05479 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05480 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05481 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LOG_REQUEST_END >= 256) { 05482 return; 05483 } 05484 #endif 05485 mavlink_message_t msg; 05486 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05487 uint16_t i; 05488 mavlink_log_request_end_t packet_in = { 05489 5,72 05490 }; 05491 mavlink_log_request_end_t packet1, packet2; 05492 memset(&packet1, 0, sizeof(packet1)); 05493 packet1.target_system = packet_in.target_system; 05494 packet1.target_component = packet_in.target_component; 05495 05496 05497 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05498 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05499 // cope with extensions 05500 memset(MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LOG_REQUEST_END_MIN_LEN); 05501 } 05502 #endif 05503 memset(&packet2, 0, sizeof(packet2)); 05504 mavlink_msg_log_request_end_encode(system_id, component_id, &msg, &packet1); 05505 mavlink_msg_log_request_end_decode(&msg, &packet2); 05506 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05507 05508 memset(&packet2, 0, sizeof(packet2)); 05509 mavlink_msg_log_request_end_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component ); 05510 mavlink_msg_log_request_end_decode(&msg, &packet2); 05511 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05512 05513 memset(&packet2, 0, sizeof(packet2)); 05514 mavlink_msg_log_request_end_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component ); 05515 mavlink_msg_log_request_end_decode(&msg, &packet2); 05516 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05517 05518 memset(&packet2, 0, sizeof(packet2)); 05519 mavlink_msg_to_send_buffer(buffer, &msg); 05520 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05521 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05522 } 05523 mavlink_msg_log_request_end_decode(last_msg, &packet2); 05524 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05525 05526 memset(&packet2, 0, sizeof(packet2)); 05527 mavlink_msg_log_request_end_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component ); 05528 mavlink_msg_log_request_end_decode(last_msg, &packet2); 05529 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05530 } 05531 05532 static void mavlink_test_gps_inject_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05533 { 05534 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05535 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05536 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_INJECT_DATA >= 256) { 05537 return; 05538 } 05539 #endif 05540 mavlink_message_t msg; 05541 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05542 uint16_t i; 05543 mavlink_gps_inject_data_t packet_in = { 05544 5,72,139,{ 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 } 05545 }; 05546 mavlink_gps_inject_data_t packet1, packet2; 05547 memset(&packet1, 0, sizeof(packet1)); 05548 packet1.target_system = packet_in.target_system; 05549 packet1.target_component = packet_in.target_component; 05550 packet1.len = packet_in.len; 05551 05552 mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*110); 05553 05554 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05555 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05556 // cope with extensions 05557 memset(MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_INJECT_DATA_MIN_LEN); 05558 } 05559 #endif 05560 memset(&packet2, 0, sizeof(packet2)); 05561 mavlink_msg_gps_inject_data_encode(system_id, component_id, &msg, &packet1); 05562 mavlink_msg_gps_inject_data_decode(&msg, &packet2); 05563 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05564 05565 memset(&packet2, 0, sizeof(packet2)); 05566 mavlink_msg_gps_inject_data_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.len , packet1.data ); 05567 mavlink_msg_gps_inject_data_decode(&msg, &packet2); 05568 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05569 05570 memset(&packet2, 0, sizeof(packet2)); 05571 mavlink_msg_gps_inject_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.len , packet1.data ); 05572 mavlink_msg_gps_inject_data_decode(&msg, &packet2); 05573 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05574 05575 memset(&packet2, 0, sizeof(packet2)); 05576 mavlink_msg_to_send_buffer(buffer, &msg); 05577 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05578 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05579 } 05580 mavlink_msg_gps_inject_data_decode(last_msg, &packet2); 05581 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05582 05583 memset(&packet2, 0, sizeof(packet2)); 05584 mavlink_msg_gps_inject_data_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.len , packet1.data ); 05585 mavlink_msg_gps_inject_data_decode(last_msg, &packet2); 05586 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05587 } 05588 05589 static void mavlink_test_gps2_raw(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05590 { 05591 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05592 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05593 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS2_RAW >= 256) { 05594 return; 05595 } 05596 #endif 05597 mavlink_message_t msg; 05598 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05599 uint16_t i; 05600 mavlink_gps2_raw_t packet_in = { 05601 93372036854775807ULL,963497880,963498088,963498296,963498504,18483,18587,18691,18795,101,168,235 05602 }; 05603 mavlink_gps2_raw_t packet1, packet2; 05604 memset(&packet1, 0, sizeof(packet1)); 05605 packet1.time_usec = packet_in.time_usec; 05606 packet1.lat = packet_in.lat; 05607 packet1.lon = packet_in.lon; 05608 packet1.alt = packet_in.alt; 05609 packet1.dgps_age = packet_in.dgps_age; 05610 packet1.eph = packet_in.eph; 05611 packet1.epv = packet_in.epv; 05612 packet1.vel = packet_in.vel; 05613 packet1.cog = packet_in.cog; 05614 packet1.fix_type = packet_in.fix_type; 05615 packet1.satellites_visible = packet_in.satellites_visible; 05616 packet1.dgps_numch = packet_in.dgps_numch; 05617 05618 05619 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05620 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05621 // cope with extensions 05622 memset(MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS2_RAW_MIN_LEN); 05623 } 05624 #endif 05625 memset(&packet2, 0, sizeof(packet2)); 05626 mavlink_msg_gps2_raw_encode(system_id, component_id, &msg, &packet1); 05627 mavlink_msg_gps2_raw_decode(&msg, &packet2); 05628 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05629 05630 memset(&packet2, 0, sizeof(packet2)); 05631 mavlink_msg_gps2_raw_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age ); 05632 mavlink_msg_gps2_raw_decode(&msg, &packet2); 05633 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05634 05635 memset(&packet2, 0, sizeof(packet2)); 05636 mavlink_msg_gps2_raw_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age ); 05637 mavlink_msg_gps2_raw_decode(&msg, &packet2); 05638 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05639 05640 memset(&packet2, 0, sizeof(packet2)); 05641 mavlink_msg_to_send_buffer(buffer, &msg); 05642 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05643 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05644 } 05645 mavlink_msg_gps2_raw_decode(last_msg, &packet2); 05646 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05647 05648 memset(&packet2, 0, sizeof(packet2)); 05649 mavlink_msg_gps2_raw_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.cog , packet1.satellites_visible , packet1.dgps_numch , packet1.dgps_age ); 05650 mavlink_msg_gps2_raw_decode(last_msg, &packet2); 05651 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05652 } 05653 05654 static void mavlink_test_power_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05655 { 05656 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05657 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05658 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_POWER_STATUS >= 256) { 05659 return; 05660 } 05661 #endif 05662 mavlink_message_t msg; 05663 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05664 uint16_t i; 05665 mavlink_power_status_t packet_in = { 05666 17235,17339,17443 05667 }; 05668 mavlink_power_status_t packet1, packet2; 05669 memset(&packet1, 0, sizeof(packet1)); 05670 packet1.Vcc = packet_in.Vcc; 05671 packet1.Vservo = packet_in.Vservo; 05672 packet1.flags = packet_in.flags; 05673 05674 05675 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05676 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05677 // cope with extensions 05678 memset(MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_POWER_STATUS_MIN_LEN); 05679 } 05680 #endif 05681 memset(&packet2, 0, sizeof(packet2)); 05682 mavlink_msg_power_status_encode(system_id, component_id, &msg, &packet1); 05683 mavlink_msg_power_status_decode(&msg, &packet2); 05684 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05685 05686 memset(&packet2, 0, sizeof(packet2)); 05687 mavlink_msg_power_status_pack(system_id, component_id, &msg , packet1.Vcc , packet1.Vservo , packet1.flags ); 05688 mavlink_msg_power_status_decode(&msg, &packet2); 05689 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05690 05691 memset(&packet2, 0, sizeof(packet2)); 05692 mavlink_msg_power_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.Vcc , packet1.Vservo , packet1.flags ); 05693 mavlink_msg_power_status_decode(&msg, &packet2); 05694 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05695 05696 memset(&packet2, 0, sizeof(packet2)); 05697 mavlink_msg_to_send_buffer(buffer, &msg); 05698 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05699 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05700 } 05701 mavlink_msg_power_status_decode(last_msg, &packet2); 05702 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05703 05704 memset(&packet2, 0, sizeof(packet2)); 05705 mavlink_msg_power_status_send(MAVLINK_COMM_1 , packet1.Vcc , packet1.Vservo , packet1.flags ); 05706 mavlink_msg_power_status_decode(last_msg, &packet2); 05707 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05708 } 05709 05710 static void mavlink_test_serial_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05711 { 05712 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05713 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05714 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SERIAL_CONTROL >= 256) { 05715 return; 05716 } 05717 #endif 05718 mavlink_message_t msg; 05719 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05720 uint16_t i; 05721 mavlink_serial_control_t packet_in = { 05722 963497464,17443,151,218,29,{ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165 } 05723 }; 05724 mavlink_serial_control_t packet1, packet2; 05725 memset(&packet1, 0, sizeof(packet1)); 05726 packet1.baudrate = packet_in.baudrate; 05727 packet1.timeout = packet_in.timeout; 05728 packet1.device = packet_in.device; 05729 packet1.flags = packet_in.flags; 05730 packet1.count = packet_in.count; 05731 05732 mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*70); 05733 05734 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05735 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05736 // cope with extensions 05737 memset(MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SERIAL_CONTROL_MIN_LEN); 05738 } 05739 #endif 05740 memset(&packet2, 0, sizeof(packet2)); 05741 mavlink_msg_serial_control_encode(system_id, component_id, &msg, &packet1); 05742 mavlink_msg_serial_control_decode(&msg, &packet2); 05743 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05744 05745 memset(&packet2, 0, sizeof(packet2)); 05746 mavlink_msg_serial_control_pack(system_id, component_id, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); 05747 mavlink_msg_serial_control_decode(&msg, &packet2); 05748 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05749 05750 memset(&packet2, 0, sizeof(packet2)); 05751 mavlink_msg_serial_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); 05752 mavlink_msg_serial_control_decode(&msg, &packet2); 05753 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05754 05755 memset(&packet2, 0, sizeof(packet2)); 05756 mavlink_msg_to_send_buffer(buffer, &msg); 05757 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05758 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05759 } 05760 mavlink_msg_serial_control_decode(last_msg, &packet2); 05761 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05762 05763 memset(&packet2, 0, sizeof(packet2)); 05764 mavlink_msg_serial_control_send(MAVLINK_COMM_1 , packet1.device , packet1.flags , packet1.timeout , packet1.baudrate , packet1.count , packet1.data ); 05765 mavlink_msg_serial_control_decode(last_msg, &packet2); 05766 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05767 } 05768 05769 static void mavlink_test_gps_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05770 { 05771 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05772 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05773 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RTK >= 256) { 05774 return; 05775 } 05776 #endif 05777 mavlink_message_t msg; 05778 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05779 uint16_t i; 05780 mavlink_gps_rtk_t packet_in = { 05781 963497464,963497672,963497880,963498088,963498296,963498504,963498712,18691,223,34,101,168,235 05782 }; 05783 mavlink_gps_rtk_t packet1, packet2; 05784 memset(&packet1, 0, sizeof(packet1)); 05785 packet1.time_last_baseline_ms = packet_in.time_last_baseline_ms; 05786 packet1.tow = packet_in.tow; 05787 packet1.baseline_a_mm = packet_in.baseline_a_mm; 05788 packet1.baseline_b_mm = packet_in.baseline_b_mm; 05789 packet1.baseline_c_mm = packet_in.baseline_c_mm; 05790 packet1.accuracy = packet_in.accuracy; 05791 packet1.iar_num_hypotheses = packet_in.iar_num_hypotheses; 05792 packet1.wn = packet_in.wn; 05793 packet1.rtk_receiver_id = packet_in.rtk_receiver_id; 05794 packet1.rtk_health = packet_in.rtk_health; 05795 packet1.rtk_rate = packet_in.rtk_rate; 05796 packet1.nsats = packet_in.nsats; 05797 packet1.baseline_coords_type = packet_in.baseline_coords_type; 05798 05799 05800 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05801 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05802 // cope with extensions 05803 memset(MAVLINK_MSG_ID_GPS_RTK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RTK_MIN_LEN); 05804 } 05805 #endif 05806 memset(&packet2, 0, sizeof(packet2)); 05807 mavlink_msg_gps_rtk_encode(system_id, component_id, &msg, &packet1); 05808 mavlink_msg_gps_rtk_decode(&msg, &packet2); 05809 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05810 05811 memset(&packet2, 0, sizeof(packet2)); 05812 mavlink_msg_gps_rtk_pack(system_id, component_id, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05813 mavlink_msg_gps_rtk_decode(&msg, &packet2); 05814 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05815 05816 memset(&packet2, 0, sizeof(packet2)); 05817 mavlink_msg_gps_rtk_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05818 mavlink_msg_gps_rtk_decode(&msg, &packet2); 05819 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05820 05821 memset(&packet2, 0, sizeof(packet2)); 05822 mavlink_msg_to_send_buffer(buffer, &msg); 05823 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05824 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05825 } 05826 mavlink_msg_gps_rtk_decode(last_msg, &packet2); 05827 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05828 05829 memset(&packet2, 0, sizeof(packet2)); 05830 mavlink_msg_gps_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05831 mavlink_msg_gps_rtk_decode(last_msg, &packet2); 05832 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05833 } 05834 05835 static void mavlink_test_gps2_rtk(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05836 { 05837 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05838 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05839 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS2_RTK >= 256) { 05840 return; 05841 } 05842 #endif 05843 mavlink_message_t msg; 05844 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05845 uint16_t i; 05846 mavlink_gps2_rtk_t packet_in = { 05847 963497464,963497672,963497880,963498088,963498296,963498504,963498712,18691,223,34,101,168,235 05848 }; 05849 mavlink_gps2_rtk_t packet1, packet2; 05850 memset(&packet1, 0, sizeof(packet1)); 05851 packet1.time_last_baseline_ms = packet_in.time_last_baseline_ms; 05852 packet1.tow = packet_in.tow; 05853 packet1.baseline_a_mm = packet_in.baseline_a_mm; 05854 packet1.baseline_b_mm = packet_in.baseline_b_mm; 05855 packet1.baseline_c_mm = packet_in.baseline_c_mm; 05856 packet1.accuracy = packet_in.accuracy; 05857 packet1.iar_num_hypotheses = packet_in.iar_num_hypotheses; 05858 packet1.wn = packet_in.wn; 05859 packet1.rtk_receiver_id = packet_in.rtk_receiver_id; 05860 packet1.rtk_health = packet_in.rtk_health; 05861 packet1.rtk_rate = packet_in.rtk_rate; 05862 packet1.nsats = packet_in.nsats; 05863 packet1.baseline_coords_type = packet_in.baseline_coords_type; 05864 05865 05866 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05867 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05868 // cope with extensions 05869 memset(MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS2_RTK_MIN_LEN); 05870 } 05871 #endif 05872 memset(&packet2, 0, sizeof(packet2)); 05873 mavlink_msg_gps2_rtk_encode(system_id, component_id, &msg, &packet1); 05874 mavlink_msg_gps2_rtk_decode(&msg, &packet2); 05875 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05876 05877 memset(&packet2, 0, sizeof(packet2)); 05878 mavlink_msg_gps2_rtk_pack(system_id, component_id, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05879 mavlink_msg_gps2_rtk_decode(&msg, &packet2); 05880 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05881 05882 memset(&packet2, 0, sizeof(packet2)); 05883 mavlink_msg_gps2_rtk_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05884 mavlink_msg_gps2_rtk_decode(&msg, &packet2); 05885 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05886 05887 memset(&packet2, 0, sizeof(packet2)); 05888 mavlink_msg_to_send_buffer(buffer, &msg); 05889 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05890 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05891 } 05892 mavlink_msg_gps2_rtk_decode(last_msg, &packet2); 05893 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05894 05895 memset(&packet2, 0, sizeof(packet2)); 05896 mavlink_msg_gps2_rtk_send(MAVLINK_COMM_1 , packet1.time_last_baseline_ms , packet1.rtk_receiver_id , packet1.wn , packet1.tow , packet1.rtk_health , packet1.rtk_rate , packet1.nsats , packet1.baseline_coords_type , packet1.baseline_a_mm , packet1.baseline_b_mm , packet1.baseline_c_mm , packet1.accuracy , packet1.iar_num_hypotheses ); 05897 mavlink_msg_gps2_rtk_decode(last_msg, &packet2); 05898 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05899 } 05900 05901 static void mavlink_test_scaled_imu3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05902 { 05903 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05904 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05905 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_IMU3 >= 256) { 05906 return; 05907 } 05908 #endif 05909 mavlink_message_t msg; 05910 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05911 uint16_t i; 05912 mavlink_scaled_imu3_t packet_in = { 05913 963497464,17443,17547,17651,17755,17859,17963,18067,18171,18275 05914 }; 05915 mavlink_scaled_imu3_t packet1, packet2; 05916 memset(&packet1, 0, sizeof(packet1)); 05917 packet1.time_boot_ms = packet_in.time_boot_ms; 05918 packet1.xacc = packet_in.xacc; 05919 packet1.yacc = packet_in.yacc; 05920 packet1.zacc = packet_in.zacc; 05921 packet1.xgyro = packet_in.xgyro; 05922 packet1.ygyro = packet_in.ygyro; 05923 packet1.zgyro = packet_in.zgyro; 05924 packet1.xmag = packet_in.xmag; 05925 packet1.ymag = packet_in.ymag; 05926 packet1.zmag = packet_in.zmag; 05927 05928 05929 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05930 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05931 // cope with extensions 05932 memset(MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_IMU3_MIN_LEN); 05933 } 05934 #endif 05935 memset(&packet2, 0, sizeof(packet2)); 05936 mavlink_msg_scaled_imu3_encode(system_id, component_id, &msg, &packet1); 05937 mavlink_msg_scaled_imu3_decode(&msg, &packet2); 05938 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05939 05940 memset(&packet2, 0, sizeof(packet2)); 05941 mavlink_msg_scaled_imu3_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05942 mavlink_msg_scaled_imu3_decode(&msg, &packet2); 05943 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05944 05945 memset(&packet2, 0, sizeof(packet2)); 05946 mavlink_msg_scaled_imu3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05947 mavlink_msg_scaled_imu3_decode(&msg, &packet2); 05948 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05949 05950 memset(&packet2, 0, sizeof(packet2)); 05951 mavlink_msg_to_send_buffer(buffer, &msg); 05952 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 05953 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 05954 } 05955 mavlink_msg_scaled_imu3_decode(last_msg, &packet2); 05956 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05957 05958 memset(&packet2, 0, sizeof(packet2)); 05959 mavlink_msg_scaled_imu3_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag ); 05960 mavlink_msg_scaled_imu3_decode(last_msg, &packet2); 05961 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05962 } 05963 05964 static void mavlink_test_data_transmission_handshake(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 05965 { 05966 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05967 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 05968 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE >= 256) { 05969 return; 05970 } 05971 #endif 05972 mavlink_message_t msg; 05973 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 05974 uint16_t i; 05975 mavlink_data_transmission_handshake_t packet_in = { 05976 963497464,17443,17547,17651,163,230,41 05977 }; 05978 mavlink_data_transmission_handshake_t packet1, packet2; 05979 memset(&packet1, 0, sizeof(packet1)); 05980 packet1.size = packet_in.size; 05981 packet1.width = packet_in.width; 05982 packet1.height = packet_in.height; 05983 packet1.packets = packet_in.packets; 05984 packet1.type = packet_in.type; 05985 packet1.payload = packet_in.payload; 05986 packet1.jpg_quality = packet_in.jpg_quality; 05987 05988 05989 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 05990 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 05991 // cope with extensions 05992 memset(MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DATA_TRANSMISSION_HANDSHAKE_MIN_LEN); 05993 } 05994 #endif 05995 memset(&packet2, 0, sizeof(packet2)); 05996 mavlink_msg_data_transmission_handshake_encode(system_id, component_id, &msg, &packet1); 05997 mavlink_msg_data_transmission_handshake_decode(&msg, &packet2); 05998 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 05999 06000 memset(&packet2, 0, sizeof(packet2)); 06001 mavlink_msg_data_transmission_handshake_pack(system_id, component_id, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality ); 06002 mavlink_msg_data_transmission_handshake_decode(&msg, &packet2); 06003 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06004 06005 memset(&packet2, 0, sizeof(packet2)); 06006 mavlink_msg_data_transmission_handshake_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality ); 06007 mavlink_msg_data_transmission_handshake_decode(&msg, &packet2); 06008 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06009 06010 memset(&packet2, 0, sizeof(packet2)); 06011 mavlink_msg_to_send_buffer(buffer, &msg); 06012 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06013 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06014 } 06015 mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2); 06016 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06017 06018 memset(&packet2, 0, sizeof(packet2)); 06019 mavlink_msg_data_transmission_handshake_send(MAVLINK_COMM_1 , packet1.type , packet1.size , packet1.width , packet1.height , packet1.packets , packet1.payload , packet1.jpg_quality ); 06020 mavlink_msg_data_transmission_handshake_decode(last_msg, &packet2); 06021 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06022 } 06023 06024 static void mavlink_test_encapsulated_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06025 { 06026 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06027 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06028 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ENCAPSULATED_DATA >= 256) { 06029 return; 06030 } 06031 #endif 06032 mavlink_message_t msg; 06033 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06034 uint16_t i; 06035 mavlink_encapsulated_data_t packet_in = { 06036 17235,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135 } 06037 }; 06038 mavlink_encapsulated_data_t packet1, packet2; 06039 memset(&packet1, 0, sizeof(packet1)); 06040 packet1.seqnr = packet_in.seqnr; 06041 06042 mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*253); 06043 06044 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06045 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06046 // cope with extensions 06047 memset(MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ENCAPSULATED_DATA_MIN_LEN); 06048 } 06049 #endif 06050 memset(&packet2, 0, sizeof(packet2)); 06051 mavlink_msg_encapsulated_data_encode(system_id, component_id, &msg, &packet1); 06052 mavlink_msg_encapsulated_data_decode(&msg, &packet2); 06053 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06054 06055 memset(&packet2, 0, sizeof(packet2)); 06056 mavlink_msg_encapsulated_data_pack(system_id, component_id, &msg , packet1.seqnr , packet1.data ); 06057 mavlink_msg_encapsulated_data_decode(&msg, &packet2); 06058 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06059 06060 memset(&packet2, 0, sizeof(packet2)); 06061 mavlink_msg_encapsulated_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.seqnr , packet1.data ); 06062 mavlink_msg_encapsulated_data_decode(&msg, &packet2); 06063 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06064 06065 memset(&packet2, 0, sizeof(packet2)); 06066 mavlink_msg_to_send_buffer(buffer, &msg); 06067 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06068 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06069 } 06070 mavlink_msg_encapsulated_data_decode(last_msg, &packet2); 06071 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06072 06073 memset(&packet2, 0, sizeof(packet2)); 06074 mavlink_msg_encapsulated_data_send(MAVLINK_COMM_1 , packet1.seqnr , packet1.data ); 06075 mavlink_msg_encapsulated_data_decode(last_msg, &packet2); 06076 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06077 } 06078 06079 static void mavlink_test_distance_sensor(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06080 { 06081 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06082 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06083 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DISTANCE_SENSOR >= 256) { 06084 return; 06085 } 06086 #endif 06087 mavlink_message_t msg; 06088 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06089 uint16_t i; 06090 mavlink_distance_sensor_t packet_in = { 06091 963497464,17443,17547,17651,163,230,41,108 06092 }; 06093 mavlink_distance_sensor_t packet1, packet2; 06094 memset(&packet1, 0, sizeof(packet1)); 06095 packet1.time_boot_ms = packet_in.time_boot_ms; 06096 packet1.min_distance = packet_in.min_distance; 06097 packet1.max_distance = packet_in.max_distance; 06098 packet1.current_distance = packet_in.current_distance; 06099 packet1.type = packet_in.type; 06100 packet1.id = packet_in.id; 06101 packet1.orientation = packet_in.orientation; 06102 packet1.covariance = packet_in.covariance; 06103 06104 06105 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06106 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06107 // cope with extensions 06108 memset(MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DISTANCE_SENSOR_MIN_LEN); 06109 } 06110 #endif 06111 memset(&packet2, 0, sizeof(packet2)); 06112 mavlink_msg_distance_sensor_encode(system_id, component_id, &msg, &packet1); 06113 mavlink_msg_distance_sensor_decode(&msg, &packet2); 06114 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06115 06116 memset(&packet2, 0, sizeof(packet2)); 06117 mavlink_msg_distance_sensor_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance ); 06118 mavlink_msg_distance_sensor_decode(&msg, &packet2); 06119 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06120 06121 memset(&packet2, 0, sizeof(packet2)); 06122 mavlink_msg_distance_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance ); 06123 mavlink_msg_distance_sensor_decode(&msg, &packet2); 06124 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06125 06126 memset(&packet2, 0, sizeof(packet2)); 06127 mavlink_msg_to_send_buffer(buffer, &msg); 06128 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06129 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06130 } 06131 mavlink_msg_distance_sensor_decode(last_msg, &packet2); 06132 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06133 06134 memset(&packet2, 0, sizeof(packet2)); 06135 mavlink_msg_distance_sensor_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.min_distance , packet1.max_distance , packet1.current_distance , packet1.type , packet1.id , packet1.orientation , packet1.covariance ); 06136 mavlink_msg_distance_sensor_decode(last_msg, &packet2); 06137 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06138 } 06139 06140 static void mavlink_test_terrain_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06141 { 06142 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06143 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06144 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_REQUEST >= 256) { 06145 return; 06146 } 06147 #endif 06148 mavlink_message_t msg; 06149 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06150 uint16_t i; 06151 mavlink_terrain_request_t packet_in = { 06152 93372036854775807ULL,963497880,963498088,18067 06153 }; 06154 mavlink_terrain_request_t packet1, packet2; 06155 memset(&packet1, 0, sizeof(packet1)); 06156 packet1.mask = packet_in.mask; 06157 packet1.lat = packet_in.lat; 06158 packet1.lon = packet_in.lon; 06159 packet1.grid_spacing = packet_in.grid_spacing; 06160 06161 06162 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06163 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06164 // cope with extensions 06165 memset(MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_REQUEST_MIN_LEN); 06166 } 06167 #endif 06168 memset(&packet2, 0, sizeof(packet2)); 06169 mavlink_msg_terrain_request_encode(system_id, component_id, &msg, &packet1); 06170 mavlink_msg_terrain_request_decode(&msg, &packet2); 06171 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06172 06173 memset(&packet2, 0, sizeof(packet2)); 06174 mavlink_msg_terrain_request_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask ); 06175 mavlink_msg_terrain_request_decode(&msg, &packet2); 06176 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06177 06178 memset(&packet2, 0, sizeof(packet2)); 06179 mavlink_msg_terrain_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask ); 06180 mavlink_msg_terrain_request_decode(&msg, &packet2); 06181 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06182 06183 memset(&packet2, 0, sizeof(packet2)); 06184 mavlink_msg_to_send_buffer(buffer, &msg); 06185 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06186 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06187 } 06188 mavlink_msg_terrain_request_decode(last_msg, &packet2); 06189 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06190 06191 memset(&packet2, 0, sizeof(packet2)); 06192 mavlink_msg_terrain_request_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.mask ); 06193 mavlink_msg_terrain_request_decode(last_msg, &packet2); 06194 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06195 } 06196 06197 static void mavlink_test_terrain_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06198 { 06199 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06200 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06201 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_DATA >= 256) { 06202 return; 06203 } 06204 #endif 06205 mavlink_message_t msg; 06206 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06207 uint16_t i; 06208 mavlink_terrain_data_t packet_in = { 06209 963497464,963497672,17651,{ 17755, 17756, 17757, 17758, 17759, 17760, 17761, 17762, 17763, 17764, 17765, 17766, 17767, 17768, 17769, 17770 },3 06210 }; 06211 mavlink_terrain_data_t packet1, packet2; 06212 memset(&packet1, 0, sizeof(packet1)); 06213 packet1.lat = packet_in.lat; 06214 packet1.lon = packet_in.lon; 06215 packet1.grid_spacing = packet_in.grid_spacing; 06216 packet1.gridbit = packet_in.gridbit; 06217 06218 mav_array_memcpy(packet1.data, packet_in.data, sizeof(int16_t)*16); 06219 06220 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06221 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06222 // cope with extensions 06223 memset(MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_DATA_MIN_LEN); 06224 } 06225 #endif 06226 memset(&packet2, 0, sizeof(packet2)); 06227 mavlink_msg_terrain_data_encode(system_id, component_id, &msg, &packet1); 06228 mavlink_msg_terrain_data_decode(&msg, &packet2); 06229 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06230 06231 memset(&packet2, 0, sizeof(packet2)); 06232 mavlink_msg_terrain_data_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data ); 06233 mavlink_msg_terrain_data_decode(&msg, &packet2); 06234 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06235 06236 memset(&packet2, 0, sizeof(packet2)); 06237 mavlink_msg_terrain_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data ); 06238 mavlink_msg_terrain_data_decode(&msg, &packet2); 06239 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06240 06241 memset(&packet2, 0, sizeof(packet2)); 06242 mavlink_msg_to_send_buffer(buffer, &msg); 06243 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06244 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06245 } 06246 mavlink_msg_terrain_data_decode(last_msg, &packet2); 06247 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06248 06249 memset(&packet2, 0, sizeof(packet2)); 06250 mavlink_msg_terrain_data_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.grid_spacing , packet1.gridbit , packet1.data ); 06251 mavlink_msg_terrain_data_decode(last_msg, &packet2); 06252 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06253 } 06254 06255 static void mavlink_test_terrain_check(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06256 { 06257 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06258 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06259 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_CHECK >= 256) { 06260 return; 06261 } 06262 #endif 06263 mavlink_message_t msg; 06264 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06265 uint16_t i; 06266 mavlink_terrain_check_t packet_in = { 06267 963497464,963497672 06268 }; 06269 mavlink_terrain_check_t packet1, packet2; 06270 memset(&packet1, 0, sizeof(packet1)); 06271 packet1.lat = packet_in.lat; 06272 packet1.lon = packet_in.lon; 06273 06274 06275 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06276 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06277 // cope with extensions 06278 memset(MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_CHECK_MIN_LEN); 06279 } 06280 #endif 06281 memset(&packet2, 0, sizeof(packet2)); 06282 mavlink_msg_terrain_check_encode(system_id, component_id, &msg, &packet1); 06283 mavlink_msg_terrain_check_decode(&msg, &packet2); 06284 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06285 06286 memset(&packet2, 0, sizeof(packet2)); 06287 mavlink_msg_terrain_check_pack(system_id, component_id, &msg , packet1.lat , packet1.lon ); 06288 mavlink_msg_terrain_check_decode(&msg, &packet2); 06289 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06290 06291 memset(&packet2, 0, sizeof(packet2)); 06292 mavlink_msg_terrain_check_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon ); 06293 mavlink_msg_terrain_check_decode(&msg, &packet2); 06294 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06295 06296 memset(&packet2, 0, sizeof(packet2)); 06297 mavlink_msg_to_send_buffer(buffer, &msg); 06298 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06299 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06300 } 06301 mavlink_msg_terrain_check_decode(last_msg, &packet2); 06302 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06303 06304 memset(&packet2, 0, sizeof(packet2)); 06305 mavlink_msg_terrain_check_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon ); 06306 mavlink_msg_terrain_check_decode(last_msg, &packet2); 06307 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06308 } 06309 06310 static void mavlink_test_terrain_report(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06311 { 06312 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06313 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06314 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_TERRAIN_REPORT >= 256) { 06315 return; 06316 } 06317 #endif 06318 mavlink_message_t msg; 06319 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06320 uint16_t i; 06321 mavlink_terrain_report_t packet_in = { 06322 963497464,963497672,73.0,101.0,18067,18171,18275 06323 }; 06324 mavlink_terrain_report_t packet1, packet2; 06325 memset(&packet1, 0, sizeof(packet1)); 06326 packet1.lat = packet_in.lat; 06327 packet1.lon = packet_in.lon; 06328 packet1.terrain_height = packet_in.terrain_height; 06329 packet1.current_height = packet_in.current_height; 06330 packet1.spacing = packet_in.spacing; 06331 packet1.pending = packet_in.pending; 06332 packet1.loaded = packet_in.loaded; 06333 06334 06335 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06336 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06337 // cope with extensions 06338 memset(MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_TERRAIN_REPORT_MIN_LEN); 06339 } 06340 #endif 06341 memset(&packet2, 0, sizeof(packet2)); 06342 mavlink_msg_terrain_report_encode(system_id, component_id, &msg, &packet1); 06343 mavlink_msg_terrain_report_decode(&msg, &packet2); 06344 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06345 06346 memset(&packet2, 0, sizeof(packet2)); 06347 mavlink_msg_terrain_report_pack(system_id, component_id, &msg , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded ); 06348 mavlink_msg_terrain_report_decode(&msg, &packet2); 06349 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06350 06351 memset(&packet2, 0, sizeof(packet2)); 06352 mavlink_msg_terrain_report_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded ); 06353 mavlink_msg_terrain_report_decode(&msg, &packet2); 06354 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06355 06356 memset(&packet2, 0, sizeof(packet2)); 06357 mavlink_msg_to_send_buffer(buffer, &msg); 06358 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06359 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06360 } 06361 mavlink_msg_terrain_report_decode(last_msg, &packet2); 06362 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06363 06364 memset(&packet2, 0, sizeof(packet2)); 06365 mavlink_msg_terrain_report_send(MAVLINK_COMM_1 , packet1.lat , packet1.lon , packet1.spacing , packet1.terrain_height , packet1.current_height , packet1.pending , packet1.loaded ); 06366 mavlink_msg_terrain_report_decode(last_msg, &packet2); 06367 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06368 } 06369 06370 static void mavlink_test_scaled_pressure2(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06371 { 06372 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06373 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06374 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE2 >= 256) { 06375 return; 06376 } 06377 #endif 06378 mavlink_message_t msg; 06379 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06380 uint16_t i; 06381 mavlink_scaled_pressure2_t packet_in = { 06382 963497464,45.0,73.0,17859 06383 }; 06384 mavlink_scaled_pressure2_t packet1, packet2; 06385 memset(&packet1, 0, sizeof(packet1)); 06386 packet1.time_boot_ms = packet_in.time_boot_ms; 06387 packet1.press_abs = packet_in.press_abs; 06388 packet1.press_diff = packet_in.press_diff; 06389 packet1.temperature = packet_in.temperature; 06390 06391 06392 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06393 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06394 // cope with extensions 06395 memset(MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE2_MIN_LEN); 06396 } 06397 #endif 06398 memset(&packet2, 0, sizeof(packet2)); 06399 mavlink_msg_scaled_pressure2_encode(system_id, component_id, &msg, &packet1); 06400 mavlink_msg_scaled_pressure2_decode(&msg, &packet2); 06401 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06402 06403 memset(&packet2, 0, sizeof(packet2)); 06404 mavlink_msg_scaled_pressure2_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06405 mavlink_msg_scaled_pressure2_decode(&msg, &packet2); 06406 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06407 06408 memset(&packet2, 0, sizeof(packet2)); 06409 mavlink_msg_scaled_pressure2_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06410 mavlink_msg_scaled_pressure2_decode(&msg, &packet2); 06411 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06412 06413 memset(&packet2, 0, sizeof(packet2)); 06414 mavlink_msg_to_send_buffer(buffer, &msg); 06415 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06416 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06417 } 06418 mavlink_msg_scaled_pressure2_decode(last_msg, &packet2); 06419 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06420 06421 memset(&packet2, 0, sizeof(packet2)); 06422 mavlink_msg_scaled_pressure2_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06423 mavlink_msg_scaled_pressure2_decode(last_msg, &packet2); 06424 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06425 } 06426 06427 static void mavlink_test_att_pos_mocap(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06428 { 06429 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06430 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06431 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ATT_POS_MOCAP >= 256) { 06432 return; 06433 } 06434 #endif 06435 mavlink_message_t msg; 06436 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06437 uint16_t i; 06438 mavlink_att_pos_mocap_t packet_in = { 06439 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0 },185.0,213.0,241.0 06440 }; 06441 mavlink_att_pos_mocap_t packet1, packet2; 06442 memset(&packet1, 0, sizeof(packet1)); 06443 packet1.time_usec = packet_in.time_usec; 06444 packet1.x = packet_in.x; 06445 packet1.y = packet_in.y; 06446 packet1.z = packet_in.z; 06447 06448 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 06449 06450 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06451 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06452 // cope with extensions 06453 memset(MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ATT_POS_MOCAP_MIN_LEN); 06454 } 06455 #endif 06456 memset(&packet2, 0, sizeof(packet2)); 06457 mavlink_msg_att_pos_mocap_encode(system_id, component_id, &msg, &packet1); 06458 mavlink_msg_att_pos_mocap_decode(&msg, &packet2); 06459 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06460 06461 memset(&packet2, 0, sizeof(packet2)); 06462 mavlink_msg_att_pos_mocap_pack(system_id, component_id, &msg , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z ); 06463 mavlink_msg_att_pos_mocap_decode(&msg, &packet2); 06464 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06465 06466 memset(&packet2, 0, sizeof(packet2)); 06467 mavlink_msg_att_pos_mocap_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z ); 06468 mavlink_msg_att_pos_mocap_decode(&msg, &packet2); 06469 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06470 06471 memset(&packet2, 0, sizeof(packet2)); 06472 mavlink_msg_to_send_buffer(buffer, &msg); 06473 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06474 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06475 } 06476 mavlink_msg_att_pos_mocap_decode(last_msg, &packet2); 06477 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06478 06479 memset(&packet2, 0, sizeof(packet2)); 06480 mavlink_msg_att_pos_mocap_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.q , packet1.x , packet1.y , packet1.z ); 06481 mavlink_msg_att_pos_mocap_decode(last_msg, &packet2); 06482 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06483 } 06484 06485 static void mavlink_test_set_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06486 { 06487 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06488 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06489 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET >= 256) { 06490 return; 06491 } 06492 #endif 06493 mavlink_message_t msg; 06494 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06495 uint16_t i; 06496 mavlink_set_actuator_control_target_t packet_in = { 06497 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0 },125,192,3 06498 }; 06499 mavlink_set_actuator_control_target_t packet1, packet2; 06500 memset(&packet1, 0, sizeof(packet1)); 06501 packet1.time_usec = packet_in.time_usec; 06502 packet1.group_mlx = packet_in.group_mlx; 06503 packet1.target_system = packet_in.target_system; 06504 packet1.target_component = packet_in.target_component; 06505 06506 mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*8); 06507 06508 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06509 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06510 // cope with extensions 06511 memset(MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_ACTUATOR_CONTROL_TARGET_MIN_LEN); 06512 } 06513 #endif 06514 memset(&packet2, 0, sizeof(packet2)); 06515 mavlink_msg_set_actuator_control_target_encode(system_id, component_id, &msg, &packet1); 06516 mavlink_msg_set_actuator_control_target_decode(&msg, &packet2); 06517 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06518 06519 memset(&packet2, 0, sizeof(packet2)); 06520 mavlink_msg_set_actuator_control_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls ); 06521 mavlink_msg_set_actuator_control_target_decode(&msg, &packet2); 06522 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06523 06524 memset(&packet2, 0, sizeof(packet2)); 06525 mavlink_msg_set_actuator_control_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls ); 06526 mavlink_msg_set_actuator_control_target_decode(&msg, &packet2); 06527 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06528 06529 memset(&packet2, 0, sizeof(packet2)); 06530 mavlink_msg_to_send_buffer(buffer, &msg); 06531 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06532 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06533 } 06534 mavlink_msg_set_actuator_control_target_decode(last_msg, &packet2); 06535 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06536 06537 memset(&packet2, 0, sizeof(packet2)); 06538 mavlink_msg_set_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.target_system , packet1.target_component , packet1.controls ); 06539 mavlink_msg_set_actuator_control_target_decode(last_msg, &packet2); 06540 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06541 } 06542 06543 static void mavlink_test_actuator_control_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06544 { 06545 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06546 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06547 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET >= 256) { 06548 return; 06549 } 06550 #endif 06551 mavlink_message_t msg; 06552 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06553 uint16_t i; 06554 mavlink_actuator_control_target_t packet_in = { 06555 93372036854775807ULL,{ 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0 },125 06556 }; 06557 mavlink_actuator_control_target_t packet1, packet2; 06558 memset(&packet1, 0, sizeof(packet1)); 06559 packet1.time_usec = packet_in.time_usec; 06560 packet1.group_mlx = packet_in.group_mlx; 06561 06562 mav_array_memcpy(packet1.controls, packet_in.controls, sizeof(float)*8); 06563 06564 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06565 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06566 // cope with extensions 06567 memset(MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ACTUATOR_CONTROL_TARGET_MIN_LEN); 06568 } 06569 #endif 06570 memset(&packet2, 0, sizeof(packet2)); 06571 mavlink_msg_actuator_control_target_encode(system_id, component_id, &msg, &packet1); 06572 mavlink_msg_actuator_control_target_decode(&msg, &packet2); 06573 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06574 06575 memset(&packet2, 0, sizeof(packet2)); 06576 mavlink_msg_actuator_control_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.group_mlx , packet1.controls ); 06577 mavlink_msg_actuator_control_target_decode(&msg, &packet2); 06578 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06579 06580 memset(&packet2, 0, sizeof(packet2)); 06581 mavlink_msg_actuator_control_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.group_mlx , packet1.controls ); 06582 mavlink_msg_actuator_control_target_decode(&msg, &packet2); 06583 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06584 06585 memset(&packet2, 0, sizeof(packet2)); 06586 mavlink_msg_to_send_buffer(buffer, &msg); 06587 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06588 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06589 } 06590 mavlink_msg_actuator_control_target_decode(last_msg, &packet2); 06591 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06592 06593 memset(&packet2, 0, sizeof(packet2)); 06594 mavlink_msg_actuator_control_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.group_mlx , packet1.controls ); 06595 mavlink_msg_actuator_control_target_decode(last_msg, &packet2); 06596 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06597 } 06598 06599 static void mavlink_test_altitude(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06600 { 06601 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06602 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06603 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ALTITUDE >= 256) { 06604 return; 06605 } 06606 #endif 06607 mavlink_message_t msg; 06608 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06609 uint16_t i; 06610 mavlink_altitude_t packet_in = { 06611 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0 06612 }; 06613 mavlink_altitude_t packet1, packet2; 06614 memset(&packet1, 0, sizeof(packet1)); 06615 packet1.time_usec = packet_in.time_usec; 06616 packet1.altitude_monotonic = packet_in.altitude_monotonic; 06617 packet1.altitude_amsl = packet_in.altitude_amsl; 06618 packet1.altitude_local = packet_in.altitude_local; 06619 packet1.altitude_relative = packet_in.altitude_relative; 06620 packet1.altitude_terrain = packet_in.altitude_terrain; 06621 packet1.bottom_clearance = packet_in.bottom_clearance; 06622 06623 06624 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06625 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06626 // cope with extensions 06627 memset(MAVLINK_MSG_ID_ALTITUDE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ALTITUDE_MIN_LEN); 06628 } 06629 #endif 06630 memset(&packet2, 0, sizeof(packet2)); 06631 mavlink_msg_altitude_encode(system_id, component_id, &msg, &packet1); 06632 mavlink_msg_altitude_decode(&msg, &packet2); 06633 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06634 06635 memset(&packet2, 0, sizeof(packet2)); 06636 mavlink_msg_altitude_pack(system_id, component_id, &msg , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance ); 06637 mavlink_msg_altitude_decode(&msg, &packet2); 06638 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06639 06640 memset(&packet2, 0, sizeof(packet2)); 06641 mavlink_msg_altitude_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance ); 06642 mavlink_msg_altitude_decode(&msg, &packet2); 06643 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06644 06645 memset(&packet2, 0, sizeof(packet2)); 06646 mavlink_msg_to_send_buffer(buffer, &msg); 06647 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06648 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06649 } 06650 mavlink_msg_altitude_decode(last_msg, &packet2); 06651 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06652 06653 memset(&packet2, 0, sizeof(packet2)); 06654 mavlink_msg_altitude_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.altitude_monotonic , packet1.altitude_amsl , packet1.altitude_local , packet1.altitude_relative , packet1.altitude_terrain , packet1.bottom_clearance ); 06655 mavlink_msg_altitude_decode(last_msg, &packet2); 06656 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06657 } 06658 06659 static void mavlink_test_resource_request(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06660 { 06661 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06662 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06663 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_RESOURCE_REQUEST >= 256) { 06664 return; 06665 } 06666 #endif 06667 mavlink_message_t msg; 06668 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06669 uint16_t i; 06670 mavlink_resource_request_t packet_in = { 06671 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2 },243,{ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173 } 06672 }; 06673 mavlink_resource_request_t packet1, packet2; 06674 memset(&packet1, 0, sizeof(packet1)); 06675 packet1.request_id = packet_in.request_id; 06676 packet1.uri_type = packet_in.uri_type; 06677 packet1.transfer_type = packet_in.transfer_type; 06678 06679 mav_array_memcpy(packet1.uri, packet_in.uri, sizeof(uint8_t)*120); 06680 mav_array_memcpy(packet1.storage, packet_in.storage, sizeof(uint8_t)*120); 06681 06682 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06683 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06684 // cope with extensions 06685 memset(MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_RESOURCE_REQUEST_MIN_LEN); 06686 } 06687 #endif 06688 memset(&packet2, 0, sizeof(packet2)); 06689 mavlink_msg_resource_request_encode(system_id, component_id, &msg, &packet1); 06690 mavlink_msg_resource_request_decode(&msg, &packet2); 06691 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06692 06693 memset(&packet2, 0, sizeof(packet2)); 06694 mavlink_msg_resource_request_pack(system_id, component_id, &msg , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage ); 06695 mavlink_msg_resource_request_decode(&msg, &packet2); 06696 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06697 06698 memset(&packet2, 0, sizeof(packet2)); 06699 mavlink_msg_resource_request_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage ); 06700 mavlink_msg_resource_request_decode(&msg, &packet2); 06701 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06702 06703 memset(&packet2, 0, sizeof(packet2)); 06704 mavlink_msg_to_send_buffer(buffer, &msg); 06705 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06706 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06707 } 06708 mavlink_msg_resource_request_decode(last_msg, &packet2); 06709 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06710 06711 memset(&packet2, 0, sizeof(packet2)); 06712 mavlink_msg_resource_request_send(MAVLINK_COMM_1 , packet1.request_id , packet1.uri_type , packet1.uri , packet1.transfer_type , packet1.storage ); 06713 mavlink_msg_resource_request_decode(last_msg, &packet2); 06714 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06715 } 06716 06717 static void mavlink_test_scaled_pressure3(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06718 { 06719 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06720 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06721 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SCALED_PRESSURE3 >= 256) { 06722 return; 06723 } 06724 #endif 06725 mavlink_message_t msg; 06726 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06727 uint16_t i; 06728 mavlink_scaled_pressure3_t packet_in = { 06729 963497464,45.0,73.0,17859 06730 }; 06731 mavlink_scaled_pressure3_t packet1, packet2; 06732 memset(&packet1, 0, sizeof(packet1)); 06733 packet1.time_boot_ms = packet_in.time_boot_ms; 06734 packet1.press_abs = packet_in.press_abs; 06735 packet1.press_diff = packet_in.press_diff; 06736 packet1.temperature = packet_in.temperature; 06737 06738 06739 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06740 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06741 // cope with extensions 06742 memset(MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SCALED_PRESSURE3_MIN_LEN); 06743 } 06744 #endif 06745 memset(&packet2, 0, sizeof(packet2)); 06746 mavlink_msg_scaled_pressure3_encode(system_id, component_id, &msg, &packet1); 06747 mavlink_msg_scaled_pressure3_decode(&msg, &packet2); 06748 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06749 06750 memset(&packet2, 0, sizeof(packet2)); 06751 mavlink_msg_scaled_pressure3_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06752 mavlink_msg_scaled_pressure3_decode(&msg, &packet2); 06753 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06754 06755 memset(&packet2, 0, sizeof(packet2)); 06756 mavlink_msg_scaled_pressure3_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06757 mavlink_msg_scaled_pressure3_decode(&msg, &packet2); 06758 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06759 06760 memset(&packet2, 0, sizeof(packet2)); 06761 mavlink_msg_to_send_buffer(buffer, &msg); 06762 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06763 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06764 } 06765 mavlink_msg_scaled_pressure3_decode(last_msg, &packet2); 06766 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06767 06768 memset(&packet2, 0, sizeof(packet2)); 06769 mavlink_msg_scaled_pressure3_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.press_abs , packet1.press_diff , packet1.temperature ); 06770 mavlink_msg_scaled_pressure3_decode(last_msg, &packet2); 06771 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06772 } 06773 06774 static void mavlink_test_follow_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06775 { 06776 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06777 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06778 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_FOLLOW_TARGET >= 256) { 06779 return; 06780 } 06781 #endif 06782 mavlink_message_t msg; 06783 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06784 uint16_t i; 06785 mavlink_follow_target_t packet_in = { 06786 93372036854775807ULL,93372036854776311ULL,963498296,963498504,185.0,{ 213.0, 214.0, 215.0 },{ 297.0, 298.0, 299.0 },{ 381.0, 382.0, 383.0, 384.0 },{ 493.0, 494.0, 495.0 },{ 577.0, 578.0, 579.0 },25 06787 }; 06788 mavlink_follow_target_t packet1, packet2; 06789 memset(&packet1, 0, sizeof(packet1)); 06790 packet1.timestamp = packet_in.timestamp; 06791 packet1.custom_state = packet_in.custom_state; 06792 packet1.lat = packet_in.lat; 06793 packet1.lon = packet_in.lon; 06794 packet1.alt = packet_in.alt; 06795 packet1.est_capabilities = packet_in.est_capabilities; 06796 06797 mav_array_memcpy(packet1.vel, packet_in.vel, sizeof(float)*3); 06798 mav_array_memcpy(packet1.acc, packet_in.acc, sizeof(float)*3); 06799 mav_array_memcpy(packet1.attitude_q, packet_in.attitude_q, sizeof(float)*4); 06800 mav_array_memcpy(packet1.rates, packet_in.rates, sizeof(float)*3); 06801 mav_array_memcpy(packet1.position_cov, packet_in.position_cov, sizeof(float)*3); 06802 06803 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06804 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06805 // cope with extensions 06806 memset(MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_FOLLOW_TARGET_MIN_LEN); 06807 } 06808 #endif 06809 memset(&packet2, 0, sizeof(packet2)); 06810 mavlink_msg_follow_target_encode(system_id, component_id, &msg, &packet1); 06811 mavlink_msg_follow_target_decode(&msg, &packet2); 06812 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06813 06814 memset(&packet2, 0, sizeof(packet2)); 06815 mavlink_msg_follow_target_pack(system_id, component_id, &msg , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state ); 06816 mavlink_msg_follow_target_decode(&msg, &packet2); 06817 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06818 06819 memset(&packet2, 0, sizeof(packet2)); 06820 mavlink_msg_follow_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state ); 06821 mavlink_msg_follow_target_decode(&msg, &packet2); 06822 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06823 06824 memset(&packet2, 0, sizeof(packet2)); 06825 mavlink_msg_to_send_buffer(buffer, &msg); 06826 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06827 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06828 } 06829 mavlink_msg_follow_target_decode(last_msg, &packet2); 06830 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06831 06832 memset(&packet2, 0, sizeof(packet2)); 06833 mavlink_msg_follow_target_send(MAVLINK_COMM_1 , packet1.timestamp , packet1.est_capabilities , packet1.lat , packet1.lon , packet1.alt , packet1.vel , packet1.acc , packet1.attitude_q , packet1.rates , packet1.position_cov , packet1.custom_state ); 06834 mavlink_msg_follow_target_decode(last_msg, &packet2); 06835 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06836 } 06837 06838 static void mavlink_test_control_system_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06839 { 06840 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06841 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06842 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE >= 256) { 06843 return; 06844 } 06845 #endif 06846 mavlink_message_t msg; 06847 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06848 uint16_t i; 06849 mavlink_control_system_state_t packet_in = { 06850 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,297.0,325.0,{ 353.0, 354.0, 355.0 },{ 437.0, 438.0, 439.0 },{ 521.0, 522.0, 523.0, 524.0 },633.0,661.0,689.0 06851 }; 06852 mavlink_control_system_state_t packet1, packet2; 06853 memset(&packet1, 0, sizeof(packet1)); 06854 packet1.time_usec = packet_in.time_usec; 06855 packet1.x_acc = packet_in.x_acc; 06856 packet1.y_acc = packet_in.y_acc; 06857 packet1.z_acc = packet_in.z_acc; 06858 packet1.x_vel = packet_in.x_vel; 06859 packet1.y_vel = packet_in.y_vel; 06860 packet1.z_vel = packet_in.z_vel; 06861 packet1.x_pos = packet_in.x_pos; 06862 packet1.y_pos = packet_in.y_pos; 06863 packet1.z_pos = packet_in.z_pos; 06864 packet1.airspeed = packet_in.airspeed; 06865 packet1.roll_rate = packet_in.roll_rate; 06866 packet1.pitch_rate = packet_in.pitch_rate; 06867 packet1.yaw_rate = packet_in.yaw_rate; 06868 06869 mav_array_memcpy(packet1.vel_variance, packet_in.vel_variance, sizeof(float)*3); 06870 mav_array_memcpy(packet1.pos_variance, packet_in.pos_variance, sizeof(float)*3); 06871 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 06872 06873 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06874 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06875 // cope with extensions 06876 memset(MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CONTROL_SYSTEM_STATE_MIN_LEN); 06877 } 06878 #endif 06879 memset(&packet2, 0, sizeof(packet2)); 06880 mavlink_msg_control_system_state_encode(system_id, component_id, &msg, &packet1); 06881 mavlink_msg_control_system_state_decode(&msg, &packet2); 06882 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06883 06884 memset(&packet2, 0, sizeof(packet2)); 06885 mavlink_msg_control_system_state_pack(system_id, component_id, &msg , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate ); 06886 mavlink_msg_control_system_state_decode(&msg, &packet2); 06887 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06888 06889 memset(&packet2, 0, sizeof(packet2)); 06890 mavlink_msg_control_system_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate ); 06891 mavlink_msg_control_system_state_decode(&msg, &packet2); 06892 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06893 06894 memset(&packet2, 0, sizeof(packet2)); 06895 mavlink_msg_to_send_buffer(buffer, &msg); 06896 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06897 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06898 } 06899 mavlink_msg_control_system_state_decode(last_msg, &packet2); 06900 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06901 06902 memset(&packet2, 0, sizeof(packet2)); 06903 mavlink_msg_control_system_state_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.x_acc , packet1.y_acc , packet1.z_acc , packet1.x_vel , packet1.y_vel , packet1.z_vel , packet1.x_pos , packet1.y_pos , packet1.z_pos , packet1.airspeed , packet1.vel_variance , packet1.pos_variance , packet1.q , packet1.roll_rate , packet1.pitch_rate , packet1.yaw_rate ); 06904 mavlink_msg_control_system_state_decode(last_msg, &packet2); 06905 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06906 } 06907 06908 static void mavlink_test_battery_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06909 { 06910 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06911 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06912 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_BATTERY_STATUS >= 256) { 06913 return; 06914 } 06915 #endif 06916 mavlink_message_t msg; 06917 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06918 uint16_t i; 06919 mavlink_battery_status_t packet_in = { 06920 963497464,963497672,17651,{ 17755, 17756, 17757, 17758, 17759, 17760, 17761, 17762, 17763, 17764 },18795,101,168,235,46 06921 }; 06922 mavlink_battery_status_t packet1, packet2; 06923 memset(&packet1, 0, sizeof(packet1)); 06924 packet1.current_consumed = packet_in.current_consumed; 06925 packet1.energy_consumed = packet_in.energy_consumed; 06926 packet1.temperature = packet_in.temperature; 06927 packet1.current_battery = packet_in.current_battery; 06928 packet1.id = packet_in.id; 06929 packet1.battery_function = packet_in.battery_function; 06930 packet1.type = packet_in.type; 06931 packet1.battery_remaining = packet_in.battery_remaining; 06932 06933 mav_array_memcpy(packet1.voltages, packet_in.voltages, sizeof(uint16_t)*10); 06934 06935 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06936 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 06937 // cope with extensions 06938 memset(MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_BATTERY_STATUS_MIN_LEN); 06939 } 06940 #endif 06941 memset(&packet2, 0, sizeof(packet2)); 06942 mavlink_msg_battery_status_encode(system_id, component_id, &msg, &packet1); 06943 mavlink_msg_battery_status_decode(&msg, &packet2); 06944 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06945 06946 memset(&packet2, 0, sizeof(packet2)); 06947 mavlink_msg_battery_status_pack(system_id, component_id, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining ); 06948 mavlink_msg_battery_status_decode(&msg, &packet2); 06949 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06950 06951 memset(&packet2, 0, sizeof(packet2)); 06952 mavlink_msg_battery_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining ); 06953 mavlink_msg_battery_status_decode(&msg, &packet2); 06954 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06955 06956 memset(&packet2, 0, sizeof(packet2)); 06957 mavlink_msg_to_send_buffer(buffer, &msg); 06958 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 06959 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 06960 } 06961 mavlink_msg_battery_status_decode(last_msg, &packet2); 06962 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06963 06964 memset(&packet2, 0, sizeof(packet2)); 06965 mavlink_msg_battery_status_send(MAVLINK_COMM_1 , packet1.id , packet1.battery_function , packet1.type , packet1.temperature , packet1.voltages , packet1.current_battery , packet1.current_consumed , packet1.energy_consumed , packet1.battery_remaining ); 06966 mavlink_msg_battery_status_decode(last_msg, &packet2); 06967 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 06968 } 06969 06970 static void mavlink_test_autopilot_version(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 06971 { 06972 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 06973 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 06974 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_AUTOPILOT_VERSION >= 256) { 06975 return; 06976 } 06977 #endif 06978 mavlink_message_t msg; 06979 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 06980 uint16_t i; 06981 mavlink_autopilot_version_t packet_in = { 06982 93372036854775807ULL,93372036854776311ULL,963498296,963498504,963498712,963498920,18899,19003,{ 113, 114, 115, 116, 117, 118, 119, 120 },{ 137, 138, 139, 140, 141, 142, 143, 144 },{ 161, 162, 163, 164, 165, 166, 167, 168 } 06983 }; 06984 mavlink_autopilot_version_t packet1, packet2; 06985 memset(&packet1, 0, sizeof(packet1)); 06986 packet1.capabilities = packet_in.capabilities; 06987 packet1.uid = packet_in.uid; 06988 packet1.flight_sw_version = packet_in.flight_sw_version; 06989 packet1.middleware_sw_version = packet_in.middleware_sw_version; 06990 packet1.os_sw_version = packet_in.os_sw_version; 06991 packet1.board_version = packet_in.board_version; 06992 packet1.vendor_id = packet_in.vendor_id; 06993 packet1.product_id = packet_in.product_id; 06994 06995 mav_array_memcpy(packet1.flight_custom_version, packet_in.flight_custom_version, sizeof(uint8_t)*8); 06996 mav_array_memcpy(packet1.middleware_custom_version, packet_in.middleware_custom_version, sizeof(uint8_t)*8); 06997 mav_array_memcpy(packet1.os_custom_version, packet_in.os_custom_version, sizeof(uint8_t)*8); 06998 06999 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07000 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07001 // cope with extensions 07002 memset(MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_AUTOPILOT_VERSION_MIN_LEN); 07003 } 07004 #endif 07005 memset(&packet2, 0, sizeof(packet2)); 07006 mavlink_msg_autopilot_version_encode(system_id, component_id, &msg, &packet1); 07007 mavlink_msg_autopilot_version_decode(&msg, &packet2); 07008 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07009 07010 memset(&packet2, 0, sizeof(packet2)); 07011 mavlink_msg_autopilot_version_pack(system_id, component_id, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid ); 07012 mavlink_msg_autopilot_version_decode(&msg, &packet2); 07013 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07014 07015 memset(&packet2, 0, sizeof(packet2)); 07016 mavlink_msg_autopilot_version_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid ); 07017 mavlink_msg_autopilot_version_decode(&msg, &packet2); 07018 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07019 07020 memset(&packet2, 0, sizeof(packet2)); 07021 mavlink_msg_to_send_buffer(buffer, &msg); 07022 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07023 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07024 } 07025 mavlink_msg_autopilot_version_decode(last_msg, &packet2); 07026 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07027 07028 memset(&packet2, 0, sizeof(packet2)); 07029 mavlink_msg_autopilot_version_send(MAVLINK_COMM_1 , packet1.capabilities , packet1.flight_sw_version , packet1.middleware_sw_version , packet1.os_sw_version , packet1.board_version , packet1.flight_custom_version , packet1.middleware_custom_version , packet1.os_custom_version , packet1.vendor_id , packet1.product_id , packet1.uid ); 07030 mavlink_msg_autopilot_version_decode(last_msg, &packet2); 07031 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07032 } 07033 07034 static void mavlink_test_landing_target(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07035 { 07036 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07037 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07038 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_LANDING_TARGET >= 256) { 07039 return; 07040 } 07041 #endif 07042 mavlink_message_t msg; 07043 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07044 uint16_t i; 07045 mavlink_landing_target_t packet_in = { 07046 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,89,156 07047 }; 07048 mavlink_landing_target_t packet1, packet2; 07049 memset(&packet1, 0, sizeof(packet1)); 07050 packet1.time_usec = packet_in.time_usec; 07051 packet1.angle_x = packet_in.angle_x; 07052 packet1.angle_y = packet_in.angle_y; 07053 packet1.distance = packet_in.distance; 07054 packet1.size_x = packet_in.size_x; 07055 packet1.size_y = packet_in.size_y; 07056 packet1.target_num = packet_in.target_num; 07057 packet1.frame = packet_in.frame; 07058 07059 07060 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07061 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07062 // cope with extensions 07063 memset(MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_LANDING_TARGET_MIN_LEN); 07064 } 07065 #endif 07066 memset(&packet2, 0, sizeof(packet2)); 07067 mavlink_msg_landing_target_encode(system_id, component_id, &msg, &packet1); 07068 mavlink_msg_landing_target_decode(&msg, &packet2); 07069 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07070 07071 memset(&packet2, 0, sizeof(packet2)); 07072 mavlink_msg_landing_target_pack(system_id, component_id, &msg , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y ); 07073 mavlink_msg_landing_target_decode(&msg, &packet2); 07074 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07075 07076 memset(&packet2, 0, sizeof(packet2)); 07077 mavlink_msg_landing_target_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y ); 07078 mavlink_msg_landing_target_decode(&msg, &packet2); 07079 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07080 07081 memset(&packet2, 0, sizeof(packet2)); 07082 mavlink_msg_to_send_buffer(buffer, &msg); 07083 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07084 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07085 } 07086 mavlink_msg_landing_target_decode(last_msg, &packet2); 07087 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07088 07089 memset(&packet2, 0, sizeof(packet2)); 07090 mavlink_msg_landing_target_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.target_num , packet1.frame , packet1.angle_x , packet1.angle_y , packet1.distance , packet1.size_x , packet1.size_y ); 07091 mavlink_msg_landing_target_decode(last_msg, &packet2); 07092 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07093 } 07094 07095 static void mavlink_test_estimator_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07096 { 07097 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07098 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07099 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ESTIMATOR_STATUS >= 256) { 07100 return; 07101 } 07102 #endif 07103 mavlink_message_t msg; 07104 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07105 uint16_t i; 07106 mavlink_estimator_status_t packet_in = { 07107 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0,19315 07108 }; 07109 mavlink_estimator_status_t packet1, packet2; 07110 memset(&packet1, 0, sizeof(packet1)); 07111 packet1.time_usec = packet_in.time_usec; 07112 packet1.vel_ratio = packet_in.vel_ratio; 07113 packet1.pos_horiz_ratio = packet_in.pos_horiz_ratio; 07114 packet1.pos_vert_ratio = packet_in.pos_vert_ratio; 07115 packet1.mag_ratio = packet_in.mag_ratio; 07116 packet1.hagl_ratio = packet_in.hagl_ratio; 07117 packet1.tas_ratio = packet_in.tas_ratio; 07118 packet1.pos_horiz_accuracy = packet_in.pos_horiz_accuracy; 07119 packet1.pos_vert_accuracy = packet_in.pos_vert_accuracy; 07120 packet1.flags = packet_in.flags; 07121 07122 07123 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07124 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07125 // cope with extensions 07126 memset(MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ESTIMATOR_STATUS_MIN_LEN); 07127 } 07128 #endif 07129 memset(&packet2, 0, sizeof(packet2)); 07130 mavlink_msg_estimator_status_encode(system_id, component_id, &msg, &packet1); 07131 mavlink_msg_estimator_status_decode(&msg, &packet2); 07132 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07133 07134 memset(&packet2, 0, sizeof(packet2)); 07135 mavlink_msg_estimator_status_pack(system_id, component_id, &msg , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy ); 07136 mavlink_msg_estimator_status_decode(&msg, &packet2); 07137 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07138 07139 memset(&packet2, 0, sizeof(packet2)); 07140 mavlink_msg_estimator_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy ); 07141 mavlink_msg_estimator_status_decode(&msg, &packet2); 07142 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07143 07144 memset(&packet2, 0, sizeof(packet2)); 07145 mavlink_msg_to_send_buffer(buffer, &msg); 07146 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07147 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07148 } 07149 mavlink_msg_estimator_status_decode(last_msg, &packet2); 07150 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07151 07152 memset(&packet2, 0, sizeof(packet2)); 07153 mavlink_msg_estimator_status_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.flags , packet1.vel_ratio , packet1.pos_horiz_ratio , packet1.pos_vert_ratio , packet1.mag_ratio , packet1.hagl_ratio , packet1.tas_ratio , packet1.pos_horiz_accuracy , packet1.pos_vert_accuracy ); 07154 mavlink_msg_estimator_status_decode(last_msg, &packet2); 07155 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07156 } 07157 07158 static void mavlink_test_wind_cov(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07159 { 07160 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07161 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07162 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_WIND_COV >= 256) { 07163 return; 07164 } 07165 #endif 07166 mavlink_message_t msg; 07167 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07168 uint16_t i; 07169 mavlink_wind_cov_t packet_in = { 07170 93372036854775807ULL,73.0,101.0,129.0,157.0,185.0,213.0,241.0,269.0 07171 }; 07172 mavlink_wind_cov_t packet1, packet2; 07173 memset(&packet1, 0, sizeof(packet1)); 07174 packet1.time_usec = packet_in.time_usec; 07175 packet1.wind_x = packet_in.wind_x; 07176 packet1.wind_y = packet_in.wind_y; 07177 packet1.wind_z = packet_in.wind_z; 07178 packet1.var_horiz = packet_in.var_horiz; 07179 packet1.var_vert = packet_in.var_vert; 07180 packet1.wind_alt = packet_in.wind_alt; 07181 packet1.horiz_accuracy = packet_in.horiz_accuracy; 07182 packet1.vert_accuracy = packet_in.vert_accuracy; 07183 07184 07185 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07186 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07187 // cope with extensions 07188 memset(MAVLINK_MSG_ID_WIND_COV_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_WIND_COV_MIN_LEN); 07189 } 07190 #endif 07191 memset(&packet2, 0, sizeof(packet2)); 07192 mavlink_msg_wind_cov_encode(system_id, component_id, &msg, &packet1); 07193 mavlink_msg_wind_cov_decode(&msg, &packet2); 07194 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07195 07196 memset(&packet2, 0, sizeof(packet2)); 07197 mavlink_msg_wind_cov_pack(system_id, component_id, &msg , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy ); 07198 mavlink_msg_wind_cov_decode(&msg, &packet2); 07199 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07200 07201 memset(&packet2, 0, sizeof(packet2)); 07202 mavlink_msg_wind_cov_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy ); 07203 mavlink_msg_wind_cov_decode(&msg, &packet2); 07204 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07205 07206 memset(&packet2, 0, sizeof(packet2)); 07207 mavlink_msg_to_send_buffer(buffer, &msg); 07208 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07209 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07210 } 07211 mavlink_msg_wind_cov_decode(last_msg, &packet2); 07212 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07213 07214 memset(&packet2, 0, sizeof(packet2)); 07215 mavlink_msg_wind_cov_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.wind_x , packet1.wind_y , packet1.wind_z , packet1.var_horiz , packet1.var_vert , packet1.wind_alt , packet1.horiz_accuracy , packet1.vert_accuracy ); 07216 mavlink_msg_wind_cov_decode(last_msg, &packet2); 07217 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07218 } 07219 07220 static void mavlink_test_gps_input(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07221 { 07222 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07223 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07224 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_INPUT >= 256) { 07225 return; 07226 } 07227 #endif 07228 mavlink_message_t msg; 07229 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07230 uint16_t i; 07231 mavlink_gps_input_t packet_in = { 07232 93372036854775807ULL,963497880,963498088,963498296,157.0,185.0,213.0,241.0,269.0,297.0,325.0,353.0,381.0,20147,20251,185,252,63 07233 }; 07234 mavlink_gps_input_t packet1, packet2; 07235 memset(&packet1, 0, sizeof(packet1)); 07236 packet1.time_usec = packet_in.time_usec; 07237 packet1.time_week_ms = packet_in.time_week_ms; 07238 packet1.lat = packet_in.lat; 07239 packet1.lon = packet_in.lon; 07240 packet1.alt = packet_in.alt; 07241 packet1.hdop = packet_in.hdop; 07242 packet1.vdop = packet_in.vdop; 07243 packet1.vn = packet_in.vn; 07244 packet1.ve = packet_in.ve; 07245 packet1.vd = packet_in.vd; 07246 packet1.speed_accuracy = packet_in.speed_accuracy; 07247 packet1.horiz_accuracy = packet_in.horiz_accuracy; 07248 packet1.vert_accuracy = packet_in.vert_accuracy; 07249 packet1.ignore_flags = packet_in.ignore_flags; 07250 packet1.time_week = packet_in.time_week; 07251 packet1.gps_id = packet_in.gps_id; 07252 packet1.fix_type = packet_in.fix_type; 07253 packet1.satellites_visible = packet_in.satellites_visible; 07254 07255 07256 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07257 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07258 // cope with extensions 07259 memset(MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_INPUT_MIN_LEN); 07260 } 07261 #endif 07262 memset(&packet2, 0, sizeof(packet2)); 07263 mavlink_msg_gps_input_encode(system_id, component_id, &msg, &packet1); 07264 mavlink_msg_gps_input_decode(&msg, &packet2); 07265 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07266 07267 memset(&packet2, 0, sizeof(packet2)); 07268 mavlink_msg_gps_input_pack(system_id, component_id, &msg , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible ); 07269 mavlink_msg_gps_input_decode(&msg, &packet2); 07270 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07271 07272 memset(&packet2, 0, sizeof(packet2)); 07273 mavlink_msg_gps_input_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible ); 07274 mavlink_msg_gps_input_decode(&msg, &packet2); 07275 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07276 07277 memset(&packet2, 0, sizeof(packet2)); 07278 mavlink_msg_to_send_buffer(buffer, &msg); 07279 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07280 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07281 } 07282 mavlink_msg_gps_input_decode(last_msg, &packet2); 07283 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07284 07285 memset(&packet2, 0, sizeof(packet2)); 07286 mavlink_msg_gps_input_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.gps_id , packet1.ignore_flags , packet1.time_week_ms , packet1.time_week , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.hdop , packet1.vdop , packet1.vn , packet1.ve , packet1.vd , packet1.speed_accuracy , packet1.horiz_accuracy , packet1.vert_accuracy , packet1.satellites_visible ); 07287 mavlink_msg_gps_input_decode(last_msg, &packet2); 07288 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07289 } 07290 07291 static void mavlink_test_gps_rtcm_data(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07292 { 07293 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07294 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07295 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_GPS_RTCM_DATA >= 256) { 07296 return; 07297 } 07298 #endif 07299 mavlink_message_t msg; 07300 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07301 uint16_t i; 07302 mavlink_gps_rtcm_data_t packet_in = { 07303 5,72,{ 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 } 07304 }; 07305 mavlink_gps_rtcm_data_t packet1, packet2; 07306 memset(&packet1, 0, sizeof(packet1)); 07307 packet1.flags = packet_in.flags; 07308 packet1.len = packet_in.len; 07309 07310 mav_array_memcpy(packet1.data, packet_in.data, sizeof(uint8_t)*180); 07311 07312 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07313 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07314 // cope with extensions 07315 memset(MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_GPS_RTCM_DATA_MIN_LEN); 07316 } 07317 #endif 07318 memset(&packet2, 0, sizeof(packet2)); 07319 mavlink_msg_gps_rtcm_data_encode(system_id, component_id, &msg, &packet1); 07320 mavlink_msg_gps_rtcm_data_decode(&msg, &packet2); 07321 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07322 07323 memset(&packet2, 0, sizeof(packet2)); 07324 mavlink_msg_gps_rtcm_data_pack(system_id, component_id, &msg , packet1.flags , packet1.len , packet1.data ); 07325 mavlink_msg_gps_rtcm_data_decode(&msg, &packet2); 07326 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07327 07328 memset(&packet2, 0, sizeof(packet2)); 07329 mavlink_msg_gps_rtcm_data_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.flags , packet1.len , packet1.data ); 07330 mavlink_msg_gps_rtcm_data_decode(&msg, &packet2); 07331 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07332 07333 memset(&packet2, 0, sizeof(packet2)); 07334 mavlink_msg_to_send_buffer(buffer, &msg); 07335 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07336 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07337 } 07338 mavlink_msg_gps_rtcm_data_decode(last_msg, &packet2); 07339 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07340 07341 memset(&packet2, 0, sizeof(packet2)); 07342 mavlink_msg_gps_rtcm_data_send(MAVLINK_COMM_1 , packet1.flags , packet1.len , packet1.data ); 07343 mavlink_msg_gps_rtcm_data_decode(last_msg, &packet2); 07344 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07345 } 07346 07347 static void mavlink_test_high_latency(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07348 { 07349 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07350 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07351 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HIGH_LATENCY >= 256) { 07352 return; 07353 } 07354 #endif 07355 mavlink_message_t msg; 07356 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07357 uint16_t i; 07358 mavlink_high_latency_t packet_in = { 07359 963497464,963497672,963497880,17859,17963,18067,18171,18275,18379,18483,211,22,89,156,223,34,101,168,235,46,113,180,247,58 07360 }; 07361 mavlink_high_latency_t packet1, packet2; 07362 memset(&packet1, 0, sizeof(packet1)); 07363 packet1.custom_mode = packet_in.custom_mode; 07364 packet1.latitude = packet_in.latitude; 07365 packet1.longitude = packet_in.longitude; 07366 packet1.roll = packet_in.roll; 07367 packet1.pitch = packet_in.pitch; 07368 packet1.heading = packet_in.heading; 07369 packet1.heading_sp = packet_in.heading_sp; 07370 packet1.altitude_amsl = packet_in.altitude_amsl; 07371 packet1.altitude_sp = packet_in.altitude_sp; 07372 packet1.wp_distance = packet_in.wp_distance; 07373 packet1.base_mode = packet_in.base_mode; 07374 packet1.landed_state = packet_in.landed_state; 07375 packet1.throttle = packet_in.throttle; 07376 packet1.airspeed = packet_in.airspeed; 07377 packet1.airspeed_sp = packet_in.airspeed_sp; 07378 packet1.groundspeed = packet_in.groundspeed; 07379 packet1.climb_rate = packet_in.climb_rate; 07380 packet1.gps_nsat = packet_in.gps_nsat; 07381 packet1.gps_fix_type = packet_in.gps_fix_type; 07382 packet1.battery_remaining = packet_in.battery_remaining; 07383 packet1.temperature = packet_in.temperature; 07384 packet1.temperature_air = packet_in.temperature_air; 07385 packet1.failsafe = packet_in.failsafe; 07386 packet1.wp_num = packet_in.wp_num; 07387 07388 07389 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07390 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07391 // cope with extensions 07392 memset(MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HIGH_LATENCY_MIN_LEN); 07393 } 07394 #endif 07395 memset(&packet2, 0, sizeof(packet2)); 07396 mavlink_msg_high_latency_encode(system_id, component_id, &msg, &packet1); 07397 mavlink_msg_high_latency_decode(&msg, &packet2); 07398 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07399 07400 memset(&packet2, 0, sizeof(packet2)); 07401 mavlink_msg_high_latency_pack(system_id, component_id, &msg , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance ); 07402 mavlink_msg_high_latency_decode(&msg, &packet2); 07403 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07404 07405 memset(&packet2, 0, sizeof(packet2)); 07406 mavlink_msg_high_latency_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance ); 07407 mavlink_msg_high_latency_decode(&msg, &packet2); 07408 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07409 07410 memset(&packet2, 0, sizeof(packet2)); 07411 mavlink_msg_to_send_buffer(buffer, &msg); 07412 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07413 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07414 } 07415 mavlink_msg_high_latency_decode(last_msg, &packet2); 07416 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07417 07418 memset(&packet2, 0, sizeof(packet2)); 07419 mavlink_msg_high_latency_send(MAVLINK_COMM_1 , packet1.base_mode , packet1.custom_mode , packet1.landed_state , packet1.roll , packet1.pitch , packet1.heading , packet1.throttle , packet1.heading_sp , packet1.latitude , packet1.longitude , packet1.altitude_amsl , packet1.altitude_sp , packet1.airspeed , packet1.airspeed_sp , packet1.groundspeed , packet1.climb_rate , packet1.gps_nsat , packet1.gps_fix_type , packet1.battery_remaining , packet1.temperature , packet1.temperature_air , packet1.failsafe , packet1.wp_num , packet1.wp_distance ); 07420 mavlink_msg_high_latency_decode(last_msg, &packet2); 07421 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07422 } 07423 07424 static void mavlink_test_vibration(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07425 { 07426 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07427 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07428 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_VIBRATION >= 256) { 07429 return; 07430 } 07431 #endif 07432 mavlink_message_t msg; 07433 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07434 uint16_t i; 07435 mavlink_vibration_t packet_in = { 07436 93372036854775807ULL,73.0,101.0,129.0,963498504,963498712,963498920 07437 }; 07438 mavlink_vibration_t packet1, packet2; 07439 memset(&packet1, 0, sizeof(packet1)); 07440 packet1.time_usec = packet_in.time_usec; 07441 packet1.vibration_x = packet_in.vibration_x; 07442 packet1.vibration_y = packet_in.vibration_y; 07443 packet1.vibration_z = packet_in.vibration_z; 07444 packet1.clipping_0 = packet_in.clipping_0; 07445 packet1.clipping_1 = packet_in.clipping_1; 07446 packet1.clipping_2 = packet_in.clipping_2; 07447 07448 07449 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07450 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07451 // cope with extensions 07452 memset(MAVLINK_MSG_ID_VIBRATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_VIBRATION_MIN_LEN); 07453 } 07454 #endif 07455 memset(&packet2, 0, sizeof(packet2)); 07456 mavlink_msg_vibration_encode(system_id, component_id, &msg, &packet1); 07457 mavlink_msg_vibration_decode(&msg, &packet2); 07458 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07459 07460 memset(&packet2, 0, sizeof(packet2)); 07461 mavlink_msg_vibration_pack(system_id, component_id, &msg , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 ); 07462 mavlink_msg_vibration_decode(&msg, &packet2); 07463 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07464 07465 memset(&packet2, 0, sizeof(packet2)); 07466 mavlink_msg_vibration_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 ); 07467 mavlink_msg_vibration_decode(&msg, &packet2); 07468 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07469 07470 memset(&packet2, 0, sizeof(packet2)); 07471 mavlink_msg_to_send_buffer(buffer, &msg); 07472 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07473 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07474 } 07475 mavlink_msg_vibration_decode(last_msg, &packet2); 07476 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07477 07478 memset(&packet2, 0, sizeof(packet2)); 07479 mavlink_msg_vibration_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.vibration_x , packet1.vibration_y , packet1.vibration_z , packet1.clipping_0 , packet1.clipping_1 , packet1.clipping_2 ); 07480 mavlink_msg_vibration_decode(last_msg, &packet2); 07481 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07482 } 07483 07484 static void mavlink_test_home_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07485 { 07486 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07487 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07488 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HOME_POSITION >= 256) { 07489 return; 07490 } 07491 #endif 07492 mavlink_message_t msg; 07493 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07494 uint16_t i; 07495 mavlink_home_position_t packet_in = { 07496 963497464,963497672,963497880,101.0,129.0,157.0,{ 185.0, 186.0, 187.0, 188.0 },297.0,325.0,353.0 07497 }; 07498 mavlink_home_position_t packet1, packet2; 07499 memset(&packet1, 0, sizeof(packet1)); 07500 packet1.latitude = packet_in.latitude; 07501 packet1.longitude = packet_in.longitude; 07502 packet1.altitude = packet_in.altitude; 07503 packet1.x = packet_in.x; 07504 packet1.y = packet_in.y; 07505 packet1.z = packet_in.z; 07506 packet1.approach_x = packet_in.approach_x; 07507 packet1.approach_y = packet_in.approach_y; 07508 packet1.approach_z = packet_in.approach_z; 07509 07510 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 07511 07512 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07513 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07514 // cope with extensions 07515 memset(MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HOME_POSITION_MIN_LEN); 07516 } 07517 #endif 07518 memset(&packet2, 0, sizeof(packet2)); 07519 mavlink_msg_home_position_encode(system_id, component_id, &msg, &packet1); 07520 mavlink_msg_home_position_decode(&msg, &packet2); 07521 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07522 07523 memset(&packet2, 0, sizeof(packet2)); 07524 mavlink_msg_home_position_pack(system_id, component_id, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07525 mavlink_msg_home_position_decode(&msg, &packet2); 07526 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07527 07528 memset(&packet2, 0, sizeof(packet2)); 07529 mavlink_msg_home_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07530 mavlink_msg_home_position_decode(&msg, &packet2); 07531 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07532 07533 memset(&packet2, 0, sizeof(packet2)); 07534 mavlink_msg_to_send_buffer(buffer, &msg); 07535 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07536 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07537 } 07538 mavlink_msg_home_position_decode(last_msg, &packet2); 07539 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07540 07541 memset(&packet2, 0, sizeof(packet2)); 07542 mavlink_msg_home_position_send(MAVLINK_COMM_1 , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07543 mavlink_msg_home_position_decode(last_msg, &packet2); 07544 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07545 } 07546 07547 static void mavlink_test_set_home_position(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07548 { 07549 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07550 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07551 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_SET_HOME_POSITION >= 256) { 07552 return; 07553 } 07554 #endif 07555 mavlink_message_t msg; 07556 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07557 uint16_t i; 07558 mavlink_set_home_position_t packet_in = { 07559 963497464,963497672,963497880,101.0,129.0,157.0,{ 185.0, 186.0, 187.0, 188.0 },297.0,325.0,353.0,161 07560 }; 07561 mavlink_set_home_position_t packet1, packet2; 07562 memset(&packet1, 0, sizeof(packet1)); 07563 packet1.latitude = packet_in.latitude; 07564 packet1.longitude = packet_in.longitude; 07565 packet1.altitude = packet_in.altitude; 07566 packet1.x = packet_in.x; 07567 packet1.y = packet_in.y; 07568 packet1.z = packet_in.z; 07569 packet1.approach_x = packet_in.approach_x; 07570 packet1.approach_y = packet_in.approach_y; 07571 packet1.approach_z = packet_in.approach_z; 07572 packet1.target_system = packet_in.target_system; 07573 07574 mav_array_memcpy(packet1.q, packet_in.q, sizeof(float)*4); 07575 07576 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07577 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07578 // cope with extensions 07579 memset(MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_SET_HOME_POSITION_MIN_LEN); 07580 } 07581 #endif 07582 memset(&packet2, 0, sizeof(packet2)); 07583 mavlink_msg_set_home_position_encode(system_id, component_id, &msg, &packet1); 07584 mavlink_msg_set_home_position_decode(&msg, &packet2); 07585 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07586 07587 memset(&packet2, 0, sizeof(packet2)); 07588 mavlink_msg_set_home_position_pack(system_id, component_id, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07589 mavlink_msg_set_home_position_decode(&msg, &packet2); 07590 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07591 07592 memset(&packet2, 0, sizeof(packet2)); 07593 mavlink_msg_set_home_position_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07594 mavlink_msg_set_home_position_decode(&msg, &packet2); 07595 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07596 07597 memset(&packet2, 0, sizeof(packet2)); 07598 mavlink_msg_to_send_buffer(buffer, &msg); 07599 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07600 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07601 } 07602 mavlink_msg_set_home_position_decode(last_msg, &packet2); 07603 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07604 07605 memset(&packet2, 0, sizeof(packet2)); 07606 mavlink_msg_set_home_position_send(MAVLINK_COMM_1 , packet1.target_system , packet1.latitude , packet1.longitude , packet1.altitude , packet1.x , packet1.y , packet1.z , packet1.q , packet1.approach_x , packet1.approach_y , packet1.approach_z ); 07607 mavlink_msg_set_home_position_decode(last_msg, &packet2); 07608 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07609 } 07610 07611 static void mavlink_test_message_interval(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07612 { 07613 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07614 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07615 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MESSAGE_INTERVAL >= 256) { 07616 return; 07617 } 07618 #endif 07619 mavlink_message_t msg; 07620 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07621 uint16_t i; 07622 mavlink_message_interval_t packet_in = { 07623 963497464,17443 07624 }; 07625 mavlink_message_interval_t packet1, packet2; 07626 memset(&packet1, 0, sizeof(packet1)); 07627 packet1.interval_us = packet_in.interval_us; 07628 packet1.message_id = packet_in.message_id; 07629 07630 07631 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07632 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07633 // cope with extensions 07634 memset(MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MESSAGE_INTERVAL_MIN_LEN); 07635 } 07636 #endif 07637 memset(&packet2, 0, sizeof(packet2)); 07638 mavlink_msg_message_interval_encode(system_id, component_id, &msg, &packet1); 07639 mavlink_msg_message_interval_decode(&msg, &packet2); 07640 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07641 07642 memset(&packet2, 0, sizeof(packet2)); 07643 mavlink_msg_message_interval_pack(system_id, component_id, &msg , packet1.message_id , packet1.interval_us ); 07644 mavlink_msg_message_interval_decode(&msg, &packet2); 07645 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07646 07647 memset(&packet2, 0, sizeof(packet2)); 07648 mavlink_msg_message_interval_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.message_id , packet1.interval_us ); 07649 mavlink_msg_message_interval_decode(&msg, &packet2); 07650 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07651 07652 memset(&packet2, 0, sizeof(packet2)); 07653 mavlink_msg_to_send_buffer(buffer, &msg); 07654 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07655 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07656 } 07657 mavlink_msg_message_interval_decode(last_msg, &packet2); 07658 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07659 07660 memset(&packet2, 0, sizeof(packet2)); 07661 mavlink_msg_message_interval_send(MAVLINK_COMM_1 , packet1.message_id , packet1.interval_us ); 07662 mavlink_msg_message_interval_decode(last_msg, &packet2); 07663 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07664 } 07665 07666 static void mavlink_test_extended_sys_state(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07667 { 07668 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07669 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07670 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_EXTENDED_SYS_STATE >= 256) { 07671 return; 07672 } 07673 #endif 07674 mavlink_message_t msg; 07675 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07676 uint16_t i; 07677 mavlink_extended_sys_state_t packet_in = { 07678 5,72 07679 }; 07680 mavlink_extended_sys_state_t packet1, packet2; 07681 memset(&packet1, 0, sizeof(packet1)); 07682 packet1.vtol_state = packet_in.vtol_state; 07683 packet1.landed_state = packet_in.landed_state; 07684 07685 07686 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07687 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07688 // cope with extensions 07689 memset(MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_EXTENDED_SYS_STATE_MIN_LEN); 07690 } 07691 #endif 07692 memset(&packet2, 0, sizeof(packet2)); 07693 mavlink_msg_extended_sys_state_encode(system_id, component_id, &msg, &packet1); 07694 mavlink_msg_extended_sys_state_decode(&msg, &packet2); 07695 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07696 07697 memset(&packet2, 0, sizeof(packet2)); 07698 mavlink_msg_extended_sys_state_pack(system_id, component_id, &msg , packet1.vtol_state , packet1.landed_state ); 07699 mavlink_msg_extended_sys_state_decode(&msg, &packet2); 07700 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07701 07702 memset(&packet2, 0, sizeof(packet2)); 07703 mavlink_msg_extended_sys_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.vtol_state , packet1.landed_state ); 07704 mavlink_msg_extended_sys_state_decode(&msg, &packet2); 07705 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07706 07707 memset(&packet2, 0, sizeof(packet2)); 07708 mavlink_msg_to_send_buffer(buffer, &msg); 07709 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07710 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07711 } 07712 mavlink_msg_extended_sys_state_decode(last_msg, &packet2); 07713 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07714 07715 memset(&packet2, 0, sizeof(packet2)); 07716 mavlink_msg_extended_sys_state_send(MAVLINK_COMM_1 , packet1.vtol_state , packet1.landed_state ); 07717 mavlink_msg_extended_sys_state_decode(last_msg, &packet2); 07718 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07719 } 07720 07721 static void mavlink_test_adsb_vehicle(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07722 { 07723 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07724 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07725 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_ADSB_VEHICLE >= 256) { 07726 return; 07727 } 07728 #endif 07729 mavlink_message_t msg; 07730 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07731 uint16_t i; 07732 mavlink_adsb_vehicle_t packet_in = { 07733 963497464,963497672,963497880,963498088,18067,18171,18275,18379,18483,211,"BCDEFGHI",113,180 07734 }; 07735 mavlink_adsb_vehicle_t packet1, packet2; 07736 memset(&packet1, 0, sizeof(packet1)); 07737 packet1.ICAO_address = packet_in.ICAO_address; 07738 packet1.lat = packet_in.lat; 07739 packet1.lon = packet_in.lon; 07740 packet1.altitude = packet_in.altitude; 07741 packet1.heading = packet_in.heading; 07742 packet1.hor_velocity = packet_in.hor_velocity; 07743 packet1.ver_velocity = packet_in.ver_velocity; 07744 packet1.flags = packet_in.flags; 07745 packet1.squawk = packet_in.squawk; 07746 packet1.altitude_type = packet_in.altitude_type; 07747 packet1.emitter_type = packet_in.emitter_type; 07748 packet1.tslc = packet_in.tslc; 07749 07750 mav_array_memcpy(packet1.callsign, packet_in.callsign, sizeof(char)*9); 07751 07752 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07753 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07754 // cope with extensions 07755 memset(MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_ADSB_VEHICLE_MIN_LEN); 07756 } 07757 #endif 07758 memset(&packet2, 0, sizeof(packet2)); 07759 mavlink_msg_adsb_vehicle_encode(system_id, component_id, &msg, &packet1); 07760 mavlink_msg_adsb_vehicle_decode(&msg, &packet2); 07761 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07762 07763 memset(&packet2, 0, sizeof(packet2)); 07764 mavlink_msg_adsb_vehicle_pack(system_id, component_id, &msg , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk ); 07765 mavlink_msg_adsb_vehicle_decode(&msg, &packet2); 07766 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07767 07768 memset(&packet2, 0, sizeof(packet2)); 07769 mavlink_msg_adsb_vehicle_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk ); 07770 mavlink_msg_adsb_vehicle_decode(&msg, &packet2); 07771 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07772 07773 memset(&packet2, 0, sizeof(packet2)); 07774 mavlink_msg_to_send_buffer(buffer, &msg); 07775 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07776 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07777 } 07778 mavlink_msg_adsb_vehicle_decode(last_msg, &packet2); 07779 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07780 07781 memset(&packet2, 0, sizeof(packet2)); 07782 mavlink_msg_adsb_vehicle_send(MAVLINK_COMM_1 , packet1.ICAO_address , packet1.lat , packet1.lon , packet1.altitude_type , packet1.altitude , packet1.heading , packet1.hor_velocity , packet1.ver_velocity , packet1.callsign , packet1.emitter_type , packet1.tslc , packet1.flags , packet1.squawk ); 07783 mavlink_msg_adsb_vehicle_decode(last_msg, &packet2); 07784 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07785 } 07786 07787 static void mavlink_test_collision(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07788 { 07789 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07790 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07791 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_COLLISION >= 256) { 07792 return; 07793 } 07794 #endif 07795 mavlink_message_t msg; 07796 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07797 uint16_t i; 07798 mavlink_collision_t packet_in = { 07799 963497464,45.0,73.0,101.0,53,120,187 07800 }; 07801 mavlink_collision_t packet1, packet2; 07802 memset(&packet1, 0, sizeof(packet1)); 07803 packet1.id = packet_in.id; 07804 packet1.time_to_minimum_delta = packet_in.time_to_minimum_delta; 07805 packet1.altitude_minimum_delta = packet_in.altitude_minimum_delta; 07806 packet1.horizontal_minimum_delta = packet_in.horizontal_minimum_delta; 07807 packet1.src = packet_in.src; 07808 packet1.action = packet_in.action; 07809 packet1.threat_level = packet_in.threat_level; 07810 07811 07812 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07813 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07814 // cope with extensions 07815 memset(MAVLINK_MSG_ID_COLLISION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_COLLISION_MIN_LEN); 07816 } 07817 #endif 07818 memset(&packet2, 0, sizeof(packet2)); 07819 mavlink_msg_collision_encode(system_id, component_id, &msg, &packet1); 07820 mavlink_msg_collision_decode(&msg, &packet2); 07821 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07822 07823 memset(&packet2, 0, sizeof(packet2)); 07824 mavlink_msg_collision_pack(system_id, component_id, &msg , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta ); 07825 mavlink_msg_collision_decode(&msg, &packet2); 07826 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07827 07828 memset(&packet2, 0, sizeof(packet2)); 07829 mavlink_msg_collision_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta ); 07830 mavlink_msg_collision_decode(&msg, &packet2); 07831 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07832 07833 memset(&packet2, 0, sizeof(packet2)); 07834 mavlink_msg_to_send_buffer(buffer, &msg); 07835 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07836 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07837 } 07838 mavlink_msg_collision_decode(last_msg, &packet2); 07839 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07840 07841 memset(&packet2, 0, sizeof(packet2)); 07842 mavlink_msg_collision_send(MAVLINK_COMM_1 , packet1.src , packet1.id , packet1.action , packet1.threat_level , packet1.time_to_minimum_delta , packet1.altitude_minimum_delta , packet1.horizontal_minimum_delta ); 07843 mavlink_msg_collision_decode(last_msg, &packet2); 07844 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07845 } 07846 07847 static void mavlink_test_v2_extension(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07848 { 07849 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07850 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07851 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_V2_EXTENSION >= 256) { 07852 return; 07853 } 07854 #endif 07855 mavlink_message_t msg; 07856 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07857 uint16_t i; 07858 mavlink_v2_extension_t packet_in = { 07859 17235,139,206,17,{ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76 } 07860 }; 07861 mavlink_v2_extension_t packet1, packet2; 07862 memset(&packet1, 0, sizeof(packet1)); 07863 packet1.message_type = packet_in.message_type; 07864 packet1.target_network = packet_in.target_network; 07865 packet1.target_system = packet_in.target_system; 07866 packet1.target_component = packet_in.target_component; 07867 07868 mav_array_memcpy(packet1.payload, packet_in.payload, sizeof(uint8_t)*249); 07869 07870 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07871 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07872 // cope with extensions 07873 memset(MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_V2_EXTENSION_MIN_LEN); 07874 } 07875 #endif 07876 memset(&packet2, 0, sizeof(packet2)); 07877 mavlink_msg_v2_extension_encode(system_id, component_id, &msg, &packet1); 07878 mavlink_msg_v2_extension_decode(&msg, &packet2); 07879 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07880 07881 memset(&packet2, 0, sizeof(packet2)); 07882 mavlink_msg_v2_extension_pack(system_id, component_id, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload ); 07883 mavlink_msg_v2_extension_decode(&msg, &packet2); 07884 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07885 07886 memset(&packet2, 0, sizeof(packet2)); 07887 mavlink_msg_v2_extension_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload ); 07888 mavlink_msg_v2_extension_decode(&msg, &packet2); 07889 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07890 07891 memset(&packet2, 0, sizeof(packet2)); 07892 mavlink_msg_to_send_buffer(buffer, &msg); 07893 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07894 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07895 } 07896 mavlink_msg_v2_extension_decode(last_msg, &packet2); 07897 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07898 07899 memset(&packet2, 0, sizeof(packet2)); 07900 mavlink_msg_v2_extension_send(MAVLINK_COMM_1 , packet1.target_network , packet1.target_system , packet1.target_component , packet1.message_type , packet1.payload ); 07901 mavlink_msg_v2_extension_decode(last_msg, &packet2); 07902 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07903 } 07904 07905 static void mavlink_test_memory_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07906 { 07907 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07908 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07909 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_MEMORY_VECT >= 256) { 07910 return; 07911 } 07912 #endif 07913 mavlink_message_t msg; 07914 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07915 uint16_t i; 07916 mavlink_memory_vect_t packet_in = { 07917 17235,139,206,{ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48 } 07918 }; 07919 mavlink_memory_vect_t packet1, packet2; 07920 memset(&packet1, 0, sizeof(packet1)); 07921 packet1.address = packet_in.address; 07922 packet1.ver = packet_in.ver; 07923 packet1.type = packet_in.type; 07924 07925 mav_array_memcpy(packet1.value, packet_in.value, sizeof(int8_t)*32); 07926 07927 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07928 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07929 // cope with extensions 07930 memset(MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_MEMORY_VECT_MIN_LEN); 07931 } 07932 #endif 07933 memset(&packet2, 0, sizeof(packet2)); 07934 mavlink_msg_memory_vect_encode(system_id, component_id, &msg, &packet1); 07935 mavlink_msg_memory_vect_decode(&msg, &packet2); 07936 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07937 07938 memset(&packet2, 0, sizeof(packet2)); 07939 mavlink_msg_memory_vect_pack(system_id, component_id, &msg , packet1.address , packet1.ver , packet1.type , packet1.value ); 07940 mavlink_msg_memory_vect_decode(&msg, &packet2); 07941 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07942 07943 memset(&packet2, 0, sizeof(packet2)); 07944 mavlink_msg_memory_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.address , packet1.ver , packet1.type , packet1.value ); 07945 mavlink_msg_memory_vect_decode(&msg, &packet2); 07946 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07947 07948 memset(&packet2, 0, sizeof(packet2)); 07949 mavlink_msg_to_send_buffer(buffer, &msg); 07950 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 07951 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 07952 } 07953 mavlink_msg_memory_vect_decode(last_msg, &packet2); 07954 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07955 07956 memset(&packet2, 0, sizeof(packet2)); 07957 mavlink_msg_memory_vect_send(MAVLINK_COMM_1 , packet1.address , packet1.ver , packet1.type , packet1.value ); 07958 mavlink_msg_memory_vect_decode(last_msg, &packet2); 07959 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07960 } 07961 07962 static void mavlink_test_debug_vect(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 07963 { 07964 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07965 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 07966 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEBUG_VECT >= 256) { 07967 return; 07968 } 07969 #endif 07970 mavlink_message_t msg; 07971 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 07972 uint16_t i; 07973 mavlink_debug_vect_t packet_in = { 07974 93372036854775807ULL,73.0,101.0,129.0,"UVWXYZABC" 07975 }; 07976 mavlink_debug_vect_t packet1, packet2; 07977 memset(&packet1, 0, sizeof(packet1)); 07978 packet1.time_usec = packet_in.time_usec; 07979 packet1.x = packet_in.x; 07980 packet1.y = packet_in.y; 07981 packet1.z = packet_in.z; 07982 07983 mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); 07984 07985 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 07986 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 07987 // cope with extensions 07988 memset(MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEBUG_VECT_MIN_LEN); 07989 } 07990 #endif 07991 memset(&packet2, 0, sizeof(packet2)); 07992 mavlink_msg_debug_vect_encode(system_id, component_id, &msg, &packet1); 07993 mavlink_msg_debug_vect_decode(&msg, &packet2); 07994 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 07995 07996 memset(&packet2, 0, sizeof(packet2)); 07997 mavlink_msg_debug_vect_pack(system_id, component_id, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z ); 07998 mavlink_msg_debug_vect_decode(&msg, &packet2); 07999 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08000 08001 memset(&packet2, 0, sizeof(packet2)); 08002 mavlink_msg_debug_vect_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z ); 08003 mavlink_msg_debug_vect_decode(&msg, &packet2); 08004 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08005 08006 memset(&packet2, 0, sizeof(packet2)); 08007 mavlink_msg_to_send_buffer(buffer, &msg); 08008 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 08009 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 08010 } 08011 mavlink_msg_debug_vect_decode(last_msg, &packet2); 08012 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08013 08014 memset(&packet2, 0, sizeof(packet2)); 08015 mavlink_msg_debug_vect_send(MAVLINK_COMM_1 , packet1.name , packet1.time_usec , packet1.x , packet1.y , packet1.z ); 08016 mavlink_msg_debug_vect_decode(last_msg, &packet2); 08017 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08018 } 08019 08020 static void mavlink_test_named_value_float(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 08021 { 08022 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08023 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 08024 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAMED_VALUE_FLOAT >= 256) { 08025 return; 08026 } 08027 #endif 08028 mavlink_message_t msg; 08029 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 08030 uint16_t i; 08031 mavlink_named_value_float_t packet_in = { 08032 963497464,45.0,"IJKLMNOPQ" 08033 }; 08034 mavlink_named_value_float_t packet1, packet2; 08035 memset(&packet1, 0, sizeof(packet1)); 08036 packet1.time_boot_ms = packet_in.time_boot_ms; 08037 packet1.value = packet_in.value; 08038 08039 mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); 08040 08041 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08042 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 08043 // cope with extensions 08044 memset(MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAMED_VALUE_FLOAT_MIN_LEN); 08045 } 08046 #endif 08047 memset(&packet2, 0, sizeof(packet2)); 08048 mavlink_msg_named_value_float_encode(system_id, component_id, &msg, &packet1); 08049 mavlink_msg_named_value_float_decode(&msg, &packet2); 08050 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08051 08052 memset(&packet2, 0, sizeof(packet2)); 08053 mavlink_msg_named_value_float_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value ); 08054 mavlink_msg_named_value_float_decode(&msg, &packet2); 08055 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08056 08057 memset(&packet2, 0, sizeof(packet2)); 08058 mavlink_msg_named_value_float_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value ); 08059 mavlink_msg_named_value_float_decode(&msg, &packet2); 08060 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08061 08062 memset(&packet2, 0, sizeof(packet2)); 08063 mavlink_msg_to_send_buffer(buffer, &msg); 08064 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 08065 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 08066 } 08067 mavlink_msg_named_value_float_decode(last_msg, &packet2); 08068 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08069 08070 memset(&packet2, 0, sizeof(packet2)); 08071 mavlink_msg_named_value_float_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value ); 08072 mavlink_msg_named_value_float_decode(last_msg, &packet2); 08073 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08074 } 08075 08076 static void mavlink_test_named_value_int(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 08077 { 08078 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08079 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 08080 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_NAMED_VALUE_INT >= 256) { 08081 return; 08082 } 08083 #endif 08084 mavlink_message_t msg; 08085 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 08086 uint16_t i; 08087 mavlink_named_value_int_t packet_in = { 08088 963497464,963497672,"IJKLMNOPQ" 08089 }; 08090 mavlink_named_value_int_t packet1, packet2; 08091 memset(&packet1, 0, sizeof(packet1)); 08092 packet1.time_boot_ms = packet_in.time_boot_ms; 08093 packet1.value = packet_in.value; 08094 08095 mav_array_memcpy(packet1.name, packet_in.name, sizeof(char)*10); 08096 08097 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08098 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 08099 // cope with extensions 08100 memset(MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_NAMED_VALUE_INT_MIN_LEN); 08101 } 08102 #endif 08103 memset(&packet2, 0, sizeof(packet2)); 08104 mavlink_msg_named_value_int_encode(system_id, component_id, &msg, &packet1); 08105 mavlink_msg_named_value_int_decode(&msg, &packet2); 08106 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08107 08108 memset(&packet2, 0, sizeof(packet2)); 08109 mavlink_msg_named_value_int_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.name , packet1.value ); 08110 mavlink_msg_named_value_int_decode(&msg, &packet2); 08111 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08112 08113 memset(&packet2, 0, sizeof(packet2)); 08114 mavlink_msg_named_value_int_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.name , packet1.value ); 08115 mavlink_msg_named_value_int_decode(&msg, &packet2); 08116 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08117 08118 memset(&packet2, 0, sizeof(packet2)); 08119 mavlink_msg_to_send_buffer(buffer, &msg); 08120 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 08121 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 08122 } 08123 mavlink_msg_named_value_int_decode(last_msg, &packet2); 08124 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08125 08126 memset(&packet2, 0, sizeof(packet2)); 08127 mavlink_msg_named_value_int_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.name , packet1.value ); 08128 mavlink_msg_named_value_int_decode(last_msg, &packet2); 08129 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08130 } 08131 08132 static void mavlink_test_statustext(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 08133 { 08134 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08135 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 08136 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_STATUSTEXT >= 256) { 08137 return; 08138 } 08139 #endif 08140 mavlink_message_t msg; 08141 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 08142 uint16_t i; 08143 mavlink_statustext_t packet_in = { 08144 5,"BCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWX" 08145 }; 08146 mavlink_statustext_t packet1, packet2; 08147 memset(&packet1, 0, sizeof(packet1)); 08148 packet1.severity = packet_in.severity; 08149 08150 mav_array_memcpy(packet1.text, packet_in.text, sizeof(char)*50); 08151 08152 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08153 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 08154 // cope with extensions 08155 memset(MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_STATUSTEXT_MIN_LEN); 08156 } 08157 #endif 08158 memset(&packet2, 0, sizeof(packet2)); 08159 mavlink_msg_statustext_encode(system_id, component_id, &msg, &packet1); 08160 mavlink_msg_statustext_decode(&msg, &packet2); 08161 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08162 08163 memset(&packet2, 0, sizeof(packet2)); 08164 mavlink_msg_statustext_pack(system_id, component_id, &msg , packet1.severity , packet1.text ); 08165 mavlink_msg_statustext_decode(&msg, &packet2); 08166 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08167 08168 memset(&packet2, 0, sizeof(packet2)); 08169 mavlink_msg_statustext_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.severity , packet1.text ); 08170 mavlink_msg_statustext_decode(&msg, &packet2); 08171 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08172 08173 memset(&packet2, 0, sizeof(packet2)); 08174 mavlink_msg_to_send_buffer(buffer, &msg); 08175 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 08176 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 08177 } 08178 mavlink_msg_statustext_decode(last_msg, &packet2); 08179 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08180 08181 memset(&packet2, 0, sizeof(packet2)); 08182 mavlink_msg_statustext_send(MAVLINK_COMM_1 , packet1.severity , packet1.text ); 08183 mavlink_msg_statustext_decode(last_msg, &packet2); 08184 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08185 } 08186 08187 static void mavlink_test_debug(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 08188 { 08189 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08190 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); 08191 if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_DEBUG >= 256) { 08192 return; 08193 } 08194 #endif 08195 mavlink_message_t msg; 08196 uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; 08197 uint16_t i; 08198 mavlink_debug_t packet_in = { 08199 963497464,45.0,29 08200 }; 08201 mavlink_debug_t packet1, packet2; 08202 memset(&packet1, 0, sizeof(packet1)); 08203 packet1.time_boot_ms = packet_in.time_boot_ms; 08204 packet1.value = packet_in.value; 08205 packet1.ind = packet_in.ind; 08206 08207 08208 #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 08209 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { 08210 // cope with extensions 08211 memset(MAVLINK_MSG_ID_DEBUG_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_DEBUG_MIN_LEN); 08212 } 08213 #endif 08214 memset(&packet2, 0, sizeof(packet2)); 08215 mavlink_msg_debug_encode(system_id, component_id, &msg, &packet1); 08216 mavlink_msg_debug_decode(&msg, &packet2); 08217 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08218 08219 memset(&packet2, 0, sizeof(packet2)); 08220 mavlink_msg_debug_pack(system_id, component_id, &msg , packet1.time_boot_ms , packet1.ind , packet1.value ); 08221 mavlink_msg_debug_decode(&msg, &packet2); 08222 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08223 08224 memset(&packet2, 0, sizeof(packet2)); 08225 mavlink_msg_debug_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_boot_ms , packet1.ind , packet1.value ); 08226 mavlink_msg_debug_decode(&msg, &packet2); 08227 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08228 08229 memset(&packet2, 0, sizeof(packet2)); 08230 mavlink_msg_to_send_buffer(buffer, &msg); 08231 for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) { 08232 comm_send_ch(MAVLINK_COMM_0, buffer[i]); 08233 } 08234 mavlink_msg_debug_decode(last_msg, &packet2); 08235 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08236 08237 memset(&packet2, 0, sizeof(packet2)); 08238 mavlink_msg_debug_send(MAVLINK_COMM_1 , packet1.time_boot_ms , packet1.ind , packet1.value ); 08239 mavlink_msg_debug_decode(last_msg, &packet2); 08240 MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); 08241 } 08242 08243 static void mavlink_test_common(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) 08244 { 08245 mavlink_test_heartbeat(system_id, component_id, last_msg); 08246 mavlink_test_sys_status(system_id, component_id, last_msg); 08247 mavlink_test_system_time(system_id, component_id, last_msg); 08248 mavlink_test_ping(system_id, component_id, last_msg); 08249 mavlink_test_change_operator_control(system_id, component_id, last_msg); 08250 mavlink_test_change_operator_control_ack(system_id, component_id, last_msg); 08251 mavlink_test_auth_key(system_id, component_id, last_msg); 08252 mavlink_test_set_mode(system_id, component_id, last_msg); 08253 mavlink_test_param_request_read(system_id, component_id, last_msg); 08254 mavlink_test_param_request_list(system_id, component_id, last_msg); 08255 mavlink_test_param_value(system_id, component_id, last_msg); 08256 mavlink_test_param_set(system_id, component_id, last_msg); 08257 mavlink_test_gps_raw_int(system_id, component_id, last_msg); 08258 mavlink_test_gps_status(system_id, component_id, last_msg); 08259 mavlink_test_scaled_imu(system_id, component_id, last_msg); 08260 mavlink_test_raw_imu(system_id, component_id, last_msg); 08261 mavlink_test_raw_pressure(system_id, component_id, last_msg); 08262 mavlink_test_scaled_pressure(system_id, component_id, last_msg); 08263 mavlink_test_attitude(system_id, component_id, last_msg); 08264 mavlink_test_attitude_quaternion(system_id, component_id, last_msg); 08265 mavlink_test_local_position_ned(system_id, component_id, last_msg); 08266 mavlink_test_global_position_int(system_id, component_id, last_msg); 08267 mavlink_test_rc_channels_scaled(system_id, component_id, last_msg); 08268 mavlink_test_rc_channels_raw(system_id, component_id, last_msg); 08269 mavlink_test_servo_output_raw(system_id, component_id, last_msg); 08270 mavlink_test_mission_request_partial_list(system_id, component_id, last_msg); 08271 mavlink_test_mission_write_partial_list(system_id, component_id, last_msg); 08272 mavlink_test_mission_item(system_id, component_id, last_msg); 08273 mavlink_test_mission_request(system_id, component_id, last_msg); 08274 mavlink_test_mission_set_current(system_id, component_id, last_msg); 08275 mavlink_test_mission_current(system_id, component_id, last_msg); 08276 mavlink_test_mission_request_list(system_id, component_id, last_msg); 08277 mavlink_test_mission_count(system_id, component_id, last_msg); 08278 mavlink_test_mission_clear_all(system_id, component_id, last_msg); 08279 mavlink_test_mission_item_reached(system_id, component_id, last_msg); 08280 mavlink_test_mission_ack(system_id, component_id, last_msg); 08281 mavlink_test_set_gps_global_origin(system_id, component_id, last_msg); 08282 mavlink_test_gps_global_origin(system_id, component_id, last_msg); 08283 mavlink_test_param_map_rc(system_id, component_id, last_msg); 08284 mavlink_test_mission_request_int(system_id, component_id, last_msg); 08285 mavlink_test_safety_set_allowed_area(system_id, component_id, last_msg); 08286 mavlink_test_safety_allowed_area(system_id, component_id, last_msg); 08287 mavlink_test_attitude_quaternion_cov(system_id, component_id, last_msg); 08288 mavlink_test_nav_controller_output(system_id, component_id, last_msg); 08289 mavlink_test_global_position_int_cov(system_id, component_id, last_msg); 08290 mavlink_test_local_position_ned_cov(system_id, component_id, last_msg); 08291 mavlink_test_rc_channels(system_id, component_id, last_msg); 08292 mavlink_test_request_data_stream(system_id, component_id, last_msg); 08293 mavlink_test_data_stream(system_id, component_id, last_msg); 08294 mavlink_test_manual_control(system_id, component_id, last_msg); 08295 mavlink_test_rc_channels_override(system_id, component_id, last_msg); 08296 mavlink_test_mission_item_int(system_id, component_id, last_msg); 08297 mavlink_test_vfr_hud(system_id, component_id, last_msg); 08298 mavlink_test_command_int(system_id, component_id, last_msg); 08299 mavlink_test_command_long(system_id, component_id, last_msg); 08300 mavlink_test_command_ack(system_id, component_id, last_msg); 08301 mavlink_test_manual_setpoint(system_id, component_id, last_msg); 08302 mavlink_test_set_attitude_target(system_id, component_id, last_msg); 08303 mavlink_test_attitude_target(system_id, component_id, last_msg); 08304 mavlink_test_set_position_target_local_ned(system_id, component_id, last_msg); 08305 mavlink_test_position_target_local_ned(system_id, component_id, last_msg); 08306 mavlink_test_set_position_target_global_int(system_id, component_id, last_msg); 08307 mavlink_test_position_target_global_int(system_id, component_id, last_msg); 08308 mavlink_test_local_position_ned_system_global_offset(system_id, component_id, last_msg); 08309 mavlink_test_hil_state(system_id, component_id, last_msg); 08310 mavlink_test_hil_controls(system_id, component_id, last_msg); 08311 mavlink_test_hil_rc_inputs_raw(system_id, component_id, last_msg); 08312 mavlink_test_hil_actuator_controls(system_id, component_id, last_msg); 08313 mavlink_test_optical_flow(system_id, component_id, last_msg); 08314 mavlink_test_global_vision_position_estimate(system_id, component_id, last_msg); 08315 mavlink_test_vision_position_estimate(system_id, component_id, last_msg); 08316 mavlink_test_vision_speed_estimate(system_id, component_id, last_msg); 08317 mavlink_test_vicon_position_estimate(system_id, component_id, last_msg); 08318 mavlink_test_highres_imu(system_id, component_id, last_msg); 08319 mavlink_test_optical_flow_rad(system_id, component_id, last_msg); 08320 mavlink_test_hil_sensor(system_id, component_id, last_msg); 08321 mavlink_test_sim_state(system_id, component_id, last_msg); 08322 mavlink_test_radio_status(system_id, component_id, last_msg); 08323 mavlink_test_file_transfer_protocol(system_id, component_id, last_msg); 08324 mavlink_test_timesync(system_id, component_id, last_msg); 08325 mavlink_test_camera_trigger(system_id, component_id, last_msg); 08326 mavlink_test_hil_gps(system_id, component_id, last_msg); 08327 mavlink_test_hil_optical_flow(system_id, component_id, last_msg); 08328 mavlink_test_hil_state_quaternion(system_id, component_id, last_msg); 08329 mavlink_test_scaled_imu2(system_id, component_id, last_msg); 08330 mavlink_test_log_request_list(system_id, component_id, last_msg); 08331 mavlink_test_log_entry(system_id, component_id, last_msg); 08332 mavlink_test_log_request_data(system_id, component_id, last_msg); 08333 mavlink_test_log_data(system_id, component_id, last_msg); 08334 mavlink_test_log_erase(system_id, component_id, last_msg); 08335 mavlink_test_log_request_end(system_id, component_id, last_msg); 08336 mavlink_test_gps_inject_data(system_id, component_id, last_msg); 08337 mavlink_test_gps2_raw(system_id, component_id, last_msg); 08338 mavlink_test_power_status(system_id, component_id, last_msg); 08339 mavlink_test_serial_control(system_id, component_id, last_msg); 08340 mavlink_test_gps_rtk(system_id, component_id, last_msg); 08341 mavlink_test_gps2_rtk(system_id, component_id, last_msg); 08342 mavlink_test_scaled_imu3(system_id, component_id, last_msg); 08343 mavlink_test_data_transmission_handshake(system_id, component_id, last_msg); 08344 mavlink_test_encapsulated_data(system_id, component_id, last_msg); 08345 mavlink_test_distance_sensor(system_id, component_id, last_msg); 08346 mavlink_test_terrain_request(system_id, component_id, last_msg); 08347 mavlink_test_terrain_data(system_id, component_id, last_msg); 08348 mavlink_test_terrain_check(system_id, component_id, last_msg); 08349 mavlink_test_terrain_report(system_id, component_id, last_msg); 08350 mavlink_test_scaled_pressure2(system_id, component_id, last_msg); 08351 mavlink_test_att_pos_mocap(system_id, component_id, last_msg); 08352 mavlink_test_set_actuator_control_target(system_id, component_id, last_msg); 08353 mavlink_test_actuator_control_target(system_id, component_id, last_msg); 08354 mavlink_test_altitude(system_id, component_id, last_msg); 08355 mavlink_test_resource_request(system_id, component_id, last_msg); 08356 mavlink_test_scaled_pressure3(system_id, component_id, last_msg); 08357 mavlink_test_follow_target(system_id, component_id, last_msg); 08358 mavlink_test_control_system_state(system_id, component_id, last_msg); 08359 mavlink_test_battery_status(system_id, component_id, last_msg); 08360 mavlink_test_autopilot_version(system_id, component_id, last_msg); 08361 mavlink_test_landing_target(system_id, component_id, last_msg); 08362 mavlink_test_estimator_status(system_id, component_id, last_msg); 08363 mavlink_test_wind_cov(system_id, component_id, last_msg); 08364 mavlink_test_gps_input(system_id, component_id, last_msg); 08365 mavlink_test_gps_rtcm_data(system_id, component_id, last_msg); 08366 mavlink_test_high_latency(system_id, component_id, last_msg); 08367 mavlink_test_vibration(system_id, component_id, last_msg); 08368 mavlink_test_home_position(system_id, component_id, last_msg); 08369 mavlink_test_set_home_position(system_id, component_id, last_msg); 08370 mavlink_test_message_interval(system_id, component_id, last_msg); 08371 mavlink_test_extended_sys_state(system_id, component_id, last_msg); 08372 mavlink_test_adsb_vehicle(system_id, component_id, last_msg); 08373 mavlink_test_collision(system_id, component_id, last_msg); 08374 mavlink_test_v2_extension(system_id, component_id, last_msg); 08375 mavlink_test_memory_vect(system_id, component_id, last_msg); 08376 mavlink_test_debug_vect(system_id, component_id, last_msg); 08377 mavlink_test_named_value_float(system_id, component_id, last_msg); 08378 mavlink_test_named_value_int(system_id, component_id, last_msg); 08379 mavlink_test_statustext(system_id, component_id, last_msg); 08380 mavlink_test_debug(system_id, component_id, last_msg); 08381 } 08382 08383 #ifdef __cplusplus 08384 } 08385 #endif // __cplusplus 08386 #endif // COMMON_TESTSUITE_H 08387
Generated on Wed Jul 13 2022 05:12:04 by
