Instrument Neutral Distributed Interface INDI  2.0.2
indicorrelator.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2010, 2017 Ilia Platone, Jasem Mutlaq. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
7 
8  This library is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  Library General Public License for more details.
12 
13  You should have received a copy of the GNU Library General Public License
14  along with this library; see the file COPYING.LIB. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 *******************************************************************************/
18 
19 #pragma once
20 
21 #include "indisensorinterface.h"
22 #include "dsp.h"
23 #include <fitsio.h>
24 
25 #ifdef HAVE_WEBSOCKET
26 #include "indiwsserver.h"
27 #endif
28 
29 #include <fitsio.h>
30 
31 #include <memory>
32 #include <cstring>
33 #include <chrono>
34 #include <stdint.h>
35 #include <mutex>
36 #include <thread>
37 
38 //JM 2019-01-17: Disabled until further notice
39 //#define WITH_EXPOSURE_LOOPING
40 
41 
58 namespace INDI
59 {
60 class StreamManager;
61 
63 {
64  public:
69  typedef union
70  {
71  struct
72  {
73  double x;
74  double y;
75  double z;
76  };
77  double values[3];
78  } Baseline;
79 
84  typedef union
85  {
86  struct
87  {
88  double u;
89  double v;
90  };
91  double values[2];
92  } UVCoordinate;
93 
98  typedef struct
99  {
102  double coefficient;
103  } Correlation;
104 
105  enum
106  {
109 
110  Correlator();
111  virtual ~Correlator();
112 
113  bool initProperties() override;
114  bool updateProperties() override;
115  void ISGetProperties(const char *dev) override;
116  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
117  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
118  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
119  bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
120  char *names[], int n) override;
121  bool ISSnoopDevice(XMLEle *root) override;
122 
123  virtual bool StartIntegration(double duration) override;
124 
129  virtual inline double getCorrelationDegree()
130  {
131  return 0.0;
132  }
133 
139  {
140  Correlation ret;
142  ret.baseline = baseline;
144  return ret;
145  }
146 
151  void setBaseline(Baseline bl);
152 
157  void setWavelength(double wl);
158 
163  void setBandwidth(double bw);
164 
170  {
171  return baseline;
172  }
173 
178  inline double getWavelength()
179  {
180  return wavelength;
181  }
182 
187  UVCoordinate getUVCoordinates();
188 
194  UVCoordinate getUVCoordinates(double lst);
195 
202  UVCoordinate getUVCoordinates(double alt, double az);
203 
208  double getDelay();
209 
215  double getDelay(double lst);
216 
223  double getDelay(double alt, double az);
224 
229  inline double setBandwidth()
230  {
231  return bandwidth;
232  }
233 
238  {
239  return &CorrelatorSettingsNP;
240  }
241 
245  uint32_t GetCorrelatorCapability() const
246  {
247  return capability;
248  }
249 
254  void SetCorrelatorCapability(uint32_t cap);
255 
266  virtual void setMinMaxStep(const char *property, const char *element, double min, double max, double step,
267  bool sendToClient) override;
268 
269  typedef enum
270  {
278 
279  private:
280  Baseline baseline;
281  double wavelength;
282  double bandwidth;
283  INumber CorrelatorSettingsN[5];
284 };
285 }
Class to provide general functionality of Monodimensional Correlator.
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.
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
enum INDI::Correlator::@232 CorrelatorCapability
double setBandwidth()
setBandwidth Get the bandwidth of the correlator.
INumberVectorProperty CorrelatorSettingsNP
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
void SetCorrelatorCapability(uint32_t cap)
SetCorrelatorCapability Set the Correlator capabilities. Al fields must be initialized.
virtual bool StartIntegration(double duration) override
Start integration from the Sensor device.
uint32_t GetCorrelatorCapability() const
GetCorrelatorCapability returns the Sensor capabilities.
Correlation getCorrelation()
getCorrelation Get current correlation degree plus UV and baseline information.
double getDelay()
getDelay Get current baseline delay with reference to the current sidereal time.
virtual void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient) override
setMinMaxStep for a number property element
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
virtual double getCorrelationDegree()
getCorrelationDegree Get current correlation degree.
bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
double getWavelength()
setWavelength Get the observed wavelength.
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void setBaseline(Baseline bl)
setBaseline Set the baseline size in meters.
void setWavelength(double wl)
setWavelength Set the observed wavelength.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Baseline getBaseline()
setBaseline Get the baseline size in meters.
INumberVectorProperty * getCorrelatorSettings()
Return Vector Info Property.
UVCoordinate getUVCoordinates()
getUVCoordinates Get current UV projected coordinates with reference to the current sidereal time.
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
The SensorDevice class provides functionality of a Sensor Device within a Sensor.
Class to provide video streaming and recording functionality.
double max(void)
double min(void)
ISState
Switch state.
Definition: indiapi.h:150
Namespace to encapsulate INDI client, drivers, and mediator classes.
One number descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
the baseline (position of the telescopes) of this correlator.