Instrument Neutral Distributed Interface INDI  2.0.2
ClientAPIForAlignmentDatabase.h
Go to the documentation of this file.
1 
9 #pragma once
10 
11 #include "basedevice.h"
12 #include "baseclient.h"
13 
14 #include "Common.h"
15 #include <pthread.h>
16 
17 namespace INDI
18 {
19 namespace AlignmentSubsystem
20 {
27 {
28  public:
31 
34 
40  bool AppendSyncPoint(const AlignmentDatabaseEntry &CurrentValues);
41 
46  bool ClearSyncPoints();
47 
53  bool DeleteSyncPoint(unsigned int Offset);
54 
61  bool EditSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues);
62 
67  int GetDatabaseSize();
68 
74 
81  bool InsertSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues);
82 
87  bool LoadDatabase();
88 
96  void ProcessNewBLOB(IBLOB *BLOBPointer);
97 
105  void ProcessNewDevice(INDI::BaseDevice *DevicePointer);
106 
114  void ProcessNewNumber(INumberVectorProperty *NumberVectorProperty);
115 
123  void ProcessNewProperty(INDI::Property *PropertyPointer);
124 
132  void ProcessNewSwitch(ISwitchVectorProperty *SwitchVectorProperty);
133 
139  bool ReadIncrementSyncPoint(AlignmentDatabaseEntry &CurrentValues);
140 
147  bool ReadSyncPoint(unsigned int Offset, AlignmentDatabaseEntry &CurrentValues);
148 
153  bool SaveDatabase();
154 
155  private:
156  // Private methods
157 
158  bool SendEntryData(const AlignmentDatabaseEntry &CurrentValues);
159  bool SetDriverBusy();
160  bool SignalDriverCompletion();
161  bool WaitForDriverCompletion();
162 
163  // Private properties
164 
165  INDI::BaseClient *BaseClient { nullptr };
166  pthread_cond_t DriverActionCompleteCondition;
167  pthread_mutex_t DriverActionCompleteMutex;
168  bool DriverActionComplete { false };
169  INDI::BaseDevice *Device { nullptr };
170  INDI::Property *MandatoryNumbers { nullptr };
171  INDI::Property *OptionalBinaryBlob { nullptr };
172  INDI::Property *PointsetSize { nullptr };
173  INDI::Property *CurrentEntry { nullptr };
174  INDI::Property *Action { nullptr };
175  INDI::Property *Commit { nullptr };
176 };
177 
178 } // namespace AlignmentSubsystem
179 } // namespace INDI
This class provides the client API to the driver side alignment database. It communicates with the dr...
bool AppendSyncPoint(const AlignmentDatabaseEntry &CurrentValues)
Append a sync point to the database.
bool SaveDatabase()
Save the database to persistent storage.
bool ReadSyncPoint(unsigned int Offset, AlignmentDatabaseEntry &CurrentValues)
Read a sync point from the database.
bool InsertSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
Insert a sync point in the database.
bool LoadDatabase()
Load the database from persistent storage.
void Initialise(INDI::BaseClient *BaseClient)
Initialise the API.
bool EditSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
Edit a sync point in the database.
bool ReadIncrementSyncPoint(AlignmentDatabaseEntry &CurrentValues)
Increment the current offset then read a sync point from the database.
void ProcessNewNumber(INumberVectorProperty *NumberVectorProperty)
Process new number message from driver. This routine should be called from within the newNumber handl...
void ProcessNewDevice(INDI::BaseDevice *DevicePointer)
Process new device message from driver. This routine should be called from within the newDevice handl...
void ProcessNewBLOB(IBLOB *BLOBPointer)
Process new BLOB message from driver. This routine should be called from within the newBLOB handler i...
void ProcessNewSwitch(ISwitchVectorProperty *SwitchVectorProperty)
Process new switch message from driver. This routine should be called from within the newSwitch handl...
bool ClearSyncPoints()
Delete all sync points from the database.
void ProcessNewProperty(INDI::Property *PropertyPointer)
Process new property message from driver. This routine should be called from within the newProperty h...
int GetDatabaseSize()
Return the number of entries in the database.
bool DeleteSyncPoint(unsigned int Offset)
Delete a sync point from the database.
Class to provide basic client functionality.
Definition: baseclient.h:52
Class to provide basic INDI device functionality.
Definition: basedevice.h:52
Provides generic container for INDI properties.
Definition: indiproperty.h:48
Namespace to encapsulate INDI client, drivers, and mediator classes.
One Blob (Binary Large Object) descriptor.
Entry in the in memory alignment database.
Definition: Common.h:152
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367