00001 #ifndef SLS_DETECTOR_USERS_H
00002 #define SLS_DETECTOR_USERS_H
00003
00004
00005
00016 class detectorData;
00017 class multiSlsDetector;
00018 class multiSlsDetectorCommand;
00019
00020
00021 #include <stdint.h>
00022 #include <string>
00023
00024
00025 using namespace std;
00026
00027
00028
00029
00030
00031
00032
00033
00084 class slsDetectorUsers
00085 {
00086
00087 public:
00088
00090 slsDetectorUsers(int id=0);
00091
00092
00094 virtual ~slsDetectorUsers();
00095
00096
00097
00102 string getDetectorDeveloper();
00103
00104
00105
00110 int setOnline(int const online=-1);
00111
00116 void startMeasurement();
00117
00122 int stopMeasurement();
00123
00128 int getDetectorStatus();
00129
00133 string getFilePath();
00134
00140 string setFilePath(string s);
00141
00146 string getFileName();
00147
00154 string setFileName(string s);
00155
00160 int getFileIndex();
00161
00167 int setFileIndex(int i);
00168
00173 string getFlatFieldCorrectionDir();
00174
00180 string setFlatFieldCorrectionDir(string dir);
00181
00186 string getFlatFieldCorrectionFile();
00187
00193 int setFlatFieldCorrectionFile(string fname="");
00194
00195
00196
00202 int enableFlatFieldCorrection(int i=-1);
00203
00209 int enableCountRateCorrection(int i=-1);
00210
00216 int enablePixelMaskCorrection(int i=-1);
00217
00223 int enableAngularConversion(int i=-1);
00224
00227 int enableWriteToFile(int i=-1);
00228
00235 int setPositions(int nPos, double *pos);
00236
00242 int getPositions(double *pos=NULL);
00243
00252 int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
00253
00254
00263 int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
00272 int getMaximumDetectorSize(int &nx, int &ny);
00273
00274
00280 int setBitDepth(int i=-1);
00281
00282
00283
00289 int setSettings(int isettings=-1);
00290
00295 int getThresholdEnergy();
00296
00297
00303 int setThresholdEnergy(int e_eV);
00304
00309 int getBeamEnergy();
00310
00311
00317 int setBeamEnergy(int e_eV);
00318
00326 double setExposureTime(double t=-1, bool inseconds=false);
00327
00334 double setExposurePeriod(double t=-1, bool inseconds=false);
00335
00342 double setDelayAfterTrigger(double t=-1, bool inseconds=false);
00343
00349 int64_t setNumberOfGates(int64_t t=-1);
00350
00356 int64_t setNumberOfFrames(int64_t t=-1);
00357
00363 int64_t setNumberOfCycles(int64_t t=-1);
00364
00365
00371 int setTimingMode(int pol=-1);
00372
00378 int readConfigurationFile(string const fname);
00379
00380
00387 int dumpDetectorSetup(string const fname);
00394 int retrieveDetectorSetup(string const fname);
00395
00400 string getDetectorType();
00401
00407 int setReceiverMode(int n=-1);
00408
00414 void registerDataCallback(int( *userCallback)(detectorData* d, int f, void*), void *pArg);
00415
00421 void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
00422
00428 virtual void initDataset(int refresh);
00429
00430
00441 virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var);
00442
00451 virtual void finalizeDataset(double *a, double *v, double *e, int &np);
00452
00457 int64_t getModuleFirmwareVersion();
00458
00464 int64_t getModuleSerialNumber(int imod=-1);
00465
00470 int64_t getDetectorFirmwareVersion();
00471
00476 int64_t getDetectorSerialNumber();
00477
00482 int64_t getDetectorSoftwareVersion();
00483
00488 int64_t getThisSoftwareVersion();
00489
00495 void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
00496
00502 void registerGetPositionCallback( double (*func)(void*),void *arg);
00507 void registerConnectChannelsCallback( int (*func)(void*),void *arg);
00512 void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
00517 void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
00522 void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
00527 void registerGetI0Callback( double (*func)(int,void*),void *arg);
00528
00536 string putCommand(int narg, char *args[], int pos=-1);
00537
00545 string getCommand(int narg, char *args[], int pos=-1);
00546
00547
00548
00549
00550
00551
00552
00557 static string runStatusType(int s){ \
00558 switch (s) { \
00559 case 0: return string("idle"); \
00560 case 1: return string("error"); \
00561 case 2: return string("waiting"); \
00562 case 3: return string("finished"); \
00563 case 4: return string("data"); \
00564 case 5: return string("running"); \
00565 default: return string("unknown"); \
00566 }};
00567
00568
00569
00575 static int getDetectorSettings(string s){ \
00576 if (s=="standard") return 0; \
00577 if (s=="fast") return 1; \
00578 if (s=="highgain") return 2; \
00579 if (s=="dynamicgain") return 3; \
00580 if (s=="lowgain") return 4; \
00581 if (s=="mediumgain") return 5; \
00582 if (s=="veryhighgain") return 6; \
00583 return -1; };
00584
00589 static string getDetectorSettings(int s){\
00590 switch(s) { \
00591 case 0: return string("standard");\
00592 case 1: return string("fast");\
00593 case 2: return string("highgain");\
00594 case 3: return string("dynamicgain"); \
00595 case 4: return string("lowgain"); \
00596 case 5: return string("mediumgain"); \
00597 case 6: return string("veryhighgain"); \
00598 default: return string("undefined"); \
00599 }};
00600
00601
00602
00609 static string getTimingMode(int f){ \
00610 switch(f) { \
00611 case 0: return string( "auto"); \
00612 case 1: return string("trigger"); \
00613 case 2: return string("ro_trigger"); \
00614 case 3: return string("gating"); \
00615 case 4: return string("triggered_gating"); \
00616 default: return string( "unknown"); \
00617 } };
00618
00625 static int getTimingMode(string s){ \
00626 if (s== "auto") return 0; \
00627 if (s== "trigger") return 1; \
00628 if (s== "ro_trigger") return 2; \
00629 if (s== "gating") return 3; \
00630 if (s== "triggered_gating") return 4; \
00631 return -1; };
00632
00633 private:
00634 multiSlsDetector *myDetector;
00635 multiSlsDetectorCommand *myCmd;
00636 };
00637
00638 #endif