mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07:13 +02:00
client and receiver: silent mode put into shared memory, works properly now
This commit is contained in:
@ -53,7 +53,7 @@ int BinaryFile::CreateFile(uint64_t fnum) {
|
||||
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
|
||||
return FAIL;
|
||||
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName;
|
||||
}
|
||||
return OK;
|
||||
@ -125,7 +125,7 @@ int BinaryFile::CreateMasterFile(bool en, uint32_t size,
|
||||
if (master && (*detIndex==0)) {
|
||||
masterFileName = BinaryFileStatic::CreateMasterFileName(filePath,
|
||||
fileNamePrefix, *fileIndex);
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
||||
}
|
||||
return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName,
|
||||
|
@ -27,7 +27,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
fileFormat* ftype, bool fwenable,
|
||||
bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
bool* fp, bool* act, bool* depaden,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm,
|
||||
void (*dataReadycb)(char*, char*, uint32_t, void*),
|
||||
void (*dataModifyReadycb)(char*, char*, uint32_t &, void*),
|
||||
void *pDataReadycb) :
|
||||
@ -49,6 +49,8 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
tempBuffer(0),
|
||||
activated(act),
|
||||
deactivatedPaddingEnable(depaden),
|
||||
silentMode(sm),
|
||||
framePadding(fp),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
@ -56,8 +58,6 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
numTotalFramesCaught(0),
|
||||
numFramesCaught(0),
|
||||
currentFrameIndex(0),
|
||||
silentMode(false),
|
||||
framePadding(fp),
|
||||
rawDataReadyCallBack(dataReadycb),
|
||||
rawDataModifyReadyCallBack(dataModifyReadycb),
|
||||
pRawDataReady(pDataReadycb)
|
||||
@ -236,13 +236,13 @@ void DataProcessor::SetupFileWriter(bool fwe, int* nd, uint32_t* maxf,
|
||||
file = new HDF5File(index, maxf,
|
||||
nd, fname, fpath, findex, owenable,
|
||||
dindex, nunits, nf, dr, portno,
|
||||
generalData->nPixelsX, generalData->nPixelsY, &silentMode);
|
||||
generalData->nPixelsX, generalData->nPixelsY, silentMode);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
file = new BinaryFile(index, maxf,
|
||||
nd, fname, fpath, findex, owenable,
|
||||
dindex, nunits, nf, dr, portno, &silentMode);
|
||||
dindex, nunits, nf, dr, portno, silentMode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -453,9 +453,6 @@ void DataProcessor::SetPixelDimension() {
|
||||
}
|
||||
}
|
||||
|
||||
void DataProcessor::SetSilentMode(bool mode) {
|
||||
silentMode = mode;
|
||||
}
|
||||
|
||||
void DataProcessor::PadMissingPackets(char* buf) {
|
||||
FILE_LOG(logDEBUG) << index << ": Padding Missing Packets";
|
||||
|
@ -16,7 +16,8 @@ using namespace std;
|
||||
const string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi, int* fd, char* ajh) :
|
||||
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
generalData(0),
|
||||
@ -25,14 +26,14 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, int* sEnable, uint64
|
||||
dynamicRange(dr),
|
||||
shortFrameEnable(sEnable),
|
||||
fileIndex(fi),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
silentMode(sm),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
firstMeasurementIndex(0),
|
||||
completeBuffer(0),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
silentMode(false)
|
||||
completeBuffer(0)
|
||||
{
|
||||
if(ThreadObject::CreateThread() == FAIL)
|
||||
throw std::exception();
|
||||
@ -272,7 +273,3 @@ int DataStreamer::RestreamStop() {
|
||||
}
|
||||
|
||||
|
||||
void DataStreamer::SetSilentMode(bool mode) {
|
||||
silentMode = mode;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ void File::PrintMembers() {
|
||||
<< "UDP Port number: " << *udpPortNumber << endl
|
||||
<< "Master File Name: " << masterFileName << endl
|
||||
<< "Current File Name: " << currentFileName << endl
|
||||
<< "Silent Mode: " << silentMode;
|
||||
<< "Silent Mode: " << *silentMode;
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,7 +159,7 @@ int HDF5File::CreateFile(uint64_t fnum) {
|
||||
if (dataspace == NULL)
|
||||
cprintf(RED,"Got nothing!\n");
|
||||
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName;
|
||||
}
|
||||
return OK;
|
||||
@ -215,7 +215,7 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
||||
if (fnum >= extNumImages) {
|
||||
if (HDF5FileStatic::ExtendDataset(index, dataspace, dataset,
|
||||
dataspace_para, dataset_para, *numImages) == OK) {
|
||||
if (!silentMode) {
|
||||
if (!(*silentMode)) {
|
||||
cprintf(BLUE,"%d Extending HDF5 dataset by %llu, Total x Dimension: %llu\n",
|
||||
index, (long long unsigned int)extNumImages,
|
||||
(long long unsigned int)(extNumImages + *numImages));
|
||||
@ -258,7 +258,7 @@ int HDF5File::CreateMasterFile(bool en, uint32_t size,
|
||||
virtualfd = 0;
|
||||
masterFileName = HDF5FileStatic::CreateMasterFileName(filePath,
|
||||
fileNamePrefix, *fileIndex);
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
||||
}
|
||||
pthread_mutex_lock(&Mutex);
|
||||
@ -297,7 +297,13 @@ void HDF5File::EndofAcquisition(bool anyPacketsCaught, uint64_t numf) {
|
||||
// called only by the one maser receiver
|
||||
int HDF5File::CreateVirtualFile(uint64_t numf) {
|
||||
pthread_mutex_lock(&Mutex);
|
||||
int ret = HDF5FileStatic::CreateVirtualDataFile(
|
||||
|
||||
string vname = HDF5FileStatic::CreateVirtualFileName(filePath, fileNamePrefix, *fileIndex);
|
||||
if(!(*silentMode)) {
|
||||
FILE_LOG(logINFO) << "Virtual File: " << vname;
|
||||
}
|
||||
|
||||
int ret = HDF5FileStatic::CreateVirtualDataFile(vname,
|
||||
virtualfd, masterFileName,
|
||||
filePath, fileNamePrefix, *fileIndex, (*numImages > 1),
|
||||
*detIndex, *numUnitsPerDetector,
|
||||
|
@ -22,7 +22,7 @@ const string Listener::TypeName = "Listener";
|
||||
Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
|
||||
uint32_t* us, uint32_t* as, uint32_t* fpf,
|
||||
frameDiscardPolicy* fdp, bool* act, bool* depaden) :
|
||||
frameDiscardPolicy* fdp, bool* act, bool* depaden, bool* sm) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
generalData(0),
|
||||
@ -40,6 +40,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
frameDiscardMode(fdp),
|
||||
activated(act),
|
||||
deactivatedPaddingEnable(depaden),
|
||||
silentMode(sm),
|
||||
xcoord(0),
|
||||
ycoord(0),
|
||||
acquisitionStartedFlag(false),
|
||||
@ -54,8 +55,7 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
||||
listeningPacket(0),
|
||||
udpSocketAlive(0),
|
||||
numPacketsStatistic(0),
|
||||
numFramesStatistic(0),
|
||||
silentMode(false)
|
||||
numFramesStatistic(0)
|
||||
{
|
||||
if(ThreadObject::CreateThread() == FAIL)
|
||||
throw std::exception();
|
||||
@ -159,7 +159,7 @@ void Listener::RecordFirstIndices(uint64_t fnum) {
|
||||
firstAcquisitionIndex = fnum;
|
||||
}
|
||||
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
if (!index) cprintf(BLUE,"%d First Acquisition Index:%lu\n"
|
||||
"%d First Measurement Index:%lu\n",
|
||||
index, firstAcquisitionIndex,
|
||||
@ -237,11 +237,6 @@ void Listener::ShutDownUDPSocket() {
|
||||
}
|
||||
|
||||
|
||||
void Listener::SetSilentMode(bool mode) {
|
||||
silentMode = mode;
|
||||
}
|
||||
|
||||
|
||||
int Listener::CreateDummySocketForUDPSocketBufferSize(uint32_t s) {
|
||||
FILE_LOG(logINFO) << "Testing UDP Socket Buffer size with test port " << *udpPortNumber;
|
||||
|
||||
@ -349,7 +344,7 @@ void Listener::ThreadExecution() {
|
||||
fifo->PushAddress(buffer);
|
||||
|
||||
//Statistics
|
||||
if(!silentMode) {
|
||||
if(!(*silentMode)) {
|
||||
numFramesStatistic++;
|
||||
if (numFramesStatistic >=
|
||||
//second condition also for infinite #number of frames
|
||||
|
@ -91,7 +91,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader));
|
||||
|
||||
//***receiver parameters***
|
||||
silentMode = 0;
|
||||
silentMode = false;
|
||||
|
||||
}
|
||||
|
||||
@ -319,7 +319,7 @@ slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return status;}
|
||||
|
||||
uint32_t UDPBaseImplementation::getSilentMode() const{
|
||||
bool UDPBaseImplementation::getSilentMode() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return silentMode;}
|
||||
|
||||
@ -664,7 +664,7 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
|
||||
}
|
||||
|
||||
/***receiver parameters***/
|
||||
void UDPBaseImplementation::setSilentMode(const uint32_t i){
|
||||
void UDPBaseImplementation::setSilentMode(const bool i){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
||||
silentMode = i;
|
||||
|
@ -224,7 +224,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&shortFrameEnable, &fileIndex, flippedData, additionalJsonHeader);
|
||||
&shortFrameEnable, &fileIndex, flippedData, additionalJsonHeader, &silentMode);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
@ -309,19 +309,6 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) {
|
||||
}
|
||||
|
||||
|
||||
void UDPStandardImplementation::setSilentMode(const uint32_t i){
|
||||
silentMode = i;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
(*it)->SetSilentMode(i);
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetSilentMode(i);
|
||||
for (vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it)
|
||||
(*it)->SetSilentMode(i);
|
||||
|
||||
FILE_LOG(logINFO) << "Silent Mode: " << i;
|
||||
}
|
||||
|
||||
|
||||
int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
FILE_LOG(logDEBUG) << "Setting receiver type";
|
||||
@ -375,13 +362,13 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
|
||||
&udpPortNum[i], eth, &numberOfFrames, &dynamicRange,
|
||||
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile,
|
||||
&frameDiscardMode, &activated, &deactivatedPaddingEnable);
|
||||
&frameDiscardMode, &activated, &deactivatedPaddingEnable, &silentMode);
|
||||
listener.push_back(l);
|
||||
|
||||
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
||||
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||
&dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode,
|
||||
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
||||
dataProcessor.push_back(p);
|
||||
}
|
||||
|
@ -721,6 +721,11 @@ int slsReceiverTCPIPInterface::send_update() {
|
||||
#endif
|
||||
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
||||
|
||||
// silent mode
|
||||
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
|
||||
ind=(int)receiverBase->getSilentMode();
|
||||
#endif
|
||||
n += mySock->SendDataOnly(&ind,sizeof(ind));
|
||||
|
||||
if (!lockStatus)
|
||||
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
||||
@ -2437,7 +2442,7 @@ int slsReceiverTCPIPInterface::set_silent_mode() {
|
||||
}
|
||||
}
|
||||
//get
|
||||
retval = receiverBase->getSilentMode(); // no check required
|
||||
retval = (int)receiverBase->getSilentMode(); // no check required
|
||||
}
|
||||
#endif
|
||||
#ifdef VERYVERBOSE
|
||||
|
Reference in New Issue
Block a user