Instrument Neutral Distributed Interface INDI  2.0.2
astrometrydriver.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2017 Jasem Mutlaq. All rights reserved.
3 
4  INDI Astrometry.net Driver
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "defaultdevice.h"
28 
29 #include <pthread.h>
30 
52 {
53  public:
54  enum
55  {
58  };
59 
60  enum
61  {
67  };
68 
70  ~AstrometryDriver() = default;
71 
72  virtual void ISGetProperties(const char *dev) override;
73  virtual bool initProperties() override;
74  virtual bool updateProperties() override;
75 
76  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
77  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
78  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
79  virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
80  char *formats[], char *names[], int n) override;
81  virtual bool ISSnoopDevice(XMLEle *root) override;
82 
83  static void *runSolverHelper(void *context);
84 
85  protected:
86  // Generic indi device entries
87  bool Connect() override;
88  bool Disconnect() override;
89  const char *getDefaultName() override;
90 
91  virtual bool saveConfigItems(FILE *fp) override;
92 
93  // Astrometry
94 
95  // Enable/Disable solver
99 
100  // Solver Settings
103 
104  // Solver Results
107 
110 
113 
116 
117  private:
118  // Run solver thread
119  void runSolver();
120 
130  bool processBLOB(uint8_t *data, uint32_t size, uint32_t len);
131 
132  // Thread for listenINDI()
133  pthread_t solverThread;
134  pthread_mutex_t lock;
135 };
The AstrometryDriver class is an INDI driver frontend for astrometry.net.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
static void * runSolverHelper(void *context)
INumber SolverResultN[5]
virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override
Process the client newBLOB command.
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
IBLOBVectorProperty SolverDataBP
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
ITextVectorProperty ActiveDeviceTP
virtual void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
ISwitchVectorProperty SolverSP
INumberVectorProperty SolverResultNP
ITextVectorProperty SolverSettingsTP
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
~AstrometryDriver()=default
bool Disconnect() override
Disconnect from device.
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
IBLOBVectorProperty CCDDataBP
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
const char * getDefaultName() override
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
ISState
Switch state.
Definition: indiapi.h:150
One Blob (Binary Large Object) descriptor.
One number descriptor.
One switch descriptor.
One text descriptor.
BLOB (Binary Large Object) vector property descriptor.
Definition: indiapi.h:471
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367
Text vector property descriptor.
Definition: indiapi.h:246