地面站终端 App
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

/****************************************************************************
*
* (c) 2017 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
#pragma once
#include "LifetimeChecker.h"
#include "AirMapSharedState.h"
#include <QObject>
#include <QGeoCoordinate>
#include "airmap/traffic.h"
#include <memory>
/**
* @class AirMapTrafficMonitor
*
*/
class AirMapTrafficMonitor : public QObject, public LifetimeChecker
{
Q_OBJECT
public:
AirMapTrafficMonitor (AirMapSharedState& shared);
virtual ~AirMapTrafficMonitor ();
void startConnection (const QString& flightID);
void stop();
signals:
void error (const QString& what, const QString& airmapdMessage, const QString& airmapdDetails);
void trafficUpdate (bool alert, QString traffic_id, QString vehicle_id, QGeoCoordinate location, float heading);
private:
void _update (airmap::Traffic::Update::Type type, const std::vector<airmap::Traffic::Update>& update);
private:
QString _flightID;
AirMapSharedState& _shared;
std::shared_ptr<airmap::Traffic::Monitor> _monitor;
std::shared_ptr<airmap::Traffic::Monitor::Subscriber> _subscriber;
};