Instrument Neutral Distributed Interface INDI  2.0.2
activefocuser.h
Go to the documentation of this file.
1 /*
2  ActiveFocuser driver for Takahashi CCA-250 and Mewlon-250/300CRS
3  Driver written by Alvin FREY <https://afrey.fr> for Optique Unterlinden and Takahashi Europe
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Lesser General Public License for more details.
12  You should have received a copy of the GNU Lesser General Public
13  License along with this library; if not, write to the Free Software
14  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 */
16 
17 #pragma once
18 #include <cmath>
19 #include <memory>
20 #include <cstring>
21 #include <sstream>
22 #include <unistd.h>
23 #include "hidapi.h"
24 #include "indifocuser.h"
25 
27 {
28  public:
29 
30  ActiveFocuser();
31 
33 
34  const char *getDefaultName() override;
35 
36  void ISGetProperties(const char *dev) override;
37 
38  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
39 
40  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
41 
42  void TimerHit() override;
43 
44  protected:
45 
46  bool initProperties() override;
47 
48  bool updateProperties() override;
49 
50  bool Connect() override;
51 
52  bool Disconnect() override;
53 
54  bool AbortFocuser() override;
55 
56  IPState MoveAbsFocuser(uint32_t targetTicks) override;
57 
58  IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
59 
60  private:
61 
62  hid_device *hid_handle;
63 
64  double internalTicks{0};
65  // double initTicks{0}; // #PS: unused
66 
67  // Hardware version display
68  ITextVectorProperty HardwareVersionNP;
69  IText HardwareVersionN[1];
70 
71  // Software version display
72  ITextVectorProperty SoftwareVersionNP;
73  IText SoftwareVersionN[1];
74 
75  // Air Temperature in celsius degrees
76  INumberVectorProperty AirTemperatureNP;
77  INumber AirTemperatureN[1];
78 
79  // Mirror Temperature in celsius degrees
80  INumberVectorProperty MirrorTemperatureNP;
81  INumber MirrorTemperatureN[1];
82 
83  // Tube Temperature in celsius degrees
84  INumberVectorProperty TubeTemperatureNP;
85  INumber TubeTemperatureN[1];
86 
87  // Fan State switch
88  ISwitch FanS[2];
90 
91 };
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
bool Disconnect() override
Disconnect from device.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
IPState MoveAbsFocuser(uint32_t targetTicks) override
MoveFocuser the focuser to an absolute position.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
bool AbortFocuser() override
AbortFocuser all focus motion.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
One number descriptor.
One switch descriptor.
One text descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367
Text vector property descriptor.
Definition: indiapi.h:246