Instrument Neutral Distributed Interface INDI  2.0.2
STAR2000.h
Go to the documentation of this file.
1 /*******************************************************************************
2  created 2014 G. Schmidt
3 
4  derived from gpusb code from Jasem Mutlaq
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the Free
8  Software Foundation; either version 2 of the License, or (at your option)
9  any later version.
10 
11  This program is distributed in the hope that it will be useful, but WITHOUT
12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 
21  The full GNU General Public License is included in this distribution in the
22  file called LICENSE.
23 *******************************************************************************/
24 
25 #pragma once
26 
27 #include "defaultdevice.h"
28 #include "indiguiderinterface.h"
29 
30 #include <ctime>
31 
33 {
34  public:
35  STAR2000() = default;
36 
37  virtual bool initProperties() override;
38  virtual bool updateProperties() override;
39  virtual void ISGetProperties(const char *dev) override;
40  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
41  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
42  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
43  virtual bool ISSnoopDevice(XMLEle *root) override;
44 
45  protected:
46  virtual bool saveConfigItems(FILE *fp) override;
47 
48  // Generic indi device entries
49  bool Connect() override;
50  bool Connect(char *);
51  bool Disconnect() override;
52  const char *getDefaultName() override;
53 
54  void TimerHit() override;
55 
56  virtual IPState GuideNorth(uint32_t ms) override;
57  virtual IPState GuideSouth(uint32_t ms) override;
58  virtual IPState GuideEast(uint32_t ms) override;
59  virtual IPState GuideWest(uint32_t ms) override;
60 
61  private:
62  float CalcWEPulseTimeLeft();
63  float CalcNSPulseTimeLeft();
64 
65  public:
66  // STAR2000 box RS232 port
68  IText PortT[1] {};
69 
70  private:
71  bool InWEPulse { false };
72  float WEPulseRequest { 0 };
73  struct timeval WEPulseStart
74  {
75  0, 0
76  };
77  int WEtimerID { 0 };
78 
79  bool InNSPulse { false };
80  float NSPulseRequest { 0 };
81  struct timeval NSPulseStart
82  {
83  0, 0
84  };
85  int NStimerID { 0 };
86 
87  int WEDir { 0 };
88  int NSDir { 0 };
89 };
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
Definition: STAR2000.cpp:359
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: STAR2000.cpp:149
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
Definition: STAR2000.cpp:387
void TimerHit() override
Callback function to be called once SetTimer duration elapses.
Definition: STAR2000.cpp:210
const char * getDefaultName() override
Definition: STAR2000.cpp:38
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: STAR2000.cpp:168
virtual bool initProperties() override
Initilize properties initial state and value. The child class must implement this function.
Definition: STAR2000.cpp:88
bool Connect() override
Connect to the device. INDI::DefaultDevice implementation connects to appropriate connection interfac...
Definition: STAR2000.cpp:43
IText PortT[1]
Definition: STAR2000.h:68
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: STAR2000.cpp:123
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: STAR2000.cpp:163
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: STAR2000.cpp:130
ITextVectorProperty PortTP
Definition: STAR2000.h:67
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
Definition: STAR2000.cpp:331
virtual bool updateProperties() override
updateProperties is called whenever there is a change in the CONNECTION status of the driver....
Definition: STAR2000.cpp:105
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: STAR2000.cpp:144
STAR2000()=default
bool Disconnect() override
Disconnect from device.
Definition: STAR2000.cpp:78
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
Definition: STAR2000.cpp:303
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
One text descriptor.
Text vector property descriptor.
Definition: indiapi.h:246