/usr/include/libindi/alignment/ClientAPIForAlignmentDatabase.h is in libindi-dev 1.2.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*!
* \file ClientAPIForAlignmentDatabase.h
*
* \author Roger James
* \date 13th November 2013
*
*/
#ifndef INDI_ALIGNMENTSUBSYSTEM_CLIENTAPIFORALIGNMENTDATABASE_H
#define INDI_ALIGNMENTSUBSYSTEM_CLIENTAPIFORALIGNMENTDATABASE_H
#include "Common.h"
#include "indibase/basedevice.h"
#include "indibase/baseclient.h"
#include <string>
namespace INDI {
namespace AlignmentSubsystem {
/*!
* \class ClientAPIForAlignmentDatabase
* \brief This class provides the client API to the driver side alignment database. It communicates
* with the driver via the INDI properties interface.
*/
class ClientAPIForAlignmentDatabase
{
public:
/// \brief Default constructor
ClientAPIForAlignmentDatabase();
/// \brief Virtual destructor
virtual ~ClientAPIForAlignmentDatabase();
/** \brief Append a sync point to the database.
\param[in] CurrentValues The entry to append.
\return True if successful
*/
bool AppendSyncPoint(const AlignmentDatabaseEntry& CurrentValues);
/** \brief Delete all sync points from the database.
\return True if successful
*/
bool ClearSyncPoints();
/** \brief Delete a sync point from the database.
\param[in] Offset Pointer to the entry to delete
\return True if successful
*/
bool DeleteSyncPoint(unsigned int Offset);
/** \brief Edit a sync point in the database.
\param[in] Offset Pointer to where to make the edit.
\param[in] CurrentValues The entry to edit.
\return True if successful
*/
bool EditSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry& CurrentValues);
/** \brief Return the number of entries in the database.
\return The number of entries in the database
*/
const int GetDatabaseSize();
/// \brief Initialise the API
/// \param[in] BaseClient A pointer to the INDI::BaseClient class
void Initialise(INDI::BaseClient *BaseClient);
/** \brief Insert a sync point in the database.
\param[in] Offset Pointer to where to make then insertion.
\param[in] CurrentValues The entry to insert.
\return True if successful
*/
bool InsertSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry& CurrentValues);
/** \brief Load the database from persistent storage
\return True if successful
*/
bool LoadDatabase();
/** \brief Process new BLOB message from driver. This routine should be called from within
the newBLOB handler in the client. This routine is not normally called directly but is called by
the ProcessNewBLOB function in INDI::Alignment::AlignmentSubsystemForClients which filters out calls
from unwanted devices. TODO maybe hide this function.
\param[in] BLOBPointer A pointer to the INDI::IBLOB.
*/
void ProcessNewBLOB(IBLOB *BLOBPointer);
/** \brief Process new device message from driver. This routine should be called from within
the newDevice handler in the client. This routine is not normally called directly but is called by
the ProcessNewDevice function in INDI::Alignment::AlignmentSubsystemForClients which filters out calls
from unwanted devices. TODO maybe hide this function.
\param[in] DevicePointer A pointer to the INDI::BaseDevice object.
*/
void ProcessNewDevice(INDI::BaseDevice *DevicePointer);
/** \brief Process new number message from driver. This routine should be called from within
the newNumber handler in the client. This routine is not normally called directly but is called by
the ProcessNewNumber function in INDI::Alignment::AlignmentSubsystemForClients which filters out calls
from unwanted devices. TODO maybe hide this function.
\param[in] NumberVectorProperty A pointer to the INDI::INumberVectorProperty.
*/
void ProcessNewNumber(INumberVectorProperty *NumberVectorProperty);
/** \brief Process new property message from driver. This routine should be called from within
the newProperty handler in the client. This routine is not normally called directly but is called by
the ProcessNewProperty function in INDI::Alignment::AlignmentSubsystemForClients which filters out calls
from unwanted devices. TODO maybe hide this function.
\param[in] PropertyPointer A pointer to the INDI::Property object.
*/
void ProcessNewProperty(INDI::Property *PropertyPointer);
/** \brief Process new switch message from driver. This routine should be called from within
the newSwitch handler in the client. This routine is not normally called directly but is called by
the ProcessNewSwitch function in INDI::Alignment::AlignmentSubsystemForClients which filters out calls
from unwanted devices. TODO maybe hide this function.
\param[in] SwitchVectorProperty A pointer to the INDI::ISwitchVectorProperty.
*/
void ProcessNewSwitch(ISwitchVectorProperty *SwitchVectorProperty);
/** \brief Increment the current offset then read a sync point from the database.
\param[out] CurrentValues The entry read.
\return True if successful
*/
bool ReadIncrementSyncPoint(AlignmentDatabaseEntry& CurrentValues);
/** \brief Read a sync point from the database.
\param[in] Offset Pointer to where to read from.
\param[out] CurrentValues The entry read.
\return True if successful
*/
bool ReadSyncPoint(unsigned int Offset, AlignmentDatabaseEntry& CurrentValues);
/** \brief Save the database to persistent storage
\return True if successful
*/
bool SaveDatabase();
private:
// Private methods
bool SendEntryData(const AlignmentDatabaseEntry& CurrentValues);
bool SetDriverBusy();
bool SignalDriverCompletion();
bool WaitForDriverCompletion();
// Private properties
INDI::BaseClient *BaseClient;
pthread_cond_t DriverActionCompleteCondition;
pthread_mutex_t DriverActionCompleteMutex;
bool DriverActionComplete;
INDI::BaseDevice *Device;
INDI::Property *MandatoryNumbers;
INDI::Property *OptionalBinaryBlob;
INDI::Property *PointsetSize;
INDI::Property *CurrentEntry;
INDI::Property *Action;
INDI::Property *Commit;
};
} // namespace AlignmentSubsystem
} // namespace INDI
#endif // INDI_ALIGNMENTSUBSYSTEM_CLIENTAPIFORALIGNMENTDATABASE_H
|