diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index 3ce5ad56c5604c764f85434adb3800e4508c3178..176c47811750253476752f9905a47b43ad3e5ea3 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -24,6 +24,7 @@
src/ui/preferences/MavlinkSettings.qml
src/MissionEditor/MissionEditor.qml
src/MissionEditor/MissionEditorHelp.qml
+ src/ui/preferences/MockLink.qml
src/AutoPilotPlugins/PX4/PowerComponent.qml
src/AutoPilotPlugins/PX4/PowerComponentSummary.qml
src/VehicleSetup/PX4FlowSensor.qml
diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc
index 53dd03924c2d99b3e53424d94864a4f5b9ea2843..efec03aea803af52ce3a654bd979bb43ee8990b3 100644
--- a/src/QmlControls/QGroundControlQmlGlobal.cc
+++ b/src/QmlControls/QGroundControlQmlGlobal.cc
@@ -66,3 +66,83 @@ bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool de
settings.beginGroup(kQmlGlobalKeyName);
return settings.value(key, defaultValue).toBool();
}
+
+#ifdef QT_DEBUG
+void QGroundControlQmlGlobal::_startMockLink(MockConfiguration* mockConfig)
+{
+ MockLink* mockLink = new MockLink(mockConfig);
+
+ LinkManager* linkManager = qgcApp()->toolbox()->linkManager();
+
+ linkManager->_addLink(mockLink);
+ linkManager->connectLink(mockLink);
+}
+#endif
+
+void QGroundControlQmlGlobal::startPX4MockLink(bool sendStatusText)
+{
+#ifdef QT_DEBUG
+ MockConfiguration mockConfig("PX4 MockLink");
+
+ mockConfig.setFirmwareType(MAV_AUTOPILOT_PX4);
+ mockConfig.setVehicleType(MAV_TYPE_QUADROTOR);
+ mockConfig.setSendStatusText(sendStatusText);
+
+ _startMockLink(&mockConfig);
+#endif
+}
+
+void QGroundControlQmlGlobal::startGenericMockLink(bool sendStatusText)
+{
+#ifdef QT_DEBUG
+ MockConfiguration mockConfig("Generic MockLink");
+
+ mockConfig.setFirmwareType(MAV_AUTOPILOT_GENERIC);
+ mockConfig.setVehicleType(MAV_TYPE_QUADROTOR);
+ mockConfig.setSendStatusText(sendStatusText);
+
+ _startMockLink(&mockConfig);
+#endif
+}
+
+void QGroundControlQmlGlobal::startAPMArduCopterMockLink(bool sendStatusText)
+{
+#ifdef QT_DEBUG
+ MockConfiguration mockConfig("APM ArduCopter MockLink");
+
+ mockConfig.setFirmwareType(MAV_AUTOPILOT_ARDUPILOTMEGA);
+ mockConfig.setVehicleType(MAV_TYPE_QUADROTOR);
+ mockConfig.setSendStatusText(sendStatusText);
+
+ _startMockLink(&mockConfig);
+#endif
+}
+
+void QGroundControlQmlGlobal::startAPMArduPlaneMockLink(bool sendStatusText)
+{
+#ifdef QT_DEBUG
+ MockConfiguration mockConfig("APM ArduPlane MockLink");
+
+ mockConfig.setFirmwareType(MAV_AUTOPILOT_ARDUPILOTMEGA);
+ mockConfig.setVehicleType(MAV_TYPE_FIXED_WING);
+ mockConfig.setSendStatusText(sendStatusText);
+
+ _startMockLink(&mockConfig);
+#endif
+}
+
+void QGroundControlQmlGlobal::stopAllMockLinks(void)
+{
+#ifdef QT_DEBUG
+ LinkManager* linkManager = qgcApp()->toolbox()->linkManager();
+
+ QList links = linkManager->getLinks();
+ for (int i=0; i(link);
+ if (mockLink) {
+ linkManager->disconnectLink(mockLink);
+ }
+ }
+#endif
+}
diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h
index 8f3ad3c0b1bf8b39aa7fd6a47d60445df331f560..302439196909c892313cc6f4b8b41228641b3591 100644
--- a/src/QmlControls/QGroundControlQmlGlobal.h
+++ b/src/QmlControls/QGroundControlQmlGlobal.h
@@ -34,6 +34,10 @@
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
+#ifdef QT_DEBUG
+#include "MockLink.h"
+#endif
+
class QGCToolbox;
class QGroundControlQmlGlobal : public QObject
@@ -58,6 +62,12 @@ public:
Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value);
Q_INVOKABLE bool loadBoolGlobalSetting (const QString& key, bool defaultValue);
+ Q_INVOKABLE void startPX4MockLink (bool sendStatusText);
+ Q_INVOKABLE void startGenericMockLink (bool sendStatusText);
+ Q_INVOKABLE void startAPMArduCopterMockLink (bool sendStatusText);
+ Q_INVOKABLE void startAPMArduPlaneMockLink (bool sendStatusText);
+ Q_INVOKABLE void stopAllMockLinks (void);
+
// Property accesors
HomePositionManager* homePositionManager () { return _homePositionManager; }
@@ -123,6 +133,10 @@ signals:
void isVersionCheckEnabledChanged (bool enabled);
private:
+#ifdef QT_DEBUG
+ void _startMockLink(MockConfiguration* mockConfig);
+#endif
+
HomePositionManager* _homePositionManager;
FlightMapSettings* _flightMapSettings;
};
diff --git a/src/ui/MainWindowLeftPanel.qml b/src/ui/MainWindowLeftPanel.qml
index b831c8f025c25760eda1c6f296fde513d8fcacd7..668c236d848c8a6f7c0c291abd0e1508a3c22bf3 100644
--- a/src/ui/MainWindowLeftPanel.qml
+++ b/src/ui/MainWindowLeftPanel.qml
@@ -169,6 +169,20 @@ Item {
checked = true
}
}
+ QGCButton {
+ width: parent.width * 0.8
+ height: ScreenTools.defaultFontPixelHeight * 2.5
+ text: "Mock Link"
+ visible: ScreenTools.isDebug
+ exclusiveGroup: panelActionGroup
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ if(__rightPanel.source != "MockLink.qml") {
+ __rightPanel.source = "MockLink.qml"
+ }
+ checked = true
+ }
+ }
QGCButton {
width: parent.width * 0.8
height: ScreenTools.defaultFontPixelHeight * 2.5
diff --git a/src/ui/preferences/MockLink.qml b/src/ui/preferences/MockLink.qml
new file mode 100644
index 0000000000000000000000000000000000000000..7398aa59db6465289d848e97ec81b02952e3f71f
--- /dev/null
+++ b/src/ui/preferences/MockLink.qml
@@ -0,0 +1,67 @@
+/*=====================================================================
+
+ QGroundControl Open Source Ground Control Station
+
+ (c) 2009 - 2015 QGROUNDCONTROL PROJECT
+
+ This file is part of the QGROUNDCONTROL project
+
+ QGROUNDCONTROL is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ QGROUNDCONTROL is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with QGROUNDCONTROL. If not, see .
+
+ ======================================================================*/
+
+import QtQuick 2.3
+
+import QGroundControl 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.ScreenTools 1.0
+
+Rectangle {
+ color: qgcPal.window
+
+ QGCPalette { id: qgcPal; colorGroupEnabled: true }
+
+ Column {
+ anchors.margins: ScreenTools.defaultFontPixelHeight
+ anchors.left: parent.left
+ anchors.top: parent.top
+ spacing: ScreenTools.defaultFontPixelHeight
+
+ QGCButton {
+ text: "PX4 Vehicle"
+ onClicked: QGroundControl.startPX4MockLink(sendStatusText.checked)
+ }
+ QGCButton {
+ text: "APM ArduCopter Vehicle"
+ onClicked: QGroundControl.startAPMArduCopterMockLink(sendStatusText.checked)
+ }
+ QGCButton {
+ text: "APM ArduPlane Vehicle"
+ onClicked: QGroundControl.startAPMArduPlaneMockLink(sendStatusText.checked)
+ }
+ QGCButton {
+ text: "Generic Vehicle"
+ onClicked: QGroundControl.startGenericMockLink(sendStatusText.checked)
+ }
+ QGCCheckBox {
+ id: sendStatusText
+ text: "Send status text + voice"
+ }
+ QGCButton {
+ text: "Stop All MockLinks"
+ onClicked: QGroundControl.stopAllMockLinks()
+ }
+ }
+}