libapogee
3.0.3079
|
00001 00014 #ifndef APOGEECAM_INCLUDE_H__ 00015 #define APOGEECAM_INCLUDE_H__ 00016 00017 #include <string> 00018 #include <vector> 00019 #include <stdint.h> 00020 00021 00022 #ifdef WIN_OS 00023 #include <memory> 00024 #else 00025 #include <tr1/memory> 00026 #endif 00027 00028 #include "CameraStatusRegs.h" 00029 #include "CameraInfo.h" 00030 #include "DefDllExport.h" 00031 00032 00033 00034 class PlatformData; 00035 class CApnCamData; 00036 class CameraIo; 00037 class ModeFsm; 00038 class CcdAcqParams; 00039 00040 class DLL_EXPORT ApogeeCam 00041 { 00042 public: 00043 00047 virtual ~ApogeeCam(); 00048 00057 void Reset(); 00058 00064 uint16_t ReadReg( uint16_t reg ); 00065 00071 void WriteReg( uint16_t reg, uint16_t value); 00072 00079 void SetRoiNumRows( uint16_t rows ); 00080 00088 void SetRoiNumCols( uint16_t cols ); 00089 00094 uint16_t GetRoiNumRows(); 00095 00100 uint16_t GetRoiNumCols(); 00101 00107 void SetRoiStartRow( uint16_t row ); 00108 00114 void SetRoiStartCol( uint16_t col ); 00115 00120 uint16_t GetRoiStartRow(); 00121 00126 uint16_t GetRoiStartCol(); 00127 00135 void SetRoiBinRow( uint16_t bin ); 00136 00141 uint16_t GetRoiBinRow(); 00142 00150 void SetRoiBinCol( uint16_t bin ); 00151 00156 uint16_t GetRoiBinCol(); 00157 00162 uint16_t GetFirmwareRev(); 00163 00170 void SetImageCount( uint16_t count ); 00171 00176 uint16_t GetImageCount(); 00177 00184 uint16_t GetImgSequenceCount(); 00185 00193 void SetSequenceDelay( double delay ); 00194 00200 double GetSequenceDelay(); 00201 00210 void SetVariableSequenceDelay( bool variable ); 00211 00216 bool GetVariableSequenceDelay(); 00217 00225 void SetTdiRate( double TdiRate ); 00226 00231 double GetTdiRate(); 00232 00241 void SetTdiRows( uint16_t TdiRows ); 00242 00247 uint16_t GetTdiRows(); 00248 00255 uint16_t GetTdiCounter(); 00256 00266 void SetTdiBinningRows( uint16_t bin ); 00267 00272 uint16_t GetTdiBinningRows(); 00273 00282 void SetKineticsSectionHeight( uint16_t height ); 00283 00288 uint16_t GetKineticsSectionHeight(); 00289 00297 void SetKineticsSections( uint16_t sections ); 00298 00303 uint16_t GetKineticsSections(); 00304 00313 void SetKineticsShiftInterval( double interval ); 00314 00319 double GetKineticsShiftInterval(); 00320 00330 void SetShutterStrobePosition( double position ); 00331 00336 double GetShutterStrobePosition(); 00337 00346 void SetShutterStrobePeriod( double period ); 00347 00352 double GetShutterStrobePeriod(); 00353 00364 void SetShutterCloseDelay( double delay ); 00365 00370 double GetShutterCloseDelay(); 00371 00382 void SetCoolerBackoffPoint( double point ); 00383 00388 double GetCoolerBackoffPoint(); 00389 00400 void SetCoolerSetPoint( double point ); 00401 00406 double GetCoolerSetPoint(); 00407 00412 Apg::CameraMode GetCameraMode(); 00413 00420 void SetCameraMode( Apg::CameraMode mode ); 00421 00433 void SetFastSequence( bool TurnOn ); 00434 00439 bool IsFastSequenceOn(); 00440 00453 void SetBulkDownload( bool TurnOn ); 00454 00459 bool IsBulkDownloadOn(); 00460 00472 void SetPipelineDownload( bool TurnOn ); 00473 00478 bool IsPipelineDownloadOn(); 00479 00504 void SetIoPortAssignment( uint16_t assignment ); 00505 00510 uint16_t GetIoPortAssignment(); 00511 00516 void SetIoPortBlankingBits( uint16_t blankingBits ); 00517 00522 uint16_t GetIoPortBlankingBits(); 00523 00537 void SetIoPortDirection( uint16_t direction ); 00538 00543 uint16_t GetIoPortDirection(); 00544 00553 void SetIoPortData( uint16_t data ); 00554 00559 uint16_t GetIoPortData(); 00560 00568 void SetPreFlash( bool TurnOn ) { m_IsPreFlashOn = TurnOn; } 00569 00574 bool GetPreFlash() { return m_IsPreFlashOn; } 00575 00584 void SetExternalTrigger( bool TurnOn, Apg::TriggerMode trigMode, 00585 Apg::TriggerType trigType ); 00586 00591 bool IsTriggerNormEachOn(); 00592 00597 bool IsTriggerNormGroupOn(); 00598 00603 bool IsTriggerTdiKinEachOn(); 00604 00609 bool IsTriggerTdiKinGroupOn(); 00610 00615 bool IsTriggerExternalShutterOn(); 00616 00621 bool IsTriggerExternalReadoutOn(); 00622 00628 void SetShutterState( Apg::ShutterState state ); 00629 00634 Apg::ShutterState GetShutterState(); 00635 00641 bool IsShutterForcedOpen(); 00642 00648 bool IsShutterForcedClosed(); 00649 00654 bool IsShutterOpen(); 00655 00662 void SetShutterAmpCtrl( bool TurnOn ); 00663 00669 bool IsShutterAmpCtrlOn(); 00670 00676 void SetCooler( bool TurnOn ); 00677 00682 Apg::CoolerStatus GetCoolerStatus(); 00683 00688 bool IsCoolerOn(); 00689 00694 double GetTempCcd(); 00695 00704 void SetCcdAdcResolution(Apg::Resolution res); 00705 00710 Apg::Resolution GetCcdAdcResolution(); 00711 00720 void SetCcdAdcSpeed(Apg::AdcSpeed speed); 00721 00726 Apg::AdcSpeed GetCcdAdcSpeed(); 00727 00732 uint16_t GetMaxBinCols(); 00733 00738 uint16_t GetMaxBinRows(); 00739 00745 uint16_t GetMaxImgCols(); 00746 00752 uint16_t GetMaxImgRows(); 00753 00759 uint16_t GetTotalRows(); 00760 00766 uint16_t GetTotalCols(); 00767 00774 uint16_t GetNumOverscanCols(); 00775 00780 bool IsInterline(); 00781 00786 CamModel::PlatformType GetPlatformType(); 00787 00793 void SetLedAState( Apg::LedState state ); 00794 00799 Apg::LedState GetLedAState(); 00800 00806 void SetLedBState( Apg::LedState state ); 00807 00812 Apg::LedState GetLedBState(); 00813 00819 void SetLedMode( Apg::LedMode mode ); 00820 00825 Apg::LedMode GetLedMode(); 00826 00832 std::string GetInfo(); 00833 00838 std::string GetModel(); 00839 00844 std::string GetSensor(); 00845 00858 void SetFlushCommands( bool Disable ); 00859 00864 bool AreFlushCmdsDisabled(); 00865 00877 void SetPostExposeFlushing( bool Disable ); 00878 00883 bool IsPostExposeFlushingDisabled(); 00884 00889 double GetPixelWidth(); 00890 00895 double GetPixelHeight(); 00896 00901 double GetMinExposureTime(); 00902 00907 double GetMaxExposureTime(); 00908 00913 bool IsColor(); 00914 00919 bool IsCoolingSupported(); 00920 00925 bool IsCoolingRegulated(); 00926 00931 double GetInputVoltage(); 00932 00937 CamModel::InterfaceType GetInterfaceType(); 00938 00946 void GetUsbVendorInfo( uint16_t & VendorId, 00947 uint16_t & ProductId, uint16_t & DeviceId); 00948 00953 bool IsCCD(); 00954 00963 void PauseTimer( bool TurnOn ); 00964 00970 bool IsSerialASupported(); 00971 00977 bool IsSerialBSupported(); 00978 00988 void SetFlushBinningRows( uint16_t bin ); 00989 00994 uint16_t GetFlushBinningRows(); 00995 01000 bool IsOverscanDigitized(); 01001 01009 void SetDigitizeOverscan( const bool TurnOn ); 01010 01018 void SetAdcGain( uint16_t gain, int32_t ad, int32_t channel ); 01019 01026 uint16_t GetAdcGain( int32_t ad, int32_t channel ); 01027 01035 void SetAdcOffset( uint16_t offset, int32_t ad, int32_t channel ); 01036 01043 uint16_t GetAdcOffset( int32_t ad, int32_t channel ); 01044 01048 bool IsInitialized() { return m_IsInitialized; } 01049 01053 bool IsConnected() { return m_IsConnected; } 01054 01061 void SetAdSimMode( bool TurnOn ); 01062 01067 bool IsAdSimModeOn(); 01068 01076 void SetLedBrightness( double PercentIntensity ); 01077 01084 double GetLedBrightness(); 01085 01090 std::string GetDriverVersion(); 01091 01096 std::string GetUsbFirmwareVersion(); 01097 01102 std::string GetSerialNumber(); 01103 01104 // ****** PURE VIRTUAL INTERFACE ******** 01105 01117 virtual void OpenConnection( const std::string & ioType, 01118 const std::string & DeviceAddr, 01119 const uint16_t FirmwareRev, 01120 const uint16_t Id ) = 0; 01121 01129 virtual void CloseConnection() = 0; 01130 01136 virtual void Init() = 0; 01137 01148 virtual void StartExposure( double Duration, bool IsLight ) = 0; 01149 01154 virtual CameraStatusRegs GetStatus() = 0; 01155 01160 virtual Apg::Status GetImagingStatus() = 0; 01161 01167 virtual void GetImage( std::vector<uint16_t> & out ) = 0; 01168 01178 virtual void StopExposure( bool Digitize ) = 0; 01179 01184 virtual uint32_t GetAvailableMemory() = 0; 01185 01190 virtual int32_t GetNumAds() = 0; 01191 01196 virtual int32_t GetNumAdChannels() = 0; 01197 01203 virtual double GetCoolerDrive() = 0; 01204 01215 virtual void SetFanMode( Apg::FanMode mode, bool PreCondCheck = true ) = 0; 01216 01221 virtual Apg::FanMode GetFanMode() = 0; 01222 01229 virtual double GetTempHeatsink() = 0; 01230 01231 protected: 01232 ApogeeCam(CamModel::PlatformType platform) ; 01233 01234 void VerifyFrmwrRev(); 01235 void LogConnectAndDisconnect( bool Connect ); 01236 01237 void ExectuePreFlash(); 01238 void SetExpsoureTime( double Duration ); 01239 void IssueExposeCmd( bool IsLight ); 01240 01241 void IsThereAStatusError( uint16_t statusReg ); 01242 01243 bool IsImgDone( const CameraStatusRegs & statusObj); 01244 Apg::Status LogAndReturnStatus( Apg::Status status, 01245 const CameraStatusRegs & statusObj); 01246 01247 void SupsendCooler( bool & resume ); 01248 void ResumeCooler(); 01249 void WaitForCoolerSuspendBit( const uint16_t mask, const bool IsHigh ); 01250 01251 void InitShutterCloseDelay(); 01252 01253 void StopExposureModeNorm( bool Digitize ); 01254 void Reset(bool Flush); 01255 01256 void HardStopExposure( const std::string & msg ); 01257 void GrabImageAndThrowItAway(); 01258 01259 void AdcParamCheck( const int32_t ad, 01260 const int32_t channel, const std::string & fxName ); 01261 01262 void SetNumAdOutputs( const uint16_t num ); 01263 01264 bool CheckAndWaitForStatus( Apg::Status desired, Apg::Status & acutal ); 01265 void CancelExposureNoThrow(); 01266 double DefaultGetTempHeatsink(); 01267 01268 void DefaultInit(); 01269 void ClearAllRegisters(); 01270 void DefaultCfgCamFromId( uint16_t CameraId ); 01271 void DefaultSetFanMode( Apg::FanMode mode, bool PreCondCheck ); 01272 Apg::FanMode DefaultGetFanMode(); 01273 void DefaultCloseConnection(); 01274 01275 // ****** PURE VIRTUAL INTERFACE ******** 01276 virtual void CfgCamFromId( uint16_t CameraId ) = 0; 01277 virtual void ExposureAndGetImgRC(uint16_t & r, uint16_t & c) = 0; 01278 virtual uint16_t ExposureZ() = 0; 01279 virtual uint16_t GetImageZ() = 0; 01280 virtual uint16_t GetIlluminationMask() = 0; 01281 virtual void FixImgFromCamera( const std::vector<uint16_t> & data, 01282 std::vector<uint16_t> & out, int32_t rows, int32_t cols) = 0; 01283 01284 //this code removes vc++ compiler warning C4251 01285 //from http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html 01286 #ifdef WIN_OS 01287 template class DLL_EXPORT std::tr1::shared_ptr<CameraIo>; 01288 template class DLL_EXPORT std::tr1::shared_ptr<PlatformData>; 01289 template class DLL_EXPORT std::tr1::shared_ptr<CApnCamData>; 01290 template class DLL_EXPORT std::tr1::shared_ptr<ModeFsm>; 01291 template class DLL_EXPORT std::tr1::shared_ptr<CcdAcqParams>; 01292 #endif 01293 01294 std::tr1::shared_ptr<CameraIo> m_CamIo; 01295 std::tr1::shared_ptr<PlatformData> m_CameraConsts; 01296 std::tr1::shared_ptr<CApnCamData> m_CamCfgData; 01297 std::tr1::shared_ptr<ModeFsm> m_CamMode; 01298 std::tr1::shared_ptr<CcdAcqParams> m_CcdAcqSettings; 01299 01300 01301 01302 CamModel::PlatformType m_PlatformType; 01303 const std::string m_fileName; 01304 uint16_t m_FirmwareVersion; 01305 uint16_t m_Id; 01306 uint16_t m_NumImgsDownloaded; 01307 bool m_ImageInProgress; 01308 bool m_IsPreFlashOn; 01309 bool m_IsInitialized; 01310 bool m_IsConnected; 01311 01312 private: 01313 01314 //disabling the copy ctor and assignment operator 01315 //generated by the compiler - don't want them 01316 //Effective C++ Item 6 01317 ApogeeCam(const ApogeeCam&); 01318 ApogeeCam& operator=(ApogeeCam&); 01319 }; 01320 01321 #endif