diff --git a/slsReceiverSoftware/include/UDPBaseImplementation.h b/slsReceiverSoftware/include/UDPBaseImplementation.h index 0519d1a56..6c7a1b500 100644 --- a/slsReceiverSoftware/include/UDPBaseImplementation.h +++ b/slsReceiverSoftware/include/UDPBaseImplementation.h @@ -488,8 +488,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter * * return value is * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 1 we open, close, write file, callback does not do anything */ void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg); @@ -518,10 +517,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter * 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)(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); + char*, uint32_t, void*),void *arg); @@ -620,8 +618,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter * * return value is * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 1 we open, close, write file, callback does not do anything */ int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*); void *pStartAcquisition; @@ -653,10 +650,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter * 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)(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*); + char*, uint32_t, void*); void *pRawDataReady; diff --git a/slsReceiverSoftware/include/UDPInterface.h b/slsReceiverSoftware/include/UDPInterface.h index de497a0b6..5aa47b58e 100644 --- a/slsReceiverSoftware/include/UDPInterface.h +++ b/slsReceiverSoftware/include/UDPInterface.h @@ -544,9 +544,8 @@ class UDPInterface { * datasize * * return value is - * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 0 callback takes care of open,close,write file + * 1 we open, close, write file, callback does not do anything */ virtual void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) = 0; @@ -575,10 +574,9 @@ class UDPInterface { * 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)(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; + char*, uint32_t, void*),void *arg) = 0; protected: diff --git a/slsReceiverSoftware/include/receiver_defs.h b/slsReceiverSoftware/include/receiver_defs.h index 795557dee..fe142ddea 100755 --- a/slsReceiverSoftware/include/receiver_defs.h +++ b/slsReceiverSoftware/include/receiver_defs.h @@ -47,8 +47,7 @@ typedef struct { #define GOODBYE -200 #define DO_NOTHING 0 -#define CREATE_FILES 1 -#define DO_EVERYTHING 2 +#define DO_EVERYTHING 1 #define BUF_SIZE (16*1024*1024) //16mb #define SAMPLE_TIME_IN_NS 100000000//100ms diff --git a/slsReceiverSoftware/include/slsReceiver.h b/slsReceiverSoftware/include/slsReceiver.h index 35feec9f4..7617f43f7 100644 --- a/slsReceiverSoftware/include/slsReceiver.h +++ b/slsReceiverSoftware/include/slsReceiver.h @@ -67,8 +67,7 @@ class slsReceiver : private virtual slsReceiverDefs { * * return value is * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 1 we open, close, write file, callback does not do anything */ void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg); @@ -97,10 +96,9 @@ class slsReceiver : private virtual slsReceiverDefs { * 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)(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); + char*, uint32_t, void*),void *arg); diff --git a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h index bed74d936..d497f8fb8 100644 --- a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h +++ b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h @@ -67,8 +67,7 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs { * * return value is * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 1 we open, close, write file, callback does not do anything */ void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg); @@ -97,11 +96,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs { * 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)(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); - + char*, uint32_t, void*),void *arg); private: /** @@ -313,8 +310,7 @@ private: * * return value is * 0 callback takes care of open,close,wrie file - * 1 callback writes file, we have to open, close it - * 2 we open, close, write file, callback does not do anything + * 1 we open, close, write file, callback does not do anything */ int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*); void *pStartAcquisition; @@ -346,10 +342,9 @@ private: * 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)(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*); + char*, uint32_t, void*); void *pRawDataReady; diff --git a/slsReceiverSoftware/include/slsReceiverUsers.h b/slsReceiverSoftware/include/slsReceiverUsers.h index c59e4cf13..ee60ed2cd 100644 --- a/slsReceiverSoftware/include/slsReceiverUsers.h +++ b/slsReceiverSoftware/include/slsReceiverUsers.h @@ -56,7 +56,7 @@ public: @sort register calbback for starting the acquisition \param func callback to be called when starting the acquisition. Its arguments are filepath, filename, fileindex, datasize - \returns 0 callback takes care of open,close,write file; 1 callback writes file, we have to open, close it; 2 we open, close, write file, callback does not do anything + \returns 0 callback takes care of open,close,write file; 1 we open, close, write file, callback does not do anything */ void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*),void *arg); @@ -72,12 +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 frameNumber, expLength, packetNumber, bunchId, timestamp, modId, xCoord, yCoord, zCoord, debug, roundRNumber, detType, version, dataPointer, dataSize, fileDescriptor + \param func raw data ready callback. arguments are frameNumber, expLength, packetNumber, bunchId, timestamp, modId, xCoord, yCoord, zCoord, debug, roundRNumber, detType, version, dataPointer, dataSize \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); + char* datapointer, uint32_t datasize, void*),void *arg); //receiver object slsReceiver* receiver; diff --git a/slsReceiverSoftware/src/UDPBaseImplementation.cpp b/slsReceiverSoftware/src/UDPBaseImplementation.cpp index 8d184ed82..5539b4d95 100644 --- a/slsReceiverSoftware/src/UDPBaseImplementation.cpp +++ b/slsReceiverSoftware/src/UDPBaseImplementation.cpp @@ -518,7 +518,7 @@ void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uin } 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){ + char*, uint32_t, void*),void *arg){ rawDataReadyCallBack=func; pRawDataReady=arg; } diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 46548b3dd..0c2a6d063 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -1536,7 +1536,7 @@ int UDPStandardImplementation::setupWriter(){ cbAction=startAcquisitionCallBack(filePath, (char*)tempname.c_str(),fileIndex, (uint32_t)bufferSize,pStartAcquisition); } - if(cbAction < DO_EVERYTHING){ + if(cbAction == DO_NOTHING){ FILE_LOG(logINFO) << "Call back activated. Data saving must be taken care of by user in call back."; if (rawDataReadyCallBack){ FILE_LOG(logINFO) << "Data Write has been defined externally"; @@ -1587,12 +1587,12 @@ int UDPStandardImplementation::createNewFile(int ithread){ #endif //filewrite enable & we allowed to create/close files - if(fileWriteEnable && cbAction > DO_NOTHING){ + if(fileWriteEnable && cbAction == DO_EVERYTHING){ //close file pointers if(sfilefd[ithread]){ //all threads need to close file, reset mask and exit loop - if(myDetectorType == EIGER && fileWriteEnable && (cbAction > DO_NOTHING)){ + if(myDetectorType == EIGER && fileWriteEnable && (cbAction == DO_EVERYTHING)){ updateFileHeader(ithread); fseek(sfilefd[ithread],0,0); fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]); @@ -2732,7 +2732,7 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){ //all threads need to close file, reset mask and exit loop - if(myDetectorType == EIGER && fileWriteEnable && (cbAction > DO_NOTHING)){ + if(myDetectorType == EIGER && fileWriteEnable && (cbAction == DO_EVERYTHING)){ updateFileHeader(ithread); fseek(sfilefd[ithread],0,0); fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]); @@ -2891,7 +2891,7 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char* //callback to write data - if (cbAction < DO_EVERYTHING) + if (cbAction == DO_NOTHING) rawDataReadyCallBack( tempframenumber,//frameNumber 0,//expLength @@ -2908,7 +2908,7 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char* SLS_DETECTOR_HEADER_VERSION,//version wbuffer + fifoBufferHeaderSize, bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize, - sfilefd[ithread], pRawDataReady);//know which thread from sfilefd + pRawDataReady);//know which thread from sfilefd @@ -2954,7 +2954,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf sls_detector_header* header = (sls_detector_header*) (wbuffer + HEADER_SIZE_NUM_TOT_PACKETS); uint64_t tempframenumber = header->frameNumber; - if (cbAction < DO_EVERYTHING) + if (cbAction == DO_NOTHING) rawDataReadyCallBack( header->frameNumber, header->expLength, @@ -2971,7 +2971,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf header->version, wbuffer + fifoBufferHeaderSize, bufferSize * numberofJobsPerBuffer + fifoBufferHeaderSize, - sfilefd[ithread], pRawDataReady); + pRawDataReady); //write to file if enabled and update write parameters diff --git a/slsReceiverSoftware/src/slsReceiver.cpp b/slsReceiverSoftware/src/slsReceiver.cpp index 0db3dc793..4a28ab8e1 100644 --- a/slsReceiverSoftware/src/slsReceiver.cpp +++ b/slsReceiverSoftware/src/slsReceiver.cpp @@ -180,7 +180,7 @@ void slsReceiver::registerCallBackAcquisitionFinished(void (*func)(uint64_t, voi 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){ + char*, uint32_t, void*),void *arg){ //tcpipInterface if(udp_interface) udp_interface->registerCallBackRawDataReady(func,arg); diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index a21bc8ca8..8f4fd537a 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -3404,7 +3404,7 @@ void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func) } 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){ + char*, uint32_t, void*),void *arg){ rawDataReadyCallBack=func; pRawDataReady=arg; } diff --git a/slsReceiverSoftware/src/slsReceiverUsers.cpp b/slsReceiverSoftware/src/slsReceiverUsers.cpp index 512e838ac..a0126764d 100644 --- a/slsReceiverSoftware/src/slsReceiverUsers.cpp +++ b/slsReceiverSoftware/src/slsReceiverUsers.cpp @@ -35,7 +35,7 @@ void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(uint64_t 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){ + char* datapointer, uint32_t datasize, void*), void *arg){ receiver->registerCallBackRawDataReady(func,arg); }