diff --git a/slsReceiverSoftware/include/BinaryFile.h b/slsReceiverSoftware/include/BinaryFile.h index 407ba1c59..7a1f1fdce 100644 --- a/slsReceiverSoftware/include/BinaryFile.h +++ b/slsReceiverSoftware/include/BinaryFile.h @@ -34,11 +34,13 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi * @param nf pointer to number of images in acquisition * @param dr pointer to dynamic range * @param portno pointer to udp port number for logging + * @param smode pointer to silent mode */ BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf, 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); + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, + bool* smode); /** * Destructor diff --git a/slsReceiverSoftware/include/DataProcessor.h b/slsReceiverSoftware/include/DataProcessor.h index 0f20f23e1..2b71205f6 100644 --- a/slsReceiverSoftware/include/DataProcessor.h +++ b/slsReceiverSoftware/include/DataProcessor.h @@ -64,6 +64,12 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject { */ static void ResetRunningMask(); + /** + * Set Silent Mode + * @param mode 1 sets 0 unsets + */ + static void SetSilentMode(bool mode); + //*** non static functions *** //*** getters *** /** @@ -285,6 +291,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject { /** Fifo structure */ Fifo* fifo; + /** Silent Mode */ + static bool SilentMode; + //individual members /** File writer implemented as binary or hdf5 File */ diff --git a/slsReceiverSoftware/include/DataStreamer.h b/slsReceiverSoftware/include/DataStreamer.h index 50d3f2e14..6db211be5 100644 --- a/slsReceiverSoftware/include/DataStreamer.h +++ b/slsReceiverSoftware/include/DataStreamer.h @@ -51,6 +51,12 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject { */ static void ResetRunningMask(); + /** + * Set Silent Mode + * @param mode 1 sets 0 unsets + */ + static void SetSilentMode(bool mode); + //*** non static functions *** //*** getters *** @@ -178,6 +184,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject { /** Fifo structure */ Fifo* fifo; + /** Silent Mode */ + static bool SilentMode; + + + /** ZMQ Socket - Receiver to Client */ ZmqSocket* zmqSocket; diff --git a/slsReceiverSoftware/include/File.h b/slsReceiverSoftware/include/File.h index ec61996f6..bbc53d5e2 100644 --- a/slsReceiverSoftware/include/File.h +++ b/slsReceiverSoftware/include/File.h @@ -34,11 +34,13 @@ class File : private virtual slsReceiverDefs { * @param nf pointer to number of images in acquisition * @param dr pointer to dynamic range * @param portno pointer to udp port number for logging + * @param smode pointer to silent mode */ File(int ind, uint32_t maxf, const uint32_t* ppf, 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); + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, + bool* smode); /** * Destructor @@ -220,5 +222,8 @@ class File : private virtual slsReceiverDefs { /** UDP Port Number for logging */ uint32_t* udpPortNumber; + /** Silent Mode */ + bool silentMode; + }; diff --git a/slsReceiverSoftware/include/HDF5File.h b/slsReceiverSoftware/include/HDF5File.h index c765fbfec..c3a2e6c11 100644 --- a/slsReceiverSoftware/include/HDF5File.h +++ b/slsReceiverSoftware/include/HDF5File.h @@ -42,12 +42,14 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt * @param portno pointer to udp port number for logging * @param nx number of pixels in x direction * @param ny number of pixels in y direction + * @param smode pointer to silent mode */ HDF5File(int ind, uint32_t maxf, const uint32_t* ppf, 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, - uint32_t nx, uint32_t ny); + uint32_t nx, uint32_t ny, + bool* smode); /** * Destructor diff --git a/slsReceiverSoftware/include/Listener.h b/slsReceiverSoftware/include/Listener.h index e2aa7c971..575add7e1 100644 --- a/slsReceiverSoftware/include/Listener.h +++ b/slsReceiverSoftware/include/Listener.h @@ -57,6 +57,12 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { */ static void ResetRunningMask(); + /** + * Set Silent Mode + * @param mode 1 sets 0 unsets + */ + static void SetSilentMode(bool mode); + //*** non static functions *** //*** getters *** @@ -217,6 +223,9 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { /** Fifo structure */ Fifo* fifo; + /** Silent Mode */ + static bool SilentMode; + // individual members /** Detector Type */ @@ -258,7 +267,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { uint64_t firstMeasurementIndex; - // for statistics + // for acquisition summary /** Number of complete Packets caught for each real time acquisition (eg. for each scan (start& stop of receiver)) */ volatile uint64_t numPacketsCaught; @@ -287,8 +296,12 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { /** if the udp socket is connected */ bool udpSocketAlive; + + // for print progress during acqusition + /** number of packets for statistic */ uint32_t numPacketsStatistic; + /** number of images for statistic */ uint32_t numFramesStatistic; }; diff --git a/slsReceiverSoftware/include/UDPBaseImplementation.h b/slsReceiverSoftware/include/UDPBaseImplementation.h index e24a305c5..906e18fe4 100644 --- a/slsReceiverSoftware/include/UDPBaseImplementation.h +++ b/slsReceiverSoftware/include/UDPBaseImplementation.h @@ -239,6 +239,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter */ runStatus getStatus() const; + /** + * Get Silent Mode + * @return silent mode + */ + uint32_t getSilentMode() const; + /** * Get activate * If deactivated, receiver will write dummy packets 0xFF @@ -438,6 +444,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter */ int setFifoDepth(const uint32_t i); + //***receiver parameters*** + /** + * Set Silent Mode + * @param i silent mode. 1 sets, 0 unsets + */ + void setSilentMode(const uint32_t i); /************************************************************************* * Behavioral functions*************************************************** @@ -653,6 +665,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter /** streaming port */ uint32_t streamingPort; + //***receiver parameters*** + uint32_t silentMode; + //***callback parameters*** /** diff --git a/slsReceiverSoftware/include/UDPInterface.h b/slsReceiverSoftware/include/UDPInterface.h index c0da7d055..bea127706 100644 --- a/slsReceiverSoftware/include/UDPInterface.h +++ b/slsReceiverSoftware/include/UDPInterface.h @@ -323,6 +323,12 @@ class UDPInterface { */ virtual slsReceiverDefs::runStatus getStatus() const = 0; + /** + * Get Silent Mode + * @return silent mode + */ + virtual uint32_t getSilentMode() const = 0; + /** * Get activate * If deactivated, receiver will write dummy packets 0xFF @@ -520,6 +526,14 @@ class UDPInterface { virtual int setFifoDepth(const uint32_t i) = 0; + //***receiver parameters*** + /** + * Set Silent Mode + * @param i silent mode. 1 sets, 0 unsets + */ + virtual void setSilentMode(const uint32_t i) = 0; + + /************************************************************************* * Behavioral functions*************************************************** * They may modify the status of the receiver **************************** diff --git a/slsReceiverSoftware/include/UDPStandardImplementation.h b/slsReceiverSoftware/include/UDPStandardImplementation.h index 9f6fc73e2..5e840f468 100644 --- a/slsReceiverSoftware/include/UDPStandardImplementation.h +++ b/slsReceiverSoftware/include/UDPStandardImplementation.h @@ -101,6 +101,12 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase */ int setFifoDepth(const uint32_t i); + /** + * Set Silent Mode + * @param i silent mode. 1 sets, 0 unsets + */ + void setSilentMode(const uint32_t i); + /** * Set receiver type (and corresponding detector variables in derived STANDARD class) * It is the first function called by the client when connecting to receiver diff --git a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h index a899c3c03..8780ab1c9 100644 --- a/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h +++ b/slsReceiverSoftware/include/slsReceiverTCPIPInterface.h @@ -264,6 +264,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs { /** set streaming port */ int set_streaming_port(); + /** set silent mode */ + int set_silent_mode(); + /** detector type */ diff --git a/slsReceiverSoftware/include/sls_receiver_funcs.h b/slsReceiverSoftware/include/sls_receiver_funcs.h index a8574edd2..5b4be98b6 100644 --- a/slsReceiverSoftware/include/sls_receiver_funcs.h +++ b/slsReceiverSoftware/include/sls_receiver_funcs.h @@ -61,6 +61,8 @@ enum recFuncs{ F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */ F_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */ F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */ + + F_SET_RECEIVER_SILENT_MODE, /** < sets the receiver silent mode */ /* Always append functions hereafter!!! */ diff --git a/slsReceiverSoftware/src/BinaryFile.cpp b/slsReceiverSoftware/src/BinaryFile.cpp index b50beee37..1b211b1ba 100644 --- a/slsReceiverSoftware/src/BinaryFile.cpp +++ b/slsReceiverSoftware/src/BinaryFile.cpp @@ -17,9 +17,10 @@ FILE* BinaryFile::masterfd = 0; BinaryFile::BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf, 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): + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, + bool* smode): - File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno), + File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, smode), filefd(0), numFramesInFile(0), numActualPacketsInFile(0) @@ -54,7 +55,8 @@ int BinaryFile::CreateFile(uint64_t fnum) { if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL) return FAIL; - FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; + if(!silentMode) + FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; return OK; } @@ -90,7 +92,8 @@ int BinaryFile::CreateMasterFile(bool en, uint32_t size, if (master && (*detIndex==0)) { masterFileName = BinaryFileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex); - FILE_LOG(logINFO) << "Master File: " << masterFileName; + if(!silentMode) + FILE_LOG(logINFO) << "Master File: " << masterFileName; return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable, *dynamicRange, en, size, nx, ny, *numImages, at, st, ap, BINARY_WRITER_VERSION); diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index b3dbc0462..edc368db8 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -30,6 +30,8 @@ uint64_t DataProcessor::RunningMask(0x0); pthread_mutex_t DataProcessor::Mutex = PTHREAD_MUTEX_INITIALIZER; +bool DataProcessor::SilentMode(false); + DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable, uint32_t* freq, uint32_t* timer, @@ -90,6 +92,10 @@ void DataProcessor::ResetRunningMask() { RunningMask = 0x0; } +void DataProcessor::SetSilentMode(bool mode) { + SilentMode = mode; +} + /** non static functions */ /** getters */ string DataProcessor::GetType(){ @@ -238,14 +244,14 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t* nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, - generalData->nPixelsX, generalData->nPixelsY); + generalData->nPixelsX, generalData->nPixelsY, &SilentMode); break; #endif default: file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame, nd, fname, fpath, findex, frindexenable, owenable, - dindex, nunits, nf, dr, portno); + dindex, nunits, nf, dr, portno, &SilentMode); break; } } diff --git a/slsReceiverSoftware/src/DataStreamer.cpp b/slsReceiverSoftware/src/DataStreamer.cpp index 5823adf63..ddc013f1b 100644 --- a/slsReceiverSoftware/src/DataStreamer.cpp +++ b/slsReceiverSoftware/src/DataStreamer.cpp @@ -23,6 +23,8 @@ uint64_t DataStreamer::RunningMask(0x0); pthread_mutex_t DataStreamer::Mutex = PTHREAD_MUTEX_INITIALIZER; +bool DataStreamer::SilentMode(false); + DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable) : ThreadObject(NumberofDataStreamers), @@ -71,6 +73,11 @@ void DataStreamer::ResetRunningMask() { RunningMask = 0x0; } +void DataStreamer::SetSilentMode(bool mode) { + SilentMode = mode; +} + + /** non static functions */ /** getters */ string DataStreamer::GetType(){ diff --git a/slsReceiverSoftware/src/File.cpp b/slsReceiverSoftware/src/File.cpp index ee135a076..7bbfbeda4 100644 --- a/slsReceiverSoftware/src/File.cpp +++ b/slsReceiverSoftware/src/File.cpp @@ -13,7 +13,8 @@ using namespace std; File::File(int ind, uint32_t maxf, const uint32_t* ppf, 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): + int* dindex, int* nunits, uint64_t* nf, uint32_t* dr, uint32_t* portno, + bool* smode): index(ind), maxFramesPerFile(maxf), packetsPerFrame(ppf), @@ -28,7 +29,8 @@ File::File(int ind, uint32_t maxf, const uint32_t* ppf, numUnitsPerDetector(nunits), numImages(nf), dynamicRange(dr), - udpPortNumber(portno) + udpPortNumber(portno), + silentMode(smode) { master = index?false:true; @@ -59,7 +61,8 @@ void File::PrintMembers() { << "Dynamic Range: " << *dynamicRange << endl << "UDP Port number: " << *udpPortNumber << endl << "Master File Name: " << masterFileName << endl - << "Current File Name: " << currentFileName; + << "Current File Name: " << currentFileName << endl + << "Silent Mode: " << silentMode; } diff --git a/slsReceiverSoftware/src/HDF5File.cpp b/slsReceiverSoftware/src/HDF5File.cpp index a24814097..a52cb18eb 100644 --- a/slsReceiverSoftware/src/HDF5File.cpp +++ b/slsReceiverSoftware/src/HDF5File.cpp @@ -25,9 +25,10 @@ HDF5File::HDF5File(int ind, uint32_t maxf, const uint32_t* ppf, 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, - uint32_t nx, uint32_t ny): + uint32_t nx, uint32_t ny, + bool* smode): - File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno), + File(ind, maxf, ppf, nd, fname, fpath, findex, frindexenable, owenable, dindex, nunits, nf, dr, portno, smode), filefd(0), dataspace(0), dataset(0), @@ -110,7 +111,8 @@ int HDF5File::CreateFile(uint64_t fnum) { if (dataspace == NULL) bprintf(RED,"Got nothing!\n"); - FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; + if(!silentMode) + FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; return OK; } @@ -171,7 +173,8 @@ int HDF5File::CreateMasterFile(bool en, uint32_t size, if (master && (*detIndex==0)) { virtualfd = 0; masterFileName = HDF5FileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex); - FILE_LOG(logINFO) << "Master File: " << masterFileName; + if(!silentMode) + FILE_LOG(logINFO) << "Master File: " << masterFileName; pthread_mutex_lock(&Mutex); int ret = HDF5FileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable, *dynamicRange, en, size, nx, ny, *numImages, at, st, ap, HDF5_WRITER_VERSION); diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index 7d624d555..f3a4cb84d 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -26,6 +26,8 @@ uint64_t Listener::RunningMask(0x0); pthread_mutex_t Listener::Mutex = PTHREAD_MUTEX_INITIALIZER; +bool Listener::SilentMode(false); + Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr) : ThreadObject(NumberofListeners), @@ -93,6 +95,9 @@ void Listener::ResetRunningMask() { RunningMask = 0x0; } +void Listener::SetSilentMode(bool mode) { + SilentMode = mode; +} /** non static functions */ /** getters */ @@ -183,10 +188,13 @@ void Listener::RecordFirstIndices(uint64_t fnum) { acquisitionStartedFlag = true; firstAcquisitionIndex = fnum; } - if (!index) bprintf(BLUE,"%d First Acquisition Index:%lu\n" - "%d First Measurement Index:%lu\n", - index, firstAcquisitionIndex, - index, firstMeasurementIndex); + + if(!SilentMode) { + if (!index) bprintf(BLUE,"%d First Acquisition Index:%lu\n" + "%d First Measurement Index:%lu\n", + index, firstAcquisitionIndex, + index, firstMeasurementIndex); + } } @@ -299,9 +307,11 @@ void Listener::ThreadExecution() { fifo->PushAddress(buffer); //Statistics - numFramesStatistic++; - if (numFramesStatistic >= generalData->maxFramesPerFile) - PrintFifoStatistics(); + if(!SilentMode) { + numFramesStatistic++; + if (numFramesStatistic >= generalData->maxFramesPerFile) + PrintFifoStatistics(); + } } diff --git a/slsReceiverSoftware/src/UDPBaseImplementation.cpp b/slsReceiverSoftware/src/UDPBaseImplementation.cpp index 66e84d3a5..2b145d8a3 100644 --- a/slsReceiverSoftware/src/UDPBaseImplementation.cpp +++ b/slsReceiverSoftware/src/UDPBaseImplementation.cpp @@ -80,6 +80,9 @@ void UDPBaseImplementation::initializeMembers(){ frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS; dataStreamEnable = false; streamingPort = 0; + + //***receiver parameters*** + silentMode = 0; } UDPBaseImplementation::~UDPBaseImplementation(){} @@ -206,6 +209,8 @@ uint32_t UDPBaseImplementation::getFifoDepth() const{ FILE_LOG(logDEBUG) << __AT /***receiver status***/ slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return status;} +uint32_t UDPBaseImplementation::getSilentMode() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return silentMode;} + int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return activated;} uint32_t UDPBaseImplementation::getStreamingPort() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return streamingPort;} @@ -465,6 +470,14 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){ return OK; } +/***receiver parameters***/ +void UDPBaseImplementation::setSilentMode(const uint32_t i){ + FILE_LOG(logDEBUG) << __AT__ << " starting"; + + silentMode = i; + FILE_LOG(logINFO) << "Silent Mode: " << i; +} + /************************************************************************* * Behavioral functions*************************************************** * They may modify the status of the receiver **************************** diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 759dea8e9..11422e7fb 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -267,6 +267,16 @@ int UDPStandardImplementation::setFifoDepth(const uint32_t i) { } +void UDPStandardImplementation::setSilentMode(const uint32_t i){ + silentMode = i; + + Listener::SetSilentMode(i); + DataProcessor::SetSilentMode(i); + DataStreamer::SetSilentMode(i); + + FILE_LOG(logINFO) << "Silent Mode: " << i; +} + int UDPStandardImplementation::setDetectorType(const detectorType d) { FILE_LOG (logDEBUG) << "Setting receiver type"; @@ -332,9 +342,8 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) { //set up writer and callbacks for (vector::const_iterator it = listener.begin(); it != listener.end(); ++it) (*it)->SetGeneralData(generalData); - for (vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) { + for (vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) (*it)->SetGeneralData(generalData); - } SetThreadPriorities(); diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 9743936cb..35a66925c 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -282,6 +282,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) { case F_SEND_RECEIVER_DETPOSID: return "F_SEND_RECEIVER_DETPOSID"; case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE"; case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT"; + case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE"; default: return "Unknown Function"; } } @@ -328,6 +329,7 @@ int slsReceiverTCPIPInterface::function_table(){ flist[F_SEND_RECEIVER_DETPOSID] = &slsReceiverTCPIPInterface::set_detector_posid; flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size; flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port; + flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode; #ifdef VERYVERBOSE for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) { FILE_LOG(logINFO) << "function fnum: " << i << " (" << getFunctionName((enum recFuncs)i) << ") located at " << (unsigned int)flist[i]; @@ -2366,3 +2368,53 @@ int slsReceiverTCPIPInterface::set_streaming_port() { // return ok/fail return ret; } + + + + + +int slsReceiverTCPIPInterface::set_silent_mode() { + ret = OK; + memset(mess, 0, sizeof(mess)); + int value = -1; + int retval = -1; + + // receive arguments + if (mySock->ReceiveDataOnly(&value,sizeof(value)) < 0 ) + return printSocketReadError(); + + // execute action +#ifdef SLS_RECEIVER_UDP_FUNCTIONS + if (receiverBase == NULL) + invalidReceiverObject(); + else { + // set + if(value >= 0) { + if (mySock->differentClients && lockStatus) + receiverlocked(); + else if (receiverBase->getStatus() != IDLE) + receiverNotIdle(); + else { + receiverBase->setSilentMode(value); // no check required + } + } + //get + retval = receiverBase->getSilentMode(); // no check required + } +#endif +#ifdef VERYVERBOSE + FILE_LOG(logDEBUG1) << "silent mode:" << retval; +#endif + + if (ret == OK && mySock->differentClients) + ret = FORCE_UPDATE; + + // send answer + mySock->SendDataOnly(&ret,sizeof(ret)); + if (ret == FAIL) + mySock->SendDataOnly(mess,sizeof(mess)); + mySock->SendDataOnly(&retval,sizeof(retval)); + + // return ok/fail + return ret; +}