15 namespace AlignmentSubsystem
20 "ALIGNMENT_POINT_ENTRY_OBSERVATION_JULIAN_DATE",
"Observation Julian date",
"%g", 0, 60000, 0, 0);
21 IUFillNumber(&AlignmentPointSetEntry[
ENTRY_RA],
"ALIGNMENT_POINT_ENTRY_RA",
"Right Ascension (hh:mm:ss)",
"%010.6m",
23 IUFillNumber(&AlignmentPointSetEntry[
ENTRY_DEC],
"ALIGNMENT_POINT_ENTRY_DEC",
"Declination (dd:mm:ss)",
"%010.6m",
26 "Telescope direction vector x",
"%g", -FLT_MAX, FLT_MAX, 0, 0);
28 "Telescope direction vector y",
"%g", -FLT_MAX, FLT_MAX, 0, 0);
30 "Telescope direction vector z",
"%g", -FLT_MAX, FLT_MAX, 0, 0);
32 "ALIGNMENT_POINT_MANDATORY_NUMBERS",
"Mandatory sync point numeric fields",
ALIGNMENT_TAB,
IP_RW,
36 IUFillBLOB(&AlignmentPointSetPrivateBinaryData,
"ALIGNMENT_POINT_ENTRY_PRIVATE",
"Private binary data",
37 "alignmentPrivateData");
38 IUFillBLOBVector(&AlignmentPointSetPrivateBinaryDataV, &AlignmentPointSetPrivateBinaryData, 1,
39 pTelescope->
getDeviceName(),
"ALIGNMENT_POINT_OPTIONAL_BINARY_BLOB",
43 IUFillNumber(&AlignmentPointSetSize,
"ALIGNMENT_POINTSET_SIZE",
"Size",
"%g", 0, 100000, 0, 0);
48 IUFillNumber(&AlignmentPointSetPointer,
"ALIGNMENT_POINTSET_CURRENT_ENTRY",
"Pointer",
"%g", 0, 100000, 0, 0);
53 IUFillSwitch(&AlignmentPointSetAction[0],
"APPEND",
"Add entries at end of set",
ISS_ON);
54 IUFillSwitch(&AlignmentPointSetAction[1],
"INSERT",
"Insert entries at current index",
ISS_OFF);
55 IUFillSwitch(&AlignmentPointSetAction[2],
"EDIT",
"Overwrite entry at current index",
ISS_OFF);
56 IUFillSwitch(&AlignmentPointSetAction[3],
"DELETE",
"Delete entry at current index",
ISS_OFF);
57 IUFillSwitch(&AlignmentPointSetAction[4],
"CLEAR",
"Delete all the entries in the set",
ISS_OFF);
58 IUFillSwitch(&AlignmentPointSetAction[5],
"READ",
"Read the entry at the current pointer",
ISS_OFF);
59 IUFillSwitch(&AlignmentPointSetAction[6],
"READ INCREMENT",
"Increment the pointer before reading the entry",
61 IUFillSwitch(&AlignmentPointSetAction[7],
"LOAD DATABASE",
"Load the alignment database from local storage",
63 IUFillSwitch(&AlignmentPointSetAction[8],
"SAVE DATABASE",
"Save the alignment database to local storage",
ISS_OFF);
76 int blobsizes[],
char *blobs[],
char *formats[],
80 if (strcmp(name, AlignmentPointSetPrivateBinaryDataV.
name) == 0)
82 AlignmentPointSetPrivateBinaryDataV.
s =
IPS_OK;
83 if (0 ==
IUUpdateBLOB(&AlignmentPointSetPrivateBinaryDataV, sizes, blobsizes, blobs, formats, names, n))
86 strncpy(AlignmentPointSetPrivateBinaryData.format,
"alignmentPrivateData",
MAXINDIBLOBFMT);
92 IUFillBLOB(&DummyBlob,
"ALIGNMENT_POINT_ENTRY_PRIVATE",
"Private binary data",
"alignmentPrivateData");
94 "ALIGNMENT_POINT_OPTIONAL_BINARY_BLOB",
"Optional sync point binary data",
ALIGNMENT_TAB,
102 char *names[],
int n)
105 if (strcmp(name, AlignmentPointSetEntryV.
name) == 0)
107 AlignmentPointSetEntryV.
s =
IPS_OK;
108 if (0 ==
IUUpdateNumber(&AlignmentPointSetEntryV, values, names, n))
112 else if (strcmp(name, AlignmentPointSetPointerV.
name) == 0)
114 AlignmentPointSetPointerV.
s =
IPS_OK;
115 if (0 ==
IUUpdateNumber(&AlignmentPointSetPointerV, values, names, n))
122 char *names[],
int n)
126 if (strcmp(name, AlignmentPointSetActionV.
name) == 0)
128 AlignmentPointSetActionV.
s =
IPS_OK;
129 if (0 ==
IUUpdateSwitch(&AlignmentPointSetActionV, states, names, n))
133 else if (strcmp(name, AlignmentPointSetCommitV.
name) == 0)
135 const unsigned int Offset = AlignmentPointSetPointer.value;
136 AlignmentPointSetCommitV.
s =
IPS_OK;
146 if ((0 != AlignmentPointSetPrivateBinaryData.size) && (
nullptr != AlignmentPointSetPrivateBinaryData.blob))
148 CurrentValues.
PrivateData.reset(
new unsigned char[AlignmentPointSetPrivateBinaryData.size]);
149 memcpy(CurrentValues.
PrivateData.get(), AlignmentPointSetPrivateBinaryData.blob,
150 AlignmentPointSetPrivateBinaryData.size);
151 CurrentValues.
PrivateDataSize = AlignmentPointSetPrivateBinaryData.size;
156 AlignmentDatabase.push_back(CurrentValues);
157 AlignmentPointSetSize.value = AlignmentDatabase.size();
163 if (Offset > AlignmentDatabase.size())
167 AlignmentDatabase.insert(AlignmentDatabase.begin() + Offset, CurrentValues);
168 AlignmentPointSetSize.value = AlignmentDatabase.size();
173 else if (AlignmentPointSetAction[
EDIT].s ==
ISS_ON)
175 if (Offset >= AlignmentDatabase.size())
178 AlignmentDatabase[Offset] = CurrentValues;
182 if (Offset >= AlignmentDatabase.size())
186 AlignmentDatabase.erase(AlignmentDatabase.begin() + Offset);
187 AlignmentPointSetSize.value = AlignmentDatabase.size();
192 else if (AlignmentPointSetAction[
CLEAR].s ==
ISS_ON)
195 AlignmentDatabase.clear();
196 AlignmentPointSetSize.value = 0;
204 AlignmentPointSetPointer.value++;
209 if (Offset >= AlignmentDatabase.size())
214 AlignmentDatabase[Offset].ObservationJulianDate;
215 AlignmentPointSetEntry[
ENTRY_RA].value = AlignmentDatabase[Offset].RightAscension;
216 AlignmentPointSetEntry[
ENTRY_DEC].value = AlignmentDatabase[Offset].Declination;
217 AlignmentPointSetEntry[
ENTRY_VECTOR_X].value = AlignmentDatabase[Offset].TelescopeDirection.x;
218 AlignmentPointSetEntry[
ENTRY_VECTOR_Y].value = AlignmentDatabase[Offset].TelescopeDirection.y;
219 AlignmentPointSetEntry[
ENTRY_VECTOR_Z].value = AlignmentDatabase[Offset].TelescopeDirection.z;
224 if ((0 != AlignmentDatabase[Offset].PrivateDataSize) &&
225 (
nullptr != AlignmentDatabase[Offset].PrivateData.get()))
228 AlignmentPointSetPrivateBinaryData.blob = malloc(AlignmentDatabase[Offset].PrivateDataSize);
229 memcpy(AlignmentPointSetPrivateBinaryData.blob, AlignmentDatabase[Offset].PrivateData.get(),
230 AlignmentDatabase[Offset].PrivateDataSize);
231 AlignmentPointSetPrivateBinaryData.bloblen = AlignmentDatabase[Offset].PrivateDataSize;
232 AlignmentPointSetPrivateBinaryData.size = AlignmentDatabase[Offset].PrivateDataSize;
233 AlignmentPointSetPrivateBinaryDataV.
s =
IPS_OK;
234 IDSetBLOB(&AlignmentPointSetPrivateBinaryDataV,
nullptr);
241 AlignmentPointSetSize.value = AlignmentDatabase.size();
264 if ((latitude != Position.latitude) || (longitude != Position.longitude))
AlignmentDatabaseType & GetAlignmentDatabase()
Get a reference to the in memory database.
bool SaveDatabase(const char *DeviceName)
Save the database to persistent storage.
void SetDatabaseReferencePosition(double Latitude, double Longitude)
Set the database reference position.
std::vector< AlignmentDatabaseEntry > AlignmentDatabaseType
bool GetDatabaseReferencePosition(IGeographicCoordinates &Position)
Get the database reference position.
bool LoadDatabase(const char *DeviceName)
Load the database from persistent storage.
void ProcessNumberProperties(Telescope *, const char *name, double values[], char *names[], int n)
Call this function from within the ISNewNumber processing path. The function will handle any alignmen...
void InitProperties(Telescope *pTelescope)
Initialize alignment database properties. It is recommended to call this function within initProperti...
void UpdateLocation(double latitude, double longitude, double elevation)
Call this function from within the updateLocation processing path.
void UpdateSize()
Call this function when the number of entries in the database changes.
void ProcessBlobProperties(Telescope *pTelescope, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Call this function from within the ISNewBLOB processing path. The function will handle any alignment ...
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 alignmen...
const char * getDeviceName() const
void registerProperty(const INDI::Property &property)
Register the property to be able to observe and update.
void IUFillNumberVector(INumberVectorProperty *nvp, INumber *np, int nnp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a number vector property. The vector's auxiliary elements will be set to NULL.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
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.
void IUFillNumber(INumber *np, const char *name, const char *label, const char *format, double min, double max, double step, double value)
Assign attributes for a number property. The number's auxiliary elements will be set to NULL.
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.
void IUFillBLOBVector(IBLOBVectorProperty *bvp, IBLOB *bp, int nbp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a BLOB vector property. The vector's auxiliary elements will be set to NULL.
void IUFillBLOB(IBLOB *bp, const char *name, const char *label, const char *format)
Assign attributes for a BLOB property. The BLOB's data and auxiliary elements will be set to NULL.
int IUUpdateBLOB(IBLOBVectorProperty *bvp, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update all BLOB members in a BLOB vector property.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
int IUUpdateNumber(INumberVectorProperty *nvp, double values[], char *names[], int n)
Update all numbers in a number vector property.
void IDSetBLOB(const IBLOBVectorProperty *bvp, const char *fmt,...)
#define DEBUGFDEVICE(device, priority, msg,...)
@ ENTRY_OBSERVATION_JULIAN_DATE
Namespace to encapsulate INDI client, drivers, and mediator classes.
One Blob (Binary Large Object) descriptor.
Entry in the in memory alignment database.
double RightAscension
Right ascension in decimal hours. N.B. libnova works in decimal degrees so conversion is always neede...
double ObservationJulianDate
TelescopeDirectionVector TelescopeDirection
Normalised vector giving telescope pointing direction. This is referred to elsewhere as the "apparent...
double Declination
Declination in decimal degrees.
int PrivateDataSize
This size in bytes of any private data.
std::unique_ptr< unsigned char > PrivateData
Private data associated with this sync point.
BLOB (Binary Large Object) vector property descriptor.