2 Intelliscope
INDI driver
3 Copyright (C) 2005 Douglas Philipson (dougp AT intermind DOT net)
5 Based on code by Jasem Mutlaq (mutlaqja@ikarustech.com)
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT
ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License
for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with
this library;
if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 #define mydev "Intelliscope"
33 #define BASIC_GROUP "Main Control"
34 #define POLLMS_OVERRIDE 1000
35 #define currentRA eq[0].value
36 #define currentDEC eq[1].value
37 #define INTELLISCOPE_TIMEOUT 5
39 static void ISPoll(
void *);
41 static void connectTelescope(
void);
45 static ISwitch PowerS[] = { {
"CONNECT",
"Connect",
ISS_OFF, 0, 0 }, {
"DISCONNECT",
"Disconnect",
ISS_ON, 0, 0 } };
49 static IText PortT[] = { {
"PORT",
"Port", 0, 0, 0, 0 } };
55 {
"RA",
"RA H:M:S",
"%10.6m", 0., 24., 0., 0., 0, 0, 0 },
56 {
"DEC",
"Dec D:M:S",
"%10.6m", -90., 90., 0., 0., 0, 0, 0 },
59 mydev,
"EQUATORIAL_EOD_COORD",
"Equatorial JNow",
BASIC_GROUP,
IP_RO, 0,
IPS_IDLE,
eq,
NARRAY(
eq),
"", 0
64 static int isInit = 0;
101 void ISNewText(
const char *dev,
const char *name,
char *texts[],
char *names[],
int n)
117 void ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
126 void ISNewBLOB(
const char *dev,
const char *name,
int sizes[],
int blobsizes[],
char *blobs[],
char *formats[],
127 char *names[],
int n)
146 char CR[1] = { (char)0x51 };
147 float RA = 0.0, DEC = 0.0;
152 error_type = write(
fd, CR, 1);
157 tcflush(
fd, TCIFLUSH);
161 if (coords[0] ==
'Q')
168 nbytes_read = sscanf(coords,
" %g %g", &RA, &DEC);
176 IDLog(
"Error in Intelliscope number format [%s], exiting.\n", coords);
181 *
ra = RA * 0.0390625;
182 *
dec = DEC * 0.0390625;
191 if (PowerS[0].s ==
ISS_ON)
202 IDLog(
"Unknown error while reading telescope coordinates\n");
217 void connectTelescope(
void)
int IEAddTimer(int millisecs, IE_TCF *fp, void *p)
Register a new single-shot timer function, fp, to be called with ud as argument after ms.
#define NARRAY(a)
Handy macro to find the number of elements in array a[]. Must be used with actual array,...
int tty_connect(const char *device, int bit_rate, int word_size, int parity, int stop_bits, int *fd)
Establishes a tty connection to a terminal device.
int tty_disconnect(int fd)
Closes a tty connection and flushes the bus.
void IDLog(const char *fmt,...)
int tty_read(int fd, char *buf, int nbytes, int timeout, int *nbytes_read)
read buffer from terminal
Implementations for common driver routines.
void IUResetSwitch(ISwitchVectorProperty *svp)
Reset all switches in a switch vector property to OFF.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
Interface to the reference INDI C API device implementation on the Device Driver side.
int IUUpdateSwitch(ISwitchVectorProperty *svp, ISState *states, char *names[], int n)
Update all switches in a switch vector property.
void IDSetNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDSetSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
void IDDefNumber(const INumberVectorProperty *nvp, const char *fmt,...)
void IDDefText(const ITextVectorProperty *tvp, const char *fmt,...)
void IDSetText(const ITextVectorProperty *tvp, const char *fmt,...)
void IDDefSwitch(const ISwitchVectorProperty *svp, const char *fmt,...)
void ISNewBLOB(const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
Update data of an existing blob vector property.
void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Update the value of an existing switch vector property.
void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
Update the value of an existing text vector property.
void ISGetProperties(const char *dev)
Get Device Properties.
#define INTELLISCOPE_TIMEOUT
INumberVectorProperty eqNum
void ISSnoopDevice(XMLEle *root)
Function defined by Drivers that is called when another Driver it is snooping (by having previously c...
void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
ISwitchVectorProperty PowerSP
int updateIntelliscopeCoord(int fd, double *ra, double *dec)
ITextVectorProperty PortTP
Namespace to encapsulate INDI client, drivers, and mediator classes.
Number vector property descriptor.
Switch vector property descriptor.
Text vector property descriptor.