Commit d33852c5 authored by dogmaphobic's avatar dogmaphobic

PX4FLOW Sensor Support.

parent a4742fdc
...@@ -271,7 +271,7 @@ HEADERS += \ ...@@ -271,7 +271,7 @@ HEADERS += \
src/ui/uas/UASMessageView.h \ src/ui/uas/UASMessageView.h \
src/MissionItem.h \ src/MissionItem.h \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h \ src/AutoPilotPlugins/PX4/PX4AirframeLoader.h \
src/QGCSettings.h src/QmlControls/QGCImageProvider.h \
WindowsBuild { WindowsBuild {
PRECOMPILED_HEADER += src/stable_headers.h PRECOMPILED_HEADER += src/stable_headers.h
...@@ -383,7 +383,7 @@ SOURCES += \ ...@@ -383,7 +383,7 @@ SOURCES += \
src/ui/uas/UASMessageView.cc \ src/ui/uas/UASMessageView.cc \
src/MissionItem.cc \ src/MissionItem.cc \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc \ src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc \
src/QGCSettings.cpp src/QmlControls/QGCImageProvider.cc \
!iOSBuild { !iOSBuild {
SOURCES += \ SOURCES += \
......
...@@ -6,99 +6,104 @@ ...@@ -6,99 +6,104 @@
<file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file> <file alias="FactSystemTest.qml">src/FactSystem/FactSystemTest.qml</file>
</qresource> </qresource>
<qresource prefix="/qml"> <qresource prefix="/qml">
<file alias="test.qml">src/test.qml</file> <file alias="AirframeComponent.qml">src/AutoPilotPlugins/PX4/AirframeComponent.qml</file>
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file> <file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
<file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file> <file alias="APMAirframeComponent.qml">src/AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="QGroundControl/FactControls/FactPanel.qml">src/FactSystem/FactControls/FactPanel.qml</file> <file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file> <file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file>
<file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file> <file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file>
<file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file> <file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file>
<file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file> <file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file> <file alias="FlightModesComponent.qml">src/AutoPilotPlugins/PX4/FlightModesComponent.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="GeneralSettings.qml">src/ui/preferences/GeneralSettings.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="MainWindowLeftPanel.qml">src/ui/MainWindowLeftPanel.qml</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<file alias="MissionEditorHelp.qml">src/MissionEditor/MissionEditorHelp.qml</file>
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="QGroundControl/Controls/MainToolBarIndicators.qml">src/ui/toolbar/MainToolBarIndicators.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file> <file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file> <file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file> <file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
<file alias="QGroundControl/Controls/QGCComboBox.qml">src/QmlControls/QGCComboBox.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file> <file alias="QGroundControl/Controls/QGCLabel.qml">src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file> <file alias="QGroundControl/Controls/QGCTextField.qml">src/QmlControls/QGCTextField.qml</file>
<file alias="QGroundControl/Controls/QGCComboBox.qml">src/QmlControls/QGCComboBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
<file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file> <file alias="QGroundControl/Controls/QGCToolBarButton.qml">src/QmlControls/QGCToolBarButton.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/IndicatorButton.qml">src/QmlControls/IndicatorButton.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="QGroundControl/Controls/QGCView.qml">src/QmlControls/QGCView.qml</file> <file alias="QGroundControl/Controls/QGCView.qml">src/QmlControls/QGCView.qml</file>
<file alias="QGroundControl/Controls/QGCViewPanel.qml">src/QmlControls/QGCViewPanel.qml</file>
<file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.qml</file> <file alias="QGroundControl/Controls/QGCViewDialog.qml">src/QmlControls/QGCViewDialog.qml</file>
<file alias="QGroundControl/Controls/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file> <file alias="QGroundControl/Controls/QGCViewMessage.qml">src/QmlControls/QGCViewMessage.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file> <file alias="QGroundControl/Controls/QGCViewPanel.qml">src/QmlControls/QGCViewPanel.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file> <file alias="QGroundControl/Controls/qmldir">src/QmlControls/QGroundControl.Controls.qmldir</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemSummary.qml">src/QmlControls/MissionItemSummary.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/RoundButton.qml">src/QmlControls/RoundButton.qml</file> <file alias="QGroundControl/Controls/RoundButton.qml">src/QmlControls/RoundButton.qml</file>
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="MainWindowLeftPanel.qml">src/ui/MainWindowLeftPanel.qml</file>
<file alias="QGroundControl/Controls/MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="QGroundControl/Controls/MainToolBarIndicators.qml">src/ui/toolbar/MainToolBarIndicators.qml</file>
<file alias="QGroundControl/Controls/SignalStrength.qml">src/ui/toolbar/SignalStrength.qml</file> <file alias="QGroundControl/Controls/SignalStrength.qml">src/ui/toolbar/SignalStrength.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file> <file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file> <file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="FirmwareUpgrade.qml">src/VehicleSetup/FirmwareUpgrade.qml</file> <file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="JoystickConfig.qml">src/VehicleSetup/JoystickConfig.qml</file> <file alias="QGroundControl/Controls/ViewWidget.qml">src/ViewWidgets/ViewWidget.qml</file>
<file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file>
<file alias="CustomCommandWidget.qml">src/ViewWidgets/CustomCommandWidget.qml</file> <file alias="QGroundControl/FactControls/FactCheckBox.qml">src/FactSystem/FactControls/FactCheckBox.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file> <file alias="QGroundControl/FactControls/FactComboBox.qml">src/FactSystem/FactControls/FactComboBox.qml</file>
<file alias="RadioComponent.qml">src/AutoPilotPlugins/PX4/RadioComponent.qml</file> <file alias="QGroundControl/FactControls/FactLabel.qml">src/FactSystem/FactControls/FactLabel.qml</file>
<file alias="PowerComponent.qml">src/AutoPilotPlugins/PX4/PowerComponent.qml</file> <file alias="QGroundControl/FactControls/FactPanel.qml">src/FactSystem/FactControls/FactPanel.qml</file>
<file alias="SensorsComponent.qml">src/AutoPilotPlugins/PX4/SensorsComponent.qml</file> <file alias="QGroundControl/FactControls/FactTextField.qml">src/FactSystem/FactControls/FactTextField.qml</file>
<file alias="FlightModesComponent.qml">src/AutoPilotPlugins/PX4/FlightModesComponent.qml</file> <file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file>
<file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>
<file alias="PowerComponentSummary.qml">src/AutoPilotPlugins/PX4/PowerComponentSummary.qml</file>
<file alias="SensorsComponentSummary.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml</file>
<file alias="SensorsComponentSummaryFixedWing.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml</file>
<file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file>
<file alias="FlightModesComponentSummary.qml">src/AutoPilotPlugins/PX4/FlightModesComponentSummary.qml</file>
<file alias="AirframeComponentSummary.qml">src/AutoPilotPlugins/PX4/AirframeComponentSummary.qml</file>
<file alias="AirframeComponent.qml">src/AutoPilotPlugins/PX4/AirframeComponent.qml</file>
<file alias="MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="MissionEditor.qml">src/MissionEditor/MissionEditor.qml</file>
<file alias="MissionEditorHelp.qml">src/MissionEditor/MissionEditorHelp.qml</file>
<file alias="APMAirframeComponent.qml">src/AutoPilotPlugins/APM/APMAirframeComponent.qml</file>
<file alias="APMAirframeComponentSummary.qml">src/AutoPilotPlugins/APM/APMAirframeComponentSummary.qml</file>
<file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file> <file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewMap.qml">src/FlightDisplay/FlightDisplayViewMap.qml</file> <file alias="QGroundControl/FlightDisplay/FlightDisplayViewMap.qml">src/FlightDisplay/FlightDisplayViewMap.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">src/FlightDisplay/FlightDisplayViewVideo.qml</file> <file alias="QGroundControl/FlightDisplay/FlightDisplayViewVideo.qml">src/FlightDisplay/FlightDisplayViewVideo.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewWidgets.qml">src/FlightDisplay/FlightDisplayViewWidgets.qml</file> <file alias="QGroundControl/FlightDisplay/FlightDisplayViewWidgets.qml">src/FlightDisplay/FlightDisplayViewWidgets.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file> <file alias="QGroundControl/FlightDisplay/qmldir">src/FlightDisplay/qmldir</file>
<file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file> <file alias="QGroundControl/FlightMap/FlightMap.qml">src/FlightMap/FlightMap.qml</file>
<file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file> <file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file> <file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeHUD.qml">src/FlightMap/Widgets/QGCAttitudeHUD.qml</file> <file alias="QGroundControl/FlightMap/QGCAttitudeHUD.qml">src/FlightMap/Widgets/QGCAttitudeHUD.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCCompassWidget.qml">src/FlightMap/Widgets/QGCCompassWidget.qml</file> <file alias="QGroundControl/FlightMap/QGCCompassWidget.qml">src/FlightMap/Widgets/QGCCompassWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCInstrumentWidget.qml">src/FlightMap/Widgets/QGCInstrumentWidget.qml</file> <file alias="QGroundControl/FlightMap/QGCInstrumentWidget.qml">src/FlightMap/Widgets/QGCInstrumentWidget.qml</file>
<file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file> <file alias="QGroundControl/FlightMap/QGCPitchIndicator.qml">src/FlightMap/Widgets/QGCPitchIndicator.qml</file>
<file alias="QGroundControl/FlightMap/QGCSlider.qml">src/FlightMap/Widgets/QGCSlider.qml</file> <file alias="QGroundControl/FlightMap/QGCSlider.qml">src/FlightMap/Widgets/QGCSlider.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemIndicator.qml">src/FlightMap/MapItems/MissionItemIndicator.qml</file> <file alias="QGroundControl/FlightMap/QGCVideoBackground.qml">src/FlightMap/QGCVideoBackground.qml</file>
<file alias="QGroundControl/FlightMap/qmldir">src/FlightMap/qmldir</file>
<file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file> <file alias="QGroundControl/FlightMap/VehicleMapItem.qml">src/FlightMap/MapItems/VehicleMapItem.qml</file>
<file alias="QGroundControl/FlightMap/MissionItemView.qml">src/FlightMap/MapItems/MissionItemView.qml</file>
<file alias="QGroundControl/FlightMap/MissionLineView.qml">src/FlightMap/MapItems/MissionLineView.qml</file>
<file alias="DebugWindow.qml">src/ui/preferences/DebugWindow.qml</file> <file alias="QGroundControl/ScreenTools/qmldir">src/QmlControls/QGroundControl.ScreenTools.qmldir</file>
<file alias="MavlinkSettings.qml">src/ui/preferences/MavlinkSettings.qml</file> <file alias="QGroundControl/ScreenTools/ScreenTools.qml">src/QmlControls/ScreenTools.qml</file>
<file alias="GeneralSettings.qml">src/ui/preferences/GeneralSettings.qml</file>
<file alias="QmlTest.qml">src/QmlControls/QmlTest.qml</file>
<file alias="RadioComponent.qml">src/AutoPilotPlugins/PX4/RadioComponent.qml</file>
<file alias="RadioComponentSummary.qml">src/AutoPilotPlugins/PX4/RadioComponentSummary.qml</file>
<file alias="SafetyComponent.qml">src/AutoPilotPlugins/PX4/SafetyComponent.qml</file>
<file alias="SafetyComponentSummary.qml">src/AutoPilotPlugins/PX4/SafetyComponentSummary.qml</file>
<file alias="SensorsComponent.qml">src/AutoPilotPlugins/PX4/SensorsComponent.qml</file>
<file alias="SensorsComponentSummary.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml</file>
<file alias="SensorsComponentSummaryFixedWing.qml">src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml</file>
<file alias="SetupParameterEditor.qml">src/VehicleSetup/SetupParameterEditor.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
<file alias="test.qml">src/test.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
</qresource> </qresource>
</RCC> </RCC>
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
...@@ -30,7 +30,7 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(const QString& title, QAction* action, QW ...@@ -30,7 +30,7 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(const QString& title, QAction* action, QW
QGCDockWidget(title, action, parent) QGCDockWidget(title, action, parent)
{ {
_ui.setupUi(this); _ui.setupUi(this);
layout()->setContentsMargins(0,0,0,0); layout()->setContentsMargins(0,0,0,0);
if (action) { if (action) {
...@@ -69,6 +69,12 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void) ...@@ -69,6 +69,12 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
return _ui.qmlWidget->rootObject(); return _ui.qmlWidget->rootObject();
} }
QQmlEngine* QGCQmlWidgetHolder::getEngine()
{
return _ui.qmlWidget->engine();
}
void QGCQmlWidgetHolder::setResizeMode(QQuickWidget::ResizeMode resizeMode) void QGCQmlWidgetHolder::setResizeMode(QQuickWidget::ResizeMode resizeMode)
{ {
_ui.qmlWidget->setResizeMode(resizeMode); _ui.qmlWidget->setResizeMode(resizeMode);
......
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
#ifndef QGCQmlWidgetHolder_h #ifndef QGCQmlWidgetHolder_h
...@@ -49,7 +49,7 @@ public: ...@@ -49,7 +49,7 @@ public:
// action = NULL // action = NULL
explicit QGCQmlWidgetHolder(const QString& title, QAction* action, QWidget *parent = 0); explicit QGCQmlWidgetHolder(const QString& title, QAction* action, QWidget *parent = 0);
~QGCQmlWidgetHolder(); ~QGCQmlWidgetHolder();
/// Sets the UAS into the widget which in turn will load facts into the context /// Sets the UAS into the widget which in turn will load facts into the context
void setAutoPilot(AutoPilotPlugin* autoPilot); void setAutoPilot(AutoPilotPlugin* autoPilot);
...@@ -58,13 +58,16 @@ public: ...@@ -58,13 +58,16 @@ public:
/// Get Root Object /// Get Root Object
QQuickItem* getRootObject(void); QQuickItem* getRootObject(void);
/// Get QML Engine
QQmlEngine* getEngine();
/// Sets the QML into the control. Will display errors message box if error occurs loading source. /// Sets the QML into the control. Will display errors message box if error occurs loading source.
/// @return true: source loaded, false: source not loaded, errors occured /// @return true: source loaded, false: source not loaded, errors occured
bool setSource(const QUrl& qmlUrl); bool setSource(const QUrl& qmlUrl);
void setContextPropertyObject(const QString& name, QObject* object); void setContextPropertyObject(const QString& name, QObject* object);
/// Sets the resize mode for the QQuickWidget container /// Sets the resize mode for the QQuickWidget container
void setResizeMode(QQuickWidget::ResizeMode resizeMode); void setResizeMode(QQuickWidget::ResizeMode resizeMode);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "AutoPilotPluginManager.h" #include "AutoPilotPluginManager.h"
#include "UASMessageHandler.h" #include "UASMessageHandler.h"
#include "FactSystem.h" #include "FactSystem.h"
#include "QGCImageProvider.h"
QGCToolbox::QGCToolbox(QGCApplication* app) QGCToolbox::QGCToolbox(QGCApplication* app)
: _firmwarePluginManager(NULL) : _firmwarePluginManager(NULL)
...@@ -45,6 +46,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app) ...@@ -45,6 +46,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
, _audioOutput(NULL) , _audioOutput(NULL)
, _uasMessageHandler(NULL) , _uasMessageHandler(NULL)
, _factSystem(NULL) , _factSystem(NULL)
, _imageProvider(NULL)
{ {
_firmwarePluginManager = new FirmwarePluginManager(app); _firmwarePluginManager = new FirmwarePluginManager(app);
_autopilotPluginManager = new AutoPilotPluginManager(app); _autopilotPluginManager = new AutoPilotPluginManager(app);
...@@ -57,6 +59,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app) ...@@ -57,6 +59,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_joystickManager = new JoystickManager(app); _joystickManager = new JoystickManager(app);
_audioOutput = new GAudioOutput(app); _audioOutput = new GAudioOutput(app);
_uasMessageHandler = new UASMessageHandler(app); _uasMessageHandler = new UASMessageHandler(app);
_imageProvider = new QGCImageProvider(app);
_firmwarePluginManager->setToolbox(this); _firmwarePluginManager->setToolbox(this);
_autopilotPluginManager->setToolbox(this); _autopilotPluginManager->setToolbox(this);
...@@ -69,6 +72,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app) ...@@ -69,6 +72,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_joystickManager->setToolbox(this); _joystickManager->setToolbox(this);
_audioOutput->setToolbox(this); _audioOutput->setToolbox(this);
_uasMessageHandler->setToolbox(this); _uasMessageHandler->setToolbox(this);
_imageProvider->setToolbox(this);
} }
QGCToolbox::~QGCToolbox() QGCToolbox::~QGCToolbox()
......
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
#ifndef QGCToolbox_h #ifndef QGCToolbox_h
...@@ -38,6 +38,7 @@ class GAudioOutput; ...@@ -38,6 +38,7 @@ class GAudioOutput;
class FirmwarePluginManager; class FirmwarePluginManager;
class AutoPilotPluginManager; class AutoPilotPluginManager;
class FactSystem; class FactSystem;
class QGCImageProvider;
/// 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 { class QGCToolbox {
...@@ -46,29 +47,31 @@ public: ...@@ -46,29 +47,31 @@ public:
QGCToolbox(QGCApplication* app); QGCToolbox(QGCApplication* app);
~QGCToolbox(); ~QGCToolbox();
LinkManager* linkManager(void) { return _linkManager; } LinkManager* linkManager(void) { return _linkManager; }
MAVLinkProtocol* mavlinkProtocol(void) { return _mavlinkProtocol; } MAVLinkProtocol* mavlinkProtocol(void) { return _mavlinkProtocol; }
MultiVehicleManager* multiVehicleManager(void) { return _multiVehicleManager; } MultiVehicleManager* multiVehicleManager(void) { return _multiVehicleManager; }
JoystickManager* joystickManager(void) { return _joystickManager; } JoystickManager* joystickManager(void) { return _joystickManager; }
UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; } UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; }
HomePositionManager* homePositionManager(void) { return _homePositionManager; } HomePositionManager* homePositionManager(void) { return _homePositionManager; }
FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; } FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; }
GAudioOutput* audioOutput(void) { return _audioOutput; } GAudioOutput* audioOutput(void) { return _audioOutput; }
FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; } FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; }
AutoPilotPluginManager* autopilotPluginManager(void) { return _autopilotPluginManager; } AutoPilotPluginManager* autopilotPluginManager(void) { return _autopilotPluginManager; }
QGCImageProvider* imageProvider() { return _imageProvider; }
private: private:
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager;
AutoPilotPluginManager* _autopilotPluginManager; AutoPilotPluginManager* _autopilotPluginManager;
LinkManager* _linkManager; LinkManager* _linkManager;
MultiVehicleManager* _multiVehicleManager; MultiVehicleManager* _multiVehicleManager;
MAVLinkProtocol* _mavlinkProtocol; MAVLinkProtocol* _mavlinkProtocol;
FlightMapSettings* _flightMapSettings; FlightMapSettings* _flightMapSettings;
HomePositionManager* _homePositionManager; HomePositionManager* _homePositionManager;
JoystickManager* _joystickManager; JoystickManager* _joystickManager;
GAudioOutput* _audioOutput; GAudioOutput* _audioOutput;
UASMessageHandler* _uasMessageHandler; UASMessageHandler* _uasMessageHandler;
FactSystem* _factSystem; FactSystem* _factSystem;
QGCImageProvider* _imageProvider;
}; };
/// This is the base class for all tools /// This is the base class for all tools
......
...@@ -23,17 +23,75 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. ...@@ -23,17 +23,75 @@ along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
/** /**
* @file * @file
* @brief Implementation of class QGCSettings * @brief Image Provider
* *
* @author Gus Grubba <mavlink@grubba.com> * @author Gus Grubba <mavlink@grubba.com>
* *
*/ */
#include "QGCSettings.h" #include "QGCImageProvider.h"
QGCSettings::QGCSettings(QObject *parent) : QObject(parent) #include <QPainter>
#include <qFont>
QGCImageProvider::QGCImageProvider(QGCApplication *app)
: QGCTool(app)
, QQuickImageProvider(QQmlImageProviderBase::Image)
{
}
QGCImageProvider::~QGCImageProvider()
{
}
void QGCImageProvider::setToolbox(QGCToolbox *toolbox)
{ {
QGCTool::setToolbox(toolbox);
//-- Dummy temporary image until something comes along
_pImage = QImage(320, 240, QImage::Format_RGBA8888);
_pImage.fill(Qt::black);
QPainter painter(&_pImage);
QFont f = painter.font();
f.setPixelSize(20);
painter.setFont(f);
painter.setPen(Qt::white);
painter.drawText(QRectF(0, 0, 320, 240), Qt::AlignCenter, "Waiting...");
}
QImage QGCImageProvider::requestImage(const QString & /* image url with vehicle id*/, QSize *, const QSize &)
{
/*
The QML side will request an image using a special URL, which we've registered as QGCImages.
The URL follows this format (or anything you want to make out of it after the "QGCImages" part):
"image://QGCImages/vvv/iii"
Where:
vvv: Some vehicle id
iii: An auto incremented index (which forces the Item to reload the image)
The image index is incremented each time a new image arrives. A signal is emitted and the QML side
updates its contents automatically.
Image {
source: "image://QGCImages/" + _activeVehicle.id + "/" + _activeVehicle.flowImageIndex
width: parent.width * 0.5
height: width * 0.75
cache: false
anchors.centerIn: parent
fillMode: Image.PreserveAspectFit
}
For now, we don't even look at the URL. This will have to be fixed if we're to support multiple
vehicles transmitting flow images.
*/
return _pImage;
}
void QGCImageProvider::setImage(QImage* pImage, int /* vehicle id*/)
{
_pImage = pImage->mirrored();
} }
...@@ -23,28 +23,37 @@ ...@@ -23,28 +23,37 @@
/** /**
* @file * @file
* @brief Definition of main class * @brief Image Provider
* *
* @author Gus Grubba <mavlink@grubba.com> * @author Gus Grubba <mavlink@grubba.com>
* *
*/ */
#ifndef QGCSETTINGS_H #ifndef QGCIMAGEPROVIDER_H
#define QGCSETTINGS_H #define QGCIMAGEPROVIDER_H
#include <QObject> #include <QObject>
#include <QQmlListProperty>
#include <QQuickImageProvider>
class QGCSettings : public QObject #include "QGCToolbox.h"
class QGCImageProvider : public QGCTool, public QQuickImageProvider
{ {
Q_OBJECT
public: public:
explicit QGCSettings(QObject *parent = 0); QGCImageProvider (QGCApplication* app);
~QGCImageProvider ();
signals: QImage requestImage (const QString & id, QSize * size, const QSize & requestedSize);
void setImage (QImage* pImage, int id = 0);
public slots: void setToolbox (QGCToolbox *toolbox);
private:
//-- TODO: For now this is holding a single image. If you happen to have two
// or more vehicles with flow, it will not work. To properly manage that condition
// this should be a map between each vehicle and its image. The URL provided
// for the image request would contain the vehicle identification.
QImage _pImage;
}; };
#endif // QGCSETTINGS_H
#endif // QGCIMAGEPROVIDER_H
...@@ -39,6 +39,7 @@ Button { ...@@ -39,6 +39,7 @@ Button {
verticalAlignment: TextEdit.AlignVCenter verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter horizontalAlignment: TextEdit.AlignHCenter
color: showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText color: showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
font.pixelSize: ScreenTools.isMobile ? ScreenTools.defaultFontPixelSize * 0.65 : ScreenTools.defaultFontPixelSize
text: control.text text: control.text
Rectangle { Rectangle {
......
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
...@@ -56,6 +56,7 @@ void MultiVehicleManager::setToolbox(QGCToolbox *toolbox) ...@@ -56,6 +56,7 @@ void MultiVehicleManager::setToolbox(QGCToolbox *toolbox)
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<MultiVehicleManager>("QGroundControl.MultiVehicleManager", 1, 0, "MultiVehicleManager", "Reference only"); qmlRegisterUncreatableType<MultiVehicleManager>("QGroundControl.MultiVehicleManager", 1, 0, "MultiVehicleManager", "Reference only");
} }
bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId, mavlink_heartbeat_t& heartbeat) bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId, mavlink_heartbeat_t& heartbeat)
...@@ -64,7 +65,7 @@ bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId ...@@ -64,7 +65,7 @@ bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId
if (vehicleId == _mavlinkProtocol->getSystemId()) { if (vehicleId == _mavlinkProtocol->getSystemId()) {
_app->showToolBarMessage(QString("Warning: A vehicle is using the same system id as QGroundControl: %1").arg(vehicleId)); _app->showToolBarMessage(QString("Warning: A vehicle is using the same system id as QGroundControl: %1").arg(vehicleId));
} }
QSettings settings; QSettings settings;
bool mavlinkVersionCheck = settings.value("VERSION_CHECK_ENABLED", true).toBool(); bool mavlinkVersionCheck = settings.value("VERSION_CHECK_ENABLED", true).toBool();
if (mavlinkVersionCheck && heartbeat.mavlink_version != MAVLINK_VERSION) { if (mavlinkVersionCheck && heartbeat.mavlink_version != MAVLINK_VERSION) {
...@@ -74,24 +75,24 @@ bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId ...@@ -74,24 +75,24 @@ bool MultiVehicleManager::notifyHeartbeatInfo(LinkInterface* link, int vehicleId
"QGroundControl therefore refuses to connect to vehicle #%1, which sends MAVLink version %2 (QGroundControl uses version %3).").arg(vehicleId).arg(heartbeat.mavlink_version).arg(MAVLINK_VERSION)); "QGroundControl therefore refuses to connect to vehicle #%1, which sends MAVLink version %2 (QGroundControl uses version %3).").arg(vehicleId).arg(heartbeat.mavlink_version).arg(MAVLINK_VERSION));
return false; return false;
} }
Vehicle* vehicle = new Vehicle(link, vehicleId, (MAV_AUTOPILOT)heartbeat.autopilot, (MAV_TYPE)heartbeat.type, _firmwarePluginManager, _autopilotPluginManager, _joystickManager); Vehicle* vehicle = new Vehicle(link, vehicleId, (MAV_AUTOPILOT)heartbeat.autopilot, (MAV_TYPE)heartbeat.type, _firmwarePluginManager, _autopilotPluginManager, _joystickManager);
if (!vehicle) { if (!vehicle) {
qWarning() << "New Vehicle allocation failed"; qWarning() << "New Vehicle allocation failed";
return false; return false;
} }
connect(vehicle, &Vehicle::allLinksDisconnected, this, &MultiVehicleManager::_deleteVehiclePhase1); connect(vehicle, &Vehicle::allLinksDisconnected, this, &MultiVehicleManager::_deleteVehiclePhase1);
connect(vehicle->autopilotPlugin(), &AutoPilotPlugin::parametersReadyChanged, this, &MultiVehicleManager::_autopilotParametersReadyChanged); connect(vehicle->autopilotPlugin(), &AutoPilotPlugin::parametersReadyChanged, this, &MultiVehicleManager::_autopilotParametersReadyChanged);
_vehicles.append(vehicle); _vehicles.append(vehicle);
emit vehicleAdded(vehicle); emit vehicleAdded(vehicle);
setActiveVehicle(vehicle); setActiveVehicle(vehicle);
} }
return true; return true;
} }
...@@ -115,17 +116,17 @@ void MultiVehicleManager::_deleteVehiclePhase1(Vehicle* vehicle) ...@@ -115,17 +116,17 @@ void MultiVehicleManager::_deleteVehiclePhase1(Vehicle* vehicle)
if (!found) { if (!found) {
qWarning() << "Vehicle not found in map!"; qWarning() << "Vehicle not found in map!";
} }
vehicle->setActive(false); vehicle->setActive(false);
vehicle->uas()->clearVehicle(); vehicle->uas()->clearVehicle();
// First we must signal that a vehicle is no longer available. // First we must signal that a vehicle is no longer available.
_activeVehicleAvailable = false; _activeVehicleAvailable = false;
_parameterReadyVehicleAvailable = false; _parameterReadyVehicleAvailable = false;
emit activeVehicleAvailableChanged(false); emit activeVehicleAvailableChanged(false);
emit parameterReadyVehicleAvailableChanged(false); emit parameterReadyVehicleAvailableChanged(false);
emit vehicleRemoved(vehicle); emit vehicleRemoved(vehicle);
// We must let the above signals flow through the system as well as get back to the main loop event queue // We must let the above signals flow through the system as well as get back to the main loop event queue
// before we can actually delete the Vehicle. The reason is that Qml may be holding on the references to it. // before we can actually delete the Vehicle. The reason is that Qml may be holding on the references to it.
// Even though the above signals should unload any Qml which has references, that Qml will not be destroyed // Even though the above signals should unload any Qml which has references, that Qml will not be destroyed
...@@ -141,15 +142,15 @@ void MultiVehicleManager::_deleteVehiclePhase2 (void) ...@@ -141,15 +142,15 @@ void MultiVehicleManager::_deleteVehiclePhase2 (void)
/// Qml has been notified of vehicle about to go away and should be disconnected from it by now. /// Qml has been notified of vehicle about to go away and should be disconnected from it by now.
/// This means we can now clear the active vehicle property and delete the Vehicle for real. /// This means we can now clear the active vehicle property and delete the Vehicle for real.
Vehicle* newActiveVehicle = NULL; Vehicle* newActiveVehicle = NULL;
if (_vehicles.count()) { if (_vehicles.count()) {
newActiveVehicle = qobject_cast<Vehicle*>(_vehicles[0]); newActiveVehicle = qobject_cast<Vehicle*>(_vehicles[0]);
} }
_activeVehicle = newActiveVehicle; _activeVehicle = newActiveVehicle;
emit activeVehicleChanged(newActiveVehicle); emit activeVehicleChanged(newActiveVehicle);
if (_activeVehicle) { if (_activeVehicle) {
_activeVehicle->setActive(true); _activeVehicle->setActive(true);
emit activeVehicleAvailableChanged(true); emit activeVehicleAvailableChanged(true);
...@@ -157,7 +158,7 @@ void MultiVehicleManager::_deleteVehiclePhase2 (void) ...@@ -157,7 +158,7 @@ void MultiVehicleManager::_deleteVehiclePhase2 (void)
emit parameterReadyVehicleAvailableChanged(true); emit parameterReadyVehicleAvailableChanged(true);
} }
} }
_vehicleBeingDeleted->deleteLater(); _vehicleBeingDeleted->deleteLater();
} }
...@@ -168,10 +169,10 @@ void MultiVehicleManager::setActiveVehicle(Vehicle* vehicle) ...@@ -168,10 +169,10 @@ void MultiVehicleManager::setActiveVehicle(Vehicle* vehicle)
if (vehicle != _activeVehicle) { if (vehicle != _activeVehicle) {
if (_activeVehicle) { if (_activeVehicle) {
_activeVehicle->setActive(false); _activeVehicle->setActive(false);
// The sequence of signals is very important in order to not leave Qml elements connected // The sequence of signals is very important in order to not leave Qml elements connected
// to a non-existent vehicle. // to a non-existent vehicle.
// First we must signal that there is no active vehicle available. This will disconnect // First we must signal that there is no active vehicle available. This will disconnect
// any existing ui from the currently active vehicle. // any existing ui from the currently active vehicle.
_activeVehicleAvailable = false; _activeVehicleAvailable = false;
...@@ -179,7 +180,7 @@ void MultiVehicleManager::setActiveVehicle(Vehicle* vehicle) ...@@ -179,7 +180,7 @@ void MultiVehicleManager::setActiveVehicle(Vehicle* vehicle)
emit activeVehicleAvailableChanged(false); emit activeVehicleAvailableChanged(false);
emit parameterReadyVehicleAvailableChanged(false); emit parameterReadyVehicleAvailableChanged(false);
} }
// See explanation in _deleteVehiclePhase1 // See explanation in _deleteVehiclePhase1
_vehicleBeingSetActive = vehicle; _vehicleBeingSetActive = vehicle;
QTimer::singleShot(20, this, &MultiVehicleManager::_setActiveVehiclePhase2); QTimer::singleShot(20, this, &MultiVehicleManager::_setActiveVehiclePhase2);
...@@ -193,13 +194,13 @@ void MultiVehicleManager::_setActiveVehiclePhase2(void) ...@@ -193,13 +194,13 @@ void MultiVehicleManager::_setActiveVehiclePhase2(void)
// Now we signal the new active vehicle // Now we signal the new active vehicle
_activeVehicle = _vehicleBeingSetActive; _activeVehicle = _vehicleBeingSetActive;
emit activeVehicleChanged(_activeVehicle); emit activeVehicleChanged(_activeVehicle);
// And finally vehicle availability // And finally vehicle availability
if (_activeVehicle) { if (_activeVehicle) {
_activeVehicle->setActive(true); _activeVehicle->setActive(true);
_activeVehicleAvailable = true; _activeVehicleAvailable = true;
emit activeVehicleAvailableChanged(true); emit activeVehicleAvailableChanged(true);
if (_activeVehicle->autopilotPlugin()->parametersReady()) { if (_activeVehicle->autopilotPlugin()->parametersReady()) {
_parameterReadyVehicleAvailable = true; _parameterReadyVehicleAvailable = true;
emit parameterReadyVehicleAvailableChanged(true); emit parameterReadyVehicleAvailableChanged(true);
...@@ -210,12 +211,12 @@ void MultiVehicleManager::_setActiveVehiclePhase2(void) ...@@ -210,12 +211,12 @@ void MultiVehicleManager::_setActiveVehiclePhase2(void)
void MultiVehicleManager::_autopilotParametersReadyChanged(bool parametersReady) void MultiVehicleManager::_autopilotParametersReadyChanged(bool parametersReady)
{ {
AutoPilotPlugin* autopilot = dynamic_cast<AutoPilotPlugin*>(sender()); AutoPilotPlugin* autopilot = dynamic_cast<AutoPilotPlugin*>(sender());
if (!autopilot) { if (!autopilot) {
qWarning() << "Dynamic cast failed!"; qWarning() << "Dynamic cast failed!";
return; return;
} }
if (autopilot->vehicle() == _activeVehicle) { if (autopilot->vehicle() == _activeVehicle) {
_parameterReadyVehicleAvailable = parametersReady; _parameterReadyVehicleAvailable = parametersReady;
emit parameterReadyVehicleAvailableChanged(parametersReady); emit parameterReadyVehicleAvailableChanged(parametersReady);
...@@ -249,10 +250,12 @@ Vehicle* MultiVehicleManager::getVehicleById(int vehicleId) ...@@ -249,10 +250,12 @@ Vehicle* MultiVehicleManager::getVehicleById(int vehicleId)
QList<Vehicle*> MultiVehicleManager::vehicles(void) QList<Vehicle*> MultiVehicleManager::vehicles(void)
{ {
QList<Vehicle*> list; QList<Vehicle*> list;
for (int i=0; i< _vehicles.count(); i++) { for (int i=0; i< _vehicles.count(); i++) {
list += qobject_cast<Vehicle*>(_vehicles[i]); list += qobject_cast<Vehicle*>(_vehicles[i]);
} }
return list; return list;
} }
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
...@@ -44,20 +44,20 @@ Q_DECLARE_LOGGING_CATEGORY(MultiVehicleManagerLog) ...@@ -44,20 +44,20 @@ Q_DECLARE_LOGGING_CATEGORY(MultiVehicleManagerLog)
class MultiVehicleManager : public QGCTool class MultiVehicleManager : public QGCTool
{ {
Q_OBJECT Q_OBJECT
public: public:
MultiVehicleManager(QGCApplication* app); MultiVehicleManager(QGCApplication* app);
Q_INVOKABLE void saveSetting (const QString &key, const QString& value); Q_INVOKABLE void saveSetting (const QString &key, const QString& value);
Q_INVOKABLE QString loadSetting (const QString &key, const QString& defaultValue); Q_INVOKABLE QString loadSetting (const QString &key, const QString& defaultValue);
Q_PROPERTY(bool activeVehicleAvailable READ activeVehicleAvailable NOTIFY activeVehicleAvailableChanged) Q_PROPERTY(bool activeVehicleAvailable READ activeVehicleAvailable NOTIFY activeVehicleAvailableChanged)
Q_PROPERTY(bool parameterReadyVehicleAvailable READ parameterReadyVehicleAvailable NOTIFY parameterReadyVehicleAvailableChanged) Q_PROPERTY(bool parameterReadyVehicleAvailable READ parameterReadyVehicleAvailable NOTIFY parameterReadyVehicleAvailableChanged)
Q_PROPERTY(Vehicle* activeVehicle READ activeVehicle WRITE setActiveVehicle NOTIFY activeVehicleChanged) Q_PROPERTY(Vehicle* activeVehicle READ activeVehicle WRITE setActiveVehicle NOTIFY activeVehicleChanged)
Q_PROPERTY(QmlObjectListModel* vehicles READ vehiclesModel CONSTANT) Q_PROPERTY(QmlObjectListModel* vehicles READ vehiclesModel CONSTANT)
// Methods // Methods
/// Called to notify that a heartbeat was received with the specified information. MultiVehicleManager /// Called to notify that a heartbeat was received with the specified information. MultiVehicleManager
/// will create/update Vehicles as necessary. /// will create/update Vehicles as necessary.
/// @param link Heartbeat came through on this link /// @param link Heartbeat came through on this link
...@@ -65,24 +65,24 @@ public: ...@@ -65,24 +65,24 @@ public:
/// @param heartbeat Mavlink heartbeat message /// @param heartbeat Mavlink heartbeat message
/// @return true: continue further processing of this message, false: disregard this message /// @return true: continue further processing of this message, false: disregard this message
bool notifyHeartbeatInfo(LinkInterface* link, int vehicleId, mavlink_heartbeat_t& heartbeat); bool notifyHeartbeatInfo(LinkInterface* link, int vehicleId, mavlink_heartbeat_t& heartbeat);
Q_INVOKABLE Vehicle* getVehicleById(int vehicleId); Q_INVOKABLE Vehicle* getVehicleById(int vehicleId);
UAS* activeUas(void) { return _activeVehicle ? _activeVehicle->uas() : NULL; } UAS* activeUas(void) { return _activeVehicle ? _activeVehicle->uas() : NULL; }
QList<Vehicle*> vehicles(void); QList<Vehicle*> vehicles(void);
// Property accessors // Property accessors
bool activeVehicleAvailable(void) { return _activeVehicleAvailable; } bool activeVehicleAvailable(void) { return _activeVehicleAvailable; }
bool parameterReadyVehicleAvailable(void) { return _parameterReadyVehicleAvailable; } bool parameterReadyVehicleAvailable(void) { return _parameterReadyVehicleAvailable; }
Vehicle* activeVehicle(void) { return _activeVehicle; } Vehicle* activeVehicle(void) { return _activeVehicle; }
void setActiveVehicle(Vehicle* vehicle); void setActiveVehicle(Vehicle* vehicle);
QmlObjectListModel* vehiclesModel(void) { return &_vehicles; } QmlObjectListModel* vehiclesModel(void) { return &_vehicles; }
// Override from QGCTool // Override from QGCTool
virtual void setToolbox(QGCToolbox *toolbox); virtual void setToolbox(QGCToolbox *toolbox);
...@@ -92,33 +92,34 @@ signals: ...@@ -92,33 +92,34 @@ signals:
void activeVehicleAvailableChanged(bool activeVehicleAvailable); void activeVehicleAvailableChanged(bool activeVehicleAvailable);
void parameterReadyVehicleAvailableChanged(bool parameterReadyVehicleAvailable); void parameterReadyVehicleAvailableChanged(bool parameterReadyVehicleAvailable);
void activeVehicleChanged(Vehicle* activeVehicle); void activeVehicleChanged(Vehicle* activeVehicle);
void _deleteVehiclePhase2Signal(void); void _deleteVehiclePhase2Signal(void);
private slots: private slots:
void _deleteVehiclePhase1(Vehicle* vehicle); void _deleteVehiclePhase1(Vehicle* vehicle);
void _deleteVehiclePhase2(void); void _deleteVehiclePhase2(void);
void _setActiveVehiclePhase2(void); void _setActiveVehiclePhase2(void);
void _autopilotParametersReadyChanged(bool parametersReady); void _autopilotParametersReadyChanged(bool parametersReady);
private: private:
bool _vehicleExists(int vehicleId); bool _vehicleExists(int vehicleId);
bool _activeVehicleAvailable; ///< true: An active vehicle is available bool _activeVehicleAvailable; ///< true: An active vehicle is available
bool _parameterReadyVehicleAvailable; ///< true: An active vehicle with ready parameters is available bool _parameterReadyVehicleAvailable; ///< true: An active vehicle with ready parameters is available
Vehicle* _activeVehicle; ///< Currently active vehicle from a ui perspective Vehicle* _activeVehicle; ///< Currently active vehicle from a ui perspective
Vehicle* _vehicleBeingDeleted; ///< Vehicle being deleted in queued phases Vehicle* _vehicleBeingDeleted; ///< Vehicle being deleted in queued phases
Vehicle* _vehicleBeingSetActive; ///< Vehicle being set active in queued phases Vehicle* _vehicleBeingSetActive; ///< Vehicle being set active in queued phases
QList<int> _ignoreVehicleIds; ///< List of vehicle id for which we ignore further communication QList<int> _ignoreVehicleIds; ///< List of vehicle id for which we ignore further communication
QmlObjectListModel _vehicles; QmlObjectListModel _vehicles;
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager;
AutoPilotPluginManager* _autopilotPluginManager; AutoPilotPluginManager* _autopilotPluginManager;
JoystickManager* _joystickManager; JoystickManager* _joystickManager;
MAVLinkProtocol* _mavlinkProtocol; MAVLinkProtocol* _mavlinkProtocol;
}; };
#endif #endif
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
#include "Vehicle.h" #include "Vehicle.h"
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "CoordinateVector.h" #include "CoordinateVector.h"
#include "ParameterLoader.h" #include "ParameterLoader.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCImageProvider.h"
QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog") QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog")
...@@ -104,25 +105,27 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -104,25 +105,27 @@ Vehicle::Vehicle(LinkInterface* link,
, _firmwarePluginManager(firmwarePluginManager) , _firmwarePluginManager(firmwarePluginManager)
, _autopilotPluginManager(autopilotPluginManager) , _autopilotPluginManager(autopilotPluginManager)
, _joystickManager(joystickManager) , _joystickManager(joystickManager)
, _flowImageIndex(0)
{ {
_addLink(link); _addLink(link);
_mavlink = qgcApp()->toolbox()->mavlinkProtocol(); _mavlink = qgcApp()->toolbox()->mavlinkProtocol();
connect(_mavlink, &MAVLinkProtocol::messageReceived, this, &Vehicle::_mavlinkMessageReceived); connect(_mavlink, &MAVLinkProtocol::messageReceived, this, &Vehicle::_mavlinkMessageReceived);
connect(this, &Vehicle::_sendMessageOnThread, this, &Vehicle::_sendMessage, Qt::QueuedConnection); connect(this, &Vehicle::_sendMessageOnThread, this, &Vehicle::_sendMessage, Qt::QueuedConnection);
_uas = new UAS(_mavlink, this, _firmwarePluginManager); _uas = new UAS(_mavlink, this, _firmwarePluginManager);
setLatitude(_uas->getLatitude()); setLatitude(_uas->getLatitude());
setLongitude(_uas->getLongitude()); setLongitude(_uas->getLongitude());
connect(_uas, &UAS::latitudeChanged, this, &Vehicle::setLatitude); connect(_uas, &UAS::latitudeChanged, this, &Vehicle::setLatitude);
connect(_uas, &UAS::longitudeChanged, this, &Vehicle::setLongitude); connect(_uas, &UAS::longitudeChanged, this, &Vehicle::setLongitude);
connect(_uas, &UAS::imageReady, this, &Vehicle::_imageReady);
_firmwarePlugin = _firmwarePluginManager->firmwarePluginForAutopilot(_firmwareType, _vehicleType);
_autopilotPlugin = _autopilotPluginManager->newAutopilotPluginForVehicle(this); _firmwarePlugin = _firmwarePluginManager->firmwarePluginForAutopilot(_firmwareType, _vehicleType);
_autopilotPlugin = _autopilotPluginManager->newAutopilotPluginForVehicle(this);
connect(_autopilotPlugin, &AutoPilotPlugin::parametersReadyChanged, this, &Vehicle::_parametersReady); connect(_autopilotPlugin, &AutoPilotPlugin::parametersReadyChanged, this, &Vehicle::_parametersReady);
connect(_autopilotPlugin, &AutoPilotPlugin::missingParametersChanged, this, &Vehicle::missingParametersChanged); connect(_autopilotPlugin, &AutoPilotPlugin::missingParametersChanged, this, &Vehicle::missingParametersChanged);
...@@ -131,7 +134,7 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -131,7 +134,7 @@ Vehicle::Vehicle(LinkInterface* link,
_refreshTimer->setInterval(UPDATE_TIMER); _refreshTimer->setInterval(UPDATE_TIMER);
_refreshTimer->start(UPDATE_TIMER); _refreshTimer->start(UPDATE_TIMER);
emit heartbeatTimeoutChanged(); emit heartbeatTimeoutChanged();
_mav = uas(); _mav = uas();
// Reset satellite count (no GPS) // Reset satellite count (no GPS)
_satelliteCount = -1; _satelliteCount = -1;
...@@ -158,9 +161,9 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -158,9 +161,9 @@ Vehicle::Vehicle(LinkInterface* link,
_setSatelliteCount(pUas->getSatelliteCount(), QString("")); _setSatelliteCount(pUas->getSatelliteCount(), QString(""));
connect(pUas, &UAS::satelliteCountChanged, this, &Vehicle::_setSatelliteCount); connect(pUas, &UAS::satelliteCountChanged, this, &Vehicle::_setSatelliteCount);
} }
_loadSettings(); _loadSettings();
_missionManager = new MissionManager(this); _missionManager = new MissionManager(this);
connect(_missionManager, &MissionManager::error, this, &Vehicle::_missionManagerError); connect(_missionManager, &MissionManager::error, this, &Vehicle::_missionManagerError);
...@@ -169,10 +172,10 @@ Vehicle::Vehicle(LinkInterface* link, ...@@ -169,10 +172,10 @@ Vehicle::Vehicle(LinkInterface* link,
connect(_parameterLoader, SIGNAL(parameterListProgress(float)), _autopilotPlugin, SIGNAL(parameterListProgress(float))); connect(_parameterLoader, SIGNAL(parameterListProgress(float)), _autopilotPlugin, SIGNAL(parameterListProgress(float)));
_firmwarePlugin->initializeVehicle(this); _firmwarePlugin->initializeVehicle(this);
_sendMultipleTimer.start(_sendMessageMultipleIntraMessageDelay); _sendMultipleTimer.start(_sendMessageMultipleIntraMessageDelay);
connect(&_sendMultipleTimer, &QTimer::timeout, this, &Vehicle::_sendMessageMultipleNext); connect(&_sendMultipleTimer, &QTimer::timeout, this, &Vehicle::_sendMessageMultipleNext);
_mapTrajectoryTimer.setInterval(_mapTrajectoryMsecsBetweenPoints); _mapTrajectoryTimer.setInterval(_mapTrajectoryMsecsBetweenPoints);
connect(&_mapTrajectoryTimer, &QTimer::timeout, this, &Vehicle::_addNewMapTrajectoryPoint); connect(&_mapTrajectoryTimer, &QTimer::timeout, this, &Vehicle::_addNewMapTrajectoryPoint);
...@@ -191,6 +194,7 @@ Vehicle::~Vehicle() ...@@ -191,6 +194,7 @@ Vehicle::~Vehicle()
delete _mav; delete _mav;
_mav = NULL; _mav = NULL;
} }
void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message) void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message)
...@@ -200,14 +204,14 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes ...@@ -200,14 +204,14 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
} }
_communicationInactivityTimer.start(); _communicationInactivityTimer.start();
if (!_containsLink(link)) { if (!_containsLink(link)) {
_addLink(link); _addLink(link);
} }
// Give the plugin a change to adjust the message contents // Give the plugin a change to adjust the message contents
_firmwarePlugin->adjustMavlinkMessage(&message); _firmwarePlugin->adjustMavlinkMessage(&message);
switch (message.msgid) { switch (message.msgid) {
case MAVLINK_MSG_ID_HOME_POSITION: case MAVLINK_MSG_ID_HOME_POSITION:
_handleHomePosition(message); _handleHomePosition(message);
...@@ -216,9 +220,9 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes ...@@ -216,9 +220,9 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
_handleHeartbeat(message); _handleHeartbeat(message);
break; break;
} }
emit mavlinkMessageReceived(message); emit mavlinkMessageReceived(message);
_uas->receiveMessage(message); _uas->receiveMessage(message);
} }
...@@ -228,7 +232,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message) ...@@ -228,7 +232,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message)
bool emitHomePositionAvailableChanged = false; bool emitHomePositionAvailableChanged = false;
mavlink_home_position_t homePos; mavlink_home_position_t homePos;
mavlink_msg_home_position_decode(&message, &homePos); mavlink_msg_home_position_decode(&message, &homePos);
QGeoCoordinate newHomePosition (homePos.latitude / 10000000.0, QGeoCoordinate newHomePosition (homePos.latitude / 10000000.0,
...@@ -255,15 +259,15 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message) ...@@ -255,15 +259,15 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message)
void Vehicle::_handleHeartbeat(mavlink_message_t& message) void Vehicle::_handleHeartbeat(mavlink_message_t& message)
{ {
mavlink_heartbeat_t heartbeat; mavlink_heartbeat_t heartbeat;
mavlink_msg_heartbeat_decode(&message, &heartbeat); mavlink_msg_heartbeat_decode(&message, &heartbeat);
bool newArmed = heartbeat.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY; bool newArmed = heartbeat.base_mode & MAV_MODE_FLAG_DECODE_POSITION_SAFETY;
if (_armed != newArmed) { if (_armed != newArmed) {
_armed = newArmed; _armed = newArmed;
emit armedChanged(_armed); emit armedChanged(_armed);
// We are transitioning to the armed state, begin tracking trajectory points for the map // We are transitioning to the armed state, begin tracking trajectory points for the map
if (_armed) { if (_armed) {
_mapTrajectoryStart(); _mapTrajectoryStart();
...@@ -286,7 +290,7 @@ bool Vehicle::_containsLink(LinkInterface* link) ...@@ -286,7 +290,7 @@ bool Vehicle::_containsLink(LinkInterface* link)
return true; return true;
} }
} }
return false; return false;
} }
...@@ -303,14 +307,14 @@ void Vehicle::_linkDisconnected(LinkInterface* link) ...@@ -303,14 +307,14 @@ void Vehicle::_linkDisconnected(LinkInterface* link)
{ {
qCDebug(VehicleLog) << "_linkDisconnected:" << link->getName(); qCDebug(VehicleLog) << "_linkDisconnected:" << link->getName();
qCDebug(VehicleLog) << "link count:" << _links.count(); qCDebug(VehicleLog) << "link count:" << _links.count();
for (int i=0; i<_links.count(); i++) { for (int i=0; i<_links.count(); i++) {
if (_links[i].data() == link) { if (_links[i].data() == link) {
_links.removeAt(i); _links.removeAt(i);
break; break;
} }
} }
if (_links.count() == 0) { if (_links.count() == 0) {
emit allLinksDisconnected(this); emit allLinksDisconnected(this);
} }
...@@ -327,20 +331,20 @@ void Vehicle::_sendMessage(mavlink_message_t message) ...@@ -327,20 +331,20 @@ void Vehicle::_sendMessage(mavlink_message_t message)
foreach (SharedLinkInterface sharedLink, _links) { foreach (SharedLinkInterface sharedLink, _links) {
LinkInterface* link = sharedLink.data(); LinkInterface* link = sharedLink.data();
Q_ASSERT(link); Q_ASSERT(link);
if (link->isConnected()) { if (link->isConnected()) {
MAVLinkProtocol* mavlink = _mavlink; MAVLinkProtocol* mavlink = _mavlink;
// Give the plugin a chance to adjust // Give the plugin a chance to adjust
_firmwarePlugin->adjustMavlinkMessage(&message); _firmwarePlugin->adjustMavlinkMessage(&message);
static const uint8_t messageKeys[256] = MAVLINK_MESSAGE_CRCS; static const uint8_t messageKeys[256] = MAVLINK_MESSAGE_CRCS;
mavlink_finalize_message_chan(&message, mavlink->getSystemId(), mavlink->getComponentId(), link->getMavlinkChannel(), message.len, messageKeys[message.msgid]); mavlink_finalize_message_chan(&message, mavlink->getSystemId(), mavlink->getComponentId(), link->getMavlinkChannel(), message.len, messageKeys[message.msgid]);
// Write message into buffer, prepending start sign // Write message into buffer, prepending start sign
uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
int len = mavlink_msg_to_send_buffer(buffer, &message); int len = mavlink_msg_to_send_buffer(buffer, &message);
link->writeBytes((const char*)buffer, len); link->writeBytes((const char*)buffer, len);
} }
} }
...@@ -349,11 +353,11 @@ void Vehicle::_sendMessage(mavlink_message_t message) ...@@ -349,11 +353,11 @@ void Vehicle::_sendMessage(mavlink_message_t message)
QList<LinkInterface*> Vehicle::links(void) QList<LinkInterface*> Vehicle::links(void)
{ {
QList<LinkInterface*> list; QList<LinkInterface*> list;
foreach (SharedLinkInterface sharedLink, _links) { foreach (SharedLinkInterface sharedLink, _links) {
list += sharedLink.data(); list += sharedLink.data();
} }
return list; return list;
} }
...@@ -592,7 +596,7 @@ QString Vehicle::getMavIconColor() ...@@ -592,7 +596,7 @@ QString Vehicle::getMavIconColor()
void Vehicle::_updateBatteryRemaining(UASInterface*, double voltage, double, double percent, int) void Vehicle::_updateBatteryRemaining(UASInterface*, double voltage, double, double percent, int)
{ {
if(percent < 0.0) { if(percent < 0.0) {
percent = 0.0; percent = 0.0;
} }
...@@ -678,7 +682,7 @@ void Vehicle::_handleTextMessage(int newCount) ...@@ -678,7 +682,7 @@ void Vehicle::_handleTextMessage(int newCount)
emit messageCountChanged(); emit messageCountChanged();
return; return;
} }
UASMessageHandler* pMh = qgcApp()->toolbox()->uasMessageHandler(); UASMessageHandler* pMh = qgcApp()->toolbox()->uasMessageHandler();
Q_ASSERT(pMh); Q_ASSERT(pMh);
MessageType_t type = newCount ? _currentMessageType : MessageNone; MessageType_t type = newCount ? _currentMessageType : MessageNone;
...@@ -755,16 +759,16 @@ int Vehicle::manualControlReservedButtonCount(void) ...@@ -755,16 +759,16 @@ int Vehicle::manualControlReservedButtonCount(void)
void Vehicle::_loadSettings(void) void Vehicle::_loadSettings(void)
{ {
QSettings settings; QSettings settings;
settings.beginGroup(QString(_settingsGroup).arg(_id)); settings.beginGroup(QString(_settingsGroup).arg(_id));
bool convertOk; bool convertOk;
_joystickMode = (JoystickMode_t)settings.value(_joystickModeSettingsKey, JoystickModeRC).toInt(&convertOk); _joystickMode = (JoystickMode_t)settings.value(_joystickModeSettingsKey, JoystickModeRC).toInt(&convertOk);
if (!convertOk) { if (!convertOk) {
_joystickMode = JoystickModeRC; _joystickMode = JoystickModeRC;
} }
_joystickEnabled = settings.value(_joystickEnabledSettingsKey, false).toBool(); _joystickEnabled = settings.value(_joystickEnabledSettingsKey, false).toBool();
_communicationInactivityTimeoutMSecs = settings.value(_communicationInactivityKey, _communicationInactivityTimeoutMSecsDefault).toInt(); _communicationInactivityTimeoutMSecs = settings.value(_communicationInactivityKey, _communicationInactivityTimeoutMSecsDefault).toInt();
} }
...@@ -772,9 +776,9 @@ void Vehicle::_loadSettings(void) ...@@ -772,9 +776,9 @@ void Vehicle::_loadSettings(void)
void Vehicle::_saveSettings(void) void Vehicle::_saveSettings(void)
{ {
QSettings settings; QSettings settings;
settings.beginGroup(QString(_settingsGroup).arg(_id)); settings.beginGroup(QString(_settingsGroup).arg(_id));
settings.setValue(_joystickModeSettingsKey, _joystickMode); settings.setValue(_joystickModeSettingsKey, _joystickMode);
settings.setValue(_joystickEnabledSettingsKey, _joystickEnabled); settings.setValue(_joystickEnabledSettingsKey, _joystickEnabled);
settings.setValue(_communicationInactivityKey, _communicationInactivityTimeoutMSecs); settings.setValue(_communicationInactivityKey, _communicationInactivityTimeoutMSecs);
...@@ -791,7 +795,7 @@ void Vehicle::setJoystickMode(int mode) ...@@ -791,7 +795,7 @@ void Vehicle::setJoystickMode(int mode)
qCWarning(VehicleLog) << "Invalid joystick mode" << mode; qCWarning(VehicleLog) << "Invalid joystick mode" << mode;
return; return;
} }
_joystickMode = (JoystickMode_t)mode; _joystickMode = (JoystickMode_t)mode;
_saveSettings(); _saveSettings();
emit joystickModeChanged(mode); emit joystickModeChanged(mode);
...@@ -800,9 +804,9 @@ void Vehicle::setJoystickMode(int mode) ...@@ -800,9 +804,9 @@ void Vehicle::setJoystickMode(int mode)
QStringList Vehicle::joystickModes(void) QStringList Vehicle::joystickModes(void)
{ {
QStringList list; QStringList list;
list << "Normal" << "Attitude" << "Position" << "Force" << "Velocity"; list << "Normal" << "Attitude" << "Position" << "Force" << "Velocity";
return list; return list;
} }
...@@ -844,7 +848,7 @@ bool Vehicle::active(void) ...@@ -844,7 +848,7 @@ bool Vehicle::active(void)
void Vehicle::setActive(bool active) void Vehicle::setActive(bool active)
{ {
_active = active; _active = active;
_startJoystick(_active); _startJoystick(_active);
} }
...@@ -866,10 +870,10 @@ QGeoCoordinate Vehicle::homePosition(void) ...@@ -866,10 +870,10 @@ QGeoCoordinate Vehicle::homePosition(void)
void Vehicle::setArmed(bool armed) void Vehicle::setArmed(bool armed)
{ {
// We specifically use COMMAND_LONG:MAV_CMD_COMPONENT_ARM_DISARM since it is supported by more flight stacks. // We specifically use COMMAND_LONG:MAV_CMD_COMPONENT_ARM_DISARM since it is supported by more flight stacks.
mavlink_message_t msg; mavlink_message_t msg;
mavlink_command_long_t cmd; mavlink_command_long_t cmd;
cmd.command = (uint16_t)MAV_CMD_COMPONENT_ARM_DISARM; cmd.command = (uint16_t)MAV_CMD_COMPONENT_ARM_DISARM;
cmd.confirmation = 0; cmd.confirmation = 0;
cmd.param1 = armed ? 1.0f : 0.0f; cmd.param1 = armed ? 1.0f : 0.0f;
...@@ -881,9 +885,9 @@ void Vehicle::setArmed(bool armed) ...@@ -881,9 +885,9 @@ void Vehicle::setArmed(bool armed)
cmd.param7 = 0.0f; cmd.param7 = 0.0f;
cmd.target_system = id(); cmd.target_system = id();
cmd.target_component = 0; cmd.target_component = 0;
mavlink_msg_command_long_encode(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, &cmd); mavlink_msg_command_long_encode(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, &cmd);
sendMessage(msg); sendMessage(msg);
} }
...@@ -948,13 +952,13 @@ void Vehicle::requestDataStream(MAV_DATA_STREAM stream, uint16_t rate) ...@@ -948,13 +952,13 @@ void Vehicle::requestDataStream(MAV_DATA_STREAM stream, uint16_t rate)
{ {
mavlink_message_t msg; mavlink_message_t msg;
mavlink_request_data_stream_t dataStream; mavlink_request_data_stream_t dataStream;
dataStream.req_stream_id = stream; dataStream.req_stream_id = stream;
dataStream.req_message_rate = rate; dataStream.req_message_rate = rate;
dataStream.start_stop = 1; // start dataStream.start_stop = 1; // start
dataStream.target_system = id(); dataStream.target_system = id();
dataStream.target_component = 0; dataStream.target_component = 0;
mavlink_msg_request_data_stream_encode(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, &dataStream); mavlink_msg_request_data_stream_encode(_mavlink->getSystemId(), _mavlink->getComponentId(), &msg, &dataStream);
// We use sendMessageMultiple since we really want these to make it to the vehicle // We use sendMessageMultiple since we really want these to make it to the vehicle
...@@ -965,16 +969,16 @@ void Vehicle::_sendMessageMultipleNext(void) ...@@ -965,16 +969,16 @@ void Vehicle::_sendMessageMultipleNext(void)
{ {
if (_nextSendMessageMultipleIndex < _sendMessageMultipleList.count()) { if (_nextSendMessageMultipleIndex < _sendMessageMultipleList.count()) {
qCDebug(VehicleLog) << "_sendMessageMultipleNext:" << _sendMessageMultipleList[_nextSendMessageMultipleIndex].message.msgid; qCDebug(VehicleLog) << "_sendMessageMultipleNext:" << _sendMessageMultipleList[_nextSendMessageMultipleIndex].message.msgid;
sendMessage(_sendMessageMultipleList[_nextSendMessageMultipleIndex].message); sendMessage(_sendMessageMultipleList[_nextSendMessageMultipleIndex].message);
if (--_sendMessageMultipleList[_nextSendMessageMultipleIndex].retryCount <= 0) { if (--_sendMessageMultipleList[_nextSendMessageMultipleIndex].retryCount <= 0) {
_sendMessageMultipleList.removeAt(_nextSendMessageMultipleIndex); _sendMessageMultipleList.removeAt(_nextSendMessageMultipleIndex);
} else { } else {
_nextSendMessageMultipleIndex++; _nextSendMessageMultipleIndex++;
} }
} }
if (_nextSendMessageMultipleIndex >= _sendMessageMultipleList.count()) { if (_nextSendMessageMultipleIndex >= _sendMessageMultipleList.count()) {
_nextSendMessageMultipleIndex = 0; _nextSendMessageMultipleIndex = 0;
} }
...@@ -983,10 +987,10 @@ void Vehicle::_sendMessageMultipleNext(void) ...@@ -983,10 +987,10 @@ void Vehicle::_sendMessageMultipleNext(void)
void Vehicle::sendMessageMultiple(mavlink_message_t message) void Vehicle::sendMessageMultiple(mavlink_message_t message)
{ {
SendMessageMultipleInfo_t info; SendMessageMultipleInfo_t info;
info.message = message; info.message = message;
info.retryCount = _sendMessageMultipleRetries; info.retryCount = _sendMessageMultipleRetries;
_sendMessageMultipleList.append(info); _sendMessageMultipleList.append(info);
} }
...@@ -1043,3 +1047,14 @@ ParameterLoader* Vehicle::getParameterLoader(void) ...@@ -1043,3 +1047,14 @@ ParameterLoader* Vehicle::getParameterLoader(void)
{ {
return _parameterLoader; return _parameterLoader;
} }
void Vehicle::_imageReady(UASInterface*)
{
if(_uas)
{
QImage img = _uas->getImage();
qgcApp()->toolbox()->imageProvider()->setImage(&img, _id);
_flowImageIndex++;
emit flowImageIndexChanged();
}
}
/*===================================================================== /*=====================================================================
QGroundControl Open Source Ground Control Station QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful, QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/ ======================================================================*/
/// @file /// @file
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <QObject> #include <QObject>
#include <QGeoCoordinate> #include <QGeoCoordinate>
#include <QQmlListProperty>
#include "LinkInterface.h" #include "LinkInterface.h"
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
...@@ -52,7 +51,7 @@ Q_DECLARE_LOGGING_CATEGORY(VehicleLog) ...@@ -52,7 +51,7 @@ Q_DECLARE_LOGGING_CATEGORY(VehicleLog)
class Vehicle : public QObject class Vehicle : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
Vehicle(LinkInterface* link, Vehicle(LinkInterface* link,
int vehicleId, int vehicleId,
...@@ -62,7 +61,7 @@ public: ...@@ -62,7 +61,7 @@ public:
AutoPilotPluginManager* autopilotPluginManager, AutoPilotPluginManager* autopilotPluginManager,
JoystickManager* joystickManager); JoystickManager* joystickManager);
~Vehicle(); ~Vehicle();
Q_PROPERTY(int id READ id CONSTANT) Q_PROPERTY(int id READ id CONSTANT)
Q_PROPERTY(AutoPilotPlugin* autopilot MEMBER _autopilotPlugin CONSTANT) Q_PROPERTY(AutoPilotPlugin* autopilot MEMBER _autopilotPlugin CONSTANT)
Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged) Q_PROPERTY(QGeoCoordinate coordinate READ coordinate NOTIFY coordinateChanged)
...@@ -106,7 +105,8 @@ public: ...@@ -106,7 +105,8 @@ public:
Q_PROPERTY(int joystickMode READ joystickMode WRITE setJoystickMode NOTIFY joystickModeChanged) Q_PROPERTY(int joystickMode READ joystickMode WRITE setJoystickMode NOTIFY joystickModeChanged)
Q_PROPERTY(QStringList joystickModes READ joystickModes CONSTANT) Q_PROPERTY(QStringList joystickModes READ joystickModes CONSTANT)
Q_PROPERTY(bool joystickEnabled READ joystickEnabled WRITE setJoystickEnabled NOTIFY joystickEnabledChanged) Q_PROPERTY(bool joystickEnabled READ joystickEnabled WRITE setJoystickEnabled NOTIFY joystickEnabledChanged)
Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
Q_PROPERTY(int flowImageIndex READ flowImageIndex NOTIFY flowImageIndexChanged)
/// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink /// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink
/// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches. /// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches.
...@@ -121,8 +121,8 @@ public: ...@@ -121,8 +121,8 @@ public:
QGeoCoordinate coordinate(void) { return _coordinate; } QGeoCoordinate coordinate(void) { return _coordinate; }
bool coordinateValid(void) { return _coordinateValid; } bool coordinateValid(void) { return _coordinateValid; }
QmlObjectListModel* missionItemsModel(void); QmlObjectListModel* missionItemsModel(void);
typedef enum { typedef enum {
JoystickModeRC, ///< Joystick emulates an RC Transmitter JoystickModeRC, ///< Joystick emulates an RC Transmitter
JoystickModeAttitude, JoystickModeAttitude,
...@@ -131,50 +131,50 @@ public: ...@@ -131,50 +131,50 @@ public:
JoystickModeVelocity, JoystickModeVelocity,
JoystickModeMax JoystickModeMax
} JoystickMode_t; } JoystickMode_t;
int joystickMode(void); int joystickMode(void);
void setJoystickMode(int mode); void setJoystickMode(int mode);
/// List of joystick mode names /// List of joystick mode names
QStringList joystickModes(void); QStringList joystickModes(void);
bool joystickEnabled(void); bool joystickEnabled(void);
void setJoystickEnabled(bool enabled); void setJoystickEnabled(bool enabled);
// Is vehicle active with respect to current active vehicle in QGC // Is vehicle active with respect to current active vehicle in QGC
bool active(void); bool active(void);
void setActive(bool active); void setActive(bool active);
// Property accesors // Property accesors
int id(void) { return _id; } int id(void) { return _id; }
MAV_AUTOPILOT firmwareType(void) { return _firmwareType; } MAV_AUTOPILOT firmwareType(void) { return _firmwareType; }
MAV_TYPE vehicleType(void) { return _vehicleType; } MAV_TYPE vehicleType(void) { return _vehicleType; }
/// Sends this specified message to all links accociated with this vehicle /// Sends this specified message to all links accociated with this vehicle
void sendMessage(mavlink_message_t message); void sendMessage(mavlink_message_t message);
/// Sends the specified messages multiple times to the vehicle in order to attempt to /// Sends the specified messages multiple times to the vehicle in order to attempt to
/// guarantee that it makes it to the vehicle. /// guarantee that it makes it to the vehicle.
void sendMessageMultiple(mavlink_message_t message); void sendMessageMultiple(mavlink_message_t message);
/// Provides access to uas from vehicle. Temporary workaround until UAS is fully phased out. /// Provides access to uas from vehicle. Temporary workaround until UAS is fully phased out.
UAS* uas(void) { return _uas; } UAS* uas(void) { return _uas; }
/// Provides access to uas from vehicle. Temporary workaround until AutoPilotPlugin is fully phased out. /// Provides access to uas from vehicle. Temporary workaround until AutoPilotPlugin is fully phased out.
AutoPilotPlugin* autopilotPlugin(void) { return _autopilotPlugin; } AutoPilotPlugin* autopilotPlugin(void) { return _autopilotPlugin; }
/// Provides access to the Firmware Plugin for this Vehicle /// Provides access to the Firmware Plugin for this Vehicle
FirmwarePlugin* firmwarePlugin(void) { return _firmwarePlugin; } FirmwarePlugin* firmwarePlugin(void) { return _firmwarePlugin; }
QList<LinkInterface*> links(void); QList<LinkInterface*> links(void);
int manualControlReservedButtonCount(void); int manualControlReservedButtonCount(void);
MissionManager* missionManager(void) { return _missionManager; } MissionManager* missionManager(void) { return _missionManager; }
bool homePositionAvailable(void); bool homePositionAvailable(void);
QGeoCoordinate homePosition(void); QGeoCoordinate homePosition(void);
bool armed(void) { return _armed; } bool armed(void) { return _armed; }
void setArmed(bool armed); void setArmed(bool armed);
...@@ -185,23 +185,25 @@ public: ...@@ -185,23 +185,25 @@ public:
bool hilMode(void); bool hilMode(void);
void setHilMode(bool hilMode); void setHilMode(bool hilMode);
QmlObjectListModel* trajectoryPoints(void) { return &_mapTrajectoryList; } QmlObjectListModel* trajectoryPoints(void) { return &_mapTrajectoryList; }
int flowImageIndex() { return _flowImageIndex; }
/// Requests the specified data stream from the vehicle /// Requests the specified data stream from the vehicle
/// @param stream Stream which is being requested /// @param stream Stream which is being requested
/// @param rate Rate at which to send stream in Hz /// @param rate Rate at which to send stream in Hz
void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate); void requestDataStream(MAV_DATA_STREAM stream, uint16_t rate);
bool missingParameters(void); bool missingParameters(void);
typedef enum { typedef enum {
MessageNone, MessageNone,
MessageNormal, MessageNormal,
MessageWarning, MessageWarning,
MessageError MessageError
} MessageType_t; } MessageType_t;
enum { enum {
ROLL_CHANGED, ROLL_CHANGED,
PITCH_CHANGED, PITCH_CHANGED,
...@@ -213,10 +215,10 @@ public: ...@@ -213,10 +215,10 @@ public:
ALTITUDEWGS84_CHANGED, ALTITUDEWGS84_CHANGED,
ALTITUDEAMSL_CHANGED ALTITUDEAMSL_CHANGED
}; };
// Called when the message drop-down is invoked to clear current count // Called when the message drop-down is invoked to clear current count
void resetMessages(); void resetMessages();
bool messageTypeNone () { return _currentMessageType == MessageNone; } bool messageTypeNone () { return _currentMessageType == MessageNone; }
bool messageTypeNormal () { return _currentMessageType == MessageNormal; } bool messageTypeNormal () { return _currentMessageType == MessageNormal; }
bool messageTypeWarning () { return _currentMessageType == MessageWarning; } bool messageTypeWarning () { return _currentMessageType == MessageWarning; }
...@@ -245,11 +247,11 @@ public: ...@@ -245,11 +247,11 @@ public:
unsigned int heartbeatTimeout () { return _currentHeartbeatTimeout; } unsigned int heartbeatTimeout () { return _currentHeartbeatTimeout; }
ParameterLoader* getParameterLoader(void); ParameterLoader* getParameterLoader(void);
public slots: public slots:
void setLatitude(double latitude); void setLatitude(double latitude);
void setLongitude(double longitude); void setLongitude(double longitude);
signals: signals:
void allLinksDisconnected(Vehicle* vehicle); void allLinksDisconnected(Vehicle* vehicle);
void coordinateChanged(QGeoCoordinate coordinate); void coordinateChanged(QGeoCoordinate coordinate);
...@@ -264,10 +266,10 @@ signals: ...@@ -264,10 +266,10 @@ signals:
void flightModeChanged(const QString& flightMode); void flightModeChanged(const QString& flightMode);
void hilModeChanged(bool hilMode); void hilModeChanged(bool hilMode);
void missingParametersChanged(bool missingParameters); void missingParametersChanged(bool missingParameters);
/// Used internally to move sendMessage call to main thread /// Used internally to move sendMessage call to main thread
void _sendMessageOnThread(mavlink_message_t message); void _sendMessageOnThread(mavlink_message_t message);
void messageTypeChanged (); void messageTypeChanged ();
void newMessageCountChanged (); void newMessageCountChanged ();
void messageCountChanged (); void messageCountChanged ();
...@@ -290,7 +292,8 @@ signals: ...@@ -290,7 +292,8 @@ signals:
void satelliteCountChanged (); void satelliteCountChanged ();
void currentStateChanged (); void currentStateChanged ();
void satelliteLockChanged (); void satelliteLockChanged ();
void flowImageIndexChanged ();
private slots: private slots:
void _mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message); void _mavlinkMessageReceived(LinkInterface* link, mavlink_message_t message);
void _linkDisconnected(LinkInterface* link); void _linkDisconnected(LinkInterface* link);
...@@ -316,6 +319,8 @@ private slots: ...@@ -316,6 +319,8 @@ private slots:
void _heartbeatTimeout (bool timeout, unsigned int ms); void _heartbeatTimeout (bool timeout, unsigned int ms);
void _setSatelliteCount (double val, QString name); void _setSatelliteCount (double val, QString name);
void _setSatLoc (UASInterface* uas, int fix); void _setSatLoc (UASInterface* uas, int fix);
/** @brief A new camera image has arrived */
void _imageReady (UASInterface* uas);
private: private:
bool _containsLink(LinkInterface* link); bool _containsLink(LinkInterface* link);
...@@ -335,29 +340,29 @@ private: ...@@ -335,29 +340,29 @@ private:
private: private:
int _id; ///< Mavlink system id int _id; ///< Mavlink system id
bool _active; bool _active;
MAV_AUTOPILOT _firmwareType; MAV_AUTOPILOT _firmwareType;
MAV_TYPE _vehicleType; MAV_TYPE _vehicleType;
FirmwarePlugin* _firmwarePlugin; FirmwarePlugin* _firmwarePlugin;
AutoPilotPlugin* _autopilotPlugin; AutoPilotPlugin* _autopilotPlugin;
MAVLinkProtocol* _mavlink; MAVLinkProtocol* _mavlink;
/// List of all links associated with this vehicle. We keep SharedLinkInterface objects /// List of all links associated with this vehicle. We keep SharedLinkInterface objects
/// which are QSharedPointer's in order to maintain reference counts across threads. /// which are QSharedPointer's in order to maintain reference counts across threads.
/// This way Link deletion works correctly. /// This way Link deletion works correctly.
QList<SharedLinkInterface> _links; QList<SharedLinkInterface> _links;
JoystickMode_t _joystickMode; JoystickMode_t _joystickMode;
bool _joystickEnabled; bool _joystickEnabled;
UAS* _uas; UAS* _uas;
QGeoCoordinate _coordinate; QGeoCoordinate _coordinate;
bool _coordinateValid; ///< true: vehicle has 3d lock and therefore valid location bool _coordinateValid; ///< true: vehicle has 3d lock and therefore valid location
bool _homePositionAvailable; bool _homePositionAvailable;
QGeoCoordinate _homePosition; QGeoCoordinate _homePosition;
UASInterface* _mav; UASInterface* _mav;
int _currentMessageCount; int _currentMessageCount;
int _messageCount; int _messageCount;
...@@ -389,12 +394,12 @@ private: ...@@ -389,12 +394,12 @@ private:
int _satelliteCount; int _satelliteCount;
int _satelliteLock; int _satelliteLock;
int _updateCount; int _updateCount;
MissionManager* _missionManager; MissionManager* _missionManager;
bool _missionManagerInitialRequestComplete; bool _missionManagerInitialRequestComplete;
ParameterLoader* _parameterLoader; ParameterLoader* _parameterLoader;
bool _armed; ///< true: vehicle is armed bool _armed; ///< true: vehicle is armed
uint8_t _base_mode; ///< base_mode from HEARTBEAT uint8_t _base_mode; ///< base_mode from HEARTBEAT
uint32_t _custom_mode; ///< custom_mode from HEARTBEAT uint32_t _custom_mode; ///< custom_mode from HEARTBEAT
...@@ -404,15 +409,15 @@ private: ...@@ -404,15 +409,15 @@ private:
mavlink_message_t message; ///< Message to send multiple times mavlink_message_t message; ///< Message to send multiple times
int retryCount; ///< Number of retries left int retryCount; ///< Number of retries left
} SendMessageMultipleInfo_t; } SendMessageMultipleInfo_t;
QList<SendMessageMultipleInfo_t> _sendMessageMultipleList; ///< List of messages being sent multiple times QList<SendMessageMultipleInfo_t> _sendMessageMultipleList; ///< List of messages being sent multiple times
static const int _sendMessageMultipleRetries = 5; static const int _sendMessageMultipleRetries = 5;
static const int _sendMessageMultipleIntraMessageDelay = 500; static const int _sendMessageMultipleIntraMessageDelay = 500;
QTimer _sendMultipleTimer; QTimer _sendMultipleTimer;
int _nextSendMessageMultipleIndex; int _nextSendMessageMultipleIndex;
QTimer _mapTrajectoryTimer; QTimer _mapTrajectoryTimer;
QmlObjectListModel _mapTrajectoryList; QmlObjectListModel _mapTrajectoryList;
QGeoCoordinate _mapTrajectoryLastCoordinate; QGeoCoordinate _mapTrajectoryLastCoordinate;
...@@ -423,10 +428,12 @@ private: ...@@ -423,10 +428,12 @@ private:
int _communicationInactivityTimeoutMSecs; int _communicationInactivityTimeoutMSecs;
static const int _communicationInactivityTimeoutMSecsDefault = 30 * 1000; static const int _communicationInactivityTimeoutMSecsDefault = 30 * 1000;
FirmwarePluginManager* _firmwarePluginManager; FirmwarePluginManager* _firmwarePluginManager;
AutoPilotPluginManager* _autopilotPluginManager; AutoPilotPluginManager* _autopilotPluginManager;
JoystickManager* _joystickManager; JoystickManager* _joystickManager;
int _flowImageIndex;
// Settings keys // Settings keys
static const char* _settingsGroup; static const char* _settingsGroup;
static const char* _joystickModeSettingsKey; static const char* _joystickModeSettingsKey;
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.Controls 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.MultiVehicleManager 1.0
QGCView {
id: qgcView
viewPanel: panel
property var _activeVehicle: multiVehicleManager.activeVehicle
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
QGCViewPanel {
id: panel
anchors.fill: parent
QGCLabel {
id: titleLabel
text: "PX4Flow Camera"
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Image {
source: _activeVehicle ? "image://QGCImages/" + _activeVehicle.id + "/" + _activeVehicle.flowImageIndex : ""
width: parent.width * 0.5
height: width * 0.75
cache: false
anchors.centerIn: parent
fillMode: Image.PreserveAspectFit
}
}
}
...@@ -94,6 +94,11 @@ Rectangle { ...@@ -94,6 +94,11 @@ Rectangle {
panelLoader.source = "SetupParameterEditor.qml"; panelLoader.source = "SetupParameterEditor.qml";
} }
function showPX4FlowPanel()
{
panelLoader.source = "PX4FlowSensor.qml";
}
function showVehicleComponentPanel(vehicleComponent) function showVehicleComponentPanel(vehicleComponent)
{ {
if (multiVehicleManager.activeVehicle.armed) { if (multiVehicleManager.activeVehicle.armed) {
...@@ -247,6 +252,16 @@ Rectangle { ...@@ -247,6 +252,16 @@ Rectangle {
onClicked: showFirmwarePanel() onClicked: showFirmwarePanel()
} }
SubMenuButton {
id: px4FlowButton
width: mainWindow.menuButtonWidth
exclusiveGroup: setupButtonGroup
visible: _fullParameterVehicleAvailable
setupIndicator: false
text: "PX4FLOW"
onClicked: showPX4FlowPanel()
}
SubMenuButton { SubMenuButton {
id: joystickButton id: joystickButton
width: mainWindow.menuButtonWidth width: mainWindow.menuButtonWidth
......
...@@ -70,7 +70,7 @@ union px4_custom_mode { ...@@ -70,7 +70,7 @@ union px4_custom_mode {
float MockLink::_vehicleLatitude = 47.633033f; float MockLink::_vehicleLatitude = 47.633033f;
float MockLink::_vehicleLongitude = -122.08794f; float MockLink::_vehicleLongitude = -122.08794f;
float MockLink::_vehicleAltitude = 2.5f; float MockLink::_vehicleAltitude = 9872.5f;
const char* MockConfiguration::_firmwareTypeKey = "FirmwareType"; const char* MockConfiguration::_firmwareTypeKey = "FirmwareType";
const char* MockConfiguration::_vehicleTypeKey = "VehicleType"; const char* MockConfiguration::_vehicleTypeKey = "VehicleType";
...@@ -108,9 +108,9 @@ MockLink::MockLink(MockConfiguration* config) ...@@ -108,9 +108,9 @@ MockLink::MockLink(MockConfiguration* config)
_fileServer = new MockLinkFileServer(_vehicleSystemId, _vehicleComponentId, this); _fileServer = new MockLinkFileServer(_vehicleSystemId, _vehicleComponentId, this);
Q_CHECK_PTR(_fileServer); Q_CHECK_PTR(_fileServer);
moveToThread(this); moveToThread(this);
_loadParams(); _loadParams();
QObject::connect(this, &MockLink::_incomingBytes, this, &MockLink::_handleIncomingBytes); QObject::connect(this, &MockLink::_incomingBytes, this, &MockLink::_handleIncomingBytes);
} }
...@@ -154,7 +154,7 @@ void MockLink::run(void) ...@@ -154,7 +154,7 @@ void MockLink::run(void)
QTimer _timer10HzTasks; QTimer _timer10HzTasks;
QTimer _timer50HzTasks; QTimer _timer50HzTasks;
QObject::connect(&_timer1HzTasks, &QTimer::timeout, this, &MockLink::_run1HzTasks); QObject::connect(&_timer1HzTasks, &QTimer::timeout, this, &MockLink::_run1HzTasks);
QObject::connect(&_timer10HzTasks, &QTimer::timeout, this, &MockLink::_run10HzTasks); QObject::connect(&_timer10HzTasks, &QTimer::timeout, this, &MockLink::_run10HzTasks);
QObject::connect(&_timer50HzTasks, &QTimer::timeout, this, &MockLink::_run50HzTasks); QObject::connect(&_timer50HzTasks, &QTimer::timeout, this, &MockLink::_run50HzTasks);
...@@ -164,10 +164,10 @@ void MockLink::run(void) ...@@ -164,10 +164,10 @@ void MockLink::run(void)
exec(); exec();
QObject::disconnect(&_timer1HzTasks, &QTimer::timeout, this, &MockLink::_run1HzTasks); QObject::disconnect(&_timer1HzTasks, &QTimer::timeout, this, &MockLink::_run1HzTasks);
QObject::disconnect(&_timer10HzTasks, &QTimer::timeout, this, &MockLink::_run10HzTasks); QObject::disconnect(&_timer10HzTasks, &QTimer::timeout, this, &MockLink::_run10HzTasks);
QObject::disconnect(&_timer50HzTasks, &QTimer::timeout, this, &MockLink::_run50HzTasks); QObject::disconnect(&_timer50HzTasks, &QTimer::timeout, this, &MockLink::_run50HzTasks);
_missionItemHandler.shutdown(); _missionItemHandler.shutdown();
} }
...@@ -285,14 +285,14 @@ void MockLink::_sendHeartBeat(void) ...@@ -285,14 +285,14 @@ void MockLink::_sendHeartBeat(void)
_mavBaseMode, // MAV_MODE _mavBaseMode, // MAV_MODE
_mavCustomMode, // custom mode _mavCustomMode, // custom mode
_mavState); // MAV_STATE _mavState); // MAV_STATE
respondWithMavlinkMessage(msg); respondWithMavlinkMessage(msg);
} }
void MockLink::respondWithMavlinkMessage(const mavlink_message_t& msg) void MockLink::respondWithMavlinkMessage(const mavlink_message_t& msg)
{ {
uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
int cBuffer = mavlink_msg_to_send_buffer(buffer, &msg); int cBuffer = mavlink_msg_to_send_buffer(buffer, &msg);
QByteArray bytes((char *)buffer, cBuffer); QByteArray bytes((char *)buffer, cBuffer);
emit bytesReceived(this, bytes); emit bytesReceived(this, bytes);
...@@ -354,7 +354,7 @@ void MockLink::_handleIncomingMavlinkBytes(const uint8_t* bytes, int cBytes) ...@@ -354,7 +354,7 @@ void MockLink::_handleIncomingMavlinkBytes(const uint8_t* bytes, int cBytes)
if (!mavlink_parse_char(getMavlinkChannel(), bytes[i], &msg, &comm)) { if (!mavlink_parse_char(getMavlinkChannel(), bytes[i], &msg, &comm)) {
continue; continue;
} }
if (_missionItemHandler.handleMessage(msg)) { if (_missionItemHandler.handleMessage(msg)) {
continue; continue;
} }
...@@ -379,11 +379,11 @@ void MockLink::_handleIncomingMavlinkBytes(const uint8_t* bytes, int cBytes) ...@@ -379,11 +379,11 @@ void MockLink::_handleIncomingMavlinkBytes(const uint8_t* bytes, int cBytes)
case MAVLINK_MSG_ID_PARAM_REQUEST_READ: case MAVLINK_MSG_ID_PARAM_REQUEST_READ:
_handleParamRequestRead(msg); _handleParamRequestRead(msg);
break; break;
case MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL: case MAVLINK_MSG_ID_FILE_TRANSFER_PROTOCOL:
_handleFTP(msg); _handleFTP(msg);
break; break;
case MAVLINK_MSG_ID_COMMAND_LONG: case MAVLINK_MSG_ID_COMMAND_LONG:
_handleCommandLong(msg); _handleCommandLong(msg);
break; break;
...@@ -552,14 +552,14 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg) ...@@ -552,14 +552,14 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
Q_ASSERT(request.target_system == _vehicleSystemId); Q_ASSERT(request.target_system == _vehicleSystemId);
Q_ASSERT(request.target_component == MAV_COMP_ID_ALL); Q_ASSERT(request.target_component == MAV_COMP_ID_ALL);
// We must send the first parameter for each component first. Otherwise system won't correctly know // We must send the first parameter for each component first. Otherwise system won't correctly know
// when all parameters are loaded. // when all parameters are loaded.
foreach (int componentId, _mapParamName2Value.keys()) { foreach (int componentId, _mapParamName2Value.keys()) {
uint16_t paramIndex = 0; uint16_t paramIndex = 0;
int cParameters = _mapParamName2Value[componentId].count(); int cParameters = _mapParamName2Value[componentId].count();
foreach(QString paramName, _mapParamName2Value[componentId].keys()) { foreach(QString paramName, _mapParamName2Value[componentId].keys()) {
char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN]; char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN];
mavlink_message_t responseMsg; mavlink_message_t responseMsg;
...@@ -583,17 +583,17 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg) ...@@ -583,17 +583,17 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
cParameters, // Total number of parameters cParameters, // Total number of parameters
paramIndex++); // Index of this parameter paramIndex++); // Index of this parameter
respondWithMavlinkMessage(responseMsg); respondWithMavlinkMessage(responseMsg);
// Only first parameter the first time through // Only first parameter the first time through
break; break;
} }
} }
foreach (int componentId, _mapParamName2Value.keys()) { foreach (int componentId, _mapParamName2Value.keys()) {
uint16_t paramIndex = 0; uint16_t paramIndex = 0;
int cParameters = _mapParamName2Value[componentId].count(); int cParameters = _mapParamName2Value[componentId].count();
bool skipParam = true; bool skipParam = true;
foreach(QString paramName, _mapParamName2Value[componentId].keys()) { foreach(QString paramName, _mapParamName2Value[componentId].keys()) {
if (skipParam) { if (skipParam) {
// We've already sent the first param // We've already sent the first param
...@@ -602,17 +602,17 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg) ...@@ -602,17 +602,17 @@ void MockLink::_handleParamRequestList(const mavlink_message_t& msg)
} else { } else {
char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN]; char paramId[MAVLINK_MSG_ID_PARAM_VALUE_LEN];
mavlink_message_t responseMsg; mavlink_message_t responseMsg;
Q_ASSERT(_mapParamName2Value[componentId].contains(paramName)); Q_ASSERT(_mapParamName2Value[componentId].contains(paramName));
Q_ASSERT(_mapParamName2MavParamType.contains(paramName)); Q_ASSERT(_mapParamName2MavParamType.contains(paramName));
MAV_PARAM_TYPE paramType = _mapParamName2MavParamType[paramName]; MAV_PARAM_TYPE paramType = _mapParamName2MavParamType[paramName];
Q_ASSERT(paramName.length() <= MAVLINK_MSG_ID_PARAM_VALUE_LEN); Q_ASSERT(paramName.length() <= MAVLINK_MSG_ID_PARAM_VALUE_LEN);
strncpy(paramId, paramName.toLocal8Bit().constData(), MAVLINK_MSG_ID_PARAM_VALUE_LEN); strncpy(paramId, paramName.toLocal8Bit().constData(), MAVLINK_MSG_ID_PARAM_VALUE_LEN);
qCDebug(MockLinkLog) << "Sending msg_param_value" << componentId << paramId << paramType << _mapParamName2Value[componentId][paramId]; qCDebug(MockLinkLog) << "Sending msg_param_value" << componentId << paramId << paramType << _mapParamName2Value[componentId][paramId];
mavlink_msg_param_value_pack(_vehicleSystemId, mavlink_msg_param_value_pack(_vehicleSystemId,
componentId, // component id componentId, // component id
&responseMsg, // Outgoing message &responseMsg, // Outgoing message
...@@ -634,14 +634,14 @@ void MockLink::_handleParamSet(const mavlink_message_t& msg) ...@@ -634,14 +634,14 @@ void MockLink::_handleParamSet(const mavlink_message_t& msg)
Q_ASSERT(request.target_system == _vehicleSystemId); Q_ASSERT(request.target_system == _vehicleSystemId);
int componentId = request.target_component; int componentId = request.target_component;
// Param may not be null terminated if exactly fits // Param may not be null terminated if exactly fits
char paramId[MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN + 1]; char paramId[MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN + 1];
paramId[MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN] = 0; paramId[MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN] = 0;
strncpy(paramId, request.param_id, MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN); strncpy(paramId, request.param_id, MAVLINK_MSG_PARAM_SET_FIELD_PARAM_ID_LEN);
qCDebug(MockLinkLog) << "_handleParamSet" << componentId << paramId << request.param_type; qCDebug(MockLinkLog) << "_handleParamSet" << componentId << paramId << request.param_type;
Q_ASSERT(_mapParamName2Value.contains(componentId)); Q_ASSERT(_mapParamName2Value.contains(componentId));
Q_ASSERT(_mapParamName2Value[componentId].contains(paramId)); Q_ASSERT(_mapParamName2Value[componentId].contains(paramId));
Q_ASSERT(request.param_type == _mapParamName2MavParamType[paramId]); Q_ASSERT(request.param_type == _mapParamName2MavParamType[paramId]);
...@@ -726,12 +726,12 @@ void MockLink::_handleParamRequestRead(const mavlink_message_t& msg) ...@@ -726,12 +726,12 @@ void MockLink::_handleParamRequestRead(const mavlink_message_t& msg)
void MockLink::emitRemoteControlChannelRawChanged(int channel, uint16_t raw) void MockLink::emitRemoteControlChannelRawChanged(int channel, uint16_t raw)
{ {
uint16_t chanRaw[18]; uint16_t chanRaw[18];
for (int i=0; i<18; i++) { for (int i=0; i<18; i++) {
chanRaw[i] = UINT16_MAX; chanRaw[i] = UINT16_MAX;
} }
chanRaw[channel] = raw; chanRaw[channel] = raw;
mavlink_message_t responseMsg; mavlink_message_t responseMsg;
mavlink_msg_rc_channels_pack(_vehicleSystemId, mavlink_msg_rc_channels_pack(_vehicleSystemId,
_vehicleComponentId, _vehicleComponentId,
...@@ -769,7 +769,7 @@ void MockLink::_handleFTP(const mavlink_message_t& msg) ...@@ -769,7 +769,7 @@ void MockLink::_handleFTP(const mavlink_message_t& msg)
void MockLink::_handleCommandLong(const mavlink_message_t& msg) void MockLink::_handleCommandLong(const mavlink_message_t& msg)
{ {
mavlink_command_long_t request; mavlink_command_long_t request;
mavlink_msg_command_long_decode(&msg, &request); mavlink_msg_command_long_decode(&msg, &request);
if (request.command == MAV_CMD_COMPONENT_ARM_DISARM) { if (request.command == MAV_CMD_COMPONENT_ARM_DISARM) {
...@@ -808,7 +808,7 @@ void MockLink::_sendHomePosition(void) ...@@ -808,7 +808,7 @@ void MockLink::_sendHomePosition(void)
(int32_t)(_vehicleAltitude * 1000), (int32_t)(_vehicleAltitude * 1000),
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
&bogus[0], &bogus[0],
0.0f, 0.0f, 0.0f); 0.0f, 0.0f, 0.0f);
respondWithMavlinkMessage(msg); respondWithMavlinkMessage(msg);
} }
} }
...@@ -823,9 +823,9 @@ void MockLink::_sendGpsRawInt(void) ...@@ -823,9 +823,9 @@ void MockLink::_sendGpsRawInt(void)
&msg, &msg,
timeTick++, // time since boot timeTick++, // time since boot
3, // 3D fix 3, // 3D fix
(int32_t)(_vehicleLatitude * 1E7), (int32_t)(_vehicleLatitude * 1E7),
(int32_t)(_vehicleLongitude * 1E7), (int32_t)(_vehicleLongitude * 1E7),
(int32_t)(_vehicleAltitude * 1000), (int32_t)(_vehicleAltitude * 1000),
UINT16_MAX, UINT16_MAX, // HDOP/VDOP not known UINT16_MAX, UINT16_MAX, // HDOP/VDOP not known
UINT16_MAX, // velocity not known UINT16_MAX, // velocity not known
UINT16_MAX, // course over ground not known UINT16_MAX, // course over ground not known
...@@ -878,7 +878,7 @@ MockConfiguration::MockConfiguration(MockConfiguration* source) ...@@ -878,7 +878,7 @@ MockConfiguration::MockConfiguration(MockConfiguration* source)
: LinkConfiguration(source) : LinkConfiguration(source)
{ {
_firmwareType = source->_firmwareType; _firmwareType = source->_firmwareType;
_vehicleType = source->_vehicleType; _vehicleType = source->_vehicleType;
_sendStatusText = source->_sendStatusText; _sendStatusText = source->_sendStatusText;
} }
......
...@@ -53,6 +53,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -53,6 +53,7 @@ This file is part of the QGROUNDCONTROL project
#include "HomePositionManager.h" #include "HomePositionManager.h"
#include "LogCompressor.h" #include "LogCompressor.h"
#include "UAS.h" #include "UAS.h"
#include "QGCImageProvider.h"
#ifndef __mobile__ #ifndef __mobile__
#include "QGCDataPlot2D.h" #include "QGCDataPlot2D.h"
...@@ -166,6 +167,10 @@ MainWindow::MainWindow() ...@@ -166,6 +167,10 @@ MainWindow::MainWindow()
_mainQmlWidgetHolder->setContextPropertyObject("controller", this); _mainQmlWidgetHolder->setContextPropertyObject("controller", this);
_mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindow.qml")); _mainQmlWidgetHolder->setSource(QUrl::fromUserInput("qrc:qml/MainWindow.qml"));
// Image provider
QQuickImageProvider* pImgProvider = dynamic_cast<QQuickImageProvider*>(qgcApp()->toolbox()->imageProvider());
_mainQmlWidgetHolder->getEngine()->addImageProvider(QLatin1String("QGCImages"), pImgProvider);
// Set dock options // Set dock options
setDockOptions(0); setDockOptions(0);
// Setup corners // Setup corners
...@@ -309,6 +314,7 @@ MainWindow::MainWindow() ...@@ -309,6 +314,7 @@ MainWindow::MainWindow()
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
_mainQmlWidgetHolder->getEngine()->removeImageProvider(QLatin1String("QGCImages"));
_instance = NULL; _instance = NULL;
} }
...@@ -465,6 +471,8 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -465,6 +471,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
// We have to pull out the QmlWidget from the main window and delete it here, before // We have to pull out the QmlWidget from the main window and delete it here, before
// the MainWindow ends up getting deleted. Otherwise the Qml has a reference to MainWindow // the MainWindow ends up getting deleted. Otherwise the Qml has a reference to MainWindow
// inside it which in turn causes a shutdown crash. // inside it which in turn causes a shutdown crash.
// Remove image provider
_mainQmlWidgetHolder->getEngine()->removeImageProvider(QLatin1String("QGCImages"));
_centralLayout->removeWidget(_mainQmlWidgetHolder); _centralLayout->removeWidget(_mainQmlWidgetHolder);
delete _mainQmlWidgetHolder; delete _mainQmlWidgetHolder;
_mainQmlWidgetHolder = NULL; _mainQmlWidgetHolder = NULL;
...@@ -474,7 +482,10 @@ void MainWindow::closeEvent(QCloseEvent *event) ...@@ -474,7 +482,10 @@ void MainWindow::closeEvent(QCloseEvent *event)
event->accept(); event->accept();
//-- TODO: This effectively causes the QGCApplication destructor to not being able
// to access the pointer it is trying to delete.
_instance = NULL; _instance = NULL;
emit mainWindowClosed(); emit mainWindowClosed();
} }
......
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