Instrument Neutral Distributed Interface INDI 2.2.5
toup_sh20.h
Go to the documentation of this file.
1#pragma once
2
3#include "lx200generic.h"
6
7class ToupSH20 : public LX200Generic
8{
9 public:
10 ToupSH20();
11 virtual ~ToupSH20() override = default;
12
13 virtual bool initProperties() override;
14 virtual bool updateProperties() override;
15
16 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
17 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
18
19 protected:
20 virtual const char *getDefaultName() override;
21
22 virtual bool checkConnection() override;
23
24 virtual bool ReadScopeStatus() override;
25
26 // Location
27 virtual bool updateLocation(double latitude, double longitude, double elevation) override;
28 // Date
29 virtual bool setUTCOffset(double offset) override;
30 virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override;
31 // Goto
32 virtual bool Goto(double ra, double dec) override;
33 // Slew Rate
34 virtual bool SetSlewRate(int index) override;
35 // Track
36 virtual bool SetTrackEnabled(bool enabled) override;
37 // Park
38 virtual bool SetCurrentPark() override;
39 virtual bool Park() override;
40 virtual bool UnPark() override;
41 // Home
42 virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override;
43
44 private:
54 bool sendCommand(const char * cmd, char * res = nullptr, int cmd_len = -1, int res_len = -1);
55 void hexDump(char * buf, const char * data, int size);
56
57 void getStartupData();
58
59 // Mount type
60 bool setMountType(int type);
61 bool getMountType();
62 // Home
63 bool goHome();
64 bool findHome();
65 // Track mode
66 bool getTrackMode();
67 // Guide rate
68 bool setGuideRate(double value);
69 bool getGuideRate();
70 // Buzzer
71 bool setBuzzer(int value);
72 bool getBuzzer();
73 // Meridian Flip
74 bool setMeridianFlipSettings(bool enabled, bool track, double limit);
75 bool getMeridianFlipSettings();
76
77 static constexpr uint8_t SLEW_RATE_COUNT = 10;
78 static constexpr uint8_t DRIVER_LEN = 64;
79 static constexpr uint8_t DRIVER_TIMEOUT = 3;
80 static constexpr char DRIVER_STOP_CHAR = 0x23;
81
82 enum TypeSwitch
83 {
84 TYPE_AZIMUTH,
85 TYPE_EQUATORIAL
86 };
87
88 enum BuzzerSwitch
89 {
90 BUZZER_OFF,
91 BUZZER_LOW,
92 BUZZER_HIGH
93 };
94
95 enum MeridianTrackSwitch
96 {
97 MERIDIAN_TRACK,
98 MERIDIAN_STOP
99 };
100
101 INDI::PropertySwitch MountTypeSP {2};
102 INDI::PropertyNumber GuideRateNP {1};
103 INDI::PropertySwitch BuzzerSP {3};
104 INDI::PropertySwitch MeridianFlipSP {2};
105 INDI::PropertySwitch MeridianTrackSP {2};
106 INDI::PropertyNumber MeridianLimitNP {1};
107};
int SetSlewRate(void)
virtual bool ReadScopeStatus() override
Read telescope status.
virtual const char * getDefaultName() override
virtual bool Park() override
Park the telescope to its home position.
virtual bool checkConnection() override
virtual bool Goto(double ra, double dec) override
Override - Goto.
virtual bool SetCurrentPark() override
Override - Park.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Override - Location.
virtual bool setUTCOffset(double offset) override
Override - Date.
virtual bool setLocalDate(uint8_t days, uint8_t months, uint16_t years) override
virtual ~ToupSH20() override=default
virtual bool SetTrackEnabled(bool enabled) override
Override - Track enable.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Override - Home.
virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override
Process the client newSwitch command.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition toup_sh20.cpp:33
double ra
double dec
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