Instrument Neutral Distributed Interface INDI 2.2.5
spectracyber.h
Go to the documentation of this file.
1/*
2 Kuwait National Radio Observatory
3 INDI Driver for SpectraCyber Hydrogen Line Spectrometer
4 Communication: RS232 <---> USB
5
6 Copyright (C) 2009 Jasem Mutlaq ([email protected])
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
22 Change Log:
23 2009-09-17: Creating spectrometer class (JM)
24
25*/
26
27#pragma once
28
29#include <defaultdevice.h>
30
31#include <string>
32
33#define MAXBLEN 64
34
36{
37 public:
39 {
40 IF_GAIN, // IF Gain
41 CONT_GAIN, // Continuum Gain
42 SPEC_GAIN, // Spectral Gain
43 CONT_TIME, // Continuum Channel Integration Constant
44 SPEC_TIME, // Spectral Channel Integration Constant
45 NOISE_SOURCE, // Noise Source Control
46 CONT_OFFSET, // Continuum DC Offset
47 SPEC_OFFSET, // Spectral DC Offset
48 RECV_FREQ, // Receive Frequency
49 READ_CHANNEL, // Read Channel Value
50 BANDWIDTH, // Bandwidth
51 RESET // Reset All
52 };
53
68
70
71 // Standard INDI interface functions
72 virtual void ISGetProperties(const char *dev) override;
73 virtual bool ISNewNumber(const char *dev, const char *name, double values[], 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 ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
76 virtual bool ISSnoopDevice(XMLEle *root) override;
77
78 protected:
79 virtual const char *getDefaultName() override;
80
81 virtual bool Connect() override;
82 virtual bool Disconnect() override;
83 virtual void TimerHit() override;
84
85 //void reset_all_properties(bool reset_to_idle=false);
86 bool update_freq(double nFreq);
87
88 private:
93 INDI::PropertyBlob DataStreamBP {INDI::Property()};
94 IText *telescopeID;
95
96 // Snooping On
97 INumber EquatorialCoordsRN[2];
98 INumberVectorProperty EquatorialCoordsRNP;
99
100 // Functions
101 virtual bool initProperties() override;
102 bool init_spectrometer();
103 void abort_scan();
104 bool read_channel();
105 bool dispatch_command(SpectrometerCommand command);
106 int get_on_switch(ISwitchVectorProperty *sp);
107 bool reset();
108
109 // Variables
110 std::string type_name;
111 std::string default_port;
112
113 int fd;
114 char bLine[MAXBLEN];
115 char command[5];
116 double start_freq, target_freq, sample_rate, JD, chanValue;
117};
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Provides generic container for INDI properties.
bool update_freq(double nFreq)
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual void TimerHit() override
Callback function to be called once SetTimer duration elapses.
virtual bool Disconnect() override
Disconnect from device.
virtual bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual 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 ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
virtual const char * getDefaultName() override
ISState
Switch state.
Definition indiapi.h:148
#define MAXBLEN
One number descriptor.
One text descriptor.
Number vector property descriptor.
Definition indiapi.h:317
Switch vector property descriptor.
Definition indiapi.h:365