Instrument Neutral Distributed Interface INDI 2.2.5
ioptronv3.h
Go to the documentation of this file.
1/*
2 INDI IOptron v3 Driver for firmware version 20171001 or later.
3
4 Copyright (C) 2018 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 Updated for PEC V3
21*/
22
23#pragma once
24
25#include <memory>
26
27#include "ioptronv3driver.h"
28#include "indiguiderinterface.h"
29#include "inditelescope.h"
30
32{
33 public:
34
35 IOptronV3();
36
37 virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override;
38 virtual bool ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n) override;
39
40 protected:
41 virtual const char *getDefaultName() override;
42
43 virtual bool Handshake() override;
44
45 virtual bool initProperties() override;
46 virtual bool updateProperties() override;
47
48 virtual bool ReadScopeStatus() override;
49
50 virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override;
51 virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override;
52
53 virtual bool saveConfigItems(FILE *fp) override;
54
55 virtual bool Park() override;
56 virtual bool UnPark() override;
57
58 virtual bool Sync(double ra, double de) override;
59 virtual bool Goto(double ra, double de) override;
60 virtual bool Abort() override;
61
62 virtual bool updateTime(ln_date *utc, double utc_offset) override;
63 virtual bool updateLocation(double latitude, double longitude, double elevation) override;
64
65 virtual void debugTriggered(bool enable) override;
66 virtual void simulationTriggered(bool enable) override;
67
68 // Parking
69 virtual bool SetCurrentPark() override;
70 virtual bool SetDefaultPark() override;
71
72 // Track Mode
73 virtual bool SetTrackMode(uint8_t mode) override;
74
75 // Track Rate
76 virtual bool SetTrackRate(double raRate, double deRate) override;
77
78 // Track On/Off
79 virtual bool SetTrackEnabled(bool enabled) override;
80
81 // Slew Rate
82 virtual bool SetSlewRate(int index) override;
83
84 // Sim
85 void mountSim();
86
87 // Guide
88 virtual IPState GuideNorth(uint32_t ms) override;
89 virtual IPState GuideSouth(uint32_t ms) override;
90 virtual IPState GuideEast(uint32_t ms) override;
91 virtual IPState GuideWest(uint32_t ms) override;
92
93 // Homing
94 virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override;
95
96 private:
100 void getStartupData();
101
107 bool GetPECDataStatus(bool enabled);
108
109 /* Mod v3.0 Adding PEC Recording Switches */
110 ISwitch PECTrainingS[2];
111 ISwitchVectorProperty PECTrainingSP;
112
113 ITextVectorProperty PECInfoTP;
114 IText PECInfoT[2] {};
115
116 int PECTime {false};
117 bool isTraining {false};
118 // End Mod */
119
120 /* Firmware */
121 IText FirmwareT[5] {};
122 ITextVectorProperty FirmwareTP;
123
124 /* GPS Status */
125 ISwitch GPSStatusS[3];
126 ISwitchVectorProperty GPSStatusSP;
127
128 /* Time Source */
129 ISwitch TimeSourceS[3];
130 ISwitchVectorProperty TimeSourceSP;
131
132 /* Hemisphere */
133 ISwitch HemisphereS[2];
134 ISwitchVectorProperty HemisphereSP;
135
136 /* Guide Rate */
137 INumber GuideRateN[2];
138 INumberVectorProperty GuideRateNP;
139
140 /* Slew Mode */
141 ISwitch SlewModeS[2];
142 ISwitchVectorProperty SlewModeSP;
143
144 /* Counterweight Status */
145 ISwitch CWStateS[2];
146 ISwitchVectorProperty CWStateSP;
147
148 /* Daylight Saving */
149 ISwitch DaylightS[2];
150 ISwitchVectorProperty DaylightSP;
151
152 // Meridian Behavior
153 INDI::PropertySwitch MeridianActionSP {2};
154
155 // Meridian Limit
156 INDI::PropertyNumber MeridianLimitNP {1};
157
158 uint32_t DBG_SCOPE;
159
160 double currentRA {0}, currentDEC {0};
161 double targetRA {0}, targetDEC {0};
162
163 IOPv3::IOPInfo scopeInfo;
164 IOPv3::FirmwareInfo firmwareInfo;
165
166 uint8_t m_ParkingCounter {0};
167 static constexpr const uint8_t MAX_PARK_COUNTER {2};
168 static constexpr const char *MB_TAB {"Meridian Behavior"};
169
170 std::unique_ptr<IOPv3::Driver> driver;
171};
int SetSlewRate(void)
virtual bool Goto(double ra, double de) override
Move the scope to the supplied RA and DEC coordinates.
virtual IPState GuideSouth(uint32_t ms) override
Guide south for ms milliseconds. South is defined as DEC-.
virtual bool saveConfigItems(FILE *fp) override
saveConfigItems Save specific properties in the provide config file handler. Child class usually over...
virtual bool MoveNS(INDI_DIR_NS dir, TelescopeMotionCommand command) override
Start or Stop the telescope motion in the direction dir.
virtual bool SetTrackRate(double raRate, double deRate) override
SetTrackRate Set custom tracking rates.
virtual const char * getDefaultName() override
Definition ioptronv3.cpp:78
virtual bool SetTrackMode(uint8_t mode) override
SetTrackMode Set active tracking mode. Do not change track state.
virtual bool ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n) override
Process the client newNumber command.
virtual IPState ExecuteHomeAction(TelescopeHomeAction action) override
Execute a homing action.
virtual bool MoveWE(INDI_DIR_WE dir, TelescopeMotionCommand command) override
Move the telescope in the direction dir.
virtual bool Park() override
Park the telescope to its home position.
virtual bool UnPark() override
Unpark the telescope if already parked.
virtual void simulationTriggered(bool enable) override
Inform driver that the simulation option was triggered. This function is called after setSimulation i...
virtual bool SetCurrentPark() override
SetCurrentPark Set current coordinates/encoders value as the desired parking position.
void mountSim()
virtual IPState GuideNorth(uint32_t ms) override
Guide north for ms milliseconds. North is defined as DEC+.
virtual bool updateLocation(double latitude, double longitude, double elevation) override
Update telescope location settings.
virtual bool Sync(double ra, double de) override
Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.
virtual bool Handshake() override
perform handshake with device to check communication
virtual bool SetTrackEnabled(bool enabled) override
SetTrackEnabled Engages or disengages mount tracking. If there are no tracking modes available,...
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 bool SetDefaultPark() override
SetDefaultPark Set default coordinates/encoders value as the desired parking position.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void debugTriggered(bool enable) override
Inform driver that the debug option was triggered. This function is called after setDebug is triggere...
virtual bool updateTime(ln_date *utc, double utc_offset) override
Update telescope time, date, and UTC offset.
virtual IPState GuideEast(uint32_t ms) override
Guide east for ms milliseconds. East is defined as RA+.
virtual bool Abort() override
Abort any telescope motion including tracking if possible.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
Definition ioptronv3.cpp:83
virtual IPState GuideWest(uint32_t ms) override
Guide west for ms milliseconds. West is defined as RA-.
double ra
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
INDI_DIR_WE
INDI_DIR_NS
One number descriptor.
One switch descriptor.
One text descriptor.
Number vector property descriptor.
Definition indiapi.h:317
Switch vector property descriptor.
Definition indiapi.h:365
Text vector property descriptor.
Definition indiapi.h:244