Instrument Neutral Distributed Interface INDI  2.0.2
lx200ap_gtocp2.h
Go to the documentation of this file.
1 /*
2  Astro-Physics INDI driver
3 
4  Tailored for GTOCP2
5 
6  Copyright (C) 2018 Jasem Mutlaq
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 
23 #pragma once
24 
25 #include "lx200generic.h"
26 
28 {
29  public:
32 
34 
35  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
36  virtual void ISGetProperties(const char *dev) override;
37 
38  protected:
39  virtual const char *getDefaultName() override;
40  virtual bool initProperties() override;
41  virtual bool updateProperties() override;
42 
43  virtual bool ReadScopeStatus() override;
44  virtual bool Handshake() override;
45  virtual bool Disconnect() override;
46 
47  // Parking
48  virtual bool SetCurrentPark() override;
49  virtual bool SetDefaultPark() override;
50  virtual bool Park() override;
51  virtual bool UnPark() override;
52 
53  virtual bool Sync(double ra, double dec) override;
54  virtual bool Goto(double, double) override;
55  virtual bool updateTime(ln_date *utc, double utc_offset) override;
56  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
57  virtual bool SetSlewRate(int index) override;
58 
59  virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override;
60 
61  virtual bool getUTFOffset(double *offset) override;
62 
63  // Tracking
64  virtual bool SetTrackMode(uint8_t mode) override;
65  virtual bool SetTrackEnabled(bool enabled) override;
66  virtual bool SetTrackRate(double raRate, double deRate) override;
67 
68  // NSWE Motion Commands
69  virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
70  virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
71 
72  virtual bool saveConfigItems(FILE *fp) override;
73 
74  virtual void debugTriggered(bool enable) override;
75 
76  void handleGTOCP2MotionBug();
77 
80 
83 
86 
89 
93 
96 
97  IText VersionT[1] {};
99 
100  private:
101  bool initMount();
102 
103  // Side of pier
104  void syncSideOfPier();
105 
106  bool timeUpdated = false, locationUpdated = false;
107  ControllerVersion firmwareVersion = MCV_UNKNOWN;
108 
109  double currentAlt = 0, currentAz = 0;
110  double lastRA = 0, lastDE = 0;
111  double lastAZ = 0, lastAL = 0;
112 
113  bool motionCommanded = true;
114  bool mountInitialized = false;
115 };
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 SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool Handshake() override
perform handshake with device to check communication
virtual const char * getDefaultName() override
ITextVectorProperty VersionTP
ISwitchVectorProperty APSlewSpeedSP
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
ISwitchVectorProperty APGuideSpeedSP
INumberVectorProperty HourangleCoordsNP
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool Disconnect() override
Disconnect from device.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
ISwitchVectorProperty SyncCMRSP
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
INumberVectorProperty HorizontalCoordsNP
virtual bool getUTFOffset(double *offset) override
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual bool Park() override
Park the telescope to its home position.
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
ISwitchVectorProperty SwapSP
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
INDI_DIR_WE
Definition: indibasetypes.h:55
INDI_DIR_NS
Definition: indibasetypes.h:48
One number descriptor.
One switch descriptor.
One text descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367
Text vector property descriptor.
Definition: indiapi.h:246