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, stopScheduler; | ||||
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 | bool getWarningActionsActive() { return warningActionsActive; } | ||||
43 | | ||||
44 | /** | ||||
45 | * @brief Actions to be taken when a weather alert occurs | ||||
46 | */ | ||||
47 | WeatherActions getAlertActions() { return alertActions; } | ||||
48 | QString getAlertActionsStatus(); | ||||
49 | void setAlertActions(WeatherActions actions); | ||||
50 | bool getAlertActionsActive() { return alertActionsActive; } | ||||
51 | | ||||
52 | public slots: | ||||
53 | /** | ||||
54 | * @brief Activate or deactivate the weather warning actions | ||||
55 | */ | ||||
56 | void setWarningActionsActive(bool active); | ||||
57 | /** | ||||
58 | * @brief Activate or deactivate the weather alert actions | ||||
59 | */ | ||||
60 | void setAlertActionsActive(bool active); | ||||
61 | | ||||
62 | private: | ||||
63 | Weather *mWeather; | ||||
64 | QTimer warningTimer, alertTimer; | ||||
65 | struct WeatherActions warningActions, alertActions; | ||||
66 | bool warningActionsActive, alertActionsActive; | ||||
67 | | ||||
68 | private slots: | ||||
69 | void weatherChanged(ISD::Weather::Status status); | ||||
70 | void updateWeatherStatus(); | ||||
71 | | ||||
72 | signals: | ||||
73 | void newStatus(ISD::Weather::Status status); | ||||
74 | void ready(); | ||||
75 | void disconnected(); | ||||
76 | /** | ||||
77 | * @brief signal that actions need to be taken due to weather conditions | ||||
78 | */ | ||||
79 | void execute(WeatherActions actions); | ||||
80 | | ||||
81 | }; | ||||
82 | | ||||
83 | } |