Commit 352c53b1 authored by Gus Grubba's avatar Gus Grubba

On desktop (Ethernet connection), the ground unit pushes UDP directly, which...

On desktop (Ethernet connection), the ground unit pushes UDP directly, which makes the use of an actual "Link" not possible. Instead, I've moved all of Taisync support to a "manager" owned by QGCToolbox.
Added a Taisync settings with some basics already wired and running.
parent bab3c35a
...@@ -1113,18 +1113,24 @@ contains (DEFINES, QGC_GST_TAISYNC_ENABLED) { ...@@ -1113,18 +1113,24 @@ contains (DEFINES, QGC_GST_TAISYNC_ENABLED) {
src/Taisync src/Taisync
HEADERS += \ HEADERS += \
src/comm/TaisyncLink.h \ src/Taisync/TaisyncManager.h \
src/Taisync/TaisyncHandler.h \ src/Taisync/TaisyncHandler.h \
src/Taisync/TaisyncSettings.h \ src/Taisync/TaisyncSettings.h \
src/Taisync/TaisyncTelemetry.h \
src/Taisync/TaisyncVideoReceiver.h \
SOURCES += \ SOURCES += \
src/comm/TaisyncLink.cc \ src/Taisync/TaisyncManager.cc \
src/Taisync/TaisyncHandler.cc \ src/Taisync/TaisyncHandler.cc \
src/Taisync/TaisyncSettings.cc \ src/Taisync/TaisyncSettings.cc \
src/Taisync/TaisyncTelemetry.cc \
src/Taisync/TaisyncVideoReceiver.cc \ iOSBuild | AndroidBuild {
HEADERS += \
src/Taisync/TaisyncTelemetry.h \
src/Taisync/TaisyncVideoReceiver.h \
SOURCES += \
src/Taisync/TaisyncTelemetry.cc \
src/Taisync/TaisyncVideoReceiver.cc \
}
} }
#------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------
......
...@@ -35,64 +35,48 @@ ...@@ -35,64 +35,48 @@
#else #else
#include "AirspaceManager.h" #include "AirspaceManager.h"
#endif #endif
#if defined(QGC_GST_TAISYNC_ENABLED)
#include "TaisyncManager.h"
#endif
#if defined(QGC_CUSTOM_BUILD) #if defined(QGC_CUSTOM_BUILD)
#include CUSTOMHEADER #include CUSTOMHEADER
#endif #endif
QGCToolbox::QGCToolbox(QGCApplication* app) QGCToolbox::QGCToolbox(QGCApplication* app)
: _audioOutput (NULL)
, _factSystem (NULL)
, _firmwarePluginManager(NULL)
#ifndef __mobile__
, _gpsManager (NULL)
#endif
, _imageProvider (NULL)
, _joystickManager (NULL)
, _linkManager (NULL)
, _mavlinkProtocol (NULL)
, _missionCommandTree (NULL)
, _multiVehicleManager (NULL)
, _mapEngineManager (NULL)
, _uasMessageHandler (NULL)
, _followMe (NULL)
, _qgcPositionManager (NULL)
, _videoManager (NULL)
, _mavlinkLogManager (NULL)
, _corePlugin (NULL)
, _settingsManager (NULL)
, _airspaceManager (NULL)
{ {
// SettingsManager must be first so settings are available to any subsequent tools // SettingsManager must be first so settings are available to any subsequent tools
_settingsManager = new SettingsManager(app, this); _settingsManager = new SettingsManager (app, this);
//-- Scan and load plugins //-- Scan and load plugins
_scanAndLoadPlugins(app); _scanAndLoadPlugins(app);
_audioOutput = new AudioOutput (app, this); _audioOutput = new AudioOutput (app, this);
_factSystem = new FactSystem (app, this); _factSystem = new FactSystem (app, this);
_firmwarePluginManager = new FirmwarePluginManager (app, this); _firmwarePluginManager = new FirmwarePluginManager (app, this);
#ifndef __mobile__ #ifndef __mobile__
_gpsManager = new GPSManager (app, this); _gpsManager = new GPSManager (app, this);
#endif #endif
_imageProvider = new QGCImageProvider (app, this); _imageProvider = new QGCImageProvider (app, this);
_joystickManager = new JoystickManager (app, this); _joystickManager = new JoystickManager (app, this);
_linkManager = new LinkManager (app, this); _linkManager = new LinkManager (app, this);
_mavlinkProtocol = new MAVLinkProtocol (app, this); _mavlinkProtocol = new MAVLinkProtocol (app, this);
_missionCommandTree = new MissionCommandTree (app, this); _missionCommandTree = new MissionCommandTree (app, this);
_multiVehicleManager = new MultiVehicleManager (app, this); _multiVehicleManager = new MultiVehicleManager (app, this);
_mapEngineManager = new QGCMapEngineManager (app, this); _mapEngineManager = new QGCMapEngineManager (app, this);
_uasMessageHandler = new UASMessageHandler (app, this); _uasMessageHandler = new UASMessageHandler (app, this);
_qgcPositionManager = new QGCPositionManager (app, this); _qgcPositionManager = new QGCPositionManager (app, this);
_followMe = new FollowMe (app, this); _followMe = new FollowMe (app, this);
_videoManager = new VideoManager (app, this); _videoManager = new VideoManager (app, this);
_mavlinkLogManager = new MAVLinkLogManager (app, this); _mavlinkLogManager = new MAVLinkLogManager (app, this);
//-- Airmap Manager //-- Airmap Manager
//-- This should be "pluggable" so an arbitrary AirSpace manager can be used //-- This should be "pluggable" so an arbitrary AirSpace manager can be used
//-- For now, we instantiate the one and only AirMap provider //-- For now, we instantiate the one and only AirMap provider
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
_airspaceManager = new AirMapManager (app, this); _airspaceManager = new AirMapManager (app, this);
#else #else
_airspaceManager = new AirspaceManager (app, this); _airspaceManager = new AirspaceManager (app, this);
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
_taisyncManager = new TaisyncManager (app, this);
#endif #endif
} }
...@@ -100,7 +84,6 @@ void QGCToolbox::setChildToolboxes(void) ...@@ -100,7 +84,6 @@ void QGCToolbox::setChildToolboxes(void)
{ {
// SettingsManager must be first so settings are available to any subsequent tools // SettingsManager must be first so settings are available to any subsequent tools
_settingsManager->setToolbox(this); _settingsManager->setToolbox(this);
_corePlugin->setToolbox(this); _corePlugin->setToolbox(this);
_audioOutput->setToolbox(this); _audioOutput->setToolbox(this);
_factSystem->setToolbox(this); _factSystem->setToolbox(this);
...@@ -121,6 +104,9 @@ void QGCToolbox::setChildToolboxes(void) ...@@ -121,6 +104,9 @@ void QGCToolbox::setChildToolboxes(void)
_videoManager->setToolbox(this); _videoManager->setToolbox(this);
_mavlinkLogManager->setToolbox(this); _mavlinkLogManager->setToolbox(this);
_airspaceManager->setToolbox(this); _airspaceManager->setToolbox(this);
#if defined(QGC_GST_TAISYNC_ENABLED)
_taisyncManager->setToolbox(this);
#endif
} }
void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app) void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app)
...@@ -139,7 +125,7 @@ void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app) ...@@ -139,7 +125,7 @@ void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app)
QGCTool::QGCTool(QGCApplication* app, QGCToolbox* toolbox) QGCTool::QGCTool(QGCApplication* app, QGCToolbox* toolbox)
: QObject(toolbox) : QObject(toolbox)
, _app(app) , _app(app)
, _toolbox(NULL) , _toolbox(nullptr)
{ {
} }
......
...@@ -33,6 +33,9 @@ class MAVLinkLogManager; ...@@ -33,6 +33,9 @@ class MAVLinkLogManager;
class QGCCorePlugin; class QGCCorePlugin;
class SettingsManager; class SettingsManager;
class AirspaceManager; class AirspaceManager;
#if defined(QGC_GST_TAISYNC_ENABLED)
class TaisyncManager;
#endif
/// This is used to manage all of our top level services/tools /// This is used to manage all of our top level services/tools
class QGCToolbox : public QObject { class QGCToolbox : public QObject {
...@@ -41,25 +44,28 @@ class QGCToolbox : public QObject { ...@@ -41,25 +44,28 @@ class QGCToolbox : public QObject {
public: public:
QGCToolbox(QGCApplication* app); QGCToolbox(QGCApplication* app);
FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; } FirmwarePluginManager* firmwarePluginManager () { return _firmwarePluginManager; }
AudioOutput* audioOutput(void) { return _audioOutput; } AudioOutput* audioOutput () { return _audioOutput; }
JoystickManager* joystickManager(void) { return _joystickManager; } JoystickManager* joystickManager () { return _joystickManager; }
LinkManager* linkManager(void) { return _linkManager; } LinkManager* linkManager () { return _linkManager; }
MAVLinkProtocol* mavlinkProtocol(void) { return _mavlinkProtocol; } MAVLinkProtocol* mavlinkProtocol () { return _mavlinkProtocol; }
MissionCommandTree* missionCommandTree(void) { return _missionCommandTree; } MissionCommandTree* missionCommandTree () { return _missionCommandTree; }
MultiVehicleManager* multiVehicleManager(void) { return _multiVehicleManager; } MultiVehicleManager* multiVehicleManager () { return _multiVehicleManager; }
QGCMapEngineManager* mapEngineManager(void) { return _mapEngineManager; } QGCMapEngineManager* mapEngineManager () { return _mapEngineManager; }
QGCImageProvider* imageProvider() { return _imageProvider; } QGCImageProvider* imageProvider () { return _imageProvider; }
UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; } UASMessageHandler* uasMessageHandler () { return _uasMessageHandler; }
FollowMe* followMe(void) { return _followMe; } FollowMe* followMe () { return _followMe; }
QGCPositionManager* qgcPositionManager(void) { return _qgcPositionManager; } QGCPositionManager* qgcPositionManager () { return _qgcPositionManager; }
VideoManager* videoManager(void) { return _videoManager; } VideoManager* videoManager () { return _videoManager; }
MAVLinkLogManager* mavlinkLogManager(void) { return _mavlinkLogManager; } MAVLinkLogManager* mavlinkLogManager () { return _mavlinkLogManager; }
QGCCorePlugin* corePlugin(void) { return _corePlugin; } QGCCorePlugin* corePlugin () { return _corePlugin; }
SettingsManager* settingsManager(void) { return _settingsManager; } SettingsManager* settingsManager () { return _settingsManager; }
AirspaceManager* airspaceManager(void) { return _airspaceManager; } AirspaceManager* airspaceManager () { return _airspaceManager; }
#ifndef __mobile__ #ifndef __mobile__
GPSManager* gpsManager(void) { return _gpsManager; } GPSManager* gpsManager () { return _gpsManager; }
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
TaisyncManager* taisyncManager () { return _taisyncManager; }
#endif #endif
private: private:
...@@ -67,27 +73,30 @@ private: ...@@ -67,27 +73,30 @@ private:
void _scanAndLoadPlugins(QGCApplication *app); void _scanAndLoadPlugins(QGCApplication *app);
AudioOutput* _audioOutput; AudioOutput* _audioOutput = nullptr;
FactSystem* _factSystem; FactSystem* _factSystem = nullptr;
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager = nullptr;
#ifndef __mobile__ #ifndef __mobile__
GPSManager* _gpsManager; GPSManager* _gpsManager = nullptr;
#endif
QGCImageProvider* _imageProvider = nullptr;
JoystickManager* _joystickManager = nullptr;
LinkManager* _linkManager = nullptr;
MAVLinkProtocol* _mavlinkProtocol = nullptr;
MissionCommandTree* _missionCommandTree = nullptr;
MultiVehicleManager* _multiVehicleManager = nullptr;
QGCMapEngineManager* _mapEngineManager = nullptr;
UASMessageHandler* _uasMessageHandler = nullptr;
FollowMe* _followMe = nullptr;
QGCPositionManager* _qgcPositionManager = nullptr;
VideoManager* _videoManager = nullptr;
MAVLinkLogManager* _mavlinkLogManager = nullptr;
QGCCorePlugin* _corePlugin = nullptr;
SettingsManager* _settingsManager = nullptr;
AirspaceManager* _airspaceManager = nullptr;
#if defined(QGC_GST_TAISYNC_ENABLED)
TaisyncManager* _taisyncManager = nullptr;
#endif #endif
QGCImageProvider* _imageProvider;
JoystickManager* _joystickManager;
LinkManager* _linkManager;
MAVLinkProtocol* _mavlinkProtocol;
MissionCommandTree* _missionCommandTree;
MultiVehicleManager* _multiVehicleManager;
QGCMapEngineManager* _mapEngineManager;
UASMessageHandler* _uasMessageHandler;
FollowMe* _followMe;
QGCPositionManager* _qgcPositionManager;
VideoManager* _videoManager;
MAVLinkLogManager* _mavlinkLogManager;
QGCCorePlugin* _corePlugin;
SettingsManager* _settingsManager;
AirspaceManager* _airspaceManager;
friend class QGCApplication; friend class QGCApplication;
}; };
......
...@@ -29,23 +29,9 @@ double QGroundControlQmlGlobal::_zoom = 2; ...@@ -29,23 +29,9 @@ double QGroundControlQmlGlobal::_zoom = 2;
QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app, QGCToolbox* toolbox) QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app, QGCToolbox* toolbox)
: QGCTool (app, toolbox) : QGCTool (app, toolbox)
, _flightMapInitialZoom (17.0)
, _linkManager (NULL)
, _multiVehicleManager (NULL)
, _mapEngineManager (NULL)
, _qgcPositionManager (NULL)
, _missionCommandTree (NULL)
, _videoManager (NULL)
, _mavlinkLogManager (NULL)
, _corePlugin (NULL)
, _firmwarePluginManager(NULL)
, _settingsManager (NULL)
, _gpsRtkFactGroup (nullptr)
, _airspaceManager (NULL)
, _skipSetupPage (false)
{ {
// We clear the parent on this object since we run into shutdown problems caused by hybrid qml app. Instead we let it leak on shutdown. // We clear the parent on this object since we run into shutdown problems caused by hybrid qml app. Instead we let it leak on shutdown.
setParent(NULL); setParent(nullptr);
// Load last coordinates and zoom from config file // Load last coordinates and zoom from config file
QSettings settings; QSettings settings;
settings.beginGroup(_flightMapPositionSettingsGroup); settings.beginGroup(_flightMapPositionSettingsGroup);
...@@ -80,6 +66,9 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox) ...@@ -80,6 +66,9 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox)
_settingsManager = toolbox->settingsManager(); _settingsManager = toolbox->settingsManager();
_gpsRtkFactGroup = qgcApp()->gpsRtkFactGroup(); _gpsRtkFactGroup = qgcApp()->gpsRtkFactGroup();
_airspaceManager = toolbox->airspaceManager(); _airspaceManager = toolbox->airspaceManager();
#if defined(QGC_AIRMAP_ENABLED)
_taisyncManager = toolbox->taisyncManager();
#endif
} }
void QGroundControlQmlGlobal::saveGlobalSetting (const QString& key, const QString& value) void QGroundControlQmlGlobal::saveGlobalSetting (const QString& key, const QString& value)
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
#include "QGCLoggingCategory.h" #include "QGCLoggingCategory.h"
#include "AppSettings.h" #include "AppSettings.h"
#include "AirspaceManager.h" #include "AirspaceManager.h"
#if defined(QGC_GST_TAISYNC_ENABLED)
#include "TaisyncManager.h"
#else
class TaisyncManager;
#endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
#include "MockLink.h" #include "MockLink.h"
...@@ -52,6 +57,8 @@ public: ...@@ -52,6 +57,8 @@ public:
Q_PROPERTY(FactGroup* gpsRtk READ gpsRtkFactGroup CONSTANT) Q_PROPERTY(FactGroup* gpsRtk READ gpsRtkFactGroup CONSTANT)
Q_PROPERTY(AirspaceManager* airspaceManager READ airspaceManager CONSTANT) Q_PROPERTY(AirspaceManager* airspaceManager READ airspaceManager CONSTANT)
Q_PROPERTY(bool airmapSupported READ airmapSupported CONSTANT) Q_PROPERTY(bool airmapSupported READ airmapSupported CONSTANT)
Q_PROPERTY(TaisyncManager* taisyncManager READ taisyncManager CONSTANT)
Q_PROPERTY(bool taisyncSupported READ taisyncSupported CONSTANT)
Q_PROPERTY(int supportedFirmwareCount READ supportedFirmwareCount CONSTANT) Q_PROPERTY(int supportedFirmwareCount READ supportedFirmwareCount CONSTANT)
...@@ -145,6 +152,13 @@ public: ...@@ -145,6 +152,13 @@ public:
static QGeoCoordinate flightMapPosition () { return _coord; } static QGeoCoordinate flightMapPosition () { return _coord; }
static double flightMapZoom () { return _zoom; } static double flightMapZoom () { return _zoom; }
TaisyncManager* taisyncManager () { return _taisyncManager; }
#if defined(QGC_GST_TAISYNC_ENABLED)
bool taisyncSupported () { return true; }
#else
bool taisyncSupported () { return false; }
#endif
qreal zOrderTopMost () { return 1000; } qreal zOrderTopMost () { return 1000; }
qreal zOrderWidgets () { return 100; } qreal zOrderWidgets () { return 100; }
qreal zOrderMapItems () { return 50; } qreal zOrderMapItems () { return 50; }
...@@ -189,21 +203,22 @@ signals: ...@@ -189,21 +203,22 @@ signals:
void skipSetupPageChanged (); void skipSetupPageChanged ();
private: private:
double _flightMapInitialZoom; double _flightMapInitialZoom = 17.0;
LinkManager* _linkManager; LinkManager* _linkManager = nullptr;
MultiVehicleManager* _multiVehicleManager; MultiVehicleManager* _multiVehicleManager = nullptr;
QGCMapEngineManager* _mapEngineManager; QGCMapEngineManager* _mapEngineManager = nullptr;
QGCPositionManager* _qgcPositionManager; QGCPositionManager* _qgcPositionManager = nullptr;
MissionCommandTree* _missionCommandTree; MissionCommandTree* _missionCommandTree = nullptr;
VideoManager* _videoManager; VideoManager* _videoManager = nullptr;
MAVLinkLogManager* _mavlinkLogManager; MAVLinkLogManager* _mavlinkLogManager = nullptr;
QGCCorePlugin* _corePlugin; QGCCorePlugin* _corePlugin = nullptr;
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager = nullptr;
SettingsManager* _settingsManager; SettingsManager* _settingsManager = nullptr;
FactGroup* _gpsRtkFactGroup; FactGroup* _gpsRtkFactGroup = nullptr;
AirspaceManager* _airspaceManager; AirspaceManager* _airspaceManager = nullptr;
TaisyncManager* _taisyncManager = nullptr;
bool _skipSetupPage;
bool _skipSetupPage = false;
static const char* _flightMapPositionSettingsGroup; static const char* _flightMapPositionSettingsGroup;
static const char* _flightMapPositionLatitudeSettingsKey; static const char* _flightMapPositionLatitudeSettingsKey;
......
...@@ -205,5 +205,19 @@ ...@@ -205,5 +205,19 @@
"shortDescription": "Request start of MAVLink telemetry streams (ArduPilot only)", "shortDescription": "Request start of MAVLink telemetry streams (ArduPilot only)",
"type": "bool", "type": "bool",
"defaultValue": true "defaultValue": true
},
{
"name": "enableTaisync",
"shortDescription": "Enable Taisync Module Support",
"longDescription": "Enable Taisync Module Support",
"type": "bool",
"defaultValue": true
},
{
"name": "enableTaisyncVideo",
"shortDescription": "Enable Taisync Video Support",
"longDescription": "Enable Taisync Video Support",
"type": "bool",
"defaultValue": true
} }
] ]
...@@ -85,6 +85,8 @@ DECLARE_SETTINGSFACT(AppSettings, defaultFirmwareType) ...@@ -85,6 +85,8 @@ DECLARE_SETTINGSFACT(AppSettings, defaultFirmwareType)
DECLARE_SETTINGSFACT(AppSettings, gstDebugLevel) DECLARE_SETTINGSFACT(AppSettings, gstDebugLevel)
DECLARE_SETTINGSFACT(AppSettings, followTarget) DECLARE_SETTINGSFACT(AppSettings, followTarget)
DECLARE_SETTINGSFACT(AppSettings, apmStartMavlinkStreams) DECLARE_SETTINGSFACT(AppSettings, apmStartMavlinkStreams)
DECLARE_SETTINGSFACT(AppSettings, enableTaisync)
DECLARE_SETTINGSFACT(AppSettings, enableTaisyncVideo)
DECLARE_SETTINGSFACT_NO_FUNC(AppSettings, indoorPalette) DECLARE_SETTINGSFACT_NO_FUNC(AppSettings, indoorPalette)
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
class AppSettings : public SettingsGroup class AppSettings : public SettingsGroup
{ {
Q_OBJECT Q_OBJECT
public: public:
AppSettings(QObject* parent = nullptr); AppSettings(QObject* parent = nullptr);
...@@ -43,6 +43,8 @@ public: ...@@ -43,6 +43,8 @@ public:
DEFINE_SETTINGFACT(defaultFirmwareType) DEFINE_SETTINGFACT(defaultFirmwareType)
DEFINE_SETTINGFACT(gstDebugLevel) DEFINE_SETTINGFACT(gstDebugLevel)
DEFINE_SETTINGFACT(followTarget) DEFINE_SETTINGFACT(followTarget)
DEFINE_SETTINGFACT(enableTaisync)
DEFINE_SETTINGFACT(enableTaisyncVideo)
// Although this is a global setting it only affects ArduPilot vehicle since PX4 automatically starts the stream from the vehicle side // Although this is a global setting it only affects ArduPilot vehicle since PX4 automatically starts the stream from the vehicle side
DEFINE_SETTINGFACT(apmStartMavlinkStreams) DEFINE_SETTINGFACT(apmStartMavlinkStreams)
......
...@@ -72,12 +72,5 @@ ...@@ -72,12 +72,5 @@
"shortDescription": "UDP target host port for autoconnect", "shortDescription": "UDP target host port for autoconnect",
"type": "uint32", "type": "uint32",
"defaultValue": 14550 "defaultValue": 14550
},
{
"name": "autoConnectTaisyncUSB",
"shortDescription": "Automatically connect to a Taisync Ground Module",
"longDescription": "If this option is enabled GroundControl will automatically connect to a Taisync Ground Module which is connected via USB.",
"type": "bool",
"defaultValue": false
} }
] ]
...@@ -23,7 +23,6 @@ DECLARE_SETTINGSFACT(AutoConnectSettings, autoConnectUDP) ...@@ -23,7 +23,6 @@ DECLARE_SETTINGSFACT(AutoConnectSettings, autoConnectUDP)
DECLARE_SETTINGSFACT(AutoConnectSettings, udpListenPort) DECLARE_SETTINGSFACT(AutoConnectSettings, udpListenPort)
DECLARE_SETTINGSFACT(AutoConnectSettings, udpTargetHostIP) DECLARE_SETTINGSFACT(AutoConnectSettings, udpTargetHostIP)
DECLARE_SETTINGSFACT(AutoConnectSettings, udpTargetHostPort) DECLARE_SETTINGSFACT(AutoConnectSettings, udpTargetHostPort)
DECLARE_SETTINGSFACT(AutoConnectSettings, autoconnectTaisyncUSB)
DECLARE_SETTINGSFACT_NO_FUNC(AutoConnectSettings, autoConnectPixhawk) DECLARE_SETTINGSFACT_NO_FUNC(AutoConnectSettings, autoConnectPixhawk)
{ {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
class AutoConnectSettings : public SettingsGroup class AutoConnectSettings : public SettingsGroup
{ {
Q_OBJECT Q_OBJECT
public: public:
AutoConnectSettings(QObject* parent = nullptr); AutoConnectSettings(QObject* parent = nullptr);
...@@ -31,6 +31,5 @@ public: ...@@ -31,6 +31,5 @@ public:
DEFINE_SETTINGFACT(udpListenPort) DEFINE_SETTINGFACT(udpListenPort)
DEFINE_SETTINGFACT(udpTargetHostIP) DEFINE_SETTINGFACT(udpTargetHostIP)
DEFINE_SETTINGFACT(udpTargetHostPort) DEFINE_SETTINGFACT(udpTargetHostPort)
DEFINE_SETTINGFACT(autoconnectTaisyncUSB)
}; };
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
#include "VideoManager.h" #include "VideoManager.h"
QGC_LOGGING_CATEGORY(TaisyncLog, "TaisyncLog") QGC_LOGGING_CATEGORY(TaisyncLog, "TaisyncLog")
QGC_LOGGING_CATEGORY(TaisyncVerbose, "TaisyncVerbose")
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
TaisyncHandler::TaisyncHandler(QObject* parent) TaisyncHandler::TaisyncHandler(QObject* parent)
...@@ -31,8 +32,8 @@ TaisyncHandler::~TaisyncHandler() ...@@ -31,8 +32,8 @@ TaisyncHandler::~TaisyncHandler()
void void
TaisyncHandler::close() TaisyncHandler::close()
{ {
qCDebug(TaisyncLog) << "Close Taisync TCP";
if(_tcpSocket) { if(_tcpSocket) {
qCDebug(TaisyncLog) << "Close Taisync TCP";
_tcpSocket->close(); _tcpSocket->close();
_tcpSocket->deleteLater(); _tcpSocket->deleteLater();
_tcpSocket = nullptr; _tcpSocket = nullptr;
...@@ -40,13 +41,28 @@ TaisyncHandler::close() ...@@ -40,13 +41,28 @@ TaisyncHandler::close()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void bool
TaisyncHandler::_start(uint16_t port) TaisyncHandler::_start(uint16_t port, QHostAddress addr)
{ {
qCDebug(TaisyncLog) << "Start Taisync TCP on port" << port; close();
_tcpServer = new QTcpServer(this); _serverMode = addr == QHostAddress::AnyIPv4;
QObject::connect(_tcpServer, &QTcpServer::newConnection, this, &TaisyncHandler::_newConnection); if(_serverMode) {
_tcpServer->listen(QHostAddress::AnyIPv4, port); qCDebug(TaisyncLog) << "Listen for Taisync TCP on port" << port;
_tcpServer = new QTcpServer(this);
QObject::connect(_tcpServer, &QTcpServer::newConnection, this, &TaisyncHandler::_newConnection);
_tcpServer->listen(QHostAddress::AnyIPv4, port);
} else {
_tcpSocket = new QTcpSocket();
QObject::connect(_tcpSocket, &QIODevice::readyRead, this, &TaisyncHandler::_readBytes);
qCDebug(TaisyncLog) << "Connecting to" << addr;
_tcpSocket->connectToHost(addr, port);
if (!_tcpSocket->waitForConnected(1000)) {
close();
return false;
}
emit connected();
}
return true;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -14,12 +14,18 @@ ...@@ -14,12 +14,18 @@
#include <QTcpServer> #include <QTcpServer>
#include <QTcpSocket> #include <QTcpSocket>
#if defined(__ios__) || defined(__android__)
#define TAISYNC_VIDEO_UDP_PORT 5600 #define TAISYNC_VIDEO_UDP_PORT 5600
#define TAISYNC_VIDEO_TCP_PORT 8000 #define TAISYNC_VIDEO_TCP_PORT 8000
#define TAISYNC_SETTINGS_PORT 8200 #define TAISYNC_SETTINGS_PORT 8200
#define TAISYNC_TELEM_PORT 8400 #define TAISYNC_TELEM_PORT 8400
#else
#define TAISYNC_SETTINGS_PORT 80
#define TAISYNC_SETTINGS_TARGET "192.168.1.99"
#endif
Q_DECLARE_LOGGING_CATEGORY(TaisyncLog) Q_DECLARE_LOGGING_CATEGORY(TaisyncLog)
Q_DECLARE_LOGGING_CATEGORY(TaisyncVerbose)
class TaisyncHandler : public QObject class TaisyncHandler : public QObject
{ {
...@@ -28,11 +34,11 @@ public: ...@@ -28,11 +34,11 @@ public:
explicit TaisyncHandler (QObject* parent = nullptr); explicit TaisyncHandler (QObject* parent = nullptr);
~TaisyncHandler (); ~TaisyncHandler ();
virtual void start () = 0; virtual bool start () = 0;
virtual void close (); virtual void close ();
protected: protected:
virtual void _start (uint16_t port); virtual bool _start (uint16_t port, QHostAddress addr = QHostAddress::AnyIPv4);
protected slots: protected slots:
virtual void _newConnection (); virtual void _newConnection ();
...@@ -43,6 +49,7 @@ signals: ...@@ -43,6 +49,7 @@ signals:
void connected (); void connected ();
protected: protected:
QTcpServer* _tcpServer = nullptr; bool _serverMode = true;
QTcpSocket* _tcpSocket = nullptr; QTcpServer* _tcpServer = nullptr;
QTcpSocket* _tcpSocket = nullptr;
}; };
/****************************************************************************
*
* (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.
*
****************************************************************************/
#pragma once
#include "QGCToolbox.h"
#include "QGCLoggingCategory.h"
#include "TaisyncSettings.h"
#if defined(__ios__) || defined(__android__)
#include "TaisyncTelemetry.h"
#include "TaisyncVideoReceiver.h"
#endif
#include <QTimer>
class AppSettings;
class QGCApplication;
//-----------------------------------------------------------------------------
class TaisyncManager : public QGCTool
{
Q_OBJECT
public:
Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
Q_PROPERTY(bool linkConnected READ linkConnected NOTIFY linkChanged)
Q_PROPERTY(QString linkVidFormat READ linkVidFormat NOTIFY linkChanged)
Q_PROPERTY(int uplinkRSSI READ uplinkRSSI NOTIFY linkChanged)
Q_PROPERTY(int downlinkRSSI READ downlinkRSSI NOTIFY linkChanged)
Q_PROPERTY(QString serialNumber READ serialNumber NOTIFY linkChanged)
Q_PROPERTY(QString fwVersion READ fwVersion NOTIFY linkChanged)
explicit TaisyncManager (QGCApplication* app, QGCToolbox* toolbox);
~TaisyncManager () override;
void setToolbox (QGCToolbox* toolbox) override;
bool connected () { return _isConnected; }
bool linkConnected () { return _linkConnected; }
QString linkVidFormat () { return _linkVidFormat; }
int uplinkRSSI () { return _downlinkRSSI; }
int downlinkRSSI () { return _uplinkRSSI; }
QString serialNumber () { return _serialNumber; }
QString fwVersion () { return _fwVersion; }
signals:
void linkChanged ();
void connectedChanged ();
private slots:
void _connected ();
void _checkTaisync ();
void _updateSettings (QByteArray jSonData);
void _setEnabled ();
void _setVideoEnabled ();
private:
enum {
REQ_LINK_STATUS,
REQ_DEV_INFO,
REQ_FREQ_SCAN,
REQ_LAST
};
int _currReq = REQ_LAST;
bool _running = false;
bool _isConnected = false;
AppSettings* _appSettings = nullptr;
TaisyncManager* _taiManager = nullptr;
TaisyncSettings* _taiSettings = nullptr;
#if defined(__ios__) || defined(__android__)
TaisyncTelemetry* _taiTelemetery = nullptr;
TaisyncVideoReceiver* _taiVideo = nullptr;
#endif
bool _enableVideo = true;
bool _enabled = true;
bool _linkConnected = false;
QTimer _workTimer;
QString _linkVidFormat;
int _downlinkRSSI = 0;
int _uplinkRSSI = 0;
bool _savedVideoState = true;
QVariant _savedVideoSource;
QVariant _savedVideoUDP;
QVariant _savedAR;
QString _serialNumber;
QString _fwVersion;
};
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
* *
****************************************************************************/ ****************************************************************************/
#include "TaisyncManager.h"
#include "TaisyncSettings.h" #include "TaisyncSettings.h"
#include "SettingsManager.h" #include "SettingsManager.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "VideoManager.h" #include "VideoManager.h"
QGC_LOGGING_CATEGORY(TaisyncSettingsLog, "TaisyncSettingsLog")
static const char* kPostReq = static const char* kPostReq =
"POST %1 HTTP/1.1\r\n" "POST %1 HTTP/1.1\r\n"
"Content-Type: application/json\r\n" "Content-Type: application/json\r\n"
...@@ -30,19 +29,36 @@ TaisyncSettings::TaisyncSettings(QObject* parent) ...@@ -30,19 +29,36 @@ TaisyncSettings::TaisyncSettings(QObject* parent)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void bool TaisyncSettings::start()
TaisyncSettings::start()
{ {
qCDebug(TaisyncSettingsLog) << "Start Taisync Settings"; qCDebug(TaisyncLog) << "Start Taisync Settings";
_start(TAISYNC_SETTINGS_PORT); #if defined(__ios__) || defined(__android__)
return _start(TAISYNC_SETTINGS_PORT);
#else
return _start(80, QHostAddress(TAISYNC_SETTINGS_TARGET));
#endif
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bool
TaisyncSettings::requestSettings() TaisyncSettings::requestLinkStatus()
{ {
if(_tcpSocket) { if(_tcpSocket) {
QString req = QString(kGetReq).arg("/v1/baseband.json"); QString req = QString(kGetReq).arg("/v1/baseband.json");
//qCDebug(TaisyncVerbose) << "Request" << req;
_tcpSocket->write(req.toUtf8());
return true;
}
return false;
}
//-----------------------------------------------------------------------------
bool
TaisyncSettings::requestDevInfo()
{
if(_tcpSocket) {
QString req = QString(kGetReq).arg("/v1/device.json");
//qCDebug(TaisyncVerbose) << "Request" << req;
_tcpSocket->write(req.toUtf8()); _tcpSocket->write(req.toUtf8());
return true; return true;
} }
...@@ -55,6 +71,7 @@ TaisyncSettings::requestFreqScan() ...@@ -55,6 +71,7 @@ TaisyncSettings::requestFreqScan()
{ {
if(_tcpSocket) { if(_tcpSocket) {
QString req = QString(kGetReq).arg("/v1/freqscan.json"); QString req = QString(kGetReq).arg("/v1/freqscan.json");
//qCDebug(TaisyncVerbose) << "Request" << req;
_tcpSocket->write(req.toUtf8()); _tcpSocket->write(req.toUtf8());
return true; return true;
} }
...@@ -66,26 +83,12 @@ void ...@@ -66,26 +83,12 @@ void
TaisyncSettings::_readBytes() TaisyncSettings::_readBytes()
{ {
QByteArray bytesIn = _tcpSocket->read(_tcpSocket->bytesAvailable()); QByteArray bytesIn = _tcpSocket->read(_tcpSocket->bytesAvailable());
qCDebug(TaisyncSettingsLog) << "Taisync settings data:" << bytesIn.size(); //qCDebug(TaisyncVerbose) << "Taisync settings data:" << bytesIn.size();
qCDebug(TaisyncSettingsLog) << QString(bytesIn); //qCDebug(TaisyncVerbose) << QString(bytesIn);
if(bytesIn.contains("200 OK")) { //-- Go straight to Json payload
//-- Link Status? int idx = bytesIn.indexOf('{');
int idx = bytesIn.indexOf('{'); if(idx > 0) {
QJsonParseError jsonParseError; emit updateSettings(bytesIn.mid(idx));
QJsonDocument doc = QJsonDocument::fromJson(bytesIn.mid(idx), &jsonParseError);
if (jsonParseError.error != QJsonParseError::NoError) {
qWarning() << "Unable to parse Taisync response:" << jsonParseError.errorString() << jsonParseError.offset;
return;
}
QJsonObject jObj = doc.object();
//-- Link Status?
if(bytesIn.contains("\"flight\":")) {
_linkConnected = jObj["flight"].toBool(_linkConnected);
_linkVidFormat = jObj["videoformat"].toString(_linkVidFormat);
_downlinkRSSI = jObj["radiorssi"].toInt(_downlinkRSSI);
_uplinkRSSI = jObj["hdrssi"].toInt(_uplinkRSSI);
emit linkChanged();
}
} }
} }
...@@ -11,37 +11,20 @@ ...@@ -11,37 +11,20 @@
#include "TaisyncHandler.h" #include "TaisyncHandler.h"
Q_DECLARE_LOGGING_CATEGORY(TaisyncSettingsLog)
class TaisyncSettings : public TaisyncHandler class TaisyncSettings : public TaisyncHandler
{ {
Q_OBJECT Q_OBJECT
public: public:
Q_PROPERTY(bool linkConnected READ linkConnected NOTIFY linkChanged)
Q_PROPERTY(QString linkVidFormat READ linkVidFormat NOTIFY linkChanged)
Q_PROPERTY(int uplinkRSSI READ uplinkRSSI NOTIFY linkChanged)
Q_PROPERTY(int downlinkRSSI READ downlinkRSSI NOTIFY linkChanged)
explicit TaisyncSettings (QObject* parent = nullptr); explicit TaisyncSettings (QObject* parent = nullptr);
void start () override; bool start () override;
bool requestSettings (); bool requestLinkStatus ();
bool requestDevInfo ();
bool requestFreqScan (); bool requestFreqScan ();
bool linkConnected () { return _linkConnected; }
QString linkVidFormat () { return _linkVidFormat; }
int uplinkRSSI () { return _downlinkRSSI; }
int downlinkRSSI () { return _uplinkRSSI; }
signals: signals:
void linkChanged (); void updateSettings (QByteArray jSonData);
protected slots: protected slots:
void _readBytes () override; void _readBytes () override;
private:
bool _linkConnected = false;
QString _linkVidFormat;
int _downlinkRSSI = 0;
int _uplinkRSSI = 0;
}; };
This diff is collapsed.
...@@ -30,11 +30,10 @@ TaisyncTelemetry::close() ...@@ -30,11 +30,10 @@ TaisyncTelemetry::close()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void bool TaisyncTelemetry::start()
TaisyncTelemetry::start()
{ {
qCDebug(TaisyncTelemetryLog) << "Start Taisync Telemetry"; qCDebug(TaisyncTelemetryLog) << "Start Taisync Telemetry";
_start(TAISYNC_TELEM_PORT); return _start(TAISYNC_TELEM_PORT);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -22,7 +22,7 @@ public: ...@@ -22,7 +22,7 @@ public:
explicit TaisyncTelemetry (QObject* parent = nullptr); explicit TaisyncTelemetry (QObject* parent = nullptr);
void close () override; void close () override;
void start () override; bool start () override;
void writeBytes (QByteArray bytes); void writeBytes (QByteArray bytes);
signals: signals:
......
...@@ -35,12 +35,12 @@ TaisyncVideoReceiver::close() ...@@ -35,12 +35,12 @@ TaisyncVideoReceiver::close()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void bool
TaisyncVideoReceiver::start() TaisyncVideoReceiver::start()
{ {
qCDebug(TaisyncVideoReceiverLog) << "Start Taisync Video Receiver"; qCDebug(TaisyncVideoReceiverLog) << "Start Taisync Video Receiver";
_udpVideoSocket = new QUdpSocket(this); _udpVideoSocket = new QUdpSocket(this);
_start(TAISYNC_VIDEO_TCP_PORT); return _start(TAISYNC_VIDEO_TCP_PORT);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -20,7 +20,7 @@ class TaisyncVideoReceiver : public TaisyncHandler ...@@ -20,7 +20,7 @@ class TaisyncVideoReceiver : public TaisyncHandler
public: public:
explicit TaisyncVideoReceiver (QObject* parent = nullptr); explicit TaisyncVideoReceiver (QObject* parent = nullptr);
void start () override; bool start () override;
void close () override; void close () override;
private slots: private slots:
......
...@@ -229,7 +229,8 @@ VideoReceiver::start() ...@@ -229,7 +229,8 @@ VideoReceiver::start()
_stop = false; _stop = false;
qCDebug(VideoReceiverLog) << "start()"; qCDebug(VideoReceiverLog) << "start()";
#ifdef QGC_GST_TAISYNC_ENABLED #if defined(QGC_GST_TAISYNC_ENABLED) && (defined(__android__) || defined(__ios__))
//-- Taisync on iOS or Android sends a raw h.264 stream
bool isTaisyncUSB = qgcApp()->toolbox()->videoManager()->isTaisync(); bool isTaisyncUSB = qgcApp()->toolbox()->videoManager()->isTaisync();
#else #else
bool isTaisyncUSB = false; bool isTaisyncUSB = false;
...@@ -295,7 +296,7 @@ VideoReceiver::start() ...@@ -295,7 +296,7 @@ VideoReceiver::start()
break; break;
} }
g_object_set(static_cast<gpointer>(dataSource), "uri", qPrintable(_uri), "caps", caps, nullptr); g_object_set(static_cast<gpointer>(dataSource), "uri", qPrintable(_uri), "caps", caps, nullptr);
#ifdef QGC_GST_TAISYNC_ENABLED #if defined(QGC_GST_TAISYNC_ENABLED) && (defined(__android__) || defined(__ios__))
} else if(isTaisyncUSB) { } else if(isTaisyncUSB) {
QString uri = QString("0.0.0.0:%1").arg(TAISYNC_VIDEO_UDP_PORT); QString uri = QString("0.0.0.0:%1").arg(TAISYNC_VIDEO_UDP_PORT);
qCDebug(VideoReceiverLog) << "Taisync URI:" << uri; qCDebug(VideoReceiverLog) << "Taisync URI:" << uri;
......
...@@ -29,25 +29,6 @@ class QGCCorePlugin_p ...@@ -29,25 +29,6 @@ class QGCCorePlugin_p
{ {
public: public:
QGCCorePlugin_p() QGCCorePlugin_p()
: pGeneral (nullptr)
, pCommLinks (nullptr)
, pOfflineMaps (nullptr)
#if defined(QGC_AIRMAP_ENABLED)
, pAirmap (nullptr)
#endif
, pMAVLink (nullptr)
, pConsole (nullptr)
, pHelp (nullptr)
#if defined(QT_DEBUG)
, pMockLink (nullptr)
, pDebug (nullptr)
#endif
, defaultOptions (nullptr)
, valuesPageWidgetInfo (nullptr)
, cameraPageWidgetInfo (nullptr)
, videoPageWidgetInfo (nullptr)
, healthPageWidgetInfo (nullptr)
, vibrationPageWidgetInfo (nullptr)
{ {
} }
...@@ -59,6 +40,10 @@ public: ...@@ -59,6 +40,10 @@ public:
delete pCommLinks; delete pCommLinks;
if(pOfflineMaps) if(pOfflineMaps)
delete pOfflineMaps; delete pOfflineMaps;
#if defined(QGC_GST_TAISYNC_ENABLED)
if(pTaisync)
delete pTaisync;
#endif
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
if(pAirmap) if(pAirmap)
delete pAirmap; delete pAirmap;
...@@ -77,27 +62,31 @@ public: ...@@ -77,27 +62,31 @@ public:
delete defaultOptions; delete defaultOptions;
} }
QmlComponentInfo* pGeneral; QmlComponentInfo* pGeneral = nullptr;
QmlComponentInfo* pCommLinks; QmlComponentInfo* pCommLinks = nullptr;
QmlComponentInfo* pOfflineMaps; QmlComponentInfo* pOfflineMaps = nullptr;
#if defined(QGC_GST_TAISYNC_ENABLED)
QmlComponentInfo* pTaisync = nullptr;
#endif
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
QmlComponentInfo* pAirmap; QmlComponentInfo* pAirmap = nullptr;
#endif #endif
QmlComponentInfo* pMAVLink; QmlComponentInfo* pMAVLink = nullptr;
QmlComponentInfo* pConsole; QmlComponentInfo* pConsole = nullptr;
QmlComponentInfo* pHelp; QmlComponentInfo* pHelp = nullptr;
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
QmlComponentInfo* pMockLink; QmlComponentInfo* pMockLink = nullptr;
QmlComponentInfo* pDebug; QmlComponentInfo* pDebug = nullptr;
#endif #endif
QVariantList settingsList;
QGCOptions* defaultOptions; QmlComponentInfo* valuesPageWidgetInfo = nullptr;
QmlComponentInfo* cameraPageWidgetInfo = nullptr;
QmlComponentInfo* valuesPageWidgetInfo; QmlComponentInfo* videoPageWidgetInfo = nullptr;
QmlComponentInfo* cameraPageWidgetInfo; QmlComponentInfo* healthPageWidgetInfo = nullptr;
QmlComponentInfo* videoPageWidgetInfo; QmlComponentInfo* vibrationPageWidgetInfo = nullptr;
QmlComponentInfo* healthPageWidgetInfo;
QmlComponentInfo* vibrationPageWidgetInfo; QGCOptions* defaultOptions = nullptr;
QVariantList settingsList;
QVariantList instrumentPageWidgetList; QVariantList instrumentPageWidgetList;
QmlObjectListModel _emptyCustomMapItems; QmlObjectListModel _emptyCustomMapItems;
...@@ -141,6 +130,12 @@ QVariantList &QGCCorePlugin::settingsPages() ...@@ -141,6 +130,12 @@ QVariantList &QGCCorePlugin::settingsPages()
QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps))); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps)));
#if defined(QGC_GST_TAISYNC_ENABLED)
_p->pTaisync = new QmlComponentInfo(tr("Taisync"),
QUrl::fromUserInput("qrc:/qml/TaisyncSettings.qml"),
QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pTaisync)));
#endif
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
_p->pAirmap = new QmlComponentInfo(tr("AirMap"), _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"), QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#ifdef QT_DEBUG #ifdef QT_DEBUG
#include "MockLink.h" #include "MockLink.h"
#endif #endif
#if defined(QGC_GST_TAISYNC_ENABLED)
#include "TaisyncLink.h"
#endif
#define LINK_SETTING_ROOT "LinkConfigurations" #define LINK_SETTING_ROOT "LinkConfigurations"
...@@ -110,11 +107,6 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na ...@@ -110,11 +107,6 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na
case LinkConfiguration::TypeMock: case LinkConfiguration::TypeMock:
config = new MockConfiguration(name); config = new MockConfiguration(name);
break; break;
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
case LinkConfiguration::TypeTaisync:
config = new TaisyncConfiguration(name);
break;
#endif #endif
} }
return config; return config;
...@@ -153,11 +145,6 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc ...@@ -153,11 +145,6 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
case TypeMock: case TypeMock:
dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source)); dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source));
break; break;
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
case TypeTaisync:
dupe = new TaisyncConfiguration(dynamic_cast<TaisyncConfiguration*>(source));
break;
#endif #endif
case TypeLast: case TypeLast:
break; break;
......
...@@ -51,9 +51,6 @@ public: ...@@ -51,9 +51,6 @@ public:
#endif #endif
TypeUdp, ///< UDP Link TypeUdp, ///< UDP Link
TypeTcp, ///< TCP Link TypeTcp, ///< TCP Link
#if defined(QGC_GST_TAISYNC_ENABLED)
TypeTaisync,
#endif
#ifdef QGC_ENABLE_BLUETOOTH #ifdef QGC_ENABLE_BLUETOOTH
TypeBluetooth, ///< Bluetooth Link TypeBluetooth, ///< Bluetooth Link
#endif #endif
......
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
#ifdef QGC_ENABLE_BLUETOOTH #ifdef QGC_ENABLE_BLUETOOTH
#include "BluetoothLink.h" #include "BluetoothLink.h"
#endif #endif
#if defined(QGC_GST_TAISYNC_ENABLED)
#include "TaisyncLink.h"
#endif
#ifndef __mobile__ #ifndef __mobile__
#include "GPSManager.h" #include "GPSManager.h"
...@@ -151,11 +148,6 @@ LinkInterface* LinkManager::createConnectedLink(SharedLinkConfigurationPointer& ...@@ -151,11 +148,6 @@ LinkInterface* LinkManager::createConnectedLink(SharedLinkConfigurationPointer&
case LinkConfiguration::TypeMock: case LinkConfiguration::TypeMock:
pLink = new MockLink(config); pLink = new MockLink(config);
break; break;
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
case LinkConfiguration::TypeTaisync:
pLink = new TaisyncLink(config);
break;
#endif #endif
case LinkConfiguration::TypeLast: case LinkConfiguration::TypeLast:
break; break;
...@@ -410,11 +402,6 @@ void LinkManager::loadLinkConfigurationList() ...@@ -410,11 +402,6 @@ void LinkManager::loadLinkConfigurationList()
case LinkConfiguration::TypeMock: case LinkConfiguration::TypeMock:
pLink = dynamic_cast<LinkConfiguration*>(new MockConfiguration(name)); pLink = dynamic_cast<LinkConfiguration*>(new MockConfiguration(name));
break; break;
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
case LinkConfiguration::TypeTaisync:
pLink = dynamic_cast<LinkConfiguration*>(new TaisyncConfiguration(name));
break;
#endif #endif
case LinkConfiguration::TypeLast: case LinkConfiguration::TypeLast:
break; break;
...@@ -686,9 +673,6 @@ QStringList LinkManager::linkTypeStrings(void) const ...@@ -686,9 +673,6 @@ QStringList LinkManager::linkTypeStrings(void) const
#endif #endif
list += tr("UDP"); list += tr("UDP");
list += tr("TCP"); list += tr("TCP");
#if defined(QGC_GST_TAISYNC_ENABLED)
list += tr("Taisync");
#endif
#ifdef QGC_ENABLE_BLUETOOTH #ifdef QGC_ENABLE_BLUETOOTH
list += "Bluetooth"; list += "Bluetooth";
#endif #endif
...@@ -830,15 +814,6 @@ void LinkManager::_fixUnnamed(LinkConfiguration* config) ...@@ -830,15 +814,6 @@ void LinkManager::_fixUnnamed(LinkConfiguration* config)
} }
} }
break; break;
#if defined(QGC_GST_TAISYNC_ENABLED)
case LinkConfiguration::TypeTaisync: {
TaisyncConfiguration* tconfig = dynamic_cast<TaisyncConfiguration*>(config);
if(tconfig) {
config->setName(QString("Taisync Link"));
}
}
break;
#endif
#ifdef QGC_ENABLE_BLUETOOTH #ifdef QGC_ENABLE_BLUETOOTH
case LinkConfiguration::TypeBluetooth: { case LinkConfiguration::TypeBluetooth: {
BluetoothConfiguration* tconfig = dynamic_cast<BluetoothConfiguration*>(config); BluetoothConfiguration* tconfig = dynamic_cast<BluetoothConfiguration*>(config);
......
/****************************************************************************
*
* (c) 2009-2018 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 <QString>
#include <QList>
#include <QMap>
#include <QMutex>
#include <QUdpSocket>
#include <QMutexLocker>
#include <QQueue>
#include <QByteArray>
#include <QTcpServer>
#include <QTcpSocket>
#include <QVariant>
#include "QGCConfig.h"
#include "LinkManager.h"
class TaisyncTelemetry;
class TaisyncSettings;
#if defined(__ios__) || defined(__android__)
class TaisyncVideoReceiver;
#endif
//-----------------------------------------------------------------------------
class TaisyncConfiguration : public LinkConfiguration
{
Q_OBJECT
public:
Q_PROPERTY(bool videoEnabled READ videoEnabled WRITE setVideoEnabled NOTIFY enableVideoChanged)
TaisyncConfiguration (const QString& name);
TaisyncConfiguration (TaisyncConfiguration* source);
~TaisyncConfiguration ();
bool videoEnabled () { return _enableVideo; }
void setVideoEnabled (bool enable);
/// From LinkConfiguration
LinkType type () { return LinkConfiguration::TypeTaisync; }
void copyFrom (LinkConfiguration* source);
void loadSettings (QSettings& settings, const QString& root);
void saveSettings (QSettings& settings, const QString& root);
void updateSettings ();
bool isAutoConnectAllowed() { return true; }
bool isHighLatencyAllowed() { return false; }
QString settingsURL () { return "TaisyncSettings.qml"; }
QString settingsTitle () { return tr("Taisync Link Settings"); }
signals:
void enableVideoChanged ();
private:
void _copyFrom (LinkConfiguration *source);
private:
bool _enableVideo = true;
};
//-----------------------------------------------------------------------------
class TaisyncLink : public LinkInterface
{
Q_OBJECT
friend class TaisyncConfiguration;
friend class LinkManager;
public:
void requestReset () override { }
bool isConnected () const override;
QString getName () const override;
TaisyncSettings*taisyncSettings () { return _taiSettings; }
// Extensive statistics for scientific purposes
qint64 getConnectionSpeed () const override;
qint64 getCurrentInDataRate () const;
qint64 getCurrentOutDataRate () const;
// Thread
void run () override;
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool connect (void);
bool disconnect (void);
private slots:
void _writeBytes (const QByteArray data) override;
void _readBytes (QByteArray bytes);
void _telemetryReady ();
void _settingsReady ();
private:
// Links are only created/destroyed by LinkManager so constructor/destructor is not public
TaisyncLink (SharedLinkConfigurationPointer& config);
~TaisyncLink () override;
// From LinkInterface
bool _connect () override;
void _disconnect () override;
bool _hardwareConnect ();
void _hardwareDisconnect ();
void _restartConnection ();
void _writeDataGram (const QByteArray data);
private:
bool _running = false;
TaisyncConfiguration* _taiConfig = nullptr;
TaisyncTelemetry* _taiTelemetery = nullptr;
TaisyncSettings* _taiSettings = nullptr;
#if defined(__ios__) || defined(__android__)
TaisyncVideoReceiver* _taiVideo = nullptr;
#endif
bool _savedVideoState = true;
bool _connected = false;
QVariant _savedVideoSource;
QVariant _savedVideoUDP;
QVariant _savedAR;
};
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