diff --git a/slsReceiverSoftware/include/RestHelper.h b/slsReceiverSoftware/include/RestHelper.h index b3d679b26..92846750d 100644 --- a/slsReceiverSoftware/include/RestHelper.h +++ b/slsReceiverSoftware/include/RestHelper.h @@ -249,45 +249,47 @@ class RestHelper { * @return */ - int n=0; + int n = 0; int code = -1; - while(nsendRequest( (req) ); - else{ - ostream &os = session->sendRequest( req ) ; - os << request_body; - } - - HTTPResponse res; - istream &is = session->receiveResponse(res); - StreamCopier::copyToString(is, *answer); - code = res.getStatus(); - if (code != 200){ - FILE_LOG(logERROR) << "HTTP ERROR " << res.getStatus() << ": " << res.getReason() ; - code = -1; - } - else - code = 0; - return code; - } - catch (exception& e){ - FILE_LOG(logERROR) << "Exception connecting to "<< full_hostname << ": "<< e.what() << ", sleeping 5 seconds (" << n << "/"<sendRequest( (req) ); + else{ + ostream &os = session->sendRequest( req ) ; + os << request_body; + } + + HTTPResponse res; + istream &is = session->receiveResponse(res); + StreamCopier::copyToString(is, *answer); + code = res.getStatus(); + if (code != 200){ + FILE_LOG(logERROR) << "HTTP ERROR " << res.getStatus() << ": " << res.getReason() ; + code = -1; + } + else + code = 0; + return code; + } + catch (exception& e){ + FILE_LOG(logERROR) << "Exception connecting to "<< full_hostname << ": "<< e.what() << ", sleeping 5 seconds (" << n << "/"<init(rest_hostname, rest_port); code = get_rest_state(rest, &answer); + std::cout << "AAAAAAAa " << answer << std::endl; + if (code != 0){ - throw answer; + FILE_LOG(logERROR) << __AT__ << " REST state returned: " << answer; + throw; } else{ isInitialized = true; @@ -133,11 +138,19 @@ void UDPRESTImplementation::initialize_REST(){ ss >> test; - test = "{\"path\":\"" + string( getFilePath() ) + "\"}"; - code = rest->post_json("state/initialize", &answer, test); - FILE_LOG(logDEBUG) << __AT__ << "state/configure got " << code; code = rest->get_json("state", &answer); - FILE_LOG(logDEBUG) << __AT__ << "state got " << code << " " << answer << "\n"; + FILE_LOG(logDEBUG) << __AT__ << " state got " << code << " " << answer << "\n"; + if (answer != "INITIALIZED"){ + test = "{\"path\":\"" + string( getFilePath() ) + "\"}"; + code = rest->post_json("state/initialize", &answer, test); + } + else{ + test = "{\"path\":\"" + string( getFilePath() ) + "\"}"; + code = rest->post_json("state/configure", &answer, test); + } + FILE_LOG(logDEBUG) << __AT__ << " state/configure got " << code; + code = rest->get_json("state", &answer); + FILE_LOG(logDEBUG) << __AT__ << " state got " << code << " " << answer << "\n"; /* @@ -187,6 +200,11 @@ int UDPRESTImplementation::getTotalFramesCaught(){ return (totalPacketsCaught/packetsPerFrame); } +uint32_t UDPRESTImplementation::getStartAcquisitionIndex(){ + FILE_LOG(logDEBUG) << __AT__ << " called"; + return startAcquisitionIndex; +} + uint32_t UDPRESTImplementation::getStartFrameIndex(){ FILE_LOG(logDEBUG) << __AT__ << " called"; return startFrameIndex; @@ -577,16 +595,19 @@ void UDPRESTImplementation::setupFifoStructure(){ /** acquisition functions */ -void UDPRESTImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &fstartind){ +void UDPRESTImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &startAcquisitionIndex, uint32_t &startFrameIndex){ FILE_LOG(logDEBUG) << __AT__ << " called"; //point to gui data - if (guiData == NULL) + if (guiData == NULL){ guiData = latestData; + } //copy data and filename strcpy(c,guiFileName); fnum = guiFrameNumber; - fstartind = getStartFrameIndex(); + startAcquisitionIndex = getStartAcquisitionIndex(); + startFrameIndex = getStartFrameIndex(); + //could not get gui data if(!guiDataReady){ @@ -596,12 +617,7 @@ void UDPRESTImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32 else{ *raw = guiData; guiData = NULL; - - pthread_mutex_lock(&dataReadyMutex); - guiDataReady = 0; - pthread_mutex_unlock(&dataReadyMutex); if((nFrameToGui) && (writerthreads_mask)){ - /*if(nFrameToGui){*/ //release after getting data sem_post(&smp); } @@ -1169,10 +1185,8 @@ int UDPRESTImplementation::startReceiver(char message[]){ initialize_REST(); FILE_LOG(logDEBUG) << __FILE__ << "::" << __func__ << " initialized"; -// #ifdef VERBOSE cout << "Starting Receiver" << endl; -//#endif - + std::string answer; int code; //char *intStr = itoa(a); @@ -1184,17 +1198,21 @@ int UDPRESTImplementation::startReceiver(char message[]){ stringstream ss2; ss2 << getNumberOfFrames(); string str_n = ss2.str(); + + cout << "Starting Receiver" << endl; + std::string request_body = "{\"settings\": {\"bit_depth\": " + str_dr + ", \"nimages\": " + str_n + "}}"; //std::string request_body = "{\"settings\": {\"nimages\":1, \"scanid\":999, \"bit_depth\":16}}"; FILE_LOG(logDEBUG) << __FILE__ << "::" << " sending this configuration body: " << request_body; code = rest->post_json("state/configure", &answer, request_body); code = rest->get_json("state", &answer); + FILE_LOG(logDEBUG) << __FILE__ << "::" << " got: " << answer; - code = rest->post_json("state/open", &answer); - code = rest->get_json("state", &answer); + //code = rest->post_json("state/open", &answer); + //code = rest->get_json("state", &answer); - status = slsReceiverDefs::RUNNING; + status = RUNNING; //reset listening thread variables /* diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 6f454ab57..93ad2c8d1 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -352,6 +352,8 @@ int UDPStandardImplementation::setDetectorType(detectorType det){ FILE_LOG(logD //int UDPStandardImplementation::getTotalFramesCaught(){return (totalPacketsCaught/packetsPerFrame);} +//uint32_t UDPStandardImplementation::getStartAcquisitionIndex(){return startAcquisitionIndex;} + //uint32_t UDPStandardImplementation::getStartFrameIndex(){return startFrameIndex;} /* @@ -868,32 +870,34 @@ void UDPStandardImplementation::setupFifoStructure(){ /** acquisition functions */ -void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &fstartind){ +void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &startAcquisitionIndex, uint32_t &startFrameIndex){ FILE_LOG(logDEBUG) << __AT__ << " called"; //point to gui data if (guiData == NULL){ guiData = latestData; #ifdef VERY_VERY_DEBUG - cout <<"gui data not null anymore" << endl; + cout << "gui data not null anymore" << endl; #endif } //copy data and filename strcpy(c,guiFileName); fnum = guiFrameNumber; - fstartind = getStartFrameIndex(); + startAcquisitionIndex = getStartAcquisitionIndex(); + startFrameIndex = getStartFrameIndex(); + //could not get gui data if(!guiDataReady){ #ifdef VERY_VERY_DEBUG - cout<<"gui data not ready"<fnum); + if(dynamicRange != 32) - tempframenum += (startFrameIndex-1); //eiger frame numbers start at 1, so need to -1 + tempframenum = htonl(*(unsigned int*)((eiger_image_header *)((char*)(wbuf[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum); else - tempframenum = ((tempframenum / EIGER_32BIT_INITIAL_CONSTANT) + startFrameIndex)-1;//eiger 32 bit mode is a multiple of 17c. +startframeindex for scans + tempframenum = htonl(*(unsigned int*)((eiger_image_header32 *)((char*)(wbuf[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum); + + + tempframenum += (startFrameIndex-1); //eiger frame numbers start at 1, so need to -1 + //tempframenum = ((tempframenum / EIGER_32BIT_INITIAL_CONSTANT) + startFrameIndex)-1;//eiger 32 bit mode is a multiple of 17c. +startframeindex for scans + }else if ((myDetectorType == GOTTHARD) && (shortFrame == -1)) tempframenum = (((((uint32_t)(*((uint32_t*)(wbuf[ithread] + HEADER_SIZE_NUM_TOT_PACKETS))))+1)& (frameIndexMask)) >> frameIndexOffset); else @@ -1928,10 +1950,10 @@ int UDPStandardImplementation::startWriting(){ currframenum = tempframenum; pthread_mutex_unlock(&progress_mutex); } -//#ifdef VERYDEBUG +#ifdef VERYDEBUG if(myDetectorType == EIGER) cout << endl < 0){ - for(i=0;inum1)) = currframenum; + + //for 32 bit,port number needs to be changed and packet number reconstructed + if(dynamicRange == 32){ + for (i = 0; i < packetsPerFrame/4; i++){ + //new packet number that has space for 16 bit + (*(uint16_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num2)) + = ((*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num4))); + + //new port number as its the same everywhere for 32 bit!! + if(!j) (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num3)) = 0x00; + + +#ifdef VERYDEBUG + cprintf(RED, "%d - 0x%x - %d - %d\n", i, + (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num3)), + (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num4)), + (*(uint16_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num2))); +#endif + } + for (i = packetsPerFrame/4; i < packetsPerFrame/2; i++){ + //new packet number that has space for 16 bit + (*(uint16_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num2)) + = ((*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num4))+(packetsPerFrame/4)); + + //new port number as its the same everywhere for 32 bit!! + if(!j) (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader + EIGER_ONE_GIGA_ONE_PACKET_SIZE*i)))->num3)) = 0x00; + + +#ifdef VERYDEBUG + cprintf(RED, "%d -0x%x - %d - %d\n", i, + (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num3)), + (*(uint8_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num4)), + (*(uint16_t*)(((eiger_packet_header *)((char*)(wbuf[j] + totalheader +i*EIGER_ONE_GIGA_ONE_PACKET_SIZE)))->num2))); +#endif + } + } + } +#endif + + writeToFile_withoutCompression(wbuf[j], numpackets,currframenum); + } #ifdef VERYDEBUG cout << "written everyting" << endl; #endif @@ -1969,7 +2036,8 @@ int UDPStandardImplementation::startWriting(){ } else{ //copy to gui - if(numpackets == packetsPerFrame * numJobsPerThread){ //only full frames + if(numpackets >= packetsPerFrame){//min 1 frame, but neednt be + //if(numpackets == packetsPerFrame * numJobsPerThread){ //only full frames copyFrameToGui(NULL,-1,wbuf[0]+HEADER_SIZE_NUM_TOT_PACKETS); #ifdef VERYVERBOSE cout << ithread << " finished copying" << endl; @@ -2053,9 +2121,13 @@ int UDPStandardImplementation::startWriting(){ void UDPStandardImplementation::startFrameIndices(int ithread){ FILE_LOG(logDEBUG) << __AT__ << " called"; - if (myDetectorType == EIGER) + if (myDetectorType == EIGER){ //add currframenum later in this method for scans - startFrameIndex = htonl(*(unsigned int*)((eiger_image_header *)((char*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum); + if(dynamicRange == 32) + startFrameIndex = htonl(*(unsigned int*)((eiger_image_header32 *)((char*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum); + else + startFrameIndex = htonl(*(unsigned int*)((eiger_image_header *)((char*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS)))->fnum); + } //gotthard has +1 for frame number and not a short frame else if ((myDetectorType == GOTTHARD) && (shortFrame == -1)) startFrameIndex = (((((uint32_t)(*((uint32_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS))))+1) @@ -2108,12 +2180,20 @@ int i; exit(-1); } + //free buffer + if(rc <= 0){ + cout << ithread << "Discarding empty frame/ End of acquisition" << endl; + fifoFree[ithread]->push(buffer[ithread]); +#ifdef FIFO_DEBUG + cprintf(BLUE,"%d listener empty buffer pushed into fifofree %x\n", ithread, (void*)(buffer[ithread])); +#endif + } //push the last buffer into fifo - if(rc > 0){ + else{ //eiger (incomplete frames) - throw away if((myDetectorType == EIGER) && (rc < (bufferSize * numJobsPerThread)) ){ if(rc == 266240) - cout << ithread << " Start of detector: Received test frame of 266240 bytes." << endl; + cprintf(GREEN, "%d Start of detector: Received test frame of 266240 bytes.\n",ithread); cout << ithread << "Discarding incomplete frame" << endl; fifoFree[ithread]->push(buffer[ithread]); #ifdef FIFO_DEBUG @@ -2135,14 +2215,6 @@ int i; #endif } } - //free buffer - else{ - cout << ithread << "Discarding empty frame" << endl; - fifoFree[ithread]->push(buffer[ithread]); -#ifdef FIFO_DEBUG - cprintf(BLUE,"%d listener empty buffer pushed into fifofree %x\n", ithread, (void*)(buffer[ithread])); -#endif - } @@ -2252,8 +2324,13 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer[]){ //report cprintf(GREEN, "Status: Run Finished\n"); - cprintf(GREEN, "Total Packets Caught:%d\n", totalPacketsCaught); - cprintf(GREEN, "Total Frames Caught:%d\n",(totalPacketsCaught/packetsPerFrame)); + if(!totalPacketsCaught){ + cprintf(RED, "Total Packets Caught:%d\n", totalPacketsCaught); + cprintf(RED, "Total Frames Caught:%d\n",(totalPacketsCaught/packetsPerFrame)); + }else{ + cprintf(GREEN, "Total Packets Caught:%d\n", totalPacketsCaught); + cprintf(GREEN, "Total Frames Caught:%d\n",(totalPacketsCaught/packetsPerFrame)); + } //acquisition end if (acquisitionFinishedCallBack) acquisitionFinishedCallBack((totalPacketsCaught/packetsPerFrame), pAcquisitionFinished); @@ -2281,8 +2358,52 @@ void UDPStandardImplementation::writeToFile_withoutCompression(char* buf,int num if((enableFileWrite) && (sfilefd)){ offset = HEADER_SIZE_NUM_TOT_PACKETS; - if(myDetectorType == EIGER) + if(myDetectorType == EIGER){ offset += EIGER_HEADER_LENGTH; +#ifdef WRITE_HEADERS +#ifdef VERY_DEBUG + int k = 0; + if(dynamicRange != 32){ + cprintf(RED, "\np1 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num1))); + cprintf(RED, "p1:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num3))); + cprintf(RED, "p0 num:%d - %d\n", k, (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num4))); + k = 1; + cprintf(RED, "p2 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num1))); + cprintf(RED, "p2:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p1 num:%d - %d\n", k,(*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num4))); + k = 2; + cprintf(RED, "p3 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset + k*1040)))->num1))); + cprintf(RED, "p3:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p2 num:%d - %d\n", k,(*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num4))); + }else{ + k = 0; + cprintf(RED, "\np1 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num1))); + cprintf(RED, "p1:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num3))); + cprintf(RED, "p0 num:%d - %d\n", k, (*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset+k*1040)))->num2))); + k = 1; + cprintf(RED, "p2 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num1))); + cprintf(RED, "p2:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p1 num:%d - %d\n", k, (*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num2))); + k = 2; + cprintf(RED, "p3 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset + k*1040)))->num1))); + cprintf(RED, "p3:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p2 num:%d - %d\n", k, (*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num2))); + k = 256; + cprintf(RED, "p257 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset + k*1040)))->num1))); + cprintf(RED, "p257:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p256 num:%d - %d\n", k, (*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num2))); + k = 512; + cprintf(RED, "p513 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset + k*1040)))->num1))); + cprintf(RED, "p513:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p512 num:%d - %d\n", k, (*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num2))); + k = 768; + cprintf(RED, "p769 fnum:0x%x\n", (*(unsigned int*)(((eiger_packet_header *)((char*)(buf + offset + k*1040)))->num1))); + cprintf(RED, "p769:0x%x\n", (*(uint8_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num3))); + cprintf(RED, "p768 num:%d - %d\n", k,(*(uint16_t*)(((eiger_packet_header *)((char*)(buf + offset +k*1040)))->num2))); + } +#endif +#endif + } while(numpackets > 0){ //for progress and packet loss calculation(new files) diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 8b0d52195..240784ea5 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -977,7 +977,9 @@ int slsReceiverTCPIPInterface::read_frame(){ int slsReceiverTCPIPInterface::moench_read_frame(){ ret=OK; char fName[MAX_STR_LENGTH]=""; - int arg = -1,i; + int acquisitionIndex = -1; + int frameIndex= -1; + int i; int bufferSize = MOENCH_BUFFER_SIZE; @@ -990,7 +992,8 @@ int slsReceiverTCPIPInterface::moench_read_frame(){ char* raw = new char[bufferSize]; - uint32_t startIndex=0; + uint32_t startAcquisitionIndex=0; + uint32_t startFrameIndex=0; uint32_t index = 0,bindex = 0, offset=0; strcpy(mess,"Could not read frame\n"); @@ -1001,18 +1004,18 @@ int slsReceiverTCPIPInterface::moench_read_frame(){ /**send garbage with -1 index to try again*/ if(!receiverBase->getFramesCaught()){ - arg = -1; + startAcquisitionIndex = -1; cout<<"haven't caught any frame yet"<getStartFrameIndex();*/ - receiverBase->readFrame(fName,&raw,index,startIndex); + receiverBase->readFrame(fName,&raw,index,startAcquisitionIndex,startFrameIndex); /**send garbage with -1 index to try again*/ if (raw == NULL){ - arg = -1; + startAcquisitionIndex = -1; #ifdef VERBOSE cout<<"data not ready for gui yet"<SendDataOnly(fName,MAX_STR_LENGTH); - socket->SendDataOnly(&arg,sizeof(arg)); + socket->SendDataOnly(&acquisitionIndex,sizeof(acquisitionIndex)); + socket->SendDataOnly(&frameIndex,sizeof(frameIndex)); socket->SendDataOnly(retval,MOENCH_DATA_BYTES); } //return ok/fail @@ -1135,7 +1151,9 @@ int slsReceiverTCPIPInterface::moench_read_frame(){ int slsReceiverTCPIPInterface::gotthard_read_frame(){ ret=OK; char fName[MAX_STR_LENGTH]=""; - int arg = -1,i; + int acquisitionIndex = -1; + int frameIndex= -1; + int i; //retval is a full frame @@ -1161,7 +1179,8 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){ uint32_t index=0,index2=0; uint32_t pindex=0,pindex2=0; uint32_t bindex=0,bindex2=0; - uint32_t startIndex=0; + uint32_t startAcquisitionIndex=0; + uint32_t startFrameIndex=0; strcpy(mess,"Could not read frame\n"); @@ -1173,16 +1192,16 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){ /**send garbage with -1 index to try again*/ if(!receiverBase->getFramesCaught()){ - arg=-1; + startAcquisitionIndex=-1; cout<<"haven't caught any frame yet"<getStartFrameIndex();*/ - receiverBase->readFrame(fName,&raw,index,startIndex); + receiverBase->readFrame(fName,&raw,index,startAcquisitionIndex,startFrameIndex); /**send garbage with -1 index to try again*/ if (raw == NULL){ - arg = -1; + startAcquisitionIndex = -1; #ifdef VERBOSE cout<<"data not ready for gui yet"<SendDataOnly(fName,MAX_STR_LENGTH); - socket->SendDataOnly(&arg,sizeof(arg)); + socket->SendDataOnly(&acquisitionIndex,sizeof(acquisitionIndex)); + socket->SendDataOnly(&frameIndex,sizeof(frameIndex)); socket->SendDataOnly(retval,GOTTHARD_DATA_BYTES); } @@ -1297,7 +1332,9 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){ int slsReceiverTCPIPInterface::eiger_read_frame(){ ret=OK; char fName[MAX_STR_LENGTH]=""; - int arg = -1,i; + int acquisitionIndex = -1; + int frameIndex= -1; + int i; uint32_t index=0; int frameSize = EIGER_ONE_GIGA_ONE_PACKET_SIZE * packetsPerFrame; @@ -1309,7 +1346,8 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){ char* raw = new char[frameSize]; char* origVal = new char[frameSize]; char* retval = new char[dataSize]; - uint32_t startIndex=0; + uint32_t startAcquisitionIndex=0; + uint32_t startFrameIndex=0; strcpy(mess,"Could not read frame\n"); @@ -1320,7 +1358,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){ /**send garbage with -1 index to try again*/ if(!receiverBase->getFramesCaught()){ - arg=-1; + startAcquisitionIndex=-1; #ifdef VERBOSE cout<<"haven't caught any frame yet"<readFrame(fName,&raw,index,startIndex); + receiverBase->readFrame(fName,&raw,index,startAcquisitionIndex,startFrameIndex); #ifdef VERBOSE cout << "index:" << dec << index << endl; #endif /**send garbage with -1 index to try again*/ if (raw == NULL){ - arg = -1; + startAcquisitionIndex = -1; #ifdef VERBOSE cout<<"data not ready for gui yet"<SendDataOnly(fName,MAX_STR_LENGTH); - socket->SendDataOnly(&arg,sizeof(arg)); + socket->SendDataOnly(&acquisitionIndex,sizeof(acquisitionIndex)); + socket->SendDataOnly(&frameIndex,sizeof(frameIndex)); socket->SendDataOnly(retval,dataSize); }