5This library is free software;
6you can redistribute it and / or
7modify it under the terms of the GNU Lesser General Public
8License as published by the Free Software Foundation;
10version 2.1 of the License, or (at your option) any later version.
12This library is distributed in the hope that it will be useful,
13 but WITHOUT
ANY WARRANTY;
14without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16Lesser General Public License
for more details.
18You should have received a copy of the GNU Lesser General Public
19License along with
this library;
20if not, write to the Free Software
21Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110 - 1301 USA
33#define COMM_GROUP "Communication"
34#define BASIC_GROUP "Position"
36#define MAGELLAN_TRACK 0
37#define MAGELLAN_SYNC 1
40#define currentRA EquatorialCoordsRN[0].value
41#define currentDEC EquatorialCoordsRN[1].value
44static void retryConnection(
void *);
55static ISwitch ConnectS[] = { {
"CONNECT",
"Connect",
ISS_OFF, 0, 0 }, {
"DISCONNECT",
"Disconnect",
ISS_ON, 0, 0 } };
64static IText PortT[] = { {
"PORT",
"Port", 0, 0, 0, 0 } };
77INumber EquatorialCoordsRN[] = { {
"RA",
"RA H:M:S",
"%10.6m", 0., 24., 0., 0., 0, 0, 0 },
78 {
"DEC",
"Dec D:M:S",
"%10.6m", -90., 90., 0., 0., 0, 0, 0 }
93 std::unique_ptr<Magellan1> telescope;
119 IDLog(
"Initializing from MAGELLAN device...\n");
120 IDLog(
"Driver Version: 2011-07-28\n");
134 if (dev !=
nullptr && strcmp(
thisDevice, dev))
196 bool connectionEstablished = (ConnectS[0].s ==
ISS_ON);
199 if ((connectionEstablished && ConnectS[0].s ==
ISS_ON) || (!connectionEstablished && ConnectS[1].s ==
ISS_ON))
232 IDSetSwitch(svp,
"Device timed out. Current device may be busy or does not support %s. Will retry again.", msg);
263 IDSetNumber(nvp,
"Device timed out. Current device may be busy or does not support %s. Will retry again.", msg);
294 IDSetText(tvp,
"Device timed out. Current device may be busy or does not support %s. Will retry again.", msg);
317static void retryConnection(
void *p)
319 int fd = *((
int *)p);
362 char calendarDate[32];
406 "Error connecting to port %s. Make sure you have BOTH write and read permission to your port.\n",
419 IDLog(
"Telescope test successful.\n");
432 IDLog(
"Telescope is offline.");
virtual void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n)
virtual void ISGetProperties(const char *dev)
virtual void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
virtual void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n)
virtual void getBasicData()
void handleError(ISwitchVectorProperty *svp, int err, const char *msg)
virtual void ISSnoopDevice(XMLEle *root)
void setCurrentDeviceName(const char *devName)
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,...)
IText * IUFindText(const ITextVectorProperty *tvp, const char *name)
Find an IText member in a vector text property.
void IUSaveText(IText *tp, const char *newtext)
Function to reliably save new text in a IText.
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 IDMessage(const char *dev, 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,...)
int getCalendarDate(int fd, char *date)
ISwitchVectorProperty ConnectSP
INumber EquatorialCoordsRN[]
INumberVectorProperty EquatorialCoordsRNP
ITextVectorProperty PortTP
#define getMAGELLANRA(fd, x)
#define getMAGELLANDEC(fd, x)
int check_magellan_connection(int fd)
Number vector property descriptor.
Switch vector property descriptor.
Text vector property descriptor.