diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 728d8b500aaaa654e60e91d33a59d00ca51d314a..6d60e122171fefcbd1310f2e7fcc876aa36f2228 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -562,7 +562,6 @@ HEADERS+= \ src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.h \ src/AutoPilotPlugins/APM/APMCameraComponent.h \ src/AutoPilotPlugins/APM/APMCompassCal.h \ - src/AutoPilotPlugins/APM/APMComponent.h \ src/AutoPilotPlugins/APM/APMFlightModesComponent.h \ src/AutoPilotPlugins/APM/APMFlightModesComponentController.h \ src/AutoPilotPlugins/APM/APMPowerComponent.h \ @@ -573,6 +572,7 @@ HEADERS+= \ src/AutoPilotPlugins/APM/APMTuningComponent.h \ src/AutoPilotPlugins/Common/RadioComponentController.h \ src/AutoPilotPlugins/Common/ESP8266ComponentController.h \ + src/AutoPilotPlugins/Common/ESP8266Component.h \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \ src/AutoPilotPlugins/PX4/AirframeComponent.h \ src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h \ @@ -582,9 +582,7 @@ HEADERS+= \ src/AutoPilotPlugins/PX4/PowerComponent.h \ src/AutoPilotPlugins/PX4/PowerComponentController.h \ src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h \ - src/AutoPilotPlugins/PX4/PX4Component.h \ src/AutoPilotPlugins/PX4/PX4RadioComponent.h \ - src/AutoPilotPlugins/PX4/PX4ESP8266Component.h \ src/AutoPilotPlugins/PX4/SafetyComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponentController.h \ @@ -620,7 +618,6 @@ SOURCES += \ src/AutoPilotPlugins/APM/APMAirframeComponentController.cc \ src/AutoPilotPlugins/APM/APMCameraComponent.cc \ src/AutoPilotPlugins/APM/APMCompassCal.cc \ - src/AutoPilotPlugins/APM/APMComponent.cc \ src/AutoPilotPlugins/APM/APMFlightModesComponent.cc \ src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc \ src/AutoPilotPlugins/APM/APMPowerComponent.cc \ @@ -631,6 +628,7 @@ SOURCES += \ src/AutoPilotPlugins/APM/APMTuningComponent.cc \ src/AutoPilotPlugins/Common/RadioComponentController.cc \ src/AutoPilotPlugins/Common/ESP8266ComponentController.cc \ + src/AutoPilotPlugins/Common/ESP8266Component.cc \ src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.cc \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \ src/AutoPilotPlugins/PX4/AirframeComponent.cc \ @@ -641,9 +639,7 @@ SOURCES += \ src/AutoPilotPlugins/PX4/PowerComponent.cc \ src/AutoPilotPlugins/PX4/PowerComponentController.cc \ src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \ - src/AutoPilotPlugins/PX4/PX4Component.cc \ src/AutoPilotPlugins/PX4/PX4RadioComponent.cc \ - src/AutoPilotPlugins/PX4/PX4ESP8266Component.cc \ src/AutoPilotPlugins/PX4/SafetyComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponentController.cc \ diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.cc b/src/AutoPilotPlugins/APM/APMAirframeComponent.cc index 7813515aa05d19f23e2b08cf4cb27212ecb69400..c9e3b464d4ce36fea587f117d25d9ae84a685c8a 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.cc +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.cc @@ -28,7 +28,7 @@ #include "ArduCopterFirmwarePlugin.h" APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : APMComponent(vehicle, autopilot, parent) + : VehicleComponent(vehicle, autopilot, parent) , _requiresFrameSetup(false) , _name("Airframe") { diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.h b/src/AutoPilotPlugins/APM/APMAirframeComponent.h index de6b7e12875ce26e0d3390499ecd9b9ead51b81c..d023c0516b17201da96d57136e7e57fdea87de92 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.h +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.h @@ -24,16 +24,16 @@ #ifndef APMAirframeComponent_H #define APMAirframeComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMAirframeComponent : public APMComponent +class APMAirframeComponent : public VehicleComponent { Q_OBJECT public: APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from APMComponent + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc index 97ae76277ddcc26853a1443771837f6a01eed126..157f03bcdbd09ca148d1180d8b77fa9231bfade0 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc @@ -27,7 +27,7 @@ #include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack #include "FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h" -#include "APMComponent.h" +#include "VehicleComponent.h" #include "APMAirframeComponent.h" #include "APMAirframeComponentAirframes.h" #include "APMAirframeComponentController.h" @@ -40,6 +40,7 @@ #include "APMSensorsComponent.h" #include "APMPowerComponent.h" #include "APMCameraComponent.h" +#include "ESP8266Component.h" /// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type. APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) @@ -54,6 +55,7 @@ APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) , _sensorsComponent(NULL) , _tuningComponent(NULL) , _airframeFacts(new APMAirframeLoader(this, vehicle->uas(), this)) + , _esp8266Component(NULL) { APMAirframeLoader::loadAirframeFactMetaData(); } @@ -89,6 +91,13 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) _radioComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); + //-- Is there an ESP8266 Connected? + if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { + _esp8266Component = new ESP8266Component(_vehicle, this); + _esp8266Component->setupTriggerSignals(); + _components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component)); + } + _sensorsComponent = new APMSensorsComponent(_vehicle, this); _sensorsComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); @@ -100,6 +109,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) _tuningComponent = new APMTuningComponent(_vehicle, this); _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); + } else { qWarning() << "Call to vehicleCompenents prior to parametersReady"; } diff --git a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h index 52d92ab45b3741879753bc5ddde7479eae44ba1b..32bc82b6d3f2c79d55adc56ecaf373293c88b9fe 100644 --- a/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h +++ b/src/AutoPilotPlugins/APM/APMAutoPilotPlugin.h @@ -36,6 +36,7 @@ class APMSafetyComponent; class APMSensorsComponent; class APMPowerComponent; class APMCameraComponent; +class ESP8266Component; /// This is the APM specific implementation of the AutoPilot class. class APMAutoPilotPlugin : public AutoPilotPlugin @@ -57,6 +58,7 @@ public: APMSafetyComponent* safetyComponent (void) const { return _safetyComponent; } APMSensorsComponent* sensorsComponent (void) const { return _sensorsComponent; } APMTuningComponent* tuningComponent (void) const { return _tuningComponent; } + ESP8266Component* esp8266Component (void) const { return _esp8266Component; } public slots: // FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle @@ -75,6 +77,7 @@ private: APMSensorsComponent* _sensorsComponent; APMTuningComponent* _tuningComponent; APMAirframeLoader* _airframeFacts; + ESP8266Component* _esp8266Component; }; #endif diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.cc b/src/AutoPilotPlugins/APM/APMCameraComponent.cc index 03c26492f11202a92dfb2e41c7f8e22cae909eaa..2acfbc3031a6b6cf1908d3711b118337fcb828ac 100644 --- a/src/AutoPilotPlugins/APM/APMCameraComponent.cc +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.cc @@ -30,7 +30,7 @@ #include "APMAirframeComponent.h" APMCameraComponent::APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : APMComponent(vehicle, autopilot, parent) + : VehicleComponent(vehicle, autopilot, parent) , _name(tr("Camera")) { } diff --git a/src/AutoPilotPlugins/APM/APMCameraComponent.h b/src/AutoPilotPlugins/APM/APMCameraComponent.h index 7c59c9cc8b7b9c8e84e3701677f2f035ed71f0bd..5d7ff62adc723061f97d0f16b766ffffcf556562 100644 --- a/src/AutoPilotPlugins/APM/APMCameraComponent.h +++ b/src/AutoPilotPlugins/APM/APMCameraComponent.h @@ -24,16 +24,16 @@ #ifndef APMCameraComponent_H #define APMCameraComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMCameraComponent : public APMComponent +class APMCameraComponent : public VehicleComponent { Q_OBJECT public: APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMComponent.cc b/src/AutoPilotPlugins/APM/APMComponent.cc deleted file mode 100644 index e5b745b31c61477d3b33825a1ae1069f22f97f84..0000000000000000000000000000000000000000 --- a/src/AutoPilotPlugins/APM/APMComponent.cc +++ /dev/null @@ -1,51 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009 - 2014 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -/// @file -/// @author Don Gagne - -#include "APMComponent.h" -#include "Fact.h" -#include "AutoPilotPlugin.h" - -APMComponent::APMComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - VehicleComponent(vehicle, autopilot, parent) -{ - Q_ASSERT(vehicle); - Q_ASSERT(autopilot); -} - -void APMComponent::setupTriggerSignals(void) -{ - foreach (const QString& paramName, setupCompleteChangedTriggerList()) { - Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName); - connect(fact, &Fact::valueChanged, this, &APMComponent::_triggerUpdated); - } -} - - -void APMComponent::_triggerUpdated(QVariant value) -{ - Q_UNUSED(value); - emit setupCompleteChanged(setupComplete()); -} diff --git a/src/AutoPilotPlugins/APM/APMComponent.h b/src/AutoPilotPlugins/APM/APMComponent.h deleted file mode 100644 index 558c8d99f3f3f95fdefa6c76bf4243860f96cdb9..0000000000000000000000000000000000000000 --- a/src/AutoPilotPlugins/APM/APMComponent.h +++ /dev/null @@ -1,54 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009 - 2014 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -#ifndef APMComponent_H -#define APMComponent_H - -#include "VehicleComponent.h" - -#include - -/// @file -/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects. -/// @author Don Gagne - -class APMComponent : public VehicleComponent -{ - Q_OBJECT - -public: - APMComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - - /// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged - /// signal to be emitted. Last element is signalled by NULL. - virtual QStringList setupCompleteChangedTriggerList(void) const = 0; - - /// Should be called after the component is created (but not in constructor) to setup the - /// signals which are used to track parameter changes which affect setupComplete state. - void setupTriggerSignals(void); - -private slots: - void _triggerUpdated(QVariant value); -}; - -#endif diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponent.cc b/src/AutoPilotPlugins/APM/APMFlightModesComponent.cc index 21cdfc1fa225dc2dd6b8897f6ae6380f6d805365..29473b0d77ddc6f5c118d4295a0819aef3273242 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponent.cc +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponent.cc @@ -27,7 +27,7 @@ #include "APMRadioComponent.h" APMFlightModesComponent::APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - APMComponent(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Flight Modes")) { } diff --git a/src/AutoPilotPlugins/APM/APMFlightModesComponent.h b/src/AutoPilotPlugins/APM/APMFlightModesComponent.h index 688321fddac8c9283ddf8f7838c2c29be8e52f1e..e5c2a53fc48ea242c78ed957494521a8f1328f69 100644 --- a/src/AutoPilotPlugins/APM/APMFlightModesComponent.h +++ b/src/AutoPilotPlugins/APM/APMFlightModesComponent.h @@ -24,16 +24,16 @@ #ifndef APMFlightModesComponent_H #define APMFlightModesComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMFlightModesComponent : public APMComponent +class APMFlightModesComponent : public VehicleComponent { Q_OBJECT public: APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMPowerComponent.cc b/src/AutoPilotPlugins/APM/APMPowerComponent.cc index 54954dceb167b280fbb34f6a127c4e2faf51c3e6..6324ffe8596f72f00dbe94057501e5c4ecd16a23 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponent.cc +++ b/src/AutoPilotPlugins/APM/APMPowerComponent.cc @@ -26,7 +26,7 @@ #include "APMAirframeComponent.h" APMPowerComponent::APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : APMComponent(vehicle, autopilot, parent), + : VehicleComponent(vehicle, autopilot, parent), _name("Power") { } diff --git a/src/AutoPilotPlugins/APM/APMPowerComponent.h b/src/AutoPilotPlugins/APM/APMPowerComponent.h index c695533158ed0723ce45f0f88638a1663b3b106d..f1514f2f4a61e6dbad5e52aacd07730295b4ef52 100644 --- a/src/AutoPilotPlugins/APM/APMPowerComponent.h +++ b/src/AutoPilotPlugins/APM/APMPowerComponent.h @@ -24,16 +24,16 @@ #ifndef APMPowerComponent_H #define APMPowerComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMPowerComponent : public APMComponent +class APMPowerComponent : public VehicleComponent { Q_OBJECT public: APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMRadioComponent.cc b/src/AutoPilotPlugins/APM/APMRadioComponent.cc index 0e19bf648891a868f2cff3e1af958c32757d3e93..400424f54621ae778613a388ac0b978e3bbc2549 100644 --- a/src/AutoPilotPlugins/APM/APMRadioComponent.cc +++ b/src/AutoPilotPlugins/APM/APMRadioComponent.cc @@ -26,7 +26,7 @@ #include "APMAirframeComponent.h" APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - APMComponent(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Radio")) { _mapParams << QStringLiteral("RCMAP_ROLL") << QStringLiteral("RCMAP_PITCH") << QStringLiteral("RCMAP_YAW") << QStringLiteral("RCMAP_THROTTLE"); diff --git a/src/AutoPilotPlugins/APM/APMRadioComponent.h b/src/AutoPilotPlugins/APM/APMRadioComponent.h index 429eee9a48b41e3c58b2f0595afe1f7ae2d76c27..9d217e27f6fcc7f622e311e8de47da352f8f1d77 100644 --- a/src/AutoPilotPlugins/APM/APMRadioComponent.h +++ b/src/AutoPilotPlugins/APM/APMRadioComponent.h @@ -24,17 +24,17 @@ #ifndef APMRadioComponent_H #define APMRadioComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" #include "Fact.h" -class APMRadioComponent : public APMComponent +class APMRadioComponent : public VehicleComponent { Q_OBJECT public: APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponent.cc b/src/AutoPilotPlugins/APM/APMSafetyComponent.cc index 9b7e18bce4d01e3e7fa35483ff0a543b1827aec0..86815e67460adbefb2ddbab55e123c207bbf5c50 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponent.cc +++ b/src/AutoPilotPlugins/APM/APMSafetyComponent.cc @@ -30,7 +30,7 @@ #include "APMAirframeComponent.h" APMSafetyComponent::APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : APMComponent(vehicle, autopilot, parent) + : VehicleComponent(vehicle, autopilot, parent) , _name(tr("Safety")) { } diff --git a/src/AutoPilotPlugins/APM/APMSafetyComponent.h b/src/AutoPilotPlugins/APM/APMSafetyComponent.h index 01c17502c69e65e5beca5d8dd943d6841818d9cb..805e97ea36fe34755bdc317d894a5214ca04a3e0 100644 --- a/src/AutoPilotPlugins/APM/APMSafetyComponent.h +++ b/src/AutoPilotPlugins/APM/APMSafetyComponent.h @@ -24,16 +24,16 @@ #ifndef APMSafetyComponent_H #define APMSafetyComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMSafetyComponent : public APMComponent +class APMSafetyComponent : public VehicleComponent { Q_OBJECT public: APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.cc b/src/AutoPilotPlugins/APM/APMSensorsComponent.cc index 5b95ac541ad57e23a26ccecbe0945e27a6872188..9e25a183147cb49450b95d4b7beff59b60e2dc34 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.cc +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.cc @@ -29,7 +29,7 @@ // These two list must be kept in sync APMSensorsComponent::APMSensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - APMComponent(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Sensors")) { diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.h b/src/AutoPilotPlugins/APM/APMSensorsComponent.h index cf5999b76dc5850b7b53ed529512911e619898a3..754345036dc13d6c81173c512d7e929316efc839 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.h +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.h @@ -24,9 +24,9 @@ #ifndef APMSensorsComponent_H #define APMSensorsComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMSensorsComponent : public APMComponent +class APMSensorsComponent : public VehicleComponent { Q_OBJECT @@ -36,7 +36,7 @@ public: bool compassSetupNeeded(void) const; bool accelSetupNeeded(void) const; - // Virtuals from APMComponent + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.cc b/src/AutoPilotPlugins/APM/APMTuningComponent.cc index 833e54ba3ecb8fff3687ed695dc5084dfd797602..15177f306678da2f43f18b42309e2b2b24bad5ce 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.cc +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.cc @@ -26,7 +26,7 @@ #include "APMAirframeComponent.h" APMTuningComponent::APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : APMComponent(vehicle, autopilot, parent) + : VehicleComponent(vehicle, autopilot, parent) , _name("Tuning") { } diff --git a/src/AutoPilotPlugins/APM/APMTuningComponent.h b/src/AutoPilotPlugins/APM/APMTuningComponent.h index 8e7ec4e2d6aa9baaf59054bb8414e02486285a9b..90fcfe50819dd0d6ae6655a5d21b4444a8cc2bb8 100644 --- a/src/AutoPilotPlugins/APM/APMTuningComponent.h +++ b/src/AutoPilotPlugins/APM/APMTuningComponent.h @@ -24,16 +24,16 @@ #ifndef APMTuningComponent_H #define APMTuningComponent_H -#include "APMComponent.h" +#include "VehicleComponent.h" -class APMTuningComponent : public APMComponent +class APMTuningComponent : public VehicleComponent { Q_OBJECT public: APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList(void) const final; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/PX4ESP8266Component.cc b/src/AutoPilotPlugins/Common/ESP8266Component.cc similarity index 66% rename from src/AutoPilotPlugins/PX4/PX4ESP8266Component.cc rename to src/AutoPilotPlugins/Common/ESP8266Component.cc index 39e79b2b8bffb638798786353cda2d8d812682c9..650841be2286270a15f45340c17c430e1b6ce231 100644 --- a/src/AutoPilotPlugins/PX4/PX4ESP8266Component.cc +++ b/src/AutoPilotPlugins/Common/ESP8266Component.cc @@ -21,57 +21,57 @@ ======================================================================*/ -#include "PX4ESP8266Component.h" -#include "PX4AutoPilotPlugin.h" +#include "ESP8266Component.h" +#include "AutoPilotPlugin.h" -PX4ESP8266Component::PX4ESP8266Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : PX4Component(vehicle, autopilot, parent) +ESP8266Component::ESP8266Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) + : VehicleComponent(vehicle, autopilot, parent) , _name(tr("WiFi Bridge")) { } -QString PX4ESP8266Component::name(void) const +QString ESP8266Component::name(void) const { return _name; } -QString PX4ESP8266Component::description(void) const +QString ESP8266Component::description(void) const { return tr("The ESP8266 WiFi Bridge Component is used to setup the WiFi link."); } -QString PX4ESP8266Component::iconResource(void) const +QString ESP8266Component::iconResource(void) const { return "/qmlimages/wifi.svg"; } -bool PX4ESP8266Component::requiresSetup(void) const +bool ESP8266Component::requiresSetup(void) const { return false; } -bool PX4ESP8266Component::setupComplete(void) const +bool ESP8266Component::setupComplete(void) const { return true; } -QStringList PX4ESP8266Component::setupCompleteChangedTriggerList(void) const +QStringList ESP8266Component::setupCompleteChangedTriggerList(void) const { return QStringList(); } -QUrl PX4ESP8266Component::setupSource(void) const +QUrl ESP8266Component::setupSource(void) const { return QUrl::fromUserInput("qrc:/qml/ESP8266Component.qml"); } -QUrl PX4ESP8266Component::summaryQmlSource(void) const +QUrl ESP8266Component::summaryQmlSource(void) const { return QUrl::fromUserInput("qrc:/qml/ESP8266ComponentSummary.qml"); } -QString PX4ESP8266Component::prerequisiteSetup(void) const +QString ESP8266Component::prerequisiteSetup(void) const { return QString(); } diff --git a/src/AutoPilotPlugins/PX4/PX4ESP8266Component.h b/src/AutoPilotPlugins/Common/ESP8266Component.h similarity index 86% rename from src/AutoPilotPlugins/PX4/PX4ESP8266Component.h rename to src/AutoPilotPlugins/Common/ESP8266Component.h index 220b0ab4fc2e832386cf0a2d92942e973c8f080b..3a09e23b57bd247a75a905044451a7d3ece4e74a 100644 --- a/src/AutoPilotPlugins/PX4/PX4ESP8266Component.h +++ b/src/AutoPilotPlugins/Common/ESP8266Component.h @@ -21,18 +21,18 @@ ======================================================================*/ -#ifndef PX4ESP8266Component_H -#define PX4ESP8266Component_H +#ifndef ESP8266Component_H +#define ESP8266Component_H -#include "PX4Component.h" +#include "VehicleComponent.h" -class PX4ESP8266Component : public PX4Component +class ESP8266Component : public VehicleComponent { Q_OBJECT public: - PX4ESP8266Component (Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); + ESP8266Component (Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent QStringList setupCompleteChangedTriggerList() const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.cc b/src/AutoPilotPlugins/PX4/AirframeComponent.cc index 44b0ebdb53ff82e5d3d8a4b8cd90236617e68c68..87c8a0fb29a0818222fc72e136f5cb152b8deb8b 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.cc +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.cc @@ -69,7 +69,7 @@ static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]); #endif AirframeComponent::AirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Airframe")) { #if 0 diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.h b/src/AutoPilotPlugins/PX4/AirframeComponent.h index a31e5b7b674271698558278282723cc654706ee1..6ee80a57800616b550ae56b8c2a270dbf45cae57 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.h +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.h @@ -24,20 +24,20 @@ #ifndef AIRFRAMECOMPONENT_H #define AIRFRAMECOMPONENT_H -#include "PX4Component.h" +#include "VehicleComponent.h" /// @file /// @brief The Airframe VehicleComponent is used to set the SYS_AUTOSTART airframe id. /// @author Don Gagne -class AirframeComponent : public PX4Component +class AirframeComponent : public VehicleComponent { Q_OBJECT public: AirframeComponent(Vehicle* vehicles, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc index 66ad52af876b03c25aec1a2ffd728cc407afdad2..5825147a2bdd887909657b94b45b1eff8ad8a259 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.cc +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.cc @@ -34,7 +34,7 @@ struct SwitchListItem { }; FlightModesComponent::FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Flight Modes")) { } diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.h b/src/AutoPilotPlugins/PX4/FlightModesComponent.h index c8502fdd79cc8fccde953963ef9fae4f4554b5ff..f61254dc0921ab426cbf78e9ddf01a161e40ced9 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.h +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.h @@ -24,20 +24,20 @@ #ifndef FLIGHTMODESCOMPONENT_H #define FLIGHTMODESCOMPONENT_H -#include "PX4Component.h" +#include "VehicleComponent.h" /// @file /// @brief The FlightModes VehicleComponent is used to set the associated Flight Mode switches. /// @author Don Gagne -class FlightModesComponent : public PX4Component +class FlightModesComponent : public VehicleComponent { Q_OBJECT public: FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc index 6e96c18faf04026ff7520dbd16b832f56a69fdb4..ce32581b5efd408c175a47b4674ab4ba5f05ef21 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc @@ -105,7 +105,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) //-- Is there an ESP8266 Connected? if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { - _esp8266Component = new PX4ESP8266Component(_vehicle, this); + _esp8266Component = new ESP8266Component(_vehicle, this); _esp8266Component->setupTriggerSignals(); _components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component)); } diff --git a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h index 836c3c1cc998a0bc78eb2e9825cf03bb9794ebf5..134fd4761d91d6e13d27a7d8f8f76b0cf9412446 100644 --- a/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h +++ b/src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h @@ -28,7 +28,7 @@ #include "PX4AirframeLoader.h" #include "AirframeComponent.h" #include "PX4RadioComponent.h" -#include "PX4ESP8266Component.h" +#include "ESP8266Component.h" #include "FlightModesComponent.h" #include "SensorsComponent.h" #include "SafetyComponent.h" @@ -56,7 +56,7 @@ public: // These methods should only be used by objects within the plugin AirframeComponent* airframeComponent(void) { return _airframeComponent; } PX4RadioComponent* radioComponent(void) { return _radioComponent; } - PX4ESP8266Component* esp8266Component(void) { return _esp8266Component; } + ESP8266Component* esp8266Component(void) { return _esp8266Component; } FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; } SensorsComponent* sensorsComponent(void) { return _sensorsComponent; } SafetyComponent* safetyComponent(void) { return _safetyComponent; } @@ -72,7 +72,7 @@ private: QVariantList _components; AirframeComponent* _airframeComponent; PX4RadioComponent* _radioComponent; - PX4ESP8266Component* _esp8266Component; + ESP8266Component* _esp8266Component; FlightModesComponent* _flightModesComponent; SensorsComponent* _sensorsComponent; SafetyComponent* _safetyComponent; diff --git a/src/AutoPilotPlugins/PX4/PX4Component.cc b/src/AutoPilotPlugins/PX4/PX4Component.cc deleted file mode 100644 index a3ea75a917738853b6ad4b890009e329f8b22087..0000000000000000000000000000000000000000 --- a/src/AutoPilotPlugins/PX4/PX4Component.cc +++ /dev/null @@ -1,53 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009 - 2014 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -/// @file -/// @author Don Gagne - -#include "PX4Component.h" -#include "Fact.h" -#include "AutoPilotPlugin.h" - -PX4Component::PX4Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - VehicleComponent(vehicle, autopilot, parent) -{ - Q_ASSERT(vehicle); - Q_ASSERT(autopilot); -} - -void PX4Component::setupTriggerSignals(void) -{ - // Watch for changed on trigger list params - foreach (const QString ¶mName, setupCompleteChangedTriggerList()) { - Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName); - - connect(fact, &Fact::valueChanged, this, &PX4Component::_triggerUpdated); - } -} - - -void PX4Component::_triggerUpdated(QVariant value) -{ - Q_UNUSED(value); - emit setupCompleteChanged(setupComplete()); -} diff --git a/src/AutoPilotPlugins/PX4/PX4Component.h b/src/AutoPilotPlugins/PX4/PX4Component.h deleted file mode 100644 index 0283506e8568555c08cf74bd440921d46db4a290..0000000000000000000000000000000000000000 --- a/src/AutoPilotPlugins/PX4/PX4Component.h +++ /dev/null @@ -1,54 +0,0 @@ -/*===================================================================== - - QGroundControl Open Source Ground Control Station - - (c) 2009 - 2014 QGROUNDCONTROL PROJECT - - This file is part of the QGROUNDCONTROL project - - QGROUNDCONTROL is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - QGROUNDCONTROL is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with QGROUNDCONTROL. If not, see . - - ======================================================================*/ - -#ifndef PX4COMPONENT_H -#define PX4COMPONENT_H - -#include "VehicleComponent.h" - -#include - -/// @file -/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects. -/// @author Don Gagne - -class PX4Component : public VehicleComponent -{ - Q_OBJECT - -public: - PX4Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - - /// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged - /// signal to be emitted. Last element is signalled by NULL. - virtual QStringList setupCompleteChangedTriggerList(void) const = 0; - - /// Should be called after the component is created (but not in constructor) to setup the - /// signals which are used to track parameter changes which affect setupComplete state. - void setupTriggerSignals(void); - -private slots: - void _triggerUpdated(QVariant value); -}; - -#endif diff --git a/src/AutoPilotPlugins/PX4/PX4RadioComponent.cc b/src/AutoPilotPlugins/PX4/PX4RadioComponent.cc index b8d6d6cca09d0cf977c220072702fdb3af5690ff..8a500f01892ffc5512a039778fcf0a09853e8b45 100644 --- a/src/AutoPilotPlugins/PX4/PX4RadioComponent.cc +++ b/src/AutoPilotPlugins/PX4/PX4RadioComponent.cc @@ -25,7 +25,7 @@ #include "PX4AutoPilotPlugin.h" PX4RadioComponent::PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Radio")) { } diff --git a/src/AutoPilotPlugins/PX4/PX4RadioComponent.h b/src/AutoPilotPlugins/PX4/PX4RadioComponent.h index e8d14787520bb518bdd44d8a17e0f37c258f4ff0..95cd8341908de3504e6c8343c83190c46a8b422e 100644 --- a/src/AutoPilotPlugins/PX4/PX4RadioComponent.h +++ b/src/AutoPilotPlugins/PX4/PX4RadioComponent.h @@ -24,16 +24,16 @@ #ifndef PX4RadioComponent_H #define PX4RadioComponent_H -#include "PX4Component.h" +#include "VehicleComponent.h" -class PX4RadioComponent : public PX4Component +class PX4RadioComponent : public VehicleComponent { Q_OBJECT public: PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc b/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc index e808f8a34cbb8772a4ff6fa8977a3584e7268970..5d7f5d53b716824bd287636cbb9681a82e010ad9 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponent.cc @@ -26,7 +26,7 @@ #include "AirframeComponent.h" PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) - : PX4Component(vehicle, autopilot, parent) + : VehicleComponent(vehicle, autopilot, parent) , _name("Tuning") { } diff --git a/src/AutoPilotPlugins/PX4/PX4TuningComponent.h b/src/AutoPilotPlugins/PX4/PX4TuningComponent.h index a86a65abe6c149f0575696452f1e9febe51c2e93..89aeb4097fd2abae2daee74cb54c71b008753cc0 100644 --- a/src/AutoPilotPlugins/PX4/PX4TuningComponent.h +++ b/src/AutoPilotPlugins/PX4/PX4TuningComponent.h @@ -24,16 +24,16 @@ #ifndef PX4TuningComponent_H #define PX4TuningComponent_H -#include "PX4Component.h" +#include "VehicleComponent.h" -class PX4TuningComponent : public PX4Component +class PX4TuningComponent : public VehicleComponent { Q_OBJECT public: PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.cc b/src/AutoPilotPlugins/PX4/PowerComponent.cc index 0b07f24669cfd4dc2e635483b2265a07c8ac464d..357bfde0325779bfa4c014a52b7d50e1d26d71de 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.cc +++ b/src/AutoPilotPlugins/PX4/PowerComponent.cc @@ -29,7 +29,7 @@ #include "PX4AutoPilotPlugin.h" PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Power")) { } diff --git a/src/AutoPilotPlugins/PX4/PowerComponent.h b/src/AutoPilotPlugins/PX4/PowerComponent.h index 3bddfa3e6bc2801d7b2fc95283a00f3c138b455c..68436de17fe77085e9ac5334e5d6495b0428efe5 100644 --- a/src/AutoPilotPlugins/PX4/PowerComponent.h +++ b/src/AutoPilotPlugins/PX4/PowerComponent.h @@ -24,20 +24,20 @@ #ifndef PowerComponent_H #define PowerComponent_H -#include "PX4Component.h" +#include "VehicleComponent.h" /// @file /// @brief Battery, propeller and magnetometer settings /// @author Gus Grubba -class PowerComponent : public PX4Component +class PowerComponent : public VehicleComponent { Q_OBJECT public: PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.cc b/src/AutoPilotPlugins/PX4/SafetyComponent.cc index 26ab7c440323bf722a8cf6cf25278073ab4d64c5..05d62d7549f3725f057d1c31bf2851538d3829cb 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.cc +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.cc @@ -28,7 +28,7 @@ #include "PX4AutoPilotPlugin.h" SafetyComponent::SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Safety")) { } diff --git a/src/AutoPilotPlugins/PX4/SafetyComponent.h b/src/AutoPilotPlugins/PX4/SafetyComponent.h index b6f9c18570cf7e9ec1e983969e29dc63d7ad9bc3..9cbf37e2b08e3fe90171027a99f2898a34621118 100644 --- a/src/AutoPilotPlugins/PX4/SafetyComponent.h +++ b/src/AutoPilotPlugins/PX4/SafetyComponent.h @@ -24,21 +24,21 @@ #ifndef SafetyComponent_H #define SafetyComponent_H -#include "PX4Component.h" +#include "VehicleComponent.h" /// @file /// @brief The Radio VehicleComponent is used to calibrate the trasmitter and assign function mapping /// to channels. /// @author Don Gagne -class SafetyComponent : public PX4Component +class SafetyComponent : public VehicleComponent { Q_OBJECT public: SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.cc b/src/AutoPilotPlugins/PX4/SensorsComponent.cc index 0a712c74e8a741467a44f609ef3bf8a0230115a7..c47d3b2ed959136b2e097aa983a32535cf4f2a5a 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.cc +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.cc @@ -32,7 +32,7 @@ // These two list must be kept in sync SensorsComponent::SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : - PX4Component(vehicle, autopilot, parent), + VehicleComponent(vehicle, autopilot, parent), _name(tr("Sensors")) { diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.h b/src/AutoPilotPlugins/PX4/SensorsComponent.h index 5e5349fcf3297f8f4f1de3bb2a4fa2b124fe7264..a0557b44352f1008366c6882fe34332e3c8ce932 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.h +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.h @@ -24,20 +24,20 @@ #ifndef SENSORSCOMPONENT_H #define SENSORSCOMPONENT_H -#include "PX4Component.h" +#include "VehicleComponent.h" /// @file /// @brief The Sensors VehicleComponent is used to calibrate the the various sensors associated with the board. /// @author Don Gagne -class SensorsComponent : public PX4Component +class SensorsComponent : public VehicleComponent { Q_OBJECT public: SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); - // Virtuals from PX4Component + // Virtuals from VehicleComponent virtual QStringList setupCompleteChangedTriggerList(void) const; // Virtuals from VehicleComponent diff --git a/src/VehicleSetup/VehicleComponent.cc b/src/VehicleSetup/VehicleComponent.cc index 16df91fe21b987c884efa82cfcab13867658db49..de7a4835aa4405ed9687283b343b80e5d3b69af6 100644 --- a/src/VehicleSetup/VehicleComponent.cc +++ b/src/VehicleSetup/VehicleComponent.cc @@ -57,3 +57,17 @@ void VehicleComponent::addSummaryQmlComponent(QQmlContext* context, QQuickItem* item->setParentItem(parent); item->setProperty("vehicleComponent", QVariant::fromValue(this)); } + +void VehicleComponent::setupTriggerSignals(void) +{ + // Watch for changed on trigger list params + foreach (const QString ¶mName, setupCompleteChangedTriggerList()) { + Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName); + connect(fact, &Fact::valueChanged, this, &VehicleComponent::_triggerUpdated); + } +} + +void VehicleComponent::_triggerUpdated(QVariant /*value*/) +{ + emit setupCompleteChanged(setupComplete()); +} diff --git a/src/VehicleSetup/VehicleComponent.h b/src/VehicleSetup/VehicleComponent.h index dcc3ea114ccaa802c22a00c83c54833bf696cc9f..3e4fba29322c1c26ca42c104d02847417202fc71 100644 --- a/src/VehicleSetup/VehicleComponent.h +++ b/src/VehicleSetup/VehicleComponent.h @@ -66,9 +66,20 @@ public: virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent); + /// @brief Returns an list of parameter names for which a change should cause the setupCompleteChanged + /// signal to be emitted. Last element is signalled by NULL. + virtual QStringList setupCompleteChangedTriggerList(void) const = 0; + + /// Should be called after the component is created (but not in constructor) to setup the + /// signals which are used to track parameter changes which affect setupComplete state. + virtual void setupTriggerSignals(void); + signals: void setupCompleteChanged(bool setupComplete); - + +protected slots: + void _triggerUpdated(QVariant value); + protected: Vehicle* _vehicle; AutoPilotPlugin* _autopilot;