users:double for time in ns, bugfix:readframe wen no gui, return ok for config

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@564 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-05-17 09:51:31 +00:00
parent a4d99004f7
commit df6774e2c6
6 changed files with 83 additions and 36 deletions

View File

@ -3898,7 +3898,7 @@ int multiSlsDetector::readConfigurationFile(string const fname){
setNumberOfModules(-1);
getMaxNumberOfModules();
return iline;
return OK;
};
@ -3988,7 +3988,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
#endif
return iv;
return OK;
};
@ -4429,6 +4429,12 @@ int multiSlsDetector::resetFramesCaught() {
int* multiSlsDetector::readFrameFromReceiver(char* fName, int &fIndex){
int nel=(thisMultiDetector->dataBytes)/sizeof(int);
if(nel <= 0){
cout << "Multislsdetector databytes not valid :" << thisMultiDetector->dataBytes << endl;
fIndex = -1;
return NULL;
}
int n;
int* retval=new int[nel];
int *retdet, *p=retval;

View File

@ -5246,7 +5246,7 @@ int slsDetector::readConfigurationFile(string const fname){
#ifdef VERBOSE
std::cout<< "Read configuration file of " << iline << " lines" << std::endl;
#endif
return iline;
return OK;
}
@ -5308,7 +5308,7 @@ int slsDetector::readConfigurationFile(ifstream &infile){
iline++;
}
delete cmd;
return iline;
return OK;
}
@ -5339,7 +5339,7 @@ int slsDetector::writeConfigurationFile(string const fname){
#ifdef VERBOSE
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl;
#endif
return ret;
return OK;
}
@ -5425,7 +5425,7 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
}
}
delete cmd;
return iv;
return OK;
}

View File

@ -163,6 +163,21 @@ int64_t slsDetectorUsers::setDelayAfterTrigger(int64_t t){
return myDetector->setDelayAfterTrigger(t);
}
double slsDetectorUsers::setExposureTime(double t){
int64_t tms = t * 1E+9;
return 1E-9 * (double)myDetector->setExposureTime(tms);
}
double slsDetectorUsers::setExposurePeriod(double t){
int64_t tms = t * 1E+9;
return 1E-9 * (double)myDetector->setExposurePeriod(tms);
}
double slsDetectorUsers::setDelayAfterTrigger(double t){
int64_t tms = t * 1E+9;
return 1E-9 * (double)(myDetector->setDelayAfterTrigger(tms));
}
int64_t slsDetectorUsers::setNumberOfGates(int64_t t){
return myDetector->setNumberOfGates(t);
}

View File

@ -335,6 +335,28 @@ class slsDetectorUsers
*/
int64_t setDelayAfterTrigger(int64_t t=-1);
/**
@short set/get exposure time value
\param t time in s (-1 gets)
\returns timer set value in s
*/
double setExposureTime(double t=-1);
/**
@short set/get exposure period
\param t time in s (-1 gets)
\returns timer set value in s
*/
double setExposurePeriod(double t=-1);
/**
@short set/get delay after trigger
\param t time in s (-1 gets)
\returns timer set value in s
*/
double setDelayAfterTrigger(double t=-1);
/**
@short set/get number of gates
\param t number of gates (-1 gets)

View File

@ -726,7 +726,7 @@ int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
#ifdef VERBOSE
std::cout<< "Read " << iline << " lines" << std::endl;
#endif
return iline;
return OK;
}
@ -869,7 +869,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
std::cout<< "wrote " <<iv << " lines to "<< fname1 << std::endl;
#endif
return 0;
return OK;
}

View File

@ -440,39 +440,43 @@ void* postProcessing::processData(int delflag) {
if(setReceiverOnline()==OFFLINE_FLAG)
caught=prevCaught;
incrementProgress(caught-prevCaught);
if(caught-prevCaught) newData=true;
else newData=false;
prevCaught=caught;
if (checkJoinThread()) break;
//read frame if new data
if(newData){
strcpy(currentfName,"");
pthread_mutex_lock(&mg);
int* receiverData = readFrameFromReceiver(currentfName,currentfIndex);
pthread_mutex_unlock(&mg);
if(setReceiverOnline()==OFFLINE_FLAG)
receiverData = NULL;
if(receiverData == NULL){
currentfIndex = -1;
cout<<"****Detector Data returned is NULL***"<<endl;
}
//not garbage frame
if(currentfIndex>=0){
fdata=decodeData(receiverData);
delete [] receiverData;
if(fdata){
if (dataReady) {
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
dataReady(thisData, currentfIndex, pCallbackArg);
delete thisData;
fdata=NULL;
if (dataReady){
if(caught-prevCaught) newData=true;
else newData=false;
prevCaught=caught;
//read frame if new data
if (newData){
strcpy(currentfName,"");
pthread_mutex_lock(&mg);
int* receiverData = readFrameFromReceiver(currentfName,currentfIndex);
pthread_mutex_unlock(&mg);
if(setReceiverOnline()==OFFLINE_FLAG)
receiverData = NULL;
if(receiverData == NULL){
currentfIndex = -1;
cout<<"****Detector Data returned is NULL***"<<endl;
}
//not garbage frame
if(currentfIndex>=0){
fdata=decodeData(receiverData);
delete [] receiverData;
if(fdata){
if (dataReady) {
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
dataReady(thisData, currentfIndex, pCallbackArg);
delete thisData;
fdata=NULL;
}
}
}
}
else{
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
else{
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
}
}
}
}