libapogee  3.0.3179
ApogeeCam.h
1 
14 #ifndef APOGEECAM_INCLUDE_H__
15 #define APOGEECAM_INCLUDE_H__
16 
17 #include <string>
18 #include <vector>
19 #include <stdint.h>
20 
21 
22 #ifdef WIN_OS
23 #include <memory>
24 #else
25 #include <tr1/memory>
26 #endif
27 
28 #include "CameraStatusRegs.h"
29 #include "CameraInfo.h"
30 #include "DefDllExport.h"
31 
32 
33 
34 class PlatformData;
35 class CApnCamData;
36 class CameraIo;
37 class ModeFsm;
38 class CcdAcqParams;
39 class ApgTimer;
40 
41 class DLL_EXPORT ApogeeCam
42 {
43  public:
44 
48  virtual ~ApogeeCam();
49 
58  void Reset();
59 
65  uint16_t ReadReg( uint16_t reg );
66 
72  void WriteReg( uint16_t reg, uint16_t value);
73 
80  void SetRoiNumRows( uint16_t rows );
81 
89  void SetRoiNumCols( uint16_t cols );
90 
95  uint16_t GetRoiNumRows();
96 
101  uint16_t GetRoiNumCols();
102 
108  void SetRoiStartRow( uint16_t row );
109 
115  void SetRoiStartCol( uint16_t col );
116 
121  uint16_t GetRoiStartRow();
122 
127  uint16_t GetRoiStartCol();
128 
136  void SetRoiBinRow( uint16_t bin );
137 
142  uint16_t GetRoiBinRow();
143 
151  void SetRoiBinCol( uint16_t bin );
152 
157  uint16_t GetRoiBinCol();
158 
163  uint16_t GetFirmwareRev();
164 
171  void SetImageCount( uint16_t count );
172 
177  uint16_t GetImageCount();
178 
185  uint16_t GetImgSequenceCount();
186 
194  void SetSequenceDelay( double delay );
195 
201  double GetSequenceDelay();
202 
211  void SetVariableSequenceDelay( bool variable );
212 
217  bool GetVariableSequenceDelay();
218 
226  void SetTdiRate( double TdiRate );
227 
232  double GetTdiRate();
233 
242  void SetTdiRows( uint16_t TdiRows );
243 
248  uint16_t GetTdiRows();
249 
256  uint16_t GetTdiCounter();
257 
267  void SetTdiBinningRows( uint16_t bin );
268 
273  uint16_t GetTdiBinningRows();
274 
283  void SetKineticsSectionHeight( uint16_t height );
284 
289  uint16_t GetKineticsSectionHeight();
290 
298  void SetKineticsSections( uint16_t sections );
299 
304  uint16_t GetKineticsSections();
305 
314  void SetKineticsShiftInterval( double interval );
315 
320  double GetKineticsShiftInterval();
321 
331  void SetShutterStrobePosition( double position );
332 
337  double GetShutterStrobePosition();
338 
347  void SetShutterStrobePeriod( double period );
348 
353  double GetShutterStrobePeriod();
354 
365  void SetShutterCloseDelay( double delay );
366 
371  double GetShutterCloseDelay();
372 
383  void SetCoolerBackoffPoint( double point );
384 
389  double GetCoolerBackoffPoint();
390 
401  void SetCoolerSetPoint( double point );
402 
407  double GetCoolerSetPoint();
408 
413  Apg::CameraMode GetCameraMode();
414 
421  void SetCameraMode( Apg::CameraMode mode );
422 
434  void SetFastSequence( bool TurnOn );
435 
440  bool IsFastSequenceOn();
441 
454  void SetBulkDownload( bool TurnOn );
455 
460  bool IsBulkDownloadOn();
461 
473  void SetPipelineDownload( bool TurnOn );
474 
479  bool IsPipelineDownloadOn();
480 
505  void SetIoPortAssignment( uint16_t assignment );
506 
511  uint16_t GetIoPortAssignment();
512 
517  void SetIoPortBlankingBits( uint16_t blankingBits );
518 
523  uint16_t GetIoPortBlankingBits();
524 
538  void SetIoPortDirection( uint16_t direction );
539 
544  uint16_t GetIoPortDirection();
545 
554  void SetIoPortData( uint16_t data );
555 
560  uint16_t GetIoPortData();
561 
569  void SetPreFlash( bool TurnOn ) { m_IsPreFlashOn = TurnOn; }
570 
575  bool GetPreFlash() { return m_IsPreFlashOn; }
576 
585  void SetExternalTrigger( bool TurnOn, Apg::TriggerMode trigMode,
586  Apg::TriggerType trigType );
587 
592  bool IsTriggerNormEachOn();
593 
598  bool IsTriggerNormGroupOn();
599 
604  bool IsTriggerTdiKinEachOn();
605 
610  bool IsTriggerTdiKinGroupOn();
611 
616  bool IsTriggerExternalShutterOn();
617 
622  bool IsTriggerExternalReadoutOn();
623 
629  void SetShutterState( Apg::ShutterState state );
630 
635  Apg::ShutterState GetShutterState();
636 
642  bool IsShutterForcedOpen();
643 
649  bool IsShutterForcedClosed();
650 
655  bool IsShutterOpen();
656 
663  void SetShutterAmpCtrl( bool TurnOn );
664 
670  bool IsShutterAmpCtrlOn();
671 
677  void SetCooler( bool TurnOn );
678 
683  Apg::CoolerStatus GetCoolerStatus();
684 
689  bool IsCoolerOn();
690 
695  double GetTempCcd();
696 
705  void SetCcdAdcResolution(Apg::Resolution res);
706 
711  Apg::Resolution GetCcdAdcResolution();
712 
721  void SetCcdAdcSpeed(Apg::AdcSpeed speed);
722 
727  Apg::AdcSpeed GetCcdAdcSpeed();
728 
733  uint16_t GetMaxBinCols();
734 
739  uint16_t GetMaxBinRows();
740 
746  uint16_t GetMaxImgCols();
747 
753  uint16_t GetMaxImgRows();
754 
760  uint16_t GetTotalRows();
761 
767  uint16_t GetTotalCols();
768 
775  uint16_t GetNumOverscanCols();
776 
781  bool IsInterline();
782 
787  CamModel::PlatformType GetPlatformType();
788 
794  void SetLedAState( Apg::LedState state );
795 
800  Apg::LedState GetLedAState();
801 
807  void SetLedBState( Apg::LedState state );
808 
813  Apg::LedState GetLedBState();
814 
820  void SetLedMode( Apg::LedMode mode );
821 
826  Apg::LedMode GetLedMode();
827 
833  std::string GetInfo();
834 
839  std::string GetModel();
840 
845  std::string GetSensor();
846 
859  void SetFlushCommands( bool Disable );
860 
865  bool AreFlushCmdsDisabled();
866 
878  void SetPostExposeFlushing( bool Disable );
879 
884  bool IsPostExposeFlushingDisabled();
885 
890  double GetPixelWidth();
891 
896  double GetPixelHeight();
897 
902  double GetMinExposureTime();
903 
908  double GetMaxExposureTime();
909 
914  bool IsColor();
915 
920  bool IsCoolingSupported();
921 
926  bool IsCoolingRegulated();
927 
932  double GetInputVoltage();
933 
938  CamModel::InterfaceType GetInterfaceType();
939 
947  void GetUsbVendorInfo( uint16_t & VendorId,
948  uint16_t & ProductId, uint16_t & DeviceId);
949 
954  bool IsCCD();
955 
964  void PauseTimer( bool TurnOn );
965 
971  bool IsSerialASupported();
972 
978  bool IsSerialBSupported();
979 
989  void SetFlushBinningRows( uint16_t bin );
990 
995  uint16_t GetFlushBinningRows();
996 
1001  bool IsOverscanDigitized();
1002 
1010  void SetDigitizeOverscan( const bool TurnOn );
1011 
1019  void SetAdcGain( uint16_t gain, int32_t ad, int32_t channel );
1020 
1027  uint16_t GetAdcGain( int32_t ad, int32_t channel );
1028 
1036  void SetAdcOffset( uint16_t offset, int32_t ad, int32_t channel );
1037 
1044  uint16_t GetAdcOffset( int32_t ad, int32_t channel );
1045 
1049  bool IsInitialized() { return m_IsInitialized; }
1050 
1054  bool IsConnected() { return m_IsConnected; }
1055 
1062  void SetAdSimMode( bool TurnOn );
1063 
1068  bool IsAdSimModeOn();
1069 
1077  void SetLedBrightness( double PercentIntensity );
1078 
1085  double GetLedBrightness();
1086 
1091  std::string GetDriverVersion();
1092 
1097  std::string GetUsbFirmwareVersion();
1098 
1103  std::string GetSerialNumber();
1104 
1105  // ****** PURE VIRTUAL INTERFACE ********
1106 
1118  virtual void OpenConnection( const std::string & ioType,
1119  const std::string & DeviceAddr,
1120  const uint16_t FirmwareRev,
1121  const uint16_t Id ) = 0;
1122 
1130  virtual void CloseConnection() = 0;
1131 
1137  virtual void Init() = 0;
1138 
1149  virtual void StartExposure( double Duration, bool IsLight ) = 0;
1150 
1155  virtual CameraStatusRegs GetStatus() = 0;
1156 
1161  virtual Apg::Status GetImagingStatus() = 0;
1162 
1168  virtual void GetImage( std::vector<uint16_t> & out ) = 0;
1169 
1179  virtual void StopExposure( bool Digitize ) = 0;
1180 
1185  virtual uint32_t GetAvailableMemory() = 0;
1186 
1191  virtual int32_t GetNumAds() = 0;
1192 
1197  virtual int32_t GetNumAdChannels() = 0;
1198 
1204  virtual double GetCoolerDrive() = 0;
1205 
1216  virtual void SetFanMode( Apg::FanMode mode, bool PreCondCheck = true ) = 0;
1217 
1222  virtual Apg::FanMode GetFanMode() = 0;
1223 
1230  virtual double GetTempHeatsink() = 0;
1231 
1232  protected:
1233  ApogeeCam(CamModel::PlatformType platform) ;
1234 
1235  void VerifyFrmwrRev();
1236  void LogConnectAndDisconnect( bool Connect );
1237 
1238  void ExectuePreFlash();
1239  void SetExpsoureTime( double Duration );
1240  void IssueExposeCmd( bool IsLight );
1241 
1242  void IsThereAStatusError( uint16_t statusReg );
1243 
1244  bool IsImgDone( const CameraStatusRegs & statusObj);
1245  Apg::Status LogAndReturnStatus( Apg::Status status,
1246  const CameraStatusRegs & statusObj);
1247 
1248  void SupsendCooler( bool & resume );
1249  void ResumeCooler();
1250  void WaitForCoolerSuspendBit( const uint16_t mask, const bool IsHigh );
1251 
1252  void InitShutterCloseDelay();
1253 
1254  void StopExposureModeNorm( bool Digitize );
1255  void Reset(bool Flush);
1256 
1257  void HardStopExposure( const std::string & msg );
1258  void GrabImageAndThrowItAway();
1259 
1260  void AdcParamCheck( const int32_t ad,
1261  const int32_t channel, const std::string & fxName );
1262 
1263  void SetNumAdOutputs( const uint16_t num );
1264 
1265  bool CheckAndWaitForStatus( Apg::Status desired, Apg::Status & acutal );
1266  void CancelExposureNoThrow();
1267  double DefaultGetTempHeatsink();
1268 
1269  void DefaultInit();
1270  void ClearAllRegisters();
1271  void DefaultCfgCamFromId( uint16_t CameraId );
1272  void DefaultSetFanMode( Apg::FanMode mode, bool PreCondCheck );
1273  Apg::FanMode DefaultGetFanMode();
1274  void DefaultCloseConnection();
1275 
1276  // ****** PURE VIRTUAL INTERFACE ********
1277  virtual void CfgCamFromId( uint16_t CameraId ) = 0;
1278  virtual void ExposureAndGetImgRC(uint16_t & r, uint16_t & c) = 0;
1279  virtual uint16_t ExposureZ() = 0;
1280  virtual uint16_t GetImageZ() = 0;
1281  virtual uint16_t GetIlluminationMask() = 0;
1282  virtual void FixImgFromCamera( const std::vector<uint16_t> & data,
1283  std::vector<uint16_t> & out, int32_t rows, int32_t cols) = 0;
1284 
1285 //this code removes vc++ compiler warning C4251
1286 //from http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
1287 #ifdef WIN_OS
1288  template class DLL_EXPORT std::tr1::shared_ptr<CameraIo>;
1289  template class DLL_EXPORT std::tr1::shared_ptr<PlatformData>;
1290  template class DLL_EXPORT std::tr1::shared_ptr<CApnCamData>;
1291  template class DLL_EXPORT std::tr1::shared_ptr<ModeFsm>;
1292  template class DLL_EXPORT std::tr1::shared_ptr<CcdAcqParams>;
1293  template class DLL_EXPORT std::tr1::shared_ptr<ApgTimer>;
1294 #endif
1295 
1296  std::tr1::shared_ptr<CameraIo> m_CamIo;
1297  std::tr1::shared_ptr<PlatformData> m_CameraConsts;
1298  std::tr1::shared_ptr<CApnCamData> m_CamCfgData;
1299  std::tr1::shared_ptr<ModeFsm> m_CamMode;
1300  std::tr1::shared_ptr<CcdAcqParams> m_CcdAcqSettings;
1301  std::tr1::shared_ptr<ApgTimer> m_ExposureTimer;
1302 
1303  CamModel::PlatformType m_PlatformType;
1304  const std::string m_fileName;
1305  uint16_t m_FirmwareVersion;
1306  uint16_t m_Id;
1307  uint16_t m_NumImgsDownloaded;
1308  bool m_ImageInProgress;
1309  bool m_IsPreFlashOn;
1310  bool m_IsInitialized;
1311  bool m_IsConnected;
1312  double m_LastExposureTime;
1313 
1314  private:
1315 
1316  //disabling the copy ctor and assignment operator
1317  //generated by the compiler - don't want them
1318  //Effective C++ Item 6
1319  ApogeeCam(const ApogeeCam&);
1320  ApogeeCam& operator=(ApogeeCam&);
1321 };
1322 
1323 #endif
Base class for apogee cameras.
Definition: ApogeeCam.h:41
void SetPreFlash(bool TurnOn)
Definition: ApogeeCam.h:569
FanMode
Definition: CameraInfo.h:264
bool IsConnected()
Definition: ApogeeCam.h:1054
ShutterState
Definition: CameraInfo.h:340
bool GetPreFlash()
Definition: ApogeeCam.h:575
bool IsInitialized()
Definition: ApogeeCam.h:1049
Class that wrapps the basic and advanced status structs.
Definition: CameraStatusRegs.h:20
CameraMode
Definition: CameraInfo.h:188
Status
Definition: CameraInfo.h:155