1 /*
2     MAGELLAN Generic
3     Copyright (C) 2011 Onno Hommes  (ohommes@alumni.cmu.edu)
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 #pragma once
22 
23 #include "indicom.h"
24 #include "indidevapi.h"
25 
26 /*
27    The device name below eventhough we have a Magellan I
28    should remain set to a KStars registered telescope so
29    It allows the service to be stopped
30 */
31 #define mydev "Magellan I" /* The device name */
32 
33 class Magellan1
34 {
35   public:
36     Magellan1();
37     virtual ~Magellan1();
38 
39     virtual void ISGetProperties(const char *dev);
40     virtual void ISNewNumber(const char *dev, const char *name, double values[], char *names[], int n);
41     virtual void ISNewText(const char *dev, const char *name, char *texts[], char *names[], int n);
42     virtual void ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
43     virtual void ISSnoopDevice(XMLEle *root);
44     virtual void ISPoll();
45     virtual void getBasicData();
46 
47     void handleError(ISwitchVectorProperty *svp, int err, const char *msg);
48     void handleError(INumberVectorProperty *nvp, int err, const char *msg);
49     void handleError(ITextVectorProperty *tvp, int err, const char *msg);
50     bool isTelescopeOn();
51     void connectTelescope();
52     void setCurrentDeviceName(const char *devName);
53     void correctFault();
54 
55     int fd;
56 
57   protected:
58     int timeFormat;
59     int currentSiteNum;
60     int trackingMode;
61 
62     double JD;
63     double lastRA;
64     double lastDEC;
65     bool fault;
66     bool simulation;
67     char thisDevice[64];
68     int currentSet;
69     int lastSet;
70     double targetRA, targetDEC;
71 };
72