kstars
sbigccd.h
Go to the documentation of this file.00001 #if 0
00002 INDI driver for SBIG CCD
00003 Copyright (C) 2005 Chris Curran (ccurran AT planetcurran DOT com)
00004
00005 Based on Apogee PPI driver by Jasem Mutlaq (mutlaqja AT ikarustech DOT com)
00006
00007 This library is free software; you can redistribute it and/or
00008 modify it under the terms of the GNU Lesser General Public
00009 License as published by the Free Software Foundation; either
00010 version 2.1 of the License, or (at your option) any later version.
00011
00012 This library is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015 Lesser General Public License for more details.
00016
00017 You should have received a copy of the GNU Lesser General Public
00018 License along with this library; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020
00021 #endif
00022
00023 #ifndef SBIGCCD_H
00024 #define SBIGCCD_H
00025
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <string.h>
00029 #include <stdarg.h>
00030 #include <math.h>
00031 #include <unistd.h>
00032 #include <time.h>
00033 #include <fcntl.h>
00034 #include <errno.h>
00035
00036 #include "fitsrw.h"
00037 #include "indidevapi.h"
00038 #include "eventloop.h"
00039 #include "indicom.h"
00040
00041 #define mydev "SBIG CCD"
00042
00043 #define COMM_GROUP "Communication"
00044 #define EXPOSE_GROUP "Expose"
00045 #define IMAGE_GROUP "Image Settings"
00046
00047 #define POLLMS 1000
00048 #define TEMP_THRESHOLD .25
00049
00050 #define MAX_PIXELS 4096
00051 #define MAXHBIN 8
00052 #define MAXVBIN 64
00053 #define MIN_CCD_TEMP -60
00054 #define MAX_CCD_TEMP 40
00055
00056 #define getBigEndian(p) ( ((p & 0xff) << 8) | (p >> 8))
00057
00058 class SBIGCam {
00059
00060 public:
00061
00062 SBIGCam();
00063 ~SBIGCam();
00064
00065
00066 void ISGetProperties (const char *dev);
00067 void ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n);
00068 void ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n);
00069 void ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
00070
00071 private:
00072
00073
00074 struct
00075 {
00076 short width;
00077 short height;
00078 int frameType;
00079 int expose;
00080 double temperature;
00081 int binX, binY;
00082 unsigned short *img;
00083 } SBIGFrame;
00084
00085 enum { LIGHT_FRAME , BIAS_FRAME, DARK_FRAME, FLAT_FRAME };
00086
00087
00088 ISwitch PowerS[2];
00089 ISwitch FrameTypeS[4];
00090
00091
00092 INumber FrameN[4];
00093 INumber BinningN[2];
00094 INumber ExposeTimeN[1];
00095 INumber TemperatureN[1];
00096
00097
00098 IBLOB imageB;
00099
00100
00101 ISwitchVectorProperty PowerSP;
00102 ISwitchVectorProperty FrameTypeSP;
00103
00104
00105 INumberVectorProperty FrameNP;
00106 INumberVectorProperty BinningNP;
00107 INumberVectorProperty ExposeTimeNP;
00108 INumberVectorProperty TemperatureNP;
00109
00110
00111
00112 IBLOBVectorProperty imageBP;
00113
00114
00115 double targetTemp;
00116
00117
00118
00119
00120 void initProperties();
00121 bool initCamera();
00122
00123
00124 void getBasicData(void);
00125 void handleExposure(void *);
00126 void connectCCD(void);
00127 void uploadFile(char * filename);
00128 int writeFITS(char *filename, char errmsg[]);
00129 void grabImage(void);
00130 int isCCDConnected(void);
00131
00132
00133 int checkPowerS(ISwitchVectorProperty *sp);
00134 int checkPowerN(INumberVectorProperty *np);
00135 int checkPowerT(ITextVectorProperty *tp);
00136
00137
00138 int manageDefaults(char errmsg[]);
00139 int getOnSwitch(ISwitchVectorProperty *sp);
00140 FITS_HDU_LIST * create_fits_header (FITS_FILE *ofp, uint width, uint height, uint bpp);
00141 static void ISStaticPoll(void *);
00142 void ISPoll();
00143
00144 };
00145
00146 #endif
00147