Commit f08d592f authored by Don Gagne's avatar Don Gagne

Added new _autopilot member

parent 76e8afff
......@@ -62,8 +62,8 @@ static const struct mavType mavTypeInfo[] = {
};
static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]);
AirframeComponent::AirframeComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Airframe"))
{
// Validate that our mavTypeInfo array hasn't gotten out of sync
......
......@@ -35,7 +35,7 @@ class AirframeComponent : public PX4Component
Q_OBJECT
public:
AirframeComponent(UASInterface* uas, QObject* parent = NULL);
AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
......
......@@ -45,8 +45,8 @@ static const SwitchListItem switchList[] = {
};
static const size_t cSwitchList = sizeof(switchList) / sizeof(switchList[0]);
FlightModesComponent::FlightModesComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
FlightModesComponent::FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Flight Modes"))
{
}
......
......@@ -35,7 +35,7 @@ class FlightModesComponent : public PX4Component
Q_OBJECT
public:
FlightModesComponent(UASInterface* uas, QObject* parent = NULL);
FlightModesComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
......
......@@ -26,6 +26,7 @@
#include "RadioComponent.h"
#include "SensorsComponent.h"
#include "FlightModesComponent.h"
#include "SafetyComponent.h"
#include "AutoPilotPluginManager.h"
#include "UASManager.h"
#include "QGCUASParamManagerInterface.h"
......@@ -196,19 +197,23 @@ const QVariantList& PX4AutoPilotPlugin::components(void)
Q_ASSERT(_uas);
component = new AirframeComponent(_uas);
component = new AirframeComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new RadioComponent(_uas);
component = new RadioComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new FlightModesComponent(_uas);
component = new FlightModesComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new SensorsComponent(_uas);
component = new SensorsComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
component = new SafetyComponent(_uas, this);
Q_CHECK_PTR(component);
_components.append(QVariant::fromValue(component));
}
......
......@@ -26,8 +26,8 @@
#include "PX4Component.h"
PX4Component::PX4Component(UASInterface* uas, QObject* parent) :
VehicleComponent(uas, parent)
PX4Component::PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
VehicleComponent(uas, autopilot, parent)
{
bool fSuccess = connect(_paramMgr, SIGNAL(parameterUpdated(int, QString, QVariant)), this, SLOT(_parameterUpdated(int, QString, QVariant)));
Q_ASSERT(fSuccess);
......
......@@ -35,7 +35,7 @@ class PX4Component : public VehicleComponent
Q_OBJECT
public:
PX4Component(UASInterface* uas, QObject* parent = NULL);
PX4Component(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
/// @brief Returns an array of parameter names for which a change should cause the setupCompleteChanged
/// signal to be emitted. Last element is signalled by NULL. Must be implemented by upper level class.
......@@ -45,7 +45,6 @@ private slots:
/// @brief Connected to QGCUASParamManagerInterface::parameterUpdated signal in order to signal
/// setupCompleteChanged at appropriate times.
void _parameterUpdated(int compId, QString paramName, QVariant value);
};
#endif
......@@ -31,8 +31,8 @@
/// @brief Parameters which signal a change in setupComplete state
static const char* triggerParams[] = { "RC_MAP_MODE_SW", NULL };
RadioComponent::RadioComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
RadioComponent::RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Radio"))
{
}
......
......@@ -36,7 +36,7 @@ class RadioComponent : public PX4Component
Q_OBJECT
public:
RadioComponent(UASInterface* uas, QObject* parent = NULL);
RadioComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
......
......@@ -36,8 +36,8 @@ static const char* triggerParams[] = { "SENS_MAG_XOFF", "SENS_GYRO_XOFF", "SENS
/// @brief Used to translate from parameter name to user string
static const char* triggerSensors[] = { "Compass", "Gyro", "Acceleromter", "Airspeed", NULL };
SensorsComponent::SensorsComponent(UASInterface* uas, QObject* parent) :
PX4Component(uas, parent),
SensorsComponent::SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
PX4Component(uas, autopilot, parent),
_name(tr("Sensors"))
{
}
......
......@@ -35,7 +35,7 @@ class SensorsComponent : public PX4Component
Q_OBJECT
public:
SensorsComponent(UASInterface* uas, QObject* parent = NULL);
SensorsComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
// Virtuals from PX4Component
virtual const char** setupCompleteChangedTriggerList(void) const;
......
......@@ -25,13 +25,18 @@
/// @author Don Gagne <don@thegagnes.com>
#include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
VehicleComponent::VehicleComponent(UASInterface* uas, QObject* parent) :
VehicleComponent::VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent) :
QObject(parent),
_uas(uas),
_paramMgr(_uas->getParamManager())
_autopilot(autopilot)
{
Q_ASSERT(uas);
Q_ASSERT(autopilot);
_paramMgr = _uas->getParamManager();
Q_ASSERT(_paramMgr);
}
VehicleComponent::~VehicleComponent()
......
......@@ -21,6 +21,9 @@
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifndef VEHICLECOMPONENT_H
#define VEHICLECOMPONENT_H
......@@ -30,11 +33,10 @@
#include "UASInterface.h"
/// @file
/// @brief Vehicle Component class. A vehicle component is an object which
/// abstracts the physical portion of a vehicle into a set of
class AutoPilotPlugin;
/// A vehicle component is an object which abstracts the physical portion of a vehicle into a set of
/// configurable values and user interface.
/// @author Don Gagne <don@thegagnes.com>
class VehicleComponent : public QObject
{
......@@ -50,7 +52,7 @@ class VehicleComponent : public QObject
Q_PROPERTY(QVariantList summaryItems READ summaryItems CONSTANT);
public:
VehicleComponent(UASInterface* uas, QObject* parent = NULL);
VehicleComponent(UASInterface* uas, AutoPilotPlugin* autopilot, QObject* parent = NULL);
~VehicleComponent();
virtual QString name(void) const = 0;
......@@ -70,6 +72,7 @@ signals:
protected:
UASInterface* _uas;
AutoPilotPlugin* _autopilot;
QGCUASParamManagerInterface* _paramMgr;
};
......
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