| 1 | /* | 
|---|
| 2 | Celestron GPS | 
|---|
| 3 | Copyright (C) 2003 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 ORIONATLAS_H | 
|---|
| 22 | #define ORIONATLAS_H | 
|---|
| 23 |  | 
|---|
| 24 | #include <sys/types.h> | 
|---|
| 25 |  | 
|---|
| 26 | #include "indidevapi.h" | 
|---|
| 27 | #include "indicom.h" | 
|---|
| 28 |  | 
|---|
| 29 | #define RADEC 1 | 
|---|
| 30 | #define AZALT 2 | 
|---|
| 31 |  | 
|---|
| 32 | class OrionAtlas | 
|---|
| 33 | { | 
|---|
| 34 | typedef fd_set telfds; | 
|---|
| 35 |  | 
|---|
| 36 | public: | 
|---|
| 37 | OrionAtlas(); | 
|---|
| 38 | virtual ~OrionAtlas() {} | 
|---|
| 39 |  | 
|---|
| 40 | virtual void ISGetProperties (const char *dev); | 
|---|
| 41 | virtual void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); | 
|---|
| 42 | virtual void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n); | 
|---|
| 43 | virtual void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n); | 
|---|
| 44 | virtual void ISPoll (); | 
|---|
| 45 | virtual void getBasicData(); | 
|---|
| 46 |  | 
|---|
| 47 | int checkPower(INumberVectorProperty *np); | 
|---|
| 48 | int checkPower(ISwitchVectorProperty *sp); | 
|---|
| 49 | int checkPower(ITextVectorProperty *tp); | 
|---|
| 50 | void ConnectTel(); | 
|---|
| 51 | void log(const char *fmt,...); | 
|---|
| 52 | // void slewError(int slewCode); | 
|---|
| 53 | // int handleCoordSet(); | 
|---|
| 54 | // int getOnSwitch(ISwitchVectorProperty *sp); | 
|---|
| 55 |  | 
|---|
| 56 | private: | 
|---|
| 57 | int timeFormat; | 
|---|
| 58 |  | 
|---|
| 59 | int CheckConnectTel(void); | 
|---|
| 60 | int ConnectTel(char *port); | 
|---|
| 61 | void DisconnectTel(void); | 
|---|
| 62 | int GetCoords(int System=RADEC|AZALT); // Retrieve coordinates from scope | 
|---|
| 63 | void UpdateCoords(int System=RADEC|AZALT); // Retrieve coordinates and update INumbers | 
|---|
| 64 | int MoveScope(int System, double Coord1, double Coord2); // move the scope | 
|---|
| 65 |  | 
|---|
| 66 | int TelPortFD; | 
|---|
| 67 | int TelConnectFlag; | 
|---|
| 68 |  | 
|---|
| 69 | double returnRA;    /* Last update of RA */ | 
|---|
| 70 | double returnDec;   /* Last update of Dec */ | 
|---|
| 71 | double returnAz; | 
|---|
| 72 | double returnAlt; | 
|---|
| 73 | //double lat,lon; | 
|---|
| 74 |  | 
|---|
| 75 | int readn(int fd, unsigned char *ptr, int nbytes, int sec); | 
|---|
| 76 | int writen(int fd, unsigned char *ptr, int nbytes); | 
|---|
| 77 | int telstat(int fd,int sec,int usec); | 
|---|
| 78 |  | 
|---|
| 79 | bool Updating; | 
|---|
| 80 | }; | 
|---|
| 81 |  | 
|---|
| 82 | #endif | 
|---|
| 83 |  | 
|---|