Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/observatory/observatorymodel.h
- This file was added.
1 | /* Ekos Observatory Module | ||||
---|---|---|---|---|---|
2 | Copyright (C) Wolfgang Reissenberger <sterne-jaeger@t-online.de> | ||||
3 | | ||||
4 | This application is free software; you can redistribute it and/or | ||||
5 | modify it under the terms of the GNU General Public | ||||
6 | License as published by the Free Software Foundation; either | ||||
7 | version 2 of the License, or (at your option) any later version. | ||||
8 | */ | ||||
9 | | ||||
10 | #pragma once | ||||
11 | | ||||
12 | #include "observatorydomemodel.h" | ||||
13 | #include "observatoryweathermodel.h" | ||||
14 | | ||||
15 | #include <QObject> | ||||
16 | | ||||
17 | namespace Ekos | ||||
18 | { | ||||
19 | | ||||
20 | struct ObservatoryStatusControl | ||||
21 | { | ||||
22 | bool useDome, useShutter, useWeather; | ||||
23 | }; | ||||
24 | | ||||
25 | class ObservatoryModel : public QObject | ||||
26 | { | ||||
27 | | ||||
28 | Q_OBJECT | ||||
29 | | ||||
30 | public: | ||||
31 | ObservatoryModel(); | ||||
32 | | ||||
33 | ObservatoryDomeModel *getDomeModel() { return mDomeModel; } | ||||
34 | ObservatoryWeatherModel *getWeatherModel() { return mWeatherModel; } | ||||
35 | | ||||
36 | void setDomeModel(ObservatoryDomeModel *model); | ||||
37 | void setWeatherModel(ObservatoryWeatherModel *model); | ||||
38 | | ||||
39 | /** | ||||
40 | * @brief Retrieve the settings that define, from which states the | ||||
41 | * "ready" state of the observatory is derived from. | ||||
42 | */ | ||||
43 | ObservatoryStatusControl statusControl() { return mStatusControl; } | ||||
44 | void setStatusControl(ObservatoryStatusControl control); | ||||
45 | | ||||
46 | /** | ||||
47 | * @brief Is the observatory ready? This depends upon the states of the weather, | ||||
48 | * dome etc and upon whether these settings are relevant (see status control). | ||||
49 | */ | ||||
50 | bool isReady(); | ||||
51 | | ||||
52 | public slots: | ||||
53 | // call this slot in case that the weather or dome status has changed | ||||
54 | void updateStatus(); | ||||
55 | | ||||
56 | /** | ||||
57 | * @brief Depending on the status control settings execute everything so | ||||
58 | * that the status reaches the state "READY". | ||||
59 | */ | ||||
60 | void makeReady(); | ||||
61 | | ||||
62 | signals: | ||||
63 | /** | ||||
64 | * @brief Signal a new observatory status | ||||
65 | * @param isReady | ||||
66 | */ | ||||
67 | void newStatus(bool isReady); | ||||
68 | | ||||
69 | | ||||
70 | private: | ||||
71 | ObservatoryStatusControl mStatusControl; | ||||
72 | | ||||
73 | ObservatoryDomeModel *mDomeModel = nullptr; | ||||
74 | ObservatoryWeatherModel *mWeatherModel = nullptr; | ||||
75 | | ||||
76 | }; | ||||
77 | | ||||
78 | } |