added silent mode in receiver during real time acquisition, doesnt print packet loss regularly or file name created each time

This commit is contained in:
Dhanya Maliakal 2017-09-27 10:11:31 +02:00
parent 11d58beec2
commit 6a8aad4c2b
20 changed files with 214 additions and 26 deletions

View File

@ -34,11 +34,13 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi
* @param nf pointer to number of images in acquisition * @param nf pointer to number of images in acquisition
* @param dr pointer to dynamic range * @param dr pointer to dynamic range
* @param portno pointer to udp port number for logging * @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, BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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 * Destructor

View File

@ -64,6 +64,12 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
*/ */
static void ResetRunningMask(); static void ResetRunningMask();
/**
* Set Silent Mode
* @param mode 1 sets 0 unsets
*/
static void SetSilentMode(bool mode);
//*** non static functions *** //*** non static functions ***
//*** getters *** //*** getters ***
/** /**
@ -285,6 +291,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
/** Fifo structure */ /** Fifo structure */
Fifo* fifo; Fifo* fifo;
/** Silent Mode */
static bool SilentMode;
//individual members //individual members
/** File writer implemented as binary or hdf5 File */ /** File writer implemented as binary or hdf5 File */

View File

@ -51,6 +51,12 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
*/ */
static void ResetRunningMask(); static void ResetRunningMask();
/**
* Set Silent Mode
* @param mode 1 sets 0 unsets
*/
static void SetSilentMode(bool mode);
//*** non static functions *** //*** non static functions ***
//*** getters *** //*** getters ***
@ -178,6 +184,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** Fifo structure */ /** Fifo structure */
Fifo* fifo; Fifo* fifo;
/** Silent Mode */
static bool SilentMode;
/** ZMQ Socket - Receiver to Client */ /** ZMQ Socket - Receiver to Client */
ZmqSocket* zmqSocket; ZmqSocket* zmqSocket;

View File

@ -34,11 +34,13 @@ class File : private virtual slsReceiverDefs {
* @param nf pointer to number of images in acquisition * @param nf pointer to number of images in acquisition
* @param dr pointer to dynamic range * @param dr pointer to dynamic range
* @param portno pointer to udp port number for logging * @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, File(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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 * Destructor
@ -220,5 +222,8 @@ class File : private virtual slsReceiverDefs {
/** UDP Port Number for logging */ /** UDP Port Number for logging */
uint32_t* udpPortNumber; uint32_t* udpPortNumber;
/** Silent Mode */
bool silentMode;
}; };

View File

@ -42,12 +42,14 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
* @param portno pointer to udp port number for logging * @param portno pointer to udp port number for logging
* @param nx number of pixels in x direction * @param nx number of pixels in x direction
* @param ny number of pixels in y 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, HDF5File(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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,
uint32_t nx, uint32_t ny); uint32_t nx, uint32_t ny,
bool* smode);
/** /**
* Destructor * Destructor

View File

@ -57,6 +57,12 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
*/ */
static void ResetRunningMask(); static void ResetRunningMask();
/**
* Set Silent Mode
* @param mode 1 sets 0 unsets
*/
static void SetSilentMode(bool mode);
//*** non static functions *** //*** non static functions ***
//*** getters *** //*** getters ***
@ -217,6 +223,9 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
/** Fifo structure */ /** Fifo structure */
Fifo* fifo; Fifo* fifo;
/** Silent Mode */
static bool SilentMode;
// individual members // individual members
/** Detector Type */ /** Detector Type */
@ -258,7 +267,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
uint64_t firstMeasurementIndex; 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)) */ /** Number of complete Packets caught for each real time acquisition (eg. for each scan (start& stop of receiver)) */
volatile uint64_t numPacketsCaught; volatile uint64_t numPacketsCaught;
@ -287,8 +296,12 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
/** if the udp socket is connected */ /** if the udp socket is connected */
bool udpSocketAlive; bool udpSocketAlive;
// for print progress during acqusition
/** number of packets for statistic */
uint32_t numPacketsStatistic; uint32_t numPacketsStatistic;
/** number of images for statistic */
uint32_t numFramesStatistic; uint32_t numFramesStatistic;
}; };

View File

@ -239,6 +239,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/ */
runStatus getStatus() const; runStatus getStatus() const;
/**
* Get Silent Mode
* @return silent mode
*/
uint32_t getSilentMode() const;
/** /**
* Get activate * Get activate
* If deactivated, receiver will write dummy packets 0xFF * 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); 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*************************************************** * Behavioral functions***************************************************
@ -653,6 +665,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
/** streaming port */ /** streaming port */
uint32_t streamingPort; uint32_t streamingPort;
//***receiver parameters***
uint32_t silentMode;
//***callback parameters*** //***callback parameters***
/** /**

View File

@ -323,6 +323,12 @@ class UDPInterface {
*/ */
virtual slsReceiverDefs::runStatus getStatus() const = 0; virtual slsReceiverDefs::runStatus getStatus() const = 0;
/**
* Get Silent Mode
* @return silent mode
*/
virtual uint32_t getSilentMode() const = 0;
/** /**
* Get activate * Get activate
* If deactivated, receiver will write dummy packets 0xFF * If deactivated, receiver will write dummy packets 0xFF
@ -520,6 +526,14 @@ class UDPInterface {
virtual int setFifoDepth(const uint32_t i) = 0; 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*************************************************** * Behavioral functions***************************************************
* They may modify the status of the receiver **************************** * They may modify the status of the receiver ****************************

View File

@ -101,6 +101,12 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/ */
int setFifoDepth(const uint32_t i); 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) * Set receiver type (and corresponding detector variables in derived STANDARD class)
* It is the first function called by the client when connecting to receiver * It is the first function called by the client when connecting to receiver

View File

@ -264,6 +264,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
/** set streaming port */ /** set streaming port */
int set_streaming_port(); int set_streaming_port();
/** set silent mode */
int set_silent_mode();
/** detector type */ /** detector type */

View File

@ -61,6 +61,8 @@ enum recFuncs{
F_SEND_RECEIVER_DETPOSID, /** < sets the detector position id in the reveiver */ 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_SEND_RECEIVER_MULTIDETSIZE, /** < sets the multi detector size to the receiver */
F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */ F_SET_RECEIVER_STREAMING_PORT, /** < sets the receiver streaming port */
F_SET_RECEIVER_SILENT_MODE, /** < sets the receiver silent mode */
/* Always append functions hereafter!!! */ /* Always append functions hereafter!!! */

View File

@ -17,9 +17,10 @@ FILE* BinaryFile::masterfd = 0;
BinaryFile::BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf, BinaryFile::BinaryFile(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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), filefd(0),
numFramesInFile(0), numFramesInFile(0),
numActualPacketsInFile(0) numActualPacketsInFile(0)
@ -54,6 +55,7 @@ int BinaryFile::CreateFile(uint64_t fnum) {
if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL) if (BinaryFileStatic::CreateDataFile(filefd, *overWriteEnable, currentFileName, FILE_BUFFER_SIZE) == FAIL)
return FAIL; return FAIL;
if(!silentMode)
FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName; FILE_LOG(logINFO) << "[" << *udpPortNumber << "]: Binary File created: " << currentFileName;
return OK; return OK;
} }
@ -90,6 +92,7 @@ int BinaryFile::CreateMasterFile(bool en, uint32_t size,
if (master && (*detIndex==0)) { if (master && (*detIndex==0)) {
masterFileName = BinaryFileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex); masterFileName = BinaryFileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex);
if(!silentMode)
FILE_LOG(logINFO) << "Master File: " << masterFileName; FILE_LOG(logINFO) << "Master File: " << masterFileName;
return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable, return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable,
*dynamicRange, en, size, nx, ny, *numImages, *dynamicRange, en, size, nx, ny, *numImages,

View File

@ -30,6 +30,8 @@ uint64_t DataProcessor::RunningMask(0x0);
pthread_mutex_t DataProcessor::Mutex = PTHREAD_MUTEX_INITIALIZER; 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, uint32_t* freq, uint32_t* timer,
@ -90,6 +92,10 @@ void DataProcessor::ResetRunningMask() {
RunningMask = 0x0; RunningMask = 0x0;
} }
void DataProcessor::SetSilentMode(bool mode) {
SilentMode = mode;
}
/** non static functions */ /** non static functions */
/** getters */ /** getters */
string DataProcessor::GetType(){ string DataProcessor::GetType(){
@ -238,14 +244,14 @@ void DataProcessor::SetupFileWriter(int* nd, char* fname, char* fpath, uint64_t*
nd, fname, fpath, findex, nd, fname, fpath, findex,
frindexenable, owenable, frindexenable, owenable,
dindex, nunits, nf, dr, portno, dindex, nunits, nf, dr, portno,
generalData->nPixelsX, generalData->nPixelsY); generalData->nPixelsX, generalData->nPixelsY, &SilentMode);
break; break;
#endif #endif
default: default:
file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame, file = new BinaryFile(index, generalData->maxFramesPerFile, &generalData->packetsPerFrame,
nd, fname, fpath, findex, nd, fname, fpath, findex,
frindexenable, owenable, frindexenable, owenable,
dindex, nunits, nf, dr, portno); dindex, nunits, nf, dr, portno, &SilentMode);
break; break;
} }
} }

View File

@ -23,6 +23,8 @@ uint64_t DataStreamer::RunningMask(0x0);
pthread_mutex_t DataStreamer::Mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t DataStreamer::Mutex = PTHREAD_MUTEX_INITIALIZER;
bool DataStreamer::SilentMode(false);
DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable) : DataStreamer::DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable) :
ThreadObject(NumberofDataStreamers), ThreadObject(NumberofDataStreamers),
@ -71,6 +73,11 @@ void DataStreamer::ResetRunningMask() {
RunningMask = 0x0; RunningMask = 0x0;
} }
void DataStreamer::SetSilentMode(bool mode) {
SilentMode = mode;
}
/** non static functions */ /** non static functions */
/** getters */ /** getters */
string DataStreamer::GetType(){ string DataStreamer::GetType(){

View File

@ -13,7 +13,8 @@ using namespace std;
File::File(int ind, uint32_t maxf, const uint32_t* ppf, File::File(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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), index(ind),
maxFramesPerFile(maxf), maxFramesPerFile(maxf),
packetsPerFrame(ppf), packetsPerFrame(ppf),
@ -28,7 +29,8 @@ File::File(int ind, uint32_t maxf, const uint32_t* ppf,
numUnitsPerDetector(nunits), numUnitsPerDetector(nunits),
numImages(nf), numImages(nf),
dynamicRange(dr), dynamicRange(dr),
udpPortNumber(portno) udpPortNumber(portno),
silentMode(smode)
{ {
master = index?false:true; master = index?false:true;
@ -59,7 +61,8 @@ void File::PrintMembers() {
<< "Dynamic Range: " << *dynamicRange << endl << "Dynamic Range: " << *dynamicRange << endl
<< "UDP Port number: " << *udpPortNumber << endl << "UDP Port number: " << *udpPortNumber << endl
<< "Master File Name: " << masterFileName << endl << "Master File Name: " << masterFileName << endl
<< "Current File Name: " << currentFileName; << "Current File Name: " << currentFileName << endl
<< "Silent Mode: " << silentMode;
} }

View File

@ -25,9 +25,10 @@ HDF5File::HDF5File(int ind, uint32_t maxf, const uint32_t* ppf,
int* nd, char* fname, char* fpath, uint64_t* findex, int* nd, char* fname, char* fpath, uint64_t* findex,
bool* frindexenable, bool* owenable, 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,
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), filefd(0),
dataspace(0), dataspace(0),
dataset(0), dataset(0),
@ -110,6 +111,7 @@ int HDF5File::CreateFile(uint64_t fnum) {
if (dataspace == NULL) if (dataspace == NULL)
bprintf(RED,"Got nothing!\n"); bprintf(RED,"Got nothing!\n");
if(!silentMode)
FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName;
return OK; return OK;
@ -171,6 +173,7 @@ int HDF5File::CreateMasterFile(bool en, uint32_t size,
if (master && (*detIndex==0)) { if (master && (*detIndex==0)) {
virtualfd = 0; virtualfd = 0;
masterFileName = HDF5FileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex); masterFileName = HDF5FileStatic::CreateMasterFileName(filePath, fileNamePrefix, *fileIndex);
if(!silentMode)
FILE_LOG(logINFO) << "Master File: " << masterFileName; FILE_LOG(logINFO) << "Master File: " << masterFileName;
pthread_mutex_lock(&Mutex); pthread_mutex_lock(&Mutex);
int ret = HDF5FileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable, int ret = HDF5FileStatic::CreateMasterDataFile(masterfd, masterFileName, *overWriteEnable,

View File

@ -26,6 +26,8 @@ uint64_t Listener::RunningMask(0x0);
pthread_mutex_t Listener::Mutex = PTHREAD_MUTEX_INITIALIZER; 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) : Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr) :
ThreadObject(NumberofListeners), ThreadObject(NumberofListeners),
@ -93,6 +95,9 @@ void Listener::ResetRunningMask() {
RunningMask = 0x0; RunningMask = 0x0;
} }
void Listener::SetSilentMode(bool mode) {
SilentMode = mode;
}
/** non static functions */ /** non static functions */
/** getters */ /** getters */
@ -183,11 +188,14 @@ void Listener::RecordFirstIndices(uint64_t fnum) {
acquisitionStartedFlag = true; acquisitionStartedFlag = true;
firstAcquisitionIndex = fnum; firstAcquisitionIndex = fnum;
} }
if(!SilentMode) {
if (!index) bprintf(BLUE,"%d First Acquisition Index:%lu\n" if (!index) bprintf(BLUE,"%d First Acquisition Index:%lu\n"
"%d First Measurement Index:%lu\n", "%d First Measurement Index:%lu\n",
index, firstAcquisitionIndex, index, firstAcquisitionIndex,
index, firstMeasurementIndex); index, firstMeasurementIndex);
} }
}
void Listener::SetGeneralData(GeneralData*& g) { void Listener::SetGeneralData(GeneralData*& g) {
@ -299,10 +307,12 @@ void Listener::ThreadExecution() {
fifo->PushAddress(buffer); fifo->PushAddress(buffer);
//Statistics //Statistics
if(!SilentMode) {
numFramesStatistic++; numFramesStatistic++;
if (numFramesStatistic >= generalData->maxFramesPerFile) if (numFramesStatistic >= generalData->maxFramesPerFile)
PrintFifoStatistics(); PrintFifoStatistics();
} }
}

View File

@ -80,6 +80,9 @@ void UDPBaseImplementation::initializeMembers(){
frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS; frameToGuiTimerinMS = DEFAULT_STREAMING_TIMER_IN_MS;
dataStreamEnable = false; dataStreamEnable = false;
streamingPort = 0; streamingPort = 0;
//***receiver parameters***
silentMode = 0;
} }
UDPBaseImplementation::~UDPBaseImplementation(){} UDPBaseImplementation::~UDPBaseImplementation(){}
@ -206,6 +209,8 @@ uint32_t UDPBaseImplementation::getFifoDepth() const{ FILE_LOG(logDEBUG) << __AT
/***receiver status***/ /***receiver status***/
slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return 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;} int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return activated;}
uint32_t UDPBaseImplementation::getStreamingPort() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return streamingPort;} 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; 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*************************************************** * Behavioral functions***************************************************
* They may modify the status of the receiver **************************** * They may modify the status of the receiver ****************************

View File

@ -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) { int UDPStandardImplementation::setDetectorType(const detectorType d) {
FILE_LOG (logDEBUG) << "Setting receiver type"; FILE_LOG (logDEBUG) << "Setting receiver type";
@ -332,9 +342,8 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
//set up writer and callbacks //set up writer and callbacks
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it) for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
(*it)->SetGeneralData(generalData); (*it)->SetGeneralData(generalData);
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) { for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
(*it)->SetGeneralData(generalData); (*it)->SetGeneralData(generalData);
}
SetThreadPriorities(); SetThreadPriorities();

View File

@ -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_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE"; 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_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
case F_SET_RECEIVER_SILENT_MODE: return "F_SET_RECEIVER_SILENT_MODE";
default: return "Unknown Function"; 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_DETPOSID] = &slsReceiverTCPIPInterface::set_detector_posid;
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size; flist[F_SEND_RECEIVER_MULTIDETSIZE] = &slsReceiverTCPIPInterface::set_multi_detector_size;
flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port; flist[F_SET_RECEIVER_STREAMING_PORT] = &slsReceiverTCPIPInterface::set_streaming_port;
flist[F_SET_RECEIVER_SILENT_MODE] = &slsReceiverTCPIPInterface::set_silent_mode;
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) { 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]; 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 ok/fail
return ret; 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;
}