fileenablewrite shoudlnt decide if the datareadycallback is called

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@548 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-05-13 13:46:36 +00:00
parent 1e7dfcb6ad
commit 21b511fe29
2 changed files with 26 additions and 22 deletions

View File

@ -7,6 +7,11 @@
#define GOODBYE -200 #define GOODBYE -200
#define DO_NOTHING 0
#define CREATE_FILES 1
#define DO_EVERYTHING 2
//all max frames defined in sls_detector_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench //all max frames defined in sls_detector_defs.h. 20000 gotthard, 100000 for short gotthard, 1000 for moench
#define FIFO_SIZE 25000 #define FIFO_SIZE 25000

View File

@ -448,11 +448,13 @@ int slsReceiverFunctionList::startWriting(){
//by default, we read/write everything //by default, we read/write everything
cbAction=2; cbAction = DO_EVERYTHING;
//acquisition start call back returns enable write //acquisition start call back returns enable write
if (startAcquisitionCallBack) if (startAcquisitionCallBack)
cbAction=startAcquisitionCallBack(filePath,fileName,fileIndex,bufferSize,pStartAcquisition); cbAction=startAcquisitionCallBack(filePath,fileName,fileIndex,bufferSize,pStartAcquisition);
if(enableFileWrite==0 || cbAction==0) if(cbAction < DO_EVERYTHING)
cout << endl << "Note: Call back activated. Data saving must be taken care of by user in call back." << endl;
else if(enableFileWrite==0)
cout << endl << "Note: Data will not be saved" << endl; cout << endl << "Note: Data will not be saved" << endl;
@ -466,7 +468,7 @@ int slsReceiverFunctionList::startWriting(){
if(frameIndexNeeded==-1) sprintf(savefilename, "%s/%s_%d.raw", filePath,fileName,fileIndex); if(frameIndexNeeded==-1) sprintf(savefilename, "%s/%s_%d.raw", filePath,fileName,fileIndex);
else sprintf(savefilename, "%s/%s_f%012d_%d.raw", filePath,fileName,framesCaught,fileIndex); else sprintf(savefilename, "%s/%s_f%012d_%d.raw", filePath,fileName,framesCaught,fileIndex);
if(enableFileWrite || cbAction>0){ if(enableFileWrite && cbAction > DO_NOTHING){
//sync file and close fd //sync file and close fd
if(sfilefd) { if(sfilefd) {
msync(address,memsize, MS_ASYNC); msync(address,memsize, MS_ASYNC);
@ -516,31 +518,28 @@ int slsReceiverFunctionList::startWriting(){
//currframenum = (int)(*((int*)wbuf)); //currframenum = (int)(*((int*)wbuf));
//cout<<"**************curreframenm:"<<currframenum<<endl; //cout<<"**************curreframenm:"<<currframenum<<endl;
//write data //write data call back
if(enableFileWrite){ if (writeReceiverData) {
//write data call back writeReceiverData(wbuf,bufferSize, sfilefd, pwriteReceiverDataArg);
if (writeReceiverData) { }
writeReceiverData(wbuf,bufferSize, sfilefd, pwriteReceiverDataArg); //write data call back
} if (cbAction < DO_EVERYTHING) {
//write data call back rawDataReadyCallBack(currframenum, wbuf,sfilefd, guiData,pRawDataReady);
if (cbAction<2) { }
rawDataReadyCallBack(currframenum, wbuf,sfilefd, guiData,pRawDataReady); //default writing to file
} else if(enableFileWrite){
//default writing to file if(sfilefd)
else { memcpy((((char*)address)+bufferSize*framesInFile),wbuf, bufferSize);
if(sfilefd) else{
memcpy((((char*)address)+bufferSize*framesInFile),wbuf, bufferSize); cout << "You do not have permissions to overwrite: " << savefilename << endl;
else{ usleep(50000);
cout << "You do not have permissions to overwrite: " << savefilename << endl;
usleep(50000);
}
} }
} }
//copies gui data and sets/resets guiDataReady //copies gui data and sets/resets guiDataReady
if(guiData){ if(guiData){
//if (cbAction>=2)
memcpy(latestData,wbuf,bufferSize); memcpy(latestData,wbuf,bufferSize);
strcpy(guiFileName,savefilename); strcpy(guiFileName,savefilename);
guiDataReady=1; guiDataReady=1;