7#include "observatorydomemodel.h"
8#include <KLocalizedString>
13void ObservatoryDomeModel::initModel(Dome *dome)
17 connect(domeInterface, &Dome::ready,
this, [&]()
22 connect(domeInterface, &Dome::disconnected,
this, [&]()
27 connect(domeInterface, &Dome::newStatus,
this, &ObservatoryDomeModel::newStatus);
28 connect(domeInterface, &Dome::newParkStatus,
this, &ObservatoryDomeModel::newParkStatus);
29 connect(domeInterface, &Dome::newShutterStatus,
this, &ObservatoryDomeModel::newShutterStatus);
30 connect(domeInterface, &Dome::azimuthPositionChanged,
this, &ObservatoryDomeModel::azimuthPositionChanged);
31 connect(domeInterface, &Dome::newAutoSyncStatus,
this, &ObservatoryDomeModel::newAutoSyncStatus);
36ISD::Dome::Status ObservatoryDomeModel::status()
38 if (domeInterface ==
nullptr)
39 return ISD::Dome::DOME_IDLE;
41 return domeInterface->status();
44ISD::Dome::ShutterStatus ObservatoryDomeModel::shutterStatus()
46 if (domeInterface ==
nullptr)
47 return ISD::Dome::SHUTTER_UNKNOWN;
49 return domeInterface->shutterStatus();
52void ObservatoryDomeModel::park()
54 if (domeInterface ==
nullptr)
57 emit newLog(
i18n(
"Parking %1...", isRolloffRoof() ?
i18n(
"rolloff roof") :
i18n(
"dome")));
58 domeInterface->park();
62void ObservatoryDomeModel::unpark()
64 if (domeInterface ==
nullptr)
67 emit newLog(
i18n(
"Unparking %1...", isRolloffRoof() ?
i18n(
"rolloff roof") :
i18n(
"dome")));
68 domeInterface->unpark();
71ISD::ParkStatus ObservatoryDomeModel::parkStatus()
73 if (domeInterface ==
nullptr)
74 return ISD::PARK_UNKNOWN;
75 else if (isRolloffRoof())
78 if (domeInterface->status() == ISD::Dome::DOME_MOVING_CW)
79 return ISD::PARK_UNPARKING;
80 else if (domeInterface->status() == ISD::Dome::DOME_MOVING_CCW)
81 return ISD::PARK_PARKING;
85 return domeInterface->parkStatus();
88void ObservatoryDomeModel::setAutoSync(
bool activate)
90 if (domeInterface ==
nullptr)
93 if (domeInterface->setAutoSync(activate))
94 emit newLog(activate ?
i18n(
"Slaving activated.") :
i18n(
"Slaving deactivated."));
98void ObservatoryDomeModel::abort()
100 if (domeInterface ==
nullptr)
103 emit newLog(
i18n(
"Aborting..."));
104 domeInterface->abort();
107void ObservatoryDomeModel::openShutter()
109 if (domeInterface ==
nullptr)
112 emit newLog(
i18n(
"Opening shutter..."));
113 domeInterface->controlShutter(
true);
116void ObservatoryDomeModel::closeShutter()
118 if (domeInterface ==
nullptr)
121 emit newLog(
i18n(
"Closing shutter..."));
122 domeInterface->controlShutter(
false);
125bool ObservatoryDomeModel::moveDome(
bool moveCW,
bool start)
127 if (domeInterface ==
nullptr)
131 emit newLog(
i18nc(
"%2 dome or rolloff roof motion %1...",
"%2 rolloff roof %1...",
132 moveCW ?
i18n(
"opening") :
i18n(
"closing"), start ?
i18n(
"Start") :
i18n(
"Stop")));
134 emit newLog(
i18nc(
"%2 dome or rolloff roof motion %1...",
"%2 dome motion %1...",
135 moveCW ?
i18n(
"clockwise") :
i18n(
"counter clockwise"), start ?
i18n(
"Start") :
i18n(
"Stop")));
136 return domeInterface->moveDome(moveCW, start);
139void ObservatoryDomeModel::execute(WeatherActions actions)
141 if (hasShutter() && actions.closeShutter)
143 if (actions.parkDome)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
Ekos is an advanced Astrophotography tool for Linux.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)