Instrument Neutral Distributed Interface INDI  2.0.2
dsc.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3 
4  Generic Digital Setting Circles Driver
5 
6  It just gets the encoder position and outputs current coordinates.
7  Calibratoin and syncing not supported yet.
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License version 2 as published by the Free Software Foundation.
12  .
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17  .
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 *******************************************************************************/
23 
24 #pragma once
25 
26 #include "inditelescope.h"
28 
29 #include <libnova/ln_types.h>
30 
32 {
33  public:
34  DSC();
35  virtual ~DSC() = default;
36 
37  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
38  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
39  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
40 
41  protected:
42  virtual const char *getDefaultName() override;
43  virtual bool Handshake() override;
44 
45  virtual bool initProperties() override;
46  virtual bool updateProperties() override;
47  virtual bool saveConfigItems(FILE *fp) override;
48  virtual bool ReadScopeStatus() override;
49 
50  virtual bool Sync(double ra, double dec) override;
51  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
52 
53  virtual void simulationTriggered(bool enable) override;
54 
55  private:
56  INDI::IEquatorialCoordinates TelescopeEquatorialToSky();
57  INDI::IEquatorialCoordinates TelescopeHorizontalToSky();
58 
59  INumber EncoderN[4];
60  INumberVectorProperty EncoderNP;
61  enum
62  {
63  AXIS1_ENCODER,
64  AXIS2_ENCODER,
65  AXIS1_RAW_ENCODER,
66  AXIS2_RAW_ENCODER
67  };
68 
69  INumber AxisSettingsN[4];
70  INumberVectorProperty AxisSettingsNP;
71  //enum { AXIS1_TICKS, AXIS2_TICKS};
72  enum
73  {
74  AXIS1_TICKS,
75  AXIS1_DEGREE_OFFSET,
76  AXIS2_TICKS,
77  AXIS2_DEGREE_OFFSET
78  };
79 
80  ISwitch AxisRangeS[2];
81  ISwitchVectorProperty AxisRangeSP;
82  enum
83  {
84  AXIS_FULL_STEP,
85  AXIS_HALF_STEP
86  };
87 
88  ISwitch ReverseS[2];
89  ISwitchVectorProperty ReverseSP;
90 
91  ISwitch MountTypeS[2];
92  ISwitchVectorProperty MountTypeSP;
93  enum
94  {
95  MOUNT_EQUATORIAL,
96  MOUNT_ALTAZ
97  };
98 
99  //INumber EncoderOffsetN[6];
100  //INumberVectorProperty EncoderOffsetNP;
101  //enum { OFFSET_AXIS1_SCALE, OFFSET_AXIS1_OFFSET, AXIS1_DEGREE_OFFSET, OFFSET_AXIS2_SCALE, OFFSET_AXIS2_OFFSET, AXIS2_DEGREE_OFFSET };
102 
103  // Simulation Only
104  INumber SimEncoderN[2];
105  INumberVectorProperty SimEncoderNP;
106 
107  INDI::IHorizontalCoordinates encoderHorizontalCoordinates { 0, 0 };
108  INDI::IEquatorialCoordinates encoderEquatorialCoordinates { 0, 0 };
109 };
Definition: dsc.h:32
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: dsc.cpp:150
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: dsc.cpp:204
virtual ~DSC()=default
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
Definition: dsc.cpp:407
virtual bool ReadScopeStatus() override
Read telescope status.
Definition: dsc.cpp:253
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition: dsc.cpp:51
virtual const char * getDefaultName() override
Definition: dsc.cpp:46
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
Definition: dsc.cpp:534
virtual bool Handshake() override
perform handshake with device to check communication
Definition: dsc.cpp:248
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: dsc.cpp:163
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: dsc.cpp:170
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
Definition: dsc.cpp:116
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
Definition: dsc.cpp:540
DSC()
Definition: dsc.cpp:41
This class encapsulates all the alignment subsystem classes that are useful to driver implementations...
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367