Instrument Neutral Distributed Interface INDI 2.2.5
wanderer_dew_terminator.h
Go to the documentation of this file.
1/*******************************************************************************
2 Copyright(c) 2024 Frank Wang. All rights reserved.
3
4 Wanderer Dew Terminator
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"
28#include <vector>
29#include <stdint.h>
30
31namespace Connection
32{
33class Serial;
34}
35
37{
38public:
40 virtual ~WandererDewTerminator() = default;
41
42 virtual bool initProperties() override;
43 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
44 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
45 virtual bool updateProperties() override;
46
47
48
49protected:
50 const char *getDefaultName() override;
51 virtual bool saveConfigItems(FILE *fp) override;
52 virtual void TimerHit() override;
53
54
55private:
56
57 int firmware=0;
58 bool sendCommand(std::string command);
59 bool DC1DIFFMODE=false;
60 bool DC1CONSTMODE=false;
61 bool DC2DIFFMODE=false;
62 bool DC2CONSTMODE=false;
63 bool DC3DIFFMODE=false;
64 bool DC3CONSTMODE=false;
65 bool getData();
66 static constexpr const char *ENVIRONMENT_TAB {"Sensors"};
67 static constexpr const char *DC1_TAB {"DC1"};
68 static constexpr const char *DC2_TAB {"DC2"};
69 static constexpr const char *DC3_TAB {"DC3"};
70 //Current Calibrate
71 INDI::PropertySwitch CalibrateSP{1};
72
73
74 //Temp1
75 double temp1read = 0;
76 //Temp2
77 double temp2read = 0;
78 //Temp3
79 double temp3read = 0;
80 //DHTH
81 double DHTHread = 0;
82 //DHTT
83 void updateENV(double temp1,double temp2,double temp3,double DHTH,double DHTT);
84 double DHTTread = 0;
85
86 //Power Monitor
87 void updatePower(double voltage);
88 double voltageread = 0;
89
90 //DC1
91 void updateDC1(int value);
92 int DC1read = 0;
93 //DC2
94 void updateDC2(int value);
95 int DC2read = 0;
96 //DC3
97 void updateDC3(int value);
98 int DC3read = 0;
99
100
101 bool setDewPWM(uint8_t id, uint8_t value);
102
103
104 //DC1 Control////////////////////////////////////////////////////////////////
105 INDI::PropertyNumber DC1ControlNP{1};
106 enum
107 {
108 DC1,
109 };
110 //DC2 Control////////////////////////////////////////////////////////////////
111 INDI::PropertyNumber DC2ControlNP{1};
112 enum
113 {
114 DC2,
115 };
116 //DC3 Control////////////////////////////////////////////////////////////////
117 INDI::PropertyNumber DC3ControlNP{1};
118 enum
119 {
120 DC3,
121 };
122 //DC1 DIFF////////////////////////////////////////////////////////////////
123 INDI::PropertySwitch DC1diffSP{3};
124 enum
125 {
126 DC1_Manual,
127 DC1_DPD_Mode,
128 DC1_CT_Mode,
129 };
130
131 INDI::PropertyNumber DC1diffSETNP{1};
132 enum
133 {
134 DC1DIFFSET,
135 };
136 INDI::PropertyNumber DC1constSETNP{1};
137 enum
138 {
139 DC1CONSTSET,
140 };
141
142 //DC2 DIFF////////////////////////////////////////////////////////////////
143 INDI::PropertySwitch DC2diffSP{3};
144 enum
145 {
146 DC2_Manual,
147 DC2_DPD_Mode,
148 DC2_CT_Mode,
149 };
150
151 INDI::PropertyNumber DC2diffSETNP{1};
152 enum
153 {
154 DC2DIFFSET,
155 };
156 INDI::PropertyNumber DC2constSETNP{1};
157 enum
158 {
159 DC2CONSTSET,
160 };
161
162 //DC3 DIFF////////////////////////////////////////////////////////////////
163 INDI::PropertySwitch DC3diffSP{3};
164 enum
165 {
166 DC3_Manual,
167 DC3_DPD_Mode,
168 DC3_CT_Mode,
169 };
170
171 INDI::PropertyNumber DC3diffSETNP{1};
172 enum
173 {
174 DC3DIFFSET,
175 };
176 INDI::PropertyNumber DC3constSETNP{1};
177 enum
178 {
179 DC3CONSTSET,
180 };
181
182
183 // Power Monitor
184
185 INDI::PropertyNumber PowerMonitorNP{4};
186 enum
187 {
188 VOLTAGE,
189
190 };
191
192 // ENV Monitor
193
194 INDI::PropertyNumber ENVMonitorNP{6};
195 enum
196 {
197 Probe1_Temp,
198 Probe2_Temp,
199 Probe3_Temp,
200 ENV_Humidity,
201 ENV_Temp,
202 DEW_Point,
203 };
204
205
206
207 int PortFD{ -1 };
208
209 Connection::Serial *serialConnection{ nullptr };
210};
The Serial class manages connection with serial devices including Bluetooth. Serial communication is ...
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
const char * getDefaultName() override
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual ~WandererDewTerminator()=default
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
ISState
Switch state.
Definition indiapi.h:148
Combines all INDI Connection Plugins. Each INDI connection plugin is responsible of managing communic...
Definition arduino_st4.h:34