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
64
65 return true;
66}
67
68//void LX200Autostar::ISGetProperties(const char *dev)
69//{
70// if (dev != nullptr && strcmp(dev, getDeviceName()) != 0)
71// return;
72
73// LX200Generic::ISGetProperties(dev);
74
75// /*
76// if (isConnected())
77// {
78// defineProperty(&VersionTP);
79// defineProperty(&FocusSpeedNP);
80
81// // For Autostar, we have a different focus speed method
82// // Therefore, we don't need the classical one
83// deleteProperty(FocusModeSP.name);
84// }
85// */
86//}
87
89{
91
92 if (isConnected())
93 {
95 //defineProperty(&FocusSpeedNP);
96
97 // For Autostar, we have a different focus speed method
98 // Therefore, we don't need the classical one
99 //deleteProperty(FocusModeSP.name);
100 return true;
101 }
102 else
103 {
105 //deleteProperty(FocusSpeedNP.name);
106 return true;
107 }
108}
109
110//bool LX200Autostar::ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
111//{
112// if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
113// {
114// // Focus speed
115// if (!strcmp(name, FocusSpeedNP.name))
116// {
117// if (IUUpdateNumber(&FocusSpeedNP, values, names, n) < 0)
118// return false;
119
120// if (!isSimulation())
121// setGPSFocuserSpeed(PortFD, ((int)FocusSpeedNP[0].getValue()));
122// FocusSpeedNP.setState(IPS_OK);
123// FocusSpeedNP.apply();
124// return true;
125// }
126// }
127
128// return LX200Generic::ISNewNumber(dev, name, values, names, n);
129//}
130
131//bool LX200Autostar::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
132//{
133// int index = 0;
134
135// if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
136// {
137// // Focus Motion
138// if (!strcmp(name, FocusMotionSP.name))
139// {
140// // If speed is "halt"
141// if (FocusSpeedNP[0].getValue() == 0)
142// {
143// FocusMotionSP.setState(IPS_IDLE);
144// FocusMotionSP.apply();
145// return false;
146// }
147
148// int last_motion = IUFindOnSwitchIndex(&FocusMotionSP);
149
150// if (IUUpdateSwitch(&FocusMotionSP, states, names, n) < 0)
151// return false;
152
153// index = IUFindOnSwitchIndex(&FocusMotionSP);
154
155// // If same direction and we're busy, stop
156// if (last_motion == index && FocusMotionSP.s == IPS_BUSY)
157// {
158// FocusMotionSP.reset();
159// FocusMotionSP.setState(IPS_IDLE);
160// setFocuserSpeedMode(PortFD, 0);
161// FocusMotionSP.apply();
162// return true;
163// }
164
165// if (!isSimulation() && setFocuserMotion(PortFD, index) < 0)
166// {
167// FocusMotionSP.s = IPS_ALERT;
168// IDSetSwitch(&FocusMotionSP, "Error setting focuser speed.");
169// return false;
170// }
171
172// FocusMotionSP.s = IPS_BUSY;
173
174// // with a timer
175// if (FocusTimerNP.np[0].value > 0)
176// {
177// FocusTimerNP.getState() = IPS_BUSY;
178// if (isDebug())
179// IDLog("Starting Focus Timer BUSY\n");
180
181// IEAddTimer(50, LX200Generic::updateFocusHelper, this);
182// }
183
184// FocusMotionSP.apply();
185// return true;
186// }
187// }
188
189// return LX200Generic::ISNewSwitch(dev, name, states, names, n);
190//}
191
193{
194 return (setGPSFocuserSpeed(PortFD, speed) == 0);
195}
196
198{
199 // process parent
201
202 if (!isSimulation())
203 {
204 VersionTP.tp[0].text = new char[64];
206 VersionTP.tp[1].text = new char[64];
208 VersionTP.tp[2].text = new char[64];
210 VersionTP.tp[3].text = new char[128];
212 VersionTP.tp[4].text = new char[128];
214
215 IDSetText(&VersionTP, nullptr);
216 }
217}
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 setState(IPState state)
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()
INDI::PropertySwitch MountTypeSP
@ ISS_ON
Definition indiapi.h:150
@ 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)
char name[MAXINDINAME]
Definition indiapi.h:248
char * text
Definition indiapi.h:230