Line data Source code
1 : #pragma once 2 : 3 : #include "MissionItemProtocol.h" 4 : 5 : class MissionItemProtocol_Waypoints : public MissionItemProtocol { 6 : public: 7 2094 : MissionItemProtocol_Waypoints(class AP_Mission &_mission) : 8 2094 : mission(_mission) {} 9 : 10 : // mission_type returns the MAV_MISSION mavlink enumeration value 11 : // which this module is responsible for handling 12 12319 : MAV_MISSION_TYPE mission_type() const override { 13 12319 : return MAV_MISSION_TYPE_MISSION; 14 : } 15 : 16 : // complete() is called by the base class after all waypoints have 17 : // been received. _link is the link which the last item was 18 : // transfered on. 19 : MAV_MISSION_RESULT complete(const GCS_MAVLINK &_link) override; 20 : // timeout() is called by the base class in the case that the GCS 21 : // does not transfer all waypoints to the vehicle. 22 : void timeout() override; 23 : // truncate() is called to set the absolute number of items. It 24 : // must be less than or equal to the current number of items (you 25 : // can't truncate-to a longer list) 26 : void truncate(const mavlink_mission_count_t &packet) override; 27 : 28 : protected: 29 : 30 : // clear_all_items() is called to clear all items on the vehicle 31 : bool clear_all_items() override WARN_IF_UNUSED; 32 : 33 : // next_item_ap_message_id returns an item from the ap_message 34 : // enumeration which (when acted upon by the GCS class) will send 35 : // a mavlink message to the GCS requesting it upload the next 36 : // required waypoint. 37 335 : ap_message next_item_ap_message_id() const override { 38 335 : return MSG_NEXT_MISSION_REQUEST_WAYPOINTS; 39 : } 40 : 41 : private: 42 : AP_Mission &mission; 43 : 44 : // append_item() is called by the base class to add the supplied 45 : // item to the end of the list of stored items. 46 : MAV_MISSION_RESULT append_item(const mavlink_mission_item_int_t &) override WARN_IF_UNUSED; 47 : 48 : // support for GCS getting waypoints etc from us: 49 : MAV_MISSION_RESULT get_item(uint16_t seq, mavlink_mission_item_int_t &ret_packet) override WARN_IF_UNUSED; 50 : 51 : // item_count() returns the number of stored items 52 : uint16_t item_count() const override; 53 : 54 : // item_count() returns the maximum number of items which could be 55 : // stored on-board 56 : uint16_t max_items() const override; 57 : 58 : // replace_item() replaces an item in the stored list 59 : MAV_MISSION_RESULT replace_item(const mavlink_mission_item_int_t &) override WARN_IF_UNUSED; 60 : 61 : }; 62 :