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
00305
00313 double setExposureTime(double t=-1, bool inseconds=false);
00314
00321 double setExposurePeriod(double t=-1, bool inseconds=false);
00322
00329 double setDelayAfterTrigger(double t=-1, bool inseconds=false);
00330
00336 int64_t setNumberOfGates(int64_t t=-1);
00337
00343 int64_t setNumberOfFrames(int64_t t=-1);
00344
00350 int64_t setNumberOfCycles(int64_t t=-1);
00351
00352
00358 int setTimingMode(int pol=-1);
00359
00365 int readConfigurationFile(string const fname);
00366
00367
00374 int dumpDetectorSetup(string const fname);
00381 int retrieveDetectorSetup(string const fname);
00382
00387 string getDetectorType();
00388
00394 int setReceiverMode(int n=-1);
00395
00401 void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
00402
00408 void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
00409
00415 virtual void initDataset(int refresh);
00416
00417
00428 virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var);
00429
00438 virtual void finalizeDataset(double *a, double *v, double *e, int &np);
00439
00440
00446 int enableDataStreamingFromReceiver(int i=-1);
00447
00448
00453 int64_t getModuleFirmwareVersion();
00454
00460 int64_t getModuleSerialNumber(int imod=-1);
00461
00466 int64_t getDetectorFirmwareVersion();
00467
00472 int64_t getDetectorSerialNumber();
00473
00478 int64_t getDetectorSoftwareVersion();
00479
00484 int64_t getThisSoftwareVersion();
00485
00491 void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
00492
00498 void registerGetPositionCallback( double (*func)(void*),void *arg);
00503 void registerConnectChannelsCallback( int (*func)(void*),void *arg);
00508 void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
00513 void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
00518 void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
00523 void registerGetI0Callback( double (*func)(int,void*),void *arg);
00524
00532 string putCommand(int narg, char *args[], int pos=-1);
00533
00541 string getCommand(int narg, char *args[], int pos=-1);
00542
00543
00544
00545
00546
00547
00548
00553 static string runStatusType(int s){ \
00554 switch (s) { \
00555 case 0: return string("idle"); \
00556 case 1: return string("error"); \
00557 case 2: return string("waiting"); \
00558 case 3: return string("finished"); \
00559 case 4: return string("data"); \
00560 case 5: return string("running"); \
00561 default: return string("unknown"); \
00562 }};
00563
00564
00565
00571 static int getDetectorSettings(string s){ \
00572 if (s=="standard") return 0; \
00573 if (s=="fast") return 1; \
00574 if (s=="highgain") return 2; \
00575 if (s=="dynamicgain") return 3; \
00576 if (s=="lowgain") return 4; \
00577 if (s=="mediumgain") return 5; \
00578 if (s=="veryhighgain") return 6; \
00579 return -1; };
00580
00585 static string getDetectorSettings(int s){\
00586 switch(s) { \
00587 case 0: return string("standard");\
00588 case 1: return string("fast");\
00589 case 2: return string("highgain");\
00590 case 3: return string("dynamicgain"); \
00591 case 4: return string("lowgain"); \
00592 case 5: return string("mediumgain"); \
00593 case 6: return string("veryhighgain"); \
00594 default: return string("undefined"); \
00595 }};
00596
00597
00598
00605 static string getTimingMode(int f){ \
00606 switch(f) { \
00607 case 0: return string( "auto"); \
00608 case 1: return string("trigger"); \
00609 case 2: return string("ro_trigger"); \
00610 case 3: return string("gating"); \
00611 case 4: return string("triggered_gating"); \
00612 default: return string( "unknown"); \
00613 } };
00614
00621 static int getTimingMode(string s){ \
00622 if (s== "auto") return 0; \
00623 if (s== "trigger") return 1; \
00624 if (s== "ro_trigger") return 2; \
00625 if (s== "gating") return 3; \
00626 if (s== "triggered_gating") return 4; \
00627 return -1; };
00628
00629 private:
00630 multiSlsDetector *myDetector;
00631 multiSlsDetectorCommand *myCmd;
00632 };
00633
00634 #endif