Instrument Neutral Distributed Interface INDI 2.2.5
MathPluginManagement.h
Go to the documentation of this file.
1
9#pragma once
10
11#include "BuiltInMathPlugin.h"
12
13#include "inditelescope.h"
14
15#include <memory>
16
17namespace INDI
18{
19namespace AlignmentSubsystem
20{
34class MathPluginManagement : private MathPlugin // Derive from MathPluign to force the function signatures to match
35{
36 public:
41
44
47
51 void InitProperties(Telescope *pTelescope);
52
61 void ProcessSwitchProperties(Telescope *pTelescope, const char *name, ISState *states, char *names[], int n);
62
72 void ProcessTextProperties(Telescope *pTelescope, const char *name, char *texts[], char *names[], int n);
73
78 void SaveConfigProperties(FILE *fp);
79
90
94 {
95 CurrentInMemoryDatabase = pDatabase;
96 }
97
102 void SetAlignmentSubsystemActive(bool enable);
103
107 {
108 return AlignmentSubsystemActive.s == ISS_ON ? true : false;
109 }
110
111 // These must match the function signatures in MathPlugin
114 void SetApproximateMountAlignment(MountAlignment_t ApproximateAlignment);
115
124 bool TransformCelestialToTelescopeJD(double RightAscension, double Declination, double JulianDate,
125 TelescopeDirectionVector &ApparentTelescopeDirectionVector);
126
135 bool TransformTelescopeToCelestialJD(const TelescopeDirectionVector &ApparentTelescopeDirectionVector,
136 double &RightAscension, double &Declination, double JulianDate);
137
147 [[deprecated("Use TransformCelestialToTelescopeJD with an explicit Julian Date")]]
148 bool TransformCelestialToTelescope(const double RightAscension, const double Declination, double JulianOffset,
149 TelescopeDirectionVector &ApparentTelescopeDirectionVector);
150
160 [[deprecated("Use TransformTelescopeToCelestialJD with an explicit Julian Date")]]
161 bool TransformTelescopeToCelestial(const TelescopeDirectionVector &ApparentTelescopeDirectionVector,
162 double &RightAscension, double &Declination, double JulianOffset = 0);
163
164 private:
165 void EnumeratePlugins();
166 void HandlePluginLoading(Telescope *pTelescope, int CurrentPlugin, int NewPlugin);
167 std::vector<std::string> MathPluginFiles;
168 std::vector<std::string> MathPluginDisplayNames;
169
170 std::unique_ptr<ISwitch> AlignmentSubsystemMathPlugins;
171 ISwitchVectorProperty AlignmentSubsystemMathPluginsV;
172 ISwitch AlignmentSubsystemMathPluginInitialise;
173 ISwitchVectorProperty AlignmentSubsystemMathPluginInitialiseV;
174 ISwitch AlignmentSubsystemActive;
175 ISwitchVectorProperty AlignmentSubsystemActiveV;
176
177 InMemoryDatabase *CurrentInMemoryDatabase;
178
179 // The following property is used for configuration purposes only and is not propagated to the client
180 IText AlignmentSubsystemCurrentMathPlugin;
181 ITextVectorProperty AlignmentSubsystemCurrentMathPluginV;
182
183 // The following hold links to the current loaded math plugin
184 // These must match the function signatures in MathPlugin
185 MountAlignment_t (MathPlugin::*pGetApproximateMountAlignment)();
186 bool (MathPlugin::*pInitialise)(InMemoryDatabase *pInMemoryDatabase);
187 void (MathPlugin::*pSetApproximateMountAlignment)(MountAlignment_t ApproximateAlignment);
188 MathPlugin *pLoadedMathPlugin;
189 void *LoadedMathPluginHandle;
190
191 BuiltInMathPlugin BuiltInPlugin;
192};
193
194} // namespace AlignmentSubsystem
195} // namespace INDI
This class implements the default math plugin.
This class provides the driver side API to the in memory alignment database.
The following INDI properties are used to manage math plugins.
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 IsAlignmentSubsystemActive() const
Return status of alignment subsystem.
bool TransformTelescopeToCelestialJD(const TelescopeDirectionVector &ApparentTelescopeDirectionVector, double &RightAscension, double &Declination, double JulianDate)
TransformTelescopeToCelestialJD Transforms Mount Coords to Celestial (Sky) Coordinates.
void SetCurrentInMemoryDatabase(InMemoryDatabase *pDatabase)
Set the current in memory database.
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.
MountType
Describes the basic type 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
ISState
Switch state.
Definition indiapi.h:148
@ ISS_ON
Definition indiapi.h:150
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.
Switch vector property descriptor.
Definition indiapi.h:365
Text vector property descriptor.
Definition indiapi.h:244