Instrument Neutral Distributed Interface INDI  2.0.2
weathermeta.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2015 Jasem Mutlaq. All rights reserved.
3 
4  INDI Weather Meta Driver. It watches up to 4 weather drivers and report worst case
5  of each in a single property.
6 
7  This program is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the Free
9  Software Foundation; either version 2 of the License, or (at your option)
10  any later version.
11 
12  This program is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15  more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 
22  The full GNU General Public License is included in this distribution in the
23  file called LICENSE.
24 *******************************************************************************/
25 
26 #pragma once
27 
28 #include "defaultdevice.h"
29 
31 {
32  public:
33  WeatherMeta();
34  virtual ~WeatherMeta() = default;
35 
36  // Generic indi device entries
37  bool Connect() override;
38  bool Disconnect() override;
39  const char *getDefaultName() override;
40 
41  virtual bool ISSnoopDevice(XMLEle *root) override;
42 
43  virtual bool initProperties() override;
44  virtual bool updateProperties() override;
45  virtual void ISGetProperties(const char *dev) override;
46  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
47 
48  protected:
49  virtual bool saveConfigItems(FILE *fp) override;
50 
51  private:
52  void updateOverallState();
53  void updateUpdatePeriod();
54 
55  // Active stations
56  IText ActiveDeviceT[4] {};
57  ITextVectorProperty ActiveDeviceTP;
58 
59  // Stations status
60  ILight StationL[4];
61  ILightVectorProperty StationLP;
62 
63  // Update Period
64  INumber UpdatePeriodN[1];
65  INumberVectorProperty UpdatePeriodNP;
66 
67  double updatePeriods[4];
68 };
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
const char * getDefaultName() override
Definition: weathermeta.cpp:40
virtual ~WeatherMeta()=default
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: weathermeta.cpp:55
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...
Definition: weathermeta.cpp:86
bool Disconnect() override
Disconnect from device.
Definition: weathermeta.cpp:50
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: weathermeta.cpp:45
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: weathermeta.cpp:95
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
One light descriptor.
One number descriptor.
One text descriptor.
Light vector property descriptor.
Definition: indiapi.h:417
Number vector property descriptor.
Definition: indiapi.h:319
Text vector property descriptor.
Definition: indiapi.h:246