[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars] kstars/ekos: STATUS_PENDING is reserved in Windows so we are using different enum values
From:       Jasem Mutlaq <null () kde ! org>
Date:       2018-09-16 7:13:58
Message-ID: E1g1RFm-0006pg-4Y () code ! kde ! org
[Download RAW message or body]

Git commit f928a5d923e7ad08ae905c3a523387af8cd90454 by Jasem Mutlaq.
Committed on 16/09/2018 at 07:13.
Pushed by mutlaqja into branch 'master'.

STATUS_PENDING is reserved in Windows so we are using different enum values

M  +8    -3    kstars/ekos/ekos.h
M  +13   -13   kstars/ekos/ekoslive/message.cpp
M  +20   -20   kstars/ekos/manager.cpp
M  +2    -2    kstars/ekos/manager.h
M  +20   -20   kstars/ekos/scheduler/scheduler.cpp
M  +2    -2    kstars/ekos/scheduler/scheduler.h

https://commits.kde.org/kstars/f928a5d923e7ad08ae905c3a523387af8cd90454

diff --git a/kstars/ekos/ekos.h b/kstars/ekos/ekos.h
index 0d372514e..bd3d768aa 100644
--- a/kstars/ekos/ekos.h
+++ b/kstars/ekos/ekos.h
@@ -143,6 +143,8 @@ typedef enum
     FILTER_AUTOFOCUS
 } FilterState;
 
+const QString &getFilterStatusString(FilterState state);
+
 // Scheduler states
 
 const QString &getSchedulerStatusString(AlignState state);
@@ -159,12 +161,15 @@ typedef enum {
     SCHEDULER_ABORTED
 } SchedulerState;
 
-const QString &getFilterStatusString(FilterState state);
+typedef enum {
+    Idle,
+    Pending,
+    Success,
+    Error
+} CommunicationStatus;
 
 std::vector<double> gsl_polynomial_fit(const double *const data_x, const double \
*const data_y, const int n,  const int order, double &chisq);
-
-enum CommunicationStatus { STATUS_IDLE, STATUS_PENDING, STATUS_SUCCESS, STATUS_ERROR \
};  }
 
 // Communication Status
diff --git a/kstars/ekos/ekoslive/message.cpp b/kstars/ekos/ekoslive/message.cpp
index c72936d4b..4dd4a6a0b 100644
--- a/kstars/ekos/ekoslive/message.cpp
+++ b/kstars/ekos/ekoslive/message.cpp
@@ -127,7 +127,7 @@ void Message::onTextReceived(const QString &message)
     else if (command.startsWith("profile_"))
         processProfileCommands(command, payload);
 
-    if (m_Manager->getEkosStartingStatus() != Ekos::STATUS_SUCCESS)
+    if (m_Manager->getEkosStartingStatus() != Ekos::Success)
         return;
 
     if (command == commands[GET_STATES])
@@ -191,7 +191,7 @@ void Message::sendCameras()
 
 void Message::sendMounts()
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QJsonArray mountList;
@@ -228,7 +228,7 @@ void Message::sendMounts()
 void Message::sendScopes()
 {
     if (m_isConnected == false ||
-            m_Manager->getEkosStartingStatus() != Ekos::STATUS_SUCCESS ||
+            m_Manager->getEkosStartingStatus() != Ekos::Success ||
             m_Manager->mountModule() == nullptr)
         return;
 
@@ -250,7 +250,7 @@ void Message::sendTemperature(double value)
 
 void Message::sendFilterWheels()
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QJsonArray filterList;
@@ -443,7 +443,7 @@ void Message::processAlignCommands(const QString &command, const \
QJsonObject &pa  
 void Message::setAlignStatus(Ekos::AlignState newState)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QJsonObject alignState = {
@@ -455,7 +455,7 @@ void Message::setAlignStatus(Ekos::AlignState newState)
 
 void Message::setAlignSolution(const QJsonObject &solution)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QJsonObject alignState = {
@@ -522,7 +522,7 @@ void Message::processPolarCommands(const QString &command, const \
QJsonObject &pa  
 void Message::setPAHStage(Ekos::Align::PAHStage stage)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     Q_UNUSED(stage);
@@ -542,7 +542,7 @@ void Message::setPAHStage(Ekos::Align::PAHStage stage)
 
 void Message::setPAHMessage(const QString &message)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QTextDocument doc;
@@ -556,7 +556,7 @@ void Message::setPAHMessage(const QString &message)
 
 void Message::setPolarResults(QLineF correctionVector, QString polarError)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     this->correctionVector = correctionVector;
@@ -579,7 +579,7 @@ void Message::setPolarResults(QLineF correctionVector, QString \
polarError)  
 void Message::setPAHEnabled(bool enabled)
 {
-    if (m_isConnected == false || m_Manager->getEkosStartingStatus() != \
Ekos::STATUS_SUCCESS) +    if (m_isConnected == false || \
m_Manager->getEkosStartingStatus() != Ekos::Success)  return;
 
     QJsonObject polarState = {
@@ -618,12 +618,12 @@ void Message::sendProfiles()
 
 void Message::setEkosStatingStatus(Ekos::CommunicationStatus status)
 {
-    if (status == Ekos::STATUS_PENDING)
+    if (status == Ekos::Pending)
         return;
 
     QJsonObject connectionState = {
         {"connected", true},
-        {"online", status == Ekos::STATUS_SUCCESS}
+        {"online", status == Ekos::Success}
     };
     sendResponse(commands[NEW_CONNECTION_STATE], connectionState);
 }
@@ -691,7 +691,7 @@ void Message::sendConnection()
 
     QJsonObject connectionState = {
         {"connected", true},
-        {"online", m_Manager->getEkosStartingStatus() == Ekos::STATUS_SUCCESS}
+        {"online", m_Manager->getEkosStartingStatus() == Ekos::Success}
     };
     sendResponse(commands[NEW_CONNECTION_STATE], connectionState);
 }
diff --git a/kstars/ekos/manager.cpp b/kstars/ekos/manager.cpp
index 6ff9a6108..aa9c7f0e6 100644
--- a/kstars/ekos/manager.cpp
+++ b/kstars/ekos/manager.cpp
@@ -390,12 +390,12 @@ void Manager::reset()
     dustCapProcess.reset();
 
     Ekos::CommunicationStatus previousStatus = m_ekosStatus;
-    m_ekosStatus   = Ekos::STATUS_IDLE;
+    m_ekosStatus   = Ekos::Idle;
     if (previousStatus != m_ekosStatus)
         emit ekosStatusChanged(m_ekosStatus);
 
     previousStatus = m_indiStatus;
-    m_indiStatus = Ekos::STATUS_IDLE;
+    m_indiStatus = Ekos::Idle;
     if (previousStatus != m_indiStatus)
         emit indiStatusChanged(m_indiStatus);
 
@@ -683,7 +683,7 @@ bool Manager::start()
             INDIListener::Instance()->disconnect(this);
             qDeleteAll(managedDrivers);
             managedDrivers.clear();
-            m_ekosStatus = Ekos::STATUS_ERROR;
+            m_ekosStatus = Ekos::Error;
             emit ekosStatusChanged(m_ekosStatus);
             return false;
         }
@@ -691,7 +691,7 @@ bool Manager::start()
         connect(DriverManager::Instance(), \
SIGNAL(serverTerminated(QString,QString)), this,  \
SLOT(processServerTermination(QString,QString)));  
-        m_ekosStatus = Ekos::STATUS_PENDING;
+        m_ekosStatus = Ekos::Pending;
         emit ekosStatusChanged(m_ekosStatus);
 
         if (currentProfile->autoConnect)
@@ -743,7 +743,7 @@ bool Manager::start()
             INDIListener::Instance()->disconnect(this);
             qDeleteAll(managedDrivers);
             managedDrivers.clear();
-            m_ekosStatus = Ekos::STATUS_ERROR;
+            m_ekosStatus = Ekos::Error;
             emit ekosStatusChanged(m_ekosStatus);
             QApplication::restoreOverrideCursor();
             return false;
@@ -753,7 +753,7 @@ bool Manager::start()
                 SLOT(processServerTermination(QString,QString)));
 
         QApplication::restoreOverrideCursor();
-        m_ekosStatus = Ekos::STATUS_PENDING;
+        m_ekosStatus = Ekos::Pending;
         emit ekosStatusChanged(m_ekosStatus);
 
         appendLogText(
@@ -777,12 +777,12 @@ bool Manager::start()
 void Manager::checkINDITimeout()
 {
     // Don't check anything unless we're still pending
-    if (m_ekosStatus != Ekos::STATUS_PENDING)
+    if (m_ekosStatus != Ekos::Pending)
         return;
 
     if (nDevices <= 0)
     {
-        m_ekosStatus = Ekos::STATUS_SUCCESS;
+        m_ekosStatus = Ekos::Success;
         emit ekosStatusChanged(m_ekosStatus);
         return;
     }
@@ -848,7 +848,7 @@ void Manager::checkINDITimeout()
         }
     }
 
-    m_ekosStatus = Ekos::STATUS_ERROR;
+    m_ekosStatus = Ekos::Error;
 }
 
 void Manager::connectDevices()
@@ -865,12 +865,12 @@ void Manager::connectDevices()
     }
     if (genericDevices.count() == nConnected)
     {
-        m_indiStatus = Ekos::STATUS_SUCCESS;
+        m_indiStatus = Ekos::Success;
         emit indiStatusChanged(m_indiStatus);
         return;
     }
 
-    m_indiStatus = Ekos::STATUS_PENDING;
+    m_indiStatus = Ekos::Pending;
     if (previousStatus != m_indiStatus)
         emit indiStatusChanged(m_indiStatus);
 
@@ -908,7 +908,7 @@ void Manager::processServerTermination(const QString &host, const \
QString &port)  
 void Manager::cleanDevices(bool stopDrivers)
 {
-    if (m_ekosStatus == Ekos::STATUS_IDLE)
+    if (m_ekosStatus == Ekos::Idle)
         return;
 
     INDIListener::Instance()->disconnect(this);
@@ -957,7 +957,7 @@ void Manager::processNewDevice(ISD::GDInterface *devInterface)
     }
 
     // Always reset INDI Connection status if we receive a new device
-    m_indiStatus = Ekos::STATUS_IDLE;
+    m_indiStatus = Ekos::Idle;
     if (previousStatus != m_indiStatus)
         emit indiStatusChanged(m_indiStatus);
 
@@ -971,7 +971,7 @@ void Manager::processNewDevice(ISD::GDInterface *devInterface)
 
     if (nDevices <= 0)
     {
-        m_ekosStatus = Ekos::STATUS_SUCCESS;
+        m_ekosStatus = Ekos::Success;
         emit ekosStatusChanged(m_ekosStatus);
 
         connectB->setEnabled(true);
@@ -1015,11 +1015,11 @@ void Manager::deviceConnected()
     //if (nConnectedDevices >= pi->drivers.count())
     if (nConnectedDevices >= genericDevices.count())
     {
-        m_indiStatus = Ekos::STATUS_SUCCESS;
+        m_indiStatus = Ekos::Success;
         qCInfo(KSTARS_EKOS)<< "All INDI devices are now connected.";
     }
     else
-        m_indiStatus = Ekos::STATUS_PENDING;
+        m_indiStatus = Ekos::Pending;
 
     if (previousStatus != m_indiStatus)
         emit indiStatusChanged(m_indiStatus);
@@ -1085,11 +1085,11 @@ void Manager::deviceDisconnected()
     if (dev != nullptr)
     {
         if (dev->getState("CONNECTION") == IPS_ALERT)
-            m_indiStatus = Ekos::STATUS_ERROR;
+            m_indiStatus = Ekos::Error;
         else if (dev->getState("CONNECTION") == IPS_BUSY)
-            m_indiStatus = Ekos::STATUS_PENDING;
+            m_indiStatus = Ekos::Pending;
         else
-            m_indiStatus = Ekos::STATUS_IDLE;
+            m_indiStatus = Ekos::Idle;
 
         if (Options::verboseLogging())
             qCDebug(KSTARS_EKOS) << dev->getDeviceName() << " is disconnected.";
@@ -1097,7 +1097,7 @@ void Manager::deviceDisconnected()
         appendLogText(i18n("%1 is disconnected.", dev->getDeviceName()));
     }
     else
-        m_indiStatus = Ekos::STATUS_IDLE;
+        m_indiStatus = Ekos::Idle;
 
     if (previousStatus != m_indiStatus)
         emit indiStatusChanged(m_indiStatus);
diff --git a/kstars/ekos/manager.h b/kstars/ekos/manager.h
index 3709838b2..d4fd1741d 100644
--- a/kstars/ekos/manager.h
+++ b/kstars/ekos/manager.h
@@ -323,8 +323,8 @@ class Manager : public QDialog, public Ui::Manager
     QStringList m_LogText;
     KPageWidgetItem *ekosOptionsWidget { nullptr };
 
-    CommunicationStatus m_ekosStatus { STATUS_IDLE };
-    CommunicationStatus m_indiStatus { STATUS_IDLE };
+    CommunicationStatus m_ekosStatus { Ekos::Idle };
+    CommunicationStatus m_indiStatus { Ekos::Idle };
 
     std::unique_ptr<QStandardItemModel> profileModel;
     QList<std::shared_ptr<ProfileInfo>> profiles;
diff --git a/kstars/ekos/scheduler/scheduler.cpp \
b/kstars/ekos/scheduler/scheduler.cpp index dc41048f6..83901129d 100644
--- a/kstars/ekos/scheduler/scheduler.cpp
+++ b/kstars/ekos/scheduler/scheduler.cpp
@@ -2246,7 +2246,7 @@ bool Scheduler::checkEkosState()
             // Even if state is IDLE, check if Ekos is already started. If not, \
start it.  QDBusReply<int> isEkosStarted;
             isEkosStarted = ekosInterface->call(QDBus::AutoDetect, \
                "getEkosStartingStatus");
-            if (isEkosStarted.value() == Ekos::STATUS_SUCCESS)
+            if (isEkosStarted.value() == Ekos::Success)
             {
                 ekosState = EKOS_READY;
                 return true;
@@ -2261,7 +2261,7 @@ bool Scheduler::checkEkosState()
                 return false;
             }
 #endif
-            if (m_EkosCommunicationStatus == STATUS_SUCCESS)
+            if (m_EkosCommunicationStatus == Ekos::Success)
             {
                 ekosState = EKOS_READY;
                 return true;
@@ -2279,13 +2279,13 @@ bool Scheduler::checkEkosState()
 
         case EKOS_STARTING:
         {
-            if (m_EkosCommunicationStatus == STATUS_SUCCESS)
+            if (m_EkosCommunicationStatus == Ekos::Success)
             {
                 appendLogText(i18n("Ekos started."));
                 ekosState = EKOS_READY;
                 return true;
             }
-            else if (m_EkosCommunicationStatus == STATUS_ERROR)
+            else if (m_EkosCommunicationStatus == ERROR)
             {
                 if (ekosConnectFailureCount++ < MAX_FAILURE_ATTEMPTS)
                 {
@@ -2315,13 +2315,13 @@ bool Scheduler::checkEkosState()
 #if 0
             QDBusReply<int> isEkosStarted;
             isEkosStarted = ekosInterface->call(QDBus::AutoDetect, \
                "getEkosStartingStatus");
-            if (isEkosStarted.value() == Ekos::STATUS_SUCCESS)
+            if (isEkosStarted.value() == Ekos::Success)
             {
                 appendLogText(i18n("Ekos started."));
                 ekosState = EKOS_READY;
                 return true;
             }
-            else if (isEkosStarted.value() == Ekos::STATUS_ERROR)
+            else if (isEkosStarted.value() == Ekos::Error)
             {
                 if (ekosConnectFailureCount++ < MAX_FAILURE_ATTEMPTS)
                 {
@@ -2354,7 +2354,7 @@ bool Scheduler::checkEkosState()
 
         case EKOS_STOPPING:
         {
-            if (m_EkosCommunicationStatus == Ekos::STATUS_IDLE)
+            if (m_EkosCommunicationStatus == Ekos::Idle)
             {
                 appendLogText(i18n("Ekos stopped."));
                 ekosState = EKOS_IDLE;
@@ -2363,7 +2363,7 @@ bool Scheduler::checkEkosState()
 #if 0
             QDBusReply<int> isEkosStarted;
             isEkosStarted = ekosInterface->call(QDBus::AutoDetect, \
                "getEkosStartingStatus");
-            if (isEkosStarted.value() == Ekos::STATUS_IDLE)
+            if (isEkosStarted.value() == Ekos::Idle)
             {
                 appendLogText(i18n("Ekos stopped."));
                 ekosState = EKOS_IDLE;
@@ -2382,13 +2382,13 @@ bool Scheduler::checkEkosState()
 
 bool Scheduler::isINDIConnected()
 {
-    return (m_INDICommunicationStatus == Ekos::STATUS_SUCCESS);
+    return (m_INDICommunicationStatus == Ekos::Success);
 #if 0
     QDBusReply<int> isINDIConnected = ekosInterface->call(QDBus::AutoDetect, \
"getINDIConnectionStatus");  
     if (isINDIConnected.error().type() != QDBusError::NoError)
         return false;
-    else if (isINDIConnected.value() == Ekos::STATUS_SUCCESS)
+    else if (isINDIConnected.value() == Ekos::Success)
         return true;
     else // ERROR or IDLE
         return false;
@@ -2406,7 +2406,7 @@ bool Scheduler::checkINDIState()
     {
         case INDI_IDLE:
         {
-            if (m_INDICommunicationStatus == Ekos::STATUS_SUCCESS)
+            if (m_INDICommunicationStatus == Ekos::Success)
             {
                 indiState = INDI_PROPERTY_CHECK;
 
@@ -2451,13 +2451,13 @@ bool Scheduler::checkINDIState()
 
         case INDI_CONNECTING:
         {
-            if (m_INDICommunicationStatus == Ekos::STATUS_SUCCESS)
+            if (m_INDICommunicationStatus == Ekos::Success)
             {
                 appendLogText(i18n("INDI devices connected."));
                 indiState = INDI_PROPERTY_CHECK;
                 return false;
             }
-            else if (m_INDICommunicationStatus == Ekos::STATUS_ERROR)
+            else if (m_INDICommunicationStatus == Ekos::Error)
             {
                 if (indiConnectFailureCount++ < MAX_FAILURE_ATTEMPTS)
                 {
@@ -2488,13 +2488,13 @@ bool Scheduler::checkINDIState()
                 return false;
 #if 0
             QDBusReply<int> isINDIConnected = ekosInterface->call(QDBus::AutoDetect, \
                "getINDIConnectionStatus");
-            if (isINDIConnected.value() == Ekos::STATUS_SUCCESS)
+            if (isINDIConnected.value() == Ekos::Success)
             {
                 appendLogText(i18n("INDI devices connected."));
                 indiState = INDI_PROPERTY_CHECK;
                 return false;
             }
-            else if (isINDIConnected.value() == Ekos::STATUS_ERROR)
+            else if (isINDIConnected.value() == Ekos::Error)
             {
                 if (indiConnectFailureCount++ < MAX_FAILURE_ATTEMPTS)
                 {
@@ -2528,7 +2528,7 @@ bool Scheduler::checkINDIState()
 
         case INDI_DISCONNECTING:
         {
-            if (m_INDICommunicationStatus == Ekos::STATUS_IDLE)
+            if (m_INDICommunicationStatus == Ekos::Idle)
             {
                 appendLogText(i18n("INDI devices disconnected."));
                 indiState = INDI_IDLE;
@@ -2536,7 +2536,7 @@ bool Scheduler::checkINDIState()
             }
 #if 0
             QDBusReply<int> isINDIConnected = ekosInterface->call(QDBus::AutoDetect, \
                "getINDIConnectionStatus");
-            if (isINDIConnected.value() == Ekos::STATUS_IDLE)
+            if (isINDIConnected.value() == Ekos::Idle)
             {
                 appendLogText(i18n("INDI devices disconnected."));
                 indiState = INDI_IDLE;
@@ -2643,8 +2643,8 @@ bool Scheduler::checkStartupState()
             // unless we do not have light frames, then we skip all
             //QDBusReply<int> isEkosStarted;
             //isEkosStarted = ekosInterface->call(QDBus::AutoDetect, \
                "getEkosStartingStatus");
-            //if (isEkosStarted.value() == Ekos::STATUS_SUCCESS)
-            if (m_EkosCommunicationStatus == Ekos::STATUS_SUCCESS)
+            //if (isEkosStarted.value() == Ekos::Success)
+            if (m_EkosCommunicationStatus == Ekos::Success)
             {
                 if (startupScriptURL.isEmpty() == false)
                     appendLogText(i18n("Ekos is already started, skipping startup \
script...")); @@ -3672,7 +3672,7 @@ bool Scheduler::manageConnectionLoss()
 
     // If Ekos is assumed to be up, check its state
     //QDBusReply<int> const isEkosStarted = ekosInterface->call(QDBus::AutoDetect, \
                "getEkosStartingStatus");
-    if (m_EkosCommunicationStatus == Ekos::STATUS_SUCCESS)
+    if (m_EkosCommunicationStatus == Ekos::Success)
     {
         qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Ekos is currently connected, \
checking INDI before mitigating connection loss.");  
diff --git a/kstars/ekos/scheduler/scheduler.h b/kstars/ekos/scheduler/scheduler.h
index 5436e7c72..c5a784d1e 100644
--- a/kstars/ekos/scheduler/scheduler.h
+++ b/kstars/ekos/scheduler/scheduler.h
@@ -659,8 +659,8 @@ class Scheduler : public QWidget, public Ui::Scheduler
     StartupState startupState { STARTUP_IDLE };
     ShutdownState shutdownState { SHUTDOWN_IDLE };
     ParkWaitStatus parkWaitState { PARKWAIT_IDLE };
-    Ekos::CommunicationStatus m_EkosCommunicationStatus { STATUS_IDLE };
-    Ekos::CommunicationStatus m_INDICommunicationStatus { STATUS_IDLE };
+    Ekos::CommunicationStatus m_EkosCommunicationStatus { Ekos::Idle };
+    Ekos::CommunicationStatus m_INDICommunicationStatus { Ekos::Idle };
     /// List of all jobs as entered by the user or file
     QList<SchedulerJob *> jobs;
     /// Active job


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic