mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-357 Config gadget now checks whether the autopilot is connected already when it is instanciated.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@3114 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
ae32af82b1
commit
89061ac606
@ -91,7 +91,10 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
||||||
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
||||||
|
|
||||||
// *********************
|
// And check whether by any chance we are not already connected
|
||||||
|
if (telMngr->isConnected())
|
||||||
|
onAutopilotConnect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigGadgetWidget::~ConfigGadgetWidget()
|
ConfigGadgetWidget::~ConfigGadgetWidget()
|
||||||
|
@ -30,7 +30,8 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/threadmanager.h>
|
#include <coreplugin/threadmanager.h>
|
||||||
|
|
||||||
TelemetryManager::TelemetryManager()
|
TelemetryManager::TelemetryManager() :
|
||||||
|
autopilotConnected(false)
|
||||||
{
|
{
|
||||||
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
|
||||||
// Get UAVObjectManager instance
|
// Get UAVObjectManager instance
|
||||||
@ -46,6 +47,11 @@ TelemetryManager::~TelemetryManager()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TelemetryManager::isConnected()
|
||||||
|
{
|
||||||
|
return autopilotConnected;
|
||||||
|
}
|
||||||
|
|
||||||
void TelemetryManager::start(QIODevice *dev)
|
void TelemetryManager::start(QIODevice *dev)
|
||||||
{
|
{
|
||||||
device=dev;
|
device=dev;
|
||||||
@ -78,10 +84,12 @@ void TelemetryManager::onStop()
|
|||||||
|
|
||||||
void TelemetryManager::onConnect()
|
void TelemetryManager::onConnect()
|
||||||
{
|
{
|
||||||
|
autopilotConnected = true;
|
||||||
emit connected();
|
emit connected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TelemetryManager::onDisconnect()
|
void TelemetryManager::onDisconnect()
|
||||||
{
|
{
|
||||||
|
autopilotConnected = false;
|
||||||
emit disconnected();
|
emit disconnected();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
void start(QIODevice *dev);
|
void start(QIODevice *dev);
|
||||||
void stop();
|
void stop();
|
||||||
|
bool isConnected();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
@ -65,6 +66,7 @@ private:
|
|||||||
Telemetry* telemetry;
|
Telemetry* telemetry;
|
||||||
TelemetryMonitor* telemetryMon;
|
TelemetryMonitor* telemetryMon;
|
||||||
QIODevice *device;
|
QIODevice *device;
|
||||||
|
bool autopilotConnected;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TELEMETRYMANAGER_H
|
#endif // TELEMETRYMANAGER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user