Instrument Neutral Distributed Interface INDI 2.2.5
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//#define DEBUG_NYX
28
29
31{
32 public:
34 virtual bool updateProperties() override;
35 virtual bool initProperties() override;
36 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
37 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
38#ifdef DEBUG_NYX
39 virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
40
41 INDI::PropertyText DebugCommandTP {1};
42#endif
43
44 protected:
45 virtual bool ReadScopeStatus() override;
46 virtual const char *getDefaultName() override;
47 virtual bool Park() override;
48 virtual bool UnPark() override;
49 virtual bool updateLocation(double latitude, double longitude, double elevation) override;
50 virtual bool setUTCOffset(double offset) override;
51 virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
52 virtual bool SetTrackEnabled(bool enabled) override;
53 virtual bool SetTrackMode(uint8_t mode) override;
54 virtual bool SetSlewRate(int index) override;
55
56 // Homing
57 virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override;
58
59 private:
60 static constexpr const uint8_t SLEW_MODES {10};
61 static constexpr const uint8_t DRIVER_LEN {64};
62 static const char DRIVER_STOP_CHAR { 0x23 };
63 static constexpr const uint8_t DRIVER_TIMEOUT {3};
64
65 enum RefractionState
66 {
67 REFRACT_ON,
68 REFRACT_OFF
69 };
70
71 enum SafetyLimits
72 {
73 SET_SAFETY_LIMIT,
74 CLEAR_SAFETY_LIMIT
75 };
76
77 enum NYXTelescopeTrackMode
78 {
79 TRACK_SIDEREAL,
80 TRACK_SOLAR,
81 TRACK_LUNAR,
82 TRACK_KING
83 };
84
85 INDI::PropertySwitch MountTypeSP {2};
86 enum MountType
87 {
88 AltAz,
89 Equatorial
90 };
91
92 enum ElevationNumber
93 {
94 OVERHEAD,
95 HORIZON
96 };
97
98 INDI::PropertySwitch GuideRateSP {3};
99 // INDI::PropertySwitch HomeSP {1};
100 // INDI::PropertySwitch ResetHomeSP {1};
101 INDI::PropertyText Report {1};
102 INDI::PropertySwitch VerboseReportSP {2};
103 INDI::PropertyText IsTracking {1};
104 INDI::PropertyText IsSlewCompleted {1};
105 INDI::PropertyText IsParked {1};
106 INDI::PropertyText IsParkginInProgress {1};
107 INDI::PropertyText IsAtHomePosition {1};
108 INDI::PropertyText MountAltAz {1};
109 INDI::PropertyText MountEquatorial {1};
110 INDI::PropertyText PierNone {1};
111 INDI::PropertyText PierEast {1};
112 INDI::PropertyText PierWest {1};
113 INDI::PropertyText DoesRefractionComp {1};
114 INDI::PropertyText WaitingAtHome {1};
115 INDI::PropertyText IsHomePaused {1};
116 INDI::PropertyText ParkFailed {1};
117 INDI::PropertyText SlewingHome {1};
118 INDI::PropertySwitch FlipSP {1};
119 INDI::PropertySwitch RebootSP {1};
120 INDI::PropertySwitch RefractSP {2};
121 INDI::PropertyNumber ElevationLimitNP {2};
122 INDI::PropertyNumber MeridianLimitNP {1};
123 INDI::PropertySwitch SafetyLimitSP {2};
124
125
126 bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
127 void hexDump(char * buf, const char * data, int size);
128 std::vector<std::string> split(const std::string &input, const std::string &regex);
129 bool goToPark();
130 bool goToUnPark();
131 bool setMountType(int type);
132 bool setGuideRate(int rate);
133 bool verboseReport = false;
134 void SetPropertyText(INDI::PropertyText propertyTxt, IPState state);
135};
int SetSlewRate(void)
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 SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
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.
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Execute a homing action.
virtual bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
uint16_t type
Definition pwc-ioctl.h:0
uint8_t cmd[4]
Definition pwc-ioctl.h:2