/*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:2930bool handle_guided_request(AP_Mission::Mission_Command &cmd) override { return true; }31MAV_RESULT handle_preflight_reboot(const mavlink_command_int_t &packet, const mavlink_message_t &msg) override;3233protected:3435// Periph information:36uint8_t base_mode() const override { return MAV_MODE_FLAG_CUSTOM_MODE_ENABLED; }37MAV_STATE vehicle_system_status() const override { return MAV_STATE_CALIBRATING; }3839void send_nav_controller_output() const override {};40void send_pid_tuning() override {};41virtual uint8_t send_available_mode(uint8_t index) const override { return 0; }42};4344/*45* a GCS singleton used for many example sketches and tools46*/4748extern const AP_HAL::HAL& hal;4950class GCS_Periph : public GCS51{52public:5354using GCS::GCS;5556protected:5758GCS_MAVLINK_Periph *new_gcs_mavlink_backend(AP_HAL::UARTDriver &uart) override {59return NEW_NOTHROW GCS_MAVLINK_Periph(uart);60}6162private:63// the following define expands to a pair of methods to retrieve a64// pointer to an object of the correct subclass for the link at65// offset ofs. These are of the form:66// GCS_MAVLINK_XXXX *chan(const uint8_t ofs) override;67// const GCS_MAVLINK_XXXX *chan(const uint8_t ofs) override const;68GCS_MAVLINK_CHAN_METHOD_DEFINITIONS(GCS_MAVLINK_Periph);6970MAV_TYPE frame_type() const override { return MAV_TYPE_GENERIC; }71uint32_t custom_mode() const override { return 3; } // magic number72};73#endif // HAL_GCS_ENABLED747576