Commit 2e0b4c46 authored by Gus Grubba's avatar Gus Grubba

Merge pull request #2730 from dogmaphobic/generalizingWiFiBridge

Making the ESP8266 component "common" instead of APM/PX4 only.
parents bb93217c 02c07853
...@@ -562,7 +562,6 @@ HEADERS+= \ ...@@ -562,7 +562,6 @@ HEADERS+= \
src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.h \ src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.h \
src/AutoPilotPlugins/APM/APMCameraComponent.h \ src/AutoPilotPlugins/APM/APMCameraComponent.h \
src/AutoPilotPlugins/APM/APMCompassCal.h \ src/AutoPilotPlugins/APM/APMCompassCal.h \
src/AutoPilotPlugins/APM/APMComponent.h \
src/AutoPilotPlugins/APM/APMFlightModesComponent.h \ src/AutoPilotPlugins/APM/APMFlightModesComponent.h \
src/AutoPilotPlugins/APM/APMFlightModesComponentController.h \ src/AutoPilotPlugins/APM/APMFlightModesComponentController.h \
src/AutoPilotPlugins/APM/APMPowerComponent.h \ src/AutoPilotPlugins/APM/APMPowerComponent.h \
...@@ -573,6 +572,7 @@ HEADERS+= \ ...@@ -573,6 +572,7 @@ HEADERS+= \
src/AutoPilotPlugins/APM/APMTuningComponent.h \ src/AutoPilotPlugins/APM/APMTuningComponent.h \
src/AutoPilotPlugins/Common/RadioComponentController.h \ src/AutoPilotPlugins/Common/RadioComponentController.h \
src/AutoPilotPlugins/Common/ESP8266ComponentController.h \ src/AutoPilotPlugins/Common/ESP8266ComponentController.h \
src/AutoPilotPlugins/Common/ESP8266Component.h \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.h \
src/AutoPilotPlugins/PX4/AirframeComponent.h \ src/AutoPilotPlugins/PX4/AirframeComponent.h \
src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h \ src/AutoPilotPlugins/PX4/AirframeComponentAirframes.h \
...@@ -582,9 +582,7 @@ HEADERS+= \ ...@@ -582,9 +582,7 @@ HEADERS+= \
src/AutoPilotPlugins/PX4/PowerComponent.h \ src/AutoPilotPlugins/PX4/PowerComponent.h \
src/AutoPilotPlugins/PX4/PowerComponentController.h \ src/AutoPilotPlugins/PX4/PowerComponentController.h \
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h \ src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.h \
src/AutoPilotPlugins/PX4/PX4Component.h \
src/AutoPilotPlugins/PX4/PX4RadioComponent.h \ src/AutoPilotPlugins/PX4/PX4RadioComponent.h \
src/AutoPilotPlugins/PX4/PX4ESP8266Component.h \
src/AutoPilotPlugins/PX4/SafetyComponent.h \ src/AutoPilotPlugins/PX4/SafetyComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponent.h \ src/AutoPilotPlugins/PX4/SensorsComponent.h \
src/AutoPilotPlugins/PX4/SensorsComponentController.h \ src/AutoPilotPlugins/PX4/SensorsComponentController.h \
...@@ -620,7 +618,6 @@ SOURCES += \ ...@@ -620,7 +618,6 @@ SOURCES += \
src/AutoPilotPlugins/APM/APMAirframeComponentController.cc \ src/AutoPilotPlugins/APM/APMAirframeComponentController.cc \
src/AutoPilotPlugins/APM/APMCameraComponent.cc \ src/AutoPilotPlugins/APM/APMCameraComponent.cc \
src/AutoPilotPlugins/APM/APMCompassCal.cc \ src/AutoPilotPlugins/APM/APMCompassCal.cc \
src/AutoPilotPlugins/APM/APMComponent.cc \
src/AutoPilotPlugins/APM/APMFlightModesComponent.cc \ src/AutoPilotPlugins/APM/APMFlightModesComponent.cc \
src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc \ src/AutoPilotPlugins/APM/APMFlightModesComponentController.cc \
src/AutoPilotPlugins/APM/APMPowerComponent.cc \ src/AutoPilotPlugins/APM/APMPowerComponent.cc \
...@@ -631,6 +628,7 @@ SOURCES += \ ...@@ -631,6 +628,7 @@ SOURCES += \
src/AutoPilotPlugins/APM/APMTuningComponent.cc \ src/AutoPilotPlugins/APM/APMTuningComponent.cc \
src/AutoPilotPlugins/Common/RadioComponentController.cc \ src/AutoPilotPlugins/Common/RadioComponentController.cc \
src/AutoPilotPlugins/Common/ESP8266ComponentController.cc \ src/AutoPilotPlugins/Common/ESP8266ComponentController.cc \
src/AutoPilotPlugins/Common/ESP8266Component.cc \
src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.cc \ src/AutoPilotPlugins/APM/APMAirframeComponentAirframes.cc \
src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \ src/AutoPilotPlugins/Generic/GenericAutoPilotPlugin.cc \
src/AutoPilotPlugins/PX4/AirframeComponent.cc \ src/AutoPilotPlugins/PX4/AirframeComponent.cc \
...@@ -641,9 +639,7 @@ SOURCES += \ ...@@ -641,9 +639,7 @@ SOURCES += \
src/AutoPilotPlugins/PX4/PowerComponent.cc \ src/AutoPilotPlugins/PX4/PowerComponent.cc \
src/AutoPilotPlugins/PX4/PowerComponentController.cc \ src/AutoPilotPlugins/PX4/PowerComponentController.cc \
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \ src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc \
src/AutoPilotPlugins/PX4/PX4Component.cc \
src/AutoPilotPlugins/PX4/PX4RadioComponent.cc \ src/AutoPilotPlugins/PX4/PX4RadioComponent.cc \
src/AutoPilotPlugins/PX4/PX4ESP8266Component.cc \
src/AutoPilotPlugins/PX4/SafetyComponent.cc \ src/AutoPilotPlugins/PX4/SafetyComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponent.cc \ src/AutoPilotPlugins/PX4/SensorsComponent.cc \
src/AutoPilotPlugins/PX4/SensorsComponentController.cc \ src/AutoPilotPlugins/PX4/SensorsComponentController.cc \
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "ArduCopterFirmwarePlugin.h" #include "ArduCopterFirmwarePlugin.h"
APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) APMAirframeComponent::APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _requiresFrameSetup(false) , _requiresFrameSetup(false)
, _name("Airframe") , _name("Airframe")
{ {
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMAirframeComponent_H #ifndef APMAirframeComponent_H
#define APMAirframeComponent_H #define APMAirframeComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMAirframeComponent : public APMComponent class APMAirframeComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMAirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from APMComponent // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMParameterMetaData.h" // FIXME: Hack
#include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack #include "FirmwarePlugin/APM/APMFirmwarePlugin.h" // FIXME: Hack
#include "FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h" #include "FirmwarePlugin/APM/ArduCopterFirmwarePlugin.h"
#include "APMComponent.h" #include "VehicleComponent.h"
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
#include "APMAirframeComponentAirframes.h" #include "APMAirframeComponentAirframes.h"
#include "APMAirframeComponentController.h" #include "APMAirframeComponentController.h"
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "APMSensorsComponent.h" #include "APMSensorsComponent.h"
#include "APMPowerComponent.h" #include "APMPowerComponent.h"
#include "APMCameraComponent.h" #include "APMCameraComponent.h"
#include "ESP8266Component.h"
/// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type. /// This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_ARDUPILOT type.
APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent)
...@@ -54,6 +55,7 @@ APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent) ...@@ -54,6 +55,7 @@ APMAutoPilotPlugin::APMAutoPilotPlugin(Vehicle* vehicle, QObject* parent)
, _sensorsComponent(NULL) , _sensorsComponent(NULL)
, _tuningComponent(NULL) , _tuningComponent(NULL)
, _airframeFacts(new APMAirframeLoader(this, vehicle->uas(), this)) , _airframeFacts(new APMAirframeLoader(this, vehicle->uas(), this))
, _esp8266Component(NULL)
{ {
APMAirframeLoader::loadAirframeFactMetaData(); APMAirframeLoader::loadAirframeFactMetaData();
} }
...@@ -89,6 +91,13 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -89,6 +91,13 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_radioComponent->setupTriggerSignals(); _radioComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_radioComponent)); _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 = new APMSensorsComponent(_vehicle, this);
_sensorsComponent->setupTriggerSignals(); _sensorsComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_sensorsComponent));
...@@ -100,6 +109,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void) ...@@ -100,6 +109,7 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_tuningComponent = new APMTuningComponent(_vehicle, this); _tuningComponent = new APMTuningComponent(_vehicle, this);
_tuningComponent->setupTriggerSignals(); _tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent)); _components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
} else { } else {
qWarning() << "Call to vehicleCompenents prior to parametersReady"; qWarning() << "Call to vehicleCompenents prior to parametersReady";
} }
......
...@@ -36,6 +36,7 @@ class APMSafetyComponent; ...@@ -36,6 +36,7 @@ class APMSafetyComponent;
class APMSensorsComponent; class APMSensorsComponent;
class APMPowerComponent; class APMPowerComponent;
class APMCameraComponent; class APMCameraComponent;
class ESP8266Component;
/// This is the APM specific implementation of the AutoPilot class. /// This is the APM specific implementation of the AutoPilot class.
class APMAutoPilotPlugin : public AutoPilotPlugin class APMAutoPilotPlugin : public AutoPilotPlugin
...@@ -57,6 +58,7 @@ public: ...@@ -57,6 +58,7 @@ public:
APMSafetyComponent* safetyComponent (void) const { return _safetyComponent; } APMSafetyComponent* safetyComponent (void) const { return _safetyComponent; }
APMSensorsComponent* sensorsComponent (void) const { return _sensorsComponent; } APMSensorsComponent* sensorsComponent (void) const { return _sensorsComponent; }
APMTuningComponent* tuningComponent (void) const { return _tuningComponent; } APMTuningComponent* tuningComponent (void) const { return _tuningComponent; }
ESP8266Component* esp8266Component (void) const { return _esp8266Component; }
public slots: public slots:
// FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle // FIXME: This is public until we restructure AutoPilotPlugin/FirmwarePlugin/Vehicle
...@@ -75,6 +77,7 @@ private: ...@@ -75,6 +77,7 @@ private:
APMSensorsComponent* _sensorsComponent; APMSensorsComponent* _sensorsComponent;
APMTuningComponent* _tuningComponent; APMTuningComponent* _tuningComponent;
APMAirframeLoader* _airframeFacts; APMAirframeLoader* _airframeFacts;
ESP8266Component* _esp8266Component;
}; };
#endif #endif
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
APMCameraComponent::APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) APMCameraComponent::APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _name(tr("Camera")) , _name(tr("Camera"))
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMCameraComponent_H #ifndef APMCameraComponent_H
#define APMCameraComponent_H #define APMCameraComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMCameraComponent : public APMComponent class APMCameraComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMCameraComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#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());
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
#ifndef APMComponent_H
#define APMComponent_H
#include "VehicleComponent.h"
#include <QStringList>
/// @file
/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects.
/// @author Don Gagne <don@thegagnes.com>
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
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "APMRadioComponent.h" #include "APMRadioComponent.h"
APMFlightModesComponent::APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : APMFlightModesComponent::APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
APMComponent(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Flight Modes")) _name(tr("Flight Modes"))
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMFlightModesComponent_H #ifndef APMFlightModesComponent_H
#define APMFlightModesComponent_H #define APMFlightModesComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMFlightModesComponent : public APMComponent class APMFlightModesComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMFlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
APMPowerComponent::APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) APMPowerComponent::APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent), : VehicleComponent(vehicle, autopilot, parent),
_name("Power") _name("Power")
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMPowerComponent_H #ifndef APMPowerComponent_H
#define APMPowerComponent_H #define APMPowerComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMPowerComponent : public APMComponent class APMPowerComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMPowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : APMRadioComponent::APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
APMComponent(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Radio")) _name(tr("Radio"))
{ {
_mapParams << QStringLiteral("RCMAP_ROLL") << QStringLiteral("RCMAP_PITCH") << QStringLiteral("RCMAP_YAW") << QStringLiteral("RCMAP_THROTTLE"); _mapParams << QStringLiteral("RCMAP_ROLL") << QStringLiteral("RCMAP_PITCH") << QStringLiteral("RCMAP_YAW") << QStringLiteral("RCMAP_THROTTLE");
......
...@@ -24,17 +24,17 @@ ...@@ -24,17 +24,17 @@
#ifndef APMRadioComponent_H #ifndef APMRadioComponent_H
#define APMRadioComponent_H #define APMRadioComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
#include "Fact.h" #include "Fact.h"
class APMRadioComponent : public APMComponent class APMRadioComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMRadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
APMSafetyComponent::APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) APMSafetyComponent::APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _name(tr("Safety")) , _name(tr("Safety"))
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMSafetyComponent_H #ifndef APMSafetyComponent_H
#define APMSafetyComponent_H #define APMSafetyComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMSafetyComponent : public APMComponent class APMSafetyComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMSafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// These two list must be kept in sync // These two list must be kept in sync
APMSensorsComponent::APMSensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : APMSensorsComponent::APMSensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
APMComponent(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Sensors")) _name(tr("Sensors"))
{ {
......
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
#ifndef APMSensorsComponent_H #ifndef APMSensorsComponent_H
#define APMSensorsComponent_H #define APMSensorsComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMSensorsComponent : public APMComponent class APMSensorsComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
bool compassSetupNeeded(void) const; bool compassSetupNeeded(void) const;
bool accelSetupNeeded(void) const; bool accelSetupNeeded(void) const;
// Virtuals from APMComponent // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "APMAirframeComponent.h" #include "APMAirframeComponent.h"
APMTuningComponent::APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) APMTuningComponent::APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: APMComponent(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _name("Tuning") , _name("Tuning")
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef APMTuningComponent_H #ifndef APMTuningComponent_H
#define APMTuningComponent_H #define APMTuningComponent_H
#include "APMComponent.h" #include "VehicleComponent.h"
class APMTuningComponent : public APMComponent class APMTuningComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); APMTuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
QStringList setupCompleteChangedTriggerList(void) const final; QStringList setupCompleteChangedTriggerList(void) const final;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -21,57 +21,57 @@ ...@@ -21,57 +21,57 @@
======================================================================*/ ======================================================================*/
#include "PX4ESP8266Component.h" #include "ESP8266Component.h"
#include "PX4AutoPilotPlugin.h" #include "AutoPilotPlugin.h"
PX4ESP8266Component::PX4ESP8266Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) ESP8266Component::ESP8266Component(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: PX4Component(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _name(tr("WiFi Bridge")) , _name(tr("WiFi Bridge"))
{ {
} }
QString PX4ESP8266Component::name(void) const QString ESP8266Component::name(void) const
{ {
return _name; 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."); 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"; return "/qmlimages/wifi.svg";
} }
bool PX4ESP8266Component::requiresSetup(void) const bool ESP8266Component::requiresSetup(void) const
{ {
return false; return false;
} }
bool PX4ESP8266Component::setupComplete(void) const bool ESP8266Component::setupComplete(void) const
{ {
return true; return true;
} }
QStringList PX4ESP8266Component::setupCompleteChangedTriggerList(void) const QStringList ESP8266Component::setupCompleteChangedTriggerList(void) const
{ {
return QStringList(); return QStringList();
} }
QUrl PX4ESP8266Component::setupSource(void) const QUrl ESP8266Component::setupSource(void) const
{ {
return QUrl::fromUserInput("qrc:/qml/ESP8266Component.qml"); return QUrl::fromUserInput("qrc:/qml/ESP8266Component.qml");
} }
QUrl PX4ESP8266Component::summaryQmlSource(void) const QUrl ESP8266Component::summaryQmlSource(void) const
{ {
return QUrl::fromUserInput("qrc:/qml/ESP8266ComponentSummary.qml"); return QUrl::fromUserInput("qrc:/qml/ESP8266ComponentSummary.qml");
} }
QString PX4ESP8266Component::prerequisiteSetup(void) const QString ESP8266Component::prerequisiteSetup(void) const
{ {
return QString(); return QString();
} }
...@@ -21,18 +21,18 @@ ...@@ -21,18 +21,18 @@
======================================================================*/ ======================================================================*/
#ifndef PX4ESP8266Component_H #ifndef ESP8266Component_H
#define PX4ESP8266Component_H #define ESP8266Component_H
#include "PX4Component.h" #include "VehicleComponent.h"
class PX4ESP8266Component : public PX4Component class ESP8266Component : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: 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; QStringList setupCompleteChangedTriggerList() const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -69,7 +69,7 @@ static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]); ...@@ -69,7 +69,7 @@ static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]);
#endif #endif
AirframeComponent::AirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : AirframeComponent::AirframeComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Airframe")) _name(tr("Airframe"))
{ {
#if 0 #if 0
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#ifndef AIRFRAMECOMPONENT_H #ifndef AIRFRAMECOMPONENT_H
#define AIRFRAMECOMPONENT_H #define AIRFRAMECOMPONENT_H
#include "PX4Component.h" #include "VehicleComponent.h"
/// @file /// @file
/// @brief The Airframe VehicleComponent is used to set the SYS_AUTOSTART airframe id. /// @brief The Airframe VehicleComponent is used to set the SYS_AUTOSTART airframe id.
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
class AirframeComponent : public PX4Component class AirframeComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
AirframeComponent(Vehicle* vehicles, AutoPilotPlugin* autopilot, QObject* parent = NULL); AirframeComponent(Vehicle* vehicles, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -34,7 +34,7 @@ struct SwitchListItem { ...@@ -34,7 +34,7 @@ struct SwitchListItem {
}; };
FlightModesComponent::FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : FlightModesComponent::FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Flight Modes")) _name(tr("Flight Modes"))
{ {
} }
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#ifndef FLIGHTMODESCOMPONENT_H #ifndef FLIGHTMODESCOMPONENT_H
#define FLIGHTMODESCOMPONENT_H #define FLIGHTMODESCOMPONENT_H
#include "PX4Component.h" #include "VehicleComponent.h"
/// @file /// @file
/// @brief The FlightModes VehicleComponent is used to set the associated Flight Mode switches. /// @brief The FlightModes VehicleComponent is used to set the associated Flight Mode switches.
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
class FlightModesComponent : public PX4Component class FlightModesComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); FlightModesComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -105,7 +105,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void) ...@@ -105,7 +105,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
//-- Is there an ESP8266 Connected? //-- Is there an ESP8266 Connected?
if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { if(factExists(FactSystem::ParameterProvider, MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) {
_esp8266Component = new PX4ESP8266Component(_vehicle, this); _esp8266Component = new ESP8266Component(_vehicle, this);
_esp8266Component->setupTriggerSignals(); _esp8266Component->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component)); _components.append(QVariant::fromValue((VehicleComponent*)_esp8266Component));
} }
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "PX4AirframeLoader.h" #include "PX4AirframeLoader.h"
#include "AirframeComponent.h" #include "AirframeComponent.h"
#include "PX4RadioComponent.h" #include "PX4RadioComponent.h"
#include "PX4ESP8266Component.h" #include "ESP8266Component.h"
#include "FlightModesComponent.h" #include "FlightModesComponent.h"
#include "SensorsComponent.h" #include "SensorsComponent.h"
#include "SafetyComponent.h" #include "SafetyComponent.h"
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
// These methods should only be used by objects within the plugin // These methods should only be used by objects within the plugin
AirframeComponent* airframeComponent(void) { return _airframeComponent; } AirframeComponent* airframeComponent(void) { return _airframeComponent; }
PX4RadioComponent* radioComponent(void) { return _radioComponent; } PX4RadioComponent* radioComponent(void) { return _radioComponent; }
PX4ESP8266Component* esp8266Component(void) { return _esp8266Component; } ESP8266Component* esp8266Component(void) { return _esp8266Component; }
FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; } FlightModesComponent* flightModesComponent(void) { return _flightModesComponent; }
SensorsComponent* sensorsComponent(void) { return _sensorsComponent; } SensorsComponent* sensorsComponent(void) { return _sensorsComponent; }
SafetyComponent* safetyComponent(void) { return _safetyComponent; } SafetyComponent* safetyComponent(void) { return _safetyComponent; }
...@@ -72,7 +72,7 @@ private: ...@@ -72,7 +72,7 @@ private:
QVariantList _components; QVariantList _components;
AirframeComponent* _airframeComponent; AirframeComponent* _airframeComponent;
PX4RadioComponent* _radioComponent; PX4RadioComponent* _radioComponent;
PX4ESP8266Component* _esp8266Component; ESP8266Component* _esp8266Component;
FlightModesComponent* _flightModesComponent; FlightModesComponent* _flightModesComponent;
SensorsComponent* _sensorsComponent; SensorsComponent* _sensorsComponent;
SafetyComponent* _safetyComponent; SafetyComponent* _safetyComponent;
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#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 &paramName, 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());
}
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
#ifndef PX4COMPONENT_H
#define PX4COMPONENT_H
#include "VehicleComponent.h"
#include <QStringList>
/// @file
/// @brief This class is used as an abstract base class for all PX4 VehicleComponent objects.
/// @author Don Gagne <don@thegagnes.com>
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
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "PX4AutoPilotPlugin.h" #include "PX4AutoPilotPlugin.h"
PX4RadioComponent::PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : PX4RadioComponent::PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Radio")) _name(tr("Radio"))
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef PX4RadioComponent_H #ifndef PX4RadioComponent_H
#define PX4RadioComponent_H #define PX4RadioComponent_H
#include "PX4Component.h" #include "VehicleComponent.h"
class PX4RadioComponent : public PX4Component class PX4RadioComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); PX4RadioComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "AirframeComponent.h" #include "AirframeComponent.h"
PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) PX4TuningComponent::PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent)
: PX4Component(vehicle, autopilot, parent) : VehicleComponent(vehicle, autopilot, parent)
, _name("Tuning") , _name("Tuning")
{ {
} }
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#ifndef PX4TuningComponent_H #ifndef PX4TuningComponent_H
#define PX4TuningComponent_H #define PX4TuningComponent_H
#include "PX4Component.h" #include "VehicleComponent.h"
class PX4TuningComponent : public PX4Component class PX4TuningComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); PX4TuningComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "PX4AutoPilotPlugin.h" #include "PX4AutoPilotPlugin.h"
PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : PowerComponent::PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Power")) _name(tr("Power"))
{ {
} }
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#ifndef PowerComponent_H #ifndef PowerComponent_H
#define PowerComponent_H #define PowerComponent_H
#include "PX4Component.h" #include "VehicleComponent.h"
/// @file /// @file
/// @brief Battery, propeller and magnetometer settings /// @brief Battery, propeller and magnetometer settings
/// @author Gus Grubba <mavlink@grubba.com> /// @author Gus Grubba <mavlink@grubba.com>
class PowerComponent : public PX4Component class PowerComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); PowerComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "PX4AutoPilotPlugin.h" #include "PX4AutoPilotPlugin.h"
SafetyComponent::SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : SafetyComponent::SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Safety")) _name(tr("Safety"))
{ {
} }
......
...@@ -24,21 +24,21 @@ ...@@ -24,21 +24,21 @@
#ifndef SafetyComponent_H #ifndef SafetyComponent_H
#define SafetyComponent_H #define SafetyComponent_H
#include "PX4Component.h" #include "VehicleComponent.h"
/// @file /// @file
/// @brief The Radio VehicleComponent is used to calibrate the trasmitter and assign function mapping /// @brief The Radio VehicleComponent is used to calibrate the trasmitter and assign function mapping
/// to channels. /// to channels.
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
class SafetyComponent : public PX4Component class SafetyComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); SafetyComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
// These two list must be kept in sync // These two list must be kept in sync
SensorsComponent::SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) : SensorsComponent::SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(vehicle, autopilot, parent), VehicleComponent(vehicle, autopilot, parent),
_name(tr("Sensors")) _name(tr("Sensors"))
{ {
......
...@@ -24,20 +24,20 @@ ...@@ -24,20 +24,20 @@
#ifndef SENSORSCOMPONENT_H #ifndef SENSORSCOMPONENT_H
#define SENSORSCOMPONENT_H #define SENSORSCOMPONENT_H
#include "PX4Component.h" #include "VehicleComponent.h"
/// @file /// @file
/// @brief The Sensors VehicleComponent is used to calibrate the the various sensors associated with the board. /// @brief The Sensors VehicleComponent is used to calibrate the the various sensors associated with the board.
/// @author Don Gagne <don@thegagnes.com> /// @author Don Gagne <don@thegagnes.com>
class SensorsComponent : public PX4Component class SensorsComponent : public VehicleComponent
{ {
Q_OBJECT Q_OBJECT
public: public:
SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL); SensorsComponent(Vehicle* vehicle, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component // Virtuals from VehicleComponent
virtual QStringList setupCompleteChangedTriggerList(void) const; virtual QStringList setupCompleteChangedTriggerList(void) const;
// Virtuals from VehicleComponent // Virtuals from VehicleComponent
......
...@@ -217,6 +217,11 @@ int APMFirmwarePlugin::manualControlReservedButtonCount(void) ...@@ -217,6 +217,11 @@ int APMFirmwarePlugin::manualControlReservedButtonCount(void)
void APMFirmwarePlugin::adjustMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message) void APMFirmwarePlugin::adjustMavlinkMessage(Vehicle* vehicle, mavlink_message_t* message)
{ {
//-- Don't process messages to/from UDP Bridge. It doesn't suffer from these issues
if (message->compid == MAV_COMP_ID_UDP_BRIDGE) {
return;
}
if (message->msgid == MAVLINK_MSG_ID_PARAM_VALUE) { if (message->msgid == MAVLINK_MSG_ID_PARAM_VALUE) {
mavlink_param_value_t paramValue; mavlink_param_value_t paramValue;
mavlink_param_union_t paramUnion; mavlink_param_union_t paramUnion;
......
...@@ -57,3 +57,17 @@ void VehicleComponent::addSummaryQmlComponent(QQmlContext* context, QQuickItem* ...@@ -57,3 +57,17 @@ void VehicleComponent::addSummaryQmlComponent(QQmlContext* context, QQuickItem*
item->setParentItem(parent); item->setParentItem(parent);
item->setProperty("vehicleComponent", QVariant::fromValue(this)); item->setProperty("vehicleComponent", QVariant::fromValue(this));
} }
void VehicleComponent::setupTriggerSignals(void)
{
// Watch for changed on trigger list params
foreach (const QString &paramName, setupCompleteChangedTriggerList()) {
Fact* fact = _autopilot->getParameterFact(FactSystem::defaultComponentId, paramName);
connect(fact, &Fact::valueChanged, this, &VehicleComponent::_triggerUpdated);
}
}
void VehicleComponent::_triggerUpdated(QVariant /*value*/)
{
emit setupCompleteChanged(setupComplete());
}
...@@ -66,9 +66,20 @@ public: ...@@ -66,9 +66,20 @@ public:
virtual void addSummaryQmlComponent(QQmlContext* context, QQuickItem* parent); 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: signals:
void setupCompleteChanged(bool setupComplete); void setupCompleteChanged(bool setupComplete);
protected slots:
void _triggerUpdated(QVariant value);
protected: protected:
Vehicle* _vehicle; Vehicle* _vehicle;
AutoPilotPlugin* _autopilot; AutoPilotPlugin* _autopilot;
......
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