This commit is contained in:
Dhanya Maliakal
2016-10-31 14:41:12 +01:00
parent 25e010a3d8
commit 89928246d2

View File

@ -2106,12 +2106,13 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
if(!receivedSize) return 0; if(!receivedSize) return 0;
header = (jfrau_packet_header_t*)(buffer[ithread] + offset); header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
currentpnum = (*( (uint8_t*) header->packetNumber)); currentpnum = (*( (uint8_t*) header->packetNumber));
cout<<"currentpnum:"<<currentpnum<<endl; cout<<"1 currentpnum:"<<currentpnum<<endl;
while(true){ while(true){
//correct packet //correct packet
if(currentpnum == pnum){ if(currentpnum == pnum){
cout<<"correct packet"<<endl;
//complete frame, get frame number while u can //complete frame, get frame number while u can
if(pnum == 0){ if(pnum == 0){
(*((uint32_t*)(buffer[ithread]+8))) = (*( (uint32_t*) header->frameNumber))&frameIndexMask; (*((uint32_t*)(buffer[ithread]+8))) = (*( (uint32_t*) header->frameNumber))&frameIndexMask;
@ -2119,16 +2120,23 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
} }
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset, oneDataSize); receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset, oneDataSize);
if(!receivedSize) return 0; if(!receivedSize) return 0;
cout<<"got data for " << pnum << endl;
offset+=oneDataSize; offset+=oneDataSize;
//got a complete frame //got a complete frame
if(pnum == 0) if(pnum == 0)
break; break;
pnum --; pnum --;
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + offset, JFRAU_HEADER_LENGTH);
if(!receivedSize) return 0;
header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
currentpnum = (*( (uint8_t*) header->packetNumber));
cout<<"next currentpnum:"<<currentpnum<<endl;
} }
//wrong packet //wrong packet
else{ else{
cout<<"wrong packet"<<endl;
pnum = packetsPerFrame-1; pnum = packetsPerFrame-1;
offset = fifoBufferHeaderSize; offset = fifoBufferHeaderSize;
//find the start of next image //find the start of next image
@ -2139,7 +2147,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
if(!receivedSize) return 0; if(!receivedSize) return 0;
header = (jfrau_packet_header_t*)(buffer[ithread] + offset); header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
currentpnum = (*( (uint8_t*) header->packetNumber)); currentpnum = (*( (uint8_t*) header->packetNumber));
cout<<"currentpnum:"<<currentpnum<<endl; cout<<"trying to find currentpnum:"<<currentpnum<<endl;
} }
} }
}//----- got a whole frame ------- }//----- got a whole frame -------