summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-24 20:13:04 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-24 20:13:04 (GMT)
commit030e4855899a29a859f6681048986a3d8aa09313 (patch)
treee4f83a3214a9a46f675f90562b7bd4f5cfc2d232
parentab7cc640d6fbf0d969b2c97fc59c908833c572b1 (diff)
Moving common Ekos files to the auxiliary directory for better organization
-rw-r--r--kstars/ekos/auxiliary/QProgressIndicator.cpp137
-rw-r--r--kstars/ekos/auxiliary/QProgressIndicator.h108
-rw-r--r--kstars/ekos/auxiliary/darklibrary.cpp282
-rw-r--r--kstars/ekos/auxiliary/darklibrary.h76
-rw-r--r--kstars/ekos/auxiliary/dome.cpp118
-rw-r--r--kstars/ekos/auxiliary/dome.h92
-rw-r--r--kstars/ekos/auxiliary/dustcap.cpp124
-rw-r--r--kstars/ekos/auxiliary/dustcap.h105
-rw-r--r--kstars/ekos/auxiliary/weather.cpp58
-rw-r--r--kstars/ekos/auxiliary/weather.h72
10 files changed, 1172 insertions, 0 deletions
diff --git a/kstars/ekos/auxiliary/QProgressIndicator.cpp b/kstars/ekos/auxiliary/QProgressIndicator.cpp
new file mode 100644
index 0000000..425dc57
--- /dev/null
+++ b/kstars/ekos/auxiliary/QProgressIndicator.cpp
@@ -0,0 +1,137 @@
+/*
+*
+* This file is part of QProgressIndicator,
+* an open-source recent files menu widget
+*
+* Copyright (C) 2009 - 2010 Morgan Leborgne
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+#include "QProgressIndicator.h"
+
+#include <QPainter>
+
+QProgressIndicator::QProgressIndicator(QWidget* parent)
+ : QWidget(parent),
+ m_angle(0),
+ m_timerId(-1),
+ m_delay(40),
+ m_displayedWhenStopped(false),
+ m_color(Qt::black)
+{
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ setFocusPolicy(Qt::NoFocus);
+}
+
+bool QProgressIndicator::isAnimated () const
+{
+ return (m_timerId != -1);
+}
+
+void QProgressIndicator::setDisplayedWhenStopped(bool state)
+{
+ m_displayedWhenStopped = state;
+
+ update();
+}
+
+bool QProgressIndicator::isDisplayedWhenStopped() const
+{
+ return m_displayedWhenStopped;
+}
+
+void QProgressIndicator::startAnimation()
+{
+ m_angle = 0;
+
+ if (m_timerId == -1)
+ m_timerId = startTimer(m_delay);
+}
+
+void QProgressIndicator::stopAnimation()
+{
+ if (m_timerId != -1)
+ killTimer(m_timerId);
+
+ m_timerId = -1;
+
+ update();
+}
+
+void QProgressIndicator::setAnimationDelay(int delay)
+{
+ if (m_timerId != -1)
+ killTimer(m_timerId);
+
+ m_delay = delay;
+
+ if (m_timerId != -1)
+ m_timerId = startTimer(m_delay);
+}
+
+void QProgressIndicator::setColor(const QColor & color)
+{
+ m_color = color;
+
+ update();
+}
+
+QSize QProgressIndicator::sizeHint() const
+{
+ return QSize(20,20);
+}
+
+int QProgressIndicator::heightForWidth(int w) const
+{
+ return w;
+}
+
+void QProgressIndicator::timerEvent(QTimerEvent * /*event*/)
+{
+ m_angle = (m_angle+30)%360;
+
+ update();
+}
+
+void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
+{
+ if (!m_displayedWhenStopped && !isAnimated())
+ return;
+
+ int width = qMin(this->width(), this->height());
+
+ QPainter p(this);
+ p.setRenderHint(QPainter::Antialiasing);
+
+ int outerRadius = (width-1)*0.5;
+ int innerRadius = (width-1)*0.5*0.38;
+
+ int capsuleHeight = outerRadius - innerRadius;
+ int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
+ int capsuleRadius = capsuleWidth/2;
+
+ for (int i=0; i<12; i++)
+ {
+ QColor color = m_color;
+ color.setAlphaF(1.0f - (i/12.0f));
+ p.setPen(Qt::NoPen);
+ p.setBrush(color);
+ p.save();
+ p.translate(rect().center());
+ p.rotate(m_angle - i*30.0f);
+ p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
+ p.restore();
+ }
+}
diff --git a/kstars/ekos/auxiliary/QProgressIndicator.h b/kstars/ekos/auxiliary/QProgressIndicator.h
new file mode 100644
index 0000000..5baaa77
--- /dev/null
+++ b/kstars/ekos/auxiliary/QProgressIndicator.h
@@ -0,0 +1,108 @@
+/*
+*
+* This file is part of QProgressIndicator,
+* an open-source recent files menu widget
+*
+* Copyright (C) 2009 - 2010 Morgan Leborgne
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+#ifndef QPROGRESSINDICATOR_H
+#define QPROGRESSINDICATOR_H
+
+#include <QWidget>
+#include <QColor>
+
+/*!
+ \class QProgressIndicator
+ \brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
+
+ Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
+ \sa QProgressBar
+*/
+class QProgressIndicator : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
+ Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+public:
+ explicit QProgressIndicator(QWidget* parent = 0);
+
+ /*! Returns the delay between animation steps.
+ \return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
+ \sa setAnimationDelay
+ */
+ int animationDelay() const { return m_delay; }
+
+ /*! Returns a Boolean value indicating whether the component is currently animated.
+ \return Animation state.
+ \sa startAnimation stopAnimation
+ */
+ bool isAnimated () const;
+
+ /*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
+ \return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
+ \sa setDisplayedWhenStopped
+ */
+ bool isDisplayedWhenStopped() const;
+
+ /*! Returns the color of the component.
+ \sa setColor
+ */
+ const QColor & color() const { return m_color; }
+
+ virtual QSize sizeHint() const;
+ int heightForWidth(int w) const;
+public slots:
+ /*! Starts the spin animation.
+ \sa stopAnimation isAnimated
+ */
+ void startAnimation();
+
+ /*! Stops the spin animation.
+ \sa startAnimation isAnimated
+ */
+ void stopAnimation();
+
+ /*! Sets the delay between animation steps.
+ Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller value speeds it up.
+ \param delay The delay, in milliseconds.
+ \sa animationDelay
+ */
+ void setAnimationDelay(int delay);
+
+ /*! Sets whether the component hides itself when it is not animating.
+ \param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true.
+ \sa isDisplayedWhenStopped
+ */
+ void setDisplayedWhenStopped(bool state);
+
+ /*! Sets the color of the components to the given color.
+ \sa color
+ */
+ void setColor(const QColor & color);
+protected:
+ virtual void timerEvent(QTimerEvent * event);
+ virtual void paintEvent(QPaintEvent * event);
+private:
+ int m_angle;
+ int m_timerId;
+ int m_delay;
+ bool m_displayedWhenStopped;
+ QColor m_color;
+};
+
+#endif // QPROGRESSINDICATOR_H
diff --git a/kstars/ekos/auxiliary/darklibrary.cpp b/kstars/ekos/auxiliary/darklibrary.cpp
new file mode 100644
index 0000000..b068cdb
--- /dev/null
+++ b/kstars/ekos/auxiliary/darklibrary.cpp
@@ -0,0 +1,282 @@
+/* Ekos Dark Library Handler
+ Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#include <QVariantMap>
+
+#include "darklibrary.h"
+#include "Options.h"
+
+#include "kstars.h"
+#include "kspaths.h"
+#include "kstarsdata.h"
+#include "fitsviewer/fitsview.h"
+#include "fitsviewer/fitsdata.h"
+#include "auxiliary/ksuserdb.h"
+
+namespace Ekos
+{
+
+DarkLibrary * DarkLibrary::_DarkLibrary = NULL;
+
+DarkLibrary * DarkLibrary::Instance()
+{
+ if (_DarkLibrary == NULL)
+ _DarkLibrary = new DarkLibrary(KStars::Instance());
+
+ return _DarkLibrary;
+}
+
+DarkLibrary::DarkLibrary(QObject *parent) : QObject(parent)
+{
+ KStarsData::Instance()->userdb()->GetAllDarkFrames(darkFrames);
+
+
+ subtractParams.duration=0;
+ subtractParams.offsetX=0;
+ subtractParams.offsetY=0;
+ subtractParams.targetChip=0;
+ subtractParams.targetImage=0;
+
+ QDir writableDir;
+ writableDir.mkdir(KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "darks");
+}
+
+DarkLibrary::~DarkLibrary()
+{
+ qDeleteAll(darkFiles);
+}
+
+FITSData * DarkLibrary::getDarkFrame(ISD::CCDChip *targetChip, double duration)
+{
+ foreach(QVariantMap map, darkFrames)
+ {
+ // First check CCD name matches
+ if (map["ccd"].toString() == targetChip->getCCD()->getDeviceName())
+ {
+ // Then check we are on the correct chip
+ if (map["chip"].toInt() == static_cast<int>(targetChip->getType()))
+ {
+ int binX, binY;
+ targetChip->getBinning(&binX, &binY);
+
+ // Then check if binning is the same
+ if (map["binX"].toInt() == binX && map["binY"].toInt() == binY)
+ {
+ // Then check for temperature
+ if (targetChip->getCCD()->hasCooler())
+ {
+ double temperature=0;
+ targetChip->getCCD()->getTemperature(&temperature);
+ // TODO make this configurable value, the threshold
+ if (fabs(map["temperature"].toDouble()-temperature) > Options::maxDarkTemperatureDiff())
+ continue;
+ }
+
+ // Then check for duration
+ // TODO make this value configurable
+ if (fabs(map["duration"].toDouble() - duration) > 0.05)
+ continue;
+
+ // Finaly check if the duration is acceptable
+ QDateTime frameTime = QDateTime::fromString(map["timestamp"].toString(), Qt::ISODate);
+ if (frameTime.daysTo(QDateTime::currentDateTime()) > Options::darkLibraryDuration())
+ continue;
+
+ QString filename = map["filename"].toString();
+
+ if (darkFiles.contains(filename))
+ return darkFiles[filename];
+
+ // Finally we made it, let's put it in the hash
+ bool rc = loadDarkFile(filename);
+ if (rc)
+ return darkFiles[filename];
+ else
+ return NULL;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+bool DarkLibrary::loadDarkFile(const QString &filename)
+{
+ FITSData *darkData = new FITSData();
+
+ bool rc = darkData->loadFITS(filename);
+
+ if (rc)
+ darkFiles[filename] = darkData;
+ else
+ {
+ emit newLog(i18n("Failed to load dark frame file %1", filename));
+ delete (darkData);
+ }
+
+ return rc;
+}
+
+bool DarkLibrary::saveDarkFile(FITSData *darkData)
+{
+ QDateTime ts = QDateTime::currentDateTime();
+
+ QString path = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "darks/darkframe_" + ts.toString(Qt::ISODate) + ".fits";
+
+ if (darkData->saveFITS(path) != 0)
+ return false;
+
+ darkFiles[path] = darkData;
+
+ QVariantMap map;
+ int binX, binY;
+ double temperature=0;
+
+ subtractParams.targetChip->getBinning(&binX, &binY);
+ subtractParams.targetChip->getCCD()->getTemperature(&temperature);
+
+ map["ccd"] = subtractParams.targetChip->getCCD()->getDeviceName();
+ map["chip"] = static_cast<int>(subtractParams.targetChip->getType());
+ map["binX"] = binX;
+ map["binY"] = binY;
+ map["temperature"] = temperature;
+ map["duration"] = subtractParams.duration;
+ map["filename"] = path;
+
+ darkFrames.append(map);
+
+ emit newLog(i18n("Dark frame saved to %1", path));
+
+ KStarsData::Instance()->userdb()->AddDarkFrame(map);
+
+ return true;
+}
+
+bool DarkLibrary::subtract(FITSData *darkData, FITSView *lightImage, FITSScale filter, uint16_t offsetX, uint16_t offsetY)
+{
+ Q_ASSERT(darkData);
+ Q_ASSERT(lightImage);
+
+ FITSData *lightData = lightImage->getImageData();
+
+ float *darkBuffer = darkData->getImageBuffer();
+ float *lightBuffer = lightData->getImageBuffer();
+
+ int darkoffset = offsetX + offsetY * darkData->getWidth();
+ int darkW = darkData->getWidth();
+
+ int lightOffset = 0;
+ int lightW = lightData->getWidth();
+ int lightH = lightData->getHeight();
+
+ for (int i=0; i < lightH; i++)
+ {
+ for (int j=0; j < lightW; j++)
+ {
+ lightBuffer[j+lightOffset] -= darkBuffer[j+darkoffset];
+ if (lightBuffer[j+lightOffset] < 0)
+ lightBuffer[j+lightOffset] = 0;
+ }
+
+ lightOffset += lightW;
+ darkoffset += darkW;
+ }
+
+ lightData->applyFilter(filter);
+ lightImage->rescale(ZOOM_KEEP_LEVEL);
+ lightImage->updateFrame();
+
+ emit darkFrameCompleted(true);
+
+ return true;
+}
+
+void DarkLibrary::captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY)
+{
+ QStringList shutterfulCCDs = Options::shutterfulCCDs();
+ QStringList shutterlessCCDs = Options::shutterlessCCDs();
+ QString deviceName = targetChip->getCCD()->getDeviceName();
+
+ bool hasShutter = shutterfulCCDs.contains(deviceName);
+ bool hasNoShutter = shutterlessCCDs.contains(deviceName);
+
+ // If no information is available either way, then ask the user
+ if (hasShutter == false && hasNoShutter == false)
+ {
+ if (KMessageBox::questionYesNo(NULL, i18n("Does %1 have mechanical or electronic shutter?", deviceName), i18n("Dark Exposure")) == KMessageBox::Yes)
+ {
+ hasShutter = true;
+ hasNoShutter = false;
+ shutterfulCCDs.append(deviceName);
+ Options::setShutterfulCCDs(shutterfulCCDs);
+ }
+ else
+ {
+ hasShutter = false;
+ hasNoShutter = true;
+ shutterlessCCDs.append(deviceName);
+ Options::setShutterlessCCDs(shutterlessCCDs);
+ }
+ }
+
+ if (hasNoShutter)
+ {
+ KMessageBox::information(NULL, i18n("Cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
+ }
+
+ targetChip->resetFrame();
+ targetChip->setCaptureMode(FITS_CALIBRATE);
+ targetChip->setFrameType(FRAME_DARK);
+
+ subtractParams.targetChip = targetChip;
+ subtractParams.targetImage= targetImage;
+ subtractParams.duration = duration;
+ subtractParams.offsetX = offsetX;
+ subtractParams.offsetY = offsetY;
+
+ connect(targetChip->getCCD(), SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
+
+ emit newLog(i18n("Capturing dark frame..."));
+
+ targetChip->capture(duration);
+}
+
+void DarkLibrary::newFITS(IBLOB *bp)
+{
+ INDI_UNUSED(bp);
+
+ Q_ASSERT(subtractParams.targetChip);
+
+ disconnect(subtractParams.targetChip->getCCD(), SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
+
+ FITSView *calibrationView = subtractParams.targetChip->getImage(FITS_CALIBRATE);
+
+ emit newLog(i18n("Dark frame received."));
+
+ FITSData *calibrationData = new FITSData();
+
+ // Deep copy of the data
+ if (calibrationData->loadFITS(calibrationView->getImageData()->getFilename()))
+ {
+ saveDarkFile(calibrationData);
+ subtract(calibrationData, subtractParams.targetImage, subtractParams.targetChip->getCaptureFilter(), subtractParams.offsetX, subtractParams.offsetY);
+ }
+ else
+ {
+ emit darkFrameCompleted(false);
+ emit newLog(i18n("Warning: Cannot load calibration file %1", calibrationView->getImageData()->getFilename()));
+ }
+}
+
+}
+
+
+
+
diff --git a/kstars/ekos/auxiliary/darklibrary.h b/kstars/ekos/auxiliary/darklibrary.h
new file mode 100644
index 0000000..67a4692
--- /dev/null
+++ b/kstars/ekos/auxiliary/darklibrary.h
@@ -0,0 +1,76 @@
+/* Ekos Dark Library Handler
+ Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef DARKLIBRARY_H
+#define DARKLIBRARY_H
+
+#include <QObject>
+#include "indi/indiccd.h"
+
+namespace Ekos
+{
+
+/**
+ *@class DarkLibrary
+ *@short Handles aquisition & loading of dark frames for cameras. If a suitable dark frame exists, it is loaded from disk, otherwise it gets captured and saved
+ * for later use.
+ *@author Jasem Mutlaq
+ *@version 1.0
+ */
+class DarkLibrary : public QObject
+{
+
+ Q_OBJECT
+
+public:
+
+ static DarkLibrary *Instance();
+
+ FITSData * getDarkFrame(ISD::CCDChip *targetChip, double duration);
+ bool subtract(FITSData *darkData, FITSView *lightImage, FITSScale filter, uint16_t offsetX, uint16_t offsetY);
+ void captureAndSubtract(ISD::CCDChip *targetChip, FITSView*targetImage, double duration, uint16_t offsetX, uint16_t offsetY);
+
+signals:
+ void darkFrameCompleted(bool);
+ void newLog(const QString &message);
+
+public slots:
+ /**
+ * @brief newFITS A new FITS blob is received by the CCD driver.
+ * @param bp pointer to blob data
+ */
+ void newFITS(IBLOB *bp);
+
+private:
+ DarkLibrary(QObject *parent);
+ ~DarkLibrary();
+ static DarkLibrary * _DarkLibrary;
+
+ bool loadDarkFile(const QString &filename);
+ bool saveDarkFile(FITSData *darkData);
+
+ QList<QVariantMap> darkFrames;
+ QHash<QString, FITSData *> darkFiles;
+
+ struct
+ {
+ ISD::CCDChip *targetChip;
+ double duration;
+ uint16_t offsetX;
+ uint16_t offsetY;
+ FITSView *targetImage;
+ FITSScale filter;
+ } subtractParams;
+
+
+};
+
+}
+
+#endif // DARKLIBRARY_H
diff --git a/kstars/ekos/auxiliary/dome.cpp b/kstars/ekos/auxiliary/dome.cpp
new file mode 100644
index 0000000..7e9c1a3
--- /dev/null
+++ b/kstars/ekos/auxiliary/dome.cpp
@@ -0,0 +1,118 @@
+/* Ekos
+ Copyright (C) 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#include "dome.h"
+#include "ekosmanager.h"
+#include "kstars.h"
+#include "domeadaptor.h"
+
+#include <basedevice.h>
+
+
+namespace Ekos
+{
+
+Dome::Dome()
+{
+ new DomeAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Dome", this);
+
+ currentDome = NULL;
+}
+
+Dome::~Dome()
+{
+
+}
+
+void Dome::setDome(ISD::GDInterface *newDome)
+{
+ currentDome = static_cast<ISD::Dome *>(newDome);
+}
+
+bool Dome::canPark()
+{
+ if (currentDome == NULL)
+ return false;
+
+ return currentDome->canPark();
+}
+
+bool Dome::park()
+{
+ if (currentDome == NULL || currentDome->canPark() == false)
+ return false;
+
+ return currentDome->Park();
+}
+
+bool Dome::unpark()
+{
+ if (currentDome == NULL || currentDome->canPark() == false)
+ return false;
+
+ return currentDome->UnPark();
+}
+
+bool Dome::abort()
+{
+ if (currentDome == NULL)
+ return false;
+
+ return currentDome->Abort();
+}
+
+bool Dome::isMoving()
+{
+ if (currentDome == NULL)
+ return false;
+
+ return currentDome->isMoving();
+}
+
+Dome::ParkingStatus Dome::getParkingStatus()
+{
+ if (currentDome == NULL || currentDome->canPark() == false)
+ return PARKING_ERROR;
+
+ ISwitchVectorProperty *parkSP = currentDome->getBaseDevice()->getSwitch("DOME_PARK");
+
+ if (parkSP == NULL)
+ return PARKING_ERROR;
+
+ switch (parkSP->s)
+ {
+ case IPS_IDLE:
+ return PARKING_IDLE;
+
+ case IPS_OK:
+ if (parkSP->sp[0].s == ISS_ON)
+ return PARKING_OK;
+ else
+ return UNPARKING_OK;
+ break;
+
+ case IPS_BUSY:
+ if (parkSP->sp[0].s == ISS_ON)
+ return PARKING_BUSY;
+ else
+ return UNPARKING_BUSY;
+
+ case IPS_ALERT:
+ return PARKING_ERROR;
+ }
+
+ return PARKING_ERROR;
+}
+
+
+
+}
+
+
diff --git a/kstars/ekos/auxiliary/dome.h b/kstars/ekos/auxiliary/dome.h
new file mode 100644
index 0000000..9046f16
--- /dev/null
+++ b/kstars/ekos/auxiliary/dome.h
@@ -0,0 +1,92 @@
+/* Ekos Dome interface
+ Copyright (C) 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef DOME_H
+#define DOME_H
+
+#include <QtDBus/QtDBus>
+
+#include "indi/indistd.h"
+#include "indi/indidome.h"
+
+namespace Ekos
+{
+
+/**
+ *@class Dome
+ *@short Supports basic dome functions
+ *@author Jasem Mutlaq
+ *@version 1.0
+ */
+class Dome : public QObject
+{
+
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Dome")
+
+public:
+ Dome();
+ ~Dome();
+
+ typedef enum { PARKING_IDLE, PARKING_OK, UNPARKING_OK, PARKING_BUSY, UNPARKING_BUSY, PARKING_ERROR } ParkingStatus;
+
+ /** @defgroup DomeDBusInterface Ekos DBus Interface - Dome Interface
+ * Ekos::Dome interface provides advanced basic dome operations.
+ */
+
+ /*@{*/
+
+ /** DBUS interface function.
+ * Abort dome
+ */
+ Q_SCRIPTABLE bool abort();
+
+ /** DBUS interface function.
+ * Can dome park?
+ */
+ Q_SCRIPTABLE bool canPark();
+
+ /** DBUS interface function.
+ * Park dome
+ */
+ Q_SCRIPTABLE bool park();
+
+ /** DBUS interface function.
+ * Park dome
+ */
+ Q_SCRIPTABLE bool unpark();
+
+ /** DBUS interface function.
+ * Get the dome park status
+ */
+ Q_SCRIPTABLE ParkingStatus getParkingStatus();
+
+ /** DBUS interface function.
+ * Check if the dome is in motion
+ */
+ Q_SCRIPTABLE bool isMoving();
+
+ /** @}*/
+
+ /**
+ * @brief setDome set the dome device
+ * @param newDome pointer to Dome device.
+ */
+ void setDome(ISD::GDInterface *newDome);
+
+private:
+
+ // Devices needed for Dome operation
+ ISD::Dome *currentDome;
+
+};
+
+}
+
+#endif // Dome_H
diff --git a/kstars/ekos/auxiliary/dustcap.cpp b/kstars/ekos/auxiliary/dustcap.cpp
new file mode 100644
index 0000000..b83eb35
--- /dev/null
+++ b/kstars/ekos/auxiliary/dustcap.cpp
@@ -0,0 +1,124 @@
+/* Ekos DustCap Interface
+ Copyright (C) 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#include "dustcap.h"
+#include "ekosmanager.h"
+#include "kstars.h"
+#include "dustcapadaptor.h"
+
+#include <basedevice.h>
+
+
+namespace Ekos
+{
+
+DustCap::DustCap()
+{
+ new DustCapAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/KStars/Ekos/DustCap", this);
+
+ currentDustCap = NULL;
+}
+
+DustCap::~DustCap()
+{
+
+}
+
+void DustCap::setDustCap(ISD::GDInterface *newDustCap)
+{
+ currentDustCap = static_cast<ISD::DustCap *>(newDustCap);
+}
+
+DustCap::ParkingStatus DustCap::getParkingStatus()
+{
+ if (currentDustCap == NULL)
+ return PARKING_ERROR;
+
+ ISwitchVectorProperty *parkSP = currentDustCap->getBaseDevice()->getSwitch("CAP_PARK");
+
+ if (parkSP == NULL)
+ return PARKING_ERROR;
+
+ switch (parkSP->s)
+ {
+ case IPS_IDLE:
+ return PARKING_IDLE;
+
+ case IPS_OK:
+ if (parkSP->sp[0].s == ISS_ON)
+ return PARKING_OK;
+ else
+ return UNPARKING_OK;
+ break;
+
+ case IPS_BUSY:
+ if (parkSP->sp[0].s == ISS_ON)
+ return PARKING_BUSY;
+ else
+ return UNPARKING_BUSY;
+
+ case IPS_ALERT:
+ return PARKING_ERROR;
+ }
+
+ return PARKING_ERROR;
+}
+
+bool DustCap::park()
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->Park();
+}
+
+bool DustCap::unpark()
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->UnPark();
+}
+
+bool DustCap::canPark()
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->canPark();
+}
+
+bool DustCap::hasLight()
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->hasLight();
+}
+
+bool DustCap::setLightEnabled(bool enable)
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->SetLightEnabled(enable);
+}
+
+bool DustCap::setBrightness(uint16_t val)
+{
+ if (currentDustCap == NULL)
+ return false;
+
+ return currentDustCap->SetBrightness(val);
+}
+
+}
+
+
diff --git a/kstars/ekos/auxiliary/dustcap.h b/kstars/ekos/auxiliary/dustcap.h
new file mode 100644
index 0000000..db1f000
--- /dev/null
+++ b/kstars/ekos/auxiliary/dustcap.h
@@ -0,0 +1,105 @@
+/* Ekos DustCap interface
+ Copyright (C) 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef DUSTCAP_H
+#define DUSTCAP_H
+
+#include <QtDBus/QtDBus>
+
+#include "indi/indistd.h"
+#include "indi/indicap.h"
+
+namespace Ekos
+{
+
+/**
+ *@class DustCap
+ *@short Supports basic DustCap functions (open/close) and optionally control flat light
+ *@author Jasem Mutlaq
+ *@version 1.0
+ */
+class DustCap : public QObject
+{
+
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.DustCap")
+
+public:
+
+ typedef enum { PARKING_IDLE, PARKING_OK, UNPARKING_OK, PARKING_BUSY, UNPARKING_BUSY, PARKING_ERROR } ParkingStatus;
+
+ DustCap();
+ ~DustCap();
+
+ /** @defgroup DustCapDBusInterface Ekos DBus Interface - DustCap Interface
+ * Ekos::DustCap interface provides basic DustCap operations.
+ */
+
+ /*@{*/
+
+ /** DBUS interface function.
+ * If dust cap can park/unpark or is it just a light source?
+ * @return True if park is supported, false otherwise
+ */
+ Q_SCRIPTABLE bool canPark();
+
+ /** DBUS interface function.
+ * Park / Close dust cap
+ * @return True if operation started/successful, false otherwise
+ */
+ Q_SCRIPTABLE bool park();
+
+ /** DBUS interface function.
+ * UnPark / Open dust cap
+ * @return True if operation started/successful, false otherwise
+ */
+ Q_SCRIPTABLE bool unpark();
+
+ /** DBUS interface function.
+ * hasLight: Does the dust cap have a flat light source?
+ * @return True if there if flat light, false othereise
+ */
+ Q_SCRIPTABLE bool hasLight();
+
+ /** DBUS interface function.
+ * setLightEnabled: Turn on/off light box
+ * @param enable If true, turn light on, otherwise turn light off
+ * @return True if operation started/successful, false otherwise
+ */
+ Q_SCRIPTABLE bool setLightEnabled(bool enable);
+
+ /** DBUS interface function.
+ * SetLight: Set light source brightness level
+ * @return True if operation started/successful, false otherwise
+ */
+ Q_SCRIPTABLE bool setBrightness(uint16_t val);
+
+ /** DBUS interface function.
+ * Get the dome park status
+ */
+ Q_SCRIPTABLE ParkingStatus getParkingStatus();
+
+ /** @}*/
+
+ /**
+ * @brief setDustCap set the DustCap device
+ * @param newDustCap pointer to DustCap device.
+ */
+ void setDustCap(ISD::GDInterface *newDustCap);
+
+private:
+
+ // Devices needed for DustCap operation
+ ISD::DustCap *currentDustCap;
+
+};
+
+}
+
+#endif // DustCap_H
diff --git a/kstars/ekos/auxiliary/weather.cpp b/kstars/ekos/auxiliary/weather.cpp
new file mode 100644
index 0000000..f045d61
--- /dev/null
+++ b/kstars/ekos/auxiliary/weather.cpp
@@ -0,0 +1,58 @@
+/* Ekos Weather Interface
+ Copyright (C) 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#include "weather.h"
+#include "ekosmanager.h"
+#include "kstars.h"
+#include "weatheradaptor.h"
+
+#include <basedevice.h>
+
+
+namespace Ekos
+{
+
+Weather::Weather()
+{
+ new WeatherAdaptor(this);
+ QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Weather", this);
+
+ currentWeather = NULL;
+}
+
+Weather::~Weather()
+{
+
+}
+
+void Weather::setWeather(ISD::GDInterface *newWeather)
+{
+ currentWeather = static_cast<ISD::Weather *>(newWeather);
+}
+
+IPState Weather::getWeatherStatus()
+{
+ if (currentWeather == NULL)
+ return IPS_ALERT;
+
+ return currentWeather->getWeatherStatus();
+}
+
+uint16_t Weather::getUpdatePeriod()
+{
+ if (currentWeather == NULL)
+ return 0;
+
+ return currentWeather->getUpdatePeriod();
+
+}
+
+}
+
+
diff --git a/kstars/ekos/auxiliary/weather.h b/kstars/ekos/auxiliary/weather.h
new file mode 100644
index 0000000..18bc516
--- /dev/null
+++ b/kstars/ekos/auxiliary/weather.h
@@ -0,0 +1,72 @@
+/* Ekos Weather interface
+ Copyright (C) 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
+
+ This application is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef Weather_H
+#define Weather_H
+
+#include <QtDBus/QtDBus>
+
+#include "indi/indistd.h"
+#include "indi/indiweather.h"
+
+namespace Ekos
+{
+
+/**
+ *@class Weather
+ *@short Supports basic weather station functions
+ *@author Jasem Mutlaq
+ *@version 1.0
+ */
+class Weather : public QObject
+{
+
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Weather")
+
+public:
+ Weather();
+ ~Weather();
+
+ /** @defgroup WeatherDBusInterface Ekos DBus Interface - Weather Interface
+ * Ekos::Weather interface provides basic weather operations.
+ */
+
+ /*@{*/
+
+ /** DBUS interface function.
+ * Get Weather status.
+ * @return Either IPS_OK for OK acceptable weather, IPS_BUSY for weather in warning zone, and IPS_ALERT for weather in danger zone. The zones ranges are defined by the INDI weather driver.
+ */
+ Q_SCRIPTABLE IPState getWeatherStatus();
+
+ /** DBUS interface function.
+ * Get Weather Update Period
+ * @return Return weather update period in minute. The weather is updated every X minutes from the weather source.
+ */
+ Q_SCRIPTABLE uint16_t getUpdatePeriod();
+
+ /** @}*/
+
+ /**
+ * @brief setWeather set the Weather device
+ * @param newWeather pointer to Weather device.
+ */
+ void setWeather(ISD::GDInterface *newWeather);
+
+private:
+
+ // Devices needed for Weather operation
+ ISD::Weather *currentWeather;
+
+};
+
+}
+
+#endif // Weather_H