Kstars

indiweather.h
1/*
2 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <memory>
10#include <QTimer>
11#include <QJsonDocument>
12
13#include "indiconcretedevice.h"
14
15namespace ISD
16{
17/**
18 * @class Weather
19 * Focuser class handles control of INDI Weather devices. It reports overall state and the value of each parameter
20 *
21 * @author Jasem Mutlaq
22 */
23class Weather : public ConcreteDevice
24{
26 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.INDI.Weather")
27 Q_PROPERTY(ISD::Weather::Status status READ status NOTIFY newStatus)
28 Q_PROPERTY(int refreshPeriod READ refreshPeriod WRITE setRefreshPeriod)
29 Q_PROPERTY(QByteArray data READ jsonData NOTIFY newJSONData)
30
31 public:
32 explicit Weather(GenericDevice *parent);
33
34 typedef enum
35 {
36 WEATHER_IDLE,
37 WEATHER_OK,
38 WEATHER_WARNING,
39 WEATHER_ALERT,
40 } Status;
41
42 void processNumber(INDI::Property prop) override;
43 void processLight(INDI::Property prop) override;
44
45 Status status();
46
47 int refreshPeriod();
48 void setRefreshPeriod(int value);
49
50 bool refresh();
51 const QJsonArray &data() const
52 {
53 return m_Data;
54 }
55 /**
56 * @brief jsondata Used for DBus
57 * @return Weahter data in JSON Format
58 */
60 {
61 return QJsonDocument(m_Data).toJson();
62 }
63
64 signals:
65 void newStatus(ISD::Weather::Status status);
66 void newData(const QJsonArray &data);
67 void newJSONData(QByteArray data);
68
69 private:
70 Status m_WeatherStatus { WEATHER_IDLE };
71 QJsonArray m_Data;
72};
73}
74
75#ifndef KSTARS_LITE
76Q_DECLARE_METATYPE(ISD::Weather::Status)
77QDBusArgument &operator<<(QDBusArgument &argument, const ISD::Weather::Status &source);
78const QDBusArgument &operator>>(const QDBusArgument &argument, ISD::Weather::Status &dest);
79#endif
The ConcreteDevice class.
GenericDevice is the Generic Device for INDI devices.
Definition indistd.h:117
Focuser class handles control of INDI Weather devices.
Definition indiweather.h:24
QByteArray jsonData() const
jsondata Used for DBus
Definition indiweather.h:59
ISD is a collection of INDI Standard Devices.
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
QByteArray toJson(JsonFormat format) const const
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.