/** @file * @brief MAVLink comm protocol testsuite generated from cubepilot.xml * @see https://mavlink.io/en/ */ #pragma once #ifndef CUBEPILOT_TESTSUITE_H #define CUBEPILOT_TESTSUITE_H #ifdef __cplusplus extern "C" { #endif #ifndef MAVLINK_TEST_ALL #define MAVLINK_TEST_ALL static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_cubepilot(uint8_t, uint8_t, mavlink_message_t *last_msg); static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { mavlink_test_common(system_id, component_id, last_msg); mavlink_test_cubepilot(system_id, component_id, last_msg); } #endif #include "../common/testsuite.h" static void mavlink_test_cubepilot_raw_rc(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) { #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 mavlink_status_t *status = mavlink_get_channel_status(MAVLINK_COMM_0); if ((status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CUBEPILOT_RAW_RC >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_cubepilot_raw_rc_t packet_in = { { 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 } }; mavlink_cubepilot_raw_rc_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); mav_array_memcpy(packet1.rc_raw, packet_in.rc_raw, sizeof(uint8_t)*32); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions memset(MAVLINK_MSG_ID_CUBEPILOT_RAW_RC_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CUBEPILOT_RAW_RC_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_raw_rc_encode(system_id, component_id, &msg, &packet1); mavlink_msg_cubepilot_raw_rc_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_raw_rc_pack(system_id, component_id, &msg , packet1.rc_raw ); mavlink_msg_cubepilot_raw_rc_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_raw_rc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rc_raw ); mavlink_msg_cubepilot_raw_rc_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HERELINK_VIDEO_STREAM_INFORMATION >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_herelink_video_stream_information_t packet_in = { 17.0,963497672,17651,17755,17859,175,242,"QRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJK" }; mavlink_herelink_video_stream_information_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.framerate = packet_in.framerate; packet1.bitrate = packet_in.bitrate; packet1.resolution_h = packet_in.resolution_h; packet1.resolution_v = packet_in.resolution_v; packet1.rotation = packet_in.rotation; packet1.camera_id = packet_in.camera_id; packet1.status = packet_in.status; mav_array_memcpy(packet1.uri, packet_in.uri, sizeof(char)*230); #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions memset(MAVLINK_MSG_ID_HERELINK_VIDEO_STREAM_INFORMATION_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HERELINK_VIDEO_STREAM_INFORMATION_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_video_stream_information_encode(system_id, component_id, &msg, &packet1); mavlink_msg_herelink_video_stream_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_video_stream_information_pack(system_id, component_id, &msg , packet1.camera_id , packet1.status , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.uri ); mavlink_msg_herelink_video_stream_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_video_stream_information_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.camera_id , packet1.status , packet1.framerate , packet1.resolution_h , packet1.resolution_v , packet1.bitrate , packet1.rotation , packet1.uri ); mavlink_msg_herelink_video_stream_information_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_HERELINK_TELEM >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_herelink_telem_t packet_in = { 963497464,963497672,963497880,17859,17963,18067,187 }; mavlink_herelink_telem_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.rf_freq = packet_in.rf_freq; packet1.link_bw = packet_in.link_bw; packet1.link_rate = packet_in.link_rate; packet1.snr = packet_in.snr; packet1.cpu_temp = packet_in.cpu_temp; packet1.board_temp = packet_in.board_temp; packet1.rssi = packet_in.rssi; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions memset(MAVLINK_MSG_ID_HERELINK_TELEM_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_HERELINK_TELEM_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_telem_encode(system_id, component_id, &msg, &packet1); mavlink_msg_herelink_telem_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_telem_pack(system_id, component_id, &msg , packet1.rssi , packet1.snr , packet1.rf_freq , packet1.link_bw , packet1.link_rate , packet1.cpu_temp , packet1.board_temp ); mavlink_msg_herelink_telem_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_herelink_telem_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.rssi , packet1.snr , packet1.rf_freq , packet1.link_bw , packet1.link_rate , packet1.cpu_temp , packet1.board_temp ); mavlink_msg_herelink_telem_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_START >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_cubepilot_firmware_update_start_t packet_in = { 963497464,963497672,29,96 }; mavlink_cubepilot_firmware_update_start_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.size = packet_in.size; packet1.crc = packet_in.crc; packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions memset(MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_START_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_START_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_start_encode(system_id, component_id, &msg, &packet1); mavlink_msg_cubepilot_firmware_update_start_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_start_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.size , packet1.crc ); mavlink_msg_cubepilot_firmware_update_start_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_start_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.size , packet1.crc ); mavlink_msg_cubepilot_firmware_update_start_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; iflags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) && MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_RESP >= 256) { return; } #endif mavlink_message_t msg; uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint16_t i; mavlink_cubepilot_firmware_update_resp_t packet_in = { 963497464,17,84 }; mavlink_cubepilot_firmware_update_resp_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.offset = packet_in.offset; packet1.target_system = packet_in.target_system; packet1.target_component = packet_in.target_component; #ifdef MAVLINK_STATUS_FLAG_OUT_MAVLINK1 if (status->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1) { // cope with extensions memset(MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_RESP_MIN_LEN + (char *)&packet1, 0, sizeof(packet1)-MAVLINK_MSG_ID_CUBEPILOT_FIRMWARE_UPDATE_RESP_MIN_LEN); } #endif memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_resp_encode(system_id, component_id, &msg, &packet1); mavlink_msg_cubepilot_firmware_update_resp_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_resp_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.offset ); mavlink_msg_cubepilot_firmware_update_resp_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_cubepilot_firmware_update_resp_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.offset ); mavlink_msg_cubepilot_firmware_update_resp_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); mavlink_msg_to_send_buffer(buffer, &msg); for (i=0; i