mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
feature with header in file
This commit is contained in:
parent
df04d9fb07
commit
a65920377c
@ -440,6 +440,11 @@ private:
|
||||
*/
|
||||
void createHeaders(char* wbuffer[]);
|
||||
|
||||
/**
|
||||
* Updates the file header char aray, each time the corresp parameter is changed
|
||||
*/
|
||||
void updateFileHeader();
|
||||
|
||||
/**
|
||||
* Called by handleWithoutDataCompression and handleWithCompression after writing to file
|
||||
* Copy frames for GUI and updates appropriate parameters for frequency frames to gui
|
||||
@ -467,6 +472,7 @@ private:
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Class Members *********************************************************
|
||||
*************************************************************************/
|
||||
@ -515,6 +521,8 @@ private:
|
||||
/** If file created successfully for all Writer Threads */
|
||||
bool fileCreateSuccess;
|
||||
|
||||
char fileHeader[1000];
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -138,6 +138,7 @@ void UDPStandardImplementation::initializeMembers(){
|
||||
strcpy(completeFileName,"");
|
||||
maxPacketsPerFile = 0;
|
||||
fileCreateSuccess = false;
|
||||
strcpy(fileHeader,"");
|
||||
|
||||
//***acquisition indices parameters***
|
||||
startAcquisitionIndex = 0;
|
||||
@ -536,6 +537,8 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i){
|
||||
frameSize = onePacketSize * packetsPerFrame;
|
||||
maxPacketsPerFile = EIGER_MAX_FRAMES_PER_FILE * packetsPerFrame;
|
||||
|
||||
updateFileHeader();
|
||||
|
||||
//new dynamic range, then restart threads and resetup fifo structure
|
||||
if(oldDynamicRange != dynamicRange){
|
||||
|
||||
@ -591,6 +594,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b){
|
||||
"\nmaxPacketsPerFile:" << maxPacketsPerFile;
|
||||
|
||||
|
||||
updateFileHeader();
|
||||
|
||||
//new enable, then restart threads and resetup fifo structure
|
||||
if(oldTenGigaEnable != tengigaEnable){
|
||||
@ -767,6 +771,10 @@ int UDPStandardImplementation::setDetectorType(const detectorType d){
|
||||
//allocate for latest data (frame copy for gui)
|
||||
latestData = new char[frameSize];
|
||||
|
||||
//updates File Header
|
||||
if(myDetectorType == EIGER)
|
||||
updateFileHeader();
|
||||
|
||||
FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d);
|
||||
|
||||
return OK;
|
||||
@ -1413,6 +1421,10 @@ int UDPStandardImplementation::createNewFile(){
|
||||
numTotMissingPacketsInFile = 0;
|
||||
}
|
||||
|
||||
//write file header
|
||||
if(myDetectorType == EIGER)
|
||||
fwrite((void*)fileHeader, 1, strlen(fileHeader), sfilefd);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -2801,7 +2813,7 @@ void UDPStandardImplementation::createHeaders(char* wbuffer[]){
|
||||
|
||||
//overwriting port number and dynamic range
|
||||
*( (uint8_t*) wbuf_header->portIndex) = (uint8_t)port;
|
||||
*( (uint8_t*) wbuf_header->dynamicRange) = (uint8_t)dynamicRange;
|
||||
//*( (uint8_t*) wbuf_header->dynamicRange) = (uint8_t)dynamicRange;
|
||||
|
||||
//DEBUGGING
|
||||
if(*( (uint16_t*) wbuf_footer->packetNumber) != (i+1)){
|
||||
@ -2820,6 +2832,48 @@ void UDPStandardImplementation::createHeaders(char* wbuffer[]){
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::updateFileHeader(){
|
||||
int xpix=-1,ypix=-1;
|
||||
|
||||
//create detector specific packet header
|
||||
char packetheader[1000];
|
||||
strcpy(packetheader,"");
|
||||
|
||||
//only for eiger right now
|
||||
/*switch(myDetectorType){
|
||||
case EIGER:
|
||||
*/ sprintf(packetheader,"#Packet Header\n"
|
||||
"Sub Frame Number 4 bytes\n"
|
||||
"Missing Packet\t 2 bytes\n"
|
||||
"Port Number\t 1 byte\n"
|
||||
"Unused\t\t 1 byte\n\n"
|
||||
"#Packet Footer\n"
|
||||
"Frame Number\t 6 bytes\n"
|
||||
"Packet Number\t 2 bytes\n");
|
||||
xpix = EIGER_PIXELS_IN_ONE_ROW;
|
||||
ypix = EIGER_PIXELS_IN_ONE_COL;
|
||||
/* break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
//update file header
|
||||
int length = sizeof(fileHeader);
|
||||
while(length!=strlen(fileHeader)){
|
||||
length = strlen(fileHeader);
|
||||
sprintf(fileHeader,"Header\t\t %d bytes\n"
|
||||
"Dynamic Range\t %d\n"
|
||||
"Packet\t\t %d bytes\n"
|
||||
"x\t\t %d pixels\n"
|
||||
"y\t\t %d pixels\n\n"
|
||||
"%s",
|
||||
length,dynamicRange,onePacketSize,xpix,ypix,packetheader);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::copyFrameToGui(char* buffer[]){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " called";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user