Commit 2cfa58a6 authored by Don Gagne's avatar Don Gagne

pluginReady now supports disconnect signalling

parent 3df5bb48
...@@ -33,6 +33,14 @@ AutoPilotPlugin::AutoPilotPlugin(UASInterface* uas, QObject* parent) : ...@@ -33,6 +33,14 @@ AutoPilotPlugin::AutoPilotPlugin(UASInterface* uas, QObject* parent) :
_pluginReady(false) _pluginReady(false)
{ {
Q_ASSERT(_uas); Q_ASSERT(_uas);
connect(_uas, &UASInterface::disconnected, this, &AutoPilotPlugin::_uasDisconnected);
}
void AutoPilotPlugin::_uasDisconnected(void)
{
_pluginReady = false;
emit pluginReadyChanged(_pluginReady);
} }
void AutoPilotPlugin::refreshAllParameters(void) void AutoPilotPlugin::refreshAllParameters(void)
......
...@@ -51,8 +51,9 @@ class AutoPilotPlugin : public QObject ...@@ -51,8 +51,9 @@ class AutoPilotPlugin : public QObject
public: public:
AutoPilotPlugin(UASInterface* uas, QObject* parent); AutoPilotPlugin(UASInterface* uas, QObject* parent);
Q_PROPERTY(bool pluginReady READ pluginReady NOTIFY pluginReadyChanged) /// true: plugin is ready for use, plugin should no longer be used
Q_PROPERTY(bool pluginReady READ pluginReady NOTIFY pluginReadyChanged)
/// List of VehicleComponent objects /// List of VehicleComponent objects
Q_PROPERTY(QVariantList vehicleComponents READ vehicleComponents CONSTANT) Q_PROPERTY(QVariantList vehicleComponents READ vehicleComponents CONSTANT)
...@@ -100,17 +101,15 @@ public: ...@@ -100,17 +101,15 @@ public:
// Must be implemented by derived class // Must be implemented by derived class
virtual const QVariantList& vehicleComponents(void) = 0; virtual const QVariantList& vehicleComponents(void) = 0;
/// FIXME: Kind of hacky
static void clearStaticData(void); static void clearStaticData(void);
bool pluginReady(void) { return _pluginReady; }
UASInterface* uas(void) { return _uas; } UASInterface* uas(void) { return _uas; }
bool pluginReady(void) { return _pluginReady; }
signals: signals:
/// Signalled when plugin is ready for use /// Signalled when plugin is ready for use
void pluginReadyChanged(bool pluginReady); void pluginReadyChanged(bool pluginReady);
protected: protected:
/// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin /// All access to AutoPilotPugin objects is through getInstanceForAutoPilotPlugin
AutoPilotPlugin(QObject* parent = NULL) : QObject(parent) { } AutoPilotPlugin(QObject* parent = NULL) : QObject(parent) { }
...@@ -120,6 +119,9 @@ protected: ...@@ -120,6 +119,9 @@ protected:
UASInterface* _uas; UASInterface* _uas;
bool _pluginReady; bool _pluginReady;
private slots:
void _uasDisconnected(void);
}; };
#endif #endif
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