9#include "ui_filtersettings.h"
11#include "ekos/focus/focusutils.h"
13#include <indi/indifilterwheel.h>
14#include <indi/indifocuser.h>
15#include <oal/filter.h>
19#include <QStandardItemModel>
23class NotEditableDelegate;
24class NotEditableDelegate2dp;
28class DatetimeDelegate;
33class FilterManager :
public QDialog,
public Ui::FilterSettings
38 friend class BuildFilterOffsets;
44 CHANGE_POLICY = 1 << 0,
45 OFFSET_POLICY = 1 << 1,
46 AUTOFOCUS_POLICY = 1 << 2,
47 ALL_POLICIES = CHANGE_POLICY | OFFSET_POLICY | AUTOFOCUS_POLICY,
48 NO_AUTOFOCUS_POLICY = CHANGE_POLICY | OFFSET_POLICY
70 void setFilterData(
const QJsonObject &settings);
72 void createFilterModel();
73 void refreshFilterModel();
75 QStringList getFilterLabels(
bool forceRefresh =
false);
76 int getFilterPosition(
bool forceRefresh =
false);
80 void refreshFilterLabels();
84 void refreshFilterPosition();
87 int getTargetFilterPosition()
89 return targetFilterPosition;
91 int getTargetFilterOffset()
93 return targetFilterOffset;
104 bool setFilterAbsoluteFocusDetails(
int index,
int focusPos,
double focusTemp,
double focusAlt);
114 bool getFilterAbsoluteFocusDetails(
const QString &name,
int &focusPos,
double &focusTemp,
double &focusAlt)
const;
122 bool getAFDatetime(
const QString &name, QDateTime &datetime)
const;
125 bool syncAbsoluteFocusPosition(
int index);
132 double getFilterExposure(
const QString &name = QString())
const;
133 bool setFilterExposure(
int index,
double exposure);
140 int getFilterOffset(
const QString &name)
const;
148 bool setFilterOffset(QString color,
int offset);
155 int getFilterWavelength(
const QString &name = QString())
const;
162 double getFilterTicksPerTemp(
const QString &name = QString())
const;
169 double getFilterTicksPerAlt(
const QString &name = QString())
const;
179 QString getFilterLock(
const QString &name)
const;
180 bool setFilterLock(
int index, QString name);
186 void setFilterWheel(ISD::FilterWheel *filter);
187 ISD::FilterWheel *filterWheel()
const
189 return m_FilterWheel;
196 void setFocusReady(
bool enabled)
205 void applyFilterFocusPolicies();
211 void buildFilterOffsets();
215 bool setFilterPosition(uint8_t position, Ekos::FilterManager::FilterPolicy policy = ALL_POLICIES);
217 bool setFilterNames(
const QStringList &newLabels);
219 void setFocusOffsetComplete();
221 void removeDevice(
const QSharedPointer<ISD::GenericDevice> &device);
223 void reloadFilters();
227 void setFocusStatus(Ekos::FocusState focusState);
229 void setFocusAbsolutePosition(
int value)
231 m_FocusAbsPosition = value;
234 void refreshFilterProperties();
236 void signalRunAutoFocus(AutofocusReason autofocusReason,
const QString &reasonInfo);
238 void signalAbortAutoFocus();
240 void autoFocusComplete(FocusState completionState,
int currentPosition,
double currentTemperature,
double currentAlt);
244 void positionChanged(
int);
246 void labelsChanged(QStringList);
248 void exposureChanged(
double);
254 void newStatus(Ekos::FilterState state);
256 void runAutoFocus(AutofocusReason autofocusReason,
const QString &reasonInfo);
258 void abortAutoFocus();
260 void newFocusOffset(
int value,
bool useAbsoluteOffset);
264 void ticksPerTempChanged();
266 void ticksPerAltChanged();
268 void wavelengthChanged();
270 void autoFocusDone(FocusState completionState,
int currentPosition,
double currentTemperature,
double currentAlt);
273 void updateProperty(INDI::Property prop);
274 void processDisconnect();
279 ISD::FilterWheel *m_FilterWheel = {
nullptr };
282 QStringList m_currentFilterLabels;
283 int m_currentFilterPosition = { -1 };
284 double m_currentFilterExposure = { -1 };
287 QList<OAL::Filter *> m_ActiveFilters;
288 OAL::Filter *targetFilter = {
nullptr };
289 OAL::Filter *currentFilter = {
nullptr };
290 bool m_useTargetFilter = {
false };
293 uint8_t retries = { 0 };
295 int16_t lastFilterOffset { 0 };
298 QSqlTableModel *m_FilterModel = {
nullptr };
301 ITextVectorProperty *m_FilterNameProperty {
nullptr };
302 INumberVectorProperty *m_FilterPositionProperty {
nullptr };
303 ISwitchVectorProperty *m_FilterConfirmSet {
nullptr };
307 OAL::Filter * getFilterByName(
const QString &name)
const;
310 void buildOperationQueue(FilterState operation);
311 bool executeOperationQueue();
312 bool executeOneOperation(FilterState operation);
315 void checkFilterChangeTimeout();
322 QStringList getLockDelegates();
325 QQueue<FilterState> operationQueue;
327 FilterState state = { FILTER_IDLE };
329 int targetFilterPosition { -1 };
330 int targetFilterOffset { - 1 };
331 QTimer m_FilterChangeTimeout;
333 bool m_FocusReady {
false };
334 bool m_FocusAbsPositionPending {
false};
335 int m_FocusAbsPosition { -1 };
338 QPointer<ComboDelegate> lockDelegate;
339 QPointer<NotEditableDelegate> noEditDelegate;
340 QPointer<DoubleDelegate> exposureDelegate;
341 QPointer<IntegerDelegate> offsetDelegate;
342 QPointer<ToggleDelegate> useAutoFocusDelegate;
343 QPointer<IntegerDelegate> lastAFSolutionDelegate;
344 QPointer<DoubleDelegate> lastAFTempDelegate;
345 QPointer<DoubleDelegate> lastAFAltDelegate;
346 QPointer<DatetimeDelegate> lastAFDTDelegate;
347 QPointer<DoubleDelegate> ticksPerTempDelegate;
348 QPointer<DoubleDelegate> ticksPerAltDelegate;
349 QPointer<IntegerDelegate> wavelengthDelegate;
352 FilterPolicy m_Policy = { ALL_POLICIES };
354 bool m_ConfirmationPending {
false };
Ekos is an advanced Astrophotography tool for Linux.
QObject * parent() const const