1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-30 08: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:
edouard 2011-03-31 20:48:43 +00:00 committed by edouard
parent ae32af82b1
commit 89061ac606
3 changed files with 15 additions and 2 deletions

View File

@ -91,7 +91,10 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
// *********************
// And check whether by any chance we are not already connected
if (telMngr->isConnected())
onAutopilotConnect();
}
ConfigGadgetWidget::~ConfigGadgetWidget()

View File

@ -30,7 +30,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/threadmanager.h>
TelemetryManager::TelemetryManager()
TelemetryManager::TelemetryManager() :
autopilotConnected(false)
{
moveToThread(Core::ICore::instance()->threadManager()->getRealTimeThread());
// Get UAVObjectManager instance
@ -46,6 +47,11 @@ TelemetryManager::~TelemetryManager()
{
}
bool TelemetryManager::isConnected()
{
return autopilotConnected;
}
void TelemetryManager::start(QIODevice *dev)
{
device=dev;
@ -78,10 +84,12 @@ void TelemetryManager::onStop()
void TelemetryManager::onConnect()
{
autopilotConnected = true;
emit connected();
}
void TelemetryManager::onDisconnect()
{
autopilotConnected = false;
emit disconnected();
}

View File

@ -46,6 +46,7 @@ public:
void start(QIODevice *dev);
void stop();
bool isConnected();
signals:
void connected();
@ -65,6 +66,7 @@ private:
Telemetry* telemetry;
TelemetryMonitor* telemetryMon;
QIODevice *device;
bool autopilotConnected;
};
#endif // TELEMETRYMANAGER_H