receiver read frequency from gui can be set now

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@567 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-05-21 13:43:25 +00:00
parent 3afbf35e0f
commit 0e73372cf8
11 changed files with 177 additions and 70 deletions

View File

@@ -439,6 +439,7 @@ int slsReceiverFunctionList::startWriting(){
//reset this before each acq or you send old data
guiData = NULL;
guiDataReady=0;
strcpy(guiFileName,"");
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
@@ -507,8 +508,6 @@ int slsReceiverFunctionList::startWriting(){
else
currframenum = (((int)(*((int*)wbuf))) & (frameIndexMask)) >> frameIndexOffset;
//currframenum = (int)(*((int*)wbuf));
//cout<<"**************curreframenm:"<<currframenum<<endl;
//write data call back
@@ -529,24 +528,41 @@ int slsReceiverFunctionList::startWriting(){
}
}
/*
//wait for gui data for 100ms
if(nFrameToGui){
for(int i=0;i<10;i++)
if(guiData)
break;
else
usleep(10000);//10ms
//does not read every frame
if(!nFrameToGui){
if(guiData){
memcpy(latestData,wbuf,bufferSize);
strcpy(guiFileName,savefilename);
guiDataReady=1;
}else
guiDataReady=0;
}
*/
//copies gui data and sets/resets guiDataReady
if(guiData){
//reads every nth frame
else{
//catch nth frame: gui ready to copy data
while(guiData==NULL){
if(!listening_thread_running)
break;
usleep(10000);
guiDataReady=0;
}
//copies gui data and sets/resets guiDataReady
memcpy(latestData,wbuf,bufferSize);
strcpy(guiFileName,savefilename);
guiDataReady=1;
}else
guiDataReady=0;
//catch nth frame: wait for gui to take data
while(guiData==latestData){
if(!listening_thread_running)
break;
usleep(100000);
}
guiDataReady=0;
}
framesInFile++;
@@ -592,8 +608,9 @@ void slsReceiverFunctionList::readFrame(char* c,char** raw){
strcpy(c,guiFileName);
//could not get gui data
if(!guiDataReady)
if(!guiDataReady){
*raw = NULL;
}
//data ready, set guidata to receive new data
else{
*raw = guiData;