Instrument Neutral Distributed Interface INDI  1.9.5
lx200_10micron.h
Go to the documentation of this file.
1 /*
2  10micron INDI driver
3 
4  Copyright (C) 2017 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 
26 {
27  public:
28 
30  {
34  };
35 
37  {
43  };
44 
46  {
47  GSTAT_UNSET = -999,
62  };
63 
65  {
66  ALP_MRA, // Mount Right Ascension
67  ALP_MDEC, // Mount Declination
68  ALP_MSIDE, // Mount Pier Side
69  ALP_SIDTIME, // Sidereal Time
70  ALP_PRA, // Plate solved Right Ascension
71  ALP_PDEC, // Plate solved Declination
73  };
74 
76  {
77  MALPRO_MRA, // Mount Right Ascension
78  MALPRO_MDEC, // Mount Declination
79  MALPRO_MSIDE, // Mount Pier Side
80  MALPRO_SIDTIME, // Sidereal Time
82  };
83 
85  {
86  MALP_PRA, // Plate solved Right Ascension
87  MALP_PDEC, // Plate solved Declination
89  };
90 
92  {
98  };
99 
100  LX200_10MICRON();
102 
103  bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
104  bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
105  bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override;
106 
107  const char *getDefaultName() override;
108  bool Handshake() override;
109  bool initProperties() override;
110  bool updateProperties() override;
111  bool saveConfigItems(FILE *fp) override;
112  bool ReadScopeStatus() override;
113  bool Park() override;
114  bool UnPark() override;
115  bool flip();
117  bool setUnattendedFlipSetting(bool setting);
118  bool SyncConfigBehaviour(bool cmcfg);
119  bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
120  bool SetTLEtoFollow(const char *tle);
121  bool SetTLEfromDatabase(int tleN);
122  bool TrackSat();
123  bool CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime);
124 
125  int AddSyncPoint(double MRa, double MDec, double MSide, double PRa, double PDec, double SidTime);
126  int AddSyncPointHere(double PRa, double PDec);
127 
128  // TODO move these things elsewhere
129  int monthToNumber(const char *monthName);
130  int setStandardProcedureWithoutRead(int fd, const char *data);
131  int setStandardProcedureAndExpect(int fd, const char *data, const char *expect);
132  int setStandardProcedureAndReturnResponse(int fd, const char *data, char *response, int max_response_length);
133 
134  protected:
135  void getBasicData() override;
136 
137  int UnattendedFlip = -1;
140 
143 
144  virtual int SetRefractionModelTemperature(double temperature);
147 
148  virtual int SetRefractionModelPressure(double pressure);
151 
154 
157 
160 
165 
168 
171 
174 
177 
178 
179  private:
180  int fd = -1; // short notation for PortFD/sockfd
181  bool getMountInfo();
182 
183  int OldGstat = GSTAT_UNSET;
184  struct _Ginfo
185  {
186  float RA_JNOW = 0.0;
187  float DEC_JNOW = 0.0;
188  char SideOfPier = 'x';
189  float AZ = 0.0;
190  float ALT = 0.0;
191  float Jdate = 0.0;
192  int Gstat = -1;
193  int SlewStatus = -1;
194  // added :
195  double SiderealTime = -1;
196  } Ginfo;
197  int AlignmentState = ALIGN_IDLE;
198 
199 };
LX200_10MICRON::ProductTP
ITextVectorProperty ProductTP
Definition: lx200_10micron.h:142
LX200Generic
Definition: lx200generic.h:25
LX200_10MICRON::GSTAT_TRACKING
@ GSTAT_TRACKING
Definition: lx200_10micron.h:48
LX200_10MICRON::MALPRO_MDEC
@ MALPRO_MDEC
Definition: lx200_10micron.h:78
LX200_10MICRON::CalculateSatTrajectory
bool CalculateSatTrajectory(std::string start_pass_isodatetime, std::string end_pass_isodatetime)
Definition: lx200_10micron.cpp:770
LX200_10MICRON::GSTAT_UNPARKING
@ GSTAT_UNPARKING
Definition: lx200_10micron.h:51
LX200_10MICRON::LX200_10MICRON_MINI_ALIGNMENT_POINT_RO
LX200_10MICRON_MINI_ALIGNMENT_POINT_RO
Definition: lx200_10micron.h:75
LX200_10MICRON::NewAlpN
INumber NewAlpN[ALP_COUNT]
Definition: lx200_10micron.h:166
LX200_10MICRON::GSTAT_NEED_USEROK
@ GSTAT_NEED_USEROK
Definition: lx200_10micron.h:59
LX200_10MICRON::RefractionModelTemperatureNP
INumberVectorProperty RefractionModelTemperatureNP
Definition: lx200_10micron.h:146
LX200_10MICRON::PRODUCT_COUNT
@ PRODUCT_COUNT
Definition: lx200_10micron.h:42
LX200_10MICRON::monthToNumber
int monthToNumber(const char *monthName)
Definition: lx200_10micron.cpp:1315
LX200_10MICRON::UNATTENDED_FLIP_ENABLED
@ UNATTENDED_FLIP_ENABLED
Definition: lx200_10micron.h:32
LX200_10MICRON::ALIGN_START
@ ALIGN_START
Definition: lx200_10micron.h:94
ISwitch
One switch descriptor.
LX200_10MICRON::AlignmentStateSP
ISwitchVectorProperty AlignmentStateSP
Definition: lx200_10micron.h:159
LX200_10MICRON::saveConfigItems
bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
Definition: lx200_10micron.cpp:189
LX200_10MICRON::LX200_10MICRON_PRODUCT_INFO
LX200_10MICRON_PRODUCT_INFO
Definition: lx200_10micron.h:36
LX200_10MICRON::GSTAT_FOLLOWING_SATELLITE
@ GSTAT_FOLLOWING_SATELLITE
Definition: lx200_10micron.h:58
LX200_10MICRON::AlignmentPointsNP
INumberVectorProperty AlignmentPointsNP
Definition: lx200_10micron.h:156
LX200_10MICRON::UNATTENDED_FLIP_COUNT
@ UNATTENDED_FLIP_COUNT
Definition: lx200_10micron.h:33
LX200_10MICRON::ALP_SIDTIME
@ ALP_SIDTIME
Definition: lx200_10micron.h:69
INumber
One number descriptor.
LX200_10MICRON::PRODUCT_FIRMWARE_VERSION
@ PRODUCT_FIRMWARE_VERSION
Definition: lx200_10micron.h:40
LX200_10MICRON::Handshake
bool Handshake() override
perform handshake with device to check communication
Definition: lx200_10micron.cpp:91
LX200_10MICRON::ALIGN_COUNT
@ ALIGN_COUNT
Definition: lx200_10micron.h:97
LX200_10MICRON::setStandardProcedureAndReturnResponse
int setStandardProcedureAndReturnResponse(int fd, const char *data, char *response, int max_response_length)
Definition: lx200_10micron.cpp:1380
LX200_10MICRON::GSTAT_MOTORS_TOO_COLD
@ GSTAT_MOTORS_TOO_COLD
Definition: lx200_10micron.h:56
LX200_10MICRON::AlignmentPointsN
INumber AlignmentPointsN[1]
Definition: lx200_10micron.h:155
LX200_10MICRON::NewModelNameT
IText NewModelNameT[1]
Definition: lx200_10micron.h:172
LX200_10MICRON::MALP_COUNT
@ MALP_COUNT
Definition: lx200_10micron.h:88
LX200_10MICRON::LX200_10MICRON_10MICRON_GSTAT
LX200_10MICRON_10MICRON_GSTAT
Definition: lx200_10micron.h:45
LX200_10MICRON::ALP_MSIDE
@ ALP_MSIDE
Definition: lx200_10micron.h:68
LX200_10MICRON::GSTAT_TRACKING_OUTSIDE_LIMITS
@ GSTAT_TRACKING_OUTSIDE_LIMITS
Definition: lx200_10micron.h:57
LX200_10MICRON::MALPRO_COUNT
@ MALPRO_COUNT
Definition: lx200_10micron.h:81
LX200_10MICRON::ALIGN_END
@ ALIGN_END
Definition: lx200_10micron.h:95
LX200_10MICRON::TrackSat
bool TrackSat()
Definition: lx200_10micron.cpp:833
LX200_10MICRON::UnPark
bool UnPark() override
Unpark the telescope if already parked.
Definition: lx200_10micron.cpp:550
lx200generic.h
LX200_10MICRON::NewAlignmentPointsNP
INumberVectorProperty NewAlignmentPointsNP
Definition: lx200_10micron.h:170
LX200_10MICRON::GSTAT_NOT_TRACKING_AND_NOT_MOVING
@ GSTAT_NOT_TRACKING_AND_NOT_MOVING
Definition: lx200_10micron.h:55
LX200_10MICRON::initProperties
bool initProperties() override
Called to initialize basic properties required all the time.
Definition: lx200_10micron.cpp:119
LX200_10MICRON::setStandardProcedureWithoutRead
int setStandardProcedureWithoutRead(int fd, const char *data)
Definition: lx200_10micron.cpp:1336
LX200_10MICRON::ALP_PDEC
@ ALP_PDEC
Definition: lx200_10micron.h:71
LX200_10MICRON::SyncConfigBehaviour
bool SyncConfigBehaviour(bool cmcfg)
Definition: lx200_10micron.cpp:630
LX200_10MICRON::MALP_PRA
@ MALP_PRA
Definition: lx200_10micron.h:86
LX200_10MICRON::ALP_MRA
@ ALP_MRA
Definition: lx200_10micron.h:66
LX200_10MICRON::MiniNewAlpRON
INumber MiniNewAlpRON[MALPRO_COUNT]
Definition: lx200_10micron.h:161
LX200_10MICRON::LX200_10MICRON_ALIGNMENT_STATE
LX200_10MICRON_ALIGNMENT_STATE
Definition: lx200_10micron.h:91
LX200_10MICRON::ISNewNumber
bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: lx200_10micron.cpp:975
LX200_10MICRON::TLEfromDatabaseN
INumber TLEfromDatabaseN[1]
Definition: lx200_10micron.h:175
LX200_10MICRON::GSTAT_PARKED
@ GSTAT_PARKED
Definition: lx200_10micron.h:53
_ITextVectorProperty
Text vector property descriptor.
Definition: indiapi.h:244
LX200_10MICRON::ModelCountNP
INumberVectorProperty ModelCountNP
Definition: lx200_10micron.h:153
LX200_10MICRON::ALP_COUNT
@ ALP_COUNT
Definition: lx200_10micron.h:72
LX200_10MICRON::ISNewText
bool ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n) override
Process the client newSwitch command.
Definition: lx200_10micron.cpp:1257
LX200_10MICRON::ALP_PRA
@ ALP_PRA
Definition: lx200_10micron.h:70
LX200_10MICRON::ProductT
IText ProductT[4]
Definition: lx200_10micron.h:141
LX200_10MICRON::setUnattendedFlipSetting
bool setUnattendedFlipSetting(bool setting)
Definition: lx200_10micron.cpp:589
LX200_10MICRON::SetRefractionModelPressure
virtual int SetRefractionModelPressure(double pressure)
Definition: lx200_10micron.cpp:897
LX200_10MICRON::GSTAT_PARKING
@ GSTAT_PARKING
Definition: lx200_10micron.h:50
LX200_10MICRON::ALIGN_IDLE
@ ALIGN_IDLE
Definition: lx200_10micron.h:93
LX200_10MICRON::MiniNewAlpRONP
INumberVectorProperty MiniNewAlpRONP
Definition: lx200_10micron.h:162
LX200_10MICRON::LX200_10MICRON
LX200_10MICRON()
Definition: lx200_10micron.cpp:62
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
IText
One text descriptor.
LX200_10MICRON::ISNewSwitch
bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: lx200_10micron.cpp:1098
LX200_10MICRON::RefractionModelTemperatureN
INumber RefractionModelTemperatureN[1]
Definition: lx200_10micron.h:145
LX200_10MICRON::MALPRO_MRA
@ MALPRO_MRA
Definition: lx200_10micron.h:77
LX200_10MICRON
Definition: lx200_10micron.h:25
LX200_10MICRON::GSTAT_STOPPED
@ GSTAT_STOPPED
Definition: lx200_10micron.h:49
LX200_10MICRON::flip
bool flip()
Definition: lx200_10micron.cpp:614
LX200_10MICRON::AlignmentStateS
ISwitch AlignmentStateS[ALIGN_COUNT]
Definition: lx200_10micron.h:158
LX200_10MICRON::GSTAT_UNSET
@ GSTAT_UNSET
Definition: lx200_10micron.h:47
LX200_10MICRON::UnattendedFlip
int UnattendedFlip
Definition: lx200_10micron.h:137
LX200_10MICRON::setStandardProcedureAndExpect
int setStandardProcedureAndExpect(int fd, const char *data, const char *expect)
Definition: lx200_10micron.cpp:1349
LX200_10MICRON::LX200_10MICRON_UNATTENDED_FLIP_SETTINGS
LX200_10MICRON_UNATTENDED_FLIP_SETTINGS
Definition: lx200_10micron.h:29
LX200_10MICRON::SetTLEtoFollow
bool SetTLEtoFollow(const char *tle)
Definition: lx200_10micron.cpp:665
LX200_10MICRON::getUnattendedFlipSetting
bool getUnattendedFlipSetting()
Definition: lx200_10micron.cpp:566
LX200_10MICRON::PRODUCT_FIRMWARE_DATE
@ PRODUCT_FIRMWARE_DATE
Definition: lx200_10micron.h:41
LX200_10MICRON::~LX200_10MICRON
~LX200_10MICRON()
Definition: lx200_10micron.h:101
LX200_10MICRON::updateProperties
bool updateProperties() override
Called when connected state changes, to add/remove properties.
Definition: lx200_10micron.cpp:197
LX200_10MICRON::ALIGN_DELETE_CURRENT
@ ALIGN_DELETE_CURRENT
Definition: lx200_10micron.h:96
LX200_10MICRON::ModelCountN
INumber ModelCountN[1]
Definition: lx200_10micron.h:152
LX200_10MICRON::setLocalDate
bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
Definition: lx200_10micron.cpp:651
LX200_10MICRON::getBasicData
void getBasicData() override
Definition: lx200_10micron.cpp:264
LX200_10MICRON::GSTAT_ERROR
@ GSTAT_ERROR
Definition: lx200_10micron.h:61
LX200_10MICRON::Park
bool Park() override
Park the telescope to its home position.
Definition: lx200_10micron.cpp:534
LX200_10MICRON::LX200_10MICRON_ALIGNMENT_POINT
LX200_10MICRON_ALIGNMENT_POINT
Definition: lx200_10micron.h:64
Aux::ALT
@ ALT
altitude|declination axis motor
Definition: celestronauxpacket.h:91
LX200_10MICRON::ALP_MDEC
@ ALP_MDEC
Definition: lx200_10micron.h:67
LX200_10MICRON::NewAlpNP
INumberVectorProperty NewAlpNP
Definition: lx200_10micron.h:167
name
const char * name
Definition: indiserver.c:116
LX200_10MICRON::RefractionModelPressureNP
INumberVectorProperty RefractionModelPressureNP
Definition: lx200_10micron.h:150
LX200_10MICRON::MiniNewAlpNP
INumberVectorProperty MiniNewAlpNP
Definition: lx200_10micron.h:164
LX200_10MICRON::UnattendedFlipSP
ISwitchVectorProperty UnattendedFlipSP
Definition: lx200_10micron.h:139
LX200_10MICRON::MiniNewAlpN
INumber MiniNewAlpN[MALP_COUNT]
Definition: lx200_10micron.h:163
LX200_10MICRON::GSTAT_SLEWING_TO_HOME
@ GSTAT_SLEWING_TO_HOME
Definition: lx200_10micron.h:52
LX200_10MICRON::AddSyncPointHere
int AddSyncPointHere(double PRa, double PDec)
Definition: lx200_10micron.cpp:969
LX200_10MICRON::NewAlignmentPointsN
INumber NewAlignmentPointsN[1]
Definition: lx200_10micron.h:169
LX200_10MICRON::NewModelNameTP
ITextVectorProperty NewModelNameTP
Definition: lx200_10micron.h:173
LX200_10MICRON::PRODUCT_NAME
@ PRODUCT_NAME
Definition: lx200_10micron.h:38
LX200_10MICRON::GSTAT_UNKNOWN_STATUS
@ GSTAT_UNKNOWN_STATUS
Definition: lx200_10micron.h:60
LX200_10MICRON::RefractionModelPressureN
INumber RefractionModelPressureN[1]
Definition: lx200_10micron.h:149
ISState
ISState
Switch state.
Definition: indiapi.h:148
LX200_10MICRON::PRODUCT_CONTROL_BOX
@ PRODUCT_CONTROL_BOX
Definition: lx200_10micron.h:39
LX200_10MICRON::LX200_10MICRON_MINI_ALIGNMENT_POINT
LX200_10MICRON_MINI_ALIGNMENT_POINT
Definition: lx200_10micron.h:84
LX200_10MICRON::AddSyncPoint
int AddSyncPoint(double MRa, double MDec, double MSide, double PRa, double PDec, double SidTime)
Definition: lx200_10micron.cpp:911
LX200_10MICRON::TLEfromDatabaseNP
INumberVectorProperty TLEfromDatabaseNP
Definition: lx200_10micron.h:176
LX200_10MICRON::UnattendedFlipS
ISwitch UnattendedFlipS[UNATTENDED_FLIP_COUNT]
Definition: lx200_10micron.h:138
LX200_10MICRON::SetRefractionModelTemperature
virtual int SetRefractionModelTemperature(double temperature)
Definition: lx200_10micron.cpp:884
LX200_10MICRON::getDefaultName
const char * getDefaultName() override
Definition: lx200_10micron.cpp:85
LX200_10MICRON::GSTAT_SLEWING_OR_STOPPING
@ GSTAT_SLEWING_OR_STOPPING
Definition: lx200_10micron.h:54
LX200_10MICRON::SetTLEfromDatabase
bool SetTLEfromDatabase(int tleN)
Definition: lx200_10micron.cpp:738
LX200_10MICRON::MALPRO_MSIDE
@ MALPRO_MSIDE
Definition: lx200_10micron.h:79
LX200_10MICRON::ReadScopeStatus
bool ReadScopeStatus() override
Read telescope status.
Definition: lx200_10micron.cpp:386
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365
LX200_10MICRON::MALP_PDEC
@ MALP_PDEC
Definition: lx200_10micron.h:87
LX200_10MICRON::MALPRO_SIDTIME
@ MALPRO_SIDTIME
Definition: lx200_10micron.h:80
LX200_10MICRON::UNATTENDED_FLIP_DISABLED
@ UNATTENDED_FLIP_DISABLED
Definition: lx200_10micron.h:31