7 changed files with 112 additions and 63 deletions
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
#include "GCS_Tracker.h" |
||||
#include "Tracker.h" |
||||
|
||||
bool GCS_Tracker::cli_enabled() const |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
AP_HAL::BetterStream* GCS_Tracker::cliSerial() { |
||||
return nullptr; |
||||
} |
||||
|
||||
static void mavlink_snoop_static(const mavlink_message_t* msg) |
||||
{ |
||||
tracker.mavlink_snoop(msg); |
||||
} |
||||
|
||||
void GCS_Tracker::setup_uarts(AP_SerialManager &serial_manager) |
||||
{ |
||||
GCS::setup_uarts(serial_manager); |
||||
|
||||
for (uint8_t i = 1; i < num_gcs(); i++) { |
||||
gcs().chan(i).set_snoop(mavlink_snoop_static); |
||||
} |
||||
} |
||||
|
||||
void GCS_Tracker::request_datastream_position(const uint8_t sysid, const uint8_t compid) |
||||
{ |
||||
for (uint8_t i=0; i < num_gcs(); i++) { |
||||
if (gcs().chan(i).initialised) { |
||||
// request position
|
||||
if (HAVE_PAYLOAD_SPACE((mavlink_channel_t)i, DATA_STREAM)) { |
||||
mavlink_msg_request_data_stream_send( |
||||
(mavlink_channel_t)i, |
||||
sysid, |
||||
compid, |
||||
MAV_DATA_STREAM_POSITION, |
||||
tracker.g.mavlink_update_rate, |
||||
1); // start streaming
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
void GCS_Tracker::request_datastream_airpressure(const uint8_t sysid, const uint8_t compid) |
||||
{ |
||||
for (uint8_t i=0; i < num_gcs(); i++) { |
||||
if (gcs().chan(i).initialised) { |
||||
// request air pressure
|
||||
if (HAVE_PAYLOAD_SPACE((mavlink_channel_t)i, DATA_STREAM)) { |
||||
mavlink_msg_request_data_stream_send( |
||||
(mavlink_channel_t)i, |
||||
sysid, |
||||
compid, |
||||
MAV_DATA_STREAM_RAW_SENSORS, |
||||
tracker.g.mavlink_update_rate, |
||||
1); // start streaming
|
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
#pragma once |
||||
|
||||
#include <GCS_MAVLink/GCS.h> |
||||
#include "GCS_Mavlink.h" |
||||
|
||||
class GCS_Tracker : public GCS |
||||
{ |
||||
friend class Tracker; // for access to _chan in parameter declarations
|
||||
|
||||
public: |
||||
|
||||
// return the number of valid GCS objects
|
||||
uint8_t num_gcs() const override { return ARRAY_SIZE(_chan); }; |
||||
|
||||
// return GCS link at offset ofs
|
||||
GCS_MAVLINK_Tracker &chan(const uint8_t ofs) override { return _chan[ofs]; }; |
||||
|
||||
void setup_uarts(AP_SerialManager &serial_manager) override; |
||||
|
||||
private: |
||||
|
||||
void request_datastream_position(uint8_t sysid, uint8_t compid); |
||||
void request_datastream_airpressure(uint8_t sysid, uint8_t compid); |
||||
|
||||
GCS_MAVLINK_Tracker _chan[MAVLINK_COMM_NUM_BUFFERS]; |
||||
|
||||
bool cli_enabled() const override; |
||||
AP_HAL::BetterStream* cliSerial() override; |
||||
|
||||
}; |
Loading…
Reference in new issue