Instrument Neutral Distributed Interface INDI 2.2.5
lx200autostar.cpp
Go to the documentation of this file.
1/*
2 LX200 Autostar
3 Copyright (C) 2003 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21#include "lx200autostar.h"
22
23#include "lx200driver.h"
24
25#include <cstring>
26
27#define FIRMWARE_TAB "Firmware data"
28
29/********************************************
30 Property: Park telescope to HOME
31*********************************************/
32
37
39{
40 return "LX200 Autostar";
41}
42
44{
46
47 IUFillText(&VersionT[0], "Date", "", "");
48 IUFillText(&VersionT[1], "Time", "", "");
49 IUFillText(&VersionT[2], "Number", "", "");
50 IUFillText(&VersionT[3], "Full", "", "");
51 IUFillText(&VersionT[4], "Name", "", "");
53
54 // IUFillNumber(&FocusSpeedN[0], "SPEED", "Speed", "%0.f", 0, 4.0, 1.0, 0);
55 // IUFillNumberVector(&FocusSpeedNP, FocusSpeedN, 1, getDeviceName(), "FOCUS_SPEED", "Speed", FOCUS_TAB, IP_RW, 0,
56 // IPS_IDLE);
57
58 FocusSpeedNP[0].setMin(1);
59 FocusSpeedNP[0].setMax(4);
60 FocusSpeedNP[0].setValue(1);
61
63
64 return true;
65}
66
67//void LX200Autostar::ISGetProperties(const char *dev)
68//{
69// if (dev != nullptr && strcmp(dev, getDeviceName()) != 0)
70// return;
71
72// LX200Generic::ISGetProperties(dev);
73
74// /*
75// if (isConnected())
76// {
77// defineProperty(&VersionTP);
78// defineProperty(&FocusSpeedNP);
79
80// // For Autostar, we have a different focus speed method
81// // Therefore, we don't need the classical one
82// deleteProperty(FocusModeSP.name);
83// }
84// */
85//}
86
88{
90
91 if (isConnected())
92 {
94 //defineProperty(&FocusSpeedNP);
95
96 // For Autostar, we have a different focus speed method
97 // Therefore, we don't need the classical one
98 //deleteProperty(FocusModeSP.name);
99 return true;
100 }
101 else
102 {
104 //deleteProperty(FocusSpeedNP.name);
105 return true;
106 }
107}
108
109//bool LX200Autostar::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
110//{
111// if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
112// {
113// // Focus speed
114// if (!strcmp(name, FocusSpeedNP.name))
115// {
116// if (IUUpdateNumber(&FocusSpeedNP, values, names, n) < 0)
117// return false;
118
119// if (!isSimulation())
120// setGPSFocuserSpeed(PortFD, ((int)FocusSpeedNP[0].getValue()));
121// FocusSpeedNP.setState(IPS_OK);
122// FocusSpeedNP.apply();
123// return true;
124// }
125// }
126
127// return LX200Generic::ISNewNumber(dev, name, values, names, n);
128//}
129
130//bool LX200Autostar::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
131//{
132// int index = 0;
133
134// if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
135// {
136// // Focus Motion
137// if (!strcmp(name, FocusMotionSP.name))
138// {
139// // If speed is "halt"
140// if (FocusSpeedNP[0].getValue() == 0)
141// {
142// FocusMotionSP.setState(IPS_IDLE);
143// FocusMotionSP.apply();
144// return false;
145// }
146
147// int last_motion = IUFindOnSwitchIndex(&FocusMotionSP);
148
149// if (IUUpdateSwitch(&FocusMotionSP, states, names, n) < 0)
150// return false;
151
152// index = IUFindOnSwitchIndex(&FocusMotionSP);
153
154// // If same direction and we're busy, stop
155// if (last_motion == index && FocusMotionSP.s == IPS_BUSY)
156// {
157// FocusMotionSP.reset();
158// FocusMotionSP.setState(IPS_IDLE);
159// setFocuserSpeedMode(PortFD, 0);
160// FocusMotionSP.apply();
161// return true;
162// }
163
164// if (!isSimulation() && setFocuserMotion(PortFD, index) < 0)
165// {
166// FocusMotionSP.s = IPS_ALERT;
167// IDSetSwitch(&FocusMotionSP, "Error setting focuser speed.");
168// return false;
169// }
170
171// FocusMotionSP.s = IPS_BUSY;
172
173// // with a timer
174// if (FocusTimerNP.np[0].value > 0)
175// {
176// FocusTimerNP.getState() = IPS_BUSY;
177// if (isDebug())
178// IDLog("Starting Focus Timer BUSY\n");
179
180// IEAddTimer(50, LX200Generic::updateFocusHelper, this);
181// }
182
183// FocusMotionSP.apply();
184// return true;
185// }
186// }
187
188// return LX200Generic::ISNewSwitch(dev, name, states, names, n);
189//}
190
192{
193 return (setGPSFocuserSpeed(PortFD, speed) == 0);
194}
195
197{
198 // process parent
200
201 if (!isSimulation())
202 {
203 VersionTP.tp[0].text = new char[64];
204 getVersionDate(PortFD, VersionTP.tp[0].text);
205 VersionTP.tp[1].text = new char[64];
206 getVersionTime(PortFD, VersionTP.tp[1].text);
207 VersionTP.tp[2].text = new char[64];
208 getVersionNumber(PortFD, VersionTP.tp[2].text);
209 VersionTP.tp[3].text = new char[128];
210 getFullVersion(PortFD, VersionTP.tp[3].text);
211 VersionTP.tp[4].text = new char[128];
212 getProductName(PortFD, VersionTP.tp[4].text);
213
214 IDSetText(&VersionTP, nullptr);
215 }
216}
bool isConnected() const
virtual bool deleteProperty(const char *propertyName)
Delete a property and unregister it. It will also be deleted from all clients.
void defineProperty(INumberVectorProperty *property)
bool isSimulation() const
INDI::PropertyNumber FocusSpeedNP
void setMountType(TelescopeMountType type)
setMountType Report the mount type in TELESCOPE_MOUNT_TYPE. Drivers call it when the type is fixed by...
virtual void getBasicData() override
IText VersionT[5]
virtual bool SetFocuserSpeed(int speed) override
SetFocuserSpeed Set Focuser speed.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual bool initProperties() override
Called to initialize basic properties required all the time.
const char * getDefaultName() override
ITextVectorProperty VersionTP
virtual bool initProperties() override
Called to initialize basic properties required all the time.
virtual bool updateProperties() override
Called when connected state changes, to add/remove properties.
virtual void getBasicData()
@ IP_RO
Definition indiapi.h:182
@ IPS_IDLE
Definition indiapi.h:159
void IUFillTextVector(ITextVectorProperty *tvp, IText *tp, int ntp, const char *dev, const char *name, const char *label, const char *group, IPerm p, double timeout, IPState s)
Assign attributes for a text vector property. The vector's auxiliary elements will be set to NULL.
Definition indidevapi.c:509
void IUFillText(IText *tp, const char *name, const char *label, const char *initialText)
Assign attributes for a text property. The text's auxiliary elements will be set to NULL.
Definition indidevapi.c:416
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
#define getDeviceName
#define FIRMWARE_TAB
int setGPSFocuserSpeed(int fd, int speed)
#define getVersionDate(fd, x)
#define getVersionTime(fd, x)
#define getVersionNumber(fd, x)
#define getProductName(fd, x)
#define getFullVersion(fd, x)