Instrument Neutral Distributed Interface INDI  2.0.2
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 "lx200_OpenAstroTech.h"
36 #include "lx200ap.h"
37 #include "lx200ap_v2.h"
38 #include "lx200ap_gtocp2.h"
39 #include "lx200classic.h"
40 #include "lx200fs2.h"
41 #include "lx200gemini.h"
42 #include "lx200pulsar2.h"
43 #include "lx200ss2000pc.h"
44 #include "lx200zeq25.h"
45 #include "lx200gotonova.h"
46 #include "ioptronHC8406.h"
47 #include "lx200am5.h"
48 #include "lx200_pegasus_nyx101.h"
49 #include <cmath>
50 #include <memory>
51 #include <cstring>
52 #include <unistd.h>
53 #include "eq500x.h"
54 
55  /* There is _one_ binary for all LX200 drivers, but each binary is renamed
56  ** to its device name (i.e. lx200gps, lx200_16..etc). The main function will
57  ** fetch from std args the binary name and ISInit will create the apporpiate
58  ** device afterwards. If the binary name does not match any known devices,
59  ** we simply create a generic device.
60  */
61  extern char *__progname;
62 
63 #define LX200_TRACK 0
64 #define LX200_SYNC 1
65 
66 static class Loader
67 {
68  std::unique_ptr<LX200Generic> telescope;
69  public:
70  Loader()
71  {
72  // Note: these if statements use strstr() which isn't a full string match, just a substring,
73  // so if one driver name is the start of another's name, it needs to be AFTER the longer one!
74  if (strstr(__progname, "indi_lx200classic"))
75  {
76  IDLog("initializing from LX200 classic device...\n");
77  telescope.reset(new LX200Classic());
78  }
79  else if (strstr(__progname, "indi_lx200_OnStep"))
80  {
81  IDLog("initializing from LX200 OnStep device...\n");
82  telescope.reset(new LX200_OnStep());
83  }
84  else if (strstr(__progname, "indi_lx200gps"))
85  {
86  IDLog("initializing from LX200 GPS device...\n");
87  telescope.reset(new LX200GPS());
88  }
89  else if (strstr(__progname, "indi_lx200_16"))
90  {
91  IDLog("Initializing from LX200 16 device...\n");
92  telescope.reset(new LX200_16());
93  }
94  else if (strstr(__progname, "indi_lx200autostar"))
95  {
96  IDLog("initializing from Autostar device...\n");
97  telescope.reset(new LX200Autostar());
98  }
99  else if (strstr(__progname, "indi_lx200ap_v2"))
100  {
101  IDLog("initializing from Astrophysics V2 device...\n");
102  telescope.reset(new LX200AstroPhysicsV2());
103  }
104  else if (strstr(__progname, "indi_lx200ap_gtocp2"))
105  {
106  IDLog("initializing from Astrophysics GTOCP2 device...\n");
107  telescope.reset(new LX200AstroPhysicsGTOCP2());
108  }
109  else if (strstr(__progname, "indi_lx200ap"))
110  {
111  IDLog("initializing from Astrophysics device...\n");
112  telescope.reset(new LX200AstroPhysics());
113  }
114  else if (strstr(__progname, "indi_lx200gemini"))
115  {
116  IDLog("initializing from Losmandy Gemini device...\n");
117  telescope.reset(new LX200Gemini());
118  }
119  else if (strstr(__progname, "indi_lx200zeq25"))
120  {
121  IDLog("initializing from ZEQ25 device...\n");
122  telescope.reset(new LX200ZEQ25());
123  }
124  else if (strstr(__progname, "indi_lx200gotonova"))
125  {
126  IDLog("initializing from GotoNova device...\n");
127  telescope.reset(new LX200GotoNova());
128  }
129  else if (strstr(__progname, "indi_ioptronHC8406"))
130  {
131  IDLog("initializing from ioptron telescope Hand Controller HC8406 device...\n");
132  telescope.reset(new ioptronHC8406());
133  }
134  else if (strstr(__progname, "indi_lx200pulsar2"))
135  {
136  IDLog("initializing from pulsar2 device...\n");
137  telescope.reset(new LX200Pulsar2());
138  }
139  else if (strstr(__progname, "indi_lx200ss2000pc"))
140  {
141  IDLog("initializing from skysensor2000pc device...\n");
142  telescope.reset(new LX200SS2000PC());
143  }
144  else if (strstr(__progname, "indi_lx200fs2"))
145  {
146  IDLog("initializing from Astro-Electronic FS-2...\n");
147  telescope.reset(new LX200FS2());
148  }
149  else if (strstr(__progname, "indi_lx200_10micron"))
150  {
151  IDLog("initializing for 10Micron mount...\n");
152  telescope.reset(new LX200_10MICRON());
153  }
154  else if (strstr(__progname, "indi_eq500x"))
155  {
156  IDLog("initializing for EQ500X mount...\n");
157  telescope.reset(new EQ500X());
158  }
159  else if (strstr(__progname, "indi_lx200am5"))
160  {
161  IDLog("initializing for ZWO AM5 mount...\n");
162  telescope.reset(new LX200AM5());
163  }
164  else if (strstr(__progname, "indi_lx200_OpenAstroTech"))
165  {
166  IDLog("initializing for OpenAstroTech mount...\n");
167  telescope.reset(new LX200_OpenAstroTech());
168  }
169  else if (strstr(__progname, "indi_lx200_pegasus_nyx101"))
170  {
171  IDLog("initializing for Pegasus NYX-101 mount...\n");
172  telescope.reset(new LX200NYX101());
173  }
174  // be nice and give them a generic device
175  else
176  telescope.reset(new LX200Generic());
177  }
178 } loader;
179 
180 /**************************************************
181 *** LX200 Generic Implementation
182 ***************************************************/
183 
185 {
186  setVersion(2, 1);
187 
188  currentSiteNum = 1;
190  GuideNSTID = 0;
191  GuideWETID = 0;
192 
193  DBG_SCOPE = INDI::Logger::getInstance().addDebugLevel("Scope Verbose", "SCOPE");
194 
197 
200  4);
201 
202  LOG_DEBUG("Initializing from Generic LX200 device...");
203 }
Definition: eq500x.h:29
void setVersion(uint16_t vMajor, uint16_t vMinor)
Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor.
void SetTelescopeCapability(uint32_t cap, uint8_t slewRateCount)
SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.
void setLX200Capability(uint32_t cap)
#define POLLMS
void IDLog(const char *fmt,...)
Definition: indicom.c:316
#define LOG_DEBUG(txt)
Definition: indilogger.h:75
@ LX200_TRACK_SIDEREAL
Definition: lx200driver.h:107
char * __progname
static Logger & getInstance()
Method to get a reference to the object (i.e., Singleton) It is a static method.
Definition: indilogger.cpp:339
int addDebugLevel(const char *debugLevelName, const char *LoggingLevelName)
Adds a new debugging level to the driver.
Definition: indilogger.cpp:72