Instrument Neutral Distributed Interface INDI  1.9.5
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
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ReadIncrementSyncPoint
bool ReadIncrementSyncPoint(AlignmentDatabaseEntry &CurrentValues)
Increment the current offset then read a sync point from the database.
Definition: ClientAPIForAlignmentDatabase.cpp:407
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::Initialise
void Initialise(INDI::BaseClient *BaseClient)
Initialise the API.
Definition: ClientAPIForAlignmentDatabase.cpp:218
basedevice.h
INDI::AlignmentSubsystem::AlignmentDatabaseEntry
Entry in the in memory alignment database.
Definition: Common.h:145
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ProcessNewProperty
void ProcessNewProperty(INDI::Property *PropertyPointer)
Process new property message from driver. This routine should be called from within the newProperty h...
Definition: ClientAPIForAlignmentDatabase.cpp:359
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase
This class provides the client API to the driver side alignment database. It communicates with the dr...
Definition: ClientAPIForAlignmentDatabase.h:26
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::SaveDatabase
bool SaveDatabase()
Save the database to persistent storage.
Definition: ClientAPIForAlignmentDatabase.cpp:521
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::LoadDatabase
bool LoadDatabase()
Load the database from persistent storage.
Definition: ClientAPIForAlignmentDatabase.cpp:277
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ReadSyncPoint
bool ReadSyncPoint(unsigned int Offset, AlignmentDatabaseEntry &CurrentValues)
Read a sync point from the database.
Definition: ClientAPIForAlignmentDatabase.cpp:459
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ClientAPIForAlignmentDatabase
ClientAPIForAlignmentDatabase()
Default constructor.
Definition: ClientAPIForAlignmentDatabase.cpp:17
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ProcessNewBLOB
void ProcessNewBLOB(IBLOB *BLOBPointer)
Process new BLOB message from driver. This routine should be called from within the newBLOB handler i...
Definition: ClientAPIForAlignmentDatabase.cpp:316
INDI::Property
Provides generic container for INDI properties.
Definition: indiproperty.h:43
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::DeleteSyncPoint
bool DeleteSyncPoint(unsigned int Offset)
Delete a sync point from the database.
Definition: ClientAPIForAlignmentDatabase.cpp:108
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ProcessNewSwitch
void ProcessNewSwitch(ISwitchVectorProperty *SwitchVectorProperty)
Process new switch message from driver. This routine should be called from within the newSwitch handl...
Definition: ClientAPIForAlignmentDatabase.cpp:393
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ProcessNewDevice
void ProcessNewDevice(INDI::BaseDevice *DevicePointer)
Process new device message from driver. This routine should be called from within the newDevice handl...
Definition: ClientAPIForAlignmentDatabase.cpp:330
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ClearSyncPoints
bool ClearSyncPoints()
Delete all sync points from the database.
Definition: ClientAPIForAlignmentDatabase.cpp:70
Common.h
INDI::BaseClient
Class to provide basic client functionality.
Definition: baseclient.h:54
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::GetDatabaseSize
int GetDatabaseSize()
Return the number of entries in the database.
Definition: ClientAPIForAlignmentDatabase.cpp:213
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::InsertSyncPoint
bool InsertSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
Insert a sync point in the database.
Definition: ClientAPIForAlignmentDatabase.cpp:223
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::~ClientAPIForAlignmentDatabase
virtual ~ClientAPIForAlignmentDatabase()
Virtual destructor.
Definition: ClientAPIForAlignmentDatabase.cpp:23
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::ProcessNewNumber
void ProcessNewNumber(INumberVectorProperty *NumberVectorProperty)
Process new number message from driver. This routine should be called from within the newNumber handl...
Definition: ClientAPIForAlignmentDatabase.cpp:335
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
baseclient.h
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::EditSyncPoint
bool EditSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
Edit a sync point in the database.
Definition: ClientAPIForAlignmentDatabase.cpp:159
INDI::AlignmentSubsystem::ClientAPIForAlignmentDatabase::AppendSyncPoint
bool AppendSyncPoint(const AlignmentDatabaseEntry &CurrentValues)
Append a sync point to the database.
Definition: ClientAPIForAlignmentDatabase.cpp:29
INDI::BaseDevice
Class to provide basic INDI device functionality.
Definition: basedevice.h:45
IBLOB
One Blob (Binary Large Object) descriptor.
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365