indi-sbig-1.0/0000755000175000017500000000000011146555174011040 5ustar jrjrindi-sbig-1.0/ChangeLog0000644000175000017500000000005011110507066012571 0ustar jrjrChangeLog: 2008-10-03 Initial Release. indi-sbig-1.0/.cproject0000644000175000017500000012730111110507066012642 0ustar jrjr indi-sbig-1.0/AUTHORS0000644000175000017500000000022711110507066012075 0ustar jrjrJan Soldan (jsoldan AT asu DOT cas DOT cz) Acknowledgement: Jasem Mutlaq (mutlaqja AT ikarustech DOT com) Matt Longmire (matto AT sbig DOT com) indi-sbig-1.0/.project0000644000175000017500000000460711110507066012502 0ustar jrjr indi_sbig org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, org.eclipse.cdt.make.core.cleanBuildTarget clean org.eclipse.cdt.make.core.enableCleanBuild true ?name? org.eclipse.cdt.make.core.append_environment true org.eclipse.cdt.make.core.stopOnError true org.eclipse.cdt.make.core.buildCommand make org.eclipse.cdt.make.core.contents org.eclipse.cdt.make.core.activeConfigSettings org.eclipse.cdt.make.core.buildLocation ${workspace_loc:/indi_sbig/Debug} org.eclipse.cdt.make.core.useDefaultBuildCmd true org.eclipse.cdt.make.core.enableAutoBuild false org.eclipse.cdt.make.core.enableFullBuild true org.eclipse.cdt.make.core.buildArguments org.eclipse.cdt.make.core.fullBuildTarget all org.eclipse.cdt.make.core.autoBuildTarget all org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder org.eclipse.cdt.core.ccnature org.eclipse.cdt.managedbuilder.core.ScannerConfigNature org.eclipse.cdt.managedbuilder.core.managedBuildNature org.eclipse.cdt.core.cnature indi-sbig-1.0/sbigcam.h0000644000175000017500000005306011110507066012606 0ustar jrjr//============================================================================= #if 0 File name : sbigcam.h Driver type: SBIG CCD Camera INDI Driver Copyright (C) 2005-2006 Jan Soldan (jsoldan AT asu DOT cas DOT cz) 251 65 Ondrejov-236, Czech Republic Acknowledgement: Jasem Mutlaq (mutlaqja AT ikarustech DOT com) Matt Longmire (matto AT sbig DOT com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #endif //============================================================================= #ifndef _SBIG_CAM_ #define _SBIG_CAM_ #include #include #include #include #include #include "sbigudrv.h" // Define INDI if INDI driver should be generated, otherwise only SbigCam class without // INDI support will be generated. #define INDI #define USE_CCD_FRAME_STANDARD_PROPERTY //#define USE_CCD_BINNING_STANDARD_PROPERTY #define USE_BLOB_COMPRESS #ifdef INDI #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #endif using std::string; /* How to use SBIG CFW-10 SA under Linux: 1) If you have a RS-232 port on you computer, localize its serial device. It may look like this one: /dev/ttyS0 In the case you use an USB to RS-232 adapter, the device may be located at: /dev/ttyUSB0 2) Make a symbolic link to this device with the following name: ln -s /dev/ttyUSB0 ~/kdeedu/kstars/kstars/indi/sbigcfw Please note that the SBIG CFW-10 SA _always_ uses device named sbigcfw. 3) Change mode of this device: chmod a+rw /dev/ttyUSB0 4) Inside KStars: a) Open CFW panel b) Set CFW Type to CFW-10 SA c) Press Connect button d) The CFW's detection may take a few seconds due to its internal initialization. */ //============================================================================= const int INVALID_HANDLE_VALUE = -1; // for file operations //============================================================================= // SBIG temperature constants: const double T0 = 25.000; const double MAX_AD = 4096.000; const double R_RATIO_CCD = 2.570; const double R_BRIDGE_CCD = 10.000; const double DT_CCD = 25.000; const double R0 = 3.000; const double R_RATIO_AMBIENT = 7.791; const double R_BRIDGE_AMBIENT = 3.000; const double DT_AMBIENT = 45.000; //============================================================================= // SBIG CCD camera port definitions: #define SBIG_USB0 "sbigusb0" #define SBIG_USB1 "sbigusb1" #define SBIG_USB2 "sbigusb2" #define SBIG_USB3 "sbigusb3" #define SBIG_LPT0 "sbiglpt0" #define SBIG_LPT1 "sbiglpt1" #define SBIG_LPT2 "sbiglpt2" //============================================================================= # ifdef INDI // DEVICE: #define DEVICE_NAME "SBIG" // GROUP: #define CAMERA_GROUP "Camera" #define CFW_GROUP "CFW" #define TEMPERATURE_GROUP "Temperature" #define FRAME_GROUP "Frame" #define EXPOSURE_GROUP "Exposure" // PRODUCT: #define PRODUCT_NAME_T "NAME" #define PRODUCT_LABEL_T "Name" #define PRODUCT_ID_NAME_T "ID" #define PRODUCT_ID_LABEL_T "ID" #define CCD_PRODUCT_NAME_TP "CCD_PRODUCT" #define CCD_PRODUCT_LABEL_TP "Product" #define CFW_PRODUCT_NAME_TP "CFW_PRODUCT" #define CFW_PRODUCT_LABEL_TP "Product" // CONNECT & DISCONNECT: #define CONNECT_NAME_S "CONNECT" #define CONNECT_LABEL_S "Connect" #define DISCONNECT_NAME_S "DISCONNECT" #define DISCONNECT_LABEL_S "Disconnect" #define CCD_CONNECTION_NAME_SP "CONNECTION" #define CCD_CONNECTION_LABEL_SP "Connection" #define CFW_CONNECTION_NAME_SP "CFW_CONNECTION" #define CFW_CONNECTION_LABEL_SP "Connection" // DEVICE PORT: #define PORT_NAME_T "PORT" #define PORT_LABEL_T "Port" #define CCD_DEVICE_PORT_NAME_TP "DEVICE_PORT" #define CCD_DEVICE_PORT_LABEL_TP "Device" // CCD FAN: #define CCD_FAN_ON_NAME_S "ON" #define CCD_FAN_ON_LABEL_S "On" #define CCD_FAN_OFF_NAME_S "OFF" #define CCD_FAN_OFF_LABEL_S "Off" #define CCD_FAN_NAME_SP "CCD_FAN" #define CCD_FAN_LABEL_SP "Fan" // CCD REQUESTS: #define CCD_IMAGING_NAME_S "IMAGING" #define CCD_IMAGING_LABEL_S "Imaging" #define CCD_TRACKING_NAME_S "TRACKING" #define CCD_TRACKING_LABEL_S "Tracking" #define CCD_EXT_TRACKING_NAME_S "EXT_TRACKING" #define CCD_EXT_TRACKING_LABEL_S "Ext.Tracking" #define CCD_REQUEST_NAME_SP "CCD_REQUEST" #define CCD_REQUEST_LABEL_SP "CCD" // CCD COOLER: #define CCD_COOLER_NAME_N "COOLER" #define CCD_COOLER_LABEL_N "[%]" #define CCD_COOLER_NAME_NP "CCD_COOLER" #define CCD_COOLER_LABEL_NP "Cooler" const double CCD_COOLER_THRESHOLD = 95.0; // CCD TEMPERATURE: #define CCD_TEMPERATURE_NAME_N "CCD_TEMPERATURE_VALUE" #define CCD_TEMPERATURE_LABEL_N "[C]" #define CCD_TEMPERATURE_NAME_NP "CCD_TEMPERATURE" #define CCD_TEMPERATURE_LABEL_NP "Temperature" const double MIN_CCD_TEMP = -70.0; const double MAX_CCD_TEMP = 40.0; const double CCD_TEMP_STEP = 0.1; const double DEF_CCD_TEMP = 0.0; const double TEMP_DIFF = 0.5; // CCD TEMPERATURE POOLING: #define CCD_TEMPERATURE_POLLING_NAME_N "TEMPERATURE_POLLING" #define CCD_TEMPERATURE_POLLING_LABEL_N "[sec]" #define CCD_TEMPERATURE_POLLING_NAME_NP "CCD_TEMPERATURE_POLLING" #define CCD_TEMPERATURE_POLLING_LABEL_NP "Polling Time" const double MIN_POLLING_TIME = 1.0; const double MAX_POLLING_TIME = 3600.0; const double STEP_POLLING_TIME = 1.0; const double CUR_POLLING_TIME = 10.0; // CCD TEMPERATURE MSG: #define CCD_TEMPERATURE_MSG_YES_NAME_S "TEMPERATURE_MSG_YES" #define CCD_TEMPERATURE_MSG_YES_LABEL_S "Yes" #define CCD_TEMPERATURE_MSG_NO_NAME_S "TEMPERATURE_MSG_NO" #define CCD_TEMPERATURE_MSG_NO_LABEL_S "No" #define CCD_TEMPERATURE_MSG_NAME_SP "CCD_TEMPERATURE_MSG" #define CCD_TEMPERATURE_MSG_LABEL_SP "Send MSG" // CCD FRAME TYPES: #define CCD_FRAME_LIGHT_NAME_N "FRAME_LIGHT" #define CCD_FRAME_DARK_NAME_N "FRAME_DARK" #define CCD_FRAME_FLAT_NAME_N "FRAME_FLAT" #define CCD_FRAME_BIAS_NAME_N "FRAME_BIAS" #define CCD_FRAME_LIGHT_LABEL_N "Light" #define CCD_FRAME_DARK_LABEL_N "Dark" #define CCD_FRAME_FLAT_LABEL_N "Flat" #define CCD_FRAME_BIAS_LABEL_N "Bias" #define CCD_FRAME_TYPE_NAME_NP "CCD_FRAME_TYPE" #define CCD_FRAME_TYPE_LABEL_NP "Type" // CCD BINNING: const int CCD_BIN_1x1_I = 0; const int CCD_BIN_2x2_I = 1; const int CCD_BIN_3x3_I = 2; const int CCD_BIN_9x9_I = 9; const int CCD_BIN_2x2_E = 7; const int CCD_BIN_3x3_E = 8; #ifdef USE_CCD_BINNING_STANDARD_PROPERTY #define CCD_HOR_BIN_NAME_N "HOR_BIN" #define CCD_HOR_BIN_LABEL_N "Horizontal" #define CCD_VER_BIN_NAME_N "VER_BIN" #define CCD_VER_BIN_LABEL_N "Vertical" #define CCD_BINNING_NAME_NP "CCD_BINNING" #define CCD_BINNING_LABEL_NP "Binning" #define CCD_MIN_BIN 1 #define CCD_MAX_BIN 3 #else #define CCD_BIN_1x1_I_NAME_S "CCD_BIN_1x1_I" #define CCD_BIN_1x1_I_LABEL_S "1x1 On Chip" #define CCD_BIN_2x2_I_NAME_S "CCD_BIN_2x2_I" #define CCD_BIN_2x2_I_LABEL_S "2x2 On Chip" #define CCD_BIN_3x3_I_NAME_S "CCD_BIN_3x3_I" #define CCD_BIN_3x3_I_LABEL_S "3x3 On Chip" #define CCD_BIN_9x9_I_NAME_S "CCD_BIN_9x9_I" #define CCD_BIN_9x9_I_LABEL_S "9x9 On Chip" #define CCD_BIN_2x2_E_NAME_S "CCD_BIN_2x2_E" #define CCD_BIN_2x2_E_LABEL_S "2x2 Off Chip" #define CCD_BIN_3x3_E_NAME_S "CCD_BIN_3x3_E" #define CCD_BIN_3x3_E_LABEL_S "3x3 Off Chip" #define CCD_BINNING_MODE_NAME_SP "CCD_BINNING_MODE" #define CCD_BINNING_MODE_LABEL_SP "Binning" #endif // CCD PIXEL INFO: #define CCD_PIXEL_WIDTH_NAME_N "PIXEL_WIDTH" #define CCD_PIXEL_WIDTH_LABEL_N "Width" #define CCD_PIXEL_HEIGHT_NAME_N "PIXEL_HEIGHT" #define CCD_PIXEL_HEIGHT_LABEL_N "Height" #define CCD_PIXEL_INFO_NAME_NP "CCD_PIXEL_INFO" #define CCD_PIXEL_INFO_LABEL_NP "Pixel Size [um]" // CCD FRAME #ifdef USE_CCD_FRAME_STANDARD_PROPERTY #define CCD_FRAME_X_NAME_N "X" #define CCD_FRAME_X_LABEL_N "Left" #define CCD_FRAME_Y_NAME_N "Y" #define CCD_FRAME_Y_LABEL_N "Top" #define CCD_FRAME_W_NAME_N "WIDTH" #define CCD_FRAME_W_LABEL_N "Width" #define CCD_FRAME_H_NAME_N "HEIGHT" #define CCD_FRAME_H_LABEL_N "Height" #define CCD_FRAME_NAME_NP "CCD_FRAME" #define CCD_FRAME_LABEL_NP "Position" #else // CCD FRAME X: #define CCD_FRAME_X_NAME_N "FRAME_X" #define CCD_FRAME_X_LABEL_N "left" #define CCD_FRAME_X_NAME_NP "CCD_FRAME_X" #define CCD_FRAME_X_LABEL_NP "Position" // CCD FRAME Y: #define CCD_FRAME_Y_NAME_N "FRAME_Y" #define CCD_FRAME_Y_LABEL_N "Top" #define CCD_FRAME_Y_NAME_NP "CCD_FRAME_Y" #define CCD_FRAME_Y_LABEL_NP "Position" // CCD FRAME W: #define CCD_FRAME_W_NAME_N "FRAME_W" #define CCD_FRAME_W_LABEL_N "Width" #define CCD_FRAME_W_NAME_NP "CCD_FRAME_W" #define CCD_FRAME_W_LABEL_NP "Size" // CCD FRAME H: #define CCD_FRAME_H_NAME_N "FRAME_H" #define CCD_FRAME_H_LABEL_N "Height" #define CCD_FRAME_H_NAME_NP "CCD_FRAME_H" #define CCD_FRAME_H_LABEL_NP "Size" #endif // CCD EXPOSE DURATION [s]: #define CCD_EXPOSE_DURATION_NAME_N "CCD_EXPOSURE_VALUE" #define CCD_EXPOSE_DURATION_LABEL_N "[sec]" #define CCD_EXPOSE_DURATION_NAME_NP "CCD_EXPOSURE" #define CCD_EXPOSE_DURATION_LABEL_NP "Time" const double MIN_EXP_TIME = 0.0; const double MAX_EXP_TIME = 3600.0; const double EXP_TIME_STEP = 0.01; const double DEF_EXP_TIME = 1.0; // BLOB: #define BLOB_NAME_B "FITS_BLOB" #define BLOB_LABEL_B "FITS" #define BLOB_NAME_BP "CCD_FITS_BLOB" #define BLOB_LABEL_BP "BLOB" #ifdef USE_BLOB_COMPRESS #define BLOB_FORMAT_B ".fits.z" #else #define BLOB_FORMAT_B ".fits" #endif // FITS file name: #define FITS_NAME_T "NAME" #define FITS_LABEL_T "Name" #define FITS_NAME_TP "FITS_NAME" #define FITS_LABEL_TP "FITS" // CFW TYPES: #define CFW1_NAME_S "CFW1" #define CFW1_LABEL_S "CFW-2" #define CFW2_NAME_S "CFW2" #define CFW2_LABEL_S "CFW-5" #define CFW3_NAME_S "CFW3" #define CFW3_LABEL_S "CFW-6A" #define CFW4_NAME_S "CFW4" #define CFW4_LABEL_S "CFW-8" #define CFW5_NAME_S "CFW5" #define CFW5_LABEL_S "CFW-402" #define CFW6_NAME_S "CFW6" #define CFW6_LABEL_S "CFW-10" #define CFW7_NAME_S "CFW7" #define CFW7_LABEL_S "CFW-10 SA" #define CFW8_NAME_S "CFW8" #define CFW8_LABEL_S "CFW-L" #ifdef USE_CFW_AUTO #define CFW9_NAME_S "CFW9" #define CFW9_LABEL_S "CFW-Auto" const int MAX_CFW_TYPES = 9; #else const int MAX_CFW_TYPES = 8; #endif #define CFW_TYPE_NAME_SP "CFW_TYPE" #define CFW_TYPE_LABEL_SP "Type" // CFW SLOTS: #define CFW_SLOT_NAME_N "SLOT" #define CFW_SLOT_LABEL_N "Slot" #define CFW_SLOT_NAME_NP "FILTER_SLOT" #define CFW_SLOT_LABEL_NP "Goto" const int MIN_FILTER_SLOT = 1; const int MAX_FILTER_SLOT = 10; const int FILTER_SLOT_STEP = 1; const int DEF_FILTER_SLOT = 1; // Auxiliary: #define UNKNOWN_LABEL "Unknown" // INDI timeout: const double INDI_TIMEOUT = 5.0; const int POLL_TEMPERATURE_MS = 10000; // Temperature polling time (ms) const int POLL_EXPOSURE_MS = 1000; // Exposure polling time (ms) // Define byte order: #define GET_BIG_ENDIAN(p) ( ((p & 0xff) << 8) | (p >> 8)) //(((p << 8) & 0xff00) | ((p >> 8) & 0xff)) #endif // INDI //============================================================================= typedef enum { CCD_THERMISTOR, AMBIENT_THERMISTOR }THERMISTOR_TYPE; //============================================================================= class SbigCam { protected: int m_fd; CAMERA_TYPE m_camera_type; int m_drv_handle; bool m_link_status; char m_dev_name[PATH_MAX]; string m_start_exposure_timestamp; #ifdef INDI // CAMERA GROUP: IText m_icam_product_t[2]; ITextVectorProperty m_icam_product_tp; IText m_icam_device_port_t[1]; ITextVectorProperty m_icam_device_port_tp; ISwitch m_icam_connection_s[2]; ISwitchVectorProperty m_icam_connection_sp; // TEMPERATURE GROUP: ISwitch m_icam_fan_state_s[2]; ISwitchVectorProperty m_icam_fan_state_sp; INumber m_icam_temperature_n[1]; INumberVectorProperty m_icam_temperature_np; double m_icam_temperature; INumber m_icam_cooler_n[1]; INumberVectorProperty m_icam_cooler_np; INumber m_icam_temperature_polling_n[1]; INumberVectorProperty m_icam_temperature_polling_np; ISwitch m_icam_temperature_msg_s[2]; ISwitchVectorProperty m_icam_temperature_msg_sp; // FRAME GROUP: ISwitch m_icam_frame_type_s[4]; ISwitchVectorProperty m_icam_frame_type_sp; ISwitch m_icam_ccd_request_s[3]; ISwitchVectorProperty m_icam_ccd_request_sp; #ifdef USE_CCD_BINNING_STANDARD_PROPERTY INumber m_icam_ccd_binning_n[2]; INumberVectorProperty m_icam_ccd_binning_np; #else ISwitch m_icam_binning_mode_s[6]; ISwitchVectorProperty m_icam_binning_mode_sp; #endif INumber m_icam_ccd_info_n[1]; INumberVectorProperty m_icam_ccd_info_np; INumber m_icam_pixel_size_n[2]; INumberVectorProperty m_icam_pixel_size_np; #ifdef USE_CCD_FRAME_STANDARD_PROPERTY INumber m_icam_ccd_frame_n[4]; INumberVectorProperty m_icam_ccd_frame_np; #else INumber m_icam_frame_x_n[1]; INumberVectorProperty m_icam_frame_x_np; INumber m_icam_frame_y_n[1]; INumberVectorProperty m_icam_frame_y_np; INumber m_icam_frame_w_n[1]; INumberVectorProperty m_icam_frame_w_np; INumber m_icam_frame_h_n[1]; INumberVectorProperty m_icam_frame_h_np; #endif // CFW GROUP: IText m_icfw_product_t[2]; ITextVectorProperty m_icfw_product_tp; ISwitch m_icfw_type_s[MAX_CFW_TYPES]; ISwitchVectorProperty m_icfw_type_sp; ISwitch m_icfw_connection_s[2]; ISwitchVectorProperty m_icfw_connection_sp; INumber m_icfw_slot_n[1]; INumberVectorProperty m_icfw_slot_np; // EXPOSURE GROUP: INumber m_icam_expose_time_n[1]; INumberVectorProperty m_icam_expose_time_np; double m_icam_expose_time; // INDI BLOBs: IBLOB m_icam_fits_b; IBLOBVectorProperty m_icam_fits_bp; // FITS file name: IText m_icam_fits_name_t[1]; ITextVectorProperty m_icam_fits_name_tp; #endif // INDI public: SbigCam(); SbigCam(const char* device_name); virtual ~SbigCam(); inline int GetFileDescriptor(){return(m_fd);} inline void SetFileDescriptor(int val = -1){m_fd = val;} inline bool IsDeviceOpen(){return((m_fd == -1) ? false : true);} inline CAMERA_TYPE GetCameraType(){return(m_camera_type);} inline void SetCameraType(CAMERA_TYPE val = NO_CAMERA){m_camera_type = val;} inline int GetDriverHandle(){return(m_drv_handle);} inline void SetDriverHandle(int val = INVALID_HANDLE_VALUE){m_drv_handle = val;} inline bool GetLinkStatus(){return(m_link_status);} inline void SetLinkStatus(bool val = false){m_link_status = val;} inline char *GetDeviceName(){return(m_dev_name);} int SetDeviceName(const char*); inline string GetStartExposureTimestamp(){return(m_start_exposure_timestamp);} inline void SetStartExposureTimestamp(const char *p) { m_start_exposure_timestamp = p; } // Driver Related Commands: int GetCfwSelType(); int OpenDevice(const char *name); int CloseDevice(); int GetDriverInfo(GetDriverInfoParams *, void *); int SetDriverHandle(SetDriverHandleParams *); int GetDriverHandle(GetDriverHandleResults *); // Exposure Related Commands: int StartExposure(StartExposureParams *); int EndExposure(EndExposureParams *); int StartReadout(StartReadoutParams *); int ReadoutLine(ReadoutLineParams *, unsigned short *results, bool subtract); int DumpLines(DumpLinesParams *); int EndReadout(EndReadoutParams *); // Temperature Related Commands: int SetTemperatureRegulation(SetTemperatureRegulationParams *); int SetTemperatureRegulation(double temp, bool enable = true); int QueryTemperatureStatus(QueryTemperatureStatusResults *); int QueryTemperatureStatus(bool &enabled, double &ccdTemp, double &setpointT, double &power); // External Control Commands: int ActivateRelay(ActivateRelayParams *); int PulseOut(PulseOutParams *); int TxSerialBytes(TXSerialBytesParams *, TXSerialBytesResults *); int GetSerialStatus(GetSerialStatusResults *); int AoTipTilt(AOTipTiltParams *); int AoSetFocus(AOSetFocusParams *); int AoDelay(AODelayParams *); int Cfw(CFWParams *, CFWResults *); // General Purpose Commands: int EstablishLink(); int GetCcdInfo(GetCCDInfoParams *, void *); int QueryCommandStatus( QueryCommandStatusParams *, QueryCommandStatusResults *); int MiscellaneousControl(MiscellaneousControlParams *); int ReadOffset(ReadOffsetParams *, ReadOffsetResults *); int GetLinkStatus(GetLinkStatusResults *); string GetErrorString(int err); int SetDriverControl(SetDriverControlParams *); int GetDriverControl(GetDriverControlParams *, GetDriverControlResults *); int UsbAdControl(USBADControlParams *); int QueryUsb(QueryUSBResults *); int RwUsbI2c(RWUSBI2CParams *); int BitIo(BitIOParams *, BitIOResults *); // SBIG's software interface to the Universal Driver Library function: int SBIGUnivDrvCommand(PAR_COMMAND, void *, void *); // High level functions: bool CheckLink(); string GetCameraName(); string GetCameraID(); int GetCcdSizeInfo( int ccd, int rm, int &frmW, int &frmH, double &pixW, double &pixH); int GetNumOfCcdChips(); bool IsFanControlAvailable(); #ifdef INDI void ISGetProperties(); void ISNewSwitch( const char *name, ISState *states, char *names[], int num); void ISNewText( const char *name, char *texts[], char *names[], int num); void ISNewNumber(const char *name, double values[], char *names[], int num); int UpdateCcdFrameProperties(bool bUpdateClient = false); int GetCcdTemperaturePoolingTime(); int UpdateProperties(); int UpdateCfwProperties(); int StartExposure(); int StopExposure(); bool CheckConnection(ISwitchVectorProperty *sp); bool CheckConnection(INumberVectorProperty *np); bool CheckConnection(ITextVectorProperty *tp); int GetSelectedCcdChip(int &ccd_request); int GetSelectedCcdBinningMode(int &binning); int GetSelectedCcdFrameType(string &frame_type); int GetCcdShutterMode(int &shutter, int ccd_request); int CfwConnect(); int CfwDisconnect(); int CfwOpenDevice(CFWResults *); int CfwCloseDevice(CFWResults *); int CfwInit(CFWResults *); int CfwGetInfo(CFWResults *); int CfwQuery(CFWResults*); int CfwGoto(CFWResults *); int CfwGotoMonitor(CFWResults *); void CfwShowResults(string name, CFWResults); void CfwUpdateProperties(CFWResults); void SetBlobState(IPState state); unsigned short *AllocateBuffer(unsigned short width, unsigned short height); int ReleaseBuffer(unsigned short height, unsigned short *buffer); int ReadoutCcd( unsigned short left, unsigned short top, unsigned short width, unsigned short height, unsigned short *buffer); string CreateFitsName(); int WriteFits( string fits_name, unsigned short width, unsigned short height, unsigned short *buffer); /* FIXME use CFITSIO FITS_HDU_LIST *CreateFitsHeader( FITS_FILE *fp, unsigned int width, unsigned int height);*/ void CreateFitsHeader(fitsfile *fptr, unsigned int width, unsigned int height); int UploadFits(string file_name); void UpdateTemperature(); void UpdateExposure(); static void UpdateTemperature(void *); static void UpdateExposure(void *); inline void SaveExposeTime(double val){m_icam_expose_time = val;} inline double GetExposeTime(){return(m_icam_expose_time);} inline double GetLastExposeTime(){return(m_icam_expose_time);} inline void SaveTemperature(double val){m_icam_temperature = val;} inline double GetLastTemperature(){return(m_icam_temperature);} #endif protected: void InitVars(); int OpenDriver(); int CloseDriver(); unsigned short CalcSetpoint(double temperature); double CalcTemperature(short thermistorType, short ccdSetpoint); double BcdPixel2double(ulong bcd); }; //============================================================================= #endif //_SBIG_CAM_ indi-sbig-1.0/sbigudrv.h0000644000175000017500000005576611110507066013045 0ustar jrjr/* SBIGUDRV.H Contains the function prototypes and enumerated constants for the Universal Parallel/USB/Ethernet driver. This supports the following devices: ST-7E/8E/9E/10E ST-5C/237/237A (PixCel255/237) ST-1K, ST-2K ST-L Large Format Camera ST-402 Camera AO-7, AOL Version 4.47 - December 13,2005 (c)1995-2005 - Santa Barbara Instrument Group Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the SBIG nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _PARDRV_ #define _PARDRV_ /* SBIG Specific Code */ #ifndef TARGET #define ENV_WIN 1 /* Target for Windows environment */ #define ENV_WINVXD 2 /* SBIG Use Only, Win 9X VXD */ #define ENV_WINSYS 3 /* SBIG Use Only, Win NT SYS */ #define ENV_ESRVJK 4 /* SBIG Use Only, Ethernet Remote */ #define ENV_ESRVWIN 5 /* SBIG Use Only, Ethernet Remote */ #define ENV_MACOSX 6 /* SBIG Use Only, Mac OSX */ #define ENV_LINUX 7 /* SBIG Use Only, Linux */ #define TARGET ENV_LINUX /* Set for your target */ #endif /* Enumerated Constants Note that the various constants are declared here as enums for ease of declaration but in the structures that use the enums unsigned shorts are used to force the various 16 and 32 bit compilers to use 16 bits. */ /* Supported Camera Commands These are the commands supported by the driver. They are prefixed by CC_ to designate them as camera commands and avoid conflicts with other enums. Some of the commands are marked as SBIG use only and have been included to enhance testability of the driver for SBIG. */ typedef enum { /* General Use Commands */ CC_NULL, /* 1 - 10 */ CC_START_EXPOSURE=1, CC_END_EXPOSURE, CC_READOUT_LINE, CC_DUMP_LINES, CC_SET_TEMPERATURE_REGULATION, CC_QUERY_TEMPERATURE_STATUS, CC_ACTIVATE_RELAY, CC_PULSE_OUT, CC_ESTABLISH_LINK, CC_GET_DRIVER_INFO, /* 11 - 20 */ CC_GET_CCD_INFO, CC_QUERY_COMMAND_STATUS, CC_MISCELLANEOUS_CONTROL, CC_READ_SUBTRACT_LINE, CC_UPDATE_CLOCK, CC_READ_OFFSET, CC_OPEN_DRIVER, CC_CLOSE_DRIVER, CC_TX_SERIAL_BYTES, CC_GET_SERIAL_STATUS, /* 21 - 30 */ CC_AO_TIP_TILT, CC_AO_SET_FOCUS, CC_AO_DELAY, CC_GET_TURBO_STATUS, CC_END_READOUT, CC_GET_US_TIMER, CC_OPEN_DEVICE, CC_CLOSE_DEVICE, CC_SET_IRQL, CC_GET_IRQL, /* 31 - 40 */ CC_GET_LINE, CC_GET_LINK_STATUS, CC_GET_DRIVER_HANDLE, CC_SET_DRIVER_HANDLE, CC_START_READOUT, CC_GET_ERROR_STRING, CC_SET_DRIVER_CONTROL, CC_GET_DRIVER_CONTROL, CC_USB_AD_CONTROL, CC_QUERY_USB, /* 41 - 50 */ CC_GET_PENTIUM_CYCLE_COUNT, CC_RW_USB_I2C, CC_CFW, CC_BIT_IO, CC_USER_EEPROM, CC_AO_CENTER, CC_BTDI_SETUP, CC_MOTOR_FOCUS, /* SBIG Use Only Commands */ CC_SEND_BLOCK=90, CC_SEND_BYTE, CC_GET_BYTE, CC_SEND_AD, CC_GET_AD, CC_CLOCK_AD, CC_SYSTEM_TEST, CC_GET_DRIVER_OPTIONS, CC_SET_DRIVER_OPTIONS, CC_LAST_COMMAND} PAR_COMMAND; /* Return Error Codes These are the error codes returned by the driver function. They are prefixed with CE_ to designate them as camera errors. */ #ifndef CE_ERROR_BASE #define CE_ERROR_BASE 1 #endif typedef enum { /* 0 - 10 */ CE_NO_ERROR, CE_CAMERA_NOT_FOUND=CE_ERROR_BASE, CE_EXPOSURE_IN_PROGRESS, CE_NO_EXPOSURE_IN_PROGRESS, CE_UNKNOWN_COMMAND, CE_BAD_CAMERA_COMMAND, CE_BAD_PARAMETER, CE_TX_TIMEOUT, CE_RX_TIMEOUT, CE_NAK_RECEIVED, CE_CAN_RECEIVED, /* 11 - 20 */ CE_UNKNOWN_RESPONSE, CE_BAD_LENGTH, CE_AD_TIMEOUT, CE_KBD_ESC, CE_CHECKSUM_ERROR, CE_EEPROM_ERROR, CE_SHUTTER_ERROR, CE_UNKNOWN_CAMERA, CE_DRIVER_NOT_FOUND, CE_DRIVER_NOT_OPEN, /* 21 - 30 */ CE_DRIVER_NOT_CLOSED, CE_SHARE_ERROR, CE_TCE_NOT_FOUND, CE_AO_ERROR, CE_ECP_ERROR, CE_MEMORY_ERROR, CE_DEVICE_NOT_FOUND, CE_DEVICE_NOT_OPEN, CE_DEVICE_NOT_CLOSED, CE_DEVICE_NOT_IMPLEMENTED, /* 31 - 40 */ CE_DEVICE_DISABLED, CE_OS_ERROR, CE_SOCK_ERROR, CE_SERVER_NOT_FOUND, CE_CFW_ERROR, CE_MF_ERROR, CE_NEXT_ERROR, CE_FAKE_DRIVER } PAR_ERROR; /* Camera Command State Codes These are the return status codes for the Query Command Status command. Theyt are prefixed with CS_ to designate them as camera status. */ typedef enum { CS_IDLE, CS_IN_PROGRESS, CS_INTEGRATING, CS_INTEGRATION_COMPLETE } PAR_COMMAND_STATUS; #define CS_PULSE_IN_ACTIVE 0x8000 #define CS_WAITING_FOR_TRIGGER 0x8000 /* Misc. Enumerated Constants ABG_STATE7 - Passed to Start Exposure Command MY_LOGICAL - General purpose type DRIVER_REQUEST - Used with Get Driver Info command CCD_REQUEST - Used with Imaging commands to specify CCD CCD_INFO_REQUEST - Used with Get CCD Info Command PORT - Used with Establish Link Command CAMERA_TYPE - Returned by Establish Link and Get CCD Info commands SHUTTER_COMMAND, SHUTTER_STATE7 - Used with Start Exposure and Miscellaneous Control Commands TEMPERATURE_REGULATION - Used with Enable Temperature Regulation LED_STATE - Used with the Miscellaneous Control Command FILTER_COMMAND, FILTER_STATE - Used with the Miscellaneous Control Command AD_SIZE, FILTER_TYPE - Used with the GetCCDInfo3 Command AO_FOCUS_COMMAND - Used with the AO Set Focus Command SBIG_DEVICE_TYPE - Used with Open Device Command DRIVER_CONTROL_PARAMS - Used with Get/SetDriverControl Command USB_AD_CONTROL_COMMAND - Used with UsbADControl Command CFW_MODEL_SELECT, CFW_STATUS, CFW_ERROR - Used with CFW command CFW_POSITION, CFW_GET_INFO_SELECT - Used with CFW Command BIT_IO_OPERATION, BIT_IO_NMAE - Used with BitIO command MF_MODEL_SELECT, MF_STATUS, MF_ERROR, MF_GET_INFO_SELECT - Used with Motor Focus Command */ typedef enum { ABG_LOW7, ABG_CLK_LOW7, ABG_CLK_MED7, ABG_CLK_HI7 } ABG_STATE7; typedef unsigned short MY_LOGICAL; #define FALSE 0 #define TRUE 1 typedef enum { DRIVER_STD, DRIVER_EXTENDED, DRIVER_USB_LOADER } DRIVER_REQUEST; typedef enum { CCD_IMAGING, CCD_TRACKING, CCD_EXT_TRACKING } CCD_REQUEST; typedef enum { RM_1X1, RM_2X2, RM_3X3, RM_NX1, RM_NX2, RM_NX3, RM_1X1_VOFFCHIP, RM_2X2_VOFFCHIP, RM_3X3_VOFFCHIP, RM_9X9 } READOUT_BINNING_MODE; typedef enum { CCD_INFO_IMAGING, CCD_INFO_TRACKING, CCD_INFO_EXTENDED, CCD_INFO_EXTENDED_5C, CCD_INFO_EXTENDED2_IMAGING, CCD_INFO_EXTENDED2_TRACKING } CCD_INFO_REQUEST; typedef enum { ABG_NOT_PRESENT, ABG_PRESENT } IMAGING_ABG; typedef enum { BR_AUTO, BR_9600, BR_19K, BR_38K, BR_57K, BR_115K } PORT_RATE; typedef enum { ST7_CAMERA=4, ST8_CAMERA, ST5C_CAMERA, TCE_CONTROLLER, ST237_CAMERA, STK_CAMERA, ST9_CAMERA, STV_CAMERA, ST10_CAMERA, ST1K_CAMERA, ST2K_CAMERA, STL_CAMERA, ST402_CAMERA, STH_CAMERA, ST4K_CAMERA, NEXT_CAMERA, NO_CAMERA=0xFFFF } CAMERA_TYPE; typedef enum { SC_LEAVE_SHUTTER, SC_OPEN_SHUTTER, SC_CLOSE_SHUTTER, SC_INITIALIZE_SHUTTER, SC_OPEN_EXT_SHUTTER, SC_CLOSE_EXT_SHUTTER} SHUTTER_COMMAND; typedef enum { SS_OPEN, SS_CLOSED, SS_OPENING, SS_CLOSING } SHUTTER_STATE7; typedef enum { REGULATION_OFF, REGULATION_ON, REGULATION_OVERRIDE, REGULATION_FREEZE, REGULATION_UNFREEZE, REGULATION_ENABLE_AUTOFREEZE, REGULATION_DISABLE_AUTOFREEZE } TEMPERATURE_REGULATION; #define REGULATION_FROZEN_MASK 0x8000 typedef enum { LED_OFF, LED_ON, LED_BLINK_LOW, LED_BLINK_HIGH } LED_STATE; typedef enum { FILTER_LEAVE, FILTER_SET_1, FILTER_SET_2, FILTER_SET_3, FILTER_SET_4, FILTER_SET_5, FILTER_STOP, FILTER_INIT } FILTER_COMMAND; typedef enum { FS_MOVING, FS_AT_1, FS_AT_2, FS_AT_3, FS_AT_4, FS_AT_5, FS_UNKNOWN } FILTER_STATE; typedef enum { AD_UNKNOWN, AD_12_BITS, AD_16_BITS } AD_SIZE; typedef enum { FW_UNKNOWN, FW_EXTERNAL, FW_VANE, FW_FILTER_WHEEL } FILTER_TYPE; typedef enum { AOF_HARD_CENTER, AOF_SOFT_CENTER, AOF_STEP_IN, AOF_STEP_OUT } AO_FOCUS_COMMAND; typedef enum { DEV_NONE, DEV_LPT1, DEV_LPT2, DEV_LPT3, DEV_USB=0x7F00, DEV_ETH, DEV_USB1, DEV_USB2, DEV_USB3, DEV_USB4 } SBIG_DEVICE_TYPE; typedef enum { DCP_USB_FIFO_ENABLE, DCP_CALL_JOURNAL_ENABLE, DCP_IVTOH_RATIO, DCP_USB_FIFO_SIZE, DCP_USB_DRIVER, DCP_KAI_RELGAIN, DCP_USB_PIXEL_DL_ENABLE, DCP_HIGH_THROUGHPUT, DCP_VDD_OPTIMIZED, DCP_AUTO_AD_GAIN, DCP_NO_HCLKS_FOR_INTEGRATION, DCP_TDI_MODE_ENABLE, DCP_VERT_FLUSH_CONTROL_ENABLE, DCP_ETHERNET_PIPELINE_ENABLE, DCP_LAST } DRIVER_CONTROL_PARAM; typedef enum { USB_AD_IMAGING_GAIN, USB_AD_IMAGING_OFFSET, USB_AD_TRACKING_GAIN, USB_AD_TRACKING_OFFSET } USB_AD_CONTROL_COMMAND; typedef enum { USBD_SBIGE, USBD_SBIGI, USBD_SBIGM, USBD_NEXT } ENUM_USB_DRIVER; typedef enum { CFWSEL_UNKNOWN, CFWSEL_CFW2, CFWSEL_CFW5, CFWSEL_CFW8, CFWSEL_CFWL, CFWSEL_CFW402, CFWSEL_AUTO, CFWSEL_CFW6A, CFWSEL_CFW10, CFWSEL_CFW10_SERIAL, CFWSEL_CFW9, CFWSEL_CFWL8, CFWSEL_CFWL8G } CFW_MODEL_SELECT; typedef enum { CFWC_QUERY, CFWC_GOTO, CFWC_INIT, CFWC_GET_INFO, CFWC_OPEN_DEVICE, CFWC_CLOSE_DEVICE } CFW_COMMAND; typedef enum { CFWS_UNKNOWN, CFWS_IDLE, CFWS_BUSY } CFW_STATUS; typedef enum { CFWE_NONE, CFWE_BUSY, CFWE_BAD_COMMAND, CFWE_CAL_ERROR, CFWE_MOTOR_TIMEOUT, CFWE_BAD_MODEL, CFWE_DEVICE_NOT_CLOSED, CFWE_DEVICE_NOT_OPEN, CFWE_I2C_ERROR } CFW_ERROR; typedef enum { CFWP_UNKNOWN, CFWP_1, CFWP_2, CFWP_3, CFWP_4, CFWP_5, CFWP_6, CFWP_7, CFWP_8, CFWP_9, CFWP_10} CFW_POSITION; typedef enum { CFWPORT_COM1=1, CFWPORT_COM2, CFWPORT_COM3, CFWPORT_COM4 } CFW_COM_PORT; typedef enum { CFWG_FIRMWARE_VERSION, CFWG_CAL_DATA, CFWG_DATA_REGISTERS } CFW_GETINFO_SELECT; typedef enum { BITIO_WRITE, BITIO_READ } BITIO_OPERATION; typedef enum { BITI_PS_LOW, BITO_IO1, BITO_IO2, BITI_IO3, BITO_FPGA_WE } BITIO_NAME; typedef enum { BTDI_SCHEDULE_ERROR=1, BTDI_OVERRUN_ERROR=2 } BTDI_ERROR; typedef enum { MFSEL_UNKNOWN, MFSEL_AUTO, MFSEL_STF } MF_MODEL_SELECT; typedef enum { MFC_QUERY, MFC_GOTO, MFC_INIT, MFC_GET_INFO, MFC_ABORT } MF_COMMAND; typedef enum { MFS_UNKNOWN, MFS_IDLE, MFS_BUSY } MF_STATUS; typedef enum { MFE_NONE, MFE_BUSY, MFE_BAD_COMMAND, MFE_CAL_ERROR, MFE_MOTOR_TIMEOUT, MFE_BAD_MODEL, MFE_I2C_ERROR, MFE_NOT_FOUND } MF_ERROR; typedef enum { MFG_FIRMWARE_VERSION, MFG_DATA_REGISTERS } MF_GETINFO_SELECT; /* General Purpose Flags */ #define END_SKIP_DELAY 0x8000 /* set in ccd parameter of EndExposure command to skip synchronization delay - Use this to increase the rep rate when taking darks to later be subtracted from SC_LEAVE_SHUTTER exposures such as when tracking and imaging */ #define START_SKIP_VDD 0x8000 /* set in ccd parameter of StartExposure command to skip lowering Imaging CCD Vdd during integration. - Use this to increase the rep rate when you don't care about glow in the upper-left corner of the imaging CCD */ #define START_MOTOR_ALWAYS_ON 0x4000 /* set in ccd parameter of StartExposure and EndExposure commands to force shutter motor to stay on all the time which reduces delays in Start and End Exposure timing and yields higher image throughput. Don't do this too often or camera head will heat up */ #define EXP_WAIT_FOR_TRIGGER_IN 0x80000000 /* set in exposureTime to wait for trigger in pulse */ #define EXP_SEND_TRIGGER_OUT 0x40000000 /* set in exposureTime to send trigger out Y- */ #define EXP_LIGHT_CLEAR 0x20000000 /* set to do light clear of the CCD */ #define EXP_MS_EXPOSURE 0x10000000 /* set to interpret exposure time as milliseconds */ #define EXP_TIME_MASK 0x00FFFFFF /* mask with exposure time to remove flags */ /* Capabilities Bits - Bit Field Definitions for the capabilitiesBits in the GetCCDInfoResults4 struct. */ #define CB_CCD_TYPE_MASK 0x0001 /* mask for CCD type */ #define CB_CCD_TYPE_FULL_FRAME 0x0000 /* b0=0 is full frame CCD */ #define CB_CCD_TYPE_FRAME_TRANSFER 0x0001 /* b0=1 is frame transfer CCD */ #define CB_CCD_ESHUTTER_MASK 0x0002 /* mask for electronic shutter type */ #define CB_CCD_ESHUTTER_NO 0x0000 /* b1=0 indicates no electronic shutter */ #define CB_CCD_ESHUTTER_YES 0x0002 /* b1=1 indicates electronic shutter */ #define CB_CCD_EXT_TRACKER_MASK 0x0004 /* mask for external tracker support */ #define CB_CCD_EXT_TRACKER_NO 0x0000 /* b2=0 indicates no external tracker support */ #define CB_CCD_EXT_TRACKER_YES 0x0004 /* b2=1 indicates external tracker support */ #define CB_CCD_BTDI_MASK 0x0008 /* mask for BTDI support */ #define CB_CCD_BTDI_NO 0x0000 /* b3=0 indicates no BTDI support */ #define CB_CCD_BTDI_YES 0x0008 /* b3=1 indicates BTDI support */ #define CB_AO8_MASK 0x0010 /* mask for AO-8 detected */ #define CB_AO8_NO 0x0000 /* b4=0 indicates no AO-8 detected */ #define CB_AO8_YES 0x0010 /* b4=1 indicates AO-8 detected */ /* Defines */ #define MIN_ST7_EXPOSURE 12 /* Minimum exposure in 1/100ths second */ #define MIN_ST402_EXPOSURE 4 /* Minimum exposure in 1/100ths second */ #define MIN_ST3200_EXPOSURE 9 /* Minimum exposure in 1/100ths second */ #define MIN_STH_EXPOSURE 1 /* Minimum exposure in 1/100ths second */ /* Command Parameter and Results Structs Make sure you set your compiler for byte structure alignment as that is how the driver was built. */ /* Force 8 Byte Struct Align but not in Sun Studio 12 */ #ifndef __SUNPRO_CC #if TARGET == ENV_MACOSX || TARGET == ENV_LINUX #pragma pack(push,8) #else #pragma pack(push) #pragma pack(8) #endif #endif typedef struct { unsigned short /* CCD_REQUEST */ ccd; unsigned long exposureTime; unsigned short /* ABG_STATE7 */ abgState; unsigned short /* SHUTTER_COMMAND */ openShutter; } StartExposureParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; } EndExposureParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; unsigned short readoutMode; unsigned short pixelStart; unsigned short pixelLength; } ReadoutLineParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; unsigned short readoutMode; unsigned short lineLength; } DumpLinesParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; } EndReadoutParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; unsigned short readoutMode; unsigned short top; unsigned short left; unsigned short height; unsigned short width; } StartReadoutParams; typedef struct { unsigned short /* TEMPERATURE_REGULATION */ regulation; unsigned short ccdSetpoint; } SetTemperatureRegulationParams; typedef struct { MY_LOGICAL enabled; unsigned short ccdSetpoint; unsigned short power; unsigned short ccdThermistor; unsigned short ambientThermistor; } QueryTemperatureStatusResults; typedef struct { unsigned short tXPlus; unsigned short tXMinus; unsigned short tYPlus; unsigned short tYMinus; } ActivateRelayParams; typedef struct { unsigned short numberPulses; unsigned short pulseWidth; unsigned short pulsePeriod; } PulseOutParams; typedef struct { unsigned short dataLength; unsigned char data[256]; } TXSerialBytesParams; typedef struct { unsigned short bytesSent; } TXSerialBytesResults; typedef struct { MY_LOGICAL clearToCOM; } GetSerialStatusResults; typedef struct { unsigned short sbigUseOnly; } EstablishLinkParams; typedef struct { unsigned short /* CAMERA_TYPE */ cameraType; } EstablishLinkResults; typedef struct { unsigned short /* DRIVER_REQUEST */ request; } GetDriverInfoParams; typedef struct { unsigned short version; char name[64]; unsigned short maxRequest; } GetDriverInfoResults0; typedef struct { unsigned short /* CCD_INFO_REQUEST */ request; } GetCCDInfoParams; typedef struct { unsigned short mode; unsigned short width; unsigned short height; unsigned short gain; unsigned long pixel_width; unsigned long pixel_height; } READOUT_INFO; typedef struct { unsigned short firmwareVersion; unsigned short /* CAMERA_TYPE */ cameraType; char name[64]; unsigned short readoutModes; struct { unsigned short mode; unsigned short width; unsigned short height; unsigned short gain; unsigned long pixelWidth; unsigned long pixelHeight; } readoutInfo[20]; } GetCCDInfoResults0; typedef struct { unsigned short badColumns; unsigned short columns[4]; unsigned short /* IMAGING_ABG */ imagingABG; char serialNumber[10]; } GetCCDInfoResults2; typedef struct { unsigned short /* AD_SIZE */ adSize; unsigned short /* FILTER_TYPE */ filterType; } GetCCDInfoResults3; typedef struct { unsigned short capabilitiesBits; unsigned short dumpExtra; } GetCCDInfoResults4; typedef struct { unsigned short command; } QueryCommandStatusParams; typedef struct { unsigned short status; } QueryCommandStatusResults; typedef struct { MY_LOGICAL fanEnable; unsigned short /* SHUTTER_COMMAND */ shutterCommand; unsigned short /* LED_STATE */ ledState; } MiscellaneousControlParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; } ReadOffsetParams; typedef struct { unsigned short offset; } ReadOffsetResults; typedef struct { unsigned short xDeflection; unsigned short yDeflection; } AOTipTiltParams; typedef struct { unsigned short /* AO_FOCUS_COMMAND */ focusCommand; } AOSetFocusParams; typedef struct { unsigned long delay; } AODelayParams; typedef struct { MY_LOGICAL turboDetected; } GetTurboStatusResults; typedef struct { unsigned short deviceType; /* SBIG_DEVICE_TYPE, specifies LPT, Ethernet, etc */ unsigned short lptBaseAddress; /* DEV_LPTN: Windows 9x Only, Win NT uses deviceSelect */ unsigned long ipAddress; /* DEV_ETH: Ethernet address */ } OpenDeviceParams; typedef struct { unsigned short level; } SetIRQLParams; typedef struct { unsigned short level; } GetIRQLResults; typedef struct { MY_LOGICAL linkEstablished; unsigned short baseAddress; unsigned short /* CAMERA_TYPE */ cameraType; unsigned long comTotal; unsigned long comFailed; } GetLinkStatusResults; typedef struct { unsigned long count; } GetUSTimerResults; typedef struct { unsigned short port; unsigned short length; unsigned char *source; } SendBlockParams; typedef struct { unsigned short port; unsigned short data; } SendByteParams; typedef struct { unsigned short /* CCD_REQUEST */ ccd; unsigned short readoutMode; unsigned short pixelStart; unsigned short pixelLength; } ClockADParams; typedef struct { unsigned short testClocks; unsigned short testMotor; unsigned short test5800; unsigned short stlAlign; unsigned short motorAlwaysOn; } SystemTestParams; typedef struct { unsigned short outLength; unsigned char *outPtr; unsigned short inLength; unsigned char *inPtr; } SendSTVBlockParams; typedef struct { unsigned short errorNo; } GetErrorStringParams; typedef struct { char errorString[64]; } GetErrorStringResults; typedef struct { short handle; } SetDriverHandleParams; typedef struct { short handle; } GetDriverHandleResults; typedef struct { unsigned short /* DRIVER_CONTROL_PARAM */ controlParameter; unsigned long controlValue; } SetDriverControlParams; typedef struct { unsigned short /* DRIVER_CONTROL_PARAM */ controlParameter; } GetDriverControlParams; typedef struct { unsigned long controlValue; } GetDriverControlResults; typedef struct { unsigned short /* USB_AD_CONTROL_COMMAND */ command; short data; } USBADControlParams; typedef struct { MY_LOGICAL cameraFound; unsigned short /* CAMERA_TYPE */ cameraType; char name[64]; char serialNumber[10]; } QUERY_USB_INFO; typedef struct { unsigned short camerasFound; QUERY_USB_INFO usbInfo[4]; } QueryUSBResults; typedef struct { unsigned short rightShift; } GetPentiumCycleCountParams; typedef struct { unsigned long countLow; unsigned long countHigh; } GetPentiumCycleCountResults; typedef struct { unsigned char address; unsigned char data; MY_LOGICAL write; unsigned char deviceAddress; } RWUSBI2CParams; typedef struct { unsigned char data; } RWUSBI2CResults; typedef struct { unsigned short /* CFW_MODEL_SELECT */ cfwModel; unsigned short /* CFW_COMMAND */ cfwCommand; unsigned long cfwParam1; unsigned long cfwParam2; unsigned short outLength; unsigned char *outPtr; unsigned short inLength; unsigned char *inPtr; } CFWParams; typedef struct { unsigned short /* CFW_MODEL_SELECT */ cfwModel; unsigned short /* CFW_POSITION */ cfwPosition; unsigned short /* CFW_STATUS */ cfwStatus; unsigned short /* CFW_ERROR */ cfwError; unsigned long cfwResult1; unsigned long cfwResult2; } CFWResults; typedef struct { unsigned short /* BITIO_OPERATION */ bitOperation; unsigned short /* BITIO_NAME */ bitName; MY_LOGICAL setBit; } BitIOParams; typedef struct { MY_LOGICAL bitIsSet; } BitIOResults; typedef struct { MY_LOGICAL writeData; unsigned char data[32]; } UserEEPROMParams, UserEEPROMResults; typedef struct { unsigned char rowPeriod; } BTDISetupParams; typedef struct { unsigned char btdiErrors; } BTDISetupResults; typedef struct { unsigned short /* MF_MODEL_SELECT */ mfModel; unsigned short /* MF_COMMAND */ mfCommand; long mfParam1; long mfParam2; unsigned short outLength; unsigned char *outPtr; unsigned short inLength; unsigned char *inPtr; } MFParams; typedef struct { unsigned short /* MF_MODEL_SELECT */ mfModel; long mfPosition; unsigned short /* MF_STATUS */ mfStatus; unsigned short /* MF_ERROR */ mfError; long mfResult1; long mfResult2; } MFResults; #ifndef __SUNPRO_CC #pragma pack(pop) /* Restore previous struct align */ #endif /* Function Prototypes This are the driver interface functions. SBIGUnivDrvCommand() - Supports Parallel, USB and Ethernet based cameras. Each function takes a command parameter and pointers to parameters and results structs. The calling program needs to allocate the memory for the parameters and results structs and these routines read them and fill them in respectively. */ #if TARGET == ENV_WIN #ifdef __cplusplus extern "C" short __stdcall SBIGUnivDrvCommand(short command, void *Params, void *Results); #else extern short __stdcall SBIGUnivDrvCommand(short command, void *Params, void *Results); #endif #else #ifdef __cplusplus extern "C" short SBIGUnivDrvCommand(short command, void *Params, void *Results); #else extern short SBIGUnivDrvCommand(short command, void *Params, void *Results); #endif #endif #endif /* ifndef _PARDRV_ */ indi-sbig-1.0/README0000644000175000017500000000167211110507066011712 0ustar jrjrSBIG INDI Driver ================ This package provides the INDI driver for Santa Barbra Instruments Group line of CCDs & Filter Wheels. Requirtments ============ + INDI >= v0.6 (http://indi.sf.net) You need to install both indi and indi-devel to build this package. + cfitsio cfitsio-devel is required to compile support for FITS. + libusb libusb is required. + SBIG Universal Driver for Linux (http://indi.sf.net) SBIG Universal driver along with fxload and the CCD firmware is required. Installation ============ See INSTALL How to Use ========== You can use the SBIG INDI Driver in any INDI-compatible client such as KStars or Xephem. To run the driver from the command line: $ indiserver indi_sbig_ccd You can then connect to the driver from any client, the default port is 7624. If you're using KStars, the driver will be automatically listed in KStars' Device Manager, no further configuration is necessary. indi-sbig-1.0/INSTALL0000644000175000017500000000052611110507066012060 0ustar jrjrSBIG INSTALL ============ You must have CMake >= 2.4.7 in order to build this package. 1) $ tar -xzf indi_sbig.tar.gz 2) $ mkdir indi_sbig_build 3) $ cd indi_sbig_build 4) $ cmake -DCMAKE_INSTALL_PREFIX=/usr . ../indi_sbig 5) $ su -c 'make install' or sudo make install Refer to README for instructions on using the driver. That's it! indi-sbig-1.0/indi_sbig.xml0000644000175000017500000000023011110507066013470 0ustar jrjr SBIG indi_sbig_ccd 1.0 indi-sbig-1.0/sbigcam.cpp0000644000175000017500000024713111110507066013145 0ustar jrjr//========================================================================== #if 0 File name : sbigcam.cpp Driver type: SBIG CCD Camera INDI Driver Copyright (C) 2005-2006 Jan Soldan (jsoldan AT asu DOT cas DOT cz) 251 65 Ondrejov-236, Czech Republic Acknowledgement: Jasem Mutlaq (mutlaqja AT ikarustech DOT com) Matt Longmire (matto AT sbig DOT com) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #endif //FIXME remove after debugging #include #include //========================================================================== #include "sbigcam.h" using namespace std; //========================================================================== #ifdef INDI // We declare an auto pointer to SBIG CCD camera. auto_ptr sbig_cam(0); #endif //========================================================================== // Initialize variables. Here we create new instance of SbigCam class. //========================================================================== #ifdef INDI void ISInit() { if(sbig_cam.get() == 0) sbig_cam.reset(new SbigCam()); } #endif //========================================================================== // INDI will call this function is called when the client inquires about // the device properties. //========================================================================== #ifdef INDI void ISGetProperties(const char *dev) { if(dev && strcmp(DEVICE_NAME, dev)) return; ISInit(); sbig_cam->ISGetProperties(); } #endif //========================================================================== #ifdef INDI void ISNewSwitch( const char *dev, const char *name, ISState *states, char *names[], int num) { if(dev && strcmp (DEVICE_NAME, dev)) return; ISInit(); sbig_cam->ISNewSwitch(name, states, names, num); } #endif //========================================================================== #ifdef INDI void ISNewText( const char *dev, const char *name, char *texts[], char *names[], int num) { if(dev && strcmp (DEVICE_NAME, dev)) return; ISInit(); sbig_cam->ISNewText(name, texts, names, num); } #endif //========================================================================== #ifdef INDI void ISNewNumber( const char *dev, const char *name, double values[], char *names[], int num) { if(dev && strcmp (DEVICE_NAME, dev)) return; ISInit(); sbig_cam->ISNewNumber(name, values, names, num); } #endif //========================================================================== #ifdef INDI void ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n) { INDI_UNUSED(dev); INDI_UNUSED(name); INDI_UNUSED(sizes); INDI_UNUSED(blobsizes); INDI_UNUSED(blobs); INDI_UNUSED(formats); INDI_UNUSED(names); INDI_UNUSED(n); } void ISSnoopDevice (XMLEle *root) { INDI_UNUSED(root); } #endif //========================================================================== SbigCam::SbigCam() { InitVars(); OpenDriver(); #ifdef INDI IEAddTimer(POLL_TEMPERATURE_MS, SbigCam::UpdateTemperature, this); IEAddTimer(POLL_EXPOSURE_MS, SbigCam::UpdateExposure, this); #endif } //========================================================================== SbigCam::SbigCam(const char* devName) { InitVars(); if(OpenDriver() == CE_NO_ERROR) OpenDevice(devName); #ifdef INDI IEAddTimer(POLL_TEMPERATURE_MS, SbigCam::UpdateTemperature, this); IEAddTimer(POLL_EXPOSURE_MS, SbigCam::UpdateExposure, this); #endif } //========================================================================== SbigCam::~SbigCam() { CloseDevice(); CloseDriver(); } //========================================================================== int SbigCam::OpenDriver() { int res; GetDriverHandleResults gdhr; SetDriverHandleParams sdhp; // Call the driver directly. if((res = ::SBIGUnivDrvCommand(CC_OPEN_DRIVER, 0, 0)) == CE_NO_ERROR){ // The driver was not open, so record the driver handle. res = ::SBIGUnivDrvCommand(CC_GET_DRIVER_HANDLE, 0, &gdhr); }else if(res == CE_DRIVER_NOT_CLOSED){ // The driver is already open which we interpret as having been // opened by another instance of the class so get the driver to // allocate a new handle and then record it. sdhp.handle = INVALID_HANDLE_VALUE; res = ::SBIGUnivDrvCommand(CC_SET_DRIVER_HANDLE, &sdhp, 0); if(res == CE_NO_ERROR){ if((res = ::SBIGUnivDrvCommand(CC_OPEN_DRIVER, 0, 0)) == CE_NO_ERROR){ res = ::SBIGUnivDrvCommand(CC_GET_DRIVER_HANDLE, 0, &gdhr); } } } if(res == CE_NO_ERROR) SetDriverHandle(gdhr.handle); return(res); } //========================================================================== int SbigCam::CloseDriver() { int res; if((res = ::SBIGUnivDrvCommand(CC_CLOSE_DRIVER, 0, 0)) == CE_NO_ERROR){ SetDriverHandle(); } return(res); } //========================================================================== int SbigCam::OpenDevice(const char *devName) { int res; OpenDeviceParams odp; // Check if device already opened: if(IsDeviceOpen()) return(CE_NO_ERROR); // Try to open new device: if(strcmp(devName, SBIG_USB0) == 0){ odp.deviceType = DEV_USB1; }else if(strcmp(devName, SBIG_USB1) == 0){ odp.deviceType = DEV_USB2; }else if(strcmp(devName, SBIG_USB2) == 0){ odp.deviceType = DEV_USB3; }else if(strcmp(devName, SBIG_USB3) == 0){ odp.deviceType = DEV_USB4; }else if(strcmp(devName, SBIG_LPT0) == 0){ odp.deviceType = DEV_LPT1; }else if(strcmp(devName, SBIG_LPT1) == 0){ odp.deviceType = DEV_LPT2; }else if(strcmp(devName, SBIG_LPT2) == 0){ odp.deviceType = DEV_LPT3; }else{ return(CE_BAD_PARAMETER); } if((res = SBIGUnivDrvCommand(CC_OPEN_DEVICE, &odp, 0)) == CE_NO_ERROR){ SetDeviceName(devName); SetFileDescriptor(true); } return(res); } //========================================================================== int SbigCam::CloseDevice() { int res = CE_NO_ERROR; if(IsDeviceOpen()){ if((res = SBIGUnivDrvCommand(CC_CLOSE_DEVICE, 0, 0)) == CE_NO_ERROR){ SetFileDescriptor(); // set value to -1 SetCameraType(); // set value to NO_CAMERA } } return(res); } //========================================================================= int SbigCam::GetDriverInfo(GetDriverInfoParams *gdip, void *res) { return(SBIGUnivDrvCommand(CC_GET_DRIVER_INFO, gdip, res)); } //========================================================================== int SbigCam::SetDriverHandle(SetDriverHandleParams *sdhp) { return(SBIGUnivDrvCommand(CC_SET_DRIVER_HANDLE, sdhp, 0)); } //========================================================================== int SbigCam::GetDriverHandle(GetDriverHandleResults *gdhr) { return(SBIGUnivDrvCommand(CC_GET_DRIVER_HANDLE, 0, gdhr)); } //========================================================================== int SbigCam::StartExposure(StartExposureParams *sep) { return(SBIGUnivDrvCommand(CC_START_EXPOSURE, sep, 0)); } //========================================================================== int SbigCam::EndExposure(EndExposureParams *eep) { return(SBIGUnivDrvCommand(CC_END_EXPOSURE, eep, 0)); } //========================================================================== int SbigCam::StartReadout(StartReadoutParams *srp) { return(SBIGUnivDrvCommand(CC_START_READOUT, srp, 0)); } //========================================================================== int SbigCam::ReadoutLine(ReadoutLineParams *rlp, unsigned short *results, bool bSubtract) { int res; if(bSubtract){ res = SBIGUnivDrvCommand(CC_READ_SUBTRACT_LINE, rlp, results); }else{ res = SBIGUnivDrvCommand(CC_READOUT_LINE, rlp, results); } return(res); } //========================================================================== int SbigCam::DumpLines(DumpLinesParams *dlp) { return(SBIGUnivDrvCommand(CC_DUMP_LINES, dlp, 0)); } //========================================================================== int SbigCam::EndReadout(EndReadoutParams *erp) { return(SBIGUnivDrvCommand(CC_END_READOUT, erp, 0)); } //========================================================================== int SbigCam::SetTemperatureRegulation(SetTemperatureRegulationParams *strp) { return(SBIGUnivDrvCommand(CC_SET_TEMPERATURE_REGULATION, strp, 0)); } //========================================================================== int SbigCam::SetTemperatureRegulation(double temperature, bool enable) { int res; SetTemperatureRegulationParams strp; if(CheckLink()){ strp.regulation = enable ? REGULATION_ON : REGULATION_OFF; strp.ccdSetpoint = CalcSetpoint(temperature); res = SBIGUnivDrvCommand(CC_SET_TEMPERATURE_REGULATION, &strp, 0); }else{ res = CE_DEVICE_NOT_OPEN; } return(res); } //========================================================================== int SbigCam::QueryTemperatureStatus( bool &enabled, double &ccdTemp, double &setpointTemp, double &power) { int res; QueryTemperatureStatusResults qtsr; if(CheckLink()){ res = SBIGUnivDrvCommand(CC_QUERY_TEMPERATURE_STATUS, 0, &qtsr); if(res == CE_NO_ERROR){ enabled = qtsr.enabled; ccdTemp = CalcTemperature(CCD_THERMISTOR, qtsr.ccdThermistor); setpointTemp = CalcTemperature(CCD_THERMISTOR, qtsr.ccdSetpoint); power = qtsr.power/255.0; } }else{ res = CE_DEVICE_NOT_OPEN; } return(res); } //========================================================================== unsigned short SbigCam::CalcSetpoint(double temperature) { // Calculate 'setpoint' from the temperature T in degr. of Celsius. double expo = (log(R_RATIO_CCD) * (T0 - temperature)) / DT_CCD; double r = R0 * exp(expo); return((unsigned short)(((MAX_AD / (R_BRIDGE_CCD / r + 1.0)) + 0.5))); } //========================================================================== double SbigCam::CalcTemperature(short thermistorType, short setpoint) { double r, expo, rBridge, rRatio, dt; switch(thermistorType){ case AMBIENT_THERMISTOR: rBridge = R_BRIDGE_AMBIENT; rRatio = R_RATIO_AMBIENT; dt = DT_AMBIENT; break; case CCD_THERMISTOR: default: rBridge = R_BRIDGE_CCD; rRatio = R_RATIO_CCD; dt = DT_CCD; break; } // Calculate temperature T in degr. Celsius from the 'setpoint' r = rBridge / ((MAX_AD / setpoint) - 1.0); expo = log(r / R0) / log(rRatio); return(T0 - dt * expo); } //========================================================================== int SbigCam::ActivateRelay(ActivateRelayParams *arp) { return(SBIGUnivDrvCommand(CC_ACTIVATE_RELAY, arp, 0)); } //========================================================================== int SbigCam::PulseOut(PulseOutParams *pop) { return(SBIGUnivDrvCommand(CC_PULSE_OUT, pop, 0)); } //========================================================================== int SbigCam::TxSerialBytes( TXSerialBytesParams *txsbp, TXSerialBytesResults *txsbr) { return(SBIGUnivDrvCommand(CC_TX_SERIAL_BYTES, txsbp, txsbr)); } //========================================================================== int SbigCam::GetSerialStatus(GetSerialStatusResults *gssr) { return(SBIGUnivDrvCommand(CC_GET_SERIAL_STATUS, 0, gssr)); } //========================================================================== int SbigCam::AoTipTilt(AOTipTiltParams *aottp) { return(SBIGUnivDrvCommand(CC_AO_TIP_TILT, aottp, 0)); } //========================================================================== int SbigCam::AoDelay(AODelayParams *aodp) { return(SBIGUnivDrvCommand(CC_AO_DELAY, aodp, 0)); } //========================================================================== int SbigCam::Cfw(CFWParams *cfwp, CFWResults *cfwr) { return(SBIGUnivDrvCommand(CC_CFW, cfwp, cfwr)); } //========================================================================== int SbigCam::EstablishLink() { int res; EstablishLinkParams elp; EstablishLinkResults elr; elp.sbigUseOnly = 0; if((res = SBIGUnivDrvCommand(CC_ESTABLISH_LINK, &elp, &elr)) == CE_NO_ERROR){ SetCameraType((CAMERA_TYPE)elr.cameraType); SetLinkStatus(true); } return(res); } //========================================================================== int SbigCam::GetCcdInfo(GetCCDInfoParams *gcp, void *gcr) { return(SBIGUnivDrvCommand(CC_GET_CCD_INFO, gcp, gcr)); } //========================================================================== int SbigCam::GetCcdSizeInfo( int ccd, int binning, int &frmW, int &frmH, double &pixW, double &pixH) { int res; GetCCDInfoParams gcp; GetCCDInfoResults0 gcr; gcp.request = ccd; res = SBIGUnivDrvCommand(CC_GET_CCD_INFO, &gcp, &gcr); if(res == CE_NO_ERROR){ frmW = gcr.readoutInfo[binning].width; frmH = gcr.readoutInfo[binning].height; pixW = BcdPixel2double(gcr.readoutInfo[binning].pixelWidth); pixH = BcdPixel2double(gcr.readoutInfo[binning].pixelHeight); } return(res); } //========================================================================== int SbigCam::QueryCommandStatus( QueryCommandStatusParams *qcsp, QueryCommandStatusResults *qcsr) { return(SBIGUnivDrvCommand(CC_QUERY_COMMAND_STATUS, qcsp, qcsr)); } //========================================================================== int SbigCam::MiscellaneousControl(MiscellaneousControlParams *mcp) { return(SBIGUnivDrvCommand(CC_MISCELLANEOUS_CONTROL, mcp, 0)); } //========================================================================== int SbigCam::ReadOffset(ReadOffsetParams *rop, ReadOffsetResults *ror) { return(SBIGUnivDrvCommand(CC_READ_OFFSET, rop, ror)); } //========================================================================== int SbigCam::GetLinkStatus(GetLinkStatusResults *glsr) { return(SBIGUnivDrvCommand(CC_GET_LINK_STATUS, glsr, 0)); } //========================================================================== string SbigCam::GetErrorString(int err) { int res; GetErrorStringParams gesp; GetErrorStringResults gesr; gesp.errorNo = err; res = SBIGUnivDrvCommand(CC_GET_ERROR_STRING, &gesp, &gesr); if(res == CE_NO_ERROR) return(string(gesr.errorString)); char str [128]; sprintf(str, "No error string found! Error code: %d", err); return(string(str)); } //========================================================================== int SbigCam::SetDriverControl(SetDriverControlParams *sdcp) { return(SBIGUnivDrvCommand(CC_SET_DRIVER_CONTROL, sdcp, 0)); } //========================================================================== int SbigCam::GetDriverControl( GetDriverControlParams *gdcp, GetDriverControlResults *gdcr) { return(SBIGUnivDrvCommand(CC_GET_DRIVER_CONTROL, gdcp, gdcr)); } //========================================================================== int SbigCam::UsbAdControl(USBADControlParams *usbadcp) { return(SBIGUnivDrvCommand(CC_USB_AD_CONTROL, usbadcp, 0)); } //========================================================================== int SbigCam::QueryUsb(QueryUSBResults *qusbr) { return(SBIGUnivDrvCommand(CC_QUERY_USB, 0, qusbr)); } //========================================================================== int SbigCam::RwUsbI2c(RWUSBI2CParams *rwusbi2cp) { return(SBIGUnivDrvCommand(CC_RW_USB_I2C, rwusbi2cp, 0)); } //========================================================================== int SbigCam::BitIo(BitIOParams *biop, BitIOResults *bior) { return(SBIGUnivDrvCommand(CC_BIT_IO, biop, bior)); } //========================================================================== string SbigCam::GetCameraName() { int res; string name = "Unknown camera"; GetCCDInfoParams gccdip; GetCCDInfoResults0 gccdir; char *p1, *p2; gccdip.request = CCD_INFO_IMAGING; // request 0 res = SBIGUnivDrvCommand(CC_GET_CCD_INFO, &gccdip, &gccdir); if(res == CE_NO_ERROR){ name = gccdir.name; switch(gccdir.cameraType){ case ST237_CAMERA: if(gccdir.readoutInfo[0].gain >= 0x100) name += 'A'; break; case STL_CAMERA: // driver reports name as "SBIG ST-L-XXX..." p1 = gccdir.name + 5; if((p2 = strchr(p1,' ')) != NULL){ *p2 = '\0'; name = p1; } break; case NO_CAMERA: name = "No camera"; break; default: break; } } return(name); } //========================================================================== string SbigCam::GetCameraID() { string str; GetCCDInfoParams gccdip; GetCCDInfoResults2 gccdir2; gccdip.request = 2; if(GetCcdInfo(&gccdip, (void *)&gccdir2) == CE_NO_ERROR){ str = gccdir2.serialNumber; } return(str); } //========================================================================== int SbigCam::SetDeviceName(const char *name) { int res = CE_NO_ERROR; if(strlen(name) < PATH_MAX){ strcpy(m_dev_name, name); }else{ res = CE_BAD_PARAMETER; } return(res); } //========================================================================== // SBIGUnivDrvCommand: // Bottleneck function for all calls to the driver that logs the command // and error. First it activates our handle and then it calls the driver. // Activating the handle first allows having multiple instances of this // class dealing with multiple cameras on different communications port. // Also allows direct access to the SBIG Universal Driver after the driver // has been opened. int SbigCam::SBIGUnivDrvCommand(PAR_COMMAND command, void *params, void *results) { int res; SetDriverHandleParams sdhp; // Make sure we have a valid handle to the driver. if(GetDriverHandle() == INVALID_HANDLE_VALUE){ res = CE_DRIVER_NOT_OPEN; }else{ // Handle is valid so install it in the driver. sdhp.handle = GetDriverHandle(); res = ::SBIGUnivDrvCommand(CC_SET_DRIVER_HANDLE, &sdhp, 0); if(res == CE_FAKE_DRIVER) { // The user is using the dummy driver. Tell him to download the real driver IDMessage(DEVICE_NAME, "Error: SBIG Dummy Driver is being used now. You can only control your camera by downloading SBIG driver from INDI website @ indi.sf.net"); } else if(res == CE_NO_ERROR){ res = ::SBIGUnivDrvCommand(command, params, results); } } return(res); } //========================================================================== bool SbigCam::CheckLink() { if(GetCameraType() != NO_CAMERA && GetLinkStatus()) return(true); return(false); } //========================================================================== int SbigCam::GetNumOfCcdChips() { int res; switch(GetCameraType()){ case ST237_CAMERA: case ST5C_CAMERA: case ST402_CAMERA: res = 1; break; case ST7_CAMERA: case ST8_CAMERA: case ST9_CAMERA: case ST2K_CAMERA: res = 2; break; case STL_CAMERA: res = 3; break; case NO_CAMERA: default: res = 0; break; } return(res); } //========================================================================== bool SbigCam::IsFanControlAvailable() { CAMERA_TYPE camera = GetCameraType(); if(camera == ST5C_CAMERA || camera == ST402_CAMERA) return(false); return(true); } //========================================================================== double SbigCam::BcdPixel2double(ulong bcd) { double value = 0.0; double digit = 0.01; for(int i = 0; i < 8; i++){ value += (bcd & 0x0F) * digit; digit *= 10.0; bcd >>= 4; } return(value); } //========================================================================== void SbigCam::InitVars() { SetFileDescriptor(); SetCameraType(); SetLinkStatus(); SetDeviceName(""); #ifdef INDI // CCD PRODUCT: IUFillText(&m_icam_product_t[0], PRODUCT_NAME_T, PRODUCT_LABEL_T, UNKNOWN_LABEL); IUFillText(&m_icam_product_t[1], PRODUCT_ID_NAME_T, PRODUCT_ID_LABEL_T, UNKNOWN_LABEL); IUFillTextVector( &m_icam_product_tp, m_icam_product_t, NARRAY(m_icam_product_t), DEVICE_NAME, CCD_PRODUCT_NAME_TP, CCD_PRODUCT_LABEL_TP, CAMERA_GROUP, IP_RO, INDI_TIMEOUT, IPS_IDLE); // CCD DEVICE PORT: IUFillText(&m_icam_device_port_t[0], PORT_NAME_T, PORT_LABEL_T, SBIG_USB0); IUFillTextVector( &m_icam_device_port_tp, m_icam_device_port_t, NARRAY(m_icam_device_port_t), DEVICE_NAME, CCD_DEVICE_PORT_NAME_TP, CCD_DEVICE_PORT_LABEL_TP, CAMERA_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // CCD CONNECTION: IUFillSwitch(&m_icam_connection_s[0], CONNECT_NAME_S, CONNECT_LABEL_S, ISS_OFF); IUFillSwitch(&m_icam_connection_s[1], DISCONNECT_NAME_S, DISCONNECT_LABEL_S, ISS_ON); IUFillSwitchVector(&m_icam_connection_sp, m_icam_connection_s, NARRAY(m_icam_connection_s), DEVICE_NAME, CCD_CONNECTION_NAME_SP, CCD_CONNECTION_LABEL_SP, CAMERA_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_IDLE); // CCD FAN STATE: IUFillSwitch(&m_icam_fan_state_s[0], CCD_FAN_ON_NAME_S, CCD_FAN_ON_LABEL_S, ISS_ON); IUFillSwitch(&m_icam_fan_state_s[1], CCD_FAN_OFF_NAME_S, CCD_FAN_OFF_LABEL_S, ISS_OFF); IUFillSwitchVector(&m_icam_fan_state_sp, m_icam_fan_state_s, NARRAY(m_icam_fan_state_s), DEVICE_NAME, CCD_FAN_NAME_SP, CCD_FAN_LABEL_SP, TEMPERATURE_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_OK); // CCD TEMPERATURE: IUFillNumber( &m_icam_temperature_n[0], CCD_TEMPERATURE_NAME_N, CCD_TEMPERATURE_LABEL_N, "%+.1f", MIN_CCD_TEMP, MAX_CCD_TEMP, CCD_TEMP_STEP, DEF_CCD_TEMP); IUFillNumberVector(&m_icam_temperature_np, m_icam_temperature_n, NARRAY(m_icam_temperature_n), DEVICE_NAME, CCD_TEMPERATURE_NAME_NP, CCD_TEMPERATURE_LABEL_NP, TEMPERATURE_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // CCD COOLER: IUFillNumber( &m_icam_cooler_n[0], CCD_COOLER_NAME_N, CCD_COOLER_LABEL_N, "%.1f", 0, 0, 0, 0); IUFillNumberVector(&m_icam_cooler_np, m_icam_cooler_n, NARRAY(m_icam_cooler_n), DEVICE_NAME, CCD_COOLER_NAME_NP, CCD_COOLER_LABEL_NP, TEMPERATURE_GROUP, IP_RO, INDI_TIMEOUT, IPS_IDLE); // CCD TEMPERATURE POLLING: IUFillNumber( &m_icam_temperature_polling_n[0], CCD_TEMPERATURE_POLLING_NAME_N, CCD_TEMPERATURE_POLLING_LABEL_N, "%.1f", MIN_POLLING_TIME, MAX_POLLING_TIME, STEP_POLLING_TIME, CUR_POLLING_TIME); IUFillNumberVector(&m_icam_temperature_polling_np, m_icam_temperature_polling_n, NARRAY(m_icam_temperature_polling_n), DEVICE_NAME, CCD_TEMPERATURE_POLLING_NAME_NP, CCD_TEMPERATURE_POLLING_LABEL_NP, TEMPERATURE_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // CCD TEMPERATURE MSG: IUFillSwitch( &m_icam_temperature_msg_s[0], CCD_TEMPERATURE_MSG_YES_NAME_S, CCD_TEMPERATURE_MSG_YES_LABEL_S, ISS_ON); IUFillSwitch( &m_icam_temperature_msg_s[1], CCD_TEMPERATURE_MSG_NO_NAME_S, CCD_TEMPERATURE_MSG_NO_LABEL_S, ISS_OFF); IUFillSwitchVector(&m_icam_temperature_msg_sp, m_icam_temperature_msg_s, NARRAY(m_icam_temperature_msg_s), DEVICE_NAME, CCD_TEMPERATURE_MSG_NAME_SP, CCD_TEMPERATURE_MSG_LABEL_SP, TEMPERATURE_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_IDLE); // CCD FRAME TYPE: IUFillSwitch( &m_icam_frame_type_s[0], CCD_FRAME_LIGHT_NAME_N, CCD_FRAME_LIGHT_LABEL_N, ISS_ON); IUFillSwitch( &m_icam_frame_type_s[1], CCD_FRAME_DARK_NAME_N, CCD_FRAME_DARK_LABEL_N, ISS_OFF); IUFillSwitch( &m_icam_frame_type_s[2], CCD_FRAME_FLAT_NAME_N, CCD_FRAME_FLAT_LABEL_N, ISS_OFF); IUFillSwitch( &m_icam_frame_type_s[3], CCD_FRAME_BIAS_NAME_N, CCD_FRAME_BIAS_LABEL_N, ISS_OFF); IUFillSwitchVector(&m_icam_frame_type_sp, m_icam_frame_type_s, NARRAY(m_icam_frame_type_s), DEVICE_NAME, CCD_FRAME_TYPE_NAME_NP, CCD_FRAME_TYPE_LABEL_NP, FRAME_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_OK); // CCD REQUEST: IUFillSwitch( &m_icam_ccd_request_s[0], CCD_IMAGING_NAME_S, CCD_IMAGING_LABEL_S, ISS_ON); IUFillSwitch( &m_icam_ccd_request_s[1], CCD_TRACKING_NAME_S, CCD_TRACKING_LABEL_S, ISS_OFF); IUFillSwitch( &m_icam_ccd_request_s[2], CCD_EXT_TRACKING_NAME_S, CCD_EXT_TRACKING_LABEL_S, ISS_OFF); IUFillSwitchVector(&m_icam_ccd_request_sp, m_icam_ccd_request_s, NARRAY(m_icam_ccd_request_s), DEVICE_NAME, CCD_REQUEST_NAME_SP, CCD_REQUEST_LABEL_SP, FRAME_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_OK); // CCD BINNING #ifdef USE_CCD_BINNING_STANDARD_PROPERTY IUFillNumber( &m_icam_ccd_binning_n[0], CCD_HOR_BIN_NAME_N, CCD_HOR_BIN_LABEL_N, "%.0f", CCD_MIN_BIN, CCD_MAX_BIN, 1, 1); IUFillNumber( &m_icam_ccd_binning_n[1], CCD_VER_BIN_NAME_N, CCD_VER_BIN_LABEL_N, "%.0f", CCD_MIN_BIN, CCD_MAX_BIN, 1, 1); IUFillNumberVector(&m_icam_ccd_binning_np, m_icam_ccd_binning_n, NARRAY(m_icam_ccd_binning_n), DEVICE_NAME, CCD_BINNING_NAME_NP, CCD_BINNING_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); #else IUFillSwitch( &m_icam_binning_mode_s[0], CCD_BIN_1x1_I_NAME_S, CCD_BIN_1x1_I_LABEL_S, ISS_ON); IUFillSwitch( &m_icam_binning_mode_s[1], CCD_BIN_2x2_I_NAME_S, CCD_BIN_2x2_I_LABEL_S, ISS_OFF); IUFillSwitch( &m_icam_binning_mode_s[2], CCD_BIN_3x3_I_NAME_S, CCD_BIN_3x3_I_LABEL_S, ISS_OFF); IUFillSwitch( &m_icam_binning_mode_s[3], CCD_BIN_9x9_I_NAME_S, CCD_BIN_9x9_I_LABEL_S, ISS_OFF); IUFillSwitch( &m_icam_binning_mode_s[4], CCD_BIN_2x2_E_NAME_S, CCD_BIN_2x2_E_LABEL_S, ISS_OFF); IUFillSwitch( &m_icam_binning_mode_s[5], CCD_BIN_3x3_E_NAME_S, CCD_BIN_3x3_E_LABEL_S, ISS_OFF); IUFillSwitchVector(&m_icam_binning_mode_sp, m_icam_binning_mode_s, NARRAY(m_icam_binning_mode_s), DEVICE_NAME, CCD_BINNING_MODE_NAME_SP, CCD_BINNING_MODE_LABEL_SP, FRAME_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_OK); #endif // CCD PIXEL INFO: IUFillNumber( &m_icam_pixel_size_n[0], CCD_PIXEL_WIDTH_NAME_N, CCD_PIXEL_WIDTH_LABEL_N, "%.2f", 0, 0, 0, 0); IUFillNumber( &m_icam_pixel_size_n[1], CCD_PIXEL_HEIGHT_NAME_N, CCD_PIXEL_HEIGHT_LABEL_N, "%.2f", 0, 0, 0, 0); IUFillNumberVector(&m_icam_pixel_size_np, m_icam_pixel_size_n, NARRAY(m_icam_pixel_size_n), DEVICE_NAME, CCD_PIXEL_INFO_NAME_NP, CCD_PIXEL_INFO_LABEL_NP, FRAME_GROUP, IP_RO, INDI_TIMEOUT, IPS_IDLE); // CCD FRAME #ifdef USE_CCD_FRAME_STANDARD_PROPERTY IUFillNumber( &m_icam_ccd_frame_n[0], CCD_FRAME_X_NAME_N, CCD_FRAME_X_LABEL_N, "%.0f", 0,0,0,0); IUFillNumber( &m_icam_ccd_frame_n[1], CCD_FRAME_Y_NAME_N, CCD_FRAME_Y_LABEL_N, "%.0f", 0,0,0,0); IUFillNumber( &m_icam_ccd_frame_n[2], CCD_FRAME_W_NAME_N, CCD_FRAME_W_LABEL_N, "%.0f", 0,0,0,0); IUFillNumber( &m_icam_ccd_frame_n[3], CCD_FRAME_H_NAME_N, CCD_FRAME_H_LABEL_N, "%.0f", 0,0,0,0); IUFillNumberVector(&m_icam_ccd_frame_np, m_icam_ccd_frame_n, NARRAY(m_icam_ccd_frame_n), DEVICE_NAME, CCD_FRAME_NAME_NP, CCD_FRAME_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); #else // FRAME X: IUFillNumber( &m_icam_frame_x_n[0], CCD_FRAME_X_NAME_N, CCD_FRAME_X_LABEL_N, "%.0f", 0,0,0,0); IUFillNumberVector(&m_icam_frame_x_np, m_icam_frame_x_n, NARRAY(m_icam_frame_x_n), DEVICE_NAME, CCD_FRAME_X_NAME_NP, CCD_FRAME_X_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // FRAME Y: IUFillNumber( &m_icam_frame_y_n[0], CCD_FRAME_Y_NAME_N, CCD_FRAME_Y_LABEL_N, "%.0f", 0,0,0,0); IUFillNumberVector(&m_icam_frame_y_np, m_icam_frame_y_n, NARRAY(m_icam_frame_y_n), DEVICE_NAME, CCD_FRAME_Y_NAME_NP, CCD_FRAME_Y_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // FRAME W: IUFillNumber( &m_icam_frame_w_n[0], CCD_FRAME_W_NAME_N, CCD_FRAME_W_LABEL_N, "%.0f",0,0,0,0); IUFillNumberVector(&m_icam_frame_w_np, m_icam_frame_w_n, NARRAY(m_icam_frame_w_n), DEVICE_NAME, CCD_FRAME_W_NAME_NP, CCD_FRAME_W_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // FRAME H: IUFillNumber( &m_icam_frame_h_n[0], CCD_FRAME_H_NAME_N, CCD_FRAME_H_LABEL_N, "%.0f",0,0,0,0); IUFillNumberVector(&m_icam_frame_h_np, m_icam_frame_h_n, NARRAY(m_icam_frame_h_n), DEVICE_NAME, CCD_FRAME_H_NAME_NP, CCD_FRAME_H_LABEL_NP, FRAME_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); #endif // CFW PRODUCT: IUFillText(&m_icfw_product_t[0], PRODUCT_NAME_T, PRODUCT_LABEL_T, UNKNOWN_LABEL); IUFillText(&m_icfw_product_t[1], PRODUCT_ID_NAME_T, PRODUCT_ID_LABEL_T, UNKNOWN_LABEL); IUFillTextVector( &m_icfw_product_tp, m_icfw_product_t, NARRAY(m_icfw_product_t), DEVICE_NAME, CFW_PRODUCT_NAME_TP, CFW_PRODUCT_LABEL_TP, CFW_GROUP, IP_RO, INDI_TIMEOUT, IPS_IDLE); // CFW_MODEL: IUFillSwitch(&m_icfw_type_s[0], CFW1_NAME_S, CFW1_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[1], CFW2_NAME_S, CFW2_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[2], CFW3_NAME_S, CFW3_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[3], CFW4_NAME_S, CFW4_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[4], CFW5_NAME_S, CFW5_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[5], CFW6_NAME_S, CFW6_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[6], CFW7_NAME_S, CFW7_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_type_s[7], CFW8_NAME_S, CFW8_LABEL_S, ISS_OFF); #ifdef USE_CFW_AUTO IUFillSwitch(&m_icfw_type_s[8], CFW9_NAME_S, CFW9_LABEL_S, ISS_OFF); #endif IUFillSwitchVector(&m_icfw_type_sp, m_icfw_type_s, NARRAY(m_icfw_type_s), DEVICE_NAME, CFW_TYPE_NAME_SP, CFW_TYPE_LABEL_SP, CFW_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_IDLE); // CFW CONNECTION: IUFillSwitch(&m_icfw_connection_s[0], CONNECT_NAME_S, CONNECT_LABEL_S, ISS_OFF); IUFillSwitch(&m_icfw_connection_s[1], DISCONNECT_NAME_S, DISCONNECT_LABEL_S, ISS_ON); IUFillSwitchVector(&m_icfw_connection_sp, m_icfw_connection_s, NARRAY(m_icfw_connection_s), DEVICE_NAME, CFW_CONNECTION_NAME_SP, CFW_CONNECTION_LABEL_SP, CFW_GROUP, IP_RW, ISR_1OFMANY, INDI_TIMEOUT, IPS_IDLE); // CFW_SLOT: IUFillNumber( &m_icfw_slot_n[0], CFW_SLOT_NAME_N, CFW_SLOT_LABEL_N, "%.0f", MIN_FILTER_SLOT, MAX_FILTER_SLOT, FILTER_SLOT_STEP, DEF_FILTER_SLOT); IUFillNumberVector(&m_icfw_slot_np, m_icfw_slot_n, NARRAY(m_icfw_slot_n), DEVICE_NAME, CFW_SLOT_NAME_NP, CFW_SLOT_LABEL_NP, CFW_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // CCD EXPOSE DURATION: IUFillNumber( &m_icam_expose_time_n[0], CCD_EXPOSE_DURATION_NAME_N, CCD_EXPOSE_DURATION_LABEL_N, "%.2f", MIN_EXP_TIME, MAX_EXP_TIME, EXP_TIME_STEP, DEF_EXP_TIME); IUFillNumberVector(&m_icam_expose_time_np, m_icam_expose_time_n, NARRAY(m_icam_expose_time_n), DEVICE_NAME, CCD_EXPOSE_DURATION_NAME_NP, CCD_EXPOSE_DURATION_LABEL_NP, EXPOSURE_GROUP, IP_RW, INDI_TIMEOUT, IPS_IDLE); // BLOB - Binary Large Object: strcpy(m_icam_fits_b.name, BLOB_NAME_B); strcpy(m_icam_fits_b.label, BLOB_LABEL_B); strcpy(m_icam_fits_b.format, BLOB_FORMAT_B); m_icam_fits_b.blob = 0; m_icam_fits_b.bloblen = 0; m_icam_fits_b.size = 0; m_icam_fits_b.bvp = 0; m_icam_fits_b.aux0 = 0; m_icam_fits_b.aux1 = 0; m_icam_fits_b.aux2 = 0; strcpy(m_icam_fits_bp.device, DEVICE_NAME); strcpy(m_icam_fits_bp.name, BLOB_NAME_BP); strcpy(m_icam_fits_bp.label, BLOB_LABEL_BP); strcpy(m_icam_fits_bp.group, EXPOSURE_GROUP); strcpy(m_icam_fits_bp.timestamp, ""); m_icam_fits_bp.p = IP_RO; m_icam_fits_bp.timeout = INDI_TIMEOUT; m_icam_fits_bp.s = IPS_IDLE; m_icam_fits_bp.bp = &m_icam_fits_b; m_icam_fits_bp.nbp = 1; m_icam_fits_bp.aux = 0; // FITS file name: IUFillText(&m_icam_fits_name_t[0], FITS_NAME_T, FITS_LABEL_T, ""); IUFillTextVector( &m_icam_fits_name_tp, m_icam_fits_name_t, NARRAY(m_icam_fits_name_t), DEVICE_NAME, FITS_NAME_TP, FITS_LABEL_TP, EXPOSURE_GROUP, IP_RO, INDI_TIMEOUT, IPS_IDLE); #endif // INDI } //========================================================================== #ifdef INDI void SbigCam::ISGetProperties() { // When a client first connects to the driver, we will offer only 3 basic // properties. After the camera is later detected, we will offer full // set of properties depending on the camera type. // CAMERA GROUP: IDDefText(&m_icam_product_tp, 0); // 1. CCD product IDDefText(&m_icam_device_port_tp, 0); // 2. CCD device port IDDefSwitch(&m_icam_connection_sp, 0); // 3. CCD connection } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::UpdateProperties() { int res = CE_NO_ERROR; string msg; IText *pIText; // TEMPERATURE GROUP: IDDelete(DEVICE_NAME, CCD_FAN_NAME_SP, 0); IDDelete(DEVICE_NAME, CCD_TEMPERATURE_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_COOLER_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_TEMPERATURE_POLLING_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_TEMPERATURE_MSG_NAME_SP, 0); // CFW GROUP: IDDelete(DEVICE_NAME, CFW_PRODUCT_NAME_TP, 0); IDDelete(DEVICE_NAME, CFW_TYPE_NAME_SP, 0); IDDelete(DEVICE_NAME, CFW_CONNECTION_NAME_SP, 0); IDDelete(DEVICE_NAME, CFW_SLOT_NAME_NP, 0); // FRAME GROUP: IDDelete(DEVICE_NAME, CCD_FRAME_TYPE_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_REQUEST_NAME_SP, 0); IDDelete(DEVICE_NAME, CCD_PIXEL_INFO_NAME_NP, 0); #ifdef USE_CCD_BINNING_STANDARD_PROPERTY IDDelete(DEVICE_NAME, CCD_BINNING_NAME_NP, 0); #else IDDelete(DEVICE_NAME, CCD_BINNING_MODE_NAME_SP, 0); #endif #ifdef USE_CCD_FRAME_STANDARD_PROPERTY IDDelete(DEVICE_NAME, CCD_FRAME_NAME_NP, 0); #else IDDelete(DEVICE_NAME, CCD_FRAME_X_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_FRAME_Y_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_FRAME_W_NAME_NP, 0); IDDelete(DEVICE_NAME, CCD_FRAME_H_NAME_NP, 0); #endif // EXPOSURE GROUP: IDDelete(DEVICE_NAME, CCD_EXPOSE_DURATION_NAME_NP, 0); IDDelete(DEVICE_NAME, FITS_NAME_TP, 0); IDDelete(DEVICE_NAME, BLOB_NAME_BP, 0); // Create new properties: if(GetCameraType() == NO_CAMERA){ // Device is closed. We again offer only three basic properties, // namely: CCD_PRODUCT, CCD_DEVICE_PORT & CCD_CONNECTION. // CCD PRODUCT: pIText = IUFindText(&m_icam_product_tp, PRODUCT_NAME_T); if(pIText) IUSaveText(pIText, UNKNOWN_LABEL); pIText = IUFindText(&m_icam_product_tp, PRODUCT_ID_NAME_T); if(pIText) IUSaveText(pIText, UNKNOWN_LABEL); m_icam_product_tp.s = IPS_IDLE; IDSetText(&m_icam_product_tp, 0); // CCD DEVICE PORT: m_icam_device_port_tp.s = IPS_IDLE; IDSetText(&m_icam_device_port_tp, 0); // CCD CONNECTION: m_icam_connection_s[0].s = ISS_OFF; m_icam_connection_s[1].s = ISS_ON; m_icam_connection_sp.s = IPS_IDLE; msg = "SBIG CCD camera is offline."; IDSetSwitch(&m_icam_connection_sp, "%s", msg.c_str()); }else{ // Device is open, so we offer the full set of properties // which are supported by the detected camera. // CCD PRODUCT: msg = GetCameraName(); pIText = IUFindText(&m_icam_product_tp, PRODUCT_NAME_T); if(pIText) IUSaveText(pIText, msg.c_str()); msg = GetCameraID(); pIText = IUFindText(&m_icam_product_tp, PRODUCT_ID_NAME_T); if(pIText) IUSaveText(pIText, msg.c_str()); m_icam_product_tp.s = IPS_OK; IDSetText(&m_icam_product_tp, 0); // CCD DEVICE PORT: IText *pIText = IUFindText(&m_icam_device_port_tp, PORT_NAME_T); if(pIText) IUSaveText(pIText, GetDeviceName()); m_icam_device_port_tp.s = IPS_OK; IDSetText(&m_icam_device_port_tp, 0); // CCD CONNECTION: m_icam_connection_s[0].s = ISS_ON; m_icam_connection_s[1].s = ISS_OFF; m_icam_connection_sp.s = IPS_OK; msg = IUFindText(&m_icam_product_tp, PRODUCT_NAME_T)->text; msg += " is online. SN: "; msg += IUFindText(&m_icam_product_tp, PRODUCT_ID_NAME_T)->text; IDSetSwitch(&m_icam_connection_sp, "%s", msg.c_str()); // CCD FAN: if(IsFanControlAvailable()){ IDDefSwitch(&m_icam_fan_state_sp, 0); } // CCD TEMPERATURE: m_icam_temperature_np.s = IPS_BUSY; IDDefNumber(&m_icam_temperature_np, 0); res = SetTemperatureRegulation(m_icam_temperature_n[0].value); if(res == CE_NO_ERROR){ // Set property to busy and poll in UpdateTemperature for CCD temp IDSetNumber(&m_icam_temperature_np, "Setting CCD temperature to %+.1f [C].", m_icam_temperature_n[0].value); }else{ m_icam_temperature_np.s = IPS_ALERT; IDSetNumber(&m_icam_temperature_np, "Error: Cannot set CCD temperature to %+.1f [C]. %s", m_icam_temperature_n[0].value, GetErrorString(res).c_str()); } // CCD COOLER: m_icam_cooler_np.s = IPS_BUSY; IDDefNumber(&m_icam_cooler_np, 0); // CCD TEMPERATURE POOLING: m_icam_temperature_polling_np.s = IPS_OK; IDDefNumber(&m_icam_temperature_polling_np, 0); // CCD TEMPERATURE MSG: m_icam_temperature_msg_sp.s = IPS_OK; IDDefSwitch(&m_icam_temperature_msg_sp, 0); // CFW PRODUCT: IDDefText(&m_icfw_product_tp, 0); // CFW TYPE: IDDefSwitch(&m_icfw_type_sp, 0); // CFW CONNECTION: IDDefSwitch(&m_icfw_connection_sp, 0); // CFW SLOT: IDDefNumber(&m_icfw_slot_np, 0); // CCD FRAME TYPE: IDDefSwitch(&m_icam_frame_type_sp, 0); // CCD REQUEST: if(GetNumOfCcdChips() > 1) IDDefSwitch(&m_icam_ccd_request_sp, 0); // CCD BINNING: #ifdef USE_CCD_BINNING_STANDARD_PROPERTY IDDefNumber(&m_icam_ccd_binning_np, 0); #else IDDefSwitch(&m_icam_binning_mode_sp, 0); #endif UpdateCcdFrameProperties(); // CCD PIXEL INFO: IDDefNumber(&m_icam_pixel_size_np, 0); // CCD FRAME #ifdef USE_CCD_FRAME_STANDARD_PROPERTY IDDefNumber(&m_icam_ccd_frame_np, 0); #else IDDefNumber(&m_icam_frame_x_np, 0); IDDefNumber(&m_icam_frame_y_np, 0); IDDefNumber(&m_icam_frame_w_np, 0); IDDefNumber(&m_icam_frame_h_np, 0); #endif // CCD EXPOSE DURATION: IDDefNumber(&m_icam_expose_time_np, 0); // CCD BLOB NAME: IDDefBLOB(&m_icam_fits_bp, 0); // CCD FITS NAME: IDDefText(&m_icam_fits_name_tp, 0); } return(res); } #endif // INDI //========================================================================= #ifdef INDI int SbigCam::UpdateCcdFrameProperties(bool bUpdateClient) { int res = CE_NO_ERROR, wCcd, hCcd, ccd, binning; double wPixel, hPixel; if((res = GetSelectedCcdChip(ccd)) != CE_NO_ERROR) return(res); if((res = GetSelectedCcdBinningMode(binning)) != CE_NO_ERROR) return(res); res = GetCcdSizeInfo(ccd, binning, wCcd, hCcd, wPixel, hPixel); if(res == CE_NO_ERROR){ // CCD INFO: m_icam_pixel_size_n[0].value = wPixel; m_icam_pixel_size_n[1].value = hPixel; m_icam_pixel_size_np.s = IPS_OK; // CCD FRAME #ifdef USE_CCD_FRAME_STANDARD_PROPERTY // X m_icam_ccd_frame_n[0].min = 0; m_icam_ccd_frame_n[0].max = wCcd-1; m_icam_ccd_frame_n[0].value = 0; // Y m_icam_ccd_frame_n[1].min = 0; m_icam_ccd_frame_n[1].max = hCcd-1; m_icam_ccd_frame_n[1].value = 0; // WIDTH m_icam_ccd_frame_n[2].min = 1; m_icam_ccd_frame_n[2].max = wCcd; m_icam_ccd_frame_n[2].value = wCcd; // HEIGHT m_icam_ccd_frame_n[3].min = 1; m_icam_ccd_frame_n[3].max = hCcd; m_icam_ccd_frame_n[3].value = hCcd; // STATE m_icam_ccd_frame_np.s = IPS_OK; #else // CCD FRAME X: m_icam_frame_x_n[0].min = 0; m_icam_frame_x_n[0].max = 0; m_icam_frame_x_n[0].value = 0; m_icam_frame_x_np.s = IPS_OK; // CCD FRAME Y: m_icam_frame_y_n[0].min = 0; m_icam_frame_y_n[0].max = 0; m_icam_frame_y_n[0].value = 0; m_icam_frame_y_np.s = IPS_OK; // CCD FRAME W: m_icam_frame_w_n[0].min = 1; m_icam_frame_w_n[0].max = wCcd; m_icam_frame_w_n[0].value = wCcd; m_icam_frame_w_np.s = IPS_OK; // CCD FRAME H: m_icam_frame_h_n[0].min = 1; m_icam_frame_h_n[0].max = hCcd; m_icam_frame_h_n[0].value = hCcd; // STATE m_icam_frame_h_np.s = IPS_OK; #endif if(bUpdateClient){ IDSetNumber(&m_icam_pixel_size_np, 0); #ifdef USE_CCD_FRAME_STANDARD_PROPERTY IDSetNumber(&m_icam_ccd_frame_np, 0); IUUpdateMinMax(&m_icam_ccd_frame_np); #else IDSetNumber(&m_icam_frame_x_np, 0); IDSetNumber(&m_icam_frame_y_np, 0); IDSetNumber(&m_icam_frame_w_np, 0); IDSetNumber(&m_icam_frame_h_np, 0); IUUpdateMinMax(&m_icam_frame_x_np); IUUpdateMinMax(&m_icam_frame_y_np); IUUpdateMinMax(&m_icam_frame_w_np); IUUpdateMinMax(&m_icam_frame_h_np); #endif } } return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetSelectedCcdChip(int &ccd_request) { int res = CE_NO_ERROR; ISwitch *p = IUFindOnSwitch(&m_icam_ccd_request_sp); if(p){ if(!strcmp(p->name, CCD_IMAGING_NAME_S)){ ccd_request = CCD_IMAGING; }else if(!strcmp(p->name, CCD_TRACKING_NAME_S)){ ccd_request = CCD_TRACKING; }else if(!strcmp(p->name, CCD_EXT_TRACKING_NAME_S)){ ccd_request = CCD_EXT_TRACKING; }else{ res = CE_BAD_PARAMETER; IDMessage(DEVICE_NAME, "Error: No CCD chip found! " "[m_icam_ccd_request_sp]!"); } }else{ res = CE_OS_ERROR; IDMessage(DEVICE_NAME, "Error: No switch ON found! " "[m_icam_ccd_request_sp]."); } return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetSelectedCcdBinningMode(int &binning) { int res = CE_NO_ERROR; #ifdef USE_CCD_BINNING_STANDARD_PROPERTY if((m_icam_ccd_binning_n[0].value == 1)&& (m_icam_ccd_binning_n[1].value == 1)){ binning = CCD_BIN_1x1_I; }else if((m_icam_ccd_binning_n[0].value == 2)&& (m_icam_ccd_binning_n[1].value == 2)){ binning = CCD_BIN_2x2_I; }else if((m_icam_ccd_binning_n[0].value == 3)&& (m_icam_ccd_binning_n[1].value == 3)){ binning = CCD_BIN_3x3_I; }else if((m_icam_ccd_binning_n[0].value == 9)&& (m_icam_ccd_binning_n[1].value == 9)){ binning = CCD_BIN_9x9_I; }else{ res = CE_BAD_PARAMETER; IDMessage(DEVICE_NAME, "Error: Bad CCD binning mode! " "Use: 1x1, 2x2 or 3x3"); } #else ISwitch *p = IUFindOnSwitch(&m_icam_binning_mode_sp); if(p){ if(!strcmp(p->name, CCD_BIN_1x1_I_NAME_S)){ binning = CCD_BIN_1x1_I; }else if(!strcmp(p->name, CCD_BIN_2x2_I_NAME_S)){ binning = CCD_BIN_2x2_I; }else if(!strcmp(p->name, CCD_BIN_3x3_I_NAME_S)){ binning = CCD_BIN_3x3_I; }else if(!strcmp(p->name, CCD_BIN_9x9_I_NAME_S)){ binning = CCD_BIN_9x9_I; }else if(!strcmp(p->name, CCD_BIN_2x2_E_NAME_S)){ binning = CCD_BIN_2x2_E; }else if(!strcmp(p->name, CCD_BIN_3x3_E_NAME_S)){ binning = CCD_BIN_3x3_E; }else{ res = CE_BAD_PARAMETER; IDMessage(DEVICE_NAME, "Error: No CCD binning mode found! " "[m_icam_binning_mode_sp]!"); } }else{ res = CE_OS_ERROR; IDMessage(DEVICE_NAME, "Error: No switch ON found! " "[m_icam_binning_mode_sp]"); } #endif return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetSelectedCcdFrameType(string &frame_type) { int res = CE_NO_ERROR; ISwitch *p = IUFindOnSwitch(&m_icam_frame_type_sp); if(p){ frame_type = p->name; }else{ res = CE_OS_ERROR; IDMessage(DEVICE_NAME, "Error: No switch ON found! " "[m_icam_frame_type_sp]"); } return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetCcdShutterMode(int &shutter, int ccd) { string frame_type; int res = GetSelectedCcdFrameType(frame_type); if(res != CE_NO_ERROR) return(res); if( !strcmp(frame_type.c_str(), CCD_FRAME_LIGHT_NAME_N) || !strcmp(frame_type.c_str(), CCD_FRAME_FLAT_NAME_N) || !strcmp(frame_type.c_str(), CCD_FRAME_BIAS_NAME_N) ){ if(ccd == CCD_EXT_TRACKING){ shutter = SC_OPEN_EXT_SHUTTER; }else{ shutter = SC_OPEN_SHUTTER; } }else if(!strcmp(frame_type.c_str(), CCD_FRAME_DARK_NAME_N)){ if(ccd == CCD_EXT_TRACKING){ shutter = SC_CLOSE_EXT_SHUTTER; }else{ shutter = SC_CLOSE_SHUTTER; } }else{ res = CE_OS_ERROR; IDMessage(DEVICE_NAME, "Error: Unknown selected CCD frame type! " "[m_icam_frame_type_sp]"); } return(res); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::ISNewSwitch(const char *name, ISState *states, char *names[], int num) { int res; string str; CFWResults cfwr; // CCD CONNECTION: if(!strcmp(name, m_icam_connection_sp.name)){ IUResetSwitch(&m_icam_connection_sp); IUUpdateSwitch(&m_icam_connection_sp, states, names, num); // Check open/close request: if(m_icam_connection_s[0].s == ISS_ON){ // Open device: if((res = OpenDevice(m_icam_device_port_tp.tp->text)) == CE_NO_ERROR){ // Establish link: if((res = EstablishLink()) == CE_NO_ERROR){ // Link established. UpdateProperties(); }else{ // Establish link error. m_icam_connection_s[0].s = ISS_OFF; m_icam_connection_s[1].s = ISS_ON; m_icam_connection_sp.s = IPS_IDLE; str = "Error: Cannot establish link to SBIG CCD camera. "; str += GetErrorString(res); IDSetSwitch(&m_icam_connection_sp, "%s", str.c_str()); } }else{ // Open device error. m_icam_connection_s[0].s = ISS_OFF; m_icam_connection_s[1].s = ISS_ON; m_icam_connection_sp.s = IPS_IDLE; str = "Error: Cannot open SBIG CCD camera device. "; str += GetErrorString(res); IDSetSwitch(&m_icam_connection_sp, "%s", str.c_str()); } }else{ // Close device. if((res = CloseDevice()) == CE_NO_ERROR){ UpdateProperties(); }else{ // Close device error: m_icam_connection_s[0].s = ISS_ON; m_icam_connection_s[1].s = ISS_OFF; m_icam_connection_sp.s = IPS_ALERT; str = "Error: Cannot close SBIG CCD camera device. "; str += GetErrorString(res); IDSetSwitch(&m_icam_connection_sp, "%s", str.c_str()); } } return; } // CCD REQUEST: if(!strcmp(name, m_icam_ccd_request_sp.name)){ if(CheckConnection(&m_icam_ccd_request_sp) == false) return; IUResetSwitch(&m_icam_ccd_request_sp); IUUpdateSwitch(&m_icam_ccd_request_sp, states, names, num); m_icam_ccd_request_sp.s = IPS_OK; IDSetSwitch(&m_icam_ccd_request_sp, 0); UpdateCcdFrameProperties(true); return; } // CCD FAN: if(!strcmp(name, m_icam_fan_state_sp.name)){ if(CheckConnection(&m_icam_fan_state_sp) == false) return; IUResetSwitch(&m_icam_fan_state_sp); IUUpdateSwitch(&m_icam_fan_state_sp, states, names, num); // Switch FAN ON/OFF: MiscellaneousControlParams mcp; if(m_icam_fan_state_s[0].s == ISS_ON){ mcp.fanEnable = 1; }else{ mcp.fanEnable = 0; } mcp.shutterCommand = SC_LEAVE_SHUTTER; mcp.ledState = LED_OFF; if((res = MiscellaneousControl(&mcp)) == CE_NO_ERROR){ m_icam_fan_state_sp.s = IPS_OK; if(mcp.fanEnable == 1){ str = "Fan turned ON."; }else{ str = "Fan turned OFF."; } }else{ m_icam_fan_state_sp.s = IPS_ALERT; if(mcp.fanEnable == 1){ str = "Error: Cannot turn Fan ON. "; }else{ str = "Error: Cannot turn Fan OFF."; } str += GetErrorString(res); } IDSetSwitch(&m_icam_fan_state_sp, "%s", str.c_str()); return; } // CCD FRAME TYPE: if(!strcmp(name, m_icam_frame_type_sp.name)){ IUResetSwitch(&m_icam_frame_type_sp); IUUpdateSwitch(&m_icam_frame_type_sp, states, names, num); m_icam_frame_type_sp.s = IPS_OK; IDSetSwitch(&m_icam_frame_type_sp, 0); return; } // CCD BINNING: #ifndef USE_CCD_BINNING_STANDARD_PROPERTY if(!strcmp(name, m_icam_binning_mode_sp.name)){ if(CheckConnection(&m_icam_binning_mode_sp) == false) return; IUResetSwitch(&m_icam_binning_mode_sp); IUUpdateSwitch(&m_icam_binning_mode_sp, states, names, num); m_icam_binning_mode_sp.s = IPS_OK; IDSetSwitch(&m_icam_binning_mode_sp, 0); UpdateCcdFrameProperties(true); return; } #endif // CCD TEMPERATURE: if(!strcmp(name, m_icam_temperature_msg_sp.name)){ IUResetSwitch(&m_icam_temperature_msg_sp); IUUpdateSwitch(&m_icam_temperature_msg_sp, states, names, num); m_icam_temperature_msg_sp.s = IPS_OK; IDSetSwitch(&m_icam_temperature_msg_sp, 0); return; } // CFW TYPE: if(!strcmp(name, m_icfw_type_sp.name)){ if(CheckConnection(&m_icfw_type_sp) == false) return; // Allow change of CFW's type only if not already connected. if(m_icfw_connection_s[0].s == ISS_OFF){ IUResetSwitch(&m_icfw_type_sp); IUUpdateSwitch(&m_icfw_type_sp, states, names, num); str = ""; }else{ str = "Cannot change CFW type while connected!"; } m_icfw_type_sp.s = IPS_OK; IDSetSwitch(&m_icfw_type_sp, "%s", str.c_str()); return; } // CFW CONNECTION: if(!strcmp(name, m_icfw_connection_sp.name)){ if(CheckConnection(&m_icfw_connection_sp) == false) return; IUResetSwitch(&m_icfw_connection_sp); IUUpdateSwitch(&m_icfw_connection_sp, states, names, num); m_icfw_connection_sp.s = IPS_BUSY; IDSetSwitch(&m_icfw_connection_sp, 0); if(m_icfw_connection_s[0].s == ISS_ON){ // Open device. if(CfwConnect() == CE_NO_ERROR){ m_icfw_connection_sp.s = IPS_OK; IDSetSwitch(&m_icfw_connection_sp, "CFW connected."); }else{ m_icfw_connection_sp.s = IPS_ALERT; IDSetSwitch(&m_icfw_connection_sp, "CFW connection error!"); } }else{ // Close device. if(CfwDisconnect() == CE_NO_ERROR){ m_icfw_connection_sp.s = IPS_ALERT; IDSetSwitch(&m_icfw_connection_sp, "CFW disconnection error!"); }else{ // Update CFW's Product/ID texts. cfwr.cfwModel = CFWSEL_UNKNOWN; cfwr.cfwPosition = CFWP_UNKNOWN; cfwr.cfwStatus = CFWS_UNKNOWN; cfwr.cfwError = CFWE_DEVICE_NOT_OPEN; cfwr.cfwResult1 = 0; cfwr.cfwResult2 = 0; CfwUpdateProperties(cfwr); // Remove connection text. m_icfw_connection_sp.s = IPS_IDLE; IDSetSwitch(&m_icfw_connection_sp, "CFW disconnected."); } } return; } } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::ISNewText( const char *name, char *texts[], char *names[], int /*num*/) { string str; // CCD DEVICE PORT: if(!strcmp(name, m_icam_device_port_tp.name)){ IText *pIText = IUFindText(&m_icam_device_port_tp, names[0]); if(pIText) IUSaveText(pIText, texts[0]); m_icam_device_port_tp.s = IPS_OK; IDSetText(&m_icam_device_port_tp, 0); } } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::ISNewNumber(const char *name, double values[], char *names[], int num) { int res = CE_NO_ERROR, wCcd, hCcd, ccd, binning; double wPixel, hPixel; // CCD EXPOSE DURATION: if(!strcmp(name, m_icam_expose_time_np.name)){ IUUpdateNumber(&m_icam_expose_time_np, values, names, num); if(m_icam_expose_time_np.s == IPS_BUSY){ StopExposure(); }else{ StartExposure(); } } // CCD TEMPERATURE: if(!strcmp(name, m_icam_temperature_np.name)){ if(CheckConnection(&m_icam_temperature_np) == false) return; if(values[0] < MIN_CCD_TEMP || values[0] > MAX_CCD_TEMP){ m_icam_temperature_np.s = IPS_IDLE; IDSetNumber(&m_icam_temperature_np, "Error: Bad temperature value! " "Range is [%.1f, %.1f] [C].", MIN_CCD_TEMP, MAX_CCD_TEMP); return; } if((res = SetTemperatureRegulation(values[0])) == CE_NO_ERROR){ // Set property to busy and poll in ISPoll for CCD temp m_icam_temperature_n[0].value = values[0]; m_icam_temperature_np.s = IPS_BUSY; IDSetNumber(&m_icam_temperature_np, "Setting CCD temperature to %+.1f [C].", values[0]); }else{ m_icam_temperature_np.s = IPS_ALERT; IDSetNumber(&m_icam_temperature_np, "Error: Cannot set CCD temperature to %+.1f [C]. %s", values[0], GetErrorString(res).c_str()); } } // CCD TEMPERATURE POOLING: if(!strcmp(name, m_icam_temperature_polling_np.name)){ m_icam_temperature_polling_np.s = IPS_OK; IUUpdateNumber(&m_icam_temperature_polling_np, values, names, num); IDSetNumber(&m_icam_temperature_polling_np, 0); } // CCD BINNING: #ifdef USE_CCD_BINNING_STANDARD_PROPERTY if(!strcmp(name, m_icam_ccd_binning_np.name)){ m_icam_ccd_binning_np.s = IPS_OK; // Update the values according to the actual CCD binning mode possibilities. // HOR_BIN == value[0], VER_BIN == value[1] if(values[0] != values[1]) values[1] = values[0]; IUUpdateNumber(&m_icam_ccd_binning_np, values, names, num); IDSetNumber(&m_icam_ccd_binning_np, 0); UpdateCcdFrameProperties(true); } #endif // CCD FRAME: #ifdef USE_CCD_FRAME_STANDARD_PROPERTY if(!strcmp(name, m_icam_ccd_frame_np.name)){ m_icam_ccd_frame_np.s = IPS_OK; // Update the values according to the actual CCD info. if((res = GetSelectedCcdChip(ccd)) == CE_NO_ERROR){ if((res = GetSelectedCcdBinningMode(binning)) == CE_NO_ERROR){ res = GetCcdSizeInfo(ccd, binning, wCcd, hCcd, wPixel, hPixel); if(res == CE_NO_ERROR){ // CCD_X + CCD_WIDTH if((values[0] + values[2]) >= wCcd){ values[2] = wCcd - values[0]; } // CCD_Y + CCD_HEIGHT if((values[1] + values[3]) >= hCcd){ values[3] = hCcd - values[1]; } } } } IUUpdateNumber(&m_icam_ccd_frame_np, values, names, num); IDSetNumber(&m_icam_ccd_frame_np, 0); } #else // CCD FRAME X: if(!strcmp(name, m_icam_frame_x_np.name)){ m_icam_frame_x_np.s = IPS_OK; IUUpdateNumber(&m_icam_frame_x_np, values, names, num); IDSetNumber(&m_icam_frame_x_np, 0); } // CCD FRAME Y: if(!strcmp(name, m_icam_frame_y_np.name)){ m_icam_frame_y_np.s = IPS_OK; IUUpdateNumber(&m_icam_frame_y_np, values, names, num); IDSetNumber(&m_icam_frame_y_np, 0); } // CCD FRAME W: if(!strcmp(name, m_icam_frame_w_np.name)){ m_icam_frame_w_np.s = IPS_OK; IUUpdateNumber(&m_icam_frame_w_np, values, names, num); IDSetNumber(&m_icam_frame_w_np, 0); // Update Min/Max of CCD_FRAME_X: m_icam_frame_x_n[0].max = m_icam_frame_w_n[0].max - m_icam_frame_w_n[0].value - 1; m_icam_frame_x_np.s = IPS_OK; IUUpdateMinMax(&m_icam_frame_x_np); } // CCD FRAME H: if(!strcmp(name, m_icam_frame_h_np.name)){ m_icam_frame_h_np.s = IPS_OK; IUUpdateNumber(&m_icam_frame_h_np, values, names, num); IDSetNumber(&m_icam_frame_h_np, 0); // Update Min/Max of CCD_FRAME_Y: m_icam_frame_y_n[0].max = m_icam_frame_h_n[0].max - m_icam_frame_h_n[0].value - 1; m_icam_frame_y_np.s = IPS_OK; IUUpdateMinMax(&m_icam_frame_y_np); } #endif // CFW SLOT: CFWResults cfwr; int type; char str[64]; if(!strcmp(name, m_icfw_slot_np.name)){ // Use CFW's GOTO only if already connected: if(m_icfw_connection_s[0].s != ISS_ON) return; m_icfw_slot_np.s = IPS_BUSY; IDSetNumber(&m_icfw_slot_np, 0); IUUpdateNumber(&m_icfw_slot_np, values, names, num); if(CfwGoto(&cfwr) == CE_NO_ERROR){ type = GetCfwSelType(); if(type == CFWSEL_CFW6A || type == CFWSEL_CFW8){ sprintf(str, "CFW position reached."); }else{ sprintf(str, "CFW position %d reached.", cfwr.cfwPosition); } m_icfw_slot_n[0].value = cfwr.cfwPosition; m_icfw_slot_np.s = IPS_OK; }else{ // CFW error occurred, so report all the available infos to the client: CfwShowResults("CFWGoto:", cfwr); m_icfw_slot_np.s = IPS_ALERT; sprintf(str, "Please Connect/Disconnect CFW, than try again..."); } IDSetNumber(&m_icfw_slot_np, "%s", str); } } #endif // INDI //========================================================================== #ifdef INDI bool SbigCam::CheckConnection(ISwitchVectorProperty *vp) { if(m_icam_connection_sp.s != IPS_OK){ IDMessage(DEVICE_NAME, "Cannot change property '%s' while the CCD is offline.", vp->name); vp->s = IPS_IDLE; IDSetSwitch(vp, NULL); return(false); } return(true); } #endif // INDI //========================================================================== #ifdef INDI bool SbigCam::CheckConnection(INumberVectorProperty *vp) { if(m_icam_connection_sp.s != IPS_OK){ IDMessage(DEVICE_NAME, "Cannot change property '%s' while the CCD is offline.", vp->name); vp->s = IPS_IDLE; IDSetNumber(vp, NULL); return(false); } return(true); } #endif // INDI //========================================================================== #ifdef INDI bool SbigCam::CheckConnection(ITextVectorProperty *vp) { if(m_icam_connection_sp.s != IPS_OK){ IDMessage(DEVICE_NAME, "Cannot change property '%s' while the CCD is offline.", vp->name); vp->s = IPS_IDLE; IDSetText(vp, NULL); return(false); } return(true); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::UpdateTemperature(void *p) { SbigCam *pSbigCam = (SbigCam *)p; if(pSbigCam->CheckLink()) pSbigCam->UpdateTemperature(); IEAddTimer( pSbigCam->GetCcdTemperaturePoolingTime(), SbigCam::UpdateTemperature, pSbigCam); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::UpdateTemperature() { bool enabled; double ccdTemp, setpointTemp, percentTE, power; // Get temperature status, ignore possible errors. if(QueryTemperatureStatus(enabled, ccdTemp, setpointTemp, percentTE) == CE_NO_ERROR){ // Compare the current temperature against the setpoint value: if(fabs(setpointTemp - ccdTemp) <= TEMP_DIFF){ m_icam_temperature_np.s = IPS_OK; }else{ m_icam_temperature_np.s = IPS_BUSY; } m_icam_temperature_n[0].value = ccdTemp; // Check the TE cooler if inside the range: power = 100.0 * percentTE; if(power <= CCD_COOLER_THRESHOLD){ m_icam_cooler_np.s = IPS_OK; }else{ m_icam_cooler_np.s = IPS_BUSY; } m_icam_cooler_n[0].value = power; // Update the client's properties: if(m_icam_temperature_msg_s[0].s == ISS_ON){ IDSetNumber(&m_icam_temperature_np, "CCD temperature %+.1f [C], TE cooler: %.1f [%%].", ccdTemp, power); }else{ IDSetNumber(&m_icam_temperature_np, 0); } IDSetNumber(&m_icam_cooler_np, 0); } } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetCcdTemperaturePoolingTime() { return((int)(m_icam_temperature_polling_n[0].value * 1000)); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::UpdateExposure(void *p) { SbigCam *pSbigCam = (SbigCam *)p; if(pSbigCam->CheckLink()) pSbigCam->UpdateExposure(); IEAddTimer(POLL_EXPOSURE_MS, SbigCam::UpdateExposure, pSbigCam); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::StartExposure() { int res; // Sanity check: int ccd, binning, shutter; if((res = GetSelectedCcdChip(ccd)) != CE_NO_ERROR) return(res); if((res = GetCcdShutterMode(shutter, ccd)) != CE_NO_ERROR) return(res); if((res = GetSelectedCcdBinningMode(binning))!= CE_NO_ERROR) return(res); // Is the expose time zero ? if(m_icam_expose_time_n[0].value == 0){ m_icam_expose_time_np.s = IPS_ALERT; IDSetNumber(&m_icam_expose_time_np, 0); IDMessage(DEVICE_NAME, "Please set non-zero exposure time and try again."); return(CE_BAD_PARAMETER); } // Save the current temperature because needed for the FITS file: bool enabled; double ccdTemp, setpointTemp, percentTE; res = QueryTemperatureStatus(enabled, ccdTemp, setpointTemp, percentTE); if(res == CE_NO_ERROR){ SaveTemperature(ccdTemp); }else{ SaveTemperature(0.0); } // Save exposure time, necessary for FITS file: SaveExposeTime(m_icam_expose_time_n[0].value); // Calculate an expose time: ulong expTime = (ulong)floor(m_icam_expose_time_n[0].value * 100.0 + 0.5); // Start exposure: StartExposureParams sep; sep.ccd = (unsigned short)ccd; sep.abgState = (unsigned short)ABG_LOW7; sep.openShutter = (unsigned short)shutter; sep.exposureTime = expTime; if((res = StartExposure(&sep)) != CE_NO_ERROR) return(res); // Save start time of the exposure: SetStartExposureTimestamp(timestamp()); // Update client's property: string msg, frame_type; if((res = GetSelectedCcdFrameType(frame_type)) != CE_NO_ERROR) return(res); // Update the expose time property: m_icam_expose_time_np.s = IPS_BUSY; IDSetNumber(&m_icam_expose_time_np, 0); // Update FITS file name: IUFillText(&m_icam_fits_name_t[0], FITS_NAME_T, FITS_LABEL_T, ""); m_icam_fits_name_tp.s = IPS_IDLE; IDSetText(&m_icam_fits_name_tp, 0); // Update BLOB property: SetBlobState(IPS_BUSY); // Update exposure action button properties: if(!strcmp(frame_type.c_str(), CCD_FRAME_LIGHT_NAME_N)){ msg = "LF exposure in progress..."; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_DARK_NAME_N)){ msg = "DF exposure in progress..."; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_FLAT_NAME_N)){ msg = "FF exposure in progress..."; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_BIAS_NAME_N)){ msg = "BF exposure in progress..."; } IDMessage(DEVICE_NAME, "%s", msg.c_str()); return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::StopExposure() { int res, ccd; string msg; if((res = GetSelectedCcdChip(ccd)) != CE_NO_ERROR) return(res); // END_EXPOSURE: EndExposureParams eep; eep.ccd = (unsigned short)ccd; res = EndExposure(&eep); // Update expose time property: m_icam_expose_time_n[0].value = 0; if(res == CE_NO_ERROR){ m_icam_expose_time_np.s = IPS_IDLE; msg = "Exposure cancelled."; }else{ m_icam_expose_time_np.s = IPS_ALERT; msg = "Stop exposure error."; } IDSetNumber(&m_icam_expose_time_np, 0); IDMessage(DEVICE_NAME, "%s", msg.c_str()); // Update BLOB property: SetBlobState(IPS_IDLE); return(res); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::UpdateExposure() { // If no expose in progress, then return: if(m_icam_expose_time_np.s != IPS_BUSY) return; int ccd; if(GetSelectedCcdChip(ccd) != CE_NO_ERROR) return; EndExposureParams eep; QueryCommandStatusParams qcsp; QueryCommandStatusResults qcsr; // Query command status: qcsp.command = CC_START_EXPOSURE; if(QueryCommandStatus(&qcsp, &qcsr) != CE_NO_ERROR) return; int mask = 12; // Tracking & external tracking CCD chip mask. if(ccd == CCD_IMAGING) mask = 3; // Imaging chip mask. // Check exposure progress: if((qcsr.status & mask) != mask){ // The exposure is still in progress, decrement an // exposure time: if(--m_icam_expose_time_n[0].value < 0){ m_icam_expose_time_n[0].value = 0; } // Update expose propery, but do not change its status now: IDSetNumber(&m_icam_expose_time_np, 0); return; } // Exposure done - update client's property: eep.ccd = ccd; EndExposure(&eep); // Get image size: #ifdef USE_CCD_FRAME_STANDARD_PROPERTY unsigned short left = (unsigned short)m_icam_ccd_frame_n[0].value; unsigned short top = (unsigned short)m_icam_ccd_frame_n[1].value; unsigned short width = (unsigned short)m_icam_ccd_frame_n[2].value; unsigned short height = (unsigned short)m_icam_ccd_frame_n[3].value; #else unsigned short left = (unsigned short)m_icam_frame_x_n[0].value; unsigned short top = (unsigned short)m_icam_frame_y_n[0].value; unsigned short width = (unsigned short)m_icam_frame_w_n[0].value; unsigned short height = (unsigned short)m_icam_frame_h_n[0].value; #endif // Allocate image buffer: //unsigned short **buffer = AllocateBuffer(width, height); unsigned short *buffer = AllocateBuffer(width, height); if(!buffer) return; // Readout CCD: IDMessage(DEVICE_NAME, "CCD readout in progress..."); if(ReadoutCcd(left, top, width, height, buffer) != CE_NO_ERROR){ ReleaseBuffer(height, buffer); IDMessage(DEVICE_NAME, "CCD readout error!"); return; } // Create unige FITS name: string fits_name = CreateFitsName(); // Write FITS: if(WriteFits(fits_name, width, height, buffer) != CE_NO_ERROR){ ReleaseBuffer(height, buffer); IDMessage(DEVICE_NAME, "WriteFits error!"); return; } // Release image buffer: if(ReleaseBuffer(height, buffer) != CE_NO_ERROR){ IDMessage(DEVICE_NAME, "ReleaseBuffer error!"); return; } // Upload FITS file name: IUFillText(&m_icam_fits_name_t[0], FITS_NAME_T, FITS_LABEL_T, fits_name.c_str()); m_icam_fits_name_tp.s = IPS_OK; IDSetText(&m_icam_fits_name_tp, 0); // Upload FITS file data: if (( UploadFits(fits_name) != CE_NO_ERROR)) return; // Update exposure time properties: m_icam_expose_time_n[0].value = GetExposeTime(); m_icam_expose_time_np.s = IPS_OK; IDSetNumber(&m_icam_expose_time_np, 0); // Update BLOB property: //SetBlobState(IPS_OK); // Send exposure done message: IDMessage(DEVICE_NAME, "CCD exposure done!"); } #endif // INDI //========================================================================== #ifdef INDI unsigned short *SbigCam::AllocateBuffer(unsigned short width, unsigned short height) { unsigned short *buffer = 0; try { // Allocate new image buffer: //size_t wlen = width * sizeof(unsigned short); buffer = new unsigned short [width * height]; memset(buffer, 0, height * width * sizeof(unsigned short)); //memset(buffer, 0, height * sizeof(unsigned short*)); //for(int h = 0; h < height; h++){ // buffer[h] = new unsigned short [width]; // memset(buffer[h], 0, wlen); //} } catch(bad_alloc &exception) { ReleaseBuffer(height, buffer); buffer = 0; IDMessage(DEVICE_NAME, "Error: AllocateBuffer - exception!"); } return(buffer); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::ReleaseBuffer(unsigned short height, unsigned short *buffer) { if(!buffer) return(CE_NO_ERROR); // Release buffer now: //for(int y = 0; y < height; y++){ // if(buffer[y]) delete [] buffer[y]; //} delete [] buffer; buffer = 0; return(CE_NO_ERROR); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::ReadoutCcd( unsigned short left, unsigned short top, unsigned short width, unsigned short height, unsigned short *buffer) { int h, w, ccd, binning, res; if((res = GetSelectedCcdChip(ccd)) != CE_NO_ERROR) return(res); if((res = GetSelectedCcdBinningMode(binning)) != CE_NO_ERROR) return(res); StartReadoutParams srp; srp.ccd = ccd; srp.readoutMode = binning; srp.left = left; srp.top = top; srp.width = width; srp.height = height; if((res = StartReadout(&srp)) != CE_NO_ERROR){ IDMessage(DEVICE_NAME, "ReadoutCcd - StartReadout error!"); return(res); } // Readout lines. ReadoutLineParams rlp; rlp.ccd = ccd; rlp.readoutMode = binning; rlp.pixelStart = left; rlp.pixelLength = width; // Readout CCD row by row: for(h = 0; h < height; h++){ ReadoutLine(&rlp, buffer + (h * width), false); } // Perform little endian to big endian (network order) // conversion since FITS is stored in big endian. /*for(h = 0; h < height; h++){ for(w = 0 ; w < width; w++){ //buffer[h][w] = GET_BIG_ENDIAN(buffer[h][w] - 32768); buffer[h * width + w] = GET_BIG_ENDIAN(buffer[h * width + w]); } }*/ // End readout: EndReadoutParams erp; erp.ccd = ccd; if((res = EndReadout(&erp)) != CE_NO_ERROR){ IDMessage(DEVICE_NAME, "ReadoutCcd - EndReadout error!"); return(res); } return(res); } #endif // INDI //========================================================================== #ifdef INDI string SbigCam::CreateFitsName() { // Create unige FITS name: // Each file name has a form: XY_YYYY-MM-DDTHH:MM:SS.fits // where XY is: LF for taking light frame // DF for taking dark frame // BF for taking bias frame // FF for taking flat field // XX if file type is not recognized. string frame_type; GetSelectedCcdFrameType(frame_type); string file_name = "XX_"; if(!strcmp(frame_type.c_str(), CCD_FRAME_LIGHT_NAME_N)){ file_name = "LF_"; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_DARK_NAME_N)){ file_name = "DF_"; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_FLAT_NAME_N)){ file_name = "FF_"; }else if(!strcmp(frame_type.c_str(), CCD_FRAME_BIAS_NAME_N)){ file_name = "BF_"; } file_name += GetStartExposureTimestamp() + ".fits"; return(file_name); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::WriteFits( string fits_name, unsigned short width, unsigned short height, unsigned short *buffer) { fitsfile *fptr; /* pointer to the FITS file; defined in fitsio.h */ int status=0; long fpixel = 1, naxis = 2, nelements; long naxes[2]; int res = CE_NO_ERROR; naxes[0] = width; naxes[1] = height; nelements = naxes[0] * naxes[1]; /* number of pixels to write */ // Insert ! to overwrite if file already exists fits_name.insert(0, "!"); /* create new file */ if (fits_create_file(&fptr, fits_name.c_str(), &status)) { IDMessage(DEVICE_NAME, "Error: WriteFits - cannot open FITS file for writing."); return(CE_OS_ERROR); } /* Create the primary array image (16-bit short integer pixels */ if (fits_create_img(fptr, USHORT_IMG, naxis, naxes, &status)) { IDMessage(DEVICE_NAME, "Error: WriteFits - cannot create FITS image."); return(CE_OS_ERROR); } CreateFitsHeader(fptr, width, height); /* Write the array of integers to the image */ if (fits_write_img(fptr, TUSHORT, fpixel, nelements, buffer, &status)) { IDMessage(DEVICE_NAME, "Error: WriteFits - write error occurred."); res = CE_OS_ERROR; } fits_close_file(fptr, &status); /* close the file */ fits_report_error(stderr, status); /* print out any error messages */ return(res); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::CreateFitsHeader(fitsfile *fptr, unsigned int width, unsigned int height) { char card[FLEN_CARD]; int status=0; double temp_val; fits_update_key(fptr, TSTRING, "INSTRUME", m_icam_product_t[0].text, "CCD Name", &status); fits_update_key(fptr, TSTRING, "DETNAM", m_icam_product_t[1].text, "", &status); temp_val = GetLastExposeTime(); fits_update_key(fptr, TDOUBLE, "EXPTIME", &temp_val, "Total Exposure Time (s)", &status); temp_val = GetLastTemperature(); fits_update_key(fptr, TDOUBLE, "CCD-TEMP", &temp_val, "degrees celcius", &status); fits_update_key(fptr, TDOUBLE, "XPIXSZ", &m_icam_pixel_size_n[0].value, "um", &status); fits_update_key(fptr, TDOUBLE, "YPIXSZ", &m_icam_pixel_size_n[0].value, "um", &status); // XBINNING & YBINNING: int binning; if(GetSelectedCcdBinningMode(binning) == CE_NO_ERROR) { switch(binning) { case CCD_BIN_1x1_I: binning = 1; break; case CCD_BIN_2x2_I: case CCD_BIN_2x2_E: binning = 2; break; case CCD_BIN_3x3_I: case CCD_BIN_3x3_E: binning = 3; break; case CCD_BIN_9x9_I: binning = 9; break; default: binning = 0; break; } fits_update_key(fptr, TINT, "XBINNING", &binning, "1=1x1, 2=2x2, etc.", &status); fits_update_key(fptr, TINT, "YBINNING", &binning, "1=1x1, 2=2x2, etc.", &status); } #ifdef USE_CCD_FRAME_STANDARD_PROPERTY // XORGSUBF: fits_update_key(fptr, TINT, "XORGSUBF", &m_icam_ccd_frame_n[0].value, "", &status); // YORGSUBF: fits_update_key(fptr, TINT, "YORGSUBF", &m_icam_ccd_frame_n[1].value, "", &status); #else // XORGSUBF: fits_update_key(fptr, TINT, "XORGSUBF", &m_icam_frame_x_n[0].value, "", &status); fits_update_key(fptr, TINT, "YORGSUBF", &m_icam_frame_y_n[0].value, "", &status); #endif // IMAGETYP: string str; GetSelectedCcdFrameType(str); if(!strcmp(str.c_str(), CCD_FRAME_LIGHT_NAME_N)){ str = "Light Frame"; }else if(!strcmp(str.c_str(), CCD_FRAME_DARK_NAME_N)){ str = "Dark Frame"; }else if(!strcmp(str.c_str(), CCD_FRAME_FLAT_NAME_N)){ str = "Flat Field"; }else if(!strcmp(str.c_str(), CCD_FRAME_BIAS_NAME_N)){ str = "Bias Frame"; }else{ str = "Unknown"; } char frame[64]; strncpy(frame, str.c_str(), 64); fits_update_key(fptr, TSTRING, "IMAGETYP", frame, "Frame Type", &status); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::UploadFits(string fits_name) { struct stat stat_p; if(stat(fits_name.c_str(), &stat_p) < 0){ IDMessage( DEVICE_NAME, "Error: UploadFits - stat %s.", fits_name.c_str()); return(CE_OS_ERROR); } unsigned long total_bytes = stat_p.st_size; unsigned char *fits_data = (unsigned char *) malloc (sizeof(unsigned char) * total_bytes); if(fits_data == 0){ IDMessage( DEVICE_NAME, "Error: UploadFits - low memory. " "Unable to initialize FITS buffers."); return(CE_OS_ERROR); } #ifdef USE_BLOB_COMPRESS unsigned char *compressed_data = (unsigned char *) malloc(sizeof(unsigned char) * total_bytes + total_bytes / 64 + 16 + 3); if(compressed_data == 0){ IDMessage( DEVICE_NAME, "Error: UploadFits - low memory. " "Unable to initialize FITS buffers."); free (fits_data); return(CE_OS_ERROR); } #endif FILE *fits_file = fopen(fits_name.c_str(), "r"); if(fits_file == 0) { free (fits_data); return(CE_OS_ERROR); } // Read FITS file from disk: unsigned int i = 0, nr = 0; for (i=0; i < total_bytes; i+= nr){ nr = fread(fits_data + i, 1, total_bytes - i, fits_file); if(nr <= 0){ IDMessage(DEVICE_NAME, "Error: UploadFits - reading temporary FITS file."); free(compressed_data); return(CE_OS_ERROR); } } fclose(fits_file); #ifdef USE_BLOB_COMPRESS unsigned long compressed_bytes = sizeof(char) * total_bytes + total_bytes / 64 + 16 + 3; // Compress it: int r = compress2(compressed_data, &compressed_bytes, fits_data, total_bytes, 9); if(r != Z_OK){ // This should NEVER happen. IDMessage(DEVICE_NAME, "Error: UploadFits - compression failed: %d", r); return(CE_OS_ERROR); } #endif // Send BLOB: strcpy(m_icam_fits_b.format, BLOB_FORMAT_B); #ifdef USE_BLOB_COMPRESS m_icam_fits_b.blob = compressed_data; m_icam_fits_b.bloblen = compressed_bytes; #else m_icam_fits_b.blob = fits_data; m_icam_fits_b.bloblen = total_bytes; #endif m_icam_fits_b.size = total_bytes; m_icam_fits_bp.s = IPS_OK; //IDMessage(DEVICE_NAME, "--> Format : %s", m_icam_fits_b.format); //IDMessage(DEVICE_NAME, "--> Bytes : %u", m_icam_fits_b.bloblen); //IDMessage(DEVICE_NAME, "--> nbp : %d", m_icam_fits_bp.nbp); //IDMessage(DEVICE_NAME, "--> Size : %u", m_icam_fits_b.size); //IDMessage(DEVICE_NAME, "==> IDSetBLOB start..."); IDSetBLOB(&m_icam_fits_bp, 0); //IDMessage(DEVICE_NAME, "==> IDSetBLOB stop..."); // Remove FITS file from the server site: remove(fits_name.c_str()); // Release memory: free(fits_data); #ifdef USE_BLOB_COMPRESS free(compressed_data); #endif return(CE_NO_ERROR); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::SetBlobState(IPState state) { strcpy(m_icam_fits_b.format, BLOB_FORMAT_B); m_icam_fits_b.blob = 0; m_icam_fits_b.bloblen = 0; m_icam_fits_b.size = 0; m_icam_fits_bp.s = state; m_icam_fits_bp.bp = &m_icam_fits_b; IDSetBLOB(&m_icam_fits_bp, 0); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwConnect() { int res; CFWResults cfwr; ISwitch *p = IUFindOnSwitch(&m_icfw_type_sp); if(!p) return(CE_OS_ERROR); do{ // 1. CFWC_OPEN_DEVICE: if((res = CfwOpenDevice(&cfwr)) != CE_NO_ERROR){ m_icfw_connection_sp.s = IPS_IDLE; IDMessage(DEVICE_NAME, "CFWC_OPEN_DEVICE error: %s !", GetErrorString(res).c_str()); continue; } // 2. CFWC_INIT: if((res = CfwInit(&cfwr)) != CE_NO_ERROR){ IDMessage( DEVICE_NAME, "CFWC_INIT error: %s !", GetErrorString(res).c_str()); CfwCloseDevice(&cfwr); IDMessage(DEVICE_NAME, "CFWC_CLOSE_DEVICE called."); continue; } // 3. CFWC_GET_INFO: if((res = CfwGetInfo(&cfwr)) != CE_NO_ERROR){ IDMessage(DEVICE_NAME, "CFWC_GET_INFO error!"); continue; } // 4. CfwUpdateProperties: CfwUpdateProperties(cfwr); // 5. Set CFW's filter min/max values: m_icfw_slot_n[0].min = 1; m_icfw_slot_n[0].max = cfwr.cfwResult2; IUUpdateMinMax(&m_icfw_slot_np); }while(0); return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwDisconnect() { CFWResults cfwr; ISwitch *p = IUFindOnSwitch(&m_icfw_type_sp); if(!p) return(CE_OS_ERROR); // Close CFW device: return(CfwCloseDevice(&cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwOpenDevice(CFWResults *cfwr) { // Under Linux we always try to open the "sbigcfw" device. There has to be a // symbolic link (ln -s) between the actual device and this name. CFWParams cfwp; int res = CE_NO_ERROR; int cfwModel = GetCfwSelType(); switch(cfwModel){ case CFWSEL_CFW10_SERIAL: cfwp.cfwModel = cfwModel; cfwp.cfwCommand = CFWC_OPEN_DEVICE; res = SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr); break; default: break; } return(res); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwCloseDevice(CFWResults *cfwr) { CFWParams cfwp; cfwp.cfwModel = GetCfwSelType(); cfwp.cfwCommand = CFWC_CLOSE_DEVICE; return(SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwInit(CFWResults *cfwr) { // Try to init CFW maximum three times: int res; CFWParams cfwp; cfwp.cfwModel = GetCfwSelType(); cfwp.cfwCommand = CFWC_INIT; for(int i=0; i < 3; i++){ if((res = SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr)) == CE_NO_ERROR) break; sleep(1); } if(res != CE_NO_ERROR) return(res); return(CfwGotoMonitor(cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwGetInfo(CFWResults *cfwr) { CFWParams cfwp; cfwp.cfwModel = GetCfwSelType(); cfwp.cfwCommand = CFWC_GET_INFO; cfwp.cfwParam1 = CFWG_FIRMWARE_VERSION; return(SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwQuery(CFWResults *cfwr) { CFWParams cfwp; cfwp.cfwModel = GetCfwSelType(); cfwp.cfwCommand = CFWC_QUERY; return(SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwGoto(CFWResults *cfwr) { int res; CFWParams cfwp; cfwp.cfwModel = GetCfwSelType(); cfwp.cfwCommand = CFWC_GOTO; cfwp.cfwParam1 = (unsigned long)m_icfw_slot_n[0].value; if((res = SBIGUnivDrvCommand(CC_CFW, &cfwp, cfwr)) != CE_NO_ERROR) return(res); return(CfwGotoMonitor(cfwr)); } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::CfwGotoMonitor(CFWResults *cfwr) { int res; do{ if((res = CfwQuery(cfwr)) != CE_NO_ERROR) return(res); }while(cfwr->cfwStatus != CFWS_IDLE); return(res); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::CfwUpdateProperties(CFWResults cfwr) { char str[64]; bool bClear = false; switch(cfwr.cfwModel){ case CFWSEL_CFW2: sprintf(str, "%s", "CFW - 2"); break; case CFWSEL_CFW5: sprintf(str, "%s", "CFW - 5"); break; case CFWSEL_CFW6A: sprintf(str, "%s", "CFW - 6A"); break; case CFWSEL_CFW8: sprintf(str, "%s", "CFW - 8"); break; case CFWSEL_CFW402: sprintf(str, "%s", "CFW - 402"); break; case CFWSEL_CFW10: sprintf(str, "%s", "CFW - 10"); break; case CFWSEL_CFW10_SERIAL: sprintf(str, "%s", "CFW - 10SA"); break; case CFWSEL_CFWL: sprintf(str, "%s", "CFW - L"); break; default: sprintf(str, "%s", "Unknown"); bClear = true; break; } // Set CFW's product ID: IText *pIText = IUFindText(&m_icfw_product_tp, PRODUCT_NAME_T); if(pIText) IUSaveText(pIText, str); // Set CFW's firmware version: if(bClear){ sprintf(str, "%s", "Unknown"); }else{ sprintf(str, "%d", (int)cfwr.cfwResult1); } pIText = IUFindText(&m_icfw_product_tp, PRODUCT_ID_NAME_T); if(pIText) IUSaveText(pIText, str); m_icfw_product_tp.s = IPS_OK; IDSetText(&m_icfw_product_tp, 0); // Set CFW's filter min/max values: if(!bClear){ m_icfw_slot_n[0].min = 1; m_icfw_slot_n[0].max = cfwr.cfwResult2; IUUpdateMinMax(&m_icfw_slot_np); } } #endif // INDI //========================================================================== #ifdef INDI int SbigCam::GetCfwSelType() { int type = CFWSEL_UNKNOWN;; ISwitch *p = IUFindOnSwitch(&m_icfw_type_sp); if(p){ if(!strcmp(p->name, CFW1_NAME_S)){ type = CFWSEL_CFW2; }else if(!strcmp(p->name, CFW2_NAME_S)){ type = CFWSEL_CFW5; }else if(!strcmp(p->name, CFW3_NAME_S)){ type = CFWSEL_CFW6A; }else if(!strcmp(p->name, CFW4_NAME_S)){ type = CFWSEL_CFW8; }else if(!strcmp(p->name, CFW5_NAME_S)){ type = CFWSEL_CFW402; }else if(!strcmp(p->name, CFW6_NAME_S)){ type = CFWSEL_CFW10; }else if(!strcmp(p->name, CFW7_NAME_S)){ type = CFWSEL_CFW10_SERIAL; }else if(!strcmp(p->name, CFW8_NAME_S)){ type = CFWSEL_CFWL; #ifdef USE_CFW_AUTO }else if(!strcmp(p->name, CFW9_NAME_S)){ type = CFWSEL_AUTO; #endif } } return(type); } #endif // INDI //========================================================================== #ifdef INDI void SbigCam::CfwShowResults(string name, CFWResults cfwr) { IDMessage(DEVICE_NAME, "%s", name.c_str()); IDMessage(DEVICE_NAME, "CFW Model: %d", cfwr.cfwModel); IDMessage(DEVICE_NAME, "CFW Position: %d", cfwr.cfwPosition); IDMessage(DEVICE_NAME, "CFW Status: %d", cfwr.cfwStatus); IDMessage(DEVICE_NAME, "CFW Error: %d", cfwr.cfwError); IDMessage(DEVICE_NAME, "CFW Result1: %ld", cfwr.cfwResult1); IDMessage(DEVICE_NAME, "CFW Result2: %ld", cfwr.cfwResult2); } #endif // INDI //========================================================================== indi-sbig-1.0/config.h.cmake0000644000175000017500000000060011110507066013515 0ustar jrjr/* Define to 1 if you have the header file. */ #cmakedefine HAVE_LINUX_VIDEODEV2_H 1 /* The symbol timezone is an int, not a function */ #define TIMEZONE_IS_INT 1 /* Define if you have termios.h */ #cmakedefine HAVE_TERMIOS_H 1 /* Define if you have fitsio.h */ #cmakedefine HAVE_CFITSIO_H 1 /* Define if you have libnova.h */ #cmakedefine HAVE_NOVA_H 1 indi-sbig-1.0/COPYING.LIB0000644000175000017500000006133411110507066012473 0ustar jrjr GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! indi-sbig-1.0/CMakeLists.txt0000644000175000017500000000317411110507066013571 0ustar jrjrcmake_minimum_required(VERSION 2.4.7) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules/") set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/indi/") set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin") Include (CheckCXXSourceCompiles) include (MacroOptionalFindPackage) include (MacroLogFeature) include (MacroBoolTo01) include (CheckIncludeFiles) find_package(USB REQUIRED) find_package(CFITSIO REQUIRED) find_package(INDI REQUIRED) find_package(SBIG REQUIRED) find_package(ZLIB REQUIRED) macro_optional_find_package(Nova) macro_bool_to_01(NOVA_FOUND HAVE_NOVA_H) macro_log_feature(NOVA_FOUND "libnova" "A general purpose, double precision, Celestial Mechanics, Astrometry and Astrodynamics library" "http://libnova.sourceforge.net" FALSE "0.12.1" "Needed by INDI.") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) include_directories( ${CMAKE_CURRENT_BINARY_DIR}) include_directories( ${CMAKE_SOURCE_DIR}) include_directories( ${INDI_INCLUDE_DIR}) include_directories( ${CFITSIO_INCLUDE_DIR}) if (NOVA_FOUND) include_directories(${NOVA_INCLUDE_DIR}) endif (NOVA_FOUND) ########### SBIG ########### set(indisbig_SRCS ${CMAKE_SOURCE_DIR}/sbigcam.cpp ) add_executable(indi_sbig_ccd ${indisbig_SRCS}) target_link_libraries(indi_sbig_ccd ${INDI_LIBRARIES} ${INDI_DRIVER_LIBRARIES} ${CFITSIO_LIBRARIES} ${SBIG_LIBRARIES} z) if (NOVA_FOUND) target_link_libraries(indi_sbig_ccd ${NOVA_LIBRARIES}) endif (NOVA_FOUND) install(TARGETS indi_sbig_ccd RUNTIME DESTINATION bin ) install(FILES indi_sbig.xml DESTINATION ${DATA_INSTALL_DIR}) indi-sbig-1.0/cmake_modules/0000755000175000017500000000000011110507066013634 5ustar jrjrindi-sbig-1.0/cmake_modules/FindSBIG.cmake0000644000175000017500000000217111110507066016164 0ustar jrjr# - Try to find SBIG # Once done this will define # # SBIG_FOUND - system has SBIG # SBIG_LIBRARIES - Link these to use SBIG # Copyright (c) 2006, Jasem Mutlaq # Based on FindSBIG by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (SBIG_LIBRARIES) # in cache already set(SBIG_FOUND TRUE) message(STATUS "Found SBIG: ${SBIG_LIBRARIES}") else (SBIG_LIBRARIES) find_library(SBIG_LIBRARIES NAMES sbigudrv PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(SBIG_LIBRARIES) set(SBIG_FOUND TRUE) else (SBIG_LIBRARIES) set(SBIG_FOUND FALSE) endif(SBIG_LIBRARIES) if (SBIG_FOUND) if (NOT SBIG_FIND_QUIETLY) message(STATUS "Found SBIG: ${SBIG_LIBRARIES}") endif (NOT SBIG_FIND_QUIETLY) else (SBIG_FOUND) if (SBIG_FIND_REQUIRED) message(FATAL_ERROR "SBIG not found. Please install SBIG >= v2.0.0 and try again.") endif (SBIG_FIND_REQUIRED) endif (SBIG_FOUND) mark_as_advanced(SBIG_LIBRARIES) endif (SBIG_LIBRARIES) indi-sbig-1.0/cmake_modules/MacroOptionalFindPackage.cmake0000644000175000017500000000205211110507066021461 0ustar jrjr# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION() # MACRO_OPTIONAL_FIND_PACKAGE( [QUIT] ) # This macro is a combination of OPTION() and FIND_PACKAGE(), it # works like FIND_PACKAGE(), but additionally it automatically creates # an option name WITH_, which can be disabled via the cmake GUI. # or via -DWITH_=OFF # The standard _FOUND variables can be used in the same way # as when using the normal FIND_PACKAGE() # Copyright (c) 2006, Alexander Neundorf, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name ) OPTION(WITH_${_name} "Search for ${_name} package" ON) if (WITH_${_name}) FIND_PACKAGE(${_name} ${ARGN}) else (WITH_${_name}) set(${_name}_FOUND) set(${_name}_INCLUDE_DIR) set(${_name}_INCLUDES) set(${_name}_LIBRARY) set(${_name}_LIBRARIES) endif (WITH_${_name}) ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE) indi-sbig-1.0/cmake_modules/MacroBoolTo01.cmake0000644000175000017500000000121311110507066017154 0ustar jrjr# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN ) # This macro evaluates its first argument # and sets all the given vaiables either to 0 or 1 # depending on the value of the first one # Copyright (c) 2006, Alexander Neundorf, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. MACRO(MACRO_BOOL_TO_01 FOUND_VAR ) FOREACH (_current_VAR ${ARGN}) IF(${FOUND_VAR}) SET(${_current_VAR} 1) ELSE(${FOUND_VAR}) SET(${_current_VAR} 0) ENDIF(${FOUND_VAR}) ENDFOREACH(_current_VAR) ENDMACRO(MACRO_BOOL_TO_01) indi-sbig-1.0/cmake_modules/FindCFITSIO.cmake0000644000175000017500000000306311110507066016541 0ustar jrjr# - Try to find CFITSIO # Once done this will define # # CFITSIO_FOUND - system has CFITSIO # CFITSIO_INCLUDE_DIR - the CFITSIO include directory # CFITSIO_LIBRARIES - Link these to use CFITSIO # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) # in cache already set(CFITSIO_FOUND TRUE) message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}") else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) find_path(CFITSIO_INCLUDE_DIR fitsio.h PATH_SUFFIXES libcfitsio3 ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(CFITSIO_LIBRARIES NAMES cfitsio PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND TRUE) else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) set(CFITSIO_FOUND FALSE) endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) if (CFITSIO_FOUND) if (NOT CFITSIO_FIND_QUIETLY) message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}") endif (NOT CFITSIO_FIND_QUIETLY) else (CFITSIO_FOUND) if (CFITSIO_FIND_REQUIRED) message(FATAL_ERROR "CFITSIO not found. Please install libcfitsio3 and try again. http://indi.sf.net") endif (CFITSIO_FIND_REQUIRED) endif (CFITSIO_FOUND) mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES) endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) indi-sbig-1.0/cmake_modules/FindUSB.cmake0000644000175000017500000000271311110507066016073 0ustar jrjr# - Try to find LIBUSB # Once done this will define # # LIBUSB_FOUND - system has LIBUSB # LIBUSB_INCLUDE_DIR - the LIBUSB include directory # LIBUSB_LIBRARIES - Link these to use LIBUSB # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) # in cache already set(LIBUSB_FOUND TRUE) message(STATUS "Found LIBUSB: ${LIBUSB_LIBRARIES}") else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) find_path(LIBUSB_INCLUDE_DIR usb.h ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(LIBUSB_LIBRARIES NAMES usb PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) set(LIBUSB_FOUND TRUE) else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) set(LIBUSB_FOUND FALSE) endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) if (LIBUSB_FOUND) if (NOT USB_FIND_QUIETLY) message(STATUS "Found LIBUSB: ${LIBUSB_LIBRARIES}") endif (NOT USB_FIND_QUIETLY) else (LIBUSB_FOUND) if (USB_FIND_REQUIRED) message(FATAL_ERROR "LIBUSB not found. Please install libusb-devel and try again.") endif (USB_FIND_REQUIRED) endif (LIBUSB_FOUND) mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) indi-sbig-1.0/cmake_modules/FindNova.cmake0000644000175000017500000000344211110507066016345 0ustar jrjr# - Try to find NOVA # Once done this will define # # NOVA_FOUND - system has NOVA # NOVA_INCLUDE_DIR - the NOVA include directory # NOVA_LIBRARIES - Link these to use NOVA # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES AND NOVA_FUNCTION_COMPILE) # in cache already set(NOVA_FOUND TRUE) message(STATUS "Found libnova: ${NOVA_LIBRARIES}") else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES) find_path(NOVA_INCLUDE_DIR libnova.h PATH_SUFFIXES libnova ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(NOVA_LIBRARIES NAMES nova PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) set(CMAKE_REQUIRED_INCLUDES ${NOVA_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${NOVA_LIBRARIES}) check_cxx_source_compiles("#include int main() { ln_get_date_from_tm(NULL, NULL); return 0; }" NOVA_FUNCTION_COMPILE) if(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES AND NOVA_FUNCTION_COMPILE) set(NOVA_FOUND TRUE) else (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES AND NOVA_FUNCTION_COMPILE) set(NOVA_FOUND FALSE) endif(NOVA_INCLUDE_DIR AND NOVA_LIBRARIES AND NOVA_FUNCTION_COMPILE) if (NOVA_FOUND) if (NOT Nova_FIND_QUIETLY) message(STATUS "Found NOVA: ${NOVA_LIBRARIES}") endif (NOT Nova_FIND_QUIETLY) else (NOVA_FOUND) if (Nova_FIND_REQUIRED) message(FATAL_ERROR "libnova not found. Please install libnova0-devel. http://indi.sf.net") endif (Nova_FIND_REQUIRED) endif (NOVA_FOUND) mark_as_advanced(NOVA_INCLUDE_DIR NOVA_LIBRARIES) endif (NOVA_INCLUDE_DIR AND NOVA_LIBRARIES AND NOVA_FUNCTION_COMPILE) indi-sbig-1.0/cmake_modules/FindINDI.cmake0000644000175000017500000000343611110507066016170 0ustar jrjr# - Try to find INDI # Once done this will define # # INDI_FOUND - system has INDI # INDI_INCLUDE_DIR - the INDI include directory # INDI_LIBRARIES - Link these to use INDI # Copyright (c) 2006, Jasem Mutlaq # Based on FindLibfacile by Carsten Niehaus, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) # in cache already set(INDI_FOUND TRUE) message(STATUS "Found INDI: ${INDI_LIBRARIES}") else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) find_path(INDI_INCLUDE_DIR indidevapi.h PATH_SUFFIXES libindi ${_obIncDir} ${GNUWIN32_DIR}/include ) find_library(INDI_DRIVER_LIBRARIES NAMES indidriver PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) find_library(INDI_LIBRARIES NAMES indi PATHS ${_obLinkDir} ${GNUWIN32_DIR}/lib ) if(INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) set(INDI_FOUND TRUE) else (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) set(INDI_FOUND FALSE) endif(INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) if (INDI_FOUND) if (NOT INDI_FIND_QUIETLY) message(STATUS "Found INDI: ${INDI_LIBRARIES}, ${INDI_DRIVER_LIBRARIES}") endif (NOT INDI_FIND_QUIETLY) else (INDI_FOUND) if (INDI_FIND_REQUIRED) message(FATAL_ERROR "indi-devel not found. Cannot compile SBIG CCD Driver. Please install indi-devel and try again. http://indi.sf.net") endif (INDI_FIND_REQUIRED) endif (INDI_FOUND) mark_as_advanced(INDI_INCLUDE_DIR INDI_LIBRARIES INDI_DRIVER_LIBRARIES) endif (INDI_INCLUDE_DIR AND INDI_LIBRARIES AND INDI_DRIVER_LIBRARIES) indi-sbig-1.0/cmake_modules/MacroLogFeature.cmake0000644000175000017500000001157711110507066017670 0ustar jrjr# This file defines the Feature Logging macros. # # MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) # Logs the information so that it can be displayed at the end # of the configure run # VAR : TRUE or FALSE, indicating whether the feature is supported # FEATURE: name of the feature, e.g. "libjpeg" # DESCRIPTION: description what this feature provides # URL: home page # REQUIRED: TRUE or FALSE, indicating whether the featue is required # MIN_VERSION: minimum version number. empty string if unneeded # COMMENTS: More info you may want to provide. empty string if unnecessary # # MACRO_DISPLAY_FEATURE_LOG() # Call this to display the collected results. # Exits CMake with a FATAL error message if a required feature is missing # # Example: # # INCLUDE(MacroLogFeature) # # FIND_PACKAGE(JPEG) # MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") # ... # MACRO_DISPLAY_FEATURE_LOG() # Copyright (c) 2006, Alexander Neundorf, # Copyright (c) 2006, Allen Winter, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. IF (NOT _macroLogFeatureAlreadyIncluded) SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_macroLogFeatureAlreadyIncluded TRUE) ENDIF (NOT _macroLogFeatureAlreadyIncluded) MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) SET(_required "${ARGV4}") SET(_minvers "${ARGV5}") SET(_comments "${ARGV6}") IF (${_var}) SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) ELSE (${_var}) IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]") SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") ENDIF (${_var}) SET(_logtext "+ ${_package}") IF (NOT ${_var}) IF (${_minvers} MATCHES ".*") SET(_logtext "${_logtext}, ${_minvers}") ENDIF (${_minvers} MATCHES ".*") SET(_logtext "${_logtext}: ${_description} <${_url}>") IF (${_comments} MATCHES ".*") SET(_logtext "${_logtext}\n${_comments}") ENDIF (${_comments} MATCHES ".*") # SET(_logtext "${_logtext}\n") #double-space missing features? ENDIF (NOT ${_var}) FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") ENDMACRO(MACRO_LOG_FEATURE) MACRO(MACRO_DISPLAY_FEATURE_LOG) SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) IF (EXISTS ${_file}) FILE(READ ${_file} _requirements) MESSAGE(STATUS "\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- Please install them before continuing this software installation.\n-----------------------------------------------------------------------------\n${_requirements}-----------------------------------------------------------------------------") FILE(REMOVE ${_file}) MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") ENDIF (EXISTS ${_file}) SET(_summary "\n") SET(_elist 0) SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) IF (EXISTS ${_file}) SET(_elist 1) FILE(READ ${_file} _enabled) FILE(REMOVE ${_file}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n${_enabled}") ENDIF (EXISTS ${_file}) SET(_dlist 0) SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) IF (EXISTS ${_file}) SET(_dlist 1) FILE(READ ${_file} _disabled) FILE(REMOVE ${_file}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n${_disabled}") ELSE (EXISTS ${_file}) IF (${_elist}) SET(_summary "${_summary}Congratulations! All external packages have been found.\n") ENDIF (${_elist}) ENDIF (EXISTS ${_file}) IF (${_elist} OR ${_dlist}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n") ENDIF (${_elist} OR ${_dlist}) MESSAGE(STATUS "${_summary}") ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)