APM:Libraries
GCS_Dummy.h
Go to the documentation of this file.
1 #include "GCS.h"
2 
4 {
5  major: 3,
6  minor: 1,
7  patch: 4,
8  fw_type: FIRMWARE_VERSION_TYPE_DEV,
9  fw_string: "Dummy GCS"
10 };
11 
12 /*
13  * GCS backend used for many examples and tools
14  */
16 {
17  uint32_t telem_delay() const override { return 0; }
18  void handleMessage(mavlink_message_t * msg) override {}
19  bool try_send_message(enum ap_message id) { return true; }
20  bool handle_guided_request(AP_Mission::Mission_Command &cmd) override { return true; }
22 
23 protected:
24 
25  Compass *get_compass() const override { return nullptr; };
26  AP_Mission *get_mission() override { return nullptr; }
27  AP_Rally *get_rally() const override { return nullptr; };
28  AP_Camera *get_camera() const override { return nullptr; };
29  const AP_FWVersion &get_fwver() const override { return fwver; }
30 
31  uint8_t sysid_my_gcs() const override { return 1; }
32  bool set_mode(uint8_t mode) override { return false; };
33 
34  // dummy information:
35  MAV_TYPE frame_type() const override { return MAV_TYPE_FIXED_WING; }
36  MAV_MODE base_mode() const override { return (MAV_MODE)MAV_MODE_FLAG_CUSTOM_MODE_ENABLED; }
37  uint32_t custom_mode() const override { return 3; } // magic number
38  MAV_STATE system_status() const override { return MAV_STATE_CALIBRATING; }
39 
40 };
41 
42 /*
43  * a GCS singleton used for many example sketches and tools
44  */
45 
46 extern const AP_HAL::HAL& hal;
47 
48 class GCS_Dummy : public GCS
49 {
51  uint8_t num_gcs() const override { return 1; }
52  GCS_MAVLINK_Dummy &chan(const uint8_t ofs) override { return dummy_backend; }
53  const GCS_MAVLINK_Dummy &chan(const uint8_t ofs) const override { return dummy_backend; };
54 
55  void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text) { hal.console->printf("TOGCS: %s\n", text); }
56 };
Object managing Rally Points.
Definition: AP_Rally.h:37
uint8_t num_gcs() const override
Definition: GCS_Dummy.h:51
AP_HAL::UARTDriver * console
Definition: HAL.h:110
Interface definition for the various Ground Control System.
Object managing Mission.
Definition: AP_Mission.h:45
ap_message
Definition: GCS.h:37
GCS_MAVLINK_Dummy dummy_backend
Definition: GCS_Dummy.h:50
global GCS object
Definition: GCS.h:562
const GCS_MAVLINK_Dummy & chan(const uint8_t ofs) const override
Definition: GCS_Dummy.h:53
virtual void printf(const char *,...) FMT_PRINTF(2
Definition: BetterStream.cpp:5
GCS_MAVLINK_Dummy & chan(const uint8_t ofs) override
Definition: GCS_Dummy.h:52
const AP_FWVersion fwver
Definition: GCS_Dummy.h:4
void send_statustext(MAV_SEVERITY severity, uint8_t dest_bitmask, const char *text)
Definition: GCS_Dummy.h:55
const AP_HAL::HAL & hal
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
Definition: AC_PID_test.cpp:14