Instrument Neutral Distributed Interface INDI 2.2.5
indireceiver.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#include <fitsio.h>
26
27#include <memory>
28#include <cstring>
29#include <chrono>
30#include <stdint.h>
31#include <mutex>
32#include <thread>
33
34//JM 2019-01-17: Disabled until further notice
35//#define WITH_EXPOSURE_LOOPING
36
37
54namespace INDI
55{
56class StreamManager;
57
58class Receiver : public virtual SensorInterface
59{
60 public:
61 enum
62 {
65
66 Receiver();
67 virtual ~Receiver();
68
69 virtual bool initProperties() override;
70 virtual bool updateProperties() override;
71 virtual void ISGetProperties(const char *dev) override;
72 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
73 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
74 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
75 virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[],
76 char *names[], int n) override;
77 virtual bool ISSnoopDevice(XMLEle *root) override;
78
79 virtual bool StartIntegration(double duration) override;
80 virtual void addFITSKeywords(fitsfile *fptr, uint8_t* buf, int len) override;
81
86 void setSampleRate(double sr);
87
92 void setBandwidth(double bandwidth);
93
98 void setGain(double gain);
99
104 void setFrequency(double freq);
105
110 void setBPS(int BPS);
111
116 inline double getBandwidth()
117 {
118 return Bandwidth;
119 }
120
125 inline double getGain()
126 {
127 return Gain;
128 }
129
134 inline double getFrequency()
135 {
136 return Frequency;
137 }
138
143 inline double getSampleRate()
144 {
145 return SampleRate;
146 }
147
155
159 uint32_t GetReceiverCapability() const
160 {
161 return capability;
162 }
163
168 void SetReceiverCapability(uint32_t cap);
169
180 virtual void setMinMaxStep(const char *property, const char *element, double min, double max, double step,
181 bool sendToClient = true) override;
182
194
195 private:
196 int BitsPerSample;
197 double Frequency;
198 double SampleRate;
199 double Bandwidth;
200 double Gain;
201
202};
203}
Class to provide general functionality of Monodimensional Receiver.
void setGain(double gain)
setGain Set gain of Receiver device.
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
void setBandwidth(double bandwidth)
setBandwidth Set bandwidth of Receiver device.
INumber ReceiverSettingsN[7]
void setBPS(int BPS)
setBPS Set the bits per sample.
virtual bool initProperties() override
Initialize properties initial state and value. The child class must implement this function.
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
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.
INumberVectorProperty * getReceiverSettings()
Return Vector Info Property.
virtual bool ISSnoopDevice(XMLEle *root) override
Process a snoop event from INDI server. This function is called when a snooped property is updated in...
void setFrequency(double freq)
setFrequency Set the frequency observed.
INumberVectorProperty ReceiverSettingsNP
double getSampleRate()
getSampleRate Get requested sample rate for the sensor in Hz.
enum INDI::Receiver::@464 ReceiverCapability
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual void addFITSKeywords(fitsfile *fptr, uint8_t *buf, int len) override
Add FITS keywords to a fits file.
@ SPECTROGRAPH_MAX_CAPABILITY
double getFrequency()
getFrequency Get requested integration frequency for the sensor in Hz.
double getBandwidth()
getBandwidth Get requested integration bandwidth for the sensor in Hz.
void SetReceiverCapability(uint32_t cap)
SetReceiverCapability Set the Receiver capabilities. Al fields must be initialized.
virtual ~Receiver()
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
void setSampleRate(double sr)
setSampleRate Set depth of Receiver device.
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...
virtual bool StartIntegration(double duration) override
Start integration from the Sensor device.
double getGain()
getGain Get requested integration gain for the sensor.
uint32_t GetReceiverCapability() const
GetReceiverCapability returns the Sensor capabilities.
The SensorDevice class provides functionality of a Sensor Device within a Sensor.
Class to provide video streaming and recording functionality.
double max(void)
#define min(a, b)
ISState
Switch state.
Definition indiapi.h:148
Namespace to encapsulate INDI client, drivers, and mediator classes.
One number descriptor.
Number vector property descriptor.
Definition indiapi.h:317