Instrument Neutral Distributed Interface INDI 2.2.5
lx200_10micron.h
Go to the documentation of this file.
1/*
2 10micron INDI driver
3
4 Copyright (C) 2017-2026 Hans Lambermont
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#include <chrono>
26
28{
29 public:
30
37
46
65
67 {
68 ALP_MRA, // Mount Right Ascension
69 ALP_MDEC, // Mount Declination
70 ALP_MSIDE, // Mount Pier Side
71 ALP_SIDTIME, // Sidereal Time
72 ALP_PRA, // Plate solved Right Ascension
73 ALP_PDEC, // Plate solved Declination
75 };
76
78 {
79 MALPRO_MRA, // Mount Right Ascension
80 MALPRO_MDEC, // Mount Declination
81 MALPRO_MSIDE, // Mount Pier Side
82 MALPRO_SIDTIME, // Sidereal Time
84 };
85
87 {
88 MALP_PRA, // Plate solved Right Ascension
89 MALP_PDEC, // Plate solved Declination
91 };
92
101
108
109 // Same order and values as :GMF# and :SMFn# minus 1
117
118 // Why a mount setting is read, which decides what is logged and sent to clients:
119 // at connect, by the periodic refresh (changes made elsewhere), or right after writing it.
126
127 // Same element order as TELESCOPE_PIER_SIDE, plus NONE
135
138
139 bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
140 bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
141 bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
142
143 const char *getDefaultName() override;
144 bool Handshake() override;
145 bool initProperties() override;
146 void ISGetProperties(const char *dev) override;
147 bool updateProperties() override;
148 bool saveConfigItems(FILE *fp) override;
149 bool ReadScopeStatus() override;
150 bool Park() override;
151 bool UnPark() override;
152 bool SetTrackEnabled(bool enabled) override;
153 bool Flip(double ra, double dec) override;
155 bool setUnattendedFlipSetting(bool setting);
157 bool confirmUnattendedFlipSetting(int wanted);
159 bool setMeridianLimits(int slewLimit, int trackLimit);
162 bool setAllowedMeridianSide(int side);
163 bool getTargetPierSide();
165 bool setSlewSettleTime(double seconds);
166 bool SetTrackMode(uint8_t mode) override;
168 bool saveModel(const char *name);
169 bool SyncConfigBehaviour(bool cmcfg);
170 bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
171 bool SetTLEtoFollow(const char *tle);
172 bool SetTLEfromDatabase(int tleN);
173 bool TrackSat();
174 bool CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime);
175
176 int AddSyncPoint(double MRa, double MDec, double MSide, double PRa, double PDec, double SidTime);
177 int AddSyncPointHere(double PRa, double PDec);
178
179 // TODO move these things elsewhere
180 int monthToNumber(const char *monthName);
181 int setStandardProcedureWithoutRead(int fd, const char *data);
182 int setStandardProcedureAndExpectChar(int fd, const char *data, const char *expect);
183 int setStandardProcedureAndReturnResponse(int fd, const char *data, char *response, int max_response_length);
184
185 protected:
186 void getBasicData() override;
187
191
194
195 virtual int SetRefractionModelTemperature(double temperature);
198
199 virtual int SetRefractionModelPressure(double pressure);
202
205
208
211
216
219
222
225
228
229 // Wake on LAN
234
235 // Shutdown
237
238 // Meridian
244
245 private:
246 int fd = -1; // short notation for PortFD/sockfd
247 bool getMountInfo();
248 bool flip();
249 bool sendWakeOnLanPacket();
250 bool m_ShutdownPending { false };
251 void TimerHit() override;
252
253 // Meridian values are polled less often than Ginfo, see ReadScopeStatus
254 void updateMeridianValues(bool all);
255 std::chrono::steady_clock::time_point lastMeridianFastPoll;
256 std::chrono::steady_clock::time_point lastMeridianSlowPoll;
257 // Slewing including settling, as last seen by ReadScopeStatus
258 bool MountSlewing { false };
259 void updateSlewDependentValues();
260
261 int OldGstat = GSTAT_UNSET;
262 struct _Ginfo
263 {
264 float RA_JNOW = 0.0;
265 float DEC_JNOW = 0.0;
266 char SideOfPier = 'x';
267 float AZ = 0.0;
268 float ALT = 0.0;
269 float Jdate = 0.0;
270 int Gstat = -1;
271 int SlewStatus = -1;
272 // added :
273 double SiderealTime = -1;
274 } Ginfo;
275 int AlignmentState = ALIGN_IDLE;
276
277};
double temperature
virtual void TimerHit() override
Called when setTimer() time is up.
INDI::PropertyNumber MeridianLimitsNP
INumber RefractionModelTemperatureN[1]
INDI::PropertySwitch AllowedMeridianSideSP
void ISGetProperties(const char *dev) override
define the driver's properties to the client. Usually, only a minimum set of properties are defined t...
void getBasicData() override
bool Handshake() override
perform handshake with device to check communication
bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
INumberVectorProperty ModelCountNP
INumberVectorProperty NewAlignmentPointsNP
ISwitchVectorProperty AlignmentStateSP
ITextVectorProperty NewModelNameTP
bool CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime)
INumberVectorProperty NewAlpNP
INumber NewAlignmentPointsN[1]
bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
int setStandardProcedureAndExpectChar(int fd, const char *data, const char *expect)
ITextVectorProperty WoLMacTP
bool getSlewSettleTime(LX200_10MICRON_READ_CONTEXT context)
LX200_10MICRON_UNATTENDED_FLIP_SETTINGS
bool UnPark() override
Unpark the telescope if already parked.
void updateUnattendedFlipSetting(LX200_10MICRON_READ_CONTEXT context)
LX200_10MICRON_MINI_ALIGNMENT_POINT_RO
int monthToNumber(const char *monthName)
INumberVectorProperty RefractionModelPressureNP
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
bool getAllowedMeridianSide(LX200_10MICRON_READ_CONTEXT context)
int setStandardProcedureWithoutRead(int fd, const char *data)
bool setAllowedMeridianSide(int side)
INumberVectorProperty RefractionModelTemperatureNP
bool SetTLEtoFollow(const char *tle)
ISwitchVectorProperty WoLSendSP
bool getUnattendedFlipSetting()
INDI::PropertyNumber SlewSettleTimeNP
bool getTrackMode(LX200_10MICRON_READ_CONTEXT context)
IText NewModelNameT[1]
INDI::PropertyNumber TrackingEndNP
ITextVectorProperty ProductTP
bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
INDI::PropertySwitch TargetPierSideSP
const char * getDefaultName() override
virtual int SetRefractionModelPressure(double pressure)
INumber MiniNewAlpN[MALP_COUNT]
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
bool getMeridianLimits(LX200_10MICRON_READ_CONTEXT context)
bool setSlewSettleTime(double seconds)
INumberVectorProperty TLEfromDatabaseNP
INumber NewAlpN[ALP_COUNT]
int setStandardProcedureAndReturnResponse(int fd, const char *data, char *response, int max_response_length)
@ GSTAT_NOT_TRACKING_AND_NOT_MOVING
bool ReadScopeStatus() override
Read telescope status.
ISwitch UnattendedFlipS[UNATTENDED_FLIP_COUNT]
bool initProperties() override
Called to initialize basic properties required all the time.
INDI::PropertySwitch MountShutdownSP
INumber MiniNewAlpRON[MALPRO_COUNT]
INumber ModelCountN[1]
bool setMeridianLimits(int slewLimit, int trackLimit)
bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual int SetRefractionModelTemperature(double temperature)
ISwitch WoLSendS[1]
bool saveModel(const char *name)
bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
bool Park() override
Park the telescope to its home position.
bool SyncConfigBehaviour(bool cmcfg)
INumberVectorProperty MiniNewAlpRONP
ISwitchVectorProperty UnattendedFlipSP
bool Flip(double ra, double dec) override
Move and flip the scope to the supplied RA and DEC coordinates.
INumber TLEfromDatabaseN[1]
INumber AlignmentPointsN[1]
int AddSyncPoint(double MRa, double MDec, double MSide, double PRa, double PDec, double SidTime)
INumberVectorProperty MiniNewAlpNP
ISwitch AlignmentStateS[ALIGN_COUNT]
bool confirmUnattendedFlipSetting(int wanted)
INumberVectorProperty AlignmentPointsNP
bool SetTLEfromDatabase(int tleN)
int AddSyncPointHere(double PRa, double PDec)
bool setUnattendedFlipSetting(bool setting)
INumber RefractionModelPressureN[1]
double ra
double dec
ISState
Switch state.
Definition indiapi.h:148
struct _ISwitchVectorProperty ISwitchVectorProperty
struct _ITextVectorProperty ITextVectorProperty
struct _INumberVectorProperty INumberVectorProperty
*brief user defined string literal for JSON values *sa std::size_t n
int fd
One number descriptor.
One switch descriptor.
One text descriptor.