• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • edu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • extragear
  • edu
  • kstars
  • kstars
  • ekos
  • auxiliary
weather.cpp
Go to the documentation of this file.
1 /* Ekos Weather Interface
2  Copyright (C) 2015 Jasem Mutlaq <[email protected]>
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 #include "weather.h"
11 
12 #include "ekos/manager.h"
13 #include "kstars.h"
14 #include "weatheradaptor.h"
15 
16 #include <basedevice.h>
17 
18 namespace Ekos
19 {
20 Weather::Weather()
21 {
22  new WeatherAdaptor(this);
23  QDBusConnection::sessionBus().registerObject("/KStars/Ekos/Weather", this);
24 
25  qRegisterMetaType<ISD::Weather::Status>("ISD::Weather::Status");
26  qDBusRegisterMetaType<ISD::Weather::Status>();
27 }
28 
29 void Weather::setWeather(ISD::GDInterface *newWeather)
30 {
31  if (newWeather == currentWeather)
32  return;
33 
34  currentWeather = static_cast<ISD::Weather *>(newWeather);
35  currentWeather->disconnect(this);
36  connect(currentWeather, &ISD::Weather::newStatus, this, &Weather::newStatus);
37  connect(currentWeather, &ISD::Weather::newWeatherData, this, &Weather::newWeatherData);
38  connect(currentWeather, &ISD::Weather::ready, this, &Weather::ready);
39  connect(currentWeather, &ISD::Weather::Connected, this, &Weather::ready);
40  connect(currentWeather, &ISD::Weather::Disconnected, this, &Weather::disconnected);
41 }
42 
43 void Weather::removeDevice(ISD::GDInterface *device)
44 {
45  device->disconnect(this);
46  if (currentWeather && !strcmp(currentWeather->getDeviceName(), device->getDeviceName()))
47  {
48  currentWeather = nullptr;
49  }
50 }
51 
52 ISD::Weather::Status Weather::status()
53 {
54  if (currentWeather == nullptr)
55  return ISD::Weather::WEATHER_IDLE;
56 
57  return currentWeather->getWeatherStatus();
58 }
59 
60 quint16 Weather::getUpdatePeriod()
61 {
62  if (currentWeather == nullptr)
63  return 0;
64 
65  return currentWeather->getUpdatePeriod();
66 }
67 
68 bool Weather::refresh()
69 {
70  return currentWeather->refresh();
71 
72 }
73 
74 }
ISD::Weather
Focuser class handles control of INDI Weather devices.
Definition: indiweather.h:25
QDBusConnection::registerObject
bool registerObject(const QString &path, QObject *object, QFlags< QDBusConnection::RegisterOption > options)
ISD::GDInterface::getDeviceName
virtual const char * getDeviceName()=0
QDBusConnection::sessionBus
QDBusConnection sessionBus()
ISD::Weather::Status
Status
Definition: indiweather.h:32
ISD::Weather::refresh
bool refresh()
Definition: indiweather.cpp:100
ISD::Weather::getWeatherStatus
Status getWeatherStatus()
Definition: indiweather.cpp:78
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
weather.h
Ekos::Weather::setWeather
void setWeather(ISD::GDInterface *newWeather)
setWeather set the Weather device
Definition: weather.cpp:29
ISD::GDInterface::Disconnected
void Disconnected()
Ekos::Weather::removeDevice
void removeDevice(ISD::GDInterface *device)
Definition: weather.cpp:43
Ekos::Weather::refresh
Q_SCRIPTABLE bool refresh()
DBUS interface function.
Definition: weather.cpp:68
Ekos::Weather::Weather
Weather()
Definition: weather.cpp:20
ISD::Weather::ready
void ready()
ISD::Weather::newStatus
void newStatus(Status status)
manager.h
ISD::DeviceDecorator::getDeviceName
const char * getDeviceName() override
Definition: indistd.cpp:1124
ISD::Weather::getUpdatePeriod
quint16 getUpdatePeriod()
Definition: indiweather.cpp:90
Ekos::Weather::disconnected
void disconnected()
ISD::Weather::newWeatherData
void newWeatherData(std::vector< WeatherData >)
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
ISD::Weather::WEATHER_IDLE
Definition: indiweather.h:34
kstars.h
ISD::GDInterface
GDInterface is the Generic Device Interface for INDI devices.
Definition: indistd.h:63
Ekos::Weather::newStatus
void newStatus(ISD::Weather::Status status)
newStatus Weather Status
Ekos::Weather::newWeatherData
void newWeatherData(std::vector< ISD::Weather::WeatherData >)
Ekos::Weather::getUpdatePeriod
Q_SCRIPTABLE quint16 getUpdatePeriod()
DBUS interface function.
Definition: weather.cpp:60
Ekos::Weather::ready
void ready()
Ekos::Weather::status
Q_SCRIPTABLE ISD::Weather::Status status()
DBUS interface function.
ISD::GDInterface::Connected
void Connected()
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Thu Dec 12 2019 02:56:35 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

edu API Reference

Skip menu "edu API Reference"
  •     core
  • kstars

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal