| 1 | /*
|
|---|
| 2 | LX200 Basic Driver
|
|---|
| 3 | Copyright (C) 2005 Jasem Mutlaq (mutlaqja@ikarustech.com)
|
|---|
| 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 | #ifndef LX200BASIC_H
|
|---|
| 22 | #define LX200BASIC_H
|
|---|
| 23 |
|
|---|
| 24 | #include "indidevapi.h"
|
|---|
| 25 | #include "indicom.h"
|
|---|
| 26 |
|
|---|
| 27 | class LX200Basic
|
|---|
| 28 | {
|
|---|
| 29 | public:
|
|---|
| 30 | LX200Basic();
|
|---|
| 31 | ~LX200Basic();
|
|---|
| 32 |
|
|---|
| 33 | void ISGetProperties (const char *dev);
|
|---|
| 34 | void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
|
|---|
| 35 | void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
|
|---|
| 36 | void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
|
|---|
| 37 | void ISPoll ();
|
|---|
| 38 |
|
|---|
| 39 | void connection_lost();
|
|---|
| 40 | void connection_resumed();
|
|---|
| 41 |
|
|---|
| 42 | private:
|
|---|
| 43 |
|
|---|
| 44 | enum LX200_STATUS { LX200_SLEW, LX200_TRACK, LX200_SYNC, LX200_PARK };
|
|---|
| 45 |
|
|---|
| 46 | /* Switches */
|
|---|
| 47 | ISwitch ConnectS[2];
|
|---|
| 48 | ISwitch OnCoordSetS[3];
|
|---|
| 49 | ISwitch AbortSlewS[1];
|
|---|
| 50 |
|
|---|
| 51 | /* Texts */
|
|---|
| 52 | IText PortT[1];
|
|---|
| 53 | IText ObjectT[1];
|
|---|
| 54 |
|
|---|
| 55 | /* Numbers */
|
|---|
| 56 | INumber EquatorialCoordsRN[2];
|
|---|
| 57 | INumber EquatorialCoordsWN[2];
|
|---|
| 58 | INumber SlewAccuracyN[2];
|
|---|
| 59 | INumber TrackAccuracyN[2];
|
|---|
| 60 |
|
|---|
| 61 | /* Switch Vectors */
|
|---|
| 62 | ISwitchVectorProperty ConnectSP;
|
|---|
| 63 | ISwitchVectorProperty OnCoordSetSP;
|
|---|
| 64 | ISwitchVectorProperty AbortSlewSP;
|
|---|
| 65 |
|
|---|
| 66 | /* Number Vectors */
|
|---|
| 67 | INumberVectorProperty EquatorialCoordsRNP;
|
|---|
| 68 | INumberVectorProperty EquatorialCoordsWNP;
|
|---|
| 69 | INumberVectorProperty SlewAccuracyNP;
|
|---|
| 70 | INumberVectorProperty TrackAccuracyNP;
|
|---|
| 71 |
|
|---|
| 72 | /* Text Vectors */
|
|---|
| 73 | ITextVectorProperty PortTP;
|
|---|
| 74 | ITextVectorProperty ObjectTP;
|
|---|
| 75 |
|
|---|
| 76 | /*******************************************************/
|
|---|
| 77 | /* Connection Routines
|
|---|
| 78 | ********************************************************/
|
|---|
| 79 | void init_properties();
|
|---|
| 80 | void get_initial_data();
|
|---|
| 81 | void connect_telescope();
|
|---|
| 82 | bool is_connected(void);
|
|---|
| 83 |
|
|---|
| 84 | /*******************************************************/
|
|---|
| 85 | /* Misc routines
|
|---|
| 86 | ********************************************************/
|
|---|
| 87 | bool process_coords();
|
|---|
| 88 | int get_switch_index(ISwitchVectorProperty *sp);
|
|---|
| 89 |
|
|---|
| 90 | /*******************************************************/
|
|---|
| 91 | /* Simulation Routines
|
|---|
| 92 | ********************************************************/
|
|---|
| 93 | void enable_simulation(bool enable);
|
|---|
| 94 |
|
|---|
| 95 | /*******************************************************/
|
|---|
| 96 | /* Error handling routines
|
|---|
| 97 | ********************************************************/
|
|---|
| 98 | void slew_error(int slewCode);
|
|---|
| 99 | void reset_all_properties();
|
|---|
| 100 | void handle_error(INumberVectorProperty *nvp, int err, const char *msg);
|
|---|
| 101 | void correct_fault();
|
|---|
| 102 |
|
|---|
| 103 | protected:
|
|---|
| 104 |
|
|---|
| 105 | double JD; /* Julian Date */
|
|---|
| 106 | double lastRA;
|
|---|
| 107 | double lastDEC;
|
|---|
| 108 | bool simulation;
|
|---|
| 109 | bool fault;
|
|---|
| 110 | int fd; /* Telescope tty file descriptor */
|
|---|
| 111 |
|
|---|
| 112 | int currentSet;
|
|---|
| 113 | int lastSet;
|
|---|
| 114 |
|
|---|
| 115 | };
|
|---|
| 116 |
|
|---|
| 117 | #endif
|
|---|