write number of frames and period in file header

This commit is contained in:
Dhanya Maliakal 2016-11-11 16:08:18 +01:00
parent c364b28922
commit 45fc87240f
2 changed files with 36 additions and 2 deletions

View File

@ -243,6 +243,13 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/
void closeFile(int ithread = 0);
/**
* Activate / Deactivate Receiver
* If deactivated, receiver will write dummy packets 0xFF
* (as it will receive nothing from detector)
*/
int setActivate(int enable = -1);
private:
/*************************************************************************
* Getters ***************************************************************
@ -601,7 +608,7 @@ private:
/** If file created successfully for all Writer Threads */
bool fileCreateSuccess;
const static int FILE_HEADER_SIZE = 400;
const static int FILE_HEADER_SIZE = 500;
char fileHeader[MAX_NUMBER_OF_WRITER_THREADS][FILE_HEADER_SIZE];

View File

@ -597,6 +597,10 @@ int UDPStandardImplementation::setAcquisitionPeriod(const uint64_t i){
FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s";
if(myDetectorType == EIGER)
for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++)
updateFileHeader(i);
return OK;
}
@ -610,6 +614,10 @@ int UDPStandardImplementation::setNumberOfFrames(const uint64_t i){
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames;
if(myDetectorType == EIGER)
for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++)
updateFileHeader(i);
return OK;
}
@ -1234,6 +1242,21 @@ void UDPStandardImplementation::closeFile(int ithread){
}
//eiger only
int UDPStandardImplementation::setActivate(int enable){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(enable != -1){
activated = enable;
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
}
for(int i=0; i<MAX_NUMBER_OF_WRITER_THREADS; i++)
updateFileHeader(i);
return activated;
}
/*************************************************************************
@ -3139,6 +3162,8 @@ void UDPStandardImplementation::updateFileHeader(int ithread){
"Data\t\t: %d bytes\n"
"x\t\t: %d pixels\n"
"y\t\t: %d pixels\n"
"Frames\t\t: %lld\n"
"Period (ns)\t: %lld\n"
"Timestamp\t: %s\n\n"
//only for eiger right now
@ -3158,9 +3183,11 @@ void UDPStandardImplementation::updateFileHeader(int ithread){
onePacketSize,oneDataSize,
//only for eiger right now
EIGER_PIXELS_IN_ONE_ROW,EIGER_PIXELS_IN_ONE_COL,
(long long int)numberOfFrames,
(long long int)acquisitionPeriod,
ctime(&t));
if(strlen(fileHeader[ithread]) > FILE_HEADER_SIZE)
cprintf(BG_RED,"File Header Size is too small for file header\n");
cprintf(BG_RED,"File Header Size %d is too small for fixed file header size %d\n",strlen(fileHeader[ithread]),FILE_HEADER_SIZE);
}