Instrument Neutral Distributed Interface INDI  2.0.2
ioptronHC8406.h
Go to the documentation of this file.
1 /*
2  ioptronHC8406 INDI driver
3  Copyright (C) 2017 Nacho Mas. Base on GotoNova driver by Jasem Mutlaq
4 
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #pragma once
22 
23 #include "lx200generic.h"
24 
25 
26 
28 {
29  public:
30  ioptronHC8406();
31 
32  virtual bool updateProperties() override;
33  virtual bool initProperties() override;
34 
35  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
36 
37  protected:
38  virtual const char *getDefaultName() override;
39 
40  virtual void getBasicData() override;
41  virtual bool checkConnection() override;
42  virtual bool isSlewComplete() override;
43 
44  virtual bool ReadScopeStatus() override;
45 
46  virtual bool SetTrackEnabled(bool enabled) override;
47  virtual bool SetTrackMode(uint8_t mode) override;
48  virtual bool Goto(double, double) override;
49  virtual bool Sync(double ra, double dec) override;
50  virtual bool updateTime(ln_date *utc, double utc_offset) override;
51  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
52 
53  virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override;
54 
55  virtual bool saveConfigItems(FILE *fp) override;
56 
57  virtual bool Park() override;
58  virtual bool UnPark() override;
59  virtual bool sendScopeTime() override;
60  private:
61  int setioptronHC8406StandardProcedure(int fd, const char *data);
62  int ioptronHC8406SyncCMR(char *matchedObject);
63 
64  // Mount Initialization.
65  void ioptronHC8406Init();
66 
67  // Settings
68  int setioptronHC8406Latitude(double Lat);
69  int setioptronHC8406Longitude(double Long);
70  int setioptronHC8406UTCOffset(double hours);
71  int getCommandString(int fd, char *data, const char *cmd);
72  int setCalenderDate(int fd, int dd, int mm, int yy);
73 
74  // Motion
75  int slewioptronHC8406();
76 
77  // Track Mode
78  int setioptronHC8406TrackMode(int mode);
79 
80  //Set move rates
81  int setMoveRate(int rate, int move_type);
82 
83  // Guide Rate
84  int setioptronHC8406GuideRate(int rate);
85 
86  // Center Rate
87  int setioptronHC8406CenterRate(int rate);
88 
89  // Slew Rate
90  int setioptronHC8406SlewRate(int rate);
91 
92  // Pier Side
93  void syncSideOfPier();
94 
95  // Simulation
96  void mountSim();
97 
98  // Sync type
99  ISwitch SyncCMRS[2];
100  ISwitchVectorProperty SyncCMRSP;
101  enum { USE_REGULAR_SYNC, USE_CMR_SYNC };
102 
103  //Cursor move speed
104  ISwitch CursorMoveSpeedS[3];
105  ISwitchVectorProperty CursorMoveSpeedSP;
106  enum { USE_GUIDE_SPEED, USE_CENTERING_SPEED, USE_SLEW_SPEED };
107  int setioptronHC8406CursorMoveSpeed(int type);
108  /* Guide Rate */
109  ISwitch GuideRateS[3];
110  ISwitchVectorProperty GuideRateSP;
111 
112  /* Center Rate */
113  ISwitch CenterRateS[4];
114  ISwitchVectorProperty CenterRateSP;
115 };
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool sendScopeTime() override
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual const char * getDefaultName() override
virtual bool Park() override
Park the telescope to its home position.
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool checkConnection() override
virtual int SendPulseCmd(int8_t direction, uint32_t duration_msec) override
virtual bool Goto(double, double) override
Move the scope to the supplied RA and DEC coordinates.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool Sync(double ra, double dec) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool isSlewComplete() override
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void getBasicData() override
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
virtual bool ReadScopeStatus() override
Read telescope status.
double ra
double dec
ISState
Switch state.
Definition: indiapi.h:150
int fd
Definition: intelliscope.c:43
__le16 type
Definition: pwc-ioctl.h:0
__u8 cmd[4]
Definition: pwc-ioctl.h:2
One switch descriptor.
Switch vector property descriptor.
Definition: indiapi.h:367