@@ -57,119 +57,125 @@ Updated driver to use INDI::Telescope (JM)
5757 ** device afterwards. If the binary name does not match any known devices,
5858 ** we simply create a generic device.
5959 */
60+ #ifdef __APPLE__
61+ #include < stdlib.h>
62+ #define PROGNAME getprogname ()
63+ #else
6064 extern char *__progname;
65+ #define PROGNAME __progname
66+ #endif
6167
6268#define LX200_TRACK 0
6369#define LX200_SYNC 1
6470
65- static class Loader
66- {
67- std::unique_ptr<LX200Generic> telescope;
68- public:
69- Loader ()
70- {
71- // Note: these if statements use strstr() which isn't a full string match, just a substring,
72- // so if one driver name is the start of another's name, it needs to be AFTER the longer one!
73- if (strstr (__progname , " indi_lx200classic" ))
74- {
75- IDLog (" initializing from LX200 classic device...\n " );
76- telescope.reset (new LX200Classic ());
77- }
78- else if (strstr (__progname , " indi_lx200_OnStep" ))
79- {
80- IDLog (" initializing from LX200 OnStep device...\n " );
81- telescope.reset (new LX200_OnStep ());
82- }
83- else if (strstr (__progname , " indi_lx200gps" ))
84- {
85- IDLog (" initializing from LX200 GPS device...\n " );
86- telescope.reset (new LX200GPS ());
87- }
88- else if (strstr (__progname , " indi_lx200_16" ))
89- {
90- IDLog (" Initializing from LX200 16 device...\n " );
91- telescope.reset (new LX200_16 ());
92- }
93- else if (strstr (__progname , " indi_lx200autostar" ))
94- {
95- IDLog (" initializing from Autostar device...\n " );
96- telescope.reset (new LX200Autostar ());
97- }
98- else if (strstr (__progname , " indi_lx200ap_v2" ))
99- {
100- IDLog (" initializing from Astrophysics V2 device...\n " );
101- telescope.reset (new LX200AstroPhysicsV2 ());
102- }
103- else if (strstr (__progname , " indi_lx200ap_legacy" ))
104- {
105- IDLog (" initializing from Astrophysics GTOCP2 device...\n " );
106- telescope.reset (new LX200AstroPhysicsGTOCP2 ());
107- }
108- else if (strstr (__progname , " indi_lx200gemini" ))
109- {
110- IDLog (" initializing from Losmandy Gemini device...\n " );
111- telescope.reset (new LX200Gemini ());
112- }
113- else if (strstr (__progname , " indi_lx200zeq25" ))
114- {
115- IDLog (" initializing from ZEQ25 device...\n " );
116- telescope.reset (new LX200ZEQ25 ());
117- }
118- else if (strstr (__progname , " indi_lx200gotonova" ))
119- {
120- IDLog (" initializing from GotoNova device...\n " );
121- telescope.reset (new LX200GotoNova ());
122- }
123- else if (strstr (__progname , " indi_ioptronHC8406" ))
124- {
125- IDLog (" initializing from ioptron telescope Hand Controller HC8406 device...\n " );
126- telescope.reset (new ioptronHC8406 ());
127- }
128- else if (strstr (__progname , " indi_lx200pulsar2" ))
129- {
130- IDLog (" initializing from pulsar2 device...\n " );
131- telescope.reset (new LX200Pulsar2 ());
132- }
133- else if (strstr (__progname , " indi_lx200ss2000pc" ))
134- {
135- IDLog (" initializing from skysensor2000pc device...\n " );
136- telescope.reset (new LX200SS2000PC ());
137- }
138- else if (strstr (__progname , " indi_lx200fs2" ))
139- {
140- IDLog (" initializing from Astro-Electronic FS-2...\n " );
141- telescope.reset (new LX200FS2 ());
142- }
143- else if (strstr (__progname , " indi_lx200_10micron" ))
144- {
145- IDLog (" initializing for 10Micron mount...\n " );
146- telescope.reset (new LX200_10MICRON ());
147- }
148- else if (strstr (__progname , " indi_eq500x" ))
149- {
150- IDLog (" initializing for EQ500X mount...\n " );
151- telescope.reset (new EQ500X ());
152- }
153- else if (strstr (__progname , " indi_lx200am5" ))
154- {
155- IDLog (" initializing for ZWO AM5 mount...\n " );
156- telescope.reset (new LX200AM5 ());
157- }
158- else if (strstr (__progname , " indi_lx200_OpenAstroTech" ))
159- {
160- IDLog (" initializing for OpenAstroTech mount...\n " );
161- telescope.reset (new LX200_OpenAstroTech ());
162- }
163- else if (strstr (__progname , " indi_lx200_pegasus_nyx101" ))
164- {
165- IDLog (" initializing for Pegasus NYX-101 mount...\n " );
166- telescope.reset (new LX200NYX101 ());
167- }
168- // be nice and give them a generic device
169- else
170- telescope.reset (new LX200Generic ());
171- }
172- } loader;
71+ static class Loader
72+ {
73+ std::unique_ptr<LX200Generic> telescope;
74+ public:
75+ Loader ()
76+ {
77+ // Note: these if statements use strstr() which isn't a full string match, just a substring,
78+ // so if one driver name is the start of another's name, it needs to be AFTER the longer one!
79+ if (strstr (PROGNAME , " indi_lx200classic" ))
80+ {
81+ IDLog (" initializing from LX200 classic device...\n " );
82+ telescope.reset (new LX200Classic ());
83+ }
84+ else if (strstr (PROGNAME , " indi_lx200_OnStep" ))
85+ {
86+ IDLog (" initializing from LX200 OnStep device...\n " );
87+ telescope.reset (new LX200_OnStep ());
88+ }
89+ else if (strstr (PROGNAME , " indi_lx200gps" ))
90+ {
91+ IDLog (" initializing from LX200 GPS device...\n " );
92+ telescope.reset (new LX200GPS ());
93+ }
94+ else if (strstr (PROGNAME , " indi_lx200_16" ))
95+ {
96+ IDLog (" Initializing from LX200 16 device...\n " );
97+ telescope.reset (new LX200_16 ());
98+ }
99+ else if (strstr (PROGNAME , " indi_lx200autostar" ))
100+ {
101+ IDLog (" initializing from Autostar device...\n " );
102+ telescope.reset (new LX200Autostar ());
103+ }
104+ else if (strstr (PROGNAME , " indi_lx200ap_v2" ))
105+ {
106+ IDLog (" initializing from Astrophysics V2 device...\n " );
107+ telescope.reset (new LX200AstroPhysicsV2 ());
108+ }
109+ else if (strstr (PROGNAME , " indi_lx200ap_legacy" ))
110+ {
111+ IDLog (" initializing from Astrophysics GTOCP2 device...\n " );
112+ telescope.reset (new LX200AstroPhysicsGTOCP2 ());
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;
173179
174180/* *************************************************
175181*** LX200 Generic Implementation
0 commit comments