mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 02:20:42 +02:00
added gui stuff
This commit is contained in:
parent
a330706d86
commit
9c7fb4da38
@ -1743,7 +1743,7 @@ void UDPStandardImplementation::startDataCallback(){
|
||||
if(guiNumPackets[ithread] == dummyPacketValue){
|
||||
|
||||
//sending previous half frames if any
|
||||
if(newFrame){
|
||||
if((myDetectorType != JUNGFRAU) && newFrame){
|
||||
//send header
|
||||
//update frame details
|
||||
frameIndex = fnum;if(frameIndex==-1) cprintf(RED,"frameindex = -1, 111\n");
|
||||
@ -1797,6 +1797,27 @@ void UDPStandardImplementation::startDataCallback(){
|
||||
}
|
||||
}
|
||||
|
||||
if(myDetectorType == JUNGFRAU){
|
||||
//send header
|
||||
//update frame details
|
||||
frameIndex = (*((uint32_t*)(latestData[ithread]+8)));
|
||||
acquisitionIndex = frameIndex - startAcquisitionIndex;
|
||||
subframeIndex = -1;
|
||||
int len = sprintf(buf+JFRAU_FILE_FRAME_HEADER_LENGTH,jsonFmt,type,shape, acquisitionIndex, frameIndex, subframeIndex,completeFileName[ithread]);
|
||||
zmq_send(zmqsocket, buf,len, ZMQ_SNDMORE);
|
||||
//send data
|
||||
zmq_send(zmqsocket, latestData[ithread]+JFRAU_FILE_FRAME_HEADER_LENGTH, oneframesize, 0);
|
||||
//start clock after sending
|
||||
if(!frameToGuiFrequency){
|
||||
randomSendNow = false;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//eiger
|
||||
else{
|
||||
|
||||
size = guiNumPackets[ithread]*onePacketSize;
|
||||
datapacketscaught+=guiNumPackets[ithread];
|
||||
offset=0;
|
||||
@ -1895,6 +1916,7 @@ void UDPStandardImplementation::startDataCallback(){
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2110,17 +2132,17 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
||||
if(!receivedSize) return 0;
|
||||
header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
|
||||
currentpnum = (*( (uint8_t*) header->packetNumber));
|
||||
cout<<"1 currentpnum:"<<currentpnum<<endl;
|
||||
//cout<<"1 currentpnum:"<<currentpnum<<endl;
|
||||
|
||||
|
||||
while(true){
|
||||
|
||||
//correct packet
|
||||
if(currentpnum == pnum){
|
||||
cout<<"correct packet"<<endl;
|
||||
//cout<<"correct packet"<<endl;
|
||||
if(pnum == packetsPerFrame-1){
|
||||
(*((uint32_t*)(buffer[ithread]+8))) = (*( (uint32_t*) header->frameNumber))&frameIndexMask;
|
||||
cout<<"current fnum:"<<(*((uint32_t*)(buffer[ithread]+8)))<<endl;
|
||||
//cout<<"current fnum:"<<(*((uint32_t*)(buffer[ithread]+8)))<<endl;
|
||||
}
|
||||
|
||||
memcpy(buffer[ithread] + offset,buffer[ithread] + JFRAU_HEADER_LENGTH, oneDataSize);
|
||||
@ -2134,7 +2156,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
||||
if(!receivedSize) return 0;
|
||||
header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
|
||||
currentpnum = (*( (uint8_t*) header->packetNumber));
|
||||
cout<<"next currentpnum :"<<currentpnum<<endl;
|
||||
//cout<<"next currentpnum :"<<currentpnum<<endl;
|
||||
}
|
||||
|
||||
//wrong packet
|
||||
@ -2149,7 +2171,7 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
||||
if(!receivedSize) return 0;
|
||||
header = (jfrau_packet_header_t*)(buffer[ithread] + offset);
|
||||
currentpnum = (*( (uint8_t*) header->packetNumber));
|
||||
cout<<"trying to find currentpnum:"<<currentpnum<<endl;
|
||||
//cout<<"trying to find currentpnum:"<<currentpnum<<endl;
|
||||
}
|
||||
}
|
||||
}//----- got a whole frame -------
|
||||
@ -2157,7 +2179,6 @@ int UDPStandardImplementation::prepareAndListenBuffer(int ithread, int cSize, ch
|
||||
receivedSize = oneDataSize * packetsPerFrame;
|
||||
}
|
||||
else{
|
||||
cprintf(BG_RED,"should not be here, wrong det\n");
|
||||
receivedSize = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + fifoBufferHeaderSize + cSize, (bufferSize * numberofJobsPerBuffer) - cSize);
|
||||
//eiger returns 0 when header packet caught
|
||||
while(receivedSize < onePacketSize && status != TRANSMITTING)
|
||||
@ -3073,6 +3094,9 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
||||
//copy date
|
||||
guiNumPackets[ithread] = numpackets;
|
||||
strcpy(guiFileName[ithread],completeFileName[ithread]);
|
||||
if(myDetectorType == JUNGFRAU)
|
||||
memcpy(latestData[ithread],buffer, numpackets*onePacketSize);
|
||||
else
|
||||
memcpy(latestData[ithread],buffer+ fifoBufferHeaderSize , numpackets*onePacketSize);
|
||||
//let it know its got data
|
||||
sem_post(&dataCallbackWriterSemaphore[ithread]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user