Instrument Neutral Distributed Interface INDI  2.0.2
lx200_pegasus_nyx101.h
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright(c) 2021 Chrysikos Efstathios. All rights reserved.
3 
4  Pegasus NYX
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 #pragma once
25 
26 #include "lx200generic.h"
27 
28 class LX200NYX101 : public LX200Generic
29 {
30 public:
31  LX200NYX101();
32  virtual bool updateProperties() override;
33  virtual bool initProperties() override;
34  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
35  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
36 
37 protected:
38  virtual bool ReadScopeStatus() override;
39  virtual const char *getDefaultName() override;
40  virtual bool Park() override;
41  virtual bool UnPark() override;
42  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
43  virtual bool setUTCOffset(double offset) override;
44  virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
45  virtual bool SetTrackEnabled(bool enabled) override;
46  virtual bool SetSlewRate(int index) override;
47 
48 private:
49  static constexpr const uint8_t SLEW_MODES {10};
50  static constexpr const uint8_t DRIVER_LEN {64};
51  static const char DRIVER_STOP_CHAR { 0x23 };
52  static constexpr const uint8_t DRIVER_TIMEOUT {3};
53 
54  INDI::PropertySwitch MountTypeSP {2};
55  enum MountType
56  {
57  AltAz,
58  Equatorial
59  };
60  INDI::PropertySwitch GuideRateSP {3};
61  INDI::PropertySwitch HomeSP {1};
62  INDI::PropertySwitch ResetHomeSP {1};
63  INDI::PropertyText Report {1};
64  INDI::PropertySwitch VerboseReportSP {2};
65  INDI::PropertyText IsTracking {1};
66  INDI::PropertyText IsSlewCompleted {1};
67  INDI::PropertyText IsParked {1};
68  INDI::PropertyText IsParkginInProgress {1};
69  INDI::PropertyText IsAtHomePosition {1};
70  INDI::PropertyText TrackSidereal {1};
71  INDI::PropertyText TrackLunar {1};
72  INDI::PropertyText TrackSolar {1};
73  INDI::PropertyText MountAltAz {1};
74  INDI::PropertyText MountEquatorial {1};
75  INDI::PropertyText PierNone {1};
76  INDI::PropertyText PierEast {1};
77  INDI::PropertyText PierWest {1};
78  INDI::PropertyText DoesRefractionComp {1};
79  INDI::PropertyText WaitingAtHome {1};
80  INDI::PropertyText IsHomePaused {1};
81  INDI::PropertyText ParkFailed {1};
82  INDI::PropertyText SlewingHome {1};
83 
84 
85  bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
86  void hexDump(char * buf, const char * data, int size);
87  std::vector<std::string> split(const std::string &input, const std::string &regex);
88  bool goToPark();
89  bool goToUnPark();
90  bool setMountType(int type);
91  bool setGuideRate(int rate);
92  bool verboseReport = false;
93  void SetPropertyText(INDI::PropertyText propertyTxt, IPState state);
94 };
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool setUTCOffset(double offset) override
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual bool Park() override
Park the telescope to its home position.
virtual const char * getDefaultName() override
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
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.
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
__le16 type
Definition: pwc-ioctl.h:0
__u8 cmd[4]
Definition: pwc-ioctl.h:2