Instrument Neutral Distributed Interface INDI  1.9.5
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  timespec start;
64  timespec duration;
65 };
66 
67 class Detector : public SensorInterface
68 {
69  public:
70 
71  enum
72  {
75 
76  Detector();
77  virtual ~Detector();
78 
79  bool initProperties();
80  bool updateProperties();
81  void ISGetProperties(const char *dev);
82  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
83  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
84  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
85  bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n);
86  bool ISSnoopDevice(XMLEle *root);
87 
88  void addFITSKeywords(fitsfile *fptr, uint8_t* buf, int len);
89 
90  virtual bool StartIntegration(double duration);
91 
96  void setResolution(double res);
97 
102  inline double getResolution()
103  {
104  return Resolution;
105  }
106 
111  void setTriggerLevel(double level);
112 
117  inline double getTriggerLevel()
118  {
119  return TriggerLevel;
120  }
121 
126  {
127  return &DetectorSettingsNP;
128  }
129 
133  uint32_t GetDetectorCapability() const
134  {
135  return capability;
136  }
137 
142  void SetDetectorCapability(uint32_t cap);
143 
154  void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient);
155 
156  typedef enum
157  {
162 
163  private:
164  double TriggerLevel;
165  double Resolution;
166  INumber DetectorSettingsN[2];
167 };
168 }
INDI::Detector::ISNewText
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Process the client newSwitch command.
Definition: indidetector.cpp:112
INDI::Detector::getResolution
double getResolution()
getResolution Get resolution of the detector in ns.
Definition: indidetector.h:102
dsp.h
INDI::Detector::DETECTOR_TRIGGER
@ DETECTOR_TRIGGER
Definition: indidetector.h:159
INDI::Detector::ISGetProperties
void ISGetProperties(const char *dev)
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
Definition: indidetector.cpp:83
min
double min(void)
INDI::Detector::DetectorCapability
enum INDI::Detector::@182 DetectorCapability
INumber
One number descriptor.
INDI::Detector::getTriggerLevel
double getTriggerLevel()
getTriggerLevel Get Trigger voltage level used for pulse detection.
Definition: indidetector.h:117
INDI::Detector::setTriggerLevel
void setTriggerLevel(double level)
setTriggerLevel Set Trigger voltage level used for pulse detection.
Definition: indidetector.cpp:136
INDI::pulse_t::start
timespec start
Definition: indidetector.h:63
INDI::SensorInterface
The SensorDevice class provides functionality of a Sensor Device within a Sensor.
Definition: indisensorinterface.h:70
INDI::Detector::GetDetectorCapability
uint32_t GetDetectorCapability() const
GetDetectorCapability returns the Sensor capabilities.
Definition: indidetector.h:133
INDI::Detector::ISNewNumber
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process the client newNumber command.
Definition: indidetector.cpp:117
INDI::SensorInterface::SENSOR_MAX_CAPABILITY
@ SENSOR_MAX_CAPABILITY
Definition: indisensorinterface.h:81
StreamManager
Class to provide video streaming and recording functionality.
max
double max(void)
INDI::Detector::DETECTOR_INFO_INDEX
DETECTOR_INFO_INDEX
Definition: indidetector.h:156
INDI::pulse_t
Definition: indidetector.h:62
INDI::Detector::setResolution
void setResolution(double res)
setResolution Set resolution of the detector in ns.
Definition: indidetector.cpp:145
INDI::Detector::ISSnoopDevice
bool ISSnoopDevice(XMLEle *root)
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: indidetector.cpp:107
INDI::SensorInterface::capability
uint32_t capability
Definition: indisensorinterface.h:418
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::Detector::DetectorSettingsNP
INumberVectorProperty DetectorSettingsNP
Definition: indidetector.h:161
INDI::Detector::ISNewSwitch
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process the client newSwitch command.
Definition: indidetector.cpp:125
INDI::Detector::Detector
Detector()
Definition: indidetector.cpp:61
INDI::Detector
Class to provide general functionality of Monodimensional Detector.
Definition: indidetector.h:67
INDI::Detector::DETECTOR_MAX_CAPABILITY
@ DETECTOR_MAX_CAPABILITY
Definition: indidetector.h:73
xml_ele_
Definition: lilxml.c:105
INDI::Detector::updateProperties
bool updateProperties()
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indidetector.cpp:88
INDI::Detector::getDetectorSettings
INumberVectorProperty * getDetectorSettings()
Return Vector Info Property.
Definition: indidetector.h:125
indiwsserver.h
INDI::Detector::StartIntegration
virtual bool StartIntegration(double duration)
Start integration from the Sensor device.
Definition: indidetector.cpp:160
INDI::Detector::addFITSKeywords
void addFITSKeywords(fitsfile *fptr, uint8_t *buf, int len)
Add FITS keywords to a fits file.
Definition: indidetector.cpp:189
name
const char * name
Definition: indiserver.c:116
indisensorinterface.h
INDI::Detector::SetDetectorCapability
void SetDetectorCapability(uint32_t cap)
SetDetectorCapability Set the Detector capabilities. Al fields must be initilized.
Definition: indidetector.cpp:154
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::Detector::initProperties
bool initProperties()
Initilize properties initial state and value. The child class must implement this function.
Definition: indidetector.cpp:71
INDI::Detector::DETECTOR_RESOLUTION
@ DETECTOR_RESOLUTION
Definition: indidetector.h:158
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::pulse_t::duration
timespec duration
Definition: indidetector.h:64
INDI::Detector::~Detector
virtual ~Detector()
Definition: indidetector.cpp:67
INDI::Detector::ISNewBLOB
bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Process the client newBLOB command.
Definition: indidetector.cpp:130
INDI::Detector::setMinMaxStep
void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient)
setMinMaxStep for a number property element
Definition: indidetector.cpp:167