Commit 294c0a45 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Add scheduler DBUS Interface. Update API documentation

parent 5c95faf1
......@@ -102,6 +102,9 @@ The "model" is encapsulated in the KStarsData class, and the "view" is encapsula
<li>\ref MountDBusInterface "Mount Module DBus Interface"</li>
<li>\ref GuideDBusInterface "Guide Module DBus Interface"</li>
<li>\ref AlignDBusInterface "Align Module DBus Interface"</li>
<li>\ref SchedulerDBusInterface "Scheduler Module DBus Interface"</li>
<li>\ref DomeDBusInterface "Dome DBus Interface"</li>
<li>\ref DustCapDBusInterface "Dust Cap DBus Interface"</li>
</ul>
- \ref ScriptBuilder Script builder
......
......@@ -528,6 +528,7 @@ qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Mount.xml ekos/mount.h Ekos
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Dome.xml ekos/dome.h Ekos::Dome)
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Weather.xml ekos/weather.h Ekos::Weather)
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.DustCap.xml ekos/dustcap.h Ekos::DustCap)
qt5_add_dbus_adaptor(kstars_SRCS org.kde.kstars.Ekos.Scheduler.xml ekos/scheduler.h Ekos::Scheduler)
endif(INDI_FOUND)
kconfig_add_kcfg_files(kstars_SRCS ${kstars_KCFG_SRCS})
......
......@@ -21,6 +21,7 @@
#include <KLocalizedString>
#include <KNotifications/KNotification>
#include "scheduleradaptor.h"
#include "dialogs/finddialog.h"
#include "ekosmanager.h"
#include "kstars.h"
......@@ -62,6 +63,9 @@ Scheduler::Scheduler()
{
setupUi(this);
new SchedulerAdaptor(this);
QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Scheduler", this);
dirPath = QDir::homePath();
state = SCHEDULER_IDLE;
ekosState = EKOS_IDLE;
......@@ -4095,6 +4099,14 @@ bool Scheduler::createJobSequence(XMLEle *root, const QString &prefix, const QSt
}
void Scheduler::resetAllJobs()
{
if (state == SCHEDULER_RUNNIG)
return;
foreach(SchedulerJob *job, jobs)
job->setState(SchedulerJob::JOB_IDLE);
}
}
......
......@@ -38,6 +38,7 @@ namespace Ekos
class Scheduler : public QWidget, public Ui::Scheduler
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Scheduler")
public:
typedef enum { SCHEDULER_IDLE, SCHEDULER_STARTUP, SCHEDULER_RUNNIG, SCHEDULER_SHUTDOWN, SCHEDULER_ABORTED } SchedulerState;
......@@ -103,16 +104,6 @@ public:
*/
void setGOTOMode(Align::GotoMode mode);
/**
* @brief start Start scheduler main loop and evaluate jobs and execute them accordingly
*/
void start();
/**
* @brief stop Stop the scheduler
*/
void stop();
/**
* @brief findAltitude Find altitude given a specific time
* @param target Target
......@@ -121,6 +112,37 @@ public:
*/
static double findAltitude(const SkyPoint & target, const QDateTime when);
/** @defgroup SchedulerDBusInterface Ekos DBus Interface - Scheduler Module
* Ekos::Align interface provides primary functions to run and stop the scheduler.
*/
/*@{*/
/** DBUS interface function.
* @brief Start the scheduler main loop and evaluate jobs and execute them accordingly.
*/
Q_SCRIPTABLE Q_NOREPLY void start();
/** DBUS interface function.
* @brief Stop the scheduler.
*/
Q_SCRIPTABLE Q_NOREPLY void stop();
/** DBUS interface function.
* @brief Loads the Ekos Scheduler List (.esl) file.
* @param fileURL path to a file
* @return true if loading file is successful, false otherwise.
*/
Q_SCRIPTABLE bool loadScheduler(const QUrl &fileURL);
/** DBUS interface function.
* @brief Resets all jobs to IDLE
*/
Q_SCRIPTABLE void resetAllJobs();
/** @}*/
protected slots:
/**
......@@ -394,21 +416,14 @@ private:
/**
* @brief saveScheduler Save scheduler jobs to a file
* @param path path of a file
* @return
*/
bool saveScheduler(const QUrl &fileURL);
/**
* @brief loadScheduler Load scheduler from a file
* @param path path to a file
* @return
* @return true on success, false on failure.
*/
bool loadScheduler(const QUrl &fileURL);
bool saveScheduler(const QUrl &fileURL);
/**
* @brief processJobInfo Process the job information from a scheduler file and populate jobs accordingly
* @param root XML root element of JOB
* @return
* @return true on success, false on failure.
*/
bool processJobInfo(XMLEle *root);
......
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kstars.Ekos.Scheduler">
<method name="start">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="stop">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="loadScheduler">
<arg name="fileURL" type="s" direction="in"/>
<arg type="b" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QUrl"/>
</method>
<method name="resetAllJobs">
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
</interface>
</node>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment