mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
removing the return value usage in start acquisition callback, callbacks will be called if registered, and we will write files if file write enabled
This commit is contained in:
parent
e450f5ec6a
commit
86490226ed
@ -486,9 +486,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is insignificant at the moment
|
||||||
* 0 callback takes care of open,close,wrie file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
||||||
|
|
||||||
@ -616,9 +616,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is insignificant at the moment
|
||||||
* 0 callback takes care of open,close,wrie file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
||||||
void *pStartAcquisition;
|
void *pStartAcquisition;
|
||||||
|
@ -543,9 +543,9 @@ class UDPInterface {
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is insignificant at the moment
|
||||||
* 0 callback takes care of open,close,write file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) = 0;
|
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg) = 0;
|
||||||
|
|
||||||
|
@ -832,13 +832,6 @@ private:
|
|||||||
pthread_mutex_t progressMutex;
|
pthread_mutex_t progressMutex;
|
||||||
|
|
||||||
|
|
||||||
//***callback***
|
|
||||||
/** The action which decides what the user and default responsibilities to save data are
|
|
||||||
* 0 raw data ready 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 */
|
|
||||||
int cbAction;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ class slsReceiver : private virtual slsReceiverDefs {
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is undefined at the moment
|
||||||
* 0 callback takes care of open,close,wrie file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is insignificant at the moment
|
||||||
* 0 callback takes care of open,close,wrie file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
void registerCallBackStartAcquisition(int (*func)(char*, char*, uint64_t, uint32_t, void*),void *arg);
|
||||||
|
|
||||||
@ -308,9 +308,9 @@ private:
|
|||||||
* fileindex
|
* fileindex
|
||||||
* datasize
|
* datasize
|
||||||
*
|
*
|
||||||
* return value is
|
* return value is insignificant at the moment
|
||||||
* 0 callback takes care of open,close,wrie file
|
* we write depending on file write enable
|
||||||
* 1 we open, close, write file, callback does not do anything
|
* users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
int (*startAcquisitionCallBack)(char*, char*, uint64_t, uint32_t, void*);
|
||||||
void *pStartAcquisition;
|
void *pStartAcquisition;
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
@sort register calbback for starting the acquisition
|
@sort register calbback for starting the acquisition
|
||||||
\param func callback to be called when starting the acquisition. Its arguments are filepath, filename, fileindex, datasize
|
\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 we open, close, write file, callback does not do anything
|
\return value is insignificant at the moment, we write depending on file write enable, users get data to write depending on call backs registered
|
||||||
*/
|
*/
|
||||||
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*),void *arg);
|
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*),void *arg);
|
||||||
|
|
||||||
|
@ -226,9 +226,6 @@ void UDPStandardImplementation::initializeMembers(){
|
|||||||
receiverData[i] = 0;
|
receiverData[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//***callback***
|
|
||||||
cbAction = DO_EVERYTHING;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1525,7 +1522,6 @@ int UDPStandardImplementation::setupWriter(){
|
|||||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||||
|
|
||||||
//acquisition start call back returns enable write
|
//acquisition start call back returns enable write
|
||||||
cbAction = DO_EVERYTHING;
|
|
||||||
if (startAcquisitionCallBack) {
|
if (startAcquisitionCallBack) {
|
||||||
//remove detector index in the file name
|
//remove detector index in the file name
|
||||||
int deti = -1;
|
int deti = -1;
|
||||||
@ -1533,17 +1529,13 @@ int UDPStandardImplementation::setupWriter(){
|
|||||||
size_t uscore=tempname.rfind("_");
|
size_t uscore=tempname.rfind("_");
|
||||||
if ((uscore!=string::npos) && (sscanf(tempname.substr(uscore+1,tempname.size()-uscore-1).c_str(),"d%d",&deti)))
|
if ((uscore!=string::npos) && (sscanf(tempname.substr(uscore+1,tempname.size()-uscore-1).c_str(),"d%d",&deti)))
|
||||||
tempname=tempname.substr(0,uscore);
|
tempname=tempname.substr(0,uscore);
|
||||||
cbAction=startAcquisitionCallBack(filePath, (char*)tempname.c_str(),fileIndex, (uint32_t)bufferSize,pStartAcquisition);
|
startAcquisitionCallBack(filePath, (char*)tempname.c_str(),fileIndex, (uint32_t)bufferSize,pStartAcquisition);
|
||||||
}
|
}
|
||||||
|
if (rawDataReadyCallBack)
|
||||||
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";
|
FILE_LOG(logINFO) << "Data Write has been defined externally";
|
||||||
}
|
if (!fileWriteEnable)
|
||||||
}else if(!fileWriteEnable){
|
|
||||||
FILE_LOG(logINFO) << "Data will not be saved";
|
FILE_LOG(logINFO) << "Data will not be saved";
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//creating first file
|
//creating first file
|
||||||
@ -1587,12 +1579,12 @@ int UDPStandardImplementation::createNewFile(int ithread){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//filewrite enable & we allowed to create/close files
|
//filewrite enable & we allowed to create/close files
|
||||||
if(fileWriteEnable && cbAction == DO_EVERYTHING){
|
if(fileWriteEnable){
|
||||||
|
|
||||||
//close file pointers
|
//close file pointers
|
||||||
if(sfilefd[ithread]){
|
if(sfilefd[ithread]){
|
||||||
//all threads need to close file, reset mask and exit loop
|
//all threads need to close file, reset mask and exit loop
|
||||||
if(myDetectorType == EIGER && fileWriteEnable && (cbAction == DO_EVERYTHING)){
|
if(myDetectorType == EIGER && fileWriteEnable){
|
||||||
updateFileHeader(ithread);
|
updateFileHeader(ithread);
|
||||||
fseek(sfilefd[ithread],0,0);
|
fseek(sfilefd[ithread],0,0);
|
||||||
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
||||||
@ -2732,7 +2724,7 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
|
|||||||
|
|
||||||
|
|
||||||
//all threads need to close file, reset mask and exit loop
|
//all threads need to close file, reset mask and exit loop
|
||||||
if(myDetectorType == EIGER && fileWriteEnable && (cbAction == DO_EVERYTHING)){
|
if(myDetectorType == EIGER && fileWriteEnable){
|
||||||
updateFileHeader(ithread);
|
updateFileHeader(ithread);
|
||||||
fseek(sfilefd[ithread],0,0);
|
fseek(sfilefd[ithread],0,0);
|
||||||
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
fwrite((void*)fileHeader[ithread], 1, FILE_HEADER_SIZE, sfilefd[ithread]);
|
||||||
@ -2891,7 +2883,7 @@ void UDPStandardImplementation::handleWithoutDataCompression(int ithread, char*
|
|||||||
|
|
||||||
|
|
||||||
//callback to write data
|
//callback to write data
|
||||||
if (cbAction == DO_NOTHING)
|
if (rawDataReadyCallBack)
|
||||||
rawDataReadyCallBack(
|
rawDataReadyCallBack(
|
||||||
tempframenumber,//frameNumber
|
tempframenumber,//frameNumber
|
||||||
0,//expLength
|
0,//expLength
|
||||||
@ -2954,7 +2946,7 @@ void UDPStandardImplementation::handleCompleteFramesOnly(int ithread, char* wbuf
|
|||||||
sls_detector_header* header = (sls_detector_header*) (wbuffer + HEADER_SIZE_NUM_TOT_PACKETS);
|
sls_detector_header* header = (sls_detector_header*) (wbuffer + HEADER_SIZE_NUM_TOT_PACKETS);
|
||||||
uint64_t tempframenumber = header->frameNumber;
|
uint64_t tempframenumber = header->frameNumber;
|
||||||
|
|
||||||
if (cbAction == DO_NOTHING)
|
if (rawDataReadyCallBack)
|
||||||
rawDataReadyCallBack(
|
rawDataReadyCallBack(
|
||||||
header->frameNumber,
|
header->frameNumber,
|
||||||
header->expLength,
|
header->expLength,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user