Kstars

observatoryweathermodel.h
1/* Ekos Observatory Module
2 SPDX-FileCopyrightText: Wolfgang Reissenberger <sterne-jaeger@t-online.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ekos/auxiliary/weather.h"
10
11#include <QObject>
12
13namespace Ekos
14{
15
16struct WeatherActions
17{
18 bool parkDome, closeShutter, stopScheduler;
19 uint delay;
20};
21
22class ObservatoryWeatherModel : public QObject
23{
24
26
27 public:
28 ObservatoryWeatherModel() = default;
29
30 void initModel(Weather *weather);
31 bool isActive()
32 {
33 return initialized;
34 }
35
36 ISD::Weather::Status status();
37
38 bool refresh();
39
40 /**
41 * @brief Actions to be taken when a weather warning occurs
42 */
43 WeatherActions getWarningActions()
44 {
45 return warningActions;
46 }
47 QString getWarningActionsStatus();
48 void setWarningActions(WeatherActions actions);
49 bool getWarningActionsActive()
50 {
51 return warningActionsActive;
52 }
53
54 /**
55 * @brief Actions to be taken when a weather alert occurs
56 */
57 WeatherActions getAlertActions()
58 {
59 return alertActions;
60 }
61 QString getAlertActionsStatus();
62 void setAlertActions(WeatherActions actions);
63 bool getAlertActionsActive()
64 {
65 return alertActionsActive;
66 }
67
68 /**
69 * @brief Retrieve the currently known weather sensor values
70 */
71 const std::vector<ISD::Weather::WeatherData> &getWeatherData() const
72 {
73 return m_WeatherData;
74 }
75
76 /**
77 * @brief Flag whether the X axis should be visible in the sensor graph
78 */
79 bool autoScaleValues()
80 {
81 return m_autoScaleValues;
82 }
83 void setAutoScaleValues(bool show);
84
85 public slots:
86 /**
87 * @brief Activate or deactivate the weather warning actions
88 */
89 void setWarningActionsActive(bool active);
90 /**
91 * @brief Activate or deactivate the weather alert actions
92 */
93 void setAlertActionsActive(bool active);
94
95 private:
96 bool initialized = false;
97 Weather *weatherInterface;
98 QTimer warningTimer, alertTimer;
99 struct WeatherActions warningActions, alertActions;
100 bool warningActionsActive, alertActionsActive, m_autoScaleValues;
101
102 void startAlertTimer();
103 void startWarningTimer();
104
105 // hold all sensor data received from the weather station
106 std::vector<ISD::Weather::WeatherData> m_WeatherData;
107 // update the stored values
108 void updateWeatherData(const std::vector<ISD::Weather::WeatherData> &data);
109 unsigned long findWeatherData(QString name);
110
111 private slots:
112 void weatherChanged(ISD::Weather::Status status);
113 void updateWeatherStatus();
114
115 signals:
116 void newStatus(ISD::Weather::Status status);
117 void newWeatherData(const std::vector<ISD::Weather::WeatherData> &data);
118 void ready();
119 void disconnected();
120 /**
121 * @brief signal that actions need to be taken due to weather conditions
122 */
123 void execute(WeatherActions actions);
124
125};
126
127}
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.