client:updated users class and release.txt

This commit is contained in:
2018-08-22 18:08:35 +02:00
parent 7945d15beb
commit 63c130a380
12 changed files with 328 additions and 146 deletions

View File

@ -2680,16 +2680,28 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int imod) {
return ret;
}
int64_t multiSlsDetector::getTimeLeft(timerIndex index) {
int64_t multiSlsDetector::getTimeLeft(timerIndex index, int imod) {
int64_t ret = -100;
{ // single
int id = -1, im = -1;
if (decodeNMod(imod, id, im) >= 0) {
if (id < 0 || id >= (int)detectors.size())
return -1;
ret = detectors[id]->getTimeLeft(index, im);
if (detectors[id]->getErrorMask())
setErrorMask(getErrorMask() | (1 << id));
return ret;
}
}
if (thisMultiDetector->masterPosition >= 0)
if (detectors[thisMultiDetector->masterPosition]) {
ret = detectors[thisMultiDetector->masterPosition]->getTimeLeft(index);
ret = detectors[thisMultiDetector->masterPosition]->getTimeLeft(index, imod);
if (detectors[thisMultiDetector->masterPosition]->getErrorMask())
setErrorMask(getErrorMask() | (1 << thisMultiDetector->masterPosition));
return ret;
}
return callDetectorMember(&slsDetector::getTimeLeft, index);
return callDetectorMember(&slsDetector::getTimeLeft, index, imod);
}
int multiSlsDetector::setSpeed(speedVariable index, int value) {

View File

@ -1048,9 +1048,10 @@ public:
* Set/get timer value left in acquisition (not all implemented for all detectors)
* @param index timer index
* @param t time in ns or number of...(e.g. frames, gates, probes)
* @param imod module number
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
int64_t getTimeLeft(timerIndex index, int imod = -1);
/**
* Set speed

View File

@ -4355,7 +4355,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t, int imod) {
int64_t slsDetector::getTimeLeft(timerIndex index) {
int64_t slsDetector::getTimeLeft(timerIndex index, int imod) {
int fnum=F_GET_TIME_LEFT;

View File

@ -1164,9 +1164,10 @@ public:
* Set/get timer value left in acquisition (not all implemented for all detectors)
* @param index timer index
* @param t time in ns or number of...(e.g. frames, gates, probes)
* @param imod module number
* @returns timer set value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
int64_t getTimeLeft(timerIndex index, int imod = -1);
/**
* Set speed

View File

@ -894,17 +894,17 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
*/
static int getADCIndex(std::string s){
if (s=="temp_fpga") return TEMPERATURE_FPGA;
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
if (s=="temp_10ge") return TEMPERATURE_10GE;
if (s=="temp_dcdc") return TEMPERATURE_DCDC;
if (s=="temp_sodl") return TEMPERATURE_SODL;
if (s=="temp_sodr") return TEMPERATURE_SODR;
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2;
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3;
return -1;
};
static int getADCIndex(std::string s){ \
if (s=="temp_fpga") return TEMPERATURE_FPGA; \
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT; \
if (s=="temp_10ge") return TEMPERATURE_10GE; \
if (s=="temp_dcdc") return TEMPERATURE_DCDC; \
if (s=="temp_sodl") return TEMPERATURE_SODL; \
if (s=="temp_sodr") return TEMPERATURE_SODR; \
if (s=="temp_fpgafl") return TEMPERATURE_FPGA2; \
if (s=="temp_fpgafr") return TEMPERATURE_FPGA3; \
return -1; \
}; \
/**
@ -912,19 +912,43 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
*/
static int getDACIndex(std::string s){
if (s=="vcmp_ll") return E_Vcmp_ll;
if (s=="vcmp_lr") return E_Vcmp_lr;
if (s=="vcmp_rl") return E_Vcmp_rl;
if (s=="vcmp_rr") return E_Vcmp_rr;
if (s=="vthreshold") return THRESHOLD;
if (s=="vrf") return E_Vrf;
if (s=="vrs") return E_Vrs;
if (s=="vtr") return E_Vtr;
if (s=="vcall") return E_cal;
if (s=="vcp") return E_Vcp;
return -1;
};
static int getDACIndex(std::string s){ \
if (s=="vcmp_ll") return E_Vcmp_ll; \
if (s=="vcmp_lr") return E_Vcmp_lr; \
if (s=="vcmp_rl") return E_Vcmp_rl; \
if (s=="vcmp_rr") return E_Vcmp_rr; \
if (s=="vthreshold") return THRESHOLD; \
if (s=="vrf") return E_Vrf; \
if (s=="vrs") return E_Vrs; \
if (s=="vtr") return E_Vtr; \
if (s=="vcall") return E_cal; \
if (s=="vcp") return E_Vcp; \
return -1; \
}; \
/**
@short returns receiver frame discard policy from std::string
\param s can be nodiscard, discardempty, discardpartial
\returns NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES, GET_FRAME_DISCARD_POLICY when unknown mode
*/
static frameDiscardPolicy getReceiverFrameDiscardPolicy(std::string s){ \
if (s=="nodiscard") return NO_DISCARD; \
if (s=="discardempty") return DISCARD_EMPTY_FRAMES; \
if (s=="discardpartial") return DISCARD_PARTIAL_FRAMES; \
return GET_FRAME_DISCARD_POLICY; \
}; \
/** returns std::string from frame discard policy
\param f can be NO_DISCARD, DISCARD_EMPTY_FRAMES, DISCARD_PARTIAL_FRAMES
\returns std::string nodiscard, discardempty, discardpartial, unknown
*/
static std::string getReceiverFrameDiscardPolicy(frameDiscardPolicy f){ \
switch (f) { \
case NO_DISCARD: return std::string("nodiscard"); \
case DISCARD_EMPTY_FRAMES: return std::string("discardempty"); \
case DISCARD_PARTIAL_FRAMES: return std::string("discardpartial"); \
default: return std::string("unknown"); \
}}; \
};

View File

@ -2249,7 +2249,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
++i;
/*! \page receiver
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest). \c Returns \c (int)
- <b>r_discardpolicy</b> sets/gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="r_discardpolicy"; //OK
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
@ -6383,14 +6383,12 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
else if(cmd=="r_discardpolicy") {
if (action==PUT_ACTION){
if (sscanf(args[1],"%d",&ival) && (ival >= 0) && (ival < NUM_DISCARD_POLICIES)) {
myDet->setReceiverFramesDiscardPolicy((frameDiscardPolicy)ival);
} else return string("could not scan frames discard policy\n");
frameDiscardPolicy f = myDet->getReceiverFrameDiscardPolicy(string(args[1]));
if (f == GET_FRAME_DISCARD_POLICY)
return string("could not scan frame discard policy. Options: nodiscard, discardempty, discardpartial\n");
myDet->setReceiverFramesDiscardPolicy(f);
}
char answer[100];
memset(answer, 0, 100);
sprintf(answer,"%d",myDet->setReceiverFramesDiscardPolicy());
return string(answer);
return myDet->getReceiverFrameDiscardPolicy(myDet->setReceiverFramesDiscardPolicy());
}
else if(cmd=="r_padding") {
@ -6424,7 +6422,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl;
os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl;
os << "r_framesperfile s\t sets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
os << "r_discardpolicy s\t sets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding s\t enables/disables partial frames to be padded in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
}
if (action==GET_ACTION || action==HELP_ACTION){
@ -6436,7 +6434,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
os << "rx_fifodepth \t returns receiver fifo depth" << std::endl;
os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl;
os << "r_framesperfile \t gets the number of frames per file in receiver. 0 means infinite or all frames in a single file." << std::endl;
os << "r_discardpolicy \t gets the frame discard policy in the receiver. 0 - no discard (default), 1 - discard only empty frames, 2 - discard any partial frame(fastest)." << std::endl;
os << "r_discardpolicy \t gets the frame discard policy in the receiver. nodiscard (default) - discards nothing, discardempty - discard only empty frames, discardpartial(fastest) - discards all partial frames." << std::endl;
os << "r_padding \t gets partial frames padding enable in the receiver. 0 does not pad partial frames(fastest), 1 (default) pads partial frames." << std::endl;
}
return os.str();

View File

@ -6,7 +6,7 @@
using namespace std;
slsDetectorUsers::slsDetectorUsers(int id, int& ret) : myDetector(0), myCmd(0){
slsDetectorUsers::slsDetectorUsers(int& ret, int id) : myDetector(0), myCmd(0){
try {
myDetector=new multiSlsDetector(id);
} catch(...) {
@ -16,22 +16,18 @@ slsDetectorUsers::slsDetectorUsers(int id, int& ret) : myDetector(0), myCmd(0){
myCmd=new multiSlsDetectorCommand(myDetector);
ret = 0;
};
}
slsDetectorUsers::~slsDetectorUsers() {
if (myDetector)
delete myDetector;
};
}
string slsDetectorUsers::getDetectorDeveloper(){
return myDetector->getDetectorDeveloper();
}
int slsDetectorUsers::setOnline(int const online){
return myDetector->setOnline(online);
}
@ -48,7 +44,6 @@ int slsDetectorUsers::stopMeasurement(){
return myDetector->stopAcquisition();
}
int slsDetectorUsers::getDetectorStatus(){
return (int)myDetector->getRunStatus();
}
@ -57,12 +52,10 @@ string slsDetectorUsers::getFilePath(){
return myDetector->getFilePath();
}
string slsDetectorUsers::setFilePath(string s){
return myDetector->setFilePath(s);
}
string slsDetectorUsers::getFileName(){
return myDetector->getFileName();
}
@ -89,7 +82,7 @@ string slsDetectorUsers::setFlatFieldCorrectionDir(string dir){
string slsDetectorUsers::getFlatFieldCorrectionFile(){
return myDetector->getFlatFieldCorrectionFile();
};
}
int slsDetectorUsers::setFlatFieldCorrectionFile(string fname){
return myDetector->setFlatFieldCorrectionFile(fname);
@ -146,7 +139,6 @@ int slsDetectorUsers::setBitDepth(int i){
return myDetector->setDynamicRange(i);
}
int slsDetectorUsers::setSettings(int isettings){
return myDetector->slsDetectorBase::setSettings(isettings);
}
@ -166,43 +158,40 @@ int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int id
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setExposureTime((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposureTime(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposureTime(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::setExposurePeriod(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setExposurePeriod((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposurePeriod(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setExposurePeriod(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::setDelayAfterTrigger(double t, bool inseconds, int imod){
if(!inseconds)
return myDetector->setDelayAfterTrigger((int64_t)t,imod);
else {
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setDelayAfterTrigger(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
// + 0.5 to round for precision lost from converting double to int64_t
int64_t tms = (int64_t)(t * (1E+9) + 0.5);
if (t < 0) tms = -1;
tms = myDetector->setDelayAfterTrigger(tms,imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
int64_t slsDetectorUsers::setNumberOfGates(int64_t t, int imod){
@ -306,6 +295,44 @@ int slsDetectorUsers::enableGapPixels(int enable) {
return myDetector->enableGapPixels(enable);
}
std::string slsDetectorUsers::setReceiverFramesDiscardPolicy(std::string f) {
return myDetector->getReceiverFrameDiscardPolicy(
myDetector->setReceiverFramesDiscardPolicy(
myDetector->getReceiverFrameDiscardPolicy(f)));
}
int slsDetectorUsers::setReceiverPartialFramesPadding(int f) {
return myDetector->setReceiverPartialFramesPadding(f);
}
int slsDetectorUsers::setReceiverFramesPerFile(int f) {
return myDetector->setReceiverFramesPerFile(f);
}
int slsDetectorUsers::sendSoftwareTrigger() {
return myDetector->sendSoftwareTrigger();
}
double slsDetectorUsers::getMeasuredPeriod(bool inseconds, int imod) {
if(!inseconds)
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_PERIOD, imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
double slsDetectorUsers::getMeasuredSubFramePeriod(bool inseconds, int imod) {
if(!inseconds)
return myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
int64_t tms = myDetector->getTimeLeft(slsReceiverDefs::MEASURED_SUBPERIOD, imod);
if (tms < 0)
return -1;
return ((1E-9) * (double)tms);
}
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg){
myDetector->registerDataCallback(userCallback,pArg);
}
@ -343,8 +370,6 @@ void slsDetectorUsers::registerGetI0Callback( double (*func)(int,void*),void *ar
}
string slsDetectorUsers::putCommand(int narg, char *args[], int pos){
if(narg < 2)
return string("Error: Insufficient Parameters");
@ -358,8 +383,6 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
}
int slsDetectorUsers::setClockDivider(int value) {
return myDetector->setClockDivider(value);
}
@ -408,7 +431,6 @@ int slsDetectorUsers::stopAcquisition() {
return myDetector->stopAcquisition();
}
int slsDetectorUsers::setReceiverSilentMode(int i) {
return myDetector->setReceiverSilentMode(i);
}
@ -465,3 +487,10 @@ double slsDetectorUsers::setSubFrameExposureDeadTime(double t, bool inseconds, i
}
}
int64_t slsDetectorUsers::setNumberOfStorageCells(int64_t t, int imod) {
return myDetector->setTimer(slsReceiverDefs::STORAGE_CELL_NUMBER, t, imod);
}
int slsDetectorUsers::setStoragecellStart(int pos) {
return myDetector->setStoragecellStart(pos);
}

View File

@ -88,26 +88,21 @@ class slsDetectorUsers
public:
/** @short default constructor
* @param id multi detector id
* @param ret address of return value. It will be set to 0 for success, else 1 for failure
* @param id multi detector id
* in creating multidetector object
*/
slsDetectorUsers(int id=0, int& ret);
slsDetectorUsers(int& ret, int id=0);
/** @short virtual destructor */
virtual ~slsDetectorUsers();
/**
@short useful to define subset of working functions
\returns "PSI" or "Dectris"
*/
std::string getDetectorDeveloper();
/** @short sets the onlineFlag
\param online can be: -1 returns wether the detector is in online (1) or offline (0) state; 0 detector in offline state; 1 detector in online state
\returns 0 (offline) or 1 (online)
@ -376,7 +371,6 @@ class slsDetectorUsers
\returns number of frames
*/
int64_t setNumberOfCycles(int64_t t=-1, int imod = -1);
/**
@short set/get the external communication mode
@ -556,11 +550,54 @@ class slsDetectorUsers
*/
int enableGapPixels(int enable=-1);
/**
* Sets the frames discard policy in receiver
* frame discard policy options:
* @param f nodiscard (default),discardempty, discardpartial (fastest), get to get the value
* @returns f nodiscard (default),discardempty, discardpartial (fastest)
*/
std::string setReceiverFramesDiscardPolicy(std::string f="get");
/**
* Sets the frame padding in receiver
* @param f 0 does not partial frames, 1 pads partial frames (-1 gets)
* @returns partial frames padding enable
*/
int setReceiverPartialFramesPadding(int f = -1);
/**
* Sets the frames per file in receiver
* @param f frames per file, 0 is infinite ie. every frame in same file (-1 gets)
* @returns frames per file
*/
int setReceiverFramesPerFile(int f = -1);
/**
* Sends a software internal trigger (EIGER only)
* @returns 0 for success, 1 for fail
*/
int sendSoftwareTrigger();
/**
* get measured period between previous two frames(EIGER only)
* @param inseconds true if the value is in s, else ns
* @param imod module number (-1 for all)
* @returns measured period
*/
double getMeasuredPeriod(bool inseconds=false, int imod = -1);
/**
* get measured sub period between previous two sub frames in 32 bit mode (EIGER only)
* @param inseconds true if the value is in s, else ns
* @param imod module number (-1 for all)
* @returns measured sub period
*/
double getMeasuredSubFramePeriod(bool inseconds=false, int imod = -1);
/**
@short register calbback for accessing detector final data
\param func function to be called at the end of the acquisition. gets detector status and progress index as arguments
*/
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg);
/**
@ -757,6 +794,21 @@ class slsDetectorUsers
*/
double setSubFrameExposureDeadTime(double t=-1, bool inseconds=false, int imod = -1);
/**
* set/get number of additional storage cells (Jungfrau)
* @param t number of additional storage cells. Default is 0. (-1 gets)
* @param imod module number (-1 for all)
* @returns number of additional storage cells
*/
int64_t setNumberOfStorageCells(int64_t t=-1, int imod = -1);
/**
* Set storage cell that stores first acquisition of the series (Jungfrau)
* @param value storage cell index. Value can be 0 to 15. Default is 15. (-1 gets)
* @returns the storage cell that stores the first acquisition of the series
*/
int setStoragecellStart(int pos=-1);
/************************************************************************
STATIC FUNCTIONS
@ -836,12 +888,12 @@ class slsDetectorUsers
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown when wrong mode
*/
static int getTimingMode(std::string s){ \
static int getTimingMode(std::string s){ \
if (s== "auto") return 0; \
if (s== "trigger") return 1; \
if (s== "ro_trigger") return 2; \
if (s== "gating") return 3; \
if (s== "triggered_gating") return 4; \
if (s== "triggered_gating") return 4; \
return -1; };

View File

@ -291,9 +291,10 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
/**
get current timer value
\param index timer index
\param imod module number
\returns elapsed time value in ns or number of...(e.g. frames, gates, probes)
*/
virtual int64_t getTimeLeft(timerIndex index)=0;
virtual int64_t getTimeLeft(timerIndex index, int imod = -1)=0;
/**
* set storage cell that stores first acquisition of the series (Jungfrau only)