Instrument Neutral Distributed Interface INDI  2.0.2
lx200am5.h
Go to the documentation of this file.
1 /*
2  ZEQ25 INDI driver
3 
4  Copyright (C) 2015 Jasem Mutlaq
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 #include "indipropertyswitch.h"
25 #include "indipropertynumber.h"
26 
27 class LX200AM5 : public LX200Generic
28 {
29  public:
30  LX200AM5();
31  virtual ~LX200AM5() override = default;
32 
33  virtual bool updateProperties() override;
34  virtual bool initProperties() override;
35 
36  virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
37  virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
38 
39  protected:
40  virtual const char *getDefaultName() override;
41 
42  // Communication
43  virtual bool checkConnection() override;
44 
45  // Motion & Goto
46  virtual bool ReadScopeStatus() override;
47  virtual bool SetSlewRate(int index) override;
48 
49  // Tracking
50  virtual bool SetTrackEnabled(bool enabled) override;
51 
52  // Time & Location
53  virtual bool updateLocation(double latitude, double longitude, double elevation) override;
54  virtual bool setUTCOffset(double offset) override;
55  virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
56 
57  // Parking
58  virtual bool Park() override;
59 
60  private:
61 
65 
76  bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
77  void hexDump(char * buf, const char * data, int size);
78  std::vector<std::string> split(const std::string &input, const std::string &regex);
79 
83  // Go Home
84  INDI::PropertySwitch HomeSP {1};
85  // Mount Type
86  INDI::PropertySwitch MountTypeSP {2};
87  enum
88  {
89  Azimuth,
90  Equatorial
91  };
92  // Guide Rate
93  INDI::PropertyNumber GuideRateNP {1};
94  // Buzzer control
95  INDI::PropertySwitch BuzzerSP {3};
96  enum
97  {
98  Off,
99  Low,
100  High
101  };
102 
103 
107  void setup();
108 
109  // Homing
110  bool goHome();
111 
112  // Guide Rate
113  bool setGuideRate(double value);
114  bool getGuideRate();
115 
116  // Buzzer
117  bool getBuzzer();
118  bool setBuzzer(int value);
119 
120  // Mount type
121  bool setMountType(int type);
122  bool getMountType();
123 
124  // Track Mode
125  bool getTrackMode();
126  bool isTracking();
127 
128 
132  // # is the stop char
133  static const char DRIVER_STOP_CHAR { 0x23 };
134  // Wait up to a maximum of 3 seconds for serial input
135  static constexpr const uint8_t DRIVER_TIMEOUT {3};
136  // Maximum buffer for sending/receving.
137  static constexpr const uint8_t DRIVER_LEN {64};
138  // Slew Modes
139  static constexpr const uint8_t SLEW_MODES {10};
140 };
141 
142 
virtual bool ReadScopeStatus() override
Read telescope status.
Definition: lx200am5.cpp:479
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
Definition: lx200am5.cpp:114
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
Definition: lx200am5.cpp:405
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition: lx200am5.cpp:53
virtual bool Park() override
Park the telescope to its home position.
Definition: lx200am5.cpp:468
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
Definition: lx200am5.cpp:242
LX200AM5()
Definition: lx200am5.cpp:36
virtual const char * getDefaultName() override
Definition: lx200am5.cpp:140
virtual bool checkConnection() override
Definition: lx200am5.cpp:148
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
Definition: lx200am5.cpp:199
virtual ~LX200AM5() override=default
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
Definition: lx200am5.cpp:433
virtual bool setUTCOffset(double offset) override
Definition: lx200am5.cpp:384
virtual bool SetSlewRate(int index) override
SetSlewRate Set desired slew rate index.
Definition: lx200am5.cpp:290
virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
Definition: lx200am5.cpp:395
ISState
Switch state.
Definition: indiapi.h:150
__le16 type
Definition: pwc-ioctl.h:0
__u8 cmd[4]
Definition: pwc-ioctl.h:2