Instrument Neutral Distributed Interface INDI  2.0.2
scopedome_sim.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  ScopeDome Dome INDI Driver
3 
4  Copyright(c) 2017-2021 Jarno Paananen. All rights reserved.
5 
6  based on:
7 
8  ScopeDome Windows ASCOM driver version 5.1.30
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Library General Public
12  License version 2 as published by the Free Software Foundation.
13  .
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18  .
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 *******************************************************************************/
24 
25 #include "scopedome_sim.h"
26 
28 {
29  return true;
30 }
31 
33 {
34  return 0;
35 }
36 
38 {
39  return 0;
40 }
41 
42 // Abstract versions
44 {
45  (void)input;
46  return ISS_OFF;
47 #if 0
48  DigitalIO channel;
49  switch(input)
50  {
51  case HOME:
52  channel = IN_HOME;
53  break;
54  case OPEN1:
55  channel = IN_OPEN1;
56  break;
57  case CLOSED1:
58  channel = IN_CLOSED1;
59  break;
60  case OPEN2:
61  channel = IN_OPEN2;
62  break;
63  case CLOSED2:
64  channel = IN_CLOSED1;
65  break;
66  case ROTARY_LINK:
67  channel = IN_ROT_LINK;
68  break;
69  default:
70  LOG_ERROR("invalid input");
71  return ISS_OFF;
72  }
73  return getInputState(channel);
74 #endif
75 }
76 
78 {
79  (void)output;
80  (void)onOff;
81  return 0;
82 #if 0
83  DigitalIO channel;
84  switch(output)
85  {
86  case RESET:
87  channel = OUT_RELAY1;
88  break;
89  case CW:
90  channel = OUT_CW;
91  break;
92  case CCW:
93  channel = OUT_CCW;
94  break;
95  default:
96  LOG_ERROR("invalid output");
97  return ISS_OFF;
98  }
99  return setOutputState(channel, onOff);
100 #endif
101 }
102 
103 void ScopeDomeSim::getFirmwareVersions(double &main, double &rotary)
104 {
105  main = 3.7;
106  rotary = 3.7;
107 }
108 
110 {
111  return STEPS_PER_REVOLUTION;
112 }
113 
115 {
116  return 0;
117 }
118 
120 {
121  return 0;
122 }
123 
125 {
126  return false;
127 }
128 
130 {
131 }
132 
134 {
135 }
136 
138 {
139 }
140 
142 {
143  (void) operation;
144 }
145 
147 {
148 }
149 
150 void ScopeDomeSim::move(int steps)
151 {
152  (void) steps;
153 }
154 
156 {
157  return 11;
158 }
159 
161 {
163  switch(index)
164  {
165  case 0:
166  info.propName = "LINK_STRENGTH";
167  info.label = "Shutter link strength";
168  info.format = "%3.0f";
169  info.minValue = 0;
170  info.maxValue = 100;
171  break;
172  case 1:
173  info.propName = "SHUTTER_POWER";
174  info.label = "Shutter internal power";
175  info.format = "%2.2f";
176  info.minValue = 0;
177  info.maxValue = 100;
178  break;
179  case 2:
180  info.propName = "SHUTTER_BATTERY";
181  info.label = "Shutter battery power";
182  info.format = "%2.2f";
183  info.minValue = 0;
184  info.maxValue = 100;
185  break;
186  case 3:
187  info.propName = "CARD_POWER";
188  info.label = "Card internal power";
189  info.format = "%2.2f";
190  info.minValue = 0;
191  info.maxValue = 100;
192  break;
193  case 4:
194  info.propName = "CARD_BATTERY";
195  info.label = "Card battery power";
196  info.format = "%2.2f";
197  info.minValue = 0;
198  info.maxValue = 100;
199  break;
200  case 5:
201  info.propName = "TEMP_DOME_IN";
202  info.label = "Temperature in dome";
203  info.format = "%2.2f";
204  info.minValue = -100;
205  info.maxValue = 100;
206  break;
207  case 6:
208  info.propName = "TEMP_DOME_OUT";
209  info.label = "Temperature outside dome";
210  info.format = "%2.2f";
211  info.minValue = -100;
212  info.maxValue = 100;
213  break;
214  case 7:
215  info.propName = "TEMP_DOME_HUMIDITY";
216  info.label = "Temperature humidity sensor";
217  info.format = "%2.2f";
218  info.minValue = -100;
219  info.maxValue = 100;
220  break;
221  case 8:
222  info.propName = "HUMIDITY";
223  info.label = "Humidity";
224  info.format = "%3.2f";
225  info.minValue = 0;
226  info.maxValue = 100;
227  break;
228  case 9:
229  info.propName = "PRESSURE";
230  info.label = "Pressure";
231  info.format = "%4.1f";
232  info.minValue = 0;
233  info.maxValue = 2000;
234  break;
235  case 10:
236  info.propName = "DEW_POINT";
237  info.label = "Dew point";
238  info.format = "%2.2f";
239  info.minValue = -100;
240  info.maxValue = 100;
241  break;
242  default:
243  LOG_ERROR("invalid sensor index");
244  break;
245  }
246  return info;
247 }
248 
249 double ScopeDomeSim::getSensorValue(size_t index)
250 {
251  double value = 0;
252 
253  switch(index)
254  {
255  case 0:
256  break;
257  case 1:
258  break;
259  case 2:
260  break;
261  case 3:
262  break;
263  case 4:
264  break;
265  case 5:
266  break;
267  case 6:
268  break;
269  case 7:
270  break;
271  case 8:
272  break;
273  case 9:
274  break;
275  case 10:
276  break;
277  default:
278  LOG_ERROR("invalid sensor index");
279  break;
280  }
281  return value;
282 }
283 
285 {
286  return 0;
287 }
288 
290 {
291  (void) index;
293  return info;
294 }
295 
297 {
298  (void) index;
299  return ISS_OFF;
300 }
301 
302 void ScopeDomeSim::setRelayState(size_t index, ISState state)
303 {
304  (void) index;
305  (void) state;
306 }
307 
309 {
310  return 0;
311 }
312 
314 {
315  (void) index;
317  return info;
318 }
319 
321 {
322  (void) index;
323  return ISS_OFF;
324 }
325 
327 {
328  (void)polarity;
329 }
virtual size_t getNumberOfRelays() override
virtual void setRelayState(size_t index, ISState state) override
virtual uint32_t getStepsPerRevolution() override
virtual bool detect() override
virtual ISState getInputValue(size_t index) override
virtual void resetCounter() override
virtual void calibrate() override
virtual bool isCalibrationNeeded() override
virtual SensorInfo getSensorInfo(size_t index) override
virtual ISState getInputState(AbstractInput input) override
virtual int getRotationCounterExt() override
virtual double getSensorValue(size_t index) override
virtual void controlShutter(ShutterOperation operation) override
virtual void getFirmwareVersions(double &main, double &rotary) override
virtual int getRotationCounter() override
virtual size_t getNumberOfSensors() override
virtual size_t getNumberOfInputs() override
virtual void findHome() override
virtual void abort() override
virtual RelayInfo getRelayInfo(size_t index) override
virtual void setHomeSensorPolarity(HomeSensorPolarity polarity) override
virtual void move(int steps) override
virtual InputInfo getInputInfo(size_t index) override
virtual uint32_t getStatus() override
virtual ISState getRelayState(size_t index) override
virtual int setOutputState(AbstractOutput output, ISState state) override
virtual int updateState() override
ISState
Switch state.
Definition: indiapi.h:150
@ ISS_OFF
Definition: indiapi.h:151
#define LOG_ERROR(txt)
Shorter logging macros. In order to use these macros, the function (or method) "getDeviceName()" must...
Definition: indilogger.h:72
int main(int, char *[])