Instrument Neutral Distributed Interface INDI  2.0.2
indidetector.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 
62 struct pulse_t
63 {
64  timespec start;
65  timespec duration;
66 };
67 
68 class Detector : public SensorInterface
69 {
70  public:
71 
72  enum
73  {
76 
77  Detector();
78  virtual ~Detector();
79 
80  bool initProperties() override;
81  bool updateProperties() override;
82  void ISGetProperties(const char *dev) override;
83  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
84  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
85  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
86  bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
87  char *names[], int n) override;
88  bool ISSnoopDevice(XMLEle *root) override;
89 
90  void addFITSKeywords(fitsfile *fptr, uint8_t* buf, int len) override;
91 
92  virtual bool StartIntegration(double duration) override;
93 
98  void setResolution(double res);
99 
104  inline double getResolution()
105  {
106  return Resolution;
107  }
108 
113  void setTriggerLevel(double level);
114 
119  inline double getTriggerLevel()
120  {
121  return TriggerLevel;
122  }
123 
128  {
129  return &DetectorSettingsNP;
130  }
131 
135  uint32_t GetDetectorCapability() const
136  {
137  return capability;
138  }
139 
144  void SetDetectorCapability(uint32_t cap);
145 
156  virtual void setMinMaxStep(const char *property, const char *element, double min, double max, double step,
157  bool sendToClient = true) override;
158 
159  typedef enum
160  {
165 
166  private:
167  double TriggerLevel;
168  double Resolution;
169  INumber DetectorSettingsN[2];
170 };
171 }
Class to provide general functionality of Monodimensional Detector.
Definition: indidetector.h:69
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
INumberVectorProperty * getDetectorSettings()
Return Vector Info Property.
Definition: indidetector.h:127
bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
double getResolution()
getResolution Get resolution of the detector in ns.
Definition: indidetector.h:104
enum INDI::Detector::@237 DetectorCapability
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
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.
uint32_t GetDetectorCapability() const
GetDetectorCapability returns the Sensor capabilities.
Definition: indidetector.h:135
void addFITSKeywords(fitsfile *fptr, uint8_t *buf, int len) override
Add FITS keywords to a fits file.
INumberVectorProperty DetectorSettingsNP
Definition: indidetector.h:164
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool StartIntegration(double duration) override
Start integration from the Sensor device.
bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
virtual void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient=true) override
setMinMaxStep for a number property element
void SetDetectorCapability(uint32_t cap)
SetDetectorCapability Set the Detector capabilities. Al fields must be initialized.
void setTriggerLevel(double level)
setTriggerLevel Set Trigger voltage level used for pulse detection.
double getTriggerLevel()
getTriggerLevel Get Trigger voltage level used for pulse detection.
Definition: indidetector.h:119
void setResolution(double res)
setResolution Set resolution of the detector in ns.
virtual ~Detector()
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.
timespec start
Definition: indidetector.h:64
timespec duration
Definition: indidetector.h:65
One number descriptor.
Number vector property descriptor.
Definition: indiapi.h:319