Commit fc74866c authored by Gus Grubba's avatar Gus Grubba

Some build fixes (not there yet)

parent 6b47e107
......@@ -1069,8 +1069,8 @@ contains (DEFINES, QGC_AIRMAP_ENABLED) {
src/AirspaceManagement/AirspaceRestriction.h \
src/AirspaceManagement/AirspaceRestrictionProvider.h \
src/AirspaceManagement/AirspaceRulesetsProvider.h \
src/AirspaceManagement/AirspaceWeatherInfoProvider.h \
src/AirspaceManagement/AirspaceVehicleManager.h \
src/AirspaceManagement/AirspaceWeatherInfoProvider.h \
SOURCES += \
src/AirspaceManagement/AirspaceController.cc \
......@@ -1078,8 +1078,8 @@ contains (DEFINES, QGC_AIRMAP_ENABLED) {
src/AirspaceManagement/AirspaceRestriction.cc \
src/AirspaceManagement/AirspaceRestrictionProvider.cc \
src/AirspaceManagement/AirspaceRulesetsProvider.cc \
src/AirspaceManagement/AirspaceWeatherInfoProvider.cc \
src/AirspaceManagement/AirspaceVehicleManager.cc \
src/AirspaceManagement/AirspaceWeatherInfoProvider.cc \
#-- This is the AirMap implementation of the above
RESOURCES += \
......@@ -1089,31 +1089,28 @@ contains (DEFINES, QGC_AIRMAP_ENABLED) {
src/Airmap
HEADERS += \
src/Airmap/AirMapFlightManager.h \
src/Airmap/AirMapManager.h \
src/Airmap/AirspaceManagement.h \
src/Airmap/AirMapSettings.h \
src/Airmap/AirmapWeatherInformation.h \
src/Airmap/AirMapRestrictionManager.h \
src/Airmap/AirMapRulesetsManager.h \
src/Airmap/AirMapSettings.h \
src/Airmap/AirMapSharedState.h \
src/Airmap/AirMapFlightManager.h \
src/Airmap/AirMapTelemetry.h \
src/Airmap/AirMapTrafficMonitor.h \
src/Airmap/AirMapVehicleManager.h \
src/Airmap/AirmapWeatherInformation.h \
SOURCES += \
src/Airmap/AirMapFlightManager.cc \
src/Airmap/AirMapManager.cc \
src/Airmap/AirspaceManagement.cc \
src/Airmap/AirspaceController.cc \
src/Airmap/AirMapSettings.cc \
src/Airmap/AirmapWeatherInformation.cc \
src/Airmap/AirMapRestrictionManager.cc \
src/Airmap/AirMapRulesetsManager.cc \
src/Airmap/AirMapSettings.cc \
src/Airmap/AirMapSharedState.cc \
src/Airmap/AirMapFlightManager.cc \
src/Airmap/AirMapTelemetry.cc \
src/Airmap/AirMapTrafficMonitor.cc \
src/Airmap/AirMapVehicleManager.cc \
src/Airmap/AirmapWeatherInformation.cc \
} else {
RESOURCES += \
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapFlightManager.h"
AirMapFlightManager::AirMapFlightManager(AirMapSharedState& shared)
......
......@@ -16,7 +16,6 @@
#include "AirMapTelemetry.h"
#include "AirMapTrafficMonitor.h"
#include "Vehicle.h"
#include "QmlObjectListModel.h"
#include "JsonHelper.h"
#include "SettingsManager.h"
......
......@@ -12,14 +12,13 @@
#include "QGCToolbox.h"
#include "QGCLoggingCategory.h"
#include "AirspaceManagement.h"
#include "AirMapSharedState.h"
#include <airmap/qt/logger.h>
#include <airmap/qt/types.h>
Q_DECLARE_LOGGING_CATEGORY(AirMapManagerLog)
class AirMapSharedState;
//-----------------------------------------------------------------------------
/**
* @class LifetimeChecker
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapRestrictionManager.h"
AirMapRestrictionManager::AirMapRestrictionManager(AirMapSharedState& shared)
......
......@@ -10,6 +10,7 @@
#pragma once
#include <QObject>
#include "AirMapManager.h"
#include "AirspaceRestrictionProvider.h"
/**
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapRulesetsManager.h"
//-----------------------------------------------------------------------------
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapSharedState.h"
void
......
......@@ -7,6 +7,7 @@
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapTelemetry.h"
AirMapTelemetry::AirMapTelemetry(AirMapSharedState& shared)
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapTrafficMonitor.h"
AirMapTrafficMonitor::~AirMapTrafficMonitor()
......
......@@ -10,6 +10,7 @@
#pragma once
#include <QObject>
#include "AirMapManager.h"
/**
* @class AirMapTrafficMonitor
......@@ -31,11 +32,11 @@ public:
void stop();
signals:
void error(const QString& what, const QString& airmapdMessage, const QString& airmapdDetails);
void trafficUpdate(QString traffic_id, QString vehicle_id, QGeoCoordinate location, float heading);
void error (const QString& what, const QString& airmapdMessage, const QString& airmapdDetails);
void trafficUpdate (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);
void _update (airmap::Traffic::Update::Type type, const std::vector<airmap::Traffic::Update>& update);
private:
QString _flightID;
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirMapVehicleManager.h"
#include "AirMapFlightManager.h"
#include "AirMapTelemetry.h"
#include "AirMapTrafficMonitor.h"
#include "Vehicle.h"
AirMapVehicleManager::AirMapVehicleManager(AirMapSharedState& shared, const Vehicle& vehicle, QGCToolbox& toolbox)
: AirspaceVehicleManager(vehicle)
, _shared(shared)
......
/****************************************************************************
*
* (c) 2009-2016 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.
*
****************************************************************************/
#include "AirMapManager.h"
#include "AirmapWeatherInformation.h"
#define WEATHER_UPDATE_DISTANCE 50000 //-- 50km threshold for weather updates
#define WEATHER_UPDATE_TIME 30 * 60 * 60 * 1000 //-- 30 minutes threshold for weather updates
AirMapWeatherInformation::AirMapWeatherInformation(AirMapSharedState& shared, QObject *parent)
: QObject(parent)
, _valid(false)
......
......@@ -11,6 +11,9 @@
#include <QObject>
#include <QGeoCoordinate>
#include <QTime>
#include "AirMapManager.h"
#include "AirspaceWeatherInfoProvider.h"
/**
......
......@@ -13,14 +13,10 @@
#include "QGCApplication.h"
#include "QGCQGeoCoordinate.h"
#define WEATHER_UPDATE_DISTANCE 50000 //-- 50km threshold for weather updates
#define WEATHER_UPDATE_TIME 30 * 60 * 60 * 1000 //-- 30 minutes threshold for weather updates
AirspaceController::AirspaceController(QObject* parent)
: QObject(parent)
, _manager(qgcApp()->toolbox()->airspaceManager())
{
connect(_manager, &AirspaceManager::weatherUpdate, this, &AirspaceController::_weatherUpdate);
}
void AirspaceController::setROI(QGeoCoordinate center, double radius)
......
......@@ -10,8 +10,9 @@
#pragma once
#include "AirspaceManagement.h"
#include "QGCMapPolygon.h"
#include "AirmapWeatherInformation.h"
#include "QmlObjectListModel.h"
#include "QGCMapPolygon.h"
class AirspaceController : public QObject
{
......
......@@ -9,7 +9,6 @@
#include "AirspaceManagement.h"
#include <Vehicle.h>
QGC_LOGGING_CATEGORY(AirspaceManagementLog, "AirspaceManagementLog")
......@@ -19,7 +18,9 @@ AirspaceManager::AirspaceManager(QGCApplication* app, QGCToolbox* toolbox)
_roiUpdateTimer.setInterval(2000);
_roiUpdateTimer.setSingleShot(true);
connect(&_roiUpdateTimer, &QTimer::timeout, this, &AirspaceManager::_updateToROI);
qmlRegisterUncreatableType<AirspaceAuthorization>("QGroundControl", 1, 0, "AirspaceAuthorization", "Reference only");
qmlRegisterUncreatableType<AirspaceAuthorization> ("QGroundControl", 1, 0, "AirspaceAuthorization", "Reference only");
qmlRegisterUncreatableType<AirspaceController> ("QGroundControl.Vehicle", 1, 0, "AirspaceController", "Reference only");
qmlRegisterUncreatableType<AirspaceWeatherInfoProvider> ("QGroundControl.Vehicle", 1, 0, "AirspaceWeatherInfoProvider","Reference only");
}
AirspaceManager::~AirspaceManager()
......@@ -89,26 +90,3 @@ void AirspaceManager::_rulessetsUpdated(bool)
{
}
AirspaceVehicleManager::AirspaceVehicleManager(const Vehicle& vehicle)
: _vehicle(vehicle)
{
connect(&_vehicle, &Vehicle::armedChanged, this, &AirspaceVehicleManager::_vehicleArmedChanged);
connect(&_vehicle, &Vehicle::mavlinkMessageReceived, this, &AirspaceVehicleManager::vehicleMavlinkMessageReceived);
}
void AirspaceVehicleManager::_vehicleArmedChanged(bool armed)
{
if (armed) {
startTelemetryStream();
_vehicleWasInMissionMode = _vehicle.flightMode() == _vehicle.missionFlightMode();
} else {
stopTelemetryStream();
// end the flight if we were in mission mode during arming or disarming
// TODO: needs to be improved. for instance if we do RTL and then want to continue the mission...
if (_vehicleWasInMissionMode || _vehicle.flightMode() == _vehicle.missionFlightMode()) {
endFlight();
}
}
}
......@@ -23,19 +23,26 @@
* each vehicle could have its own restrictions.
*/
#include "AirspaceController.h"
#include "AirspaceRestrictionProvider.h"
#include "AirspaceRulesetsProvider.h"
#include "AirspaceVehicleManager.h"
#include "AirspaceWeatherInfoProvider.h"
#include "QGCToolbox.h"
#include "MissionItem.h"
#include "QGCLoggingCategory.h"
#include "QmlObjectListModel.h"
#include "Vehicle.h"
#include <QGeoCoordinate>
#include <QObject>
#include <QString>
#include <QList>
#include <QTimer>
#include <QGCLoggingCategory.h>
Q_DECLARE_LOGGING_CATEGORY(AirspaceManagementLog)
class AirMapWeatherInformation;
//-----------------------------------------------------------------------------
/**
* Contains the status of the Airspace authorization
......@@ -49,15 +56,9 @@ public:
PermitAccepted,
PermitRejected,
};
Q_ENUMS(PermitStatus);
Q_ENUM(PermitStatus)
};
class AirspaceRestrictionProvider;
class AirspaceRulesetsProvider;
class AirspaceVehicleManager;
class AirspaceWeatherInfoProvider;
class Vehicle;
//-----------------------------------------------------------------------------
/**
* @class AirspaceManager
......@@ -104,16 +105,7 @@ public:
/**
* Name of the airspace management provider (used in the UI)
*/
virtual QString name () const = 0;
/**
* Request weather information update. When done, it will emit the weatherUpdate() signal.
* @param coordinate request update for this coordinate
*/
virtual void requestWeatherUpdate(const QGeoCoordinate& coordinate) = 0;
signals:
void weatherUpdate (bool success, QGeoCoordinate coordinate, WeatherInformation weather);
virtual QString name () const = 0;
protected slots:
virtual void _rulessetsUpdated (bool success);
......
......@@ -11,85 +11,6 @@
#include "AirspaceManagement.h"
#include <Vehicle.h>
QGC_LOGGING_CATEGORY(AirspaceManagementLog, "AirspaceManagementLog")
AirspaceManager::AirspaceManager(QGCApplication* app, QGCToolbox* toolbox)
: QGCTool(app, toolbox)
{
_roiUpdateTimer.setInterval(2000);
_roiUpdateTimer.setSingleShot(true);
connect(&_roiUpdateTimer, &QTimer::timeout, this, &AirspaceManager::_updateToROI);
qmlRegisterUncreatableType<AirspaceAuthorization>("QGroundControl", 1, 0, "AirspaceAuthorization", "Reference only");
}
AirspaceManager::~AirspaceManager()
{
if (_restrictionsProvider) {
delete _restrictionsProvider;
}
if(_rulesetsProvider) {
delete _rulesetsProvider;
}
_polygonRestrictions.clearAndDeleteContents();
_circleRestrictions.clearAndDeleteContents();
}
void AirspaceManager::setToolbox(QGCToolbox* toolbox)
{
QGCTool::setToolbox(toolbox);
// We should not call virtual methods in the constructor, so we instantiate the restriction provider here
_restrictionsProvider = instantiateRestrictionProvider();
if (_restrictionsProvider) {
connect(_restrictionsProvider, &AirspaceRestrictionProvider::requestDone, this,
&AirspaceManager::_restrictionsUpdated);
}
_rulesetsProvider = instantiateRulesetsProvider();
if (_rulesetsProvider) {
connect(_rulesetsProvider, &AirspaceRulesetsProvider::requestDone, this,
&AirspaceManager::_rulessetsUpdated);
}
}
void AirspaceManager::setROI(const QGeoCoordinate& center, double radiusMeters)
{
_roiCenter = center;
_roiRadius = radiusMeters;
_roiUpdateTimer.start();
}
void AirspaceManager::_updateToROI()
{
if (_restrictionsProvider) {
_restrictionsProvider->setROI(_roiCenter, _roiRadius);
}
//-- TODO: We may want to check the distance between this ROI and the last
// to see if we really need to update it.
if(_rulesetsProvider) {
_rulesetsProvider->setROI(_roiCenter);
}
}
void AirspaceManager::_restrictionsUpdated(bool success)
{
_polygonRestrictions.clearAndDeleteContents();
_circleRestrictions.clearAndDeleteContents();
if (success) {
for (const auto& circle : _restrictionsProvider->circles()) {
_circleRestrictions.append(circle);
}
for (const auto& polygon : _restrictionsProvider->polygons()) {
_polygonRestrictions.append(polygon);
}
} else {
// TODO: show error?
}
}
void AirspaceManager::_rulessetsUpdated(bool)
{
}
AirspaceVehicleManager::AirspaceVehicleManager(const Vehicle& vehicle)
: _vehicle(vehicle)
{
......
......@@ -10,6 +10,7 @@
#pragma once
#include <QList>
#include "MissionItem.h"
class Vehicle;
......
......@@ -15,6 +15,7 @@
*/
#include <QObject>
#include <QGeoCoordinate>
class AirspaceWeatherInfoProvider : public QObject
{
......
......@@ -84,10 +84,6 @@
#include "CameraCalc.h"
#include "VisualMissionItem.h"
#include "EditPositionDialogController.h"
#if defined(QGC_AIRMAP_ENABLED)
#include "AirspaceController.h"
#include "AirmapWeatherInformation.h"
#endif
#ifndef NO_SERIAL_LINK
#include "SerialLink.h"
#endif
......@@ -384,10 +380,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType<GeoFenceController> ("QGroundControl.Controllers", 1, 0, "GeoFenceController", "Reference only");
qmlRegisterUncreatableType<RallyPointController>("QGroundControl.Controllers", 1, 0, "RallyPointController", "Reference only");
qmlRegisterUncreatableType<VisualMissionItem> ("QGroundControl.Controllers", 1, 0, "VisualMissionItem", "Reference only");
#if defined(QGC_AIRMAP_ENABLED)
qmlRegisterUncreatableType<AirspaceController> ("QGroundControl.Vehicle", 1, 0, "AirspaceController", "Reference only");
qmlRegisterUncreatableType<AirMapWeatherInformation> ("QGroundControl.Vehicle", 1, 0, "AirMapWeatherInformation", "Reference only");
#endif
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<ESP8266ComponentController> ("QGroundControl.Controllers", 1, 0, "ESP8266ComponentController");
......
......@@ -143,7 +143,7 @@ Vehicle::Vehicle(LinkInterface* link,
, _parameterManager(NULL)
#if defined(QGC_AIRMAP_ENABLED)
, _airspaceController(NULL)
, _airspaceManagerPerVehicle(NULL)
, _airspaceVehicleManager(NULL)
#endif
, _armed(false)
, _base_mode(0)
......@@ -272,10 +272,10 @@ Vehicle::Vehicle(LinkInterface* link,
_airspaceController = new AirspaceController(this);
AirspaceManager* airspaceManager = _toolbox->airspaceManager();
if (airspaceManager) {
_airspaceManagerPerVehicle = airspaceManager->instantiateVehicle(*this);
if (_airspaceManagerPerVehicle) {
connect(_airspaceManagerPerVehicle, &AirspaceVehicleManager::trafficUpdate, this, &Vehicle::_trafficUpdate);
connect(_airspaceManagerPerVehicle, &AirspaceVehicleManager::flightPermitStatusChanged, this, &Vehicle::flightPermitStatusChanged);
_airspaceVehicleManager = airspaceManager->instantiateVehicle(*this);
if (_airspaceVehicleManager) {
connect(_airspaceVehicleManager, &AirspaceVehicleManager::trafficUpdate, this, &Vehicle::_trafficUpdate);
connect(_airspaceVehicleManager, &AirspaceVehicleManager::flightPermitStatusChanged, this, &Vehicle::flightPermitStatusChanged);
}
}
#endif
......@@ -341,7 +341,7 @@ Vehicle::Vehicle(MAV_AUTOPILOT firmwareType,
, _parameterManager(NULL)
#if defined(QGC_AIRMAP_ENABLED)
, _airspaceController(NULL)
, _airspaceManagerPerVehicle(NULL)
, _airspaceVehicleManager(NULL)
#endif
, _armed(false)
, _base_mode(0)
......@@ -477,8 +477,8 @@ Vehicle::~Vehicle()
_mav = NULL;
#if defined(QGC_AIRMAP_ENABLED)
if (_airspaceManagerPerVehicle) {
delete _airspaceManagerPerVehicle;
if (_airspaceVehicleManager) {
delete _airspaceVehicleManager;
}
#endif
}
......
......@@ -21,7 +21,8 @@
#include "UASMessageHandler.h"
#include "SettingsFact.h"
#if defined(QGC_AIRMAP_ENABLED)
#include <AirspaceManagement.h>
#include "AirspaceManagement.h"
#include "AirspaceVehicleManager.h"
#endif
class UAS;
......@@ -769,9 +770,9 @@ public:
#if defined(QGC_AIRMAP_ENABLED)
AirspaceAuthorization::PermitStatus flightPermitStatus() const
{ return _airspaceManagerPerVehicle ? _airspaceManagerPerVehicle->flightPermitStatus() : AirspaceAuthorization::PermitUnknown; }
{ return _airspaceVehicleManager ? _airspaceVehicleManager->flightPermitStatus() : AirspaceAuthorization::PermitUnknown; }
AirspaceVehicleManager* airspaceManager() const { return _airspaceManagerPerVehicle; }
AirspaceVehicleManager* airspaceManager() const { return _airspaceVehicleManager; }
#endif
signals:
......@@ -1065,8 +1066,8 @@ private:
ParameterManager* _parameterManager;
#if defined(QGC_AIRMAP_ENABLED)
AirspaceController* _airspaceController;
AirspaceVehicleManager* _airspaceManagerPerVehicle;
AirspaceController* _airspaceController;
AirspaceVehicleManager* _airspaceVehicleManager;
#endif
bool _armed; ///< true: vehicle is armed
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment