00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef LX200_H
00019 #define LX200_H
00020
00028 class LX200PortException
00029 {
00032 static const char * errorMSG[];
00033 char error[64];
00034
00035 public:
00041 LX200PortException() { strcpy(error, "UNKNOWN_ERROR");}
00052 LX200PortException(int errorType) { strcpy(error, errorMSG[errorType]); }
00053
00055 const char * getError() const {return error;}
00056 };
00057
00058
00089 class LX200
00090 {
00091 public:
00092 LX200();
00093 ~LX200();
00094
00096 enum TSlew { CENTER, GUIDE, MOVE, SLEW};
00098 enum TAlign { ALTAZ, GERMAN, LAND, POLAR};
00100 enum TDirection { EAST, NORTH, SOUTH, WEST};
00104 enum TFormat { LX200SHORT, LX200LONG, LX200UNDEFINED };
00106 enum TTelescope { LX200CLASSIC, LX200AUTOSTAR };
00108 enum TFocus { FOCUSIN, FOCUSOUT, QUITFOCUS, FOCUSFAST, FOCUSSLOW };
00110 enum TTime { TWELVEHOUR, TWENTYFOURHOUR };
00112 enum TObjects { CNGC, IC, UGC};
00114 enum TLibrary { STAR, SAO, GCVS};
00116 enum TFreq { MANUAL, QUARTZ, INCREMENT, DECREMENT};
00117
00121 bool Connect();
00122
00128 bool Connect(const char *portID);
00129
00130
00131
00132
00133
00134
00142 char ACK();
00143
00146 int getHourMode();
00147
00151 double getLX200RA();
00152
00156 double getLX200DEC();
00157
00160 double getObjRA();
00161
00164 double getObjDEC();
00165
00168 double getLX200Alt();
00169
00172 double getLX200Az();
00173
00176 double getSideralTime();
00177
00179 char * getCalenderDate();
00180
00183 double getSiteLaitude();
00184
00187 double getSiteLongitude();
00188
00191 double getLocalTime(int timeFormat);
00192
00194 bool isFINDTypeSelected();
00195
00206 char * getFINDQuality();
00207
00211 int getFINDBoundaryLimit(int boundary);
00212
00216 double getFINDMagnitudeLimit(int boundary);
00217
00221 int getFINDSizeLimit(int boundary);
00222
00224 int getFIELDRadius();
00225
00229 char * getSiteName(int siteNum);
00230
00232 int getUCTOffset();
00233
00235 double getCurrentTrackFreq();
00236
00238 char * getVersionDate();
00240 char * getVersionTime();
00242 char * getFullVersion();
00244 char * getVersionNumber();
00246 char * getProductName();
00247
00251 int getNumberOfBars();
00252
00255 TFormat getLX200Format();
00256
00257
00258
00259
00260
00263 bool setObjAlt(int degrees, int minutes);
00264
00267 bool setObjAz(int degrees, int minutes);
00268
00271 bool setCalendarDate(int dd, int mm, int yy);
00272
00275 bool setSiteLongitude(int degrees, int minutes);
00276
00279 bool setSiteLatitude(int degrees, int minutes);
00280
00284 bool setUTCOffset(int hours);
00285
00288 bool setLocalTime(int hours, int minutes, int seconds);
00289
00294 bool setSiteName(int siteNum, const char * siteName);
00295
00298 bool setObjDEC(int degrees, int minutes, int seconds);
00299
00302 bool setObjRA(int hours, int minutes, int seconds);
00303
00306 bool setSiderealTime(int hours, int minutes, int seconds);
00307
00311 bool setTrackFreq(double Freq);
00312
00320 bool setMaxSlewRate(int slewRate);
00321
00324 void setAlignmentMode(TAlign alignMode);
00325
00328 void setHourMode(TTime hMode);
00329
00332 void setTrackingRate(TFreq tRate);
00333
00336 void selectSite(int siteNum);
00337
00342 bool setFINDMagnitudeLimit(int boundary, double magnitude);
00343
00348 bool setFINDBoundaryLimit(int boundary, int degrees);
00349
00354 bool setFINDSizeLimit(int boundary, int size);
00355
00358 bool setFINDStringType();
00359
00363 bool setFIELDRadius(int radius);
00364
00366 void increaseReticleBrightness();
00368 void descreaseReticleBrightness();
00369
00372 void setReticleFlashingMode(int fMode);
00373
00376 void setLX200Format(TFormat format);
00377
00378
00379
00380
00382 void slewToAltAz();
00383
00386 void move(TDirection dir);
00387
00393 int slewToObj();
00394
00397 void abortMove(TDirection dir);
00398
00400 void abortSlew();
00401
00402
00403
00404
00405
00408 void libraryPrevObj();
00409
00412 void libraryNextObj();
00413
00416 void libraryStartFind();
00417
00422 char * libraryObjInfo();
00423
00424
00426 char * libraryFieldInfo();
00427
00431 void libraryFindCNGC(int identifier);
00432
00436 void libraryFindMessier(int identifier);
00437
00441 void libraryFindStarType(int identifer);
00442
00446 bool librarySetNGCType(TObjects ID);
00447
00451 bool librarySetSTARType(TLibrary ID);
00452
00453
00454
00455
00459 char * Sync();
00460
00462 void turnFanOn();
00463
00465 void turnFanOff();
00466
00469 void startHomeSearch(int SaveSetOption);
00470
00476 int HomeSearchResult();
00477
00480 void fieldDeRotator(bool turnOn);
00481
00484 void focusControl(TFocus fMode);
00485
00488 bool highPrecision();
00489
00493 void toggleSmartDrive (int cToggle);
00494
00495 private:
00496 int fd;
00497 static const char* ports[4];
00498 enum TError { READ_ERROR, WRITE_ERROR, READOUT_ERROR, PORT_ERROR};
00499
00500 TSlew SlewType;
00501 TAlign Alignment;
00502 TDirection Direction;
00503 TFormat LX200Format;
00504 TTelescope Telescope;
00505 TTime timeFormat;
00506 bool LX200Connected;
00507
00508 void queryLX200Format();
00509 void LX200readOut();
00510 bool setStandardProcedure(const char * writeData);
00511
00512 protected:
00516 int openPort(const char *portID);
00517
00521 int portWrite(const char * buf);
00522
00527 int portRead(char *buf, int nbytes);
00528
00532 bool queryData();
00533
00534 };
00535
00536 #endif