mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
added measurement_finished callback
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@249 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
d92a6649ee
commit
25edfba592
@ -19,6 +19,8 @@ slsDetectorUtils::slsDetectorUtils() {
|
||||
#endif
|
||||
acquisition_finished=NULL;
|
||||
acqFinished_p=NULL;
|
||||
measurement_finished=NULL;
|
||||
measFinished_p=NULL;
|
||||
registerGetPositionCallback(&defaultGetPosition, NULL);
|
||||
registerConnectChannelsCallback(&defaultConnectChannels,NULL);
|
||||
registerDisconnectChannelsCallback(&defaultDisconnectChannels,NULL);
|
||||
@ -28,6 +30,7 @@ slsDetectorUtils::slsDetectorUtils() {
|
||||
#ifdef VERBOSE
|
||||
|
||||
registerAcquisitionFinishedCallback(&dummyAcquisitionFinished,this);
|
||||
registerMeasurementFinishedCallback(&dummyMeasurementFinished,this);
|
||||
cout << "done " << endl;
|
||||
#endif
|
||||
|
||||
@ -47,11 +50,11 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
int measurement = (int)setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
|
||||
|
||||
for(int im=0;im<measurement;im++) {
|
||||
|
||||
angCalLogClass *aclog=NULL;
|
||||
enCalLogClass *eclog=NULL;
|
||||
|
||||
// int lastindex=startindex, nowindex=startindex;
|
||||
int connectChannels=0;
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Acquire function "<< delflag << endl;
|
||||
cout << "Stopped flag is "<< stoppedFlag << delflag << endl;
|
||||
@ -60,8 +63,7 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
void *status;
|
||||
|
||||
|
||||
// int lastindex=startindex, nowindex=startindex;
|
||||
int connectChannels=0;
|
||||
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(0)==positionScan)) {
|
||||
if (connectChannels==0)
|
||||
@ -72,7 +74,6 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (getActionMode(angCalLog))
|
||||
aclog=new angCalLogClass(this);
|
||||
|
||||
@ -80,7 +81,6 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
eclog=new enCalLogClass(this);
|
||||
|
||||
|
||||
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
resetFinalDataQueue();
|
||||
@ -90,6 +90,13 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
posfinished=0;
|
||||
pthread_mutex_unlock(&mp);
|
||||
|
||||
for(int im=0;im<measurement;im++) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -314,7 +321,12 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
pthread_mutex_unlock(&mp);
|
||||
pthread_join(dataProcessingThread, &status);
|
||||
}
|
||||
|
||||
if (*stoppedFlag) {
|
||||
break;
|
||||
}
|
||||
if (measurement_finished)
|
||||
measurement_finished(im,*fileIndex,measFinished_p);
|
||||
}
|
||||
|
||||
if (connectChannels) {
|
||||
if (disconnect_channels)
|
||||
@ -329,11 +341,9 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
|
||||
|
||||
if (acquisition_finished) {
|
||||
if (acquisition_finished)
|
||||
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -544,6 +544,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
void registerGetI0Callback( double (*func)(int, void*),void *arg){get_i0=func;IOarg=arg;};
|
||||
|
||||
void registerAcquisitionFinishedCallback(int( *func)(double,int, void*), void *pArg){acquisition_finished=func; acqFinished_p=pArg;};
|
||||
void registerMeasurementFinishedCallback(int( *func)(int,int, void*), void *pArg){measurement_finished=func; measFinished_p=pArg;};
|
||||
|
||||
|
||||
|
||||
@ -567,6 +568,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
int retrieveDetectorSetup(string const fname, int level=0);
|
||||
|
||||
static int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;}
|
||||
static int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;}
|
||||
|
||||
protected:
|
||||
|
||||
@ -594,7 +596,8 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
double (*get_i0)(int, void*);
|
||||
void *POarg,*CCarg,*DCarg,*GTarg,*GTNarg,*IOarg;
|
||||
int (*acquisition_finished)(double,int,void*);
|
||||
void *acqFinished_p;
|
||||
int (*measurement_finished)(int,int,void*);
|
||||
void *acqFinished_p, *measFinished_p;
|
||||
|
||||
|
||||
};
|
||||
|
@ -128,7 +128,7 @@ class angCalLogClass {
|
||||
strcpy(vars[2],"nmod"); \
|
||||
strcpy(vars[3],"angconv"); \
|
||||
strcpy(vars[4],"globaloff"); \
|
||||
strcpy(vars[5],"fineoffoff"); \
|
||||
strcpy(vars[5],"fineoff"); \
|
||||
strcpy(vars[6],"angdir"); \
|
||||
strcpy(vars[7],"ffdir"); \
|
||||
strcpy(vars[8],"flatfield"); \
|
||||
|
@ -307,6 +307,9 @@ int defaultDisconnectChannels(void *d) {
|
||||
int defaultDataReadyFunc(detectorData* d, void* p) {
|
||||
#ifdef VERBOSE
|
||||
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Data received \n");
|
||||
printf("Filename %s\n",d->fileName);
|
||||
printf("Number of points %d (%d)\n",d->npoints,d->npy);
|
||||
printf("UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU Finished \n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user