Instrument Neutral Distributed Interface INDI  1.9.5
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 };
IEQ45Basic::connection_resumed
void connection_resumed()
Definition: ieq45.cpp:709
IEQ45Basic::lastDEC
double lastDEC
Definition: ieq45.h:104
ISwitch
One switch descriptor.
indicom.h
Implementations for common driver routines.
IEQ45Basic::targetDEC
double targetDEC
Definition: ieq45.h:111
INumber
One number descriptor.
IEQ45Basic
Definition: ieq45.h:27
IEQ45Basic::targetRA
double targetRA
Definition: ieq45.h:111
IEQ45Basic::fault
bool fault
Definition: ieq45.h:106
IEQ45Basic::connection_lost
void connection_lost()
Definition: ieq45.cpp:699
IEQ45Basic::ISNewNumber
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Definition: ieq45.cpp:194
IEQ45Basic::IEQ45Basic
IEQ45Basic()
Definition: ieq45.cpp:78
_ITextVectorProperty
Text vector property descriptor.
Definition: indiapi.h:244
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
IEQ45Basic::JD
double JD
Definition: ieq45.h:102
IEQ45Basic::ISGetProperties
void ISGetProperties(const char *dev)
Definition: ieq45.cpp:147
IText
One text descriptor.
indidevapi.h
Interface to the reference INDI C API device implementation on the Device Driver side.
IEQ45Basic::fd
int fd
Definition: ieq45.h:107
IEQ45Basic::currentSet
int currentSet
Definition: ieq45.h:109
IEQ45Basic::ISNewSwitch
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Definition: ieq45.cpp:271
IEQ45Basic::simulation
bool simulation
Definition: ieq45.h:105
IEQ45Basic::ISPoll
void ISPoll()
Definition: ieq45.cpp:442
name
const char * name
Definition: indiserver.c:116
IEQ45Basic::~IEQ45Basic
~IEQ45Basic()
Definition: ieq45.cpp:98
ISState
ISState
Switch state.
Definition: indiapi.h:148
IEQ45Basic::lastRA
double lastRA
Definition: ieq45.h:103
IEQ45Basic::ISNewText
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Definition: ieq45.cpp:164
IEQ45Basic::lastSet
int lastSet
Definition: ieq45.h:110
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365