- Main Page
- Classes
- Files

- File List
- File Members

# slsDetectorUsers.h

Go to the documentation of this file.

    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    \mainpage
    00031 <CENTER><H1>API for SLS detectors data acquisition</H1></CENTER>
    00032 <HR>
    00033 */
    00085 class slsDetectorUsers
    00086  {
    00087
    00088  public:
    00089
    00091    slsDetectorUsers(int id=0);
    00092
    00093
    00095    virtual ~slsDetectorUsers();
    00096
    00097
    00098
    00103    string getDetectorDeveloper();
    00104
    00105
    00106
    00111   int setOnline(int const online=-1);
    00112
    00117   int setReceiverOnline(int const online=-1);
    00118
    00119
    00124   void startMeasurement();
    00125
    00130    int stopMeasurement();
    00131
    00136    int getDetectorStatus();
    00137
    00141    string getFilePath();
    00142
    00148    string setFilePath(string s);
    00149
    00154    string getFileName();
    00155
    00162    string setFileName(string s);
    00163
    00168    int getFileIndex();
    00169
    00175    int setFileIndex(int i);
    00176
    00181    string getFlatFieldCorrectionDir();
    00182
    00188    string setFlatFieldCorrectionDir(string dir);
    00189
    00194    string getFlatFieldCorrectionFile();
    00195
    00201    int setFlatFieldCorrectionFile(string fname="");
    00202
    00203
    00204
    00210    int enableFlatFieldCorrection(int i=-1);
    00211
    00217    int enableCountRateCorrection(int i=-1);
    00218
    00224    int enablePixelMaskCorrection(int i=-1);
    00225
    00231    int enableAngularConversion(int i=-1);
    00232
    00235    int enableWriteToFile(int i=-1);
    00236
    00243    int setPositions(int nPos, double *pos);
    00244
    00250    int getPositions(double *pos=NULL);
    00251
    00260    int setDetectorSize(int x0=-1, int y0=-1, int nx=-1, int ny=-1);
    00261
    00262
    00271    int getDetectorSize(int &x0, int &y0, int &nx, int &ny);
    00280    int getMaximumDetectorSize(int &nx, int &ny);
    00281
    00282
    00288    int setBitDepth(int i=-1);
    00289
    00290
    00291
    00297    int setSettings(int isettings=-1);
    00298
    00303    int getThresholdEnergy();
    00304
    00305
    00311    int setThresholdEnergy(int e_eV);
    00312
    00313
    00321    double setExposureTime(double t=-1, bool inseconds=false);
    00322
    00329    double setExposurePeriod(double t=-1, bool inseconds=false);
    00330
    00337    double setDelayAfterTrigger(double t=-1, bool inseconds=false);
    00338
    00344    int64_t setNumberOfGates(int64_t t=-1);
    00345
    00351    int64_t setNumberOfFrames(int64_t t=-1);
    00352
    00358    int64_t setNumberOfCycles(int64_t t=-1);
    00359
    00360
    00366    int setTimingMode(int pol=-1);
    00367
    00373    int readConfigurationFile(string const fname);
    00374
    00375
    00382    int dumpDetectorSetup(string const fname);
    00389    int retrieveDetectorSetup(string const fname);
    00390
    00395    string getDetectorType();
    00396
    00402    int setReceiverMode(int n=-1);
    00403
    00409    void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
    00410
    00416    void registerRawDataCallback(int( *userCallback)(double* p, int n, void*), void *pArg);
    00417
    00423   virtual void initDataset(int refresh);
    00424
    00425
    00436   virtual void addFrame(double *data, double pos, double i0, double t, string fname, double var);
    00437
    00446   virtual void finalizeDataset(double *a, double *v, double *e, int &np);
    00447
    00448
    00453    int enableDataStreamingFromReceiver(int i=-1);
    00454
    00460    int enableDataStreamingToClient(int i=-1);
    00461
    00468    int setReceiverDataStreamingOutPort(int i=-1);
    00469
    00476    int setClientDataStreamingInPort(int i=-1);
    00477
    00482   int64_t getModuleFirmwareVersion();
    00483
    00489   int64_t getModuleSerialNumber(int imod=-1);
    00490
    00495   int64_t getDetectorFirmwareVersion();
    00496
    00501   int64_t getDetectorSerialNumber();
    00502
    00507   int64_t getDetectorSoftwareVersion();
    00508
    00513   int64_t getThisSoftwareVersion();
    00514
    00520    void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
    00521
    00527    void registerGetPositionCallback( double (*func)(void*),void *arg);
    00532    void registerConnectChannelsCallback( int (*func)(void*),void *arg);
    00537    void registerDisconnectChannelsCallback( int (*func)(void*),void *arg);
    00542    void registerGoToPositionCallback( int (*func)(double,void*),void *arg);
    00547    void registerGoToPositionNoWaitCallback( int (*func)(double,void*),void *arg);
    00552    void registerGetI0Callback( double (*func)(int,void*),void *arg);
    00553
    00561    string putCommand(int narg, char *args[], int pos=-1);
    00562
    00570    string getCommand(int narg, char *args[], int pos=-1);
    00571
    00572    /************************************************************************
    00573
    00574                             ADVANCED FUNCTIONS
    00575
    00576    *********************************************************************/
    00582    int setClockDivider(int value);
    00583
    00589    int setParallelMode(int value);
    00590
    00597    int setAllTrimbits(int val, int id = -1);
    00598
    00606    int setDAC(string dac, int val, int id = -1);
    00607
    00614    int getADC(string adc, int id = -1);
    00615
    00620    int startReceiver();
    00621
    00626    int stopReceiver();
    00627
    00634    int startAcquisition();
    00635
    00640    int stopAcquisition();
    00641
    00647    int setReceiverSilentMode(int i);
    00648
    00654    int setHighVoltage(int i);
    00655
    00656   /************************************************************************
    00657
    00658                            STATIC FUNCTIONS
    00659
    00660   *********************************************************************/
    00661
    00666   static string runStatusType(int s){                                   \
    00667     switch (s) {                                                        \
    00668     case 0:     return string("idle");                                  \
    00669     case 1:       return string("error");                               \
    00670     case 2:      return  string("waiting");                             \
    00671     case 3:      return string("finished");                             \
    00672     case 4:      return string("data");                                 \
    00673     case 5:      return string("running");                              \
    00674     default:       return string("unknown");                            \
    00675     }};
    00676
    00677
    00678
    00684   static int getDetectorSettings(string s){             \
    00685     if (s=="standard") return 0;                        \
    00686     if (s=="fast") return 1;                            \
    00687     if (s=="highgain") return 2;                        \
    00688     if (s=="dynamicgain") return 3;                     \
    00689     if (s=="lowgain") return 4;                         \
    00690     if (s=="mediumgain") return 5;                      \
    00691     if (s=="veryhighgain") return 6;                    \
    00692     return -1;                                   };
    00693
    00698   static string getDetectorSettings(int s){\
    00699     switch(s) {                                         \
    00700     case 0:      return string("standard");\
    00701     case 1:      return string("fast");\
    00702     case 2:      return string("highgain");\
    00703     case 3:    return string("dynamicgain");    \
    00704     case 4:    return string("lowgain");                \
    00705     case 5:    return string("mediumgain");     \
    00706     case 6:    return string("veryhighgain");                   \
    00707     default:    return string("undefined");                     \
    00708     }};
    00709
    00710
    00711
    00718   static string getTimingMode(int f){   \
    00719     switch(f) {                                          \
    00720     case 0:      return string( "auto");                        \
    00721     case 1: return string("trigger");                   \
    00722     case 2: return string("ro_trigger");                                \
    00723     case 3: return string("gating");                    \
    00724     case 4: return string("triggered_gating");  \
    00725     default:    return string( "unknown");                              \
    00726     }      };
    00727
    00734   static int getTimingMode(string s){                                   \
    00735     if (s== "auto") return 0;                                           \
    00736     if (s== "trigger") return 1;                                        \
    00737     if (s== "ro_trigger") return 2;                                     \
    00738     if (s== "gating") return 3;                                         \
    00739     if (s== "triggered_gating") return 4;                               \
    00740     return -1;                                                  };
    00741
    00742
    00743  private:
    00744   multiSlsDetector *myDetector;
    00745   multiSlsDetectorCommand *myCmd;
    00746  };
    00747
    00748 #endif

All Classes Files Functions Variables Defines