Instrument Neutral Distributed Interface INDI 2.2.5
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
24#ifdef _USE_SYSTEM_HIDAPILIB
25#include <hidapi/hidapi.h>
26#else
27#include <indi_hidapi.h>
28#endif
29
30#include "indifocuser.h"
31
33{
34 public:
35
37
39
40 const char *getDefaultName() override;
41
42 void ISGetProperties(const char *dev) override;
43
44 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
45
46 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
47
48 void TimerHit() override;
49
50 protected:
51
52 bool initProperties() override;
53
54 bool updateProperties() override;
55
56 bool Connect() override;
57
58 bool Disconnect() override;
59
60 bool AbortFocuser() override;
61
62 IPState MoveAbsFocuser(uint32_t targetTicks) override;
63
64 IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override;
65
66 private:
67
68 hid_device *hid_handle;
69
70 double internalTicks{0};
71 // double initTicks{0}; // #PS: unused
72
73 // Hardware version display
74 INDI::PropertyText HardwareVersionNP {1};
75
76 // Software version display
77 INDI::PropertyText SoftwareVersionNP {1};
78
79 // Air Temperature in celsius degrees
80 INDI::PropertyNumber AirTemperatureNP {1};
81
82 // Mirror Temperature in celsius degrees
83 INDI::PropertyNumber MirrorTemperatureNP {1};
84
85 // Tube Temperature in celsius degrees
86 INDI::PropertyNumber TubeTemperatureNP {1};
87
88 // Fan State switch
89 INDI::PropertySwitch FanSP {2};
90 enum
91 {
92 FAN_ON,
93 FAN_OFF,
94 };
95
96
97};
IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks) override
MoveFocuser the focuser to an relative position.
bool initProperties() override
Initializes the default properties for the focuser device. Sets up standard INDI properties,...
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
bool updateProperties() override
Updates the state and definition of properties based on the current connection status....
void ISGetProperties(const char *dev) override
Handles client requests for property definitions for this device or all devices. Delegates to the bas...
bool Disconnect() override
Disconnect from device.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Processes incoming new number values from the client for this device. Handles updates to FocuserInter...
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
Processes incoming new switch states from the client for this device. Handles updates to FocuserInter...
const char * getDefaultName() override
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158