2 Sky Commander
INDI driver
3 Copyright (C) 2005 Jasem Mutlaq (mutlaqja@ikarustech.com)
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.
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.
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
30 #define mydev "Sky Commander"
31 #define BASIC_GROUP "Main Control"
32 #define POLLMS_OVERRIDE 1000
33 #define currentRA eq[0].value
34 #define currentDEC eq[1].value
35 #define SKYCOMMANDER_TIMEOUT 5
37 static void ISPoll(
void *);
39 static void connectTelescope(
void);
43 static ISwitch PowerS[] = { {
"CONNECT",
"Connect",
ISS_OFF, 0, 0 }, {
"DISCONNECT",
"Disconnect",
ISS_ON, 0, 0 } };
47 static IText PortT[] = { {
"PORT",
"Port", 0, 0, 0, 0 } };
53 {
"RA",
"RA H:M:S",
"%10.6m", 0., 24., 0., 0., 0, 0, 0 },
54 {
"DEC",
"Dec D:M:S",
"%10.6m", -90., 90., 0., 0., 0, 0, 0 },
57 mydev,
"EQUATORIAL_EOD_COORD",
"Equatorial JNow",
BASIC_GROUP,
IP_RO, 0,
IPS_IDLE,
eq,
NARRAY(
eq),
"", 0
62 static int isInit = 0;
99 void ISNewText(
const char *dev,
const char *name,
char *texts[],
char *names[],
int n)
115 void ISNewNumber(
const char *dev,
const char *name,
double values[],
char *names[],
int n)
124 void ISNewBLOB(
const char *dev,
const char *name,
int sizes[],
int blobsizes[],
char *blobs[],
char *formats[],
125 char *names[],
int n)
144 char CR[1] = { (char)0x0D };
145 float RA = 0.0, DEC = 0.0;
149 error_type = write(
fd, CR, 1);
153 tcflush(
fd, TCIFLUSH);
155 nbytes_read = sscanf(coords,
" %g %g", &RA, &DEC);
159 IDLog(
"Error in Sky commander number format [%s], exiting.\n", coords);
173 if (PowerS[0].s ==
ISS_ON)
184 IDLog(
"Unknown error while reading telescope coordinates\n");
199 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,...)
ITextVectorProperty PortTP
Namespace to encapsulate INDI client, drivers, and mediator classes.
#define SKYCOMMANDER_TIMEOUT
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.
int updateSkyCommanderCoord(int fd, double *ra, double *dec)
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
Number vector property descriptor.
Switch vector property descriptor.
Text vector property descriptor.