Instrument Neutral Distributed Interface INDI  2.0.2
ieq45.h
Go to the documentation of this file.
1 /*
2  IEQ45 Basic Driver
3  Copyright (C) 2011 Nacho Mas (mas.ignacio@gmail.com). Only litle changes
4  from lx200basic made it by Jasem Mutlaq (mutlaqja@ikarustech.com)
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 */
21 
22 #pragma once
23 
24 #include "indicom.h"
25 #include "indidevapi.h"
26 
28 {
29  public:
30  IEQ45Basic();
31  ~IEQ45Basic();
32 
33  void ISGetProperties(const char *dev);
34  void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
35  void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
36  void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
37  void ISPoll();
38 
39  void connection_lost();
40  void connection_resumed();
41 
42  private:
43  enum IEQ45_STATUS
44  {
45  IEQ45_SLEW,
46  IEQ45_SYNC,
47  IEQ45_PARK
48  };
49 
50  /* Switches */
51  ISwitch ConnectS[2];
52  ISwitch OnCoordSetS[2];
53  ISwitch TrackModeS[4];
54  ISwitch AbortSlewS[1];
55 
56  /* Texts */
57  IText PortT[1] {};
58 
59  /* Numbers */
60  INumber EquatorialCoordsRN[2];
61 
62  /* Switch Vectors */
63  ISwitchVectorProperty ConnectSP;
64  ISwitchVectorProperty OnCoordSetSP;
65  ISwitchVectorProperty TrackModeSP;
66  ISwitchVectorProperty AbortSlewSP;
67 
68  /* Number Vectors */
69  INumberVectorProperty EquatorialCoordsRNP;
70 
71  /* Text Vectors */
72  ITextVectorProperty PortTP;
73 
74  /*******************************************************/
75  /* Connection Routines
76  ********************************************************/
77  void init_properties();
78  void get_initial_data();
79  void connect_telescope();
80  bool is_connected();
81 
82  /*******************************************************/
83  /* Misc routines
84  ********************************************************/
85  bool process_coords();
86  int get_switch_index(ISwitchVectorProperty *sp);
87 
88  /*******************************************************/
89  /* Simulation Routines
90  ********************************************************/
91  void enable_simulation(bool enable);
92 
93  /*******************************************************/
94  /* Error handling routines
95  ********************************************************/
96  void slew_error(int slewCode);
97  void reset_all_properties();
98  void handle_error(INumberVectorProperty *nvp, int err, const char *msg);
99  void correct_fault();
100 
101  protected:
102  double JD; /* Julian Date */
103  double lastRA;
104  double lastDEC;
106  bool fault;
107  int fd; /* Telescope tty file descriptor */
108 
110  int lastSet;
112 };
bool fault
Definition: ieq45.h:106
int currentSet
Definition: ieq45.h:109
void ISPoll()
Definition: ieq45.cpp:442
IEQ45Basic()
Definition: ieq45.cpp:78
int lastSet
Definition: ieq45.h:110
double JD
Definition: ieq45.h:102
double targetDEC
Definition: ieq45.h:111
void connection_lost()
Definition: ieq45.cpp:699
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Definition: ieq45.cpp:164
double targetRA
Definition: ieq45.h:111
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Definition: ieq45.cpp:271
double lastDEC
Definition: ieq45.h:104
void ISGetProperties(const char *dev)
Definition: ieq45.cpp:147
int fd
Definition: ieq45.h:107
bool simulation
Definition: ieq45.h:105
double lastRA
Definition: ieq45.h:103
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Definition: ieq45.cpp:194
void connection_resumed()
Definition: ieq45.cpp:709
~IEQ45Basic()
Definition: ieq45.cpp:98
ISState
Switch state.
Definition: indiapi.h:150
Implementations for common driver routines.
Interface to the reference INDI C API device implementation on the Device Driver side.
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