3 INDI Interface
for Apogee PPI
4 Copyright (C
) 2005 Jasem
Mutlaq (mutlaqja AT ikarustech DOT com
)
6 This library is free software
; you can redistribute it
and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation
; either
9 version
2.1 of the License
, or (at your option
) any later version
.
11 This library is distributed in the hope that it will be useful
,
12 but WITHOUT ANY WARRANTY
; without even the implied warranty of
13 MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE
. See the GNU
14 Lesser General Public License
for more details
.
16 You should have received a copy of the GNU Lesser General Public
17 License along with
this library
; if not, write to the Free Software
18 Foundation
, Inc
., 59 Temple Place
, Suite
330, Boston
, MA
02111-1307 USA
36 #include "indidevapi.h"
37 #include "eventloop.h"
39 #include "apogee/CameraIO_Linux.h"
41 #define mydev "Apogee PPI"
43 #define COMM_GROUP "Communication"
44 #define EXPOSE_GROUP "Expose"
45 #define IMAGE_GROUP "Image Settings"
46 #define DATA_GROUP "Data Channel"
48 #define POLLMS 1000 /* Polling time (ms) */
49 #define TEMP_THRESHOLD .25 /* Differential temperature threshold (C)*/
51 #define MAX_PIXELS 4096
54 #define MIN_CCD_TEMP -60
55 #define MAX_CCD_TEMP 40
56 #define MAXCOLUMNS 16383
58 #define MAXTOTALCOLUMNS 16383
59 #define MAXTOTALROWS 16383
61 #define FILENAMESIZ 2048
62 #define LIBVERSIZ 1024
64 #define PIPEBUFSIZ 8192
67 #define getBigEndian(p) ( ((p & 0xff) << 8) | (p >> 8))
76 /* INDI Functions that must be called from indidrivermain */
77 void ISGetProperties (const char *dev
);
78 void ISNewSwitch (const char *dev
, const char *name
, ISState
*states
, char *names
[], int n
);
79 void ISNewText (const char *dev
, const char *name
, char *texts
[], char *names
[], int n
);
80 void ISNewNumber (const char *dev
, const char *name
, double values
[], char *names
[], int n
);
96 enum { LIGHT_FRAME
, BIAS_FRAME
, DARK_FRAME
, FLAT_FRAME
};
100 ISwitch
*ApogeeModelS
;
101 ISwitch FrameTypeS
[4];
106 INumber ExposeTimeN
[1];
107 INumber TemperatureN
[1];
108 INumber DataChannelN
[1];
114 ISwitchVectorProperty PowerSP
; /* Connection switch */
115 ISwitchVectorProperty ApogeeModelSP
; /* Apogee Model */
116 ISwitchVectorProperty FrameTypeSP
; /* Frame type */
119 INumberVectorProperty FrameNP
; /* Frame specs */
120 INumberVectorProperty BinningNP
; /* Binning */
121 INumberVectorProperty ExposeTimeNP
; /* Exposure */
122 INumberVectorProperty TemperatureNP
; /* Temperature control */
126 IBLOBVectorProperty imageBP
; /* Data stream */
129 static int streamTimerID
; /* Stream ID */
130 double targetTemp
; /* Target temperature */
131 CCameraIO
*cam
; /* Apogee Camera object */
136 void initProperties();
141 void getBasicData(void);
142 void handleExposure(void *);
143 void connectCCD(void);
144 void uploadFile(char * filename
);
145 int writeFITS(char *filename
, char errmsg
[]);
146 int setImageArea(char errmsg
[]);
147 void grabImage(void);
148 int isCCDConnected(void);
151 int checkPowerS(ISwitchVectorProperty
*sp
);
152 int checkPowerN(INumberVectorProperty
*np
);
153 int checkPowerT(ITextVectorProperty
*tp
);
155 /* Helper functions */
156 int manageDefaults(char errmsg
[]);
157 int getOnSwitch(ISwitchVectorProperty
*sp
);
158 FITS_HDU_LIST
* create_fits_header (FITS_FILE
*ofp
, uint width
, uint height
, uint bpp
);
159 static void ISStaticPoll(void *);
161 unsigned short hextoi(char* instr
);