mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
merge from 3.0 hotfixes done
This commit is contained in:
commit
72b71cd680
@ -1,9 +1,10 @@
|
||||
Path: slsDetectorsPackage/slsReceiverSoftware
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
|
||||
Repsitory UUID: 27301393e82602889700db12ab68a0c67a6f9736
|
||||
Revision: 657
|
||||
Branch: 3.0.1
|
||||
Repsitory UUID: 820bd8c6a08b5ac05dc6e28e6cfd5674f07d57f7
|
||||
Revision: 658
|
||||
Branch: hotfix2
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 662
|
||||
Last Changed Date: 2017-09-20 16:20:57.000000002 +0200 ./src/UDPStandardImplementation.cpp
|
||||
Last Changed Rev: 663
|
||||
Last Changed Date: 2017-10-18 15:51:33.000000002 +0200 ./src/UDPStandardImplementation.cpp
|
||||
|
||||
|
@ -26,14 +26,14 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataProcessors
|
||||
* @param f address of Fifo pointer
|
||||
* @param ftype pointer to file format type
|
||||
* @param fwenable pointer to file writer enable
|
||||
* @param fwenable file writer enable
|
||||
* @param dsEnable pointer to data stream enable
|
||||
* @param freq pointer to streaming frequency
|
||||
* @param timer pointer to timer if streaming frequency is random
|
||||
* @param dataReadycb pointer to data ready call back function
|
||||
* @param pDataReadycb pointer to arguments of data ready call back function
|
||||
*/
|
||||
DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
|
||||
DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
void (*dataReadycb)(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, void*),
|
||||
@ -162,6 +162,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
|
||||
/**
|
||||
* Set up file writer object and call backs
|
||||
* @param fwe file write enable
|
||||
* @param nd pointer to number of detectors in each dimension
|
||||
* @param fname pointer to file name prefix
|
||||
* @param fpath pointer to file path
|
||||
@ -175,7 +176,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param portno pointer to udp port number
|
||||
* @param g address of GeneralData (Detector Data) pointer
|
||||
*/
|
||||
void SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
void SetupFileWriter(bool fwe, int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, GeneralData* g = 0);
|
||||
|
||||
|
||||
@ -306,7 +307,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
fileFormat* fileFormatType;
|
||||
|
||||
/** File Write Enable */
|
||||
bool* fileWriteEnable;
|
||||
bool fileWriteEnable;
|
||||
|
||||
/** Pointer to Streaming frequency, if 0, sending random images with a timer */
|
||||
uint32_t* streamingFrequency;
|
||||
@ -320,6 +321,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** timer beginning stamp for random streaming */
|
||||
struct timespec timerBegin;
|
||||
|
||||
/** x coord hardcoded, as detector does not send them yet **/
|
||||
uint16_t xcoord;
|
||||
|
||||
|
||||
|
||||
//acquisition start
|
||||
|
@ -59,6 +59,12 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
void setFileFormat(slsReceiverDefs::fileFormat f);
|
||||
|
||||
/**
|
||||
* Set File Write Enable
|
||||
* @param b true for file write enable, else false
|
||||
*/
|
||||
void setFileWriteEnable(const bool b);
|
||||
|
||||
/**
|
||||
* Set Short Frame Enabled, later will be moved to getROI (so far only for gotthard)
|
||||
* @param i index of adc enabled, else -1 if all enabled
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "27301393e82602889700db12ab68a0c67a6f9736"
|
||||
//#define SVNREV 0x662
|
||||
#define SVNREPUUID "820bd8c6a08b5ac05dc6e28e6cfd5674f07d57f7"
|
||||
//#define SVNREV 0x663
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x662
|
||||
#define SVNDATE 0x20170920
|
||||
#define SVNREV 0x663
|
||||
#define SVNDATE 0x20171018
|
||||
//
|
||||
|
@ -33,7 +33,7 @@ pthread_mutex_t DataProcessor::Mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
bool DataProcessor::SilentMode(false);
|
||||
|
||||
|
||||
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable,
|
||||
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
void (*dataReadycb)(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, void*),
|
||||
@ -49,6 +49,7 @@ DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool*
|
||||
streamingFrequency(freq),
|
||||
streamingTimerInMs(timer),
|
||||
currentFreqCount(0),
|
||||
xcoord(0),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -214,30 +215,35 @@ int DataProcessor::SetThreadPriority(int priority) {
|
||||
|
||||
|
||||
void DataProcessor::SetFileFormat(const fileFormat f) {
|
||||
if (file->GetFileType() != f) {
|
||||
if (file && file->GetFileType() != f) {
|
||||
//remember the pointer values before they are destroyed
|
||||
int nd[MAX_DIMENSIONS];nd[0] = 0; nd[1] = 0;
|
||||
char* fname=0; char* fpath=0; uint64_t* findex=0; bool* frindexenable=0;
|
||||
bool* owenable=0; int* dindex=0; int* nunits=0; uint64_t* nf = 0; uint32_t* dr = 0; uint32_t* port = 0;
|
||||
file->GetMemberPointerValues(nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, port);
|
||||
//create file writer with same pointers
|
||||
SetupFileWriter(nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, port);
|
||||
SetupFileWriter(fileWriteEnable, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
void DataProcessor::SetupFileWriter(bool fwe, int* nd, char* fname, char* fpath, uint64_t* findex,
|
||||
bool* frindexenable, bool* owenable, int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno,
|
||||
GeneralData* g)
|
||||
{
|
||||
fileWriteEnable = fwe;
|
||||
if (g)
|
||||
generalData = g;
|
||||
// fix xcoord as detector is not providing it right now
|
||||
xcoord = ((NumberofDataProcessors > (*nunits)) ? index : ((*dindex) * (*nunits)) + index);
|
||||
|
||||
if (file)
|
||||
delete file;
|
||||
|
||||
switch(*fileFormatType){
|
||||
if (file) {
|
||||
delete file; file = 0;
|
||||
}
|
||||
|
||||
if (fileWriteEnable) {
|
||||
switch(*fileFormatType){
|
||||
#ifdef HDF5C
|
||||
case HDF5:
|
||||
file = new HDF5File(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame,
|
||||
@ -253,11 +259,14 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
|
||||
frindexenable, owenable,
|
||||
dindex, nunits, nf, dr, portno, &SilentMode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// only the first file
|
||||
int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st, uint64_t ap) {
|
||||
if (file == NULL)
|
||||
return FAIL;
|
||||
file->CloseAllFiles();
|
||||
if (file->CreateMasterFile(en, generalData->imageSize, generalData->nPixelsX, generalData->nPixelsY,
|
||||
at, st, ap) == FAIL)
|
||||
@ -274,7 +283,7 @@ void DataProcessor::CloseFiles() {
|
||||
}
|
||||
|
||||
void DataProcessor::EndofAcquisition(uint64_t numf) {
|
||||
if (*fileWriteEnable && file->GetFileType() == HDF5) {
|
||||
if (file && file->GetFileType() == HDF5) {
|
||||
file->EndofAcquisition(numf);
|
||||
}
|
||||
}
|
||||
@ -318,7 +327,8 @@ void DataProcessor::StopProcessing(char* buf) {
|
||||
else
|
||||
fifo->FreeAddress(buf);
|
||||
|
||||
file->CloseCurrentFile();
|
||||
if (file)
|
||||
file->CloseCurrentFile();
|
||||
StopRunning();
|
||||
#ifdef VERBOSE
|
||||
FILE_LOG(logINFO) << index << ": Processing Completed";
|
||||
@ -361,7 +371,10 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
||||
}
|
||||
|
||||
|
||||
if (*fileWriteEnable)
|
||||
// fix x coord that is currently not provided by detector
|
||||
header->xCoord = xcoord;
|
||||
|
||||
if (file)
|
||||
file->WriteToFile(buf, generalData->imageSize + sizeof(sls_detector_header), fnum-firstMeasurementIndex, nump);
|
||||
|
||||
if (rawDataReadyCallBack) {
|
||||
|
@ -129,6 +129,21 @@ void UDPStandardImplementation::setFileFormat(const fileFormat f){
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::setFileWriteEnable(const bool b){
|
||||
|
||||
if (fileWriteEnable != b){
|
||||
fileWriteEnable = b;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet, fileName, filePath, &fileIndex, &frameIndexEnable,
|
||||
&overwriteEnable, &detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i], generalData);
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int UDPStandardImplementation::setShortFrameEnable(const int i) {
|
||||
if (myDetectorType != GOTTHARD) {
|
||||
@ -325,7 +340,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
for ( int i=0; i < numThreads; ++i ) {
|
||||
listener.push_back(new Listener(myDetectorType, fifo[i], &status, &udpPortNum[i], eth, &activated, &numberOfFrames, &dynamicRange));
|
||||
dataProcessor.push_back(new DataProcessor(fifo[i], &fileFormatType,
|
||||
&fileWriteEnable, &dataStreamEnable, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
||||
fileWriteEnable, &dataStreamEnable, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
||||
rawDataReadyCallBack,pRawDataReady));
|
||||
if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) {
|
||||
FILE_LOG (logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")";
|
||||
@ -359,7 +374,7 @@ void UDPStandardImplementation::setDetectorPositionId(const int i){
|
||||
detID = i;
|
||||
FILE_LOG(logINFO) << "Detector Position Id:" << detID;
|
||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
|
||||
dataProcessor[i]->SetupFileWriter((int*)numDet, fileName, filePath, &fileIndex, &frameIndexEnable,
|
||||
dataProcessor[i]->SetupFileWriter( fileWriteEnable, (int*)numDet, fileName, filePath, &fileIndex, &frameIndexEnable,
|
||||
&overwriteEnable, &detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i], generalData);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user