summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 20:11:43 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 20:11:43 (GMT)
commit08f535009a8530e07274d08abb334e132b057b46 (patch)
tree4bb038706fb3c5d24b8de5d35c6234ce357f0fdf
parent83e46709c1209d3aaed257c22a18976dbe25334d (diff)
More reliable way of checking if Ekos devices are connected
-rw-r--r--kstars/ekos/ekosmanager.cpp43
-rw-r--r--kstars/ekos/ekosmanager.h2
2 files changed, 26 insertions, 19 deletions
diff --git a/kstars/ekos/ekosmanager.cpp b/kstars/ekos/ekosmanager.cpp
index cba605e..366c8e5 100644
--- a/kstars/ekos/ekosmanager.cpp
+++ b/kstars/ekos/ekosmanager.cpp
@@ -57,7 +57,7 @@ EkosManager::EkosManager(QWidget *parent) : QDialog(parent)
setWindowIcon(QIcon::fromTheme("kstars_ekos", QIcon(":/icons/breeze/default/kstars_ekos.svg")));
nDevices=0;
- nConnectedDevices=0;
+ //nConnectedDevices=0;
useGuideHead =false;
useST4 =false;
isStarted = false;
@@ -247,7 +247,7 @@ void EkosManager::loadDrivers()
void EkosManager::reset()
{
nDevices=0;
- nConnectedDevices=0;
+ //nConnectedDevices=0;
nRemoteDevices=0;
useGuideHead = false;
@@ -626,7 +626,6 @@ void EkosManager::checkINDITimeout()
void EkosManager::connectDevices()
{
-
indiConnectionStatus = EKOS_STATUS_PENDING;
foreach(ISD::GDInterface *device, genericDevices)
@@ -726,21 +725,29 @@ void EkosManager::deviceConnected()
processINDIB->setEnabled(false);
- nConnectedDevices++;
-
if (Options::verboseLogging())
{
ISD::GDInterface *device = (ISD::GDInterface *) sender();
- qDebug() << device->getDeviceName() << " is connected.";
- qDebug() << "Managed Devices: " << managedDrivers.count() << " Remote Devices: " << nRemoteDevices;
- qDebug() << "Connected Devices: " << nConnectedDevices << " nDevices: " << nDevices;
+ qDebug() << "Ekos: " << device->getDeviceName() << " is connected.";
+ //qDebug() << "Managed Devices: " << managedDrivers.count() << " Remote Devices: " << nRemoteDevices;
+ //qDebug() << "Connected Devices: " << nConnectedDevices << " nDevices: " << nDevices;
}
ProfileInfo *pi = getCurrentProfile();
//if (nConnectedDevices == managedDrivers.count() || (nDevices <=0 && nConnectedDevices == nRemoteDevices))
+
+ int nConnectedDevices=0;
+ foreach(ISD::GDInterface *device, genericDevices)
+ {
+ if (device->isConnected())
+ nConnectedDevices++;
+ }
+
if (nConnectedDevices >= pi->drivers.count())
indiConnectionStatus = EKOS_STATUS_SUCCESS;
+ qDebug() << "Ekos: " << nConnectedDevices << " devices connected out of " << genericDevices.count();
+
ISD::GDInterface *dev = static_cast<ISD::GDInterface *> (sender());
if (dev->getBaseDevice()->getDriverInterface() & INDI::BaseDevice::TELESCOPE_INTERFACE)
@@ -794,21 +801,21 @@ void EkosManager::deviceDisconnected()
indiConnectionStatus = EKOS_STATUS_PENDING;
else
indiConnectionStatus = EKOS_STATUS_IDLE;
+
+ if (Options::verboseLogging())
+ {
+ qDebug() << "Ekos: " << dev->getDeviceName() << " is disconnected.";
+ //qDebug() << "Connected Devices: " << nConnectedDevices << " nDevices: " << nDevices;
+ }
}
else
indiConnectionStatus = EKOS_STATUS_IDLE;
- if (Options::verboseLogging())
- {
- qDebug() << dev->getDeviceName() << " is disconnected.";
- qDebug() << "Connected Devices: " << nConnectedDevices << " nDevices: " << nDevices;
- }
-
- if (indiConnectionStatus == EKOS_STATUS_IDLE)
- nConnectedDevices--;
+ //if (indiConnectionStatus == EKOS_STATUS_IDLE)
+ //nConnectedDevices--;
- if (nConnectedDevices < 0)
- nConnectedDevices = 0;
+ //if (nConnectedDevices < 0)
+ //nConnectedDevices = 0;
connectB->setEnabled(true);
disconnectB->setEnabled(false);
diff --git a/kstars/ekos/ekosmanager.h b/kstars/ekos/ekosmanager.h
index d5bdbcc..e0c353e 100644
--- a/kstars/ekos/ekosmanager.h
+++ b/kstars/ekos/ekosmanager.h
@@ -254,7 +254,7 @@ private slots:
bool localMode, isStarted, remoteManagerStart;
int nDevices, nRemoteDevices;
- QAtomicInt nConnectedDevices;
+ //QAtomicInt nConnectedDevices;
QStringList logText;
KPageWidgetItem *ekosOption;