summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-18 10:23:11 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-08-18 10:23:11 (GMT)
commit67859e5a1632bab93bd03c252cf23a736d0f551c (patch)
treeafea9f9ddf707582c1b0f5a9fa08575452f18088
parentef6adfc39283bb21fc81469b6b14dc509fffd8ff (diff)
Use a boolean to know whether ekos is running or not besides communication status flag
-rw-r--r--kstars/ekos/ekosmanager.cpp21
-rw-r--r--kstars/ekos/ekosmanager.h2
2 files changed, 8 insertions, 15 deletions
diff --git a/kstars/ekos/ekosmanager.cpp b/kstars/ekos/ekosmanager.cpp
index 06e237f..540040d 100644
--- a/kstars/ekos/ekosmanager.cpp
+++ b/kstars/ekos/ekosmanager.cpp
@@ -59,6 +59,7 @@ EkosManager::EkosManager()
nConnectedDevices=0;
useGuideHead =false;
useST4 =false;
+ isStarted = false;
remoteManagerStart=false;
indiConnectionStatus = EKOS_STATUS_IDLE;
@@ -288,17 +289,16 @@ void EkosManager::reset()
if (guidePI)
guidePI->stopAnimation();
+ isStarted = false;
processINDIB->setText(i18n("Start INDI"));
}
void EkosManager::processINDI()
{
- if (ekosStartingStatus == EKOS_STATUS_SUCCESS || ekosStartingStatus == EKOS_STATUS_PENDING)
- {
- stop();
- }
- else
+ if (isStarted == false)
start();
+ else
+ stop();
}
bool EkosManager::stop()
@@ -480,9 +480,7 @@ bool EkosManager::start()
appendLogText(i18n("INDI services started on port %1. Please connect devices.", managedDrivers.first()->getPort()));
-
QTimer::singleShot(MAX_LOCAL_INDI_TIMEOUT, this, SLOT(checkINDITimeout()));
-
}
else
{
@@ -534,7 +532,6 @@ bool EkosManager::start()
appendLogText(i18n("INDI services started. Connection to remote INDI server is successful. Waiting for devices..."));
QTimer::singleShot(MAX_REMOTE_INDI_TIMEOUT, this, SLOT(checkINDITimeout()));
-
}
connectB->setEnabled(false);
@@ -543,6 +540,7 @@ bool EkosManager::start()
profileGroup->setEnabled(false);
+ isStarted = true;
processINDIB->setText(i18n("Stop INDI"));
return true;
@@ -653,7 +651,7 @@ void EkosManager::processServerTermination(const QString &host, const QString &p
void EkosManager::cleanDevices(bool stopDrivers)
{
- if (ekosStartingStatus != EKOS_STATUS_SUCCESS)
+ if (ekosStartingStatus == EKOS_STATUS_IDLE)
return;
INDIListener::Instance()->disconnect(this);
@@ -682,11 +680,6 @@ void EkosManager::cleanDevices(bool stopDrivers)
reset();
- processINDIB->setText(i18n("Start INDI"));
- processINDIB->setEnabled(true);
- connectB->setEnabled(false);
- disconnectB->setEnabled(false);
- controlPanelB->setEnabled(false);
profileGroup->setEnabled(true);
appendLogText(i18n("INDI services stopped."));
diff --git a/kstars/ekos/ekosmanager.h b/kstars/ekos/ekosmanager.h
index 55740ad..9265727 100644
--- a/kstars/ekos/ekosmanager.h
+++ b/kstars/ekos/ekosmanager.h
@@ -250,7 +250,7 @@ private slots:
Ekos::Weather *weatherProcess;
Ekos::DustCap *dustCapProcess;
- bool localMode, remoteManagerStart;
+ bool localMode, isStarted, remoteManagerStart;
int nDevices, nRemoteDevices;
QAtomicInt nConnectedDevices;