diff --git a/slsDetectorSoftware/gotthardDetectorServer/svnInfoGotthard.h b/slsDetectorSoftware/gotthardDetectorServer/svnInfoGotthard.h index 2db29a4a8..3dbc6e152 100644 --- a/slsDetectorSoftware/gotthardDetectorServer/svnInfoGotthard.h +++ b/slsDetectorSoftware/gotthardDetectorServer/svnInfoGotthard.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/gotthardDetectorServer" //#define SVNREPPATH "" #define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x579 +//#define SVNREV 0x590 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x579 -#define SVNDATE 0x20130527 +#define SVNREV 0x590 +#define SVNDATE 0x20130603 // diff --git a/slsDetectorSoftware/moenchDetectorServer/svnInfoMoench.h b/slsDetectorSoftware/moenchDetectorServer/svnInfoMoench.h index ee429a569..3ca06f0be 100644 --- a/slsDetectorSoftware/moenchDetectorServer/svnInfoMoench.h +++ b/slsDetectorSoftware/moenchDetectorServer/svnInfoMoench.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/moenchDetectorServer" //#define SVNREPPATH "" #define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x579 +//#define SVNREV 0x590 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x579 -#define SVNDATE 0x20130527 +#define SVNREV 0x590 +#define SVNDATE 0x20130603 // diff --git a/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h b/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h index 0f0b72f17..4b88df4ae 100644 --- a/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h +++ b/slsDetectorSoftware/mythenDetectorServer/svnInfoMythen.h @@ -2,10 +2,10 @@ #define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware/mythenDetectorServer" //#define SVNREPPATH "" #define SVNREPUUID "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x579 +//#define SVNREV 0x590 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTH "l_maliakal_d" -#define SVNREV 0x579 -#define SVNDATE 0x20130527 +#define SVNREV 0x590 +#define SVNDATE 0x20130603 // diff --git a/slsDetectorSoftware/slsDetector/svnInfoLib.h b/slsDetectorSoftware/slsDetector/svnInfoLib.h index 1d394966e..70fc73198 100644 --- a/slsDetectorSoftware/slsDetector/svnInfoLib.h +++ b/slsDetectorSoftware/slsDetector/svnInfoLib.h @@ -2,10 +2,10 @@ #define SVNURLLIB "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware" //#define SVNREPPATH "" #define SVNREPUUIDLIB "951219d9-93cf-4727-9268-0efd64621fa3" -//#define SVNREV 0x589 +//#define SVNREV 0x592 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTHLIB "l_maliakal_d" -#define SVNREVLIB 0x589 -#define SVNDATELIB 0x20130529 +#define SVNREVLIB 0x592 +#define SVNDATELIB 0x20130611 // diff --git a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp index f5f3e0338..008c60b03 100644 --- a/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp +++ b/slsDetectorSoftware/slsReceiver/slsReceiverFunctionList.cpp @@ -30,10 +30,12 @@ slsReceiverFunctionList::slsReceiverFunctionList(detectorType det,bool moenchwit fileIndex(0), frameIndexNeeded(0), framesCaught(0), - startFrameIndex(-1), + acqStarted(false), + measurementStarted(false), + startFrameIndex(0), frameIndex(0), totalFramesCaught(0), - startAcquisitionIndex(-1), + startAcquisitionIndex(0), acquisitionIndex(0), framesInFile(0), prevframenum(0), @@ -119,26 +121,25 @@ void slsReceiverFunctionList::setEthernetInterface(char* c){ -int slsReceiverFunctionList::getFrameIndex(){ - if(startFrameIndex==-1) +uint32_t slsReceiverFunctionList::getFrameIndex(){ + if(!framesCaught) frameIndex=0; - else if(myDetectorType == MOENCH) - frameIndex=currframenum - startFrameIndex; + else if(frameIndexOffset) + frameIndex = currframenum - startFrameIndex; //moench else - frameIndex=(currframenum - startFrameIndex)/packetsPerFrame; + frameIndex = (currframenum - startFrameIndex)/packetsPerFrame;//moench with gotthard, gotthard return frameIndex; } -int slsReceiverFunctionList::getAcquisitionIndex(){ - if(startAcquisitionIndex==-1) +uint32_t slsReceiverFunctionList::getAcquisitionIndex(){ + if(!totalFramesCaught) acquisitionIndex=0; - else if(myDetectorType == MOENCH) - acquisitionIndex=currframenum - startAcquisitionIndex; + else if(frameIndexOffset) + acquisitionIndex = currframenum - startAcquisitionIndex; //moench else - acquisitionIndex=(currframenum - startAcquisitionIndex)/packetsPerFrame; - + acquisitionIndex = (currframenum - startAcquisitionIndex)/packetsPerFrame; //moench with gotthard, gotthard return acquisitionIndex; } @@ -177,7 +178,8 @@ int slsReceiverFunctionList::setFileIndex(int i){ void slsReceiverFunctionList::resetTotalFramesCaught(){ - startAcquisitionIndex = -1; + acqStarted = false; + startAcquisitionIndex = 0; totalFramesCaught = 0; } @@ -306,7 +308,9 @@ int slsReceiverFunctionList::startListening(){ #endif int rc; - startFrameIndex=-1; + + measurementStarted = false; + startFrameIndex = 0; // A do/while(FALSE) loop is used to make error cleanup easier. The // close() of each of the socket descriptors is only done once at the @@ -343,20 +347,22 @@ int slsReceiverFunctionList::startListening(){ cerr << "recvfrom() failed" << endl; //start for each scan - if(startFrameIndex==-1){ + if(!measurementStarted){ if(!frameIndexOffset) - startFrameIndex = ((int)(*((int*)buffer)))- packetsPerFrame; + startFrameIndex = ((uint32_t)(*((uint32_t*)buffer))); else - startFrameIndex = ((((int)(*((int*)buffer))) & (frameIndexMask)) >> frameIndexOffset)-1; + startFrameIndex = ((((uint32_t)(*((uint32_t*)buffer))) & (frameIndexMask)) >> frameIndexOffset); //cout<<"startFrameIndex:"<> frameIndexOffset; + currframenum = (((uint32_t)(*((uint32_t*)wbuf))) & (frameIndexMask)) >> frameIndexOffset; //cout<<"**************curreframenm:"<getStartFrameIndex(); - /**send garbage with -1 index to try again*/ - if(startIndex==-1) - cout<<"hadnt started yet"<getFramesCaught()){ + arg = -1; + cout<<"haven't caught any frame yet"<getStartFrameIndex(); slsReceiverList->readFrame(fName,&raw); + /**send garbage with -1 index to try again*/ if (raw == NULL){ - index = startIndex-1; + arg = -1; #ifdef VERBOSE cout<<"data not ready for gui yet"<> MOENCH_FRAME_INDEX_OFFSET; - int packetIndex,x,y; - int iPacket = 0; - offset = 4; - //cout<<"this frame number:"<> MOENCH_FRAME_INDEX_OFFSET); + //cout<<"this frame number:"<= 40) && (packetIndex < 0)) - cout << "cannot decode packet index:" << packetIndex << endl; - else{ + //check validity + if ((packetIndex >= 40) && (packetIndex < 0)) + cout << "cannot decode packet index:" << packetIndex << endl; + else{ - x = packetIndex / 10; - y = packetIndex % 10; + x = packetIndex / 10; + y = packetIndex % 10; #ifdef VERBOSE - cout<<"x:"<> MOENCH_FRAME_INDEX_OFFSET)<> MOENCH_FRAME_INDEX_OFFSET) != thisFrameNumber){cout<<"did not match"<> MOENCH_FRAME_INDEX_OFFSET)<> MOENCH_FRAME_INDEX_OFFSET) != index){cout<<"did not match"<= numPackets) break; //increment @@ -1060,23 +1063,22 @@ int slsReceiverFuncs::moench_read_frame(){ iPacket++; packetOffset = packetOffset + offset + onePacketSize; }*/ - + } } - + arg = index - startIndex; + if(withGotthard) + arg = arg/MOENCH_PACKETS_PER_FRAME; } //******************************************************** - - arg=index - startIndex; } + #ifdef VERBOSE cout << "\nstartIndex:" << startIndex << endl; cout << "fName:" << fName << endl; cout << "index:" << arg << endl; #endif - - #endif if(ret==OK && socket->differentClients){ @@ -1137,8 +1139,8 @@ int slsReceiverFuncs::gotthard_read_frame(){ //int* emptys = new int[rnel](); - int index=-1,index2=-1; - int startIndex=-1; + uint32_t index=0,index2=0; + uint32_t startIndex=0; int count=0; strcpy(mess,"Could not read frame\n"); @@ -1148,25 +1150,26 @@ int slsReceiverFuncs::gotthard_read_frame(){ #ifdef SLS_RECEIVER_FUNCTION_LIST - startIndex=slsReceiverList->getStartFrameIndex(); - /**send garbage with -1 index to try again*/ - if(startIndex==-1) - cout<<"hadnt started yet"<getFramesCaught()){ + arg=-1; + cout<<"haven't caught any frame yet"<getStartFrameIndex(); slsReceiverList->readFrame(fName,&raw); + /**send garbage with -1 index to try again*/ if (raw == NULL){ - index = startIndex; + arg = -1; #ifdef VERBOSE cout<<"data not ready for gui yet"<