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/Tools/AP_Periph/GCS_MAVLink.h
Views: 1798
/*1This program is free software: you can redistribute it and/or modify2it under the terms of the GNU General Public License as published by3the Free Software Foundation, either version 3 of the License, or4(at your option) any later version.56This program is distributed in the hope that it will be useful,7but WITHOUT ANY WARRANTY; without even the implied warranty of8MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9GNU General Public License for more details.1011You should have received a copy of the GNU General Public License12along with this program. If not, see <http://www.gnu.org/licenses/>.13*/14#pragma once1516#include <GCS_MAVLink/GCS.h>17#if HAL_GCS_ENABLED1819/*20* GCS backend used for many examples and tools21*/22class GCS_MAVLINK_Periph : public GCS_MAVLINK23{24public:2526using GCS_MAVLINK::GCS_MAVLINK;2728private:2930uint32_t telem_delay() const override { return 0; }31bool handle_guided_request(AP_Mission::Mission_Command &cmd) override { return true; }32MAV_RESULT handle_preflight_reboot(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override;33uint8_t sysid_my_gcs() const override;3435protected:3637// Periph information:38MAV_MODE base_mode() const override { return (MAV_MODE)MAV_MODE_FLAG_CUSTOM_MODE_ENABLED; }39MAV_STATE vehicle_system_status() const override { return MAV_STATE_CALIBRATING; }4041void send_nav_controller_output() const override {};42void send_pid_tuning() override {};43virtual uint8_t send_available_mode(uint8_t index) const override { return 0; }44};4546/*47* a GCS singleton used for many example sketches and tools48*/4950extern const AP_HAL::HAL& hal;5152class GCS_Periph : public GCS53{54public:5556using GCS::GCS;5758protected:5960uint8_t sysid_this_mav() const override;6162GCS_MAVLINK_Periph *new_gcs_mavlink_backend(GCS_MAVLINK_Parameters ¶ms,63AP_HAL::UARTDriver &uart) override {64return NEW_NOTHROW GCS_MAVLINK_Periph(params, uart);65}6667private:68// the following define expands to a pair of methods to retrieve a69// pointer to an object of the correct subclass for the link at70// offset ofs. These are of the form:71// GCS_MAVLINK_XXXX *chan(const uint8_t ofs) override;72// const GCS_MAVLINK_XXXX *chan(const uint8_t ofs) override const;73GCS_MAVLINK_CHAN_METHOD_DEFINITIONS(GCS_MAVLINK_Periph);7475MAV_TYPE frame_type() const override { return MAV_TYPE_GENERIC; }76uint32_t custom_mode() const override { return 3; } // magic number77};78#endif // HAL_GCS_ENABLED798081