Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/libraries/AP_ADSB/AP_ADSB_uAvionix_UCP.h
Views: 1798
/*1Copyright (C) 2021 Kraus Hamdani Aerospace Inc. All rights reserved.23This program is free software: you can redistribute it and/or modify4it under the terms of the GNU General Public License as published by5the Free Software Foundation, either version 3 of the License, or6(at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program. If not, see <http://www.gnu.org/licenses/>.1516Author: Tom Pittenger17*/1819#pragma once20#include "AP_ADSB_Backend.h"2122#if HAL_ADSB_UCP_ENABLED2324#define AP_ADSB_UAVIONIX_UCP_CAPTURE_ALL_RX_PACKETS 12526#include "GDL90_protocol/GDL90_Message_Structs.h"27#include "GDL90_protocol/hostGDL90Support.h"2829class AP_ADSB_uAvionix_UCP : public AP_ADSB_Backend {30public:31using AP_ADSB_Backend::AP_ADSB_Backend;3233// init - performs any required initialisation for this instance34bool init() override;3536// update - should be called periodically37void update() override;3839// static detection function40static bool detect();4142private:4344void handle_msg(const GDL90_RX_MESSAGE &msg);45bool request_msg(const GDL90_MESSAGE_ID msg_id);4647void send_GPS_Data();48void send_Transponder_Control();49const char* get_hardware_name(const uint8_t hwId);5051bool hostTransmit(uint8_t *buffer, uint16_t length);52uint16_t gdl90Transmit(GDL90_TX_MESSAGE &message, const uint16_t length);53static bool parseByte(const uint8_t data, GDL90_RX_MESSAGE &msg, GDL90_RX_STATUS &status);5455struct {56uint32_t last_msg_ms;57GDL90_RX_MESSAGE msg;58GDL90_RX_STATUS status;5960// cache local copies so we always have the latest info of everything.61struct {62GDL90_IDENTIFICATION_V3 identification;63GDL90_TRANSPONDER_CONFIG_MSG_V4_V5 transponder_config;64GDL90_HEARTBEAT heartbeat;65GDL90_TRANSPONDER_STATUS_MSG transponder_status;66GDL90_TRANSPONDER_STATUS_MSG_V3 transponder_status_v3;67#if AP_ADSB_UAVIONIX_UCP_CAPTURE_ALL_RX_PACKETS68GDL90_OWNSHIP_REPORT ownship_report;69GDL90_OWNSHIP_GEO_ALTITUDE ownship_geometric_altitude;70GDL90_SENSOR_BARO_MESSAGE sensor_message;71#endif72} decoded;73} rx;7475struct {76uint32_t last_packet_GPS_ms; // out77uint32_t last_packet_Transponder_Control_ms; // out78uint32_t last_packet_Transponder_Status_ms; // in79uint32_t last_packet_Transponder_Heartbeat_ms; // in80uint32_t last_packet_Transponder_Ownship_ms; // in81uint32_t last_gcs_send_message_Transponder_Status_ms; // out82uint32_t last_packet_Request_Transponder_Config_ms; // out83uint32_t last_packet_Transponder_Config_ms; // in84uint32_t request_Transponder_Config_tries;85uint32_t last_packet_Request_Transponder_Id_ms; // out86uint32_t last_packet_Transponder_Id_ms; // in87uint32_t request_Transponder_Id_tries;8889} run_state;9091};92#endif // HAL_ADSB_UCP_ENABLED93949596