Instrument Neutral Distributed Interface INDI  1.9.5
lx200generic.cpp
Go to the documentation of this file.
1 #if 0
2 LX200 Generic
3 Copyright (C) 2003 - 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
4 
5 This library is free software;
6 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;
9 either
10 version 2.1 of the License, or (at your option) any later version.
11 
12 This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY;
14 without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17 
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library;
20 if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
22 
23 2013 - 10 - 27:
24 Updated driver to use INDI::Telescope (JM)
25 2015 - 11 - 25:
26  Use variable POLLMS instead of static POLLMS
27 
28 #endif
29 
30 #include "lx200generic.h"
31 
32 #include "lx200_10micron.h"
33 #include "lx200_16.h"
34 #include "lx200_OnStep.h"
35 #include "lx200ap.h"
36 #include "lx200ap_gtocp2.h"
37 #include "lx200classic.h"
38 #include "lx200fs2.h"
39 #include "lx200gemini.h"
40 #include "lx200pulsar2.h"
41 #include "lx200ss2000pc.h"
42 #include "lx200zeq25.h"
43 #include "lx200gotonova.h"
44 #include "ioptronHC8406.h"
45 #include <cmath>
46 #include <memory>
47 #include <cstring>
48 #include <unistd.h>
49 #include "eq500x.h"
50 
51  /* There is _one_ binary for all LX200 drivers, but each binary is renamed
52  ** to its device name (i.e. lx200gps, lx200_16..etc). The main function will
53  ** fetch from std args the binary name and ISInit will create the apporpiate
54  ** device afterwards. If the binary name does not match any known devices,
55  ** we simply create a generic device.
56  */
57  extern char *__progname;
58 
59 #define LX200_TRACK 0
60 #define LX200_SYNC 1
61 
62 static class Loader
63 {
64  std::unique_ptr<LX200Generic> telescope;
65  public:
66  Loader()
67  {
68  if (strstr(__progname, "indi_lx200classic"))
69  {
70  IDLog("initializing from LX200 classic device...\n");
71  telescope.reset(new LX200Classic());
72  }
73  else if (strstr(__progname, "indi_lx200_OnStep"))
74  {
75  IDLog("initializing from LX200 OnStep device...\n");
76  telescope.reset(new LX200_OnStep());
77  }
78  else if (strstr(__progname, "indi_lx200gps"))
79  {
80  IDLog("initializing from LX200 GPS device...\n");
81  telescope.reset(new LX200GPS());
82  }
83  else if (strstr(__progname, "indi_lx200_16"))
84  {
85  IDLog("Initializing from LX200 16 device...\n");
86  telescope.reset(new LX200_16());
87  }
88  else if (strstr(__progname, "indi_lx200autostar"))
89  {
90  IDLog("initializing from Autostar device...\n");
91  telescope.reset(new LX200Autostar());
92  }
93  else if (strstr(__progname, "indi_lx200ap"))
94  {
95  IDLog("initializing from Astrophysics device...\n");
96  telescope.reset(new LX200AstroPhysics());
97  }
98  else if (strstr(__progname, "indi_lx200ap_gtocp2"))
99  {
100  IDLog("initializing from Astrophysics GTOCP2 device...\n");
101  telescope.reset(new LX200AstroPhysicsGTOCP2());
102  }
103  else if (strstr(__progname, "indi_lx200gemini"))
104  {
105  IDLog("initializing from Losmandy Gemini device...\n");
106  telescope.reset(new LX200Gemini());
107  }
108  else if (strstr(__progname, "indi_lx200zeq25"))
109  {
110  IDLog("initializing from ZEQ25 device...\n");
111  telescope.reset(new LX200ZEQ25());
112  }
113  else if (strstr(__progname, "indi_lx200gotonova"))
114  {
115  IDLog("initializing from GotoNova device...\n");
116  telescope.reset(new LX200GotoNova());
117  }
118  else if (strstr(__progname, "indi_ioptronHC8406"))
119  {
120  IDLog("initializing from ioptron telescope Hand Controller HC8406 device...\n");
121  telescope.reset(new ioptronHC8406());
122  }
123  else if (strstr(__progname, "indi_lx200pulsar2"))
124  {
125  IDLog("initializing from pulsar2 device...\n");
126  telescope.reset(new LX200Pulsar2());
127  }
128  else if (strstr(__progname, "indi_lx200ss2000pc"))
129  {
130  IDLog("initializing from skysensor2000pc device...\n");
131  telescope.reset(new LX200SS2000PC());
132  }
133  else if (strstr(__progname, "indi_lx200fs2"))
134  {
135  IDLog("initializing from Astro-Electronic FS-2...\n");
136  telescope.reset(new LX200FS2());
137  }
138  else if (strstr(__progname, "indi_lx200_10micron"))
139  {
140  IDLog("initializing for 10Micron mount...\n");
141  telescope.reset(new LX200_10MICRON());
142  }
143  else if (strstr(__progname, "indi_eq500x"))
144  {
145  IDLog("initializing for EQ500X mount...\n");
146  telescope.reset(new EQ500X());
147  }
148  // be nice and give them a generic device
149  else
150  telescope.reset(new LX200Generic());
151  }
152 } loader;
153 
154 /**************************************************
155 *** LX200 Generic Implementation
156 ***************************************************/
157 
159 {
160  setVersion(2, 1);
161 
162  currentSiteNum = 1;
164  GuideNSTID = 0;
165  GuideWETID = 0;
166 
167  DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE");
168 
171 
174  4);
175 
176  LOG_DEBUG("Initializing from Generic LX200 device...");
177 }
LX200Generic
Definition: lx200generic.h:25
lx200gotonova.h
LX200_OnStep
Definition: lx200_OnStep.h:151
INDI::Telescope::TELESCOPE_CAN_PARK
@ TELESCOPE_CAN_PARK
Definition: inditelescope.h:161
lx200ap.h
LX200Autostar
Definition: lx200autostar.h:25
LX200Telescope::LX200_HAS_SITES
@ LX200_HAS_SITES
Definition: lx200telescope.h:47
INDI::Logger::getInstance
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
Definition: indilogger.cpp:354
LX200Telescope::DBG_SCOPE
uint8_t DBG_SCOPE
Definition: lx200telescope.h:174
Aux::ANY
@ ANY
Definition: celestronauxpacket.h:86
LX200Gemini
Definition: lx200gemini.h:31
lx200pulsar2.h
ioptronHC8406.h
LX200Telescope::trackingMode
int trackingMode
Definition: lx200telescope.h:171
INDI::Telescope::TELESCOPE_HAS_TRACK_MODE
@ TELESCOPE_HAS_TRACK_MODE
Definition: inditelescope.h:167
INDI::DefaultDevice::setVersion
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
Definition: defaultdevice.cpp:1219
EQ500X
Definition: eq500x.h:28
LX200Generic::LX200Generic
LX200Generic()
Definition: lx200generic.cpp:158
eq500x.h
lx200generic.h
lx200zeq25.h
lx200_10micron.h
LX200Pulsar2
Definition: lx200pulsar2.h:26
IDLog
void void void void void IDLog(const char *msg,...) ATTRIBUTE_FORMAT_PRINTF(1
Function Drivers call to log a message locally.
LX200FS2
Definition: lx200fs2.h:25
LX200GPS
Definition: lx200gps.h:25
LX200_16
Definition: lx200_16.h:25
INDI::Telescope::TELESCOPE_HAS_TIME
@ TELESCOPE_HAS_TIME
Definition: inditelescope.h:163
lx200fs2.h
INDI::Telescope::TELESCOPE_HAS_LOCATION
@ TELESCOPE_HAS_LOCATION
Definition: inditelescope.h:164
LX200Telescope::LX200_HAS_FOCUS
@ LX200_HAS_FOCUS
Definition: lx200telescope.h:44
LX200_10MICRON
Definition: lx200_10micron.h:25
INDI::Telescope::SetTelescopeCapability
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount=0)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
Definition: inditelescope.cpp:1818
lx200_OnStep.h
LX200Telescope::GuideWETID
int GuideWETID
Definition: lx200telescope.h:165
INDI::Telescope::TELESCOPE_CAN_ABORT
@ TELESCOPE_CAN_ABORT
Definition: inditelescope.h:162
LX200Telescope::LX200_HAS_TRACKING_FREQ
@ LX200_HAS_TRACKING_FREQ
Definition: lx200telescope.h:45
LX200Telescope::LX200_HAS_PULSE_GUIDING
@ LX200_HAS_PULSE_GUIDING
Definition: lx200telescope.h:48
LX200ZEQ25
Definition: lx200zeq25.h:25
INDI::Telescope
Definition: inditelescope.h:70
POLLMS
#define POLLMS
Definition: defaultdevice.h:506
lx200_16.h
LOG_DEBUG
#define LOG_DEBUG(txt)
Definition: indilogger.h:75
LX200Telescope::currentSiteNum
int currentSiteNum
Definition: lx200telescope.h:170
LX200AstroPhysics
Definition: lx200ap.h:29
lx200ap_gtocp2.h
LX200Telescope::GuideNSTID
int GuideNSTID
Definition: lx200telescope.h:164
lx200gemini.h
lx200ss2000pc.h
LX200Classic
Definition: lx200classic.h:25
INDI::Telescope::TELESCOPE_CAN_GOTO
@ TELESCOPE_CAN_GOTO
Definition: inditelescope.h:159
LX200Telescope::setLX200Capability
void setLX200Capability(uint32_t cap)
Definition: lx200telescope.h:56
INDI::Telescope::TELESCOPE_CAN_SYNC
@ TELESCOPE_CAN_SYNC
Definition: inditelescope.h:160
lx200classic.h
INDI::Logger::addDebugLevel
int addDebugLevel(const char *debugLevelName, const char *LoggingLevelName)
Adds a new debugging level to the driver.
Definition: indilogger.cpp:87
LX200_TRACK_SIDEREAL
@ LX200_TRACK_SIDEREAL
Definition: lx200driver.h:107
__progname
char * __progname
LX200Telescope::LX200_HAS_ALIGNMENT_TYPE
@ LX200_HAS_ALIGNMENT_TYPE
Definition: lx200telescope.h:46
LX200SS2000PC
Definition: lx200ss2000pc.h:25
ioptronHC8406
Definition: ioptronHC8406.h:27
LX200AstroPhysicsGTOCP2
Definition: lx200ap_gtocp2.h:27
LX200GotoNova
Definition: lx200gotonova.h:25