summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2015-06-29 11:13:38 +0300
committerJasem Mutlaq <[email protected]>2015-06-29 11:13:38 +0300
commit45e7a0e9d1a69aa7adad25527b2cf27a769fa598 (patch)
treea79bedda5691a9f1762c220cff56e976326fd07a
parentad6c2447851b0f870c07efdb5d874da91a7f6a8e (diff)
Adding two functions to capture module to clear sequence and obtain its status
-rw-r--r--kstars/ekos/capture.cpp54
-rw-r--r--kstars/ekos/capture.h11
-rw-r--r--kstars/org.kde.kstars.Ekos.Capture.xml6
3 files changed, 71 insertions, 0 deletions
diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index bd263fb..ecdc9fb 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -2389,6 +2389,60 @@ void Capture::setTemperature()
currentCCD->setTemperature(temperatureIN->value());
}
+void Capture::clearSequenceQueue()
+{
+ stopSequence();
+ queueTable->clearContents();
+ qDeleteAll(jobs);
+}
+
+QString Capture::getSequenceQueueStatus()
+{
+ if (jobs.count() == 0)
+ return "Invalid";
+
+ int idle=0, error=0, complete=0, aborted=0,running=0;
+
+ foreach(SequenceJob* job, jobs)
+ {
+ switch (job->getStatus())
+ {
+ case SequenceJob::JOB_ABORTED:
+ aborted++;
+ break;
+ case SequenceJob::JOB_BUSY:
+ running++;
+ break;
+ case SequenceJob::JOB_DONE:
+ complete++;
+ break;
+ case SequenceJob::JOB_ERROR:
+ error++;
+ break;
+ case SequenceJob::JOB_IDLE:
+ idle++;
+ break;
+ }
+ }
+
+ if (error > 0)
+ return "Error";
+
+ if (aborted > 0)
+ return "Aborted";
+
+ if (running > 0)
+ return "Running";
+
+ if (idle == jobs.count())
+ return "Idle";
+
+ if (complete == jobs.count())
+ return "Complete";
+
+ return "Invalid";
+}
+
void Capture::processTelescopeNumber(INumberVectorProperty *nvp)
{
// If it is not ours, return.
diff --git a/kstars/ekos/capture.h b/kstars/ekos/capture.h
index 15c6a6b..e66a8b4 100644
--- a/kstars/ekos/capture.h
+++ b/kstars/ekos/capture.h
@@ -225,6 +225,17 @@ public:
Q_SCRIPTABLE bool setFilter(QString device, int filterSlot);
/** DBUS interface function.
+ * Aborts any current jobs and remove all sequence queue jobs.
+ */
+ Q_SCRIPTABLE Q_NOREPLY void clearSequenceQueue();
+
+ /** DBUS interface function.
+ * Returns the overall sequence queue status. If there are no jobs pending, it returns "Invalid". If all jobs are idle, it returns "Idle". If all jobs are complete, it returns "Complete". If one or more jobs are aborted
+ * it returns "Aborted". If one or more jobs have errors, it returns "Error". If any jobs is under progress, returns "Running".
+ */
+ Q_SCRIPTABLE QString getSequenceQueueStatus();
+
+ /** DBUS interface function.
* Loads the Ekos Sequence Queue file in the Sequence Queue. Jobs are appended to existing jobs.
* @param fileURL full URL of the filename
*/
diff --git a/kstars/org.kde.kstars.Ekos.Capture.xml b/kstars/org.kde.kstars.Ekos.Capture.xml
index 23e09f4..0bf7cd1 100644
--- a/kstars/org.kde.kstars.Ekos.Capture.xml
+++ b/kstars/org.kde.kstars.Ekos.Capture.xml
@@ -21,6 +21,12 @@
<arg name="fileURL" type="s" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QUrl"/>
</method>
+ <method name="clearSequenceQueue">
+ <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
+ </method>
+ <method name="getSequenceQueueStatus">
+ <arg type="s" direction="out"/>
+ </method>
<method name="setMaximumGuidingDeviaiton">
<arg name="enable" type="b" direction="in"/>
<arg name="value" type="d" direction="in"/>