mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +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
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -560,15 +560,25 @@ class UDPInterface {
|
|||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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:
|
protected:
|
||||||
|
@ -58,9 +58,10 @@ typedef struct {
|
|||||||
#define HEADER_SIZE_NUM_PACKETS 1
|
#define HEADER_SIZE_NUM_PACKETS 1
|
||||||
#define ALL_MASK_32 0xFFFFFFFF
|
#define ALL_MASK_32 0xFFFFFFFF
|
||||||
|
|
||||||
#define FILE_FRAME_HEADER_LENGTH (8*3)
|
#define SLS_DETECTOR_HEADER_VERSION 0x1
|
||||||
#define FILE_HEADER_TIMESTAMP_OFFSET 8 //start of frame/ bunch id
|
//#define FILE_FRAME_HEADER_LENGTH (8*3)
|
||||||
#define FILE_HEADER_EXPLENGTH_OFFSET 16 //exposure length/ sub frame number
|
//#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
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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:
|
private:
|
||||||
|
@ -82,15 +82,25 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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:
|
private:
|
||||||
|
|
||||||
@ -321,15 +331,25 @@ private:
|
|||||||
/**
|
/**
|
||||||
* Call back for raw data
|
* Call back for raw data
|
||||||
* args to raw data ready callback are
|
* args to raw data ready callback are
|
||||||
* index
|
* frameNumber is the frame number
|
||||||
* frame number
|
* expLength is the subframe number (32 bit eiger) or real time exposure time in 100ns (others)
|
||||||
* timestamp/ bunch id
|
* packetNumber is the packet number
|
||||||
* exposure length/ sub frame number
|
* bunchId is the bunch id from beamline
|
||||||
* datapointer
|
* timestamp is the time stamp with 10 MHz clock
|
||||||
* datasize in bytes
|
* modId is the unique module id (unique even for left, right, top, bottom)
|
||||||
* file descriptor
|
* 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;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,10 +72,12 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
@sort register callback to be called when data are available (to process and/or save the data).
|
@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
|
\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
|
\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);
|
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
|
//receiver object
|
||||||
slsReceiver* receiver;
|
slsReceiver* receiver;
|
||||||
|
@ -116,6 +116,40 @@ public:
|
|||||||
STOPPED /**< acquisition stopped externally */
|
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
|
#ifdef __cplusplus
|
||||||
/** returns string from enabled/disabled
|
/** returns string from enabled/disabled
|
||||||
\param b true or false
|
\param b true or false
|
||||||
|
@ -517,7 +517,8 @@ void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uin
|
|||||||
pAcquisitionFinished=arg;
|
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;
|
rawDataReadyCallBack=func;
|
||||||
pRawDataReady=arg;
|
pRawDataReady=arg;
|
||||||
}
|
}
|
||||||
|
@ -650,7 +650,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
|
|||||||
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
||||||
}
|
}
|
||||||
for(int i=0;i<numberofWriterThreads;i++){
|
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
|
//restructure fifo
|
||||||
numberofJobsPerBuffer = -1;
|
numberofJobsPerBuffer = -1;
|
||||||
@ -707,7 +707,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
|
|||||||
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
if(latestData[i]){delete[] latestData[i];latestData[i] = 0;}
|
||||||
}
|
}
|
||||||
for(int i=0;i<numberofWriterThreads;i++){
|
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
|
//restructure fifo
|
||||||
@ -826,7 +826,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
fifoSize = EIGER_FIFO_SIZE;
|
fifoSize = EIGER_FIFO_SIZE;
|
||||||
fifoDepth = EIGER_FIFO_SIZE;
|
fifoDepth = EIGER_FIFO_SIZE;
|
||||||
footerOffset = EIGER_DATA_PACKET_HEADER_SIZE + oneDataSize;
|
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;
|
excludeMissingPackets= true;
|
||||||
break;
|
break;
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
@ -854,7 +854,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
maxFramesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
|
||||||
fifoDepth = JFRAU_FIFO_SIZE;
|
fifoDepth = JFRAU_FIFO_SIZE;
|
||||||
fifoSize = 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;
|
//footerOffset = Not applicable;
|
||||||
excludeMissingPackets=true;
|
excludeMissingPackets=true;
|
||||||
break;
|
break;
|
||||||
@ -895,7 +895,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
|||||||
}
|
}
|
||||||
for(int i=0; i<numberofWriterThreads; i++){
|
for(int i=0; i<numberofWriterThreads; i++){
|
||||||
if(excludeMissingPackets)
|
if(excludeMissingPackets)
|
||||||
latestData[i] = new char[bufferSize+FILE_FRAME_HEADER_LENGTH]();
|
latestData[i] = new char[bufferSize+sizeof(sls_detector_header)]();
|
||||||
else
|
else
|
||||||
latestData[i] = new char[bufferSize]();
|
latestData[i] = new char[bufferSize]();
|
||||||
}
|
}
|
||||||
@ -1871,7 +1871,7 @@ void UDPStandardImplementation::startDataCallback(){
|
|||||||
int len = sprintf(buf,jsonFmt,type,shape, acquisitionIndex, frameIndex, subframeIndex,completeFileName[ithread]);
|
int len = sprintf(buf,jsonFmt,type,shape, acquisitionIndex, frameIndex, subframeIndex,completeFileName[ithread]);
|
||||||
zmq_send(zmqsocket, buf,len, ZMQ_SNDMORE);
|
zmq_send(zmqsocket, buf,len, ZMQ_SNDMORE);
|
||||||
//send data
|
//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
|
//start clock after sending
|
||||||
if(!frameToGuiFrequency){
|
if(!frameToGuiFrequency){
|
||||||
randomSendNow = false;
|
randomSendNow = false;
|
||||||
@ -2296,28 +2296,25 @@ int UDPStandardImplementation::prepareAndListenBufferCompleteFrames(int ithread)
|
|||||||
}
|
}
|
||||||
//------------------------------------------------------ got a complete frame --------------------------------------------------------
|
//------------------------------------------------------ got a complete frame --------------------------------------------------------
|
||||||
|
|
||||||
//write frame number
|
sls_detector_header* header = (sls_detector_header*) (buffer[ithread]+HEADER_SIZE_NUM_TOT_PACKETS);
|
||||||
(*((uint64_t*)(buffer[ithread]+HEADER_SIZE_NUM_TOT_PACKETS))) = fnum + startAcquisitionIndex;
|
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
|
#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
|
#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
|
//write packet count to buffer
|
||||||
*((uint32_t*)(buffer[ithread])) = packetsPerFrame;
|
*((uint32_t*)(buffer[ithread])) = packetsPerFrame;
|
||||||
@ -2852,8 +2849,20 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
|
|||||||
|
|
||||||
//callback to write data
|
//callback to write data
|
||||||
if (cbAction < DO_EVERYTHING)
|
if (cbAction < DO_EVERYTHING)
|
||||||
rawDataReadyCallBack(detID*numberofListeningThreads+ithread, tempframenumber,
|
rawDataReadyCallBack(
|
||||||
0,0,
|
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,
|
wbuffer + fifoBufferHeaderSize,
|
||||||
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
||||||
sfilefd[ithread], pRawDataReady);//know which thread from sfilefd
|
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){
|
void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuffer){
|
||||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||||
|
|
||||||
//get current frame number
|
//get header
|
||||||
uint64_t tempframenumber = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS)));
|
sls_detector_header* header = (sls_detector_header*) (wbuffer + HEADER_SIZE_NUM_TOT_PACKETS);
|
||||||
uint64_t bnum = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_TIMESTAMP_OFFSET)));
|
uint64_t tempframenumber = header->frameNumber;
|
||||||
uint64_t snum = (*((uint64_t*)(wbuffer + HEADER_SIZE_NUM_TOT_PACKETS + FILE_HEADER_EXPLENGTH_OFFSET)));
|
|
||||||
|
|
||||||
|
|
||||||
if (cbAction < DO_EVERYTHING)
|
if (cbAction < DO_EVERYTHING)
|
||||||
rawDataReadyCallBack(detID*numberofListeningThreads+ithread, tempframenumber,
|
rawDataReadyCallBack(
|
||||||
bnum, snum,
|
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,
|
wbuffer + fifoBufferHeaderSize,
|
||||||
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize,
|
||||||
sfilefd[ithread], pRawDataReady);
|
sfilefd[ithread], pRawDataReady);
|
||||||
@ -2916,7 +2935,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf
|
|||||||
if((fileWriteEnable) && (sfilefd[ithread])){
|
if((fileWriteEnable) && (sfilefd[ithread])){
|
||||||
if(tempframenumber && (tempframenumber%maxFramesPerFile) == 0)
|
if(tempframenumber && (tempframenumber%maxFramesPerFile) == 0)
|
||||||
createNewFile(ithread);
|
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;
|
tempframenumber -= startFrameIndex;
|
||||||
@ -3179,7 +3198,7 @@ void UDPStandardImplementation::copyFrameToGui(int ithread, char* buffer, uint32
|
|||||||
strcpy(guiFileName[ithread],completeFileName[ithread]);
|
strcpy(guiFileName[ithread],completeFileName[ithread]);
|
||||||
|
|
||||||
if(excludeMissingPackets) //copy also the header
|
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
|
else //copy only the data
|
||||||
memcpy(latestData[ithread],buffer+ fifoBufferHeaderSize , numpackets*onePacketSize);
|
memcpy(latestData[ithread],buffer+ fifoBufferHeaderSize , numpackets*onePacketSize);
|
||||||
//let it know its got data
|
//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
|
//tcpipInterface
|
||||||
if(udp_interface)
|
if(udp_interface)
|
||||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||||
|
@ -3403,7 +3403,8 @@ void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func)
|
|||||||
pAcquisitionFinished=arg;
|
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;
|
rawDataReadyCallBack=func;
|
||||||
pRawDataReady=arg;
|
pRawDataReady=arg;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ void slsReceiverUsers::stop() {
|
|||||||
receiver->stop();
|
receiver->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsReceiverUsers::closeFile(int p) {
|
void slsReceiverUsers::closeFile(int p) {
|
||||||
receiver->closeFile(p);
|
receiver->closeFile(p);
|
||||||
}
|
}
|
||||||
@ -26,19 +25,17 @@ int64_t slsReceiverUsers::getReceiverVersion(){
|
|||||||
return receiver->getReceiverVersion();
|
return receiver->getReceiverVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void slsReceiverUsers::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
void slsReceiverUsers::registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg){
|
||||||
receiver->registerCallBackStartAcquisition(func,arg);
|
receiver->registerCallBackStartAcquisition(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg){
|
||||||
receiver->registerCallBackAcquisitionFinished(func,arg);
|
receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||||
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(int, uint64_t, uint64_t, uint64_t, char*, uint32_t, FILE*, void*), void *arg){
|
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);
|
receiver->registerCallBackRawDataReady(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user