From 889d89bc652682763a4b6021d988195a1d8acb84 Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 14 Aug 2020 20:20:25 -0700 Subject: update qhy sdk --- include/qhy/config.h | 49 +++ include/qhy/qhyccd.h | 851 +++++++++++++++++++++++++++++++++++++++--- include/qhy/qhyccdcamdef.h | 901 +++++++++++++++++++++++++++++++++++++++++++-- include/qhy/qhyccderr.h | 40 +- include/qhy/qhyccdstruct.h | 372 +++++++++++-------- 5 files changed, 1933 insertions(+), 280 deletions(-) create mode 100644 include/qhy/config.h (limited to 'include') diff --git a/include/qhy/config.h b/include/qhy/config.h new file mode 100644 index 0000000..6f3a5bb --- /dev/null +++ b/include/qhy/config.h @@ -0,0 +1,49 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + + + + + + +#define CALLBACK_MODE_SUPPORT 1 +#define IMAGEQUEUE_ORIG_MODE 1 + + +#define version_year 20 +#define version_month 7 +#define version_day 26 +#define version_subday 1 + +#if defined (_WIN32) +#define QHYCCD_OPENCV_SUPPORT +#define WINDOWS_PTHREAD_SUPPORT 1 +#define WINPCAP_MODE_SUPPORT 0 +#define PCIE_MODE_SUPPORT 1 +#define CYUSB_MODE_SUPPORT 1 +#define WINUSB_MODE_SUPPORT 1 +#define LIBUSB_MODE_SUPPORT 0 +#define PCIE_MODE_TEST 1 +#else +#undef QHYCCD_OPENCV_SUPPORT +#define WINDOWS_PTHREAD_SUPPORT 0 +#define WINPCAP_MODE_SUPPORT 0 + +#if defined(__arm__) || defined (__arm64__) || defined (__aarch64__) || defined(__APPLE__)||defined (__ANDROID__) +#define PCIE_MODE_SUPPORT 0 +#elif defined(__i386__) || defined(__x86_64__) +#define PCIE_MODE_SUPPORT 1 +#else +#define PCIE_MODE_SUPPORT 0 +#endif + + +#define CYUSB_MODE_SUPPORT 0 +#define WINUSB_MODE_SUPPORT 0 +#define LIBUSB_MODE_SUPPORT 1 +#endif + + + +#endif + diff --git a/include/qhy/qhyccd.h b/include/qhy/qhyccd.h index 8f709e1..c14044b 100644 --- a/include/qhy/qhyccd.h +++ b/include/qhy/qhyccd.h @@ -1,139 +1,868 @@ -/* - QHYCCD SDK - - Copyright (c) 2014 QHYCCD. - All Rights Reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program 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 General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - */ -#ifndef _QHYCCD_H_ -#define _QHYCCD_H_ -#include "qhycam.h" #include "qhyccderr.h" #include "qhyccdcamdef.h" #include "qhyccdstruct.h" #include "stdint.h" -#include "qhydevice.h" +#include "config.h" +#include + + + -#ifdef WIN32 + +#if defined (_WIN32) #include "cyapi.h" -typedef CCyUSBDevice qhyccd_handle; -#else // Linux & Mac -typedef struct libusb_device_handle qhyccd_handle; -uint32_t DeviceIsQHYCCD(uint32_t index, qhyccd_device *pDevice); -EXPORTC void STDCALL MutexInit(); -EXPORTC void STDCALL MutexDestroy(); -EXPORTC void STDCALL MutexLock(); -EXPORTC void STDCALL MutexUnlock(); -EXPORTC int STDCALL MutexTrylock(); -#endif // WIN32 - -class QHYBASE; -class QhyDevice; - -uint32_t DeviceIsQHYCCD(uint32_t index, uint32_t vid, uint32_t pid); -uint32_t QHYCCDSeriesMatch(uint32_t index, qhyccd_handle *pHandle); -uint32_t GetIdFromCam(qhyccd_handle *pHandle, char *id); - -EXPORTC QhyDevice* STDCALL GetCyDevBasedOnInstance(QHYBASE *pCam); -EXPORTC QhyDevice* STDCALL GetCyDevBasedOnHandle(qhyccd_handle *pHandle); -EXPORTC int GetCyDevIdxBasedOnInstance(QHYBASE *pCam); -EXPORTC int GetCyDevIdxBasedOnHandle(qhyccd_handle *pHandle); -EXPORTC uint32_t STDCALL GetReceivedRawDataLen(QHYBASE *pCam); -EXPORTC bool STDCALL SetReceivedRawDataLen(QHYBASE *pCam, uint32_t value); -EXPORTC bool STDCALL CleanUnlockImageQueue(QHYBASE *pCam); -//EXPORTC bool STDCALL SetUnlockImageQueue(QHYBASE *pCam); -EXPORTC uint32_t STDCALL InitQHYCCDClass(uint32_t camtype, uint32_t index); +#endif + +#ifndef __QHYCCD_H__ +#define __QHYCCD_H__ + +typedef void qhyccd_handle; + + +EXPORTFUNC void STDCALL SetQHYCCDAutoDetectCamera(bool enable); + +EXPORTC void STDCALL SetQHYCCDLogLevel(uint8_t logLevel); + +#if defined(__linux__ )&&!defined (__ANDROID__) + +EXPORTC void STDCALL SetQHYCCDLogFunction(std::function logFunction); +EXPORTC void STDCALL SetQHYCCDBufferNumber(uint32_t BufNumber); + +#endif + +EXPORTC void STDCALL EnableQHYCCDMessage(bool enable); +EXPORTC void STDCALL EnableQHYCCDLogFile(bool enable); + +EXPORTC uint32_t STDCALL SetQHYCCDSingleFrameTimeOut(qhyccd_handle *h,uint32_t time); + + +EXPORTC const char* STDCALL GetTimeStamp(); + +/** \fn uint32_t InitQHYCCDResource() + \brief initialize QHYCCD SDK resource + \return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_INITRESOURCE if the initialize failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL InitQHYCCDResource(void); + +/** \fn uint32_t ReleaseQHYCCDResource() + \brief release QHYCCD SDK resource + \return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_RELEASERESOURCE if the release failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL ReleaseQHYCCDResource(void); + +/** \fn uint32_t ScanQHYCCD() + \brief scan the connected cameras + \return + on success,return the number of connected cameras \n + QHYCCD_ERROR_NO_DEVICE,if no camera connect to computer + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL ScanQHYCCD(void); -EXPORTC uint32_t STDCALL GetQHYCCDId(int index, char *id); + +/** \fn uint32_t GetQHYCCDId(uint32_t index,char *id) + \brief get the id from camera + \param index sequence number of the connected cameras + \param id the id for camera,each camera has only id + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ +EXPORTC uint32_t STDCALL GetQHYCCDId(uint32_t index,char *id); + +/** \fn uint32_t GetQHYCCDModel(char *id, char *model) + \brief get camera model name by id + \param id the id of the camera + \param model the camera model + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code in failure + */ EXPORTC uint32_t STDCALL GetQHYCCDModel(char *id, char *model); + +/** \fn qhyccd_handle *OpenQHYCCD(char *id) + \brief open camera by camera id + \param id the id for camera,each camera has only id + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC qhyccd_handle * STDCALL OpenQHYCCD(char *id); + +/** \fn uint32_t CloseQHYCCD(qhyccd_handle *handle) + \brief close camera by handle + \param handle camera handle + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL CloseQHYCCD(qhyccd_handle *handle); + +/** + @fn uint32_t SetQHYCCDStreamMode(qhyccd_handle *handle,uint8_t mode) + @brief Set the camera's mode to chose the way reading data from camera + @param handle camera control handle + @param mode the stream mode \n + 0x00:default mode,single frame mode \n + 0x01:live mode \n + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDStreamMode(qhyccd_handle *handle,uint8_t mode); + +/** \fn uint32_t InitQHYCCD(qhyccd_handle *handle) + \brief initialization specified camera by camera handle + \param handle camera control handle + \return + on success,return QHYCCD_SUCCESS \n + on failed,return QHYCCD_ERROR_INITCAMERA \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL InitQHYCCD(qhyccd_handle *handle); + +/** @fn uint32_t IsQHYCCDControlAvailable(qhyccd_handle *handle,CONTROL_ID controlId) + @brief check the camera has the queried function or not + @param handle camera control handle + @param controlId function type + @return + on have,return QHYCCD_SUCCESS \n + on do not have,return QHYCCD_ERROR_NOTSUPPORT \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL IsQHYCCDControlAvailable(qhyccd_handle *handle,CONTROL_ID controlId); + +/** \fn uint32_t SetQHYCCDParam(qhyccd_handle *handle,CONTROL_ID controlId,double value) + \brief set params to camera + \param handle camera control handle + \param controlId function type + \param value value to camera + \return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_NOTSUPPORT,if the camera do not have the function \n + QHYCCD_ERROR_SETPARAMS,if set params to camera failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDParam(qhyccd_handle *handle,CONTROL_ID controlId, double value); + +/** \fn double GetQHYCCDParam(qhyccd_handle *handle,CONTROL_ID controlId) + \brief get the params value from camera + \param handle camera control handle + \param controlId function type + \return + on success,return the value\n + QHYCCD_ERROR_NOTSUPPORT,if the camera do not have the function \n + QHYCCD_ERROR_GETPARAMS,if get camera params'value failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC double STDCALL GetQHYCCDParam(qhyccd_handle *handle,CONTROL_ID controlId); + +/** \fn uint32_t GetQHYCCDParamMinMaxStep(qhyccd_handle *handle,CONTROL_ID controlId,double *min,double *max,double *step) + \brief get the params value from camera + \param handle camera control handle + \param controlId function type + \param *min the pointer to the function's min value + \param *max the pointer to the function's max value + \param *step the pointer to the function's single step value + \return + on success,return QHYCCD_SUCCESS\n + QHYCCD_ERROR_NOTSUPPORT,if the camera do not have the function \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDParamMinMaxStep(qhyccd_handle *handle,CONTROL_ID controlId,double *min,double *max,double *step); + +/** @fn uint32_t SetQHYCCDResolution(qhyccd_handle *handle,uint32_t x,uint32_t y,uint32_t xsize,uint32_t ysize) + @brief set camera ouput resolution + @param handle camera control handle + @param x the top left position x + @param y the top left position y + @param xsize the image width + @param ysize the image height + @return + on success,return QHYCCD_SUCCESS\n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDResolution(qhyccd_handle *handle,uint32_t x,uint32_t y,uint32_t xsize,uint32_t ysize); + +/** \fn uint32_t GetQHYCCDMemLength(qhyccd_handle *handle) + \brief get the minimum memory space for image data to save(byte) + \param handle camera control handle + \return + on success,return the total memory space for image data(byte) \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDMemLength(qhyccd_handle *handle); + +/** \fn uint32_t ExpQHYCCDSingleFrame(qhyccd_handle *handle) + \brief start to expose one frame + \param handle camera control handle + \return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_EXPOSING,if the camera is exposing \n + QHYCCD_ERROR_EXPFAILED,if start failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL ExpQHYCCDSingleFrame(qhyccd_handle *handle); + +/** + @fn uint32_t GetQHYCCDSingleFrame(qhyccd_handle *handle,uint32_t *w,uint32_t *h,uint32_t *bpp,uint32_t *channels,uint8_t *imgdata) + @brief get live frame data from camera + @param handle camera control handle + @param *w pointer to width of ouput image + @param *h pointer to height of ouput image + @param *bpp pointer to depth of ouput image + @param *channels pointer to channels of ouput image + @param *imgdata image data buffer + @return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_GETTINGFAILED,if get data failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDSingleFrame(qhyccd_handle *handle,uint32_t *w,uint32_t *h,uint32_t *bpp,uint32_t *channels,uint8_t *imgdata); + +/** + @fn uint32_t CancelQHYCCDExposing(qhyccd_handle *handle) + @param handle camera control handle + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL CancelQHYCCDExposing(qhyccd_handle *handle); + +/** + @fn uint32_t CancelQHYCCDExposingAndReadout(qhyccd_handle *handle) + @brief stop the camera exposing and readout + @param handle camera control handle + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL CancelQHYCCDExposingAndReadout(qhyccd_handle *handle); + +/** \fn uint32_t BeginQHYCCDLive(qhyccd_handle *handle) + \brief start continue exposing + \param handle camera control handle + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL BeginQHYCCDLive(qhyccd_handle *handle); + +/** + @fn uint32_t GetQHYCCDLiveFrame(qhyccd_handle *handle,uint32_t *w,uint32_t *h,uint32_t *bpp,uint32_t *channels,uint8_t *imgdata) + @brief get live frame data from camera + @param handle camera control handle + @param *w pointer to width of ouput image + @param *h pointer to height of ouput image + @param *bpp pointer to depth of ouput image + @param *channels pointer to channels of ouput image + @param *imgdata image data buffer + @return + on success,return QHYCCD_SUCCESS \n + QHYCCD_ERROR_GETTINGFAILED,if get data failed \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDLiveFrame(qhyccd_handle *handle,uint32_t *w,uint32_t *h,uint32_t *bpp,uint32_t *channels,uint8_t *imgdata); + +/** \fn uint32_t StopQHYCCDLive(qhyccd_handle *handle) + \brief stop the camera continue exposing + \param handle camera control handle + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL StopQHYCCDLive(qhyccd_handle *handle); + +/** \ + @fn uint32_t SetQHYCCDBinMode(qhyccd_handle *handle,uint32_t wbin,uint32_t hbin) + @brief set camera's bin mode for ouput image data + @param handle camera control handle + @param wbin width bin mode + @param hbin height bin mode + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SetQHYCCDBinMode(qhyccd_handle *handle,uint32_t wbin,uint32_t hbin); + +/** + @fn uint32_t SetQHYCCDBitsMode(qhyccd_handle *handle,uint32_t bits) + @brief set camera's depth bits for ouput image data + @param handle camera control handle + @param bits image depth + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDBitsMode(qhyccd_handle *handle,uint32_t bits); + +/** \fn uint32_t ControlQHYCCDTemp(qhyccd_handle *handle,double targettemp) + \brief This is a auto temprature control for QHYCCD cameras. \n + To control this,you need call this api every single second + \param handle camera control handle + \param targettemp the target control temprature + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL ControlQHYCCDTemp(qhyccd_handle *handle,double targettemp); + +/** \fn uint32_t ControlQHYCCDGuide(qhyccd_handle *handle,uint32_t direction,uint16_t duration) + \brief control the camera' guide port + \param handle camera control handle + \param direction direction \n + 0: EAST RA+ \n + 3: WEST RA- \n + 1: NORTH DEC+ \n + 2: SOUTH DEC- \n + \param duration duration of the direction + \return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL ControlQHYCCDGuide(qhyccd_handle *handle,uint32_t direction,uint16_t duration); + +/** + @fn uint32_t SendOrder2QHYCCDCFW(qhyccd_handle *handle,char *order,uint32_t length) + @brief control color filter wheel port + @param handle camera control handle + @param order order send to color filter wheel + @param length the order string length + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SendOrder2QHYCCDCFW(qhyccd_handle *handle,char *order,uint32_t length); + +/** + @fn uint32_t GetQHYCCDCFWStatus(qhyccd_handle *handle,char *status) + @brief control color filter wheel port + @param handle camera control handle + @param status the color filter wheel position status + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDCFWStatus(qhyccd_handle *handle,char *status); + +/** + @fn uint32_t IsQHYCCDCFWPlugged(qhyccd_handle *handle) + @brief control color filter wheel port + @param handle camera control handle + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL IsQHYCCDCFWPlugged(qhyccd_handle *handle); + +/** + \fn uint32_t SetQHYCCDTrigerMode(qhyccd_handle *handle,uint32_t trigerMode) + \brief set camera triger mode + \param handle camera control handle + \param trigerMode triger mode + \return +on success,return QHYCCD_SUCCESS \n +another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SetQHYCCDTrigerMode(qhyccd_handle *handle,uint32_t trigerMode); + +/** \fn void Bits16ToBits8(qhyccd_handle *h,uint8_t *InputData16,uint8_t *OutputData8,uint32_t imageX,uint32_t imageY,uint16_t B,uint16_t W) + \brief turn 16bits data into 8bits + \param h camera control handle + \param InputData16 for 16bits data memory + \param OutputData8 for 8bits data memory + \param imageX image width + \param imageY image height + \param B for stretch balck + \param W for stretch white + */ EXPORTC void STDCALL Bits16ToBits8(qhyccd_handle *h,uint8_t *InputData16,uint8_t *OutputData8,uint32_t imageX,uint32_t imageY,uint16_t B,uint16_t W); + +/** + @fn void HistInfo192x130(qhyccd_handle *h,uint32_t x,uint32_t y,uint8_t *InBuf,uint8_t *OutBuf) + @brief make the hist info + @param h camera control handle + @param x image width + @param y image height + @param InBuf for the raw image data + @param OutBuf for 192x130 8bits 3 channels image + */ EXPORTC void STDCALL HistInfo192x130(qhyccd_handle *h,uint32_t x,uint32_t y,uint8_t *InBuf,uint8_t *OutBuf); + + +/** + @fn uint32_t OSXInitQHYCCDFirmware(char *path) + @brief download the firmware to camera.(this api just need call in OSX system) + @param path path to HEX file + */ EXPORTC uint32_t STDCALL OSXInitQHYCCDFirmware(char *path); + +/** + @fn uint32_t OSXInitQHYCCDFirmware(char *path) + @brief download the firmware to camera.(this api just need call in OSX system) + @param path path to HEX file + */ +EXPORTC uint32_t STDCALL OSXInitQHYCCDFirmwareArray(); + + + +EXPORTC uint32_t STDCALL OSXInitQHYCCDAndroidFirmwareArray(int idVendor,int idProduct, + qhyccd_handle *handle); + + + +/** @fn uint32_t GetQHYCCDChipInfo(qhyccd_handle *h,double *chipw,double *chiph,uint32_t *imagew,uint32_t *imageh,double *pixelw,double *pixelh,uint32_t *bpp) + @brief get the camera's ccd/cmos chip info + @param h camera control handle + @param chipw chip size width + @param chiph chip size height + @param imagew chip output image width + @param imageh chip output image height + @param pixelw chip pixel size width + @param pixelh chip pixel size height + @param bpp chip pixel depth + */ EXPORTC uint32_t STDCALL GetQHYCCDChipInfo(qhyccd_handle *h,double *chipw,double *chiph,uint32_t *imagew,uint32_t *imageh,double *pixelw,double *pixelh,uint32_t *bpp); + +/** @fn uint32_t GetQHYCCDEffectiveArea(qhyccd_handle *h,uint32_t *startX, uint32_t *startY, uint32_t *sizeX, uint32_t *sizeY) + @brief get the camera's ccd/cmos chip info + @param h camera control handle + @param startX the Effective area x position + @param startY the Effective area y position + @param sizeX the Effective area x size + @param sizeY the Effective area y size + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDEffectiveArea(qhyccd_handle *h,uint32_t *startX, uint32_t *startY, uint32_t *sizeX, uint32_t *sizeY); + +/** @fn uint32_t GetQHYCCDOverScanArea(qhyccd_handle *h,uint32_t *startX, uint32_t *startY, uint32_t *sizeX, uint32_t *sizeY) + @brief get the camera's ccd/cmos chip info + @param h camera control handle + @param startX the OverScan area x position + @param startY the OverScan area y position + @param sizeX the OverScan area x size + @param sizeY the OverScan area y size + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDOverScanArea(qhyccd_handle *h,uint32_t *startX, uint32_t *startY, uint32_t *sizeX, uint32_t *sizeY); + + +/** @fn uint32_t SetQHYCCDFocusSetting(qhyccd_handle *h,uint32_t focusCenterX, uint32_t focusCenterY) + @brief Set the camera on focus mode + @param h camera control handle + @param focusCenterX + @param focusCenterY + @return + on success,return QHYCCD_SUCCESS \n + + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDFocusSetting(qhyccd_handle *h,uint32_t focusCenterX, uint32_t focusCenterY); + +/** @fn uint32_t GetQHYCCDExposureRemaining(qhyccd_handle *h) + @brief Get remaining ccd/cmos expose time + @param h camera control handle + @return + 100 or less 100,it means exposoure is over \n + another is remaining time + */ EXPORTC uint32_t STDCALL GetQHYCCDExposureRemaining(qhyccd_handle *h); + +/** @fn uint32_t GetQHYCCDFWVersion(qhyccd_handle *h,uint8_t *buf) + @brief Get the QHYCCD's firmware version + @param h camera control handle + @param buf buffer for version info + @return + on success,return QHYCCD_SUCCESS \n + + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDFWVersion(qhyccd_handle *h,uint8_t *buf); +EXPORTC uint32_t STDCALL GetQHYCCDFPGAVersion(qhyccd_handle *h, uint8_t fpga_index, uint8_t *buf); + +/** @fn uint32_t SetQHYCCDInterCamSerialParam(qhyccd_handle *h,uint32_t opt) + @brief Set InterCam serial2 params + @param h camera control handle + @param opt the param \n + opt: \n + 0x00 baud rate 9600bps 8N1 \n + 0x01 baud rate 4800bps 8N1 \n + 0x02 baud rate 19200bps 8N1 \n + 0x03 baud rate 28800bps 8N1 \n + 0x04 baud rate 57600bps 8N1 + @return + on success,return QHYCCD_SUCCESS \n + + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL SetQHYCCDInterCamSerialParam(qhyccd_handle *h,uint32_t opt); + +/** @fn uint32_t QHYCCDInterCamSerialTX(qhyccd_handle *h,char *buf,uint32_t length) + @brief Send data to InterCam serial2 + @param h camera control handle + @param buf buffer for data + @param length to send + @return + on success,return QHYCCD_SUCCESS \n + + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL QHYCCDInterCamSerialTX(qhyccd_handle *h,char *buf,uint32_t length); + +/** @fn uint32_t QHYCCDInterCamSerialRX(qhyccd_handle *h,char *buf) + @brief Get data from InterCam serial2 + @param h camera control handle + @param buf buffer for data + @return + on success,return the data number \n + + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL QHYCCDInterCamSerialRX(qhyccd_handle *h,char *buf); + +/** @fn uint32_t QHYCCDInterCamOledOnOff(qhyccd_handle *handle,uint8_t onoff) + @brief turn off or turn on the InterCam's Oled + @param handle camera control handle + @param onoff on or off the oled \n + 1:on \n + 0:off \n + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL QHYCCDInterCamOledOnOff(qhyccd_handle *handle,uint8_t onoff); + +/** + @fn uint32_t SetQHYCCDInterCamOledBrightness(qhyccd_handle *handle,uint8_t brightness) + @brief send data to show on InterCam's OLED + @param handle camera control handle + @param brightness the oled's brightness + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SetQHYCCDInterCamOledBrightness(qhyccd_handle *handle,uint8_t brightness); + +/** + @fn uint32_t SendFourLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messagetemp,char *messageinfo,char *messagetime,char *messagemode) + @brief spilit the message to two line,send to camera + @param handle camera control handle + @param messagetemp message for the oled's 1st line + @param messageinfo message for the oled's 2nd line + @param messagetime message for the oled's 3rd line + @param messagemode message for the oled's 4th line + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SendFourLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messagetemp,char *messageinfo,char *messagetime,char *messagemode); +/** + @fn uint32_t SendTwoLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messageTop,char *messageBottom) + @brief spilit the message to two line,send to camera + @param handle camera control handle + @param messageTop message for the oled's 1st line + @param messageBottom message for the oled's 2nd line + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SendTwoLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messageTop,char *messageBottom); + +/** + @fn uint32_t SendOneLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messageTop) + @brief spilit the message to two line,send to camera + @param handle camera control handle + @param messageTop message for all the oled + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL SendOneLine2QHYCCDInterCamOled(qhyccd_handle *handle,char *messageTop); + +/** + @fn uint32_t GetQHYCCDCameraStatus(qhyccd_handle *h,uint8_t *buf) + @brief Get the camera statu + @param h camera control handle + @param buf camera's status save space + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures + */ EXPORTC uint32_t STDCALL GetQHYCCDCameraStatus(qhyccd_handle *h,uint8_t *buf); + +/** + @fn uint32_t GetQHYCCDShutterStatus(qhyccd_handle *handle) + @brief get the camera's shutter status + @param handle camera control handle + @return + on success,return status \n + 0x00:shutter turn to right \n + 0x01:shutter from right turn to middle \n + 0x02:shutter from left turn to middle \n + 0x03:shutter turn to left \n + 0xff:IDLE \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL GetQHYCCDShutterStatus(qhyccd_handle *handle); + +/** + @fn uint32_t ControlQHYCCDShutter(qhyccd_handle *handle,uint8_t status) + @brief control camera's shutter + @param handle camera control handle + @param status the shutter status \n + 0x00:shutter turn to right \n + 0x01:shutter from right turn to middle \n + 0x02:shutter from left turn to middle \n + 0x03:shutter turn to left \n + 0xff:IDLE + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL ControlQHYCCDShutter(qhyccd_handle *handle,uint8_t status); + +/** + @fn uint32_t GetQHYCCDHumidity(qhyccd_handle *handle,double *hd) + @brief query cavity's humidity + @param handle control handle + @param hd the humidity value + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ +EXPORTC uint32_t STDCALL GetQHYCCDPressure(qhyccd_handle *handle,double *pressure); +/** + @fn uint32_t GetQHYCCDPressure(qhyccd_handle *handle,double *pressure) + @get the pressure of sensor chamber + @param handle control handle + @param pressure : the sensor chamber pressure . unit is mbar range 0.0-2000.0 + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ + EXPORTC uint32_t STDCALL GetQHYCCDHumidity(qhyccd_handle *handle,double *hd); + + +/** + @fn uint32_t QHYCCDI2CTwoWrite(qhyccd_handle *handle,uint16_t addr,uint16_t value) + @brief Set the value of the addr register in the camera. + @param handle camera control handle + @param addr the address of register + @param value the value of the address + @return + on success,return QHYCCD_SUCCESS \n + another QHYCCD_ERROR code on other failures +*/ EXPORTC uint32_t STDCALL QHYCCDI2CTwoWrite(qhyccd_handle *handle,uint16_t addr,uint16_t value); + +/** + @fn uint32_t QHYCCDI2CTwoRead(qhyccd_handle *handle,uint16_t addr) + @brief Get the value of the addr register in the camera. + @param handle camera control handle + @param addr the address of register + @return value of the addr register +*/ EXPORTC uint32_t STDCALL QHYCCDI2CTwoRead(qhyccd_handle *handle,uint16_t addr); + +/** + @fn double GetQHYCCDReadingProgress(qhyccd_handle *handle) + @brief get reading data from camera progress + @param handle camera control handle + @return current progress +*/ EXPORTC double STDCALL GetQHYCCDReadingProgress(qhyccd_handle *handle); -EXPORTC void STDCALL SetQHYCCDLogLevel(uint8_t logLevel); + + +/** + test pid parameters +*/ EXPORTC uint32_t STDCALL TestQHYCCDPIDParas(qhyccd_handle *h, double p, double i, double d); + EXPORTC uint32_t STDCALL SetQHYCCDTrigerFunction(qhyccd_handle *h,bool value); + EXPORTC uint32_t STDCALL DownloadFX3FirmWare(uint16_t vid,uint16_t pid,char *imgpath); + EXPORTC uint32_t STDCALL GetQHYCCDType(qhyccd_handle *h); + EXPORTC uint32_t STDCALL SetQHYCCDDebayerOnOff(qhyccd_handle *h,bool onoff); + EXPORTC uint32_t STDCALL SetQHYCCDFineTone(qhyccd_handle *h,uint8_t setshporshd,uint8_t shdloc,uint8_t shploc,uint8_t shwidth); + EXPORTC uint32_t STDCALL SetQHYCCDGPSVCOXFreq(qhyccd_handle *handle,uint16_t i); + EXPORTC uint32_t STDCALL SetQHYCCDGPSLedCalMode(qhyccd_handle *handle,uint8_t i); + EXPORTC void STDCALL SetQHYCCDGPSLedCal(qhyccd_handle *handle,uint32_t pos,uint8_t width); + EXPORTC void STDCALL SetQHYCCDGPSPOSA(qhyccd_handle *handle,uint8_t is_slave,uint32_t pos,uint8_t width); + EXPORTC void STDCALL SetQHYCCDGPSPOSB(qhyccd_handle *handle,uint8_t is_slave,uint32_t pos,uint8_t width); + EXPORTC uint32_t STDCALL SetQHYCCDGPSMasterSlave(qhyccd_handle *handle,uint8_t i); + EXPORTC void STDCALL SetQHYCCDGPSSlaveModeParameter(qhyccd_handle *handle,uint32_t target_sec,uint32_t target_us,uint32_t deltaT_sec,uint32_t deltaT_us,uint32_t expTime); + +EXPORTFUNC void STDCALL SetQHYCCDQuit(); + EXPORTC uint32_t STDCALL QHYCCDVendRequestWrite(qhyccd_handle *h,uint8_t req,uint16_t value,uint16_t index1,uint32_t length,uint8_t *data); + EXPORTC uint32_t STDCALL QHYCCDReadUSB_SYNC(qhyccd_handle *pDevHandle, uint8_t endpoint, uint32_t length, uint8_t *data, uint32_t timeout); + EXPORTC uint32_t STDCALL QHYCCDLibusbBulkTransfer(qhyccd_handle *pDevHandle, uint8_t endpoint, uint8_t *data, uint32_t length, int32_t *transferred, uint32_t timeout); + EXPORTC uint32_t STDCALL GetQHYCCDSDKVersion(uint32_t *year,uint32_t *month,uint32_t *day,uint32_t *subday); -EXPORTC void STDCALL print_cydev(const char *pTitle); -EXPORTC const char* STDCALL GetTimeStamp(); -EXPORTC void STDCALL GetQHYCCDControlIdString(CONTROL_ID controlId, char *pStr); -#endif // __QHYCCD_H__ + + + + +//APIs for the Readout Mode. One camera may have more than one readout mode. The different readout mode has different base-resolution. For example +//The QHY42PRO support HDR and STD mode. HDR mode base-resolution is 4096*2048. While the STD mode is 2048*2048. In this case we need to use the +//readout mode to set it. The host application need to get the readout mode and select one to set it. The sequece that call this fucntion need to be(......) + + +EXPORTC uint32_t STDCALL GetQHYCCDNumberOfReadModes(qhyccd_handle *h,uint32_t *numModes); +// Get the maximum resolution for a read mode +EXPORTC uint32_t STDCALL GetQHYCCDReadModeResolution(qhyccd_handle *h,uint32_t modeNumber, uint32_t* width, uint32_t* height); +// Get the name of a read mode +EXPORTC uint32_t STDCALL GetQHYCCDReadModeName(qhyccd_handle *h,uint32_t modeNumber, char* name); +// Set the read mode +EXPORTC uint32_t STDCALL SetQHYCCDReadMode(qhyccd_handle *h,uint32_t modeNumber); +// Get the read mode +EXPORTC uint32_t STDCALL GetQHYCCDReadMode(qhyccd_handle *h,uint32_t* modeNumber); + +EXPORTC uint32_t STDCALL GetQHYCCDBeforeOpenParam( + QHYCamMinMaxStepValue *p, + CONTROL_ID controlId); +/* +EXPORTC uint32_t STDCALL GetQHYCCDBeforeOpenReadMode(QHYCamReadModeInfo *p); +*/ +EXPORTC uint32_t STDCALL EnableQHYCCDBurstMode(qhyccd_handle *h,bool i); +EXPORTC uint32_t STDCALL SetQHYCCDBurstModeStartEnd(qhyccd_handle *h,unsigned short start,unsigned short end); +EXPORTC uint32_t STDCALL EnableQHYCCDBurstCountFun(qhyccd_handle *h,bool i); +EXPORTC uint32_t STDCALL ResetQHYCCDFrameCounter(qhyccd_handle *h); +EXPORTC uint32_t STDCALL SetQHYCCDBurstIDLE(qhyccd_handle *h); +EXPORTC uint32_t STDCALL ReleaseQHYCCDBurstIDLE(qhyccd_handle *h); +EXPORTC uint32_t STDCALL SetQHYCCDBurstModePatchNumber(qhyccd_handle *h,uint32_t value); +EXPORTC uint32_t STDCALL SetQHYCCDEnableLiveModeAntiRBI(qhyccd_handle *h,uint32_t value); +EXPORTC uint32_t STDCALL SetQHYCCDWriteFPGA(qhyccd_handle *h,uint8_t number,uint8_t regindex,uint8_t regvalue); +/** + @fn uint32_t SetQHYCCDWriteFPGA(qhyccd_handle *h,uint8_t number,uint8_t regindex,uint8_t regvalue); + @brief Write FPGA register of the camera directly for advanced control + @param handle camera control handle + @param number: if there is multiple FPGA, this is the sequence number . default is 0. + @param regindex: register index. It is 8bit. + @param regindex: register value. It is 8bit. + @return QHYCCD_SUCCESS or QHYCCD_ERROR. If it is QHYCCD_ERROR, it means (1) this model may have not support this function or (2) the API failur to run. +*/ + + +EXPORTC uint32_t STDCALL SetQHYCCDWriteCMOS(qhyccd_handle *h,uint8_t number,uint16_t regindex,uint16_t regvalue); +/** + @fn uint32_t SetQHYCCDWriteCMOS(qhyccd_handle *h,uint8_t number,uint16_t regindex,uint16_t regvalue); + @brief Write CMOS register of the camera directly for advanced control + @param handle camera control handle + @param number: if there is multiple CMOS, this is the sequence number . default is 0. + @param regindex: register index. It is 16bit. + @param regindex: register value. It is 16bit. + @return QHYCCD_SUCCESS or QHYCCD_ERROR. If it is QHYCCD_ERROR, it means (1) this model may have not support this function or (2) the API failur to run. +*/ + + +EXPORTFUNC uint32_t STDCALL SetQHYCCDTwoChannelCombineParameter(qhyccd_handle *handle, double x,double ah,double bh,double al,double bl); +/** + @fn uint32_t SetQHYCCDTwoChannelCombineParameter(qhyccd_handle *handle, double x,double ah,double bh,double al,double bl); + @brief For the camera with high gain low gain two channel combine to 16bit function, this API can set the combination parameters + @param handle camera control handle + @param x: High gain low gain channel data switch point. (based on the high gain channel data) + @param ah: High gain channel ratio (y=ax+b) + @param bh: High gain channel offset (y=ax+b) + @param al: Low gain channel ratio (y=ax+b) + @param bl: Low gain channel offset (y=ax+b) + @return QHYCCD_SUCCESS or QHYCCD_ERROR. If it is QHYCCD_ERROR, it means (1) this model may have not support this function or (2) the API failur to run. +*/ + +EXPORTC uint32_t STDCALL EnableQHYCCDImageOSD(qhyccd_handle *h,uint32_t i); + +EXPORTC void STDCALL QHYCCDQuit(); + +EXPORTC QHYDWORD STDCALL SetQHYCCDCallBack(QHYCCDProcCallBack ProcCallBack, + int32_t Flag); + +#if 0//PCIE_MODE_TEST + +#include "riffa.h" + + +/** + * Populates the fpga_info_list pointer with all FPGAs registered in the system. + * Returns 0 on success, non-zero on error. + */ +EXPORTC int STDCALL QHYCCD_fpga_list(struct fpga_info_list &list); + +/** + * Initializes the FPGA specified by id. On success, returns a pointer to a + * fpga_t struct. On error, returns NULL. Each FPGA must be opened before any + * channels can be accessed. Once opened, any number of threads can use the + * fpga_t struct. + */ +EXPORTC uint32_t STDCALL QHYCCD_fpga_open(int id); + +/** + * Cleans up memory/resources for the FPGA specified by the fd descriptor. + */ +EXPORTC void STDCALL QHYCCD_fpga_close(); + +/** + * Sends len words (4 byte words) from data to FPGA channel chnl using the + * fpga_t struct. The FPGA channel will be sent len, destoff, and last. If last + * is 1, the channel should interpret the end of this send as the end of a + * transaction. If last is 0, the channel should wait for additional sends + * before the end of the transaction. If timeout is non-zero, this call will + * send data and wait up to timeout ms for the FPGA to respond (between + * packets) before timing out. If timeout is zero, this call may block + * indefinitely. Multiple threads sending on the same channel may result in + * corrupt data or error. This function is thread safe across channels. + * Returns the number of words sent. + */ +EXPORTC int STDCALL QHYCCD_fpga_send(int chnl, void * data, int len, + int destoff, int last, uint64_t timeout); + +/** + * Receives data from the FPGA channel chnl to the data pointer, using the + * fpga_t struct. The FPGA channel can send any amount of data, so the data + * array should be large enough to accommodate. The len parameter specifies the + * actual size of the data buffer in words (4 byte words). The FPGA channel will + * specify an offset which will determine where in the data array the data will + * start being written. If the amount of data (plus offset) exceed the size of + * the data array (len), then that data will be discarded. If timeout is + * non-zero, this call will wait up to timeout ms for the FPGA to respond + * (between packets) before timing out. If timeout is zero, this call may block + * indefinitely. Multiple threads receiving on the same channel may result in + * corrupt data or error. This function is thread safe across channels. + * Returns the number of words received to the data array. + */ +EXPORTC int STDCALL QHYCCD_fpga_recv( int chnl, void * data, int len, + uint64_t timeout); + +/** + * Resets the state of the FPGA and all transfers across all channels. This is + * meant to be used as an alternative to rebooting if an error occurs while + * sending/receiving. Calling this function while other threads are sending or + * receiving will result in unexpected behavior. + */ +EXPORTC void STDCALL QHYCCD_fpga_reset(); +#endif + +#endif diff --git a/include/qhy/qhyccdcamdef.h b/include/qhy/qhyccdcamdef.h index e7051f4..490b358 100644 --- a/include/qhy/qhyccdcamdef.h +++ b/include/qhy/qhyccdcamdef.h @@ -1,43 +1,12 @@ -/* - QHYCCD SDK - Copyright (c) 2014 QHYCCD. - All Rights Reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program 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 General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - */ - -/*! - @file qhyccdcamdef.h - @brief QHYCCD SDK error define - */ #ifndef __QHYCCDCAMDEF_H__ #define __QHYCCDCAMDEF_H__ -//#define GIGAESUPPORT - -//#define QHYCCD_OPENCV_SUPPORT /* IMG series */ - /** * Type define for IMG0S */ #define DEVICETYPE_IMG0S 1000 @@ -121,8 +90,8 @@ #define DEVICETYPE_QHY5PII_C 3011 /** - * Type define for QHY5RII-M */ -#define DEVICETYPE_QHY5RII_M 3012 + * Type define for QHY5RII-C */ +#define DEVICETYPE_QHY5RII_C 3012 /** * Type define for QHY5RII-M */ @@ -361,12 +330,44 @@ #define DEVICETYPE_QHY294 4054 #define DEVICETYPE_QHY2020 4055 #define DEVICETYPE_QHY4040 4056 - +#define DEVICETYPE_QHY550 4057 +#define DEVICETYPE_QHY42PRO 4058 +#define DEVICETYPE_QHY6060 4059 +#define DEVICETYPE_QHY411 4060 + +#define DEVICETYPE_QHY600 4061 +#define DEVICETYPE_QHY600C 4062 +#define DEVICETYPE_QHY600M 4063 +#define DEVICETYPE_QHY0204 4064 + +#define DEVICETYPE_QHY411ERIS 4065 +#define DEVICETYPE_QHY411MERIS 4066 +#define DEVICETYPE_QHY411CERIS 4067 + +#define DEVICETYPE_QHY367PROC 4068 + +#define DEVICETYPE_QHY268C 4069 +#define DEVICETYPE_QHY410C 4070 +#define DEVICETYPE_QHY432 4071 +#define DEVICETYPE_QHY342 4072 +#define DEVICETYPE_QHY4040PRO 4073 +#define DEVICETYPE_QHY128PROC 4074 + +#define DEVICETYPE_QHY5III462 4075 +#define DEVICETYPE_QHY5III462C 4076 +#define DEVICETYPE_QHY5III462M 4077 + +#define DEVICETYPE_QHY533C 4078 +#define DEVICETYPE_QHY492M 4079 + +#define DEVICETYPE_QHY461 4080 +#define DEVICETYPE_QHY461M 4081 +#define DEVICETYPE_QHY461C 4082 /** * Type define for QHY5IIIEND*/ -#define DEVICETYPE_QHY5IIIEND 4999 +#define DEVICETYPE_QHY5IIIEND 4999 /** * Type define for QHY16 */ @@ -520,9 +521,835 @@ #define DEVICETYPE_QHY50GX 9013 +/** + * Type define for QHYPCIEBEGIN*/ +#define DEVICETYPE_QHYPCIEBEGIN 0X66180000 + +#define DEVICETYPE_QHY4040PROPCIE 0X66184043 +#define DEVICETYPE_QHY411ERISPCIE 0X6618c414 +#define DEVICETYPE_QHY600PCIE 0X6618c603 + + + +#define DEVICETYPE_QHYPCIEEND 0X6618ffff + + +/* IMG series */ +#define IMG132E_MAX_WIDTH 1280 +#define IMG132E_MAX_HEIGHT 1024 + +/** + * Type define for IMG0H */ +#define IMG0H_MAX_WIDTH 640 +#define IMG0H_MAX_HEIGHT 480 + +/** + * Type define for IMG0L */ +#define IMG0L_MAX_WIDTH -1 +#define IMG0L_MAX_HEIGHT -1 + +/** + * Type define for IMG0X */ + +#define IMG0X_MAX_WIDTH -1 +#define IMG0X_MAX_HEIGHT -1 + +/** + * Type define for IMG1S */ +#define IMG1S_MAX_WIDTH -1 +#define IMG1S_MAX_HEIGHT -1 + +/** + * Type define for IMG2S */ +#define IMG2S_MAX_WIDTH -1 +#define IMG2S_MAX_HEIGHT -1 + +/** + * Type define for IMG1E */ +#define IMG1E_MAX_WIDTH -1 +#define IMG1E_MAX_HEIGHT -1 + + +/* QHY5 seires */ + +/** + * Type define for QHY5 */ +#define QHY5_MAX_WIDTH 1280 +#define QHY5_MAX_HEIGHT 1024 + + +/* QHY5II series */ + +/** + * Type define for QHY5II */ +#define QHY5II_MAX_WIDTH 1280 +#define QHY5II_MAX_HEIGHT 1024 + +/** + * Type define for QHY5LII_M */ +#define QHY5LII_M_MAX_WIDTH 1280 +#define QHY5LII_M_MAX_HEIGHT 960 + +/** + * Type define for QHY5LII_C */ +#define QHY5LII_C_MAX_WIDTH 1280 +#define QHY5LII_C_MAX_HEIGHT 960 + +/** + * Type define for QHY5TII */ +#define QHY5TII_MAX_WIDTH -1 +#define QHY5TII_MAX_HEIGHT -1 + +/** + * Type define for QHY5RII */ +#define QHY5RII_MAX_WIDTH -1 +#define QHY5RII_MAX_HEIGHT -1 + +/** + * Type define for QHY5PII */ +#define QHY5PII_MAX_WIDTH -1 +#define QHY5PII_MAX_HEIGHT -1 + +/** + * Type define for QHY5VII */ +#define QHY5VII_MAX_WIDTH -1 +#define QHY5VII_MAX_HEIGHT -1 + +/** + * Type define for QHY5HII */ +#define QHY5HII_MAX_WIDTH 1280 +#define QHY5HII_MAX_HEIGHT 960 + +/** + * Type define for QHYXXX */ +#define MINICAM5S_M_MAX_WIDTH 1280 +#define MINICAM5S_M_MAX_HEIGHT 960 + +/** + * Type define for QHYXXX */ +#define MINICAM5S_C_MAX_WIDTH 1280 +#define MINICAM5S_C_MAX_HEIGHT 960 + +/** + * Type define for QHY5PII_C */ +#define QHY5PII_C_MAX_WIDTH 2592 +#define QHY5PII_C_MAX_HEIGHT 1944 + +/** + * Type define for QHY5RII-M */ +#define QHY5RII_C_MAX_WIDTH 728 +#define QHY5RII_C_MAX_HEIGHT 512 + +/** + * Type define for QHY5RII-M */ +#define MINICAM5F_M_MAX_WIDTH 1280 +#define MINICAM5F_M_MAX_HEIGHT 960 + +/** + * Type define for QHY5PII_M */ +#define QHY5PII_M_MAX_WIDTH 2592 +#define QHY5PII_M_MAX_HEIGHT 1944 + +/** + * Type define for QHY5TII */ +#define QHY5TII_C_MAX_WIDTH 2048 +#define QHY5TII_C_MAX_HEIGHT 1536 + +/** + * Type define for POLEMASTER */ +#define POLEMASTER_MAX_WIDTH 1280 +#define POLEMASTER_MAX_HEIGHT 960 + + +/* QHY5III seires */ + +/** + * Type define for QHY5III174 */ +#define QHY5III174_MAX_WIDTH 1920 +#define QHY5III174_MAX_HEIGHT 1200 + + +/** + * Type define for QHY5III174 */ +#define QHY5III174M_MAX_WIDTH QHY5III174_MAX_WIDTH +#define QHY5III174M_MAX_HEIGHT QHY5III174_MAX_HEIGHT + +/** + * Type define for QHY5III174C*/ +#define QHY5III174C_MAX_WIDTH QHY5III174_MAX_WIDTH +#define QHY5III174C_MAX_HEIGHT QHY5III174_MAX_HEIGHT + +/** + * Type define for QHY174*/ +#define QHY174_MAX_WIDTH 1920 +#define QHY174_MAX_HEIGHT 1200 + +/** + * Type define for QHY174M*/ +#define QHY174M_MAX_WIDTH QHY174_MAX_WIDTH +#define QHY174M_MAX_HEIGHT QHY174_MAX_HEIGHT + +/** + * Type define for QHY174C*/ +#define QHY174C_MAX_WIDTH QHY174_MAX_WIDTH +#define QHY174C_MAX_HEIGHT QHY174_MAX_HEIGHT + + + +/** + * Type define for QHY5III174*/ +#define QHY5III174BASE_MAX_WIDTH QHY5III174_MAX_WIDTH +#define QHY5III174BASE_MAX_HEIGHT QHY5III174_MAX_HEIGHT + + + + +/** + * Type define for QHY5III178*/ +#define QHY5III178_MAX_WIDTH 3056 +#define QHY5III178_MAX_HEIGHT 2048 + +/** + * Type define for QHY5III178C*/ +#define QHY5III178C_MAX_WIDTH QHY5III178_MAX_WIDTH +#define QHY5III178C_MAX_HEIGHT QHY5III178_MAX_HEIGHT + +/** + * Type define for QHY5III178M*/ +#define QHY5III178M_MAX_WIDTH QHY5III178_MAX_WIDTH +#define QHY5III178M_MAX_HEIGHT QHY5III178_MAX_HEIGHT + +/** + * Type define for QHY5III178*/ +#define QHY5III178BASE_MAX_WIDTH QHY5III178_MAX_WIDTH +#define QHY5III178BASE_MAX_HEIGHT QHY5III178_MAX_HEIGHT + + +/** + * Type define for QHY178*/ +#define QHY178_MAX_WIDTH 3056 +#define QHY178_MAX_HEIGHT 2048 + +/** + * Type define for QHY178M*/ +#define QHY178M_MAX_WIDTH QHY178_MAX_WIDTH +#define QHY178M_MAX_HEIGHT QHY178_MAX_HEIGHT + +/** + * Type define for QHY178C*/ +#define QHY178C_MAX_WIDTH QHY178_MAX_WIDTH +#define QHY178C_MAX_HEIGHT QHY178_MAX_HEIGHT + +/** + * Type define for QHY5III178*/ +#define QHY5III178COOLBASE_MAX_WIDTH QHY178_MAX_WIDTH +#define QHY5III178COOLBASE_MAX_HEIGHT QHY178_MAX_HEIGHT + + +/** + * Type define for QHY5III185*/ +#define QHY5III185_MAX_WIDTH 1920 +#define QHY5III185_MAX_HEIGHT 1200 + +/** + * Type define for QHY5III185C*/ +#define QHY5III185C_MAX_WIDTH QHY5III185_MAX_WIDTH +#define QHY5III185C_MAX_HEIGHT QHY5III185_MAX_HEIGHT + +/** + * Type define for QHY5III185M*/ +#define QHY5III185M_MAX_WIDTH QHY5III185_MAX_WIDTH +#define QHY5III185M_MAX_HEIGHT QHY5III185_MAX_HEIGHT + + +/** + * Type define for QHY5III185M*/ +#define QHY5III185BASE_MAX_WIDTH QHY5III185_MAX_WIDTH +#define QHY5III185BASE_MAX_HEIGHT QHY5III185_MAX_HEIGHT + + +/** + * Type define for QHY185*/ +#define QHY185_MAX_WIDTH -1 +#define QHY185_MAX_HEIGHT -1 + +/** + * Type define for QHY185M*/ +#define QHY185M_MAX_WIDTH -1 +#define QHY185M_MAX_HEIGHT -1 + +/** + * Type define for QHY185C*/ +#define QHY185C_MAX_WIDTH -1 +#define QHY185C_MAX_HEIGHT -1 + +/** + * Type define for QHY5III224*/ +#define QHY5III224_MAX_WIDTH 1280 +#define QHY5III224_MAX_HEIGHT 960 + +/** + * Type define for QHY5III224C*/ +#define QHY5III224C_MAX_WIDTH QHY5III224_MAX_WIDTH +#define QHY5III224C_MAX_HEIGHT QHY5III224_MAX_HEIGHT + +/** + * Type define for QHY5III224M*/ +#define QHY5III224M_MAX_WIDTH QHY5III224_MAX_WIDTH +#define QHY5III224M_MAX_HEIGHT QHY5III224_MAX_HEIGHT + +/** + * Type define for QHY5III224M*/ +#define QHY5III224BASE_MAX_WIDTH QHY5III224_MAX_WIDTH +#define QHY5III224BASE_MAX_HEIGHT QHY5III224_MAX_HEIGHT + +/** + * Type define for QHY224*/ +#define QHY224_MAX_WIDTH 1280 +#define QHY224_MAX_HEIGHT 960 + +/** + * Type define for QHY224M*/ +#define QHY224M_MAX_WIDTH QHY224_MAX_WIDTH +#define QHY224M_MAX_HEIGHT QHY224_MAX_HEIGHT + +/** + * Type define for QHY224C*/ +#define QHY224C_MAX_WIDTH QHY224_MAX_WIDTH +#define QHY224C_MAX_HEIGHT QHY224_MAX_HEIGHT + +/** + * Type define for QHY224C*/ +#define QHY5III224COOLBASE_MAX_WIDTH QHY224_MAX_WIDTH +#define QHY5III224COOLBASE_MAX_HEIGHT QHY224_MAX_HEIGHT + +/** + * Type define for QHY5III290*/ +#define QHY5III290_MAX_WIDTH 1920 +#define QHY5III290_MAX_HEIGHT 1080 + +/** + * Type define for QHY5III290C*/ +#define QHY5III290C_MAX_WIDTH QHY5III290_MAX_WIDTH +#define QHY5III290C_MAX_HEIGHT QHY5III290_MAX_HEIGHT + +/** + * Type define for QHY5III290M*/ +#define QHY5III290M_MAX_WIDTH QHY5III290_MAX_WIDTH +#define QHY5III290M_MAX_HEIGHT QHY5III290_MAX_HEIGHT + +/** + * Type define for QHY5III290M*/ +#define QHY5III290BASE_MAX_WIDTH QHY5III290_MAX_WIDTH +#define QHY5III290BASE_MAX_HEIGHT QHY5III290_MAX_HEIGHT + +/** + * Type define for QHY5III290*/ +#define QHY290_MAX_WIDTH 1920 +#define QHY290_MAX_HEIGHT 1080 + + + +/** + * Type define for QHY290M*/ +#define QHY290M_MAX_WIDTH QHY290_MAX_WIDTH +#define QHY290M_MAX_HEIGHT QHY290_MAX_HEIGHT + +/** + * Type define for QHY290C*/ +#define QHY290C_MAX_WIDTH QHY290_MAX_WIDTH +#define QHY290C_MAX_HEIGHT QHY290_MAX_HEIGHT + +/** + * Type define for QHY290C*/ +#define QHY5III290COOLBASE_MAX_WIDTH QHY290_MAX_WIDTH +#define QHY5III290COOLBASE_MAX_HEIGHT QHY290_MAX_HEIGHT + +/** + * Type define for QHY5III236*/ +#define QHY5III236_MAX_WIDTH 1952 +#define QHY5III236_MAX_HEIGHT 1237 + +/** + * Type define for QHY5III236C*/ +#define QHY5III236C_MAX_WIDTH QHY5III236_MAX_WIDTH +#define QHY5III236C_MAX_HEIGHT QHY5III236_MAX_HEIGHT + +/** + * Type define for QHY5III290M*/ +#define QHY5III236M_MAX_WIDTH QHY5III236_MAX_WIDTH +#define QHY5III236M_MAX_HEIGHT QHY5III236_MAX_HEIGHT + +/** + * Type define for QHY236*/ +#define QHY236_MAX_WIDTH -1 +#define QHY236_MAX_HEIGHT -1 + +/** + * Type define for QHY236M*/ +#define QHY236M_MAX_WIDTH QHY236_MAX_WIDTH +#define QHY236M_MAX_HEIGHT QHY236_MAX_HEIGHT + +/** + * Type define for QHY236C*/ +#define QHY236C_MAX_WIDTH QHY236_MAX_WIDTH +#define QHY236C_MAX_HEIGHT QHY236_MAX_HEIGHT + +/** + * Type define for GSENSE400*/ +#define QHY5IIIG400M_MAX_WIDTH 2048 +#define QHY5IIIG400M_MAX_HEIGHT 2048 + +/** + * Type define for QHY163*/ +#define QHY163_MAX_WIDTH 4656 +#define QHY163_MAX_HEIGHT 3522 + +/** + * Type define for QHY163M*/ +#define QHY163M_MAX_WIDTH QHY163_MAX_WIDTH +#define QHY163M_MAX_HEIGHT QHY163_MAX_HEIGHT + +/** + * Type define for QHY163C*/ +#define QHY163C_MAX_WIDTH QHY163_MAX_WIDTH +#define QHY163C_MAX_HEIGHT QHY163_MAX_HEIGHT + +/** + * Type define for QHY165*/ +#define QHY165_MAX_WIDTH 4936 +#define QHY165_MAX_HEIGHT 3286 + +/** + * Type define for QHY165C*/ +#define QHY165C_MAX_WIDTH QHY165_MAX_WIDTH +#define QHY165C_MAX_HEIGHT QHY165_MAX_HEIGHT + +/** + * Type define for QHY367*/ +#define QHY367_MAX_WIDTH 7380 +#define QHY367_MAX_HEIGHT 4908 + +/** + * Type define for QHY367C*/ +#define QHY367C_MAX_WIDTH QHY367_MAX_WIDTH +#define QHY367C_MAX_HEIGHT QHY367_MAX_HEIGHT + +/** + * Type define for QHY183*/ +#define QHY183_MAX_WIDTH 5544 +#define QHY183_MAX_HEIGHT 3684 + +/** + * Type define for QHY183C*/ +#define QHY183C_MAX_WIDTH QHY183_MAX_WIDTH +#define QHY183C_MAX_HEIGHT QHY183_MAX_HEIGHT + +/** + * Type define for QHY-DevelopDev*/ +#define QHY5IIICOMMON_MAX_WIDTH 9000 +#define QHY5IIICOMMON_MAX_HEIGHT 7000 + +/** + * Type define for QHY247*/ +#define QHY247_MAX_WIDTH 6088 +#define QHY247_MAX_HEIGHT 4052 + +/** + * Type define for QHY247C*/ +#define QHY247C_MAX_WIDTH QHY247_MAX_WIDTH +#define QHY247C_MAX_HEIGHT QHY247_MAX_HEIGHT + +/** + * Type define for QHY247C*/ +#define QHY5III247BASE_MAX_WIDTH QHY247_MAX_WIDTH +#define QHY5III247BASE_MAX_HEIGHT QHY247_MAX_HEIGHT + + +/** + * Type define for MINICAM6F*/ +#define MINICAM6F_MAX_WIDTH QHY5III178COOLBASE_MAX_WIDTH +#define MINICAM6F_MAX_HEIGHT QHY5III178COOLBASE_MAX_HEIGHT + +/** + * Type define for QHY168C*/ +#define QHY168_MAX_WIDTH 5056 +#define QHY168_MAX_HEIGHT 3358 + +#define QHY168C_MAX_WIDTH QHY168_MAX_WIDTH +#define QHY168C_MAX_HEIGHT QHY168_MAX_HEIGHT + +#define QHY5III168BASE_MAX_WIDTH QHY168_MAX_WIDTH +#define QHY5III168BASE_MAX_HEIGHT QHY168_MAX_HEIGHT + +/** + * Type define for QHY128C*/ +#define QHY128_MAX_WIDTH 6036 +#define QHY128_MAX_HEIGHT 4036 + +#define QHY128C_MAX_WIDTH QHY128_MAX_WIDTH +#define QHY128C_MAX_HEIGHT QHY128_MAX_HEIGHT + +#define QHY294_MAX_WIDTH 4212 +#define QHY294_MAX_HEIGHT 2850 + +#define QHY2020_MAX_WIDTH 4096 +#define QHY2020_MAX_HEIGHT 2048 + +#define QHY4040_MAX_WIDTH 4096 +#define QHY4040_MAX_HEIGHT 4118 + +#define QHY4040PRO_MAX_WIDTH 4096 +#define QHY4040PRO_MAX_HEIGHT 4118 + + +#define QHY550_MAX_WIDTH 2496 +#define QHY550_MAX_HEIGHT 2080 + +#define QHY42PRO_MAX_WIDTH 4096 +#define QHY42PRO_MAX_HEIGHT 2048 + +#define QHY6060_MAX_WIDTH 7936 +#define QHY6060_MAX_HEIGHT 6134 + +#define QHY411_MAX_WIDTH 14304 +#define QHY411_MAX_HEIGHT 10748 + +#define QHY411ERIS_MAX_WIDTH 14304 +#define QHY411ERIS_MAX_HEIGHT 10748 + +#define QHY600_MAX_WIDTH 9600 +#define QHY600_MAX_HEIGHT 6422 + + +#define QHY461_MAX_WIDTH 11760 +#define QHY461_MAX_HEIGHT 8842 + +#define QHY268C_MAX_WIDTH 6280 +#define QHY268C_MAX_HEIGHT 4210 + +#define QHY410C_MAX_WIDTH 6112 +#define QHY410C_MAX_HEIGHT 4140-100 + +#define QHY432_MAX_WIDTH 1624 +#define QHY432_MAX_HEIGHT 1136 + +#define QHY342_MAX_WIDTH 6512 +#define QHY342_MAX_HEIGHT 4870 +/** + * Type define for QHY16 */ +#define QHY16_MAX_WIDTH 4144 +#define QHY16_MAX_HEIGHT 4128 + +/** + * Type define for QHY6 */ +#define QHY6_MAX_WIDTH 800 +#define QHY6_MAX_HEIGHT 596 + +/** + * Type define for QHY7 */ +#define QHY7_MAX_WIDTH 2112 +#define QHY7_MAX_HEIGHT 2072 + +/** + * Type define for QHY2PRO */ +#define QHY2PRO_MAX_WIDTH 1440 +#define QHY2PRO_MAX_HEIGHT 1050 + +/** + * Type define for IMG2P */ +#define IMG2P_MAX_WIDTH 1436 +#define IMG2P_MAX_HEIGHT 1050 + +/** + * Type define for QHY8 */ +#define QHY8_MAX_WIDTH 3328 +#define QHY8_MAX_HEIGHT 2030 + +/** + * Type define for QHY8PRO */ +#define QHY8PRO_MAX_WIDTH 3328 +#define QHY8PRO_MAX_HEIGHT 2030 + +/** + * Type define for QHY16000 */ +#define QHY16000_MAX_WIDTH 4960 +#define QHY16000_MAX_HEIGHT 3328 + +/** + * Type define for QHY12 */ +#define QHY12_MAX_WIDTH 3328 +#define QHY12_MAX_HEIGHT 4640 + +/** + * Type define for IC8300 */ +#define IC8300_MAX_WIDTH 3584 +#define IC8300_MAX_HEIGHT 2576 + +/** + * Type define for QHY9S */ +#define QHY9S_MAX_WIDTH 3584 +#define QHY9S_MAX_HEIGHT 2574 /** - * Type define for UNKNOWN */ -#define DEVICETYPE_UNKNOWN -1 + * Type define for QHY10 */ +#define QHY10_MAX_WIDTH 2816 +#define QHY10_MAX_HEIGHT 3940 + + +/** + * Type define for QHY8L */ +#define QHY8L_MAX_WIDTH 3328 +#define QHY8L_MAX_HEIGHT 2030 + +/** + * Type define for QHY11 */ +#define QHY11_MAX_WIDTH 4096 +#define QHY11_MAX_HEIGHT 2720 + +/** + * Type define for QHY21 */ +#define QHY21_MAX_WIDTH 2048 +#define QHY21_MAX_HEIGHT 1500 + + + +/** + * Type define for QHY23 */ +#define QHY23_MAX_WIDTH 3584 +#define QHY23_MAX_HEIGHT 2728 + +/** + * Type define for QHY15 */ +#define QHY15_MAX_WIDTH 3108 +#define QHY15_MAX_HEIGHT 3086 + +/** + * Type define for QHY27 */ +#define QHY27_MAX_WIDTH 5120 +#define QHY27_MAX_HEIGHT 3332 + + +/** + * Type define for QHY28 */ +#define QHY28_MAX_WIDTH 5120 +#define QHY28_MAX_HEIGHT 3332 + +/** + * Type define for QHY9T */ +#define QHY9T_MAX_WIDTH 3584 +#define QHY9T_MAX_HEIGHT 2574 + +/** + * Type define for QHY29 */ +#define QHY29_MAX_WIDTH 6656 +#define QHY29_MAX_HEIGHT 4452 + +/** + * Type define for SOLAR1600 */ +#define SOLAR1600_MAX_WIDTH 4928 +#define SOLAR1600_MAX_HEIGHT 3264 + +/* QHYA seires */ + +/** + * Type define for QHY90A/IC90A */ +#define QHY90A_MAX_WIDTH 3584 +#define QHY90A_MAX_HEIGHT 2576 + +/** + * Type define for QHY16200A/IC16200A */ +#define QHY16200A_MAX_WIDTH 5120 +#define QHY16200A_MAX_HEIGHT 3696 + +/** + * Type define for QHY814A/IC814A */ +#define QHY814A_MAX_WIDTH 3584 +#define QHY814A_MAX_HEIGHT 2720 + +/** + * Type define for 16803 */ +#define IC16803_MAX_WIDTH 4192 +#define IC16803_MAX_HEIGHT 4128 + +/** + * Type define for 16803 */ +#define QHY09000_MAX_WIDTH 3140 +#define QHY09000_MAX_HEIGHT 3096 + + +/** + * Type define for 695A*/ +#define QHY695A_MAX_WIDTH 3072 +#define QHY695A_MAX_HEIGHT 2240 + + +/** + * Type define for QHY15GIGAE */ +#define QHY15G_MAX_WIDTH -1 +#define QHY15G_MAX_HEIGHT -1 + +/** + * Type define for SOLAR800G */ +#define SOLAR800G_MAX_WIDTH 3584 +#define SOLAR800G_MAX_HEIGHT 2574 + +#define A0340G_MAX_WIDTH -1 +#define A0340G_MAX_HEIGHT -1 + +#define QHY08050G_MAX_WIDTH (3392 - 14) +#define QHY08050G_MAX_HEIGHT 2560 + +#define QHY694G_MAX_WIDTH -1 +#define QHY694G_MAX_HEIGHT -1 + +#define QHY27G_MAX_WIDTH -1 +#define QHY27G_MAX_HEIGHT -1 + +#define QHY23G_MAX_WIDTH -1 +#define QHY23G_MAX_HEIGHT -1 + +#define QHY16000G_MAX_WIDTH 4960 +#define QHY16000G_MAX_HEIGHT 3328 + +#define QHY160002AD_MAX_WIDTH 5120 +#define QHY160002AD_MAX_HEIGHT 3328 + +#define QHY814G_MAX_WIDTH 3584 +#define QHY814G_MAX_HEIGHT 2728 + +#define QHY45GX_MAX_WIDTH 1280 +#define QHY45GX_MAX_HEIGHT 1024 + + + +#define QHY50GX_MAX_WIDTH 8400 +#define QHY50GX_MAX_HEIGHT 6220 + + + +/** + * Type define for UNKNOW */ +#define DEVICETYPE_UNKNOW -1 + +#define MAX_EXPOSURE_TIMES (3600) //s + +#define REMAINING_MIN_EXPOSURETIMES (3000)//ms + +#define MAX_CAMERA_NUMBER 200 +#define CAMERA_ID_LENGTH 64 +#define MAXDEVICES 8 + + +#define MAX_READMODE_NAME 256 +#define MAX_READMODE_CAM_NUMBER 6 + + +#define SEND_CAMERA_NO_MESSAGE 0 + + +#define SEND_CAMERA_ID 9501 +#define SEND_CAMERA_STATUS 9502 +#define SEND_CAMERA_LIVE 9503 +#define SEND_CAMERA_SINGLE 9504 +#define SEND_CAMERA_CAPABLE 9505 +#define SEND_CAMERA_MAXMINSTEP 9506 +#define SEND_CAMERA_EXPOSING 9507 + +#define CAMERA_HANDLE_INVALID 9508 +#define HANDLE_IS_NULL 9509 +#define USB_PORT_ERROR 9510 + + + + +#define CAMERA_LOSE 10001 +#define CAMERA_INSERT 10002 + +#define CAMERA_LIVE_ERROR 10003 +#define CAMERA_LIVE_DATA_AVAILABLE 10004 +#define CAMERA_LIVE_STOP 10005 +#define CAMERA_LIVE_TIMEOUT 10006 + +#define CAMERA_SINGLE_ERROR 10011 +#define CAMERA_SINGLE_DATA_AVAILABLE 10012 +#define CAMERA_SINGLE_STOP 10013 +#define CAMERA_SINGLE_TIMEOUT 10014 + +#define SEND_MSG_NONE 0 +#define SEND_MSG_WHOLE 1 +#define SEND_MSG_PART 2 + + +#define SINGLE_MODE 0 +#define LIVE_MODE 1 + +#define GET_IMAGE_TIMEOUT 60000 //QHY09000 DRIFT SCAN MOD 600000 +//#define GET_IMAGE_TIMEOUT 900000 //QHY09000 DRIFT SCAN MOD 600000 + +#define IS_OPERATOR_NONE 0 +#define IS_CAMARA_INIT 1 +#define IS_CAMARA_OPEN 2 +#define IS_CAMARA_CLOSE 3 +#define IS_CAMARA_STOP_LIVE 4 +#define IS_CAMARA_CAN_EXP 5 +#define IS_CAMARA_ERROR 6 +#define IS_GET_SINGLEPICTURE 7 +#define IS_GET_LIVEPICTURE 8 + + + +#define COMMAND_QUEUE_PUSH 1 +#define COMMAND_QUEUE_POP 2 + + + + +#define DEMO_MAXDEVICES 6 +#define MESSAGE_SIZS 1000 + + +#define CFWSLOTS_NUM9 9 +#define CFWSLOTS_NUM8 8 +#define CFWSLOTS_NUM7 7 +#define CFWSLOTS_NUM6 6 + +#define CFWSLOTS_DELAY 4000 + +#define RESET_USB_PIPE 1 +#define ABORT_USB_PIPE 2 + + + +#define MAX_PCIE_CHANNEL 4 + +#define FPGA_CAMARA_LENGTH 256 + +#define CAM_SCAN_INTERVAL 1000 + +#define CRC32_POLY (0x04C11DB7) + + + +#define PCIE_CARD_HEAD (0x55EEAACC) + +#define PCIE_CARD_READ_C (0x00005555) +#define PCIE_CARD_WRITE_C (0x00003333) + +#define PCIE_COMMAND_HEAD (0xAAEE3322) + +#define PCIE_FPGA_WRITE_C (0x00008881) +#define PCIE_NIOS_READ_C (0x00007770) +#define PCIE_NIOS_WRITE_C (0x00007771) + +#define PCIE_CAPTURE_WRITE_C (0x66666665) + + +#define PCIE_DWORD (4) + +#define FRAME_BUFF_NUM 3 + +#define IS_WRITE 1 +#define IS_READ 2 #endif diff --git a/include/qhy/qhyccderr.h b/include/qhy/qhyccderr.h index be24b3a..9652bc7 100644 --- a/include/qhy/qhyccderr.h +++ b/include/qhy/qhyccderr.h @@ -1,30 +1,3 @@ -/* - QHYCCD SDK - - Copyright (c) 2014 QHYCCD. - All Rights Reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program 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 General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - */ - -/*! \file qhyccderr.h - \brief QHYCCD SDK error define - */ #ifndef __QHYCCDERR_H__ #define __QHYCCDERR_H__ @@ -32,6 +5,17 @@ #define QHYCCD_READ_DIRECTLY 0x2001 #define QHYCCD_DELAY_200MS 0x2000 + +/** + * It means the camera using PCIE transfer data */ +#define QHYCCD_PCIE 9 + + +/** + * It means the camera using WINPCAP transfer data */ +#define QHYCCD_WINPCAP 8 + + /** * It means the camera using GiGaE transfer data */ #define QHYCCD_QGIGAE 7 @@ -164,6 +148,6 @@ /** * Set cam white balance blue failed */ #define QHYCCD_ERROR -25 -#endif // #if 0 +#endif #endif diff --git a/include/qhy/qhyccdstruct.h b/include/qhy/qhyccdstruct.h index c226926..2f08cf7 100644 --- a/include/qhy/qhyccdstruct.h +++ b/include/qhy/qhyccdstruct.h @@ -1,85 +1,72 @@ -/* - QHYCCD SDK - - Copyright (c) 2014 QHYCCD. - All Rights Reserved. - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) - any later version. - - This program 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 General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - The full GNU General Public License is included in this distribution in the - file called LICENSE. - */ -/*! - * @file qhyccdstruct.h - * @brief QHYCCD SDK struct define - */ +#include "config.h" + + + -#ifndef WIN32 - #define LINUX -#else - #define QHYCCD_OPENCV_SUPPORT -#endif -#ifdef WIN32 - #include -#else // Linux & Mac - #include -#endif #ifndef __QHYCCDSTRUCTDEF_H__ #define __QHYCCDSTRUCTDEF_H__ -#ifdef WIN32 - +#if defined (_WIN32) #ifndef EXPORTFUNC #define EXPORTFUNC extern "C" __declspec(dllexport) #endif - #ifndef STDCALL #define STDCALL __stdcall #endif - #ifndef EXPORTC #define EXPORTC extern "C" #endif - #else - #define EXPORTFUNC extern "C" #define STDCALL #define EXPORTC extern "C" - #endif #include "stdint.h" + +#if defined (_WIN32) + +#ifdef _M_IX86 +typedef uint32_t QHYDWORD; +#else +typedef uint64_t QHYDWORD; +#endif + +#else + +#ifdef __i386__ +typedef uint32_t QHYDWORD; +#else +typedef uint64_t QHYDWORD; +#endif + +#endif + + /** * usb vendor request command */ -#define QHYCCD_REQUEST_READ (0xC0) +#define QHYCCD_REQUEST_READ 0xC0 /** * usb vendor request command */ -#define QHYCCD_REQUEST_WRITE (0x40) +#define QHYCCD_REQUEST_WRITE 0x40 #define MACHANICALSHUTTER_OPEN 0 #define MACHANICALSHUTTER_CLOSE 1 #define MACHANICALSHUTTER_FREE 2 + + +#define MAX_READMODE_NUMBER 8 +#define MAX_READMODE_CAMARA_NUMBER 8 + + /** * @brief CCDREG struct define * @@ -87,51 +74,86 @@ */ typedef struct ccdreg { - uint8_t Gain; //!< ccd gain - uint8_t Offset; //!< ccd offset - uint32_t Exptime; //!< expose time - uint8_t HBIN; //!< width bin - uint8_t VBIN; //!< height bin - uint16_t LineSize; //!< almost match image width - uint16_t VerticalSize; //!< almost match image height - uint16_t SKIP_TOP; //!< Reserved - uint16_t SKIP_BOTTOM; //!< Reserved - uint16_t LiveVideo_BeginLine;//!< Reserved - uint16_t AnitInterlace; //!< Reserved - uint8_t MultiFieldBIN; //!< Reserved - uint8_t AMPVOLTAGE; //!< Reserved - uint8_t DownloadSpeed; //!< transfer speed - uint8_t TgateMode; //!< Reserved - uint8_t ShortExposure; //!< Reserved - uint8_t VSUB; //!< Reserved - uint8_t CLAMP; //!< Reserved - uint8_t TransferBIT; //!< Reserved - uint8_t TopSkipNull; //!< Reserved - uint16_t TopSkipPix; //!< Reserved - uint8_t MechanicalShutterMode;//!< Reserved - uint8_t DownloadCloseTEC; //!< Reserved - uint8_t SDRAM_MAXSIZE; //!< Reserved - uint16_t ClockADJ; //!< Reserved - uint8_t Trig; //!< Reserved - uint8_t MotorHeating; //!< Reserved - uint8_t WindowHeater; //!< Reserved - uint8_t ADCSEL; //!< Reserved -}CCDREG; + uint8_t Gain; //!< ccd gain + uint8_t Offset; //!< ccd offset + uint32_t Exptime; //!< expose time + uint8_t HBIN; //!< width bin + uint8_t VBIN; //!< height bin + uint16_t LineSize; //!< almost match image width + uint16_t VerticalSize; //!< almost match image height + uint16_t SKIP_TOP; //!< Reserved + uint16_t SKIP_BOTTOM; //!< Reserved + uint16_t LiveVideo_BeginLine;//!< Reserved + uint16_t AnitInterlace; //!< Reserved + uint8_t MultiFieldBIN; //!< Reserved + uint8_t AMPVOLTAGE; //!< Reserved + uint8_t DownloadSpeed; //!< transfer speed + uint8_t TgateMode; //!< Reserved + uint8_t ShortExposure; //!< Reserved + uint8_t VSUB; //!< Reserved + uint8_t CLAMP; //!< Reserved + uint8_t TransferBIT; //!< Reserved + uint8_t TopSkipNull; //!< Reserved + uint16_t TopSkipPix; //!< Reserved + uint8_t MechanicalShutterMode;//!< Reserved + uint8_t DownloadCloseTEC; //!< Reserved + uint8_t SDRAM_MAXSIZE; //!< Reserved + uint16_t ClockADJ; //!< Reserved + uint8_t Trig; //!< Reserved + uint8_t MotorHeating; //!< Reserved + uint8_t WindowHeater; //!< Reserved + uint8_t ADCSEL; //!< Reserved +} +CCDREG; struct BIOREG { - uint16_t LineSize; - uint16_t PatchNumber; - uint8_t AMPVOLTAGE; - uint8_t ShortExposure; - uint8_t SDRAM_MAXSIZE; - uint8_t DownloadSpeed; - uint8_t TransferBIT; - uint8_t BIOCCD_Mode; - uint8_t BIOCCD_Video; - uint8_t SDRAM_Bypass; + uint16_t LineSize; + uint16_t PatchNumber; + uint8_t AMPVOLTAGE; + uint8_t ShortExposure; + uint8_t SDRAM_MAXSIZE; + uint8_t DownloadSpeed; + uint8_t TransferBIT; + uint8_t BIOCCD_Mode; + uint8_t BIOCCD_Video; + uint8_t SDRAM_Bypass; }; + + + +#if 0 +//lowlevelstatus is used for QHYCCD LowLevelProtocol to readout the camera status from 0XD2 command. +//see QHYCCD Low Level Protocol White Paper. +typedef struct lowlevelstatus +{ + uint8_t speed; //!< ccd gain + uint32_t restExpTime; //!< ccd offset + uint32_t ExpTime; //!< expose time + uint8_t FwVersionYear; //!< width bin + uint8_t FwVersionMonth; //!< height bin + uint8_t FwVersionDay; //!< almost match image width + uint8_t TempType; //!< almost match image height + uint16_t CurrentTempADU; //!< Reserved + uint16_t TargetTempADU; //!< Reserved + uint8_t CurrentPWM;//!< Reserved + uint8_t TempControlMode; //!< Reserved + uint32_t DataInDDR; //!< Reserved + double CurrentTempC; //!< Reserved + double TargetTempC; //!< transfer speed + uint16_t ImageX; //!< Reserved + uint16_t ImageY; //!< Reserved + uint8_t ImageBitDepth; //!< Reserved + uint8_t USBSpeed; //!< Reserved + uint8_t cfwbuffer[8]; //!< Reserved + uint8_t cameraSubModel; //!< Reserved + uint8_t cameraColorType; //!< Reserved + uint8_t cameraSeriesNumber[16];//!< Reserved +} +LowLevelStatus; +#endif + /** * @brief CONTROL_ID enum define * @@ -139,84 +161,126 @@ struct BIOREG */ enum CONTROL_ID { - CONTROL_BRIGHTNESS = 0, //!< image brightness - CONTROL_CONTRAST, //1 image contrast - CONTROL_WBR, //2 red of white balance - CONTROL_WBB, //3 blue of white balance - CONTROL_WBG, //4 the green of white balance - CONTROL_GAMMA, //5 screen gamma - CONTROL_GAIN, //6 camera gain - CONTROL_OFFSET, //7 camera offset - CONTROL_EXPOSURE, //8 expose time (us) - CONTROL_SPEED, //9 transfer speed - CONTROL_TRANSFERBIT, //10 image depth bits - CONTROL_CHANNELS, //11 image channels - CONTROL_USBTRAFFIC, //12 hblank - CONTROL_ROWNOISERE, //13 row denoise - CONTROL_CURTEMP, //14 current cmos or ccd temprature - CONTROL_CURPWM, //15 current cool pwm - CONTROL_MANULPWM, //16 set the cool pwm - CONTROL_CFWPORT, //17 control camera color filter wheel port - CONTROL_COOLER, //18 check if camera has cooler - CONTROL_ST4PORT, //19 check if camera has st4port - CAM_COLOR, //20 - CAM_BIN1X1MODE, //21 check if camera has bin1x1 mode - CAM_BIN2X2MODE, //22 check if camera has bin2x2 mode - CAM_BIN3X3MODE, //23 check if camera has bin3x3 mode - CAM_BIN4X4MODE, //24 check if camera has bin4x4 mode - CAM_MECHANICALSHUTTER, //25 mechanical shutter - CAM_TRIGER_INTERFACE, //26 triger - CAM_TECOVERPROTECT_INTERFACE, //27 tec overprotect - CAM_SINGNALCLAMP_INTERFACE, //28 singnal clamp - CAM_FINETONE_INTERFACE, //29 fine tone - CAM_SHUTTERMOTORHEATING_INTERFACE, //30 shutter motor heating - CAM_CALIBRATEFPN_INTERFACE, //31 calibrated frame - CAM_CHIPTEMPERATURESENSOR_INTERFACE, //32 chip temperaure sensor - CAM_USBREADOUTSLOWEST_INTERFACE, //33 usb readout slowest - - CAM_8BITS, //34 8bit depth - CAM_16BITS, //35 16bit depth - CAM_GPS, //36 check if camera has gps - - CAM_IGNOREOVERSCAN_INTERFACE, //37 ignore overscan area - - QHYCCD_3A_AUTOBALANCE, //38 - QHYCCD_3A_AUTOEXPOSURE, //39 - QHYCCD_3A_AUTOFOCUS, //40 - CONTROL_AMPV, //41 ccd or cmos ampv - CONTROL_VCAM, //42 Virtual Camera on off - CAM_VIEW_MODE, //43 - - CONTROL_CFWSLOTSNUM, //44 check CFW slots number - IS_EXPOSING_DONE, //45 - ScreenStretchB, //46 - ScreenStretchW, //47 - CONTROL_DDR, //47 - CAM_LIGHT_PERFORMANCE_MODE, //49 - - CAM_QHY5II_GUIDE_MODE, //50 - DDR_BUFFER_CAPACITY, //51 - DDR_BUFFER_READ_THRESHOLD, //52 - - DefaultOffset, //53 - OutputDataActualBits, //54 - OutputDataAlignment //55 +/*0*/ CONTROL_BRIGHTNESS = 0, //!< image brightness +/*1*/ CONTROL_CONTRAST, //!< image contrast +/*2*/ CONTROL_WBR, //!< red of white balance +/*3*/ CONTROL_WBB, //!< blue of white balance +/*4*/ CONTROL_WBG, //!< the green of white balance +/*5*/ CONTROL_GAMMA, //!< screen gamma +/*6*/ CONTROL_GAIN, //!< camera gain +/*7*/ CONTROL_OFFSET, //!< camera offset +/*8*/ CONTROL_EXPOSURE, //!< expose time (us) +/*9*/ CONTROL_SPEED, //!< transfer speed +/*10*/ CONTROL_TRANSFERBIT, //!< image depth bits +/*11*/ CONTROL_CHANNELS, //!< image channels +/*12*/ CONTROL_USBTRAFFIC, //!< hblank +/*13*/ CONTROL_ROWNOISERE, //!< row denoise +/*14*/ CONTROL_CURTEMP, //!< current cmos or ccd temprature +/*15*/ CONTROL_CURPWM, //!< current cool pwm +/*16*/ CONTROL_MANULPWM, //!< set the cool pwm +/*17*/ CONTROL_CFWPORT, //!< control camera color filter wheel port +/*18*/ CONTROL_COOLER, //!< check if camera has cooler +/*19*/ CONTROL_ST4PORT, //!< check if camera has st4port +/*20*/ CAM_COLOR, +/*21*/ CAM_BIN1X1MODE, //!< check if camera has bin1x1 mode +/*22*/ CAM_BIN2X2MODE, //!< check if camera has bin2x2 mode +/*23*/ CAM_BIN3X3MODE, //!< check if camera has bin3x3 mode +/*24*/ CAM_BIN4X4MODE, //!< check if camera has bin4x4 mode +/*25*/ CAM_MECHANICALSHUTTER, //!< mechanical shutter +/*26*/ CAM_TRIGER_INTERFACE, //!< triger +/*27*/ CAM_TECOVERPROTECT_INTERFACE, //!< tec overprotect +/*28*/ CAM_SINGNALCLAMP_INTERFACE, //!< singnal clamp +/*29*/ CAM_FINETONE_INTERFACE, //!< fine tone +/*30*/ CAM_SHUTTERMOTORHEATING_INTERFACE, //!< shutter motor heating +/*31*/ CAM_CALIBRATEFPN_INTERFACE, //!< calibrated frame +/*32*/ CAM_CHIPTEMPERATURESENSOR_INTERFACE, //!< chip temperaure sensor +/*33*/ CAM_USBREADOUTSLOWEST_INTERFACE, //!< usb readout slowest + +/*34*/ CAM_8BITS, //!< 8bit depth +/*35*/ CAM_16BITS, //!< 16bit depth +/*36*/ CAM_GPS, //!< check if camera has gps + +/*37*/ CAM_IGNOREOVERSCAN_INTERFACE, //!< ignore overscan area + +/*38*/ QHYCCD_3A_AUTOBALANCE, +/*39*/ QHYCCD_3A_AUTOEXPOSURE, +/*40*/ QHYCCD_3A_AUTOFOCUS, +/*41*/ CONTROL_AMPV, //!< ccd or cmos ampv +/*42*/ CONTROL_VCAM, //!< Virtual Camera on off +/*43*/ CAM_VIEW_MODE, + +/*44*/ CONTROL_CFWSLOTSNUM, //!< check CFW slots number +/*45*/ IS_EXPOSING_DONE, +/*46*/ ScreenStretchB, +/*47*/ ScreenStretchW, +/*48*/ CONTROL_DDR, +/*49*/ CAM_LIGHT_PERFORMANCE_MODE, + +/*50*/ CAM_QHY5II_GUIDE_MODE, +/*51*/ DDR_BUFFER_CAPACITY, +/*52*/ DDR_BUFFER_READ_THRESHOLD, +/*53*/ DefaultGain, +/*54*/ DefaultOffset, +/*55*/ OutputDataActualBits, +/*56*/ OutputDataAlignment, + +/*57*/ CAM_SINGLEFRAMEMODE, +/*58*/ CAM_LIVEVIDEOMODE, + /*59*/ CAM_IS_COLOR, +/*60*/ hasHardwareFrameCounter, +/*61*/ CONTROL_MAX_ID, +/*62*/ CAM_HUMIDITY, //!