Instrument Neutral Distributed Interface INDI 2.2.5
MathPluginManagement.cpp
Go to the documentation of this file.
1
10
11#include <dirent.h>
12#include <dlfcn.h>
13#include <cerrno>
14#include <libnova/julian_day.h>
15
16namespace INDI
17{
18namespace AlignmentSubsystem
19{
20MathPluginManagement::MathPluginManagement() : CurrentInMemoryDatabase(nullptr),
21 pGetApproximateMountAlignment(&MathPlugin::GetApproximateMountAlignment),
22 pInitialise(&MathPlugin::Initialise),
23 pSetApproximateMountAlignment(&MathPlugin::SetApproximateMountAlignment),
24 pLoadedMathPlugin(&BuiltInPlugin), LoadedMathPluginHandle(nullptr)
25{
26 memset(&AlignmentSubsystemCurrentMathPlugin, 0, sizeof(IText));
27}
28
30{
31 EnumeratePlugins();
32 AlignmentSubsystemMathPlugins.reset(new ISwitch[MathPluginDisplayNames.size() + 1]);
33 IUFillSwitch(AlignmentSubsystemMathPlugins.get(), "INBUILT_MATH_PLUGIN", "Inbuilt Math Plugin", ISS_ON);
34
35 for (int i = 0; i < (int)MathPluginDisplayNames.size(); i++)
36 {
37 IUFillSwitch(AlignmentSubsystemMathPlugins.get() + i + 1, MathPluginDisplayNames[i].c_str(),
38 MathPluginDisplayNames[i].c_str(), ISS_OFF);
39 }
40
41 IUFillSwitchVector(&AlignmentSubsystemMathPluginsV, AlignmentSubsystemMathPlugins.get(),
42 MathPluginDisplayNames.size() + 1, ChildTelescope->getDeviceName(),
43 "ALIGNMENT_SUBSYSTEM_MATH_PLUGINS", "Math Plugins", ALIGNMENT_TAB, IP_RW, ISR_1OFMANY, 60,
44 IPS_IDLE);
45
46 int configPlugin = -1;
47 IUGetConfigOnSwitchIndex(ChildTelescope->getDeviceName(), "ALIGNMENT_SUBSYSTEM_MATH_PLUGINS", &configPlugin);
48 if (configPlugin >= 0 && configPlugin < AlignmentSubsystemMathPluginsV.nsp)
49 {
50 IUResetSwitch(&AlignmentSubsystemMathPluginsV);
51 AlignmentSubsystemMathPluginsV.sp[configPlugin].s = ISS_ON;
52 HandlePluginLoading(ChildTelescope, 0, configPlugin);
53 }
54 // Select nearest if available
55 else
56 {
57 ISwitch *sp = IUFindSwitch(&AlignmentSubsystemMathPluginsV, "Nearest Math Plugin");
58 if (sp)
59 {
60 IUResetSwitch(&AlignmentSubsystemMathPluginsV);
61 for (int i = 0; i < AlignmentSubsystemMathPluginsV.nsp; i++)
62 {
63 if (!strcmp(AlignmentSubsystemMathPluginsV.sp[i].name, sp->name))
64 {
65 sp->s = ISS_ON;
66 HandlePluginLoading(ChildTelescope, 0, i);
67 break;
68 }
69 }
70 }
71 }
72 ChildTelescope->registerProperty(&AlignmentSubsystemMathPluginsV);
73
74 IUFillSwitch(&AlignmentSubsystemMathPluginInitialise, "ALIGNMENT_SUBSYSTEM_MATH_PLUGIN_INITIALISE", "OK", ISS_OFF);
75 IUFillSwitchVector(&AlignmentSubsystemMathPluginInitialiseV, &AlignmentSubsystemMathPluginInitialise, 1,
76 ChildTelescope->getDeviceName(), "ALIGNMENT_SUBSYSTEM_MATH_PLUGIN_INITIALISE",
77 "(Re)Initialise Plugin", ALIGNMENT_TAB, IP_RW, ISR_ATMOST1, 60, IPS_IDLE);
78 ChildTelescope->registerProperty(&AlignmentSubsystemMathPluginInitialiseV);
79
80 IUFillSwitch(&AlignmentSubsystemActive, "ALIGNMENT SUBSYSTEM ACTIVE", "Alignment Subsystem Active", ISS_OFF);
81 IUFillSwitchVector(&AlignmentSubsystemActiveV, &AlignmentSubsystemActive, 1, ChildTelescope->getDeviceName(),
82 "ALIGNMENT_SUBSYSTEM_ACTIVE", "Activate alignment subsystem", ALIGNMENT_TAB, IP_RW, ISR_ATMOST1,
83 60, IPS_IDLE);
84 ChildTelescope->registerProperty(&AlignmentSubsystemActiveV);
85
86 // The following property is used for configuration purposes only and is not exposed to the client.
87 IUFillText(&AlignmentSubsystemCurrentMathPlugin, "ALIGNMENT_SUBSYSTEM_CURRENT_MATH_PLUGIN", "Current Math Plugin",
88 AlignmentSubsystemMathPlugins.get()[0].label);
89 IUFillTextVector(&AlignmentSubsystemCurrentMathPluginV, &AlignmentSubsystemCurrentMathPlugin, 1,
90 ChildTelescope->getDeviceName(), "ALIGNMENT_SUBSYSTEM_CURRENT_MATH_PLUGIN", "Current Math Plugin",
92}
93
94void MathPluginManagement::ProcessTextProperties(Telescope *pTelescope, const char *name, char *texts[], char *names[],
95 int n)
96{
97 //DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_DEBUG, "ProcessTextProperties - name(%s)", name);
98 if (strcmp(name, AlignmentSubsystemCurrentMathPluginV.name) == 0)
99 {
100 AlignmentSubsystemCurrentMathPluginV.s = IPS_OK;
101 IUUpdateText(&AlignmentSubsystemCurrentMathPluginV, texts, names, n);
102
103 // If the switch has already selected and loaded an external plugin, it takes
104 // precedence over the text property (which may be stale from a previous config
105 // save). Sync the text to match the switch and skip the redundant reload.
106 int currentSwitch = IUFindOnSwitchIndex(&AlignmentSubsystemMathPluginsV);
107 if (currentSwitch > 0 && currentSwitch <= (int)MathPluginFiles.size())
108 {
109 const char *switchPath = MathPluginFiles[currentSwitch - 1].c_str();
110 if (strcmp(AlignmentSubsystemCurrentMathPlugin.text, switchPath) != 0)
111 IUSaveText(&AlignmentSubsystemCurrentMathPlugin, switchPath);
112 return;
113 }
114
115 if (0 != strcmp(AlignmentSubsystemMathPlugins.get()[0].label, AlignmentSubsystemCurrentMathPlugin.text))
116 {
117 // Capture current mount alignment before unloading the old plugin so we can
118 // propagate it to the newly loaded plugin. Without this, every externally-loaded
119 // plugin (Nearest, SVD, …) defaults to ZENITH, which silently switches EQ
120 // drivers to the AltAz code paths and produces garbage Goto coordinates.
121 MountAlignment_t currentMountAlignment = GetApproximateMountAlignment();
122
123 // Unload old plugin if required
124 if (nullptr != LoadedMathPluginHandle)
125 {
126 typedef void Destroy_t(MathPlugin *);
127 Destroy_t *Destroy = (Destroy_t *)dlsym(LoadedMathPluginHandle, "Destroy");
128 if (nullptr != Destroy)
129 {
130 Destroy(pLoadedMathPlugin);
131 pLoadedMathPlugin = nullptr;
132 if (0 == dlclose(LoadedMathPluginHandle))
133 {
134 LoadedMathPluginHandle = nullptr;
135 }
136 else
137 {
139 "MathPluginManagement - dlclose failed on loaded plugin - %s", dlerror());
140 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
141 }
142 }
143 else
144 {
146 "MathPluginManagement - cannot get Destroy function - %s", dlerror());
147 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
148 }
149 }
150 // It is not the built in so try to load it
151 if (nullptr != (LoadedMathPluginHandle = dlopen(AlignmentSubsystemCurrentMathPlugin.text, RTLD_NOW)))
152 {
153 typedef MathPlugin *Create_t();
154 Create_t *Create = (Create_t *)dlsym(LoadedMathPluginHandle, "Create");
155 if (nullptr != Create)
156 {
157 pLoadedMathPlugin = Create();
158 SetApproximateMountAlignment(currentMountAlignment);
159 Initialise(CurrentInMemoryDatabase);
160
161 // TODO - Update the client to reflect the new plugin
162 int i = 0;
163
164 for (i = 0; i < (int)MathPluginFiles.size(); i++)
165 {
166 if (0 == strcmp(AlignmentSubsystemCurrentMathPlugin.text, MathPluginFiles[i].c_str()))
167 break;
168 }
169 if (i < (int)MathPluginFiles.size())
170 {
171 IUResetSwitch(&AlignmentSubsystemMathPluginsV);
172 (AlignmentSubsystemMathPlugins.get() + i + 1)->s = ISS_ON;
173 // Update client
174 IDSetSwitch(&AlignmentSubsystemMathPluginsV, nullptr);
175 }
176 else
177 {
179 "MathPluginManagement - cannot find %s in list of plugins", MathPluginFiles[i].c_str());
180 }
181 }
182 else
183 {
184 DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_ERROR, "MathPluginManagement - cannot get Create function - %s",
185 dlerror());
186 }
187 }
188 else
189 {
190 DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_ERROR, "MathPluginManagement - cannot load plugin %s error %s",
191 AlignmentSubsystemCurrentMathPlugin.text, dlerror());
192 }
193 }
194 else
195 {
196 // It is the inbuilt plugin
197 // Unload old plugin if required
198 if (nullptr != LoadedMathPluginHandle)
199 {
200 typedef void Destroy_t(MathPlugin *);
201 Destroy_t *Destroy = (Destroy_t *)dlsym(LoadedMathPluginHandle, "Destroy");
202 if (nullptr != Destroy)
203 {
204 Destroy(pLoadedMathPlugin);
205 pLoadedMathPlugin = nullptr;
206 if (0 == dlclose(LoadedMathPluginHandle))
207 {
208 LoadedMathPluginHandle = nullptr;
209 }
210 else
211 {
213 "MathPluginManagement - dlclose failed on loaded plugin - %s", dlerror());
214 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
215 }
216 }
217 else
218 {
220 "MathPluginManagement - cannot get Destroy function - %s", dlerror());
221 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
222 }
223 }
224 pLoadedMathPlugin = &BuiltInPlugin;
225 IUResetSwitch(&AlignmentSubsystemMathPluginsV);
226 AlignmentSubsystemMathPlugins.get()->s = ISS_ON;
227 // Update client
228 IDSetSwitch(&AlignmentSubsystemMathPluginsV, nullptr);
229 }
230 }
231}
232
233void MathPluginManagement::ProcessSwitchProperties(Telescope *pTelescope, const char *name, ISState *states,
234 char *names[], int n)
235{
236 //DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_DEBUG, "ProcessSwitchProperties - name(%s)", name);
237 INDI_UNUSED(pTelescope);
238 if (strcmp(name, AlignmentSubsystemMathPluginsV.name) == 0)
239 {
240 int CurrentPlugin = IUFindOnSwitchIndex(&AlignmentSubsystemMathPluginsV);
241 IUUpdateSwitch(&AlignmentSubsystemMathPluginsV, states, names, n);
242 AlignmentSubsystemMathPluginsV.s = IPS_OK; // Assume OK for the time being
243 int NewPlugin = IUFindOnSwitchIndex(&AlignmentSubsystemMathPluginsV);
244 HandlePluginLoading(pTelescope, CurrentPlugin, NewPlugin);
245 // Update client
246 IDSetSwitch(&AlignmentSubsystemMathPluginsV, nullptr);
247 }
248 else if (strcmp(name, AlignmentSubsystemMathPluginInitialiseV.name) == 0)
249 {
250 AlignmentSubsystemMathPluginInitialiseV.s = IPS_OK;
251 IUResetSwitch(&AlignmentSubsystemMathPluginInitialiseV);
252 // Update client display
253 IDSetSwitch(&AlignmentSubsystemMathPluginInitialiseV, nullptr);
254
255 // Initialise or reinitialise the current math plugin
256 Initialise(CurrentInMemoryDatabase);
257 }
258 else if (strcmp(name, AlignmentSubsystemActiveV.name) == 0)
259 {
260 AlignmentSubsystemActiveV.s = IPS_OK;
261 if (0 == IUUpdateSwitch(&AlignmentSubsystemActiveV, states, names, n))
262 // Update client
263 IDSetSwitch(&AlignmentSubsystemActiveV, nullptr);
264 }
265}
266
267void MathPluginManagement::HandlePluginLoading(Telescope *pTelescope, int CurrentPlugin, int NewPlugin)
268{
269 if (NewPlugin != CurrentPlugin)
270 {
271 MountAlignment_t currentMountAlignment = GetApproximateMountAlignment();
272 // New plugin requested
273 // Unload old plugin if required
274 if (0 != CurrentPlugin)
275 {
276 typedef void Destroy_t(MathPlugin *);
277 Destroy_t *Destroy = (Destroy_t *)dlsym(LoadedMathPluginHandle, "Destroy");
278 if (nullptr != Destroy)
279 {
280 Destroy(pLoadedMathPlugin);
281 pLoadedMathPlugin = nullptr;
282 if (0 == dlclose(LoadedMathPluginHandle))
283 {
284 LoadedMathPluginHandle = nullptr;
285 }
286 else
287 {
289 "MathPluginManagement - dlclose failed on loaded plugin - %s", dlerror());
290 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
291 }
292 }
293 else
294 {
296 "MathPluginManagement - cannot get Destroy function - %s", dlerror());
297 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
298 }
299 }
300 // Load the requested plugin if required
301 if (0 != NewPlugin)
302 {
303 std::string PluginPath(MathPluginFiles[NewPlugin - 1]);
304 if (nullptr != (LoadedMathPluginHandle = dlopen(PluginPath.c_str(), RTLD_NOW)))
305 {
306 typedef MathPlugin *Create_t();
307 Create_t *Create = (Create_t *)dlsym(LoadedMathPluginHandle, "Create");
308 if (nullptr != Create)
309 {
310 pLoadedMathPlugin = Create();
311 SetApproximateMountAlignment(currentMountAlignment);
312 Initialise(CurrentInMemoryDatabase);
313 IUSaveText(&AlignmentSubsystemCurrentMathPlugin, PluginPath.c_str());
314 }
315 else
316 {
317 DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_ERROR, "MathPluginManagement - cannot get Create function - %s",
318 dlerror());
319 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
320 }
321 }
322 else
323 {
324 DEBUGFDEVICE(pTelescope->getDeviceName(), INDI::Logger::DBG_ERROR, "MathPluginManagement - cannot load plugin %s error %s",
325 PluginPath.c_str(), dlerror());
326 AlignmentSubsystemMathPluginsV.s = IPS_ALERT;
327 }
328 }
329 else
330 {
331 // It is in built plugin just set up the pointers
332 pLoadedMathPlugin = &BuiltInPlugin;
333 }
334 }
335}
336
338{
339 AlignmentSubsystemActive.s = enable ? ISS_ON : ISS_OFF;
340 AlignmentSubsystemActiveV.s = IPS_OK;
341 IDSetSwitch(&AlignmentSubsystemActiveV, nullptr);
342}
343
345{
346 IUSaveConfigText(fp, &AlignmentSubsystemCurrentMathPluginV);
347 IUSaveConfigSwitch(fp, &AlignmentSubsystemMathPluginsV);
348 IUSaveConfigSwitch(fp, &AlignmentSubsystemActiveV);
349}
350
352{
353 if (EQUATORIAL == Type)
354 {
355 IGeographicCoordinates Position { 0, 0, 0 };
356 if (CurrentInMemoryDatabase->GetDatabaseReferencePosition(Position))
357 {
358 if (Position.latitude >= 0)
360 else
362 }
363 // If no position found, assume northern hemisphere.
364 else
366 }
367 else
369}
370
371// These must match the function signatures in MathPlugin
372
374{
375 return (pLoadedMathPlugin->*pGetApproximateMountAlignment)();
376}
377
379{
380 return (pLoadedMathPlugin->*pInitialise)(pInMemoryDatabase);
381}
382
384{
385 (pLoadedMathPlugin->*pSetApproximateMountAlignment)(ApproximateAlignment);
386}
387
388bool MathPluginManagement::TransformCelestialToTelescopeJD(double RightAscension, double Declination,
389 double JulianDate,
390 TelescopeDirectionVector &ApparentTelescopeDirectionVector)
391{
392 if (AlignmentSubsystemActive.s == ISS_ON)
393 return pLoadedMathPlugin->TransformCelestialToTelescopeJD(RightAscension, Declination, JulianDate,
394 ApparentTelescopeDirectionVector);
395 else
396 return false;
397}
398
400 const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination,
401 double JulianDate)
402{
403 if (AlignmentSubsystemActive.s == ISS_ON)
404 return pLoadedMathPlugin->TransformTelescopeToCelestialJD(ApparentTelescopeDirectionVector, RightAscension,
405 Declination, JulianDate);
406 else
407 return false;
408}
409
410bool MathPluginManagement::TransformCelestialToTelescope(const double RightAscension, const double Declination,
411 double JulianOffset,
412 TelescopeDirectionVector &ApparentTelescopeDirectionVector)
413{
414 return TransformCelestialToTelescopeJD(RightAscension, Declination,
415 ln_get_julian_from_sys() + JulianOffset,
416 ApparentTelescopeDirectionVector);
417}
418
420 const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination,
421 double JulianOffset)
422{
423 return TransformTelescopeToCelestialJD(ApparentTelescopeDirectionVector, RightAscension, Declination,
424 ln_get_julian_from_sys() + JulianOffset);
425}
426
427void MathPluginManagement::EnumeratePlugins()
428{
429 MathPluginFiles.clear();
430 MathPluginDisplayNames.clear();
431#ifndef OSX_EMBEDED_MODE
432 dirent *de;
433 DIR *dp;
434
435 errno = 0;
436 char MATH_PLUGINS_DIRECTORY[2048];
437 // Allow overriding the plugins directory at runtime, e.g. to load the plugins from a build tree
438 // instead of a possibly different installed version.
439 const char *pluginsDirectory = getenv("INDI_MATH_PLUGINS_DIRECTORY");
440 if (pluginsDirectory && pluginsDirectory[0] != '\0')
441 snprintf(MATH_PLUGINS_DIRECTORY, 2048 - 1, "%s", pluginsDirectory);
442 else
443 {
444#if defined(__APPLE__)
445 const char *indiprefix = getenv("INDIPREFIX");
446 if (indiprefix)
447 snprintf(MATH_PLUGINS_DIRECTORY, 2048 - 1, "%s/Contents/Resources/MathPlugins", indiprefix);
448 else
449 snprintf(MATH_PLUGINS_DIRECTORY, 2048 - 1, INDI_MATH_PLUGINS_DIRECTORY);
450#else
451 snprintf(MATH_PLUGINS_DIRECTORY, 2048 - 1, INDI_MATH_PLUGINS_DIRECTORY);
452#endif
453 }
454
455 dp = opendir(MATH_PLUGINS_DIRECTORY);
456 strncat(MATH_PLUGINS_DIRECTORY, "/", 2);
457 if (dp)
458 {
459 while (true)
460 {
461 void *Handle;
462 std::string PluginPath(MATH_PLUGINS_DIRECTORY);
463
464 errno = 0;
465 de = readdir(dp);
466 if (de == nullptr)
467 break;
468 if (0 == strcmp(de->d_name, "."))
469 continue;
470 if (0 == strcmp(de->d_name, ".."))
471 continue;
472
473 // Try to load the plugin
474 PluginPath.append(de->d_name);
475 Handle = dlopen(PluginPath.c_str(), RTLD_NOW);
476 if (nullptr == Handle)
477 {
478 IDLog("EnumeratePlugins - cannot load plugin %s error %s\n", PluginPath.c_str(), dlerror());
479 continue;
480 }
481
482 // Try to get the plugin display name
483 typedef const char *GetDisplayName_t();
484 GetDisplayName_t *GetDisplayNamePtr = (GetDisplayName_t *)dlsym(Handle, "GetDisplayName");
485 if (nullptr == GetDisplayNamePtr)
486 {
487 IDLog("EnumeratePlugins - cannot get plugin %s DisplayName error %s\n", PluginPath.c_str(), dlerror());
488 continue;
489 }
490 IDLog("EnumeratePlugins - found plugin %s\n", GetDisplayNamePtr());
491
492 MathPluginDisplayNames.push_back(GetDisplayNamePtr());
493 MathPluginFiles.push_back(PluginPath);
494 dlclose(Handle);
495 }
496 closedir(dp);
497 }
498 else
499 {
500 IDLog("EnumeratePlugins - Failed to open %s error %s\n", MATH_PLUGINS_DIRECTORY, strerror(errno));
501 }
502#endif
503}
504
505} // namespace AlignmentSubsystem
506} // namespace INDI
This class provides the driver side API to the in memory alignment database.
bool GetDatabaseReferencePosition(IGeographicCoordinates &Position)
Get the database reference position.
void ProcessSwitchProperties(Telescope *pTelescope, const char *name, ISState *states, char *names[], int n)
Call this function from within the ISNewSwitch processing path. The function will handle any math plu...
void InitProperties(Telescope *pTelescope)
Initialize alignment math plugin properties. It is recommended to call this function within initPrope...
void SaveConfigProperties(FILE *fp)
Call this function to save persistent math plugin properties. This function should be called from wit...
bool TransformTelescopeToCelestialJD(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination, double JulianDate)
TransformTelescopeToCelestialJD Transforms Mount Coords to Celestial (Sky) Coordinates.
bool TransformCelestialToTelescopeJD(double RightAscension, double Declination, double JulianDate, TelescopeDirectionVector &ApparentTelescopeDirectionVector)
TransformCelestialToTelescopeJD Transforms Celestial (Sky) Coords to Mount Coordinates.
void SetApproximateMountAlignment(MountAlignment_t ApproximateAlignment)
Set the approximate alignment of the mount.
void ProcessTextProperties(Telescope *pTelescope, const char *name, char *texts[], char *names[], int n)
Call this function from within the ISNewText processing path. The function will handle any math plugi...
bool TransformCelestialToTelescope(const double RightAscension, const double Declination, double JulianOffset, TelescopeDirectionVector &ApparentTelescopeDirectionVector)
TransformCelestialToTelescope Compat shim - resolves JD and delegates to TransformCelestialToTelescop...
bool Initialise(InMemoryDatabase *pInMemoryDatabase)
Initialise or re-initialise the math plugin. Re-reading the in memory database as necessary.
MountAlignment_t GetApproximateMountAlignment()
Get the approximate alignment of the mount.
enum INDI::AlignmentSubsystem::MathPluginManagement::MountType MountType_t
bool TransformTelescopeToCelestial(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination, double JulianOffset=0)
TransformTelescopeToCelestial Compat shim - resolves JD and delegates to TransformTelescopeToCelestia...
void SetAlignmentSubsystemActive(bool enable)
SetAlignmentSubsystemActive Enable or Disable alignment subsystem.
void SetApproximateMountAlignmentFromMountType(MountType_t Type)
Call this function to set the ApproximateMountAlignment property of the current Math Plugin....
Provides alignment subsystem functions to INDI alignment math plugins.
Definition MathPlugin.h:31
virtual bool TransformTelescopeToCelestialJD(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination, double JulianDate)
Get the true celestial coordinates for the supplied telescope pointing direction.
virtual bool TransformCelestialToTelescopeJD(double RightAscension, double Declination, double JulianDate, TelescopeDirectionVector &ApparentTelescopeDirectionVector)
Get the alignment corrected telescope pointing direction for the supplied celestial coordinates.
const char * getDeviceName() const
void registerProperty(const INDI::Property &property)
Register the property to be able to observe and update.
int errno
ISState
Switch state.
Definition indiapi.h:148
@ ISS_OFF
Definition indiapi.h:149
@ ISS_ON
Definition indiapi.h:150
@ IP_RW
Definition indiapi.h:184
@ IP_RO
Definition indiapi.h:182
@ IPS_ALERT
Definition indiapi.h:162
@ IPS_IDLE
Definition indiapi.h:159
@ IPS_OK
Definition indiapi.h:160
@ ISR_1OFMANY
Definition indiapi.h:171
@ ISR_ATMOST1
Definition indiapi.h:172
void IDLog(const char *fmt,...)
Definition indicom.c:305
void IUSaveConfigSwitch(FILE *fp, const ISwitchVectorProperty *svp)
Add a switch vector property value to the configuration file.
Definition indidevapi.c:33
int IUFindOnSwitchIndex(const ISwitchVectorProperty *svp)
Returns the index of first ON switch it finds in the vector switch property.
Definition indidevapi.c:337
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
Definition indidevapi.c:366
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
Definition indidevapi.c:509
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Definition indidevapi.c:44
ISwitch * IUFindSwitch(const ISwitchVectorProperty *svp, const char *name)
Find an ISwitch member in a vector switch property.
Definition indidevapi.c:285
void IUFillSwitch(ISwitch *sp, const char *name, const char *label, ISState s)
Assign attributes for a switch property. The switch's auxiliary elements will be set to NULL.
Definition indidevapi.c:376
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
Definition indidevapi.c:416
void IUSaveConfigText(FILE *fp, const ITextVectorProperty *tvp)
Add a text vector property value to the configuration file.
Definition indidevapi.c:28
void IUFillSwitchVector(ISwitchVectorProperty *svp, ISwitch *sp, int nsp, const char *dev, const char *name, const char *label, const char *group, IPerm p, ISRule r, double timeout, IPState s)
Assign attributes for a switch vector property. The vector's auxiliary elements will be set to NULL.
Definition indidevapi.c:453
#define INDI_UNUSED(x)
Definition indidevapi.h:132
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUUpdateText(ITextVectorProperty *tvp, char *texts[], char *names[], int n)
Update all text members in a text vector property.
int IUGetConfigOnSwitchIndex(const char *dev, const char *property, int *index)
IUGetConfigOnSwitchIndex Opens configuration file and reads single switch property to find ON switch ...
Definition indidriver.c:719
#define DEBUGFDEVICE(device, priority, msg,...)
Definition indilogger.h:61
#define ALIGNMENT_TAB
void Destroy(DummyMathPlugin *pPlugin)
DummyMathPlugin * Create()
enum INDI::AlignmentSubsystem::MountAlignment MountAlignment_t
Namespace to encapsulate INDI client, drivers, and mediator classes.
Holds a normalised direction vector (direction cosines)
Definition Common.h:69
One switch descriptor.
One text descriptor.
Holds the connection type.
char name[MAXINDINAME]
Definition indiapi.h:369
ISState s
Definition indiapi.h:353
char name[MAXINDINAME]
Definition indiapi.h:349
char name[MAXINDINAME]
Definition indiapi.h:248