Instrument Neutral Distributed Interface INDI  2.0.2
temmadriver.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2016 Gerry Rozema. All rights reserved.
3 
4  Copyright(c) 2017-2020 Jasem Mutlaq. All rights reserved.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 
20 *******************************************************************************/
21 
22 #pragma once
23 
24 #include "indiguiderinterface.h"
25 #include "inditelescope.h"
27 
29 /*,public INDI::AlignmentSubsystem::AlignmentSubsystemForDrivers*/
30 {
31  public:
32  TemmaMount();
33  virtual ~TemmaMount() override = default;
34 
35  virtual bool initProperties() override;
36  virtual bool updateProperties() override;
37  virtual const char *getDefaultName() override;
38 
39  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
40  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
41  virtual bool ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[],
42  char *formats[], char *names[], int n) override;
43  virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
44 
45 
46  protected:
47  virtual bool Handshake() override;
48  virtual bool ReadScopeStatus() override;
49 
50  virtual bool Goto(double ra, double dec) override;
51  virtual bool Sync(double ra, double dec) override;
52  virtual bool Park() override;
53  virtual bool UnPark() override;
54  virtual bool Abort() override;
55  virtual bool SetTrackMode(uint8_t mode) override;
56  virtual bool SetTrackEnabled(bool enabled) override;
57 
58  virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
59  virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
60  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
61 
62  virtual bool SetCurrentPark() override;
63  virtual bool SetDefaultPark() override;
64 
65  // methods added for guider interface
66  virtual IPState GuideNorth(uint32_t ms) override;
67  virtual IPState GuideSouth(uint32_t ms) override;
68  virtual IPState GuideEast(uint32_t ms) override;
69  virtual IPState GuideWest(uint32_t ms) override;
70 
71  // Initial implementation doesn't need this one
72  //virtual void GuideComplete(INDI_EQ_AXIS axis);
73 
74  private:
75  void mountSim();
76 
77  bool getVersion();
78  bool getCoords();
79 
80  // Send command to mount, and optionally read a response. CR LF is appended to the command.
81  // Pass nullptr to response to skip reading the respone.
82  // Response size must be 64 bytes (TEMMA_BUFFER). CR LF is removed from response.
83  bool sendCommand(const char *cmd, char *response = nullptr);
84 
85  bool motorsEnabled();
86  bool setMotorsEnabled(bool enable);
87 
88  // LST & Latitude functions
89  bool setLST();
90  bool getLST(double &lst);
91  bool setLatitude(double lat);
92  bool getLatitude(double &lat);
93 
94  //INDI::IEquatorialCoordinates TelescopeToSky(double ra, double dec);
95  //INDI::IEquatorialCoordinates SkyToTelescope(double ra, double dec);
96 
97  //bool TemmaConnect(const char *port);
98 
99  double currentRA = 0, currentDEC = 0, targetRA = 0, targetDEC = 0, alignedRA = 0, alignedDEC = 0;
100 
101  bool MotorStatus { false };
102  bool TemmaInitialized { false };
103  double Longitude { 0 };
104  double Latitude { 0 };
105  int SlewRate { 1 };
106  bool SlewActive { false };
107  uint8_t Slewbits { 0 };
108 };
virtual ~TemmaMount() override=default
virtual bool ReadScopeStatus() override
Read telescope status.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
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.
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual const char * getDefaultName() override
Definition: temmadriver.cpp:65
virtual bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual bool Goto(double ra, double dec) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition: temmadriver.cpp:70
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
virtual bool Park() override
Park the telescope to its home position.
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
INDI_DIR_WE
Definition: indibasetypes.h:55
INDI_DIR_NS
Definition: indibasetypes.h:48
__u8 cmd[4]
Definition: pwc-ioctl.h:2