mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
fixed call backs with new standard header
This commit is contained in:
parent
36e92c194d
commit
9f68fc6f3b
@ -503,15 +503,25 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg);
|
||||
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg);
|
||||
|
||||
|
||||
|
||||
@ -628,18 +638,29 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
void (*rawDataReadyCallBack)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*);
|
||||
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*);
|
||||
void *pRawDataReady;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
@ -560,15 +560,25 @@ class UDPInterface {
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
virtual void registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg) = 0;
|
||||
virtual void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -58,9 +58,10 @@ typedef struct {
|
||||
#define HEADER_SIZE_NUM_PACKETS 1
|
||||
#define ALL_MASK_32 0xFFFFFFFF
|
||||
|
||||
#define FILE_FRAME_HEADER_LENGTH (8*3)
|
||||
#define FILE_HEADER_TIMESTAMP_OFFSET 8 //start of frame/ bunch id
|
||||
#define FILE_HEADER_EXPLENGTH_OFFSET 16 //exposure length/ sub frame number
|
||||
#define SLS_DETECTOR_HEADER_VERSION 0x1
|
||||
//#define FILE_FRAME_HEADER_LENGTH (8*3)
|
||||
//#define FILE_HEADER_TIMESTAMP_OFFSET 8 //start of frame/ bunch id
|
||||
//#define FILE_HEADER_EXPLENGTH_OFFSET 16 //exposure length/ sub frame number
|
||||
|
||||
|
||||
|
||||
|
@ -82,15 +82,26 @@ class slsReceiver : private virtual slsReceiverDefs {
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg);
|
||||
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
@ -82,15 +82,25 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg);
|
||||
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg);
|
||||
|
||||
private:
|
||||
|
||||
@ -321,15 +331,25 @@ private:
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* index
|
||||
* frame number
|
||||
* timestamp/ bunch id
|
||||
* exposure length/ sub frame number
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* frameNumber is the frame number
|
||||
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
* packetNumber is the packet number
|
||||
* bunchId is the bunch id from beamline
|
||||
* timestamp is the time stamp with 10 MHz clock
|
||||
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||
* xCoord is the x coordinate in the complete detector system
|
||||
* yCoord is the y coordinate in the complete detector system
|
||||
* zCoord is the z coordinate in the complete detector system
|
||||
* debug is for debugging purposes
|
||||
* roundRNumber is the round robin set number
|
||||
* detType is the detector type see :: detectorType
|
||||
* version is the version number of this structure format
|
||||
* dataPointer is the pointer to the data
|
||||
* dataSize in bytes is the size of the data in bytes
|
||||
* fileDescriptor is the file descriptor
|
||||
*/
|
||||
void (*rawDataReadyCallBack)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*);
|
||||
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*);
|
||||
void *pRawDataReady;
|
||||
|
||||
|
||||
|
@ -72,10 +72,12 @@ public:
|
||||
|
||||
/**
|
||||
@sort register callback to be called when data are available (to process and/or save the data).
|
||||
\param func raw data ready callback. arguments are index, frame number, timestamp/ bunch id, exposure length/ sub frame number, datapointer, datasize in bytes, file descriptor
|
||||
\returns nothing
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(int index, uint64_t framenumber, uint64_t timestamp, uint64_t explength, char* datapointer, uint32_t datasize, FILE* filedescriptor, void*),void *arg);
|
||||
\param func raw data ready callback. arguments are frameNumber, expLength, packetNumber, bunchId, timestamp, modId, xCoord, yCoord, zCoord, debug, roundRNumber, detType, version, dataPointer, dataSize, fileDescriptor
|
||||
\returns nothing
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
|
||||
char* datapointer, uint32_t datasize, FILE* filedescriptor, void*),void *arg);
|
||||
|
||||
//receiver object
|
||||
slsReceiver* receiver;
|
||||
|
@ -116,6 +116,40 @@ public:
|
||||
STOPPED /**< acquisition stopped externally */
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@short structure for a Detector Packet or Image Header
|
||||
@li frameNumber is the frame number
|
||||
@li expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||
@li packetNumber is the packet number
|
||||
@li bunchId is the bunch id from beamline
|
||||
@li timestamp is the time stamp with 10 MHz clock
|
||||
@li modId is the unique module id (unique even for left, right, top, bottom)
|
||||
@li xCoord is the x coordinate in the complete detector system
|
||||
@li yCoord is the y coordinate in the complete detector system
|
||||
@li zCoord is the z coordinate in the complete detector system
|
||||
@li debug is for debugging purposes
|
||||
@li roundRNumber is the round robin set number
|
||||
@li detType is the detector type see :: detectorType
|
||||
@li version is the version number of this structure format
|
||||
*/
|
||||
typedef struct {
|
||||
uint64_t frameNumber; /**< is the frame number */
|
||||
uint32_t expLength; /**< is the subframe number (32 bit eiger) or real time exposure time in 100ns (others) */
|
||||
uint32_t packetNumber; /**< is the packet number */
|
||||
uint64_t bunchId; /**< is the bunch id from beamline */
|
||||
uint64_t timestamp; /**< is the time stamp with 10 MHz clock */
|
||||
uint16_t modId; /**< is the unique module id (unique even for left, right, top, bottom) */
|
||||
uint16_t xCoord; /**< is the x coordinate in the complete detector system */
|
||||
uint16_t yCoord; /**< is the y coordinate in the complete detector system */
|
||||
uint16_t zCoord; /**< is the z coordinate in the complete detector system */
|
||||
uint32_t debug; /**< is for debugging purposes */
|
||||
uint16_t roundRNumber; /**< is the round robin set number */
|
||||
uint8_t detType; /**< is the detector type see :: detectorType */
|
||||
uint8_t version; /**< is the version number of this structure format */
|
||||
} sls_detector_header;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
/** returns string from enabled/disabled
|
||||
\param b true or false
|
||||
|
@ -517,7 +517,8 @@ void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uin
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg){
|
||||
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg){
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
|
||||
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
||||
}
|
||||
for(int i=0;i<numberofWriterThreads;i++){
|
||||
latestData[i] = new char[bufferSize+FILE_FRAME_HEADER_LENGTH]();
|
||||
latestData[i] = new char[bufferSize+sizeof(sls_detector_header)]();
|
||||
}
|
||||
//restructure fifo
|
||||
numberofJobsPerBuffer = -1;
|
||||
@ -707,7 +707,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
|
||||
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
||||
}
|
||||
for(int i=0;i<numberofWriterThreads;i++){
|
||||
latestData[i] = new char[bufferSize+FILE_FRAME_HEADER_LENGTH]();
|
||||
latestData[i] = new char[bufferSize+sizeof(sls_detector_header)]();
|
||||
}
|
||||
|
||||
//restructure fifo
|
||||
@ -826,7 +826,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
||||
fifoSize = EIGER_FIFO_SIZE;
|
||||
fifoDepth = EIGER_FIFO_SIZE;
|
||||
footerOffset = EIGER_DATA_PACKET_HEADER_SIZE + oneDataSize;
|
||||
fifoBufferHeaderSize= (HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH);
|
||||
fifoBufferHeaderSize= (HEADER_SIZE_NUM_TOT_PACKETS + sizeof(sls_detector_header));
|
||||
excludeMissingPackets= true;
|
||||
break;
|
||||
case JUNGFRAUCTB:
|
||||
@ -854,7 +854,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
||||
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
||||
fifoDepth = JFRAU_FIFO_SIZE;
|
||||
fifoSize = JFRAU_FIFO_SIZE;
|
||||
fifoBufferHeaderSize= (HEADER_SIZE_NUM_TOT_PACKETS + FILE_FRAME_HEADER_LENGTH);
|
||||
fifoBufferHeaderSize= (HEADER_SIZE_NUM_TOT_PACKETS + sizeof(sls_detector_header));
|
||||
//footerOffset = Not applicable;
|
||||
excludeMissingPackets=true;
|
||||
break;
|
||||
@ -895,7 +895,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
||||
}
|
||||
for(int i=0; i<numberofWriterThreads; i++){
|
||||
if(excludeMissingPackets)
|
||||
latestData[i] = new char[bufferSize+FILE_FRAME_HEADER_LENGTH]();
|
||||
latestData[i] = new char[bufferSize+sizeof(sls_detector_header)]();
|
||||
else
|
||||
latestData[i] = new char[bufferSize]();
|
||||
}
|
||||
@ -1871,7 +1871,7 @@ void UDPStandardImplementation::startDataCallback(){
|
||||
int len = sprintf(buf,jsonFmt,type,shape, acquisitionIndex, frameIndex, subframeIndex,completeFileName[ithread]);
|
||||
zmq_send(zmqsocket, buf,len, ZMQ_SNDMORE);
|
||||
//send data
|
||||
zmq_send(zmqsocket, (latestData[ithread]+FILE_FRAME_HEADER_LENGTH), bufferSize, 0);
|
||||
zmq_send(zmqsocket, (latestData[ithread]+sizeof(sls_detector_header)), bufferSize, 0);
|
||||
//start clock after sending
|
||||
if(!frameToGuiFrequency){
|
||||
randomSendNow = false;
|
||||
@ -2296,28 +2296,25 @@ int UDPStandardImplementation::prepareAndListenBufferCompleteFrames(int ithread)
|
||||
}
|
||||
//------------------------------------------------------ got a complete frame --------------------------------------------------------
|
||||
|
||||
//write frame number
|
||||
(*((uint64_t*)(buffer[ithread]+HEADER_SIZE_NUM_TOT_PACKETS))) = fnum + startAcquisitionIndex;
|
||||
sls_detector_header* header = (sls_detector_header*) (buffer[ithread]+HEADER_SIZE_NUM_TOT_PACKETS);
|
||||
memset(header, 0, sizeof(sls_detector_header));
|
||||
header->frameNumber = (uint64_t) (fnum + startAcquisitionIndex);
|
||||
if (myDetectorType == EIGER && dynamicRange == 32)
|
||||
header->expLength = (uint32_t) snum;
|
||||
header->packetNumber = (uint32_t) packetsPerFrame;
|
||||
if (myDetectorType == JUNGFRAU)
|
||||
header->bunchId = (uint64_t) bnum;
|
||||
header->xCoord = (uint16_t) detID * numberofListeningThreads + ithread;
|
||||
header->detType = (uint8_t) myDetectorType;
|
||||
header->version = (uint8_t) SLS_DETECTOR_HEADER_VERSION;
|
||||
|
||||
#ifdef VERBOSE
|
||||
if(!ithread) cout << "fnum:" << (*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS))) << endl;
|
||||
if(!ithread)
|
||||
cprintf(BLUE,
|
||||
"framenumber:%llu\tsubfnum:%u\tpnum:%u\tbunchid:%llu\txcoord:%u\tdettype:%u\tversion:%u\n",
|
||||
header->frameNumber, header->expLength, header->packetNumber,
|
||||
header->bunchId, header->xCoord, header->detType, header->version);
|
||||
#endif
|
||||
switch (myDetectorType) {
|
||||
case JUNGFRAU:
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_TIMESTAMP_OFFSET))) = bnum;
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET))) = 0;
|
||||
break;
|
||||
case EIGER:
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_TIMESTAMP_OFFSET))) = 0;
|
||||
if (dynamicRange == 32)
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET))) = snum;
|
||||
else
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET))) = 0;
|
||||
break;
|
||||
default:
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_TIMESTAMP_OFFSET))) = 0;
|
||||
(*((uint64_t*)(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET))) = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
//write packet count to buffer
|
||||
*((uint32_t*)(buffer[ithread])) = packetsPerFrame;
|
||||
@ -2852,8 +2849,20 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
|
||||
|
||||
//callback to write data
|
||||
if (cbAction < DO_EVERYTHING)
|
||||
rawDataReadyCallBack(detID*numberofListeningThreads+ithread, tempframenumber,
|
||||
0,0,
|
||||
rawDataReadyCallBack(
|
||||
tempframenumber,//frameNumber
|
||||
0,//expLength
|
||||
0,//packetNumber
|
||||
0,//bunchId
|
||||
0,//timestamp
|
||||
0,//modId
|
||||
detID*numberofListeningThreads+ithread,//xCoord
|
||||
0,//yCoord
|
||||
0,//zCoord
|
||||
0,//debug
|
||||
0,//roundRNumber
|
||||
(uint8_t)myDetectorType,//detType
|
||||
SLS_DETECTOR_HEADER_VERSION,//version
|
||||
wbuffer + fifoBufferHeaderSize,
|
||||
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
||||
sfilefd[ithread], pRawDataReady);//know which thread from sfilefd
|
||||
@ -2898,15 +2907,25 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
|
||||
void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuffer){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
|
||||
//get current frame number
|
||||
uint64_t tempframenumber = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS)));
|
||||
uint64_t bnum = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_TIMESTAMP_OFFSET)));
|
||||
uint64_t snum = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET)));
|
||||
|
||||
//get header
|
||||
sls_detector_header* header = (sls_detector_header*) (wbuffer + HEADER_SIZE_NUM_TOT_PACKETS);
|
||||
uint64_t tempframenumber = header->frameNumber;
|
||||
|
||||
if (cbAction < DO_EVERYTHING)
|
||||
rawDataReadyCallBack(detID*numberofListeningThreads+ithread, tempframenumber,
|
||||
bnum, snum,
|
||||
rawDataReadyCallBack(
|
||||
header->frameNumber,
|
||||
header->expLength,
|
||||
header->packetNumber,
|
||||
header->bunchId,
|
||||
header->timestamp,
|
||||
header->modId,
|
||||
header->xCoord,
|
||||
header->yCoord,
|
||||
header->zCoord,
|
||||
header->debug,
|
||||
header->roundRNumber,
|
||||
header->detType,
|
||||
header->version,
|
||||
wbuffer + fifoBufferHeaderSize,
|
||||
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
||||
sfilefd[ithread], pRawDataReady);
|
||||
@ -2916,7 +2935,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf
|
||||
if((fileWriteEnable) && (sfilefd[ithread])){
|
||||
if(tempframenumber && (tempframenumber%maxFramesPerFile) == 0)
|
||||
createNewFile(ithread);
|
||||
fwrite(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS, 1, (bufferSize + FILE_FRAME_HEADER_LENGTH), sfilefd[ithread]);
|
||||
fwrite(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS, 1, (bufferSize + sizeof(sls_detector_header)), sfilefd[ithread]);
|
||||
}
|
||||
|
||||
tempframenumber -= startFrameIndex;
|
||||
@ -3179,7 +3198,7 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
||||
strcpy(guiFileName[ithread],completeFileName[ithread]);
|
||||
|
||||
if(excludeMissingPackets) //copy also the header
|
||||
memcpy(latestData[ithread],buffer+HEADER_SIZE_NUM_TOT_PACKETS, bufferSize + FILE_FRAME_HEADER_LENGTH);
|
||||
memcpy(latestData[ithread],buffer+ HEADER_SIZE_NUM_TOT_PACKETS, bufferSize + sizeof(sls_detector_header));
|
||||
else //copy only the data
|
||||
memcpy(latestData[ithread],buffer+ fifoBufferHeaderSize , numpackets*onePacketSize);
|
||||
//let it know its got data
|
||||
|
@ -179,7 +179,8 @@ void slsReceiver::registerCallBackAcquisitionFinished(void (*func)(uint64_t, voi
|
||||
}
|
||||
|
||||
|
||||
void slsReceiver::registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg){
|
||||
void slsReceiver::registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg){
|
||||
//tcpipInterface
|
||||
if(udp_interface)
|
||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||
|
@ -3403,7 +3403,8 @@ void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func)
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*),void *arg){
|
||||
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||
char*, uint32_t, FILE*, void*),void *arg){
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ void slsReceiverUsers::stop() {
|
||||
receiver->stop();
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverUsers::closeFile(int p) {
|
||||
receiver->closeFile(p);
|
||||
}
|
||||
@ -26,19 +25,17 @@ int64_t slsReceiverUsers::getReceiverVersion(){
|
||||
return receiver->getReceiverVersion();
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverUsers::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
||||
receiver->registerCallBackStartAcquisition(func,arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
||||
receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*), void *arg){
|
||||
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
|
||||
char* datapointer, uint32_t datasize, FILE* filedescriptor, void*), void *arg){
|
||||
receiver->registerCallBackRawDataReady(func,arg);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user