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;
32class FilterManager :
public QDialog,
public Ui::FilterSettings
37 friend class BuildFilterOffsets;
43 CHANGE_POLICY = 1 << 0,
44 OFFSET_POLICY = 1 << 1,
45 AUTOFOCUS_POLICY = 1 << 2,
46 ALL_POLICIES = CHANGE_POLICY | OFFSET_POLICY | AUTOFOCUS_POLICY,
47 NO_AUTOFOCUS_POLICY = CHANGE_POLICY | OFFSET_POLICY
68 void setFilterData(
const QJsonObject &settings);
70 void createFilterModel();
71 void refreshFilterModel();
73 QStringList getFilterLabels(
bool forceRefresh =
false);
74 int getFilterPosition(
bool forceRefresh =
false);
78 void refreshFilterLabels();
82 void refreshFilterPosition();
85 int getTargetFilterPosition()
87 return targetFilterPosition;
89 int getTargetFilterOffset()
91 return targetFilterOffset;
102 bool setFilterAbsoluteFocusDetails(
int index,
int focusPos,
double focusTemp,
double focusAlt);
112 bool getFilterAbsoluteFocusDetails(
const QString &name,
int &focusPos,
double &focusTemp,
double &focusAlt)
const;
115 bool syncAbsoluteFocusPosition(
int index);
122 double getFilterExposure(
const QString &name = QString())
const;
123 bool setFilterExposure(
int index,
double exposure);
130 int getFilterOffset(
const QString &name)
const;
138 bool setFilterOffset(QString color,
int offset);
145 int getFilterWavelength(
const QString &name = QString())
const;
152 double getFilterTicksPerTemp(
const QString &name = QString())
const;
159 double getFilterTicksPerAlt(
const QString &name = QString())
const;
169 QString getFilterLock(
const QString &name)
const;
170 bool setFilterLock(
int index, QString name);
176 void setFilterWheel(ISD::FilterWheel *filter);
177 ISD::FilterWheel *filterWheel()
const
179 return m_FilterWheel;
186 void setFocusReady(
bool enabled)
195 void applyFilterFocusPolicies();
201 void buildFilterOffsets();
205 bool setFilterPosition(uint8_t position, Ekos::FilterManager::FilterPolicy policy = ALL_POLICIES);
207 bool setFilterNames(
const QStringList &newLabels);
209 void setFocusOffsetComplete();
211 void removeDevice(
const QSharedPointer<ISD::GenericDevice> &device);
213 void reloadFilters();
217 void setFocusStatus(Ekos::FocusState focusState);
219 void setFocusAbsolutePosition(
int value)
221 m_FocusAbsPosition = value;
224 void refreshFilterProperties();
226 void signalRunAutoFocus(AutofocusReason autofocusReason,
const QString &reasonInfo);
228 void signalAbortAutoFocus();
230 void autoFocusComplete(FocusState completionState,
int currentPosition,
double currentTemperature,
double currentAlt);
234 void positionChanged(
int);
236 void labelsChanged(QStringList);
238 void exposureChanged(
double);
244 void newStatus(Ekos::FilterState state);
246 void runAutoFocus(AutofocusReason autofocusReason,
const QString &reasonInfo);
248 void abortAutoFocus();
250 void newFocusOffset(
int value,
bool useAbsoluteOffset);
254 void ticksPerTempChanged();
256 void ticksPerAltChanged();
258 void wavelengthChanged();
260 void autoFocusDone(FocusState completionState,
int currentPosition,
double currentTemperature,
double currentAlt);
263 void updateProperty(INDI::Property prop);
264 void processDisconnect();
269 ISD::FilterWheel *m_FilterWheel = {
nullptr };
272 QStringList m_currentFilterLabels;
273 int m_currentFilterPosition = { -1 };
274 double m_currentFilterExposure = { -1 };
277 QList<OAL::Filter *> m_ActiveFilters;
278 OAL::Filter *targetFilter = {
nullptr };
279 OAL::Filter *currentFilter = {
nullptr };
280 bool m_useTargetFilter = {
false };
283 uint8_t retries = { 0 };
285 int16_t lastFilterOffset { 0 };
288 QSqlTableModel *m_FilterModel = {
nullptr };
291 ITextVectorProperty *m_FilterNameProperty {
nullptr };
292 INumberVectorProperty *m_FilterPositionProperty {
nullptr };
293 ISwitchVectorProperty *m_FilterConfirmSet {
nullptr };
297 OAL::Filter * getFilterByName(
const QString &name)
const;
300 void buildOperationQueue(FilterState operation);
301 bool executeOperationQueue();
302 bool executeOneOperation(FilterState operation);
305 void checkFilterChangeTimeout();
312 QStringList getLockDelegates();
315 QQueue<FilterState> operationQueue;
317 FilterState state = { FILTER_IDLE };
319 int targetFilterPosition { -1 };
320 int targetFilterOffset { - 1 };
321 QTimer m_FilterChangeTimeout;
323 bool m_FocusReady {
false };
324 bool m_FocusAbsPositionPending {
false};
325 int m_FocusAbsPosition { -1 };
328 QPointer<ComboDelegate> lockDelegate;
329 QPointer<NotEditableDelegate> noEditDelegate;
330 QPointer<DoubleDelegate> exposureDelegate;
331 QPointer<IntegerDelegate> offsetDelegate;
332 QPointer<ToggleDelegate> useAutoFocusDelegate;
333 QPointer<IntegerDelegate> lastAFSolutionDelegate;
334 QPointer<DoubleDelegate> lastAFTempDelegate;
335 QPointer<DoubleDelegate> lastAFAltDelegate;
336 QPointer<DoubleDelegate> ticksPerTempDelegate;
337 QPointer<DoubleDelegate> ticksPerAltDelegate;
338 QPointer<IntegerDelegate> wavelengthDelegate;
341 FilterPolicy m_Policy = { ALL_POLICIES };
343 bool m_ConfirmationPending {
false };
Ekos is an advanced Astrophotography tool for Linux.
QObject * parent() const const