Instrument Neutral Distributed Interface INDI 2.2.5
aagsolo.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2025 Peter Englmaier. All rights reserved.
3
4 INDI AAG Solo CloudWatcher Driver
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 "indiweather.h"
28
29#include <map>
30
31class AAGSolo : public INDI::Weather
32{
33 public:
34 AAGSolo();
35
36 // Generic indi device entries
37 bool Connect() override;
38 bool Disconnect() override;
39 const char *getDefaultName() override;
40
41 virtual bool initProperties() override;
42 virtual bool updateProperties() override;
43 virtual void ISGetProperties(const char *dev) override;
44 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
45 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
46
47 protected:
48 virtual IPState updateWeather() override;
49 virtual bool saveConfigItems(FILE *fp) override;
50
52
53 typedef enum { CLOUDS, TEMP, WIND, GUST, RAIN,
55 struct key {
56 std::string key; // key in solo output
57 std::string parameter; // parameter name
58 };
59 const static int numKeys=9;
61 { "clouds", "WEATHER_CLOUDS" },
62 { "temp", "WEATHER_TEMPERATURE" },
63 { "wind", "WEATHER_WIND_SPEED" },
64 { "gust", "WEATHER_WIND_GUST" },
65 { "rain", "WEATHER_RAIN" },
66 { "lightmpsas", "WEATHER_LIGHT" },
67 { "safe", "WEATHER_ISSAFE" },
68 { "hum", "WEATHER_HUMIDITY" },
69 { "relpress", "WEATHER_PRESSURE" }
70 };
71
72
73 private:
74 std::map<std::string, std::string> createMap(std::string const &s);
75 bool readWatchFile();
76 bool createProperties();
77
78 INDI::PropertyText soloHostTP {1};
79 INDI::PropertyText soloInfoTP {2};
80
81 std::map<std::string, std::string> weatherMap;
82};
WeatherValue
Definition aagsolo.h:53
@ RELPRESS
Definition aagsolo.h:54
@ LIGHTMPSAS
Definition aagsolo.h:54
@ SAFE
Definition aagsolo.h:54
@ WIND
Definition aagsolo.h:53
@ GUST
Definition aagsolo.h:53
@ HUM
Definition aagsolo.h:54
@ CLOUDS
Definition aagsolo.h:53
@ RAIN
Definition aagsolo.h:53
@ TEMP
Definition aagsolo.h:53
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition aagsolo.cpp:277
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition aagsolo.cpp:226
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition aagsolo.cpp:262
static const int numKeys
Definition aagsolo.h:59
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
Definition aagsolo.cpp:201
const char * getDefaultName() override
Definition aagsolo.cpp:49
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition aagsolo.cpp:361
AAGSolo()
Definition aagsolo.cpp:43
key keys[numKeys]
Definition aagsolo.h:60
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition aagsolo.cpp:54
virtual IPState updateWeather() override
updateWeather Update weather conditions from device or service. The function should not change the st...
Definition aagsolo.cpp:298
bool Disconnect() override
Disconnect from device.
Definition aagsolo.cpp:66
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 aagsolo.cpp:252
INDI::PropertySwitch criticalSP
Definition aagsolo.h:51
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
std::string parameter
Definition aagsolo.h:57
std::string key
Definition aagsolo.h:56