Instrument Neutral Distributed Interface INDI 2.2.5
indiweather.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3
4 INDI Weather Device Class
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20
21 The full GNU General Public License is included in this distribution in the
22 file called LICENSE.
23*******************************************************************************/
24
25#pragma once
26
27#include "defaultdevice.h"
29
30#include <list>
31
32namespace Connection
33{
34class Serial;
35class TCP;
36}
37
66namespace INDI
67{
69{
70 public:
77
81 enum
82 {
83 CONNECTION_NONE = 1 << 0,
87
88 Weather();
89
90 virtual bool initProperties() override;
91 virtual void ISGetProperties(const char *dev) override;
92 virtual bool updateProperties() override;
93 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
94 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
95 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
96
97 virtual bool ISSnoopDevice(XMLEle *root) override;
98
99 protected:
107 virtual bool updateLocation(double latitude, double longitude, double elevation);
108
114 void setWeatherConnection(const uint8_t &value);
115
119 uint8_t getWeatherConnection() const;
120
121 virtual bool saveConfigItems(FILE *fp) override;
122
124 virtual bool Handshake();
125
126 // A number vector that stores latitude and longitude
128
129 // Active devices to snoop
131
134
135 int PortFD = -1;
136
137 private:
138 void processLocationInfo(double latitude, double longitude, double elevation);
139
140 bool callHandshake();
141 uint8_t weatherConnection = CONNECTION_SERIAL | CONNECTION_TCP;
142};
143}
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
The TCP class manages connection with devices over the network via TCP/IP. Upon successful connection...
friend class WeatherInterface
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool Handshake()
perform handshake with device to check communication
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
INDI::PropertyNumber LocationNP
void setWeatherConnection(const uint8_t &value)
setWeatherConnection Set Weather connection mode. Child class should call this in the constructor bef...
virtual bool updateLocation(double latitude, double longitude, double elevation)
Update weather station location.
uint8_t getWeatherConnection() const
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Connection::Serial * serialConnection
Connection::TCP * tcpConnection
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
INDI::PropertyText ActiveDeviceTP
ISState
Switch state.
Definition indiapi.h:148
*brief user defined string literal for JSON values *sa std::size_t n
struct xml_ele_ XMLEle
Definition lilxml.h:81
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition arduino_st4.h:34
Namespace to encapsulate INDI client, drivers, and mediator classes.
Holds the connection mode of the Weather.