Instrument Neutral Distributed Interface INDI 2.2.5
ClientAPIForAlignmentDatabase.cpp
Go to the documentation of this file.
1
10
11#include "indicom.h"
12
13namespace INDI
14{
15namespace AlignmentSubsystem
16{
18{
19 pthread_cond_init(&DriverActionCompleteCondition, nullptr);
20 pthread_mutex_init(&DriverActionCompleteMutex, nullptr);
21}
22
24{
25 pthread_cond_destroy(&DriverActionCompleteCondition);
26 pthread_mutex_destroy(&DriverActionCompleteMutex);
27}
28
30{
31 // Wait for driver to initialise if necessary
32 WaitForDriverCompletion();
33
34 auto pAction = Action->getSwitch();
35 auto pCommit = Commit->getSwitch();
36
37 if (APPEND != pAction->findOnSwitchIndex())
38 {
39 // Request Append mode
40 pAction->reset();
41 pAction->at(APPEND)->setState(ISS_ON);
42 SetDriverBusy();
43 BaseClient->sendNewSwitch(pAction);
44 WaitForDriverCompletion();
45 if (IPS_OK != pAction->getState())
46 {
47 IDLog("AppendSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
48 return false;
49 }
50 }
51
52 if (!SendEntryData(CurrentValues))
53 return false;
54
55 // Commit the entry to the database
56 pCommit->reset();
57 pCommit->at(0)->setState(ISS_ON);
58 SetDriverBusy();
59 BaseClient->sendNewSwitch(pCommit);
60 WaitForDriverCompletion();
61 if (IPS_OK != pCommit->getState())
62 {
63 IDLog("AppendSyncPoint - Bad Commit switch state %s\n", pCommit->getStateAsString());
64 return false;
65 }
66
67 return true;
68}
69
71{
72 // Wait for driver to initialise if necessary
73 WaitForDriverCompletion();
74
75 auto pAction = Action->getSwitch();
76 auto pCommit = Commit->getSwitch();
77
78 // Select the required action
79 if (CLEAR != pAction->findOnSwitchIndex())
80 {
81 // Request Clear mode
82 pAction->reset();
83 pAction->at(CLEAR)->setState(ISS_ON);
84 SetDriverBusy();
85 BaseClient->sendNewSwitch(pAction);
86 WaitForDriverCompletion();
87 if (IPS_OK != pAction->getState())
88 {
89 IDLog("ClearSyncPoints - Bad Action switch state %s\n", pAction->getStateAsString());
90 return false;
91 }
92 }
93
94 pCommit->reset();
95 pCommit->at(0)->setState(ISS_ON);
96 SetDriverBusy();
97 BaseClient->sendNewSwitch(pCommit);
98 WaitForDriverCompletion();
99 if (IPS_OK != pCommit->getState())
100 {
101 IDLog("ClearSyncPoints - Bad Commit switch state %s\n", pCommit->getStateAsString());
102 return false;
103 }
104
105 return true;
106}
107
109{
110 // Wait for driver to initialise if necessary
111 WaitForDriverCompletion();
112
113 auto pAction = Action->getSwitch();
114 auto pCurrentEntry = CurrentEntry->getNumber();
115 auto pCommit = Commit->getSwitch();
116
117 // Select the required action
118 if (DELETE != pAction->findOnSwitchIndex())
119 {
120 // Request Delete mode
121 pAction->reset();
122 pAction->at(DELETE)->setState(ISS_ON);
123 SetDriverBusy();
124 BaseClient->sendNewSwitch(pAction);
125 WaitForDriverCompletion();
126 if (IPS_OK != pAction->getState())
127 {
128 IDLog("DeleteSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
129 return false;
130 }
131 }
132
133 // Send the offset
134 pCurrentEntry->at(0)->setValue(Offset);
135 SetDriverBusy();
136 BaseClient->sendNewNumber(pCurrentEntry);
137 WaitForDriverCompletion();
138 if (IPS_OK != pCurrentEntry->getState())
139 {
140 IDLog("DeleteSyncPoint - Bad Current Entry state %s\n", pCurrentEntry->getStateAsString());
141 return false;
142 }
143
144 // Commit the entry to the database
145 pCommit->reset();
146 pCommit->at(0)->setState(ISS_ON);
147 SetDriverBusy();
148 BaseClient->sendNewSwitch(pCommit);
149 WaitForDriverCompletion();
150 if (IPS_OK != pCommit->getState())
151 {
152 IDLog("DeleteSyncPoint - Bad Commit switch state %s\n", pCommit->getStateAsString());
153 return false;
154 }
155
156 return true;
157}
158
159bool ClientAPIForAlignmentDatabase::EditSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
160{
161 // Wait for driver to initialise if necessary
162 WaitForDriverCompletion();
163
164 auto pAction = Action->getSwitch();
165 auto pCurrentEntry = CurrentEntry->getNumber();
166 auto pCommit = Commit->getSwitch();
167
168 // Select the required action
169 if (EDIT != pAction->findOnSwitchIndex())
170 {
171 // Request Edit mode
172 pAction->reset();
173 pAction->at(EDIT)->setState(ISS_ON);
174 SetDriverBusy();
175 BaseClient->sendNewSwitch(pAction);
176 WaitForDriverCompletion();
177 if (IPS_OK != pAction->getState())
178 {
179 IDLog("EditSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
180 return false;
181 }
182 }
183
184 // Send the offset
185 pCurrentEntry->at(0)->setValue(Offset);
186 SetDriverBusy();
187 BaseClient->sendNewNumber(pCurrentEntry);
188 WaitForDriverCompletion();
189 if (IPS_OK != pCurrentEntry->getState())
190 {
191 IDLog("EditSyncPoint - Bad Current Entry state %s\n", pCurrentEntry->getStateAsString());
192 return false;
193 }
194
195 if (!SendEntryData(CurrentValues))
196 return false;
197
198 // Commit the entry to the database
199 pCommit->reset();
200 pCommit->at(0)->setState(ISS_ON);
201 SetDriverBusy();
202 BaseClient->sendNewSwitch(pCommit);
203 WaitForDriverCompletion();
204 if (IPS_OK != pCommit->getState())
205 {
206 IDLog("EditSyncPoint - Bad Commit switch state %s\n", pCommit->getStateAsString());
207 return false;
208 }
209
210 return true;
211}
212
217
219{
220 ClientAPIForAlignmentDatabase::BaseClient = BaseClient;
221}
222
223bool ClientAPIForAlignmentDatabase::InsertSyncPoint(unsigned int Offset, const AlignmentDatabaseEntry &CurrentValues)
224{
225 // Wait for driver to initialise if necessary
226 WaitForDriverCompletion();
227
228 auto pAction = Action->getSwitch();
229 auto pCurrentEntry = CurrentEntry->getNumber();
230 auto pCommit = Commit->getSwitch();
231
232 // Select the required action
233 if (INSERT != pAction->findOnSwitchIndex())
234 {
235 // Request Insert mode
236 pAction->reset();
237 pAction->at(INSERT)->setState(ISS_ON);
238 SetDriverBusy();
239 BaseClient->sendNewSwitch(pAction);
240 WaitForDriverCompletion();
241 if (IPS_OK != pAction->getState())
242 {
243 IDLog("InsertSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
244 return false;
245 }
246 }
247
248 // Send the offset
249 pCurrentEntry->at(0)->setValue(Offset);
250 SetDriverBusy();
251 BaseClient->sendNewNumber(pCurrentEntry);
252 WaitForDriverCompletion();
253 if (IPS_OK != pCurrentEntry->getState())
254 {
255 IDLog("InsertSyncPoint - Bad Current Entry state %s\n", pCurrentEntry->getStateAsString());
256 return false;
257 }
258
259 if (!SendEntryData(CurrentValues))
260 return false;
261
262 // Commit the entry to the database
263 pCommit->reset();
264 pCommit->at(0)->setState(ISS_ON);
265 SetDriverBusy();
266 BaseClient->sendNewSwitch(pCommit);
267 WaitForDriverCompletion();
268 if (IPS_OK != pCommit->getState())
269 {
270 IDLog("InsertSyncPoint - Bad Commit switch state %s\n", pCommit->getStateAsString());
271 return false;
272 }
273
274 return true;
275}
276
278{
279 // Wait for driver to initialise if necessary
280 WaitForDriverCompletion();
281
282 auto pAction = Action->getSwitch();
283 auto pCommit = Commit->getSwitch();
284
285 // Select the required action
286 if (LOAD_DATABASE != pAction->findOnSwitchIndex())
287 {
288 // Request Load Database mode
289 pAction->reset();
290 pAction->at(LOAD_DATABASE)->setState(ISS_ON);
291 SetDriverBusy();
292 BaseClient->sendNewSwitch(pAction);
293 WaitForDriverCompletion();
294 if (IPS_OK != pAction->getState())
295 {
296 IDLog("LoadDatabase - Bad Action switch state %s\n", pAction->getStateAsString());
297 return false;
298 }
299 }
300
301 // Commit the Load Database
302 pCommit->reset();
303 pCommit->at(0)->setState(ISS_ON);
304 SetDriverBusy();
305 BaseClient->sendNewSwitch(pCommit);
306 WaitForDriverCompletion();
307 if (IPS_OK != pCommit->getState())
308 {
309 IDLog("LoadDatabase - Bad Commit state %s\n", pCommit->getStateAsString());
310 return false;
311 }
312
313 return true;
314}
315
317{
318 if (strcmp(BLOBPointer->bvp->name, "ALIGNMENT_POINT_OPTIONAL_BINARY_BLOB") == 0)
319 {
320 if (IPS_BUSY != BLOBPointer->bvp->s)
321 {
322 auto pAction = Action->getSwitch();
323 int Index = pAction->findOnSwitchIndex();
324 if ((READ != Index) && (READ_INCREMENT != Index))
325 SignalDriverCompletion();
326 }
327 }
328}
329
331{
332 Device = DevicePointer;
333}
334
336{
337 if (strcmp(NumberVectorProperty->name, "ALIGNMENT_POINT_MANDATORY_NUMBERS") == 0)
338 {
339 if (IPS_BUSY != NumberVectorProperty->s)
340 {
341 auto pAction = Action->getSwitch();
342 int Index = pAction->findOnSwitchIndex();
343 if ((READ != Index) && (READ_INCREMENT != Index))
344 SignalDriverCompletion();
345 }
346 }
347 else if (strcmp(NumberVectorProperty->name, "ALIGNMENT_POINTSET_CURRENT_ENTRY") == 0)
348 {
349 if (IPS_BUSY != NumberVectorProperty->s)
350 {
351 auto pAction = Action->getSwitch();
352 int Index = pAction->findOnSwitchIndex();
353 if (READ_INCREMENT != Index)
354 SignalDriverCompletion();
355 }
356 }
357}
358
360{
361 bool GotOneOfMine = true;
362
363 if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINT_MANDATORY_NUMBERS") == 0)
364 MandatoryNumbers = PropertyPointer;
365 else if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINT_OPTIONAL_BINARY_BLOB") == 0)
366 {
367 OptionalBinaryBlob = PropertyPointer;
368 // Make sure the format string is set up
369 OptionalBinaryBlob->getBLOB()->at(0)->setFormat("alignmentPrivateData");
370 }
371 else if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINTSET_SIZE") == 0)
372 PointsetSize = PropertyPointer;
373 else if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINTSET_CURRENT_ENTRY") == 0)
374 CurrentEntry = PropertyPointer;
375 else if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINTSET_ACTION") == 0)
376 Action = PropertyPointer;
377 else if (strcmp(PropertyPointer->getName(), "ALIGNMENT_POINTSET_COMMIT") == 0)
378 Commit = PropertyPointer;
379 else
380 GotOneOfMine = false;
381
382 // Tell the client when all the database properties have been set up
383 if (GotOneOfMine && (nullptr != MandatoryNumbers) && (nullptr != OptionalBinaryBlob) && (nullptr != PointsetSize) &&
384 (nullptr != CurrentEntry) && (nullptr != Action) && (nullptr != Commit))
385 {
386 // The DriverActionComplete state variable is initialised to false
387 // So I need to call this to set it to true and signal anyone
388 // waiting for the driver to initialise etc.
389 SignalDriverCompletion();
390 }
391}
392
394{
395 if (strcmp(SwitchVectorProperty->name, "ALIGNMENT_POINTSET_ACTION") == 0)
396 {
397 if (IPS_BUSY != SwitchVectorProperty->s)
398 SignalDriverCompletion();
399 }
400 else if (strcmp(SwitchVectorProperty->name, "ALIGNMENT_POINTSET_COMMIT") == 0)
401 {
402 if (IPS_BUSY != SwitchVectorProperty->s)
403 SignalDriverCompletion();
404 }
405}
406
408{
409 // Wait for driver to initialise if necessary
410 WaitForDriverCompletion();
411
412 auto pAction = Action->getSwitch();
413 auto pMandatoryNumbers = MandatoryNumbers->getNumber();
414 auto pBLOB = OptionalBinaryBlob->getBLOB();
415 auto pCurrentEntry = CurrentEntry->getNumber();
416 auto pCommit = Commit->getSwitch();
417
418 // Select the required action
419 if (READ_INCREMENT != pAction->findOnSwitchIndex())
420 {
421 // Request Read Increment mode
422 pAction->reset();
423 pAction->at(READ_INCREMENT)->setState(ISS_ON);
424 SetDriverBusy();
425 BaseClient->sendNewSwitch(pAction);
426 WaitForDriverCompletion();
427 if (IPS_OK != pAction->getState())
428 {
429 IDLog("ReadIncrementSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
430 return false;
431 }
432 }
433
434 // Commit the read increment
435 pCommit->reset();
436 pCommit->at(0)->setState(ISS_ON);
437 SetDriverBusy();
438 BaseClient->sendNewSwitch(pCommit);
439 WaitForDriverCompletion();
440 if ((IPS_OK != pCommit->getState()) || (IPS_OK != pMandatoryNumbers->getState()) || (IPS_OK != pBLOB->getState()) ||
441 (IPS_OK != pCurrentEntry->getState()))
442 {
443 IDLog("ReadIncrementSyncPoint - Bad Commit/Mandatory numbers/Blob/Current entry state %s %s %s %s\n",
444 pCommit->getStateAsString(), pMandatoryNumbers->getStateAsString(), pBLOB->getStateAsString(), pCurrentEntry->getStateAsString());
445 return false;
446 }
447
448 // Read the entry data
449 CurrentValues.ObservationJulianDate = pMandatoryNumbers->at(ENTRY_OBSERVATION_JULIAN_DATE)->getValue();
450 CurrentValues.RightAscension = pMandatoryNumbers->at(ENTRY_RA)->getValue();
451 CurrentValues.Declination = pMandatoryNumbers->at(ENTRY_DEC)->getValue();
452 CurrentValues.TelescopeDirection.x = pMandatoryNumbers->at(ENTRY_VECTOR_X)->getValue();
453 CurrentValues.TelescopeDirection.y = pMandatoryNumbers->at(ENTRY_VECTOR_Y)->getValue();
454 CurrentValues.TelescopeDirection.z = pMandatoryNumbers->at(ENTRY_VECTOR_Z)->getValue();
455
456 return true;
457}
458
460{
461 // Wait for driver to initialise if necessary
462 WaitForDriverCompletion();
463
464 auto pAction = Action->getSwitch();
465 auto pMandatoryNumbers = MandatoryNumbers->getNumber();
466 auto pBLOB = OptionalBinaryBlob->getBLOB();
467 auto pCurrentEntry = CurrentEntry->getNumber();
468 auto pCommit = Commit->getSwitch();
469
470 // Select the required action
471 if (READ != pAction->findOnSwitchIndex())
472 {
473 // Request Read mode
474 pAction->reset();
475 pAction->at(READ)->setState(ISS_ON);
476 SetDriverBusy();
477 BaseClient->sendNewSwitch(pAction);
478 WaitForDriverCompletion();
479 if (IPS_OK != pAction->getState())
480 {
481 IDLog("ReadSyncPoint - Bad Action switch state %s\n", pAction->getStateAsString());
482 return false;
483 }
484 }
485
486 // Send the offset
487 pCurrentEntry->at(0)->setValue(Offset);
488 SetDriverBusy();
489 BaseClient->sendNewNumber(pCurrentEntry);
490 WaitForDriverCompletion();
491 if (IPS_OK != pCurrentEntry->getState())
492 {
493 IDLog("ReadSyncPoint - Bad Current Entry state %s\n", pCurrentEntry->getStateAsString());
494 return false;
495 }
496
497 // Commit the read
498 pCommit->reset();
499 pCommit->at(0)->setState(ISS_ON);
500 SetDriverBusy();
501 BaseClient->sendNewSwitch(pCommit);
502 WaitForDriverCompletion();
503 if ((IPS_OK != pCommit->getState()) || (IPS_OK != pMandatoryNumbers->getState()) || (IPS_OK != pBLOB->getState()))
504 {
505 IDLog("ReadSyncPoint - Bad Commit/Mandatory numbers/Blob state %s %s %s\n", pCommit->getStateAsString(),
506 pMandatoryNumbers->getStateAsString(), pBLOB->getStateAsString());
507 return false;
508 }
509
510 // Read the entry data
511 CurrentValues.ObservationJulianDate = pMandatoryNumbers->at(ENTRY_OBSERVATION_JULIAN_DATE)->getValue();
512 CurrentValues.RightAscension = pMandatoryNumbers->at(ENTRY_RA)->getValue();
513 CurrentValues.Declination = pMandatoryNumbers->at(ENTRY_DEC)->getValue();
514 CurrentValues.TelescopeDirection.x = pMandatoryNumbers->at(ENTRY_VECTOR_X)->getValue();
515 CurrentValues.TelescopeDirection.y = pMandatoryNumbers->at(ENTRY_VECTOR_Y)->getValue();
516 CurrentValues.TelescopeDirection.z = pMandatoryNumbers->at(ENTRY_VECTOR_Z)->getValue();
517
518 return true;
519}
520
522{
523 // Wait for driver to initialise if necessary
524 WaitForDriverCompletion();
525
526 auto pAction = Action->getSwitch();
527 auto pCommit = Commit->getSwitch();
528
529 // Select the required action
530 if (SAVE_DATABASE != pAction->findOnSwitchIndex())
531 {
532 // Request Load Database mode
533 pAction->reset();
534 pAction->at(SAVE_DATABASE)->setState(ISS_ON);
535 SetDriverBusy();
536 BaseClient->sendNewSwitch(pAction);
537 WaitForDriverCompletion();
538 if (IPS_OK != pAction->getState())
539 {
540 IDLog("SaveDatabase - Bad Action switch state %s\n", pAction->getStateAsString());
541 return false;
542 }
543 }
544
545 // Commit the Save Database
546 pCommit->reset();
547 pCommit->at(0)->setState(ISS_ON);
548 SetDriverBusy();
549 BaseClient->sendNewSwitch(pCommit);
550 WaitForDriverCompletion();
551 if (IPS_OK != pCommit->getState())
552 {
553 IDLog("Save Database - Bad Commit state %s\n", pCommit->getStateAsString());
554 return false;
555 }
556
557 return true;
558}
559
560// Private methods
561
562bool ClientAPIForAlignmentDatabase::SendEntryData(const AlignmentDatabaseEntry &CurrentValues)
563{
564 auto pMandatoryNumbers = MandatoryNumbers->getNumber();
565 auto pBLOB = OptionalBinaryBlob->getBLOB();
566 // Send the entry data
567 pMandatoryNumbers->at(ENTRY_OBSERVATION_JULIAN_DATE)->setValue(CurrentValues.ObservationJulianDate);
568 pMandatoryNumbers->at(ENTRY_RA)->setValue(CurrentValues.RightAscension);
569 pMandatoryNumbers->at(ENTRY_DEC)->setValue(CurrentValues.Declination);
570 pMandatoryNumbers->at(ENTRY_VECTOR_X)->setValue(CurrentValues.TelescopeDirection.x);
571 pMandatoryNumbers->at(ENTRY_VECTOR_Y)->setValue(CurrentValues.TelescopeDirection.y);
572 pMandatoryNumbers->at(ENTRY_VECTOR_Z)->setValue(CurrentValues.TelescopeDirection.z);
573 SetDriverBusy();
574 BaseClient->sendNewNumber(pMandatoryNumbers);
575 WaitForDriverCompletion();
576 if (IPS_OK != pMandatoryNumbers->getState())
577 {
578 IDLog("SendEntryData - Bad mandatory numbers state %s\n", pMandatoryNumbers->getStateAsString());
579 return false;
580 }
581
582 if ((0 != CurrentValues.PrivateDataSize) && (nullptr != CurrentValues.PrivateData.get()))
583 {
584 // I have a BLOB to send
585 SetDriverBusy();
586 BaseClient->startBlob(Device->getDeviceName(), pBLOB->getName(), indi_timestamp());
587 BaseClient->sendOneBlob(pBLOB->at(0)->getName(), CurrentValues.PrivateDataSize, pBLOB->at(0)->getFormat(),
588 CurrentValues.PrivateData.get());
590 WaitForDriverCompletion();
591 if (IPS_OK != pBLOB->getState())
592 {
593 IDLog("SendEntryData - Bad BLOB state %s\n", pBLOB->getStateAsString());
594 return false;
595 }
596 }
597 return true;
598}
599
600bool ClientAPIForAlignmentDatabase::SetDriverBusy()
601{
602 int ReturnCode = pthread_mutex_lock(&DriverActionCompleteMutex);
603
604 if (ReturnCode != 0)
605 return false;
606 DriverActionComplete = false;
607 IDLog("SetDriverBusy\n");
608 ReturnCode = pthread_mutex_unlock(&DriverActionCompleteMutex);
609 return ReturnCode == 0;
610}
611
612bool ClientAPIForAlignmentDatabase::SignalDriverCompletion()
613{
614 int ReturnCode = pthread_mutex_lock(&DriverActionCompleteMutex);
615
616 if (ReturnCode != 0)
617 return false;
618 DriverActionComplete = true;
619 ReturnCode = pthread_cond_signal(&DriverActionCompleteCondition);
620 if (ReturnCode != 0)
621 {
622 ReturnCode = pthread_mutex_unlock(&DriverActionCompleteMutex);
623 return false;
624 }
625 IDLog("SignalDriverCompletion\n");
626 ReturnCode = pthread_mutex_unlock(&DriverActionCompleteMutex);
627 return ReturnCode == 0;
628}
629
630bool ClientAPIForAlignmentDatabase::WaitForDriverCompletion()
631{
632 int ReturnCode = pthread_mutex_lock(&DriverActionCompleteMutex);
633
634 while (!DriverActionComplete)
635 {
636 IDLog("WaitForDriverCompletion - Waiting\n");
637 ReturnCode = pthread_cond_wait(&DriverActionCompleteCondition, &DriverActionCompleteMutex);
638 IDLog("WaitForDriverCompletion - Back from wait ReturnCode = %d\n", ReturnCode);
639 if (ReturnCode != 0)
640 {
641 ReturnCode = pthread_mutex_unlock(&DriverActionCompleteMutex);
642 return false;
643 }
644 }
645 IDLog("WaitForDriverCompletion - Finished waiting\n");
646 ReturnCode = pthread_mutex_unlock(&DriverActionCompleteMutex);
647 return ReturnCode == 0;
648}
649
650} // namespace AlignmentSubsystem
651} // namespace INDI
void sendNewSwitch(INDI::Property pp)
Send new Switch command to server.
void finishBlob()
Send closing tag for BLOB command to server.
void sendOneBlob(IBLOB *bp)
Send ONE blob content to server. The BLOB data in raw binary format and will be converted to base64 a...
void sendNewNumber(INDI::Property pp)
Send new Number command to server.
void startBlob(const char *devName, const char *propName, const char *timestamp)
Send opening tag for BLOB command to server.
bool AppendSyncPoint(const AlignmentDatabaseEntry &CurrentValues)
Append a sync point to the database.
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
const char * getDeviceName() const
Provides generic container for INDI properties.
INDI::PropertyViewSwitch * getSwitch() const
INDI::PropertyViewBlob * getBLOB() const
INDI::PropertyViewNumber * getNumber() const
const char * getName() const
@ ISS_ON
Definition indiapi.h:150
@ IPS_BUSY
Definition indiapi.h:161
@ IPS_OK
Definition indiapi.h:160
void IDLog(const char *fmt,...)
Definition indicom.c:305
const char * indi_timestamp()
Create an ISO 8601 formatted time stamp. The format is YYYY-MM-DDTHH:MM:SS.
Definition indicom.c:337
Implementations for common driver routines.
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
double RightAscension
Right ascension in decimal hours. N.B. libnova works in decimal degrees so conversion is always neede...
Definition Common.h:190
TelescopeDirectionVector TelescopeDirection
Normalised vector giving telescope pointing direction. This is referred to elsewhere as the "apparent...
Definition Common.h:197
double Declination
Declination in decimal degrees.
Definition Common.h:193
int PrivateDataSize
This size in bytes of any private data.
Definition Common.h:203
std::unique_ptr< unsigned char > PrivateData
Private data associated with this sync point.
Definition Common.h:200
WidgetType * at(size_t index) const
void setFormat(const char *format)
Number vector property descriptor.
Definition indiapi.h:317
char name[MAXINDINAME]
Definition indiapi.h:321
Switch vector property descriptor.
Definition indiapi.h:365
char name[MAXINDINAME]
Definition indiapi.h:369