Instrument Neutral Distributed Interface INDI  1.9.2
indispectrograph.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 class Spectrograph : public virtual SensorInterface
63 {
64  public:
65  enum
66  {
69 
70  Spectrograph();
71  virtual ~Spectrograph();
72 
73  virtual bool initProperties() override;
74  virtual bool updateProperties() override;
75  virtual void ISGetProperties(const char *dev) override;
76  virtual bool ISNewNumber(const char *dev, const char *name, double values[], 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 ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
79  virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) override;
80  virtual bool ISSnoopDevice(XMLEle *root) override;
81 
82  virtual bool StartIntegration(double duration) override;
83  virtual void addFITSKeywords(fitsfile *fptr, uint8_t* buf, int len) override;
84 
89  void setLowCutFrequency(double freq);
90 
95  void setHighCutFrequency(double freq);
96 
101  void setGain(double gain);
102 
107  inline double getLowCutFrequency()
108  {
109  return LowCutFrequency;
110  }
111 
116  inline double getHighCutFrequency()
117  {
118  return HighCutFrequency;
119  }
120 
125  inline double getGain()
126  {
127  return Gain;
128  }
129 
134  {
135  return &SpectrographSettingsNP;
136  }
137 
141  uint32_t GetSpectrographCapability() const
142  {
143  return capability;
144  }
145 
150  void SetSpectrographCapability(uint32_t cap);
151 
162  void setMinMaxStep(const char *property, const char *element, double min, double max, double step,
163  bool sendToClient = true);
164 
165  typedef enum
166  {
175 
176 private:
177  double LowCutFrequency;
178  double HighCutFrequency;
179  double Gain;
180 
181 };
182 }
INDI::Spectrograph::SetSpectrographCapability
void SetSpectrographCapability(uint32_t cap)
SetSpectrographCapability Set the Spectrograph capabilities. Al fields must be initilized.
Definition: indispectrograph.cpp:165
INDI::Spectrograph::setGain
void setGain(double gain)
setGain Set gain of Spectrograph device.
Definition: indispectrograph.cpp:156
dsp.h
INDI::Spectrograph::setHighCutFrequency
void setHighCutFrequency(double freq)
setHighCutFrequency Set high cut frequency of Spectrograph device.
Definition: indispectrograph.cpp:147
INDI::Spectrograph::SPECTROGRAPH_GAIN
@ SPECTROGRAPH_GAIN
Definition: indispectrograph.h:167
min
double min(void)
INDI::Spectrograph::ISNewNumber
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: indispectrograph.cpp:119
INumber
One number descriptor.
INDI::Spectrograph::GetSpectrographCapability
uint32_t GetSpectrographCapability() const
GetSpectrographCapability returns the Sensor capabilities.
Definition: indispectrograph.h:141
INDI::SensorInterface
The SensorDevice class provides functionality of a Sensor Device within a Sensor.
Definition: indisensorinterface.h:70
INDI::Spectrograph::ISNewBLOB
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.
Definition: indispectrograph.cpp:132
INDI::Spectrograph::getGain
double getGain()
getGain Get requested integration gain for the sensor.
Definition: indispectrograph.h:125
INDI::Spectrograph::Spectrograph
Spectrograph()
Definition: indispectrograph.cpp:62
StreamManager
Class to provide video streaming and recording functionality.
INDI::Spectrograph::getLowCutFrequency
double getLowCutFrequency()
getLowCutFrequency Get requested low cut frequency in Hz.
Definition: indispectrograph.h:107
INDI::Spectrograph::SpectrographSettingsNP
INumberVectorProperty SpectrographSettingsNP
Definition: indispectrograph.h:173
max
double max(void)
INDI::Spectrograph::ISNewSwitch
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: indispectrograph.cpp:127
INDI::SensorInterface::capability
uint32_t capability
Definition: indisensorinterface.h:418
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::SensorInterface::SENSOR_MAX_CAPABILITY
@ SENSOR_MAX_CAPABILITY
Definition: indisensorinterface.h:81
INDI::Spectrograph::ISSnoopDevice
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
Definition: indispectrograph.cpp:109
INDI::Spectrograph::SPECTROGRAPH_LOWFREQ
@ SPECTROGRAPH_LOWFREQ
Definition: indispectrograph.h:168
INDI::Spectrograph::SPECTROGRAPH_ANTENNA
@ SPECTROGRAPH_ANTENNA
Definition: indispectrograph.h:171
xml_ele_
Definition: lilxml.c:105
INDI::Spectrograph::ISGetProperties
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...
Definition: indispectrograph.cpp:85
INDI::Spectrograph::setMinMaxStep
void setMinMaxStep(const char *property, const char *element, double min, double max, double step, bool sendToClient=true)
setMinMaxStep for a number property element
Definition: indispectrograph.cpp:178
INDI::Spectrograph::ISNewText
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: indispectrograph.cpp:114
INDI::Spectrograph::setLowCutFrequency
void setLowCutFrequency(double freq)
setLowCutFrequency Set low cut frequency of Spectrograph device.
Definition: indispectrograph.cpp:138
indiwsserver.h
INDI::Spectrograph::getSpectrographSettings
INumberVectorProperty * getSpectrographSettings()
Return Vector Info Property.
Definition: indispectrograph.h:133
INDI::Spectrograph::SpectrographCapability
enum INDI::Spectrograph::@192 SpectrographCapability
INDI::Spectrograph::StartIntegration
virtual bool StartIntegration(double duration) override
Start integration from the Sensor device.
Definition: indispectrograph.cpp:171
INDI::Spectrograph::SPECTROGRAPH_INFO_INDEX
SPECTROGRAPH_INFO_INDEX
Definition: indispectrograph.h:165
indisensorinterface.h
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::Spectrograph::SPECTROGRAPH_BITSPERSAMPLE
@ SPECTROGRAPH_BITSPERSAMPLE
Definition: indispectrograph.h:170
INDI::Spectrograph::SPECTROGRAPH_HIGHFREQ
@ SPECTROGRAPH_HIGHFREQ
Definition: indispectrograph.h:169
INDI::Spectrograph::SPECTROGRAPH_MAX_CAPABILITY
@ SPECTROGRAPH_MAX_CAPABILITY
Definition: indispectrograph.h:67
INDI::Spectrograph::~Spectrograph
virtual ~Spectrograph()
Definition: indispectrograph.cpp:66
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::Spectrograph
Class to provide general functionality of Monodimensional Spectrograph.
Definition: indispectrograph.h:62
INDI::Spectrograph::addFITSKeywords
virtual void addFITSKeywords(fitsfile *fptr, uint8_t *buf, int len) override
Add FITS keywords to a fits file.
Definition: indispectrograph.cpp:200
INDI::Spectrograph::getHighCutFrequency
double getHighCutFrequency()
getHighCutFrequency Get requested high cut frequency in Hz.
Definition: indispectrograph.h:116
INDI::Spectrograph::updateProperties
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: indispectrograph.cpp:90
INDI::Spectrograph::initProperties
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: indispectrograph.cpp:70
INDI::Spectrograph::SpectrographSettingsN
INumber SpectrographSettingsN[8]
Definition: indispectrograph.h:174