Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/observatory/observatoryweathermodel.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 "../auxiliary/weather.h" | ||||
13 | #include "indiweather.h" | ||||
14 | | ||||
15 | #include <QObject> | ||||
16 | | ||||
17 | namespace Ekos | ||||
18 | { | ||||
19 | | ||||
20 | struct WeatherActions { | ||||
21 | bool parkDome, closeShutter; | ||||
22 | int delay; | ||||
23 | }; | ||||
24 | | ||||
25 | class ObservatoryWeatherModel : public QObject | ||||
26 | { | ||||
27 | | ||||
28 | Q_OBJECT | ||||
29 | | ||||
30 | public: | ||||
31 | ObservatoryWeatherModel() = default; | ||||
32 | | ||||
33 | void initModel(Weather *weather); | ||||
34 | ISD::Weather::Status status(); | ||||
35 | | ||||
36 | /** | ||||
37 | * @brief Actions to be taken when a weather warning occurs | ||||
38 | */ | ||||
39 | WeatherActions getWarningActions() { return warningActions; } | ||||
40 | QString getWarningActionsStatus(); | ||||
41 | void setWarningActions(WeatherActions actions); | ||||
42 | | ||||
43 | /** | ||||
44 | * @brief Actions to be taken when a weather alert occurs | ||||
45 | */ | ||||
46 | WeatherActions getAlertActions() { return alertActions; } | ||||
47 | QString getAlertActionsStatus(); | ||||
48 | void setAlertActions(WeatherActions actions); | ||||
49 | | ||||
50 | private: | ||||
51 | Weather *mWeather; | ||||
52 | QTimer warningTimer, alertTimer; | ||||
53 | struct WeatherActions warningActions, alertActions; | ||||
54 | | ||||
55 | private slots: | ||||
56 | void weatherChanged(ISD::Weather::Status status); | ||||
57 | void updateWeatherStatus(); | ||||
58 | | ||||
59 | signals: | ||||
60 | void newStatus(ISD::Weather::Status status); | ||||
61 | void ready(); | ||||
62 | void disconnected(); | ||||
63 | /** | ||||
64 | * @brief signal that actions need to be taken due to weather conditions | ||||
65 | */ | ||||
66 | void execute(WeatherActions actions); | ||||
67 | | ||||
68 | }; | ||||
69 | | ||||
70 | } |