From af98d2bb5353f964123a86769d7c57c8eaf0e6a7 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 27 Sep 2017 10:09:02 +0200 Subject: [PATCH 1/4] added silent mode in receiver during real time acquisition, doesnt print packet loss regularly or file name created each time --- slsDetectorSoftware/commonFiles/error_defs.h | 3 +++ .../multiSlsDetector/multiSlsDetector.cpp | 14 +++++++++++ .../multiSlsDetector/multiSlsDetector.h | 6 +++++ .../slsDetector/slsDetector.cpp | 23 +++++++++++++++++++ slsDetectorSoftware/slsDetector/slsDetector.h | 6 +++++ .../slsDetector/slsDetectorCommand.cpp | 23 +++++++++++++++++++ .../slsDetector/slsDetectorUtils.h | 6 +++++ 7 files changed, 81 insertions(+) diff --git a/slsDetectorSoftware/commonFiles/error_defs.h b/slsDetectorSoftware/commonFiles/error_defs.h index ac4787cff..922d1b08d 100644 --- a/slsDetectorSoftware/commonFiles/error_defs.h +++ b/slsDetectorSoftware/commonFiles/error_defs.h @@ -81,6 +81,7 @@ using namespace std; #define THRESHOLD_NOT_SET 0x0000000040000000ULL #define RECEIVER_FILE_FORMAT 0x0000000080000000ULL #define RECEIVER_SUBF_TIME_NOT_SET 0x0000000100000000ULL +#define RECEIVER_SILENT_MODE_NOT_SET 0x0000000200000000ULL // 0x0000000FFFFFFFFFULL /** @short class returning all error messages for error mask */ @@ -262,6 +263,8 @@ public: if(slsErrorMask&RECEIVER_SUBF_TIME_NOT_SET) retval.append("Could not set sub exposure time in receiver.\n"); + if(slsErrorMask&RECEIVER_SILENT_MODE_NOT_SET) + retval.append("Could not set silent mode in receiver.\n"); //------------------------------------------------------ length of message diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 62c8a45ee..462ceeb2a 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -6266,6 +6266,20 @@ int multiSlsDetector::setReceiverFifoDepth(int i){ } +int multiSlsDetector::setReceiverSilentMode(int i){ + int ret=-100,ret1; + for (int idet=0; idetnumberOfDetectors; ++idet) + if (detectors[idet]){ + ret1=detectors[idet]->setReceiverSilentMode(i); + if(detectors[idet]->getErrorMask()) + setErrorMask(getErrorMask()|(1<receiverOnlineFlag==ONLINE_FLAG){ +#ifdef VERBOSE + if(i ==-1) + std::cout<< "Getting Receiver Silent Mode" << endl; + else + std::cout<< "Setting Receiver Silent Mode to " << i << endl; +#endif + if (connectData() == OK){ + ret=thisReceiver->sendInt(fnum,retval,i); + disconnectData(); + } + if(ret==FAIL) + setErrorMask((getErrorMask())|(RECEIVER_SILENT_MODE_NOT_SET)); + } + return retval; +} + /******** CTB funcs */ diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index d8272964c..97a40e9f2 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -1812,6 +1812,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion { */ int setReceiverFifoDepth(int i = -1); + /** set/get receiver silent mode + * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode + /returns the receiver silent mode enable + */ + int setReceiverSilentMode(int i = -1); + /******** CTB funcs */ /** opens pattern file and sends pattern to CTB diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 17aa3edef..83960ada2 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -2033,6 +2033,14 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; ++i; + /*! \page receiver + - r_silent [i] sets/gets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets. \c Returns \c (int) + */ + descrToFuncMap[i].m_pFuncName="r_silent"; // + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; + ++i; + + /* pattern generator */ @@ -5983,6 +5991,19 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) { } + else if(cmd=="r_silent"){ + if (action==PUT_ACTION){ + if (!sscanf(args[1],"%d",&ival)) + return string("Could not scan r_online input ")+string(args[1]); + if(ival>=0) + sprintf(answer,"%d",myDet->setReceiverSilentMode(ival)); + }else + sprintf(answer,"%d",myDet->setReceiverSilentMode()); + return string(answer); + + } + + return string("could not decode command"); } @@ -5998,6 +6019,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) { os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl; os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl; os << "rx_fifodepth [val]\t sets receiver fifo depth to val" << std::endl; + os << "r_silent [i]\t sets receiver in silent mode, ie. it will not print anything during real time acquisition. 1 sets, 0 unsets." << std::endl; } if (action==GET_ACTION || action==HELP_ACTION){ os << "receiver \t returns the status of receiver - can be running or idle" << std::endl; @@ -6006,6 +6028,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) { os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl; os << "tengiga \t returns 1 if the system is configured for 10Gbe else 0 for 1Gbe" << std::endl; os << "rx_fifodepth \t returns receiver fifo depth" << std::endl; + os << "r_silent \t returns receiver silent mode enable. 1 is silent, 0 not silent." << std::endl; } return os.str(); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index c88b916c8..cf1cbd2d4 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -774,6 +774,12 @@ virtual int enableTenGigabitEthernet(int i = -1)=0; */ virtual int setReceiverFifoDepth(int i = -1)=0; +/** set/get receiver silent mode + * @param i is -1 to get, 0 unsets silent mode, 1 sets silent mode + /returns the receiver silent mode enable + */ +virtual int setReceiverSilentMode(int i = -1)=0; + /******** CTB funcs */ /** opens pattern file and sends pattern to CTB From 0a446c425b4f2a7c84eb3018cfac3edbef3eb7e5 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Wed, 27 Sep 2017 10:17:48 +0200 Subject: [PATCH 2/4] added users functions for silent mode --- slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp | 4 ++++ slsDetectorSoftware/slsDetector/slsDetectorUsers.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp index f540b7db2..5f12abefc 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.cpp @@ -345,3 +345,7 @@ int slsDetectorUsers::stopReceiver() { int slsDetectorUsers::startAcquisition() { return myDetector->startAcquisition(); } + +int slsDetectorUsers::setReceiverSilentMode(int i) { + return myDetector->setReceiverSilentMode(i); +} diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h index 063658f64..0727bb49c 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUsers.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUsers.h @@ -603,6 +603,13 @@ class slsDetectorUsers */ int startAcquisition(); + /** + * set receiver in silent mode + * @param i 1 sets, 0 unsets (-1 gets) + * @return silent mode of receiver + */ + int setReceiverSilentMode(int i); + /************************************************************************ STATIC FUNCTIONS From 96caf728c862639a43bf8ca0fb0f0b2e12efb9af Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 3 Oct 2017 14:17:48 +0200 Subject: [PATCH 3/4] setting receiver to none properly, ten giga set in shared memoery properly if no receiver involved --- .../slsDetector/slsDetector.cpp | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index ebc1454ea..be39d7e7f 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -6027,6 +6027,14 @@ string slsDetector::setDetectorIP(string detectorIP){ string slsDetector::setReceiver(string receiverIP){ + + if(receiverIP == "none") { + memset(thisDetector->receiver_hostname, 0, MAX_STR_LENGTH); + strcpy(thisDetector->receiver_hostname,"none"); + thisDetector->receiverOnlineFlag = OFFLINE_FLAG; + return string(thisDetector->receiver_hostname); + } + if(getRunStatus()==RUNNING){ cprintf(RED,"Acquisition already running, Stopping it.\n"); stopAcquisition(); @@ -7588,23 +7596,23 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza /*receiver*/ int slsDetector::setReceiverOnline(int off) { - if (off!=GET_ONLINE_FLAG) { - // setting flag to offline - if (off == OFFLINE_FLAG) - thisDetector->receiverOnlineFlag = off; - // set flag to online only if hostname not none - else if(strcmp(thisDetector->receiver_hostname,"none")){ - thisDetector->receiverOnlineFlag=off; - } - if (thisDetector->receiverOnlineFlag==ONLINE_FLAG){ - setReceiverTCPSocket(); - // error in connecting - if(thisDetector->receiverOnlineFlag==OFFLINE_FLAG){ - std::cout << "cannot connect to receiver" << endl; - setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER)); - } - } - } + if (off!=GET_ONLINE_FLAG) { + // no receiver + if(!strcmp(thisDetector->receiver_hostname,"none")) + thisDetector->receiverOnlineFlag = OFFLINE_FLAG; + else + thisDetector->receiverOnlineFlag = off; + // check receiver online + if (thisDetector->receiverOnlineFlag==ONLINE_FLAG){ + setReceiverTCPSocket(); + // error in connecting + if(thisDetector->receiverOnlineFlag==OFFLINE_FLAG){ + std::cout << "cannot connect to receiver" << endl; + setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER)); + } + } + + } return thisDetector->receiverOnlineFlag; } @@ -8681,9 +8689,9 @@ int slsDetector::enableTenGigabitEthernet(int i){ //must also configuremac if((i != -1)&&(retval == i)) if(configureMAC() != FAIL){ - ret = FAIL; - retval=-1; if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){ + ret = FAIL; + retval=-1; #ifdef VERBOSE std::cout << "Enabling / Disabling 10Gbe in receiver: " << i << std::endl; #endif From 2aed12dcb9328f6fa7b97c2de606059c3a5202a5 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 3 Oct 2017 14:18:33 +0200 Subject: [PATCH 4/4] updaterev --- slsDetectorSoftware/gitInfo.txt | 8 ++++---- slsDetectorSoftware/slsDetector/gitInfoLib.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/slsDetectorSoftware/gitInfo.txt b/slsDetectorSoftware/gitInfo.txt index c93f8cb81..3321a278b 100644 --- a/slsDetectorSoftware/gitInfo.txt +++ b/slsDetectorSoftware/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsDetectorSoftware URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git -Repsitory UUID: 0fb1ff01209ad1aa975f39285814c2cc42db2678 -Revision: 1556 +Repsitory UUID: 1fd03e9cdd01efd75e3ab8641be71d61b2e1aa10 +Revision: 1566 Branch: 3.0.1 Last Changed Author: Dhanya_Maliakal -Last Changed Rev: 1561 -Last Changed Date: 2017-09-20 18:27:25.000000002 +0200 ./slsDetectorAnalysis/postProcessing.cpp +Last Changed Rev: 1571 +Last Changed Date: 2017-10-03 14:12:22.000000002 +0200 ./slsDetector/slsDetector.cpp diff --git a/slsDetectorSoftware/slsDetector/gitInfoLib.h b/slsDetectorSoftware/slsDetector/gitInfoLib.h index 0c42ec2a6..e2528c4b3 100644 --- a/slsDetectorSoftware/slsDetector/gitInfoLib.h +++ b/slsDetectorSoftware/slsDetector/gitInfoLib.h @@ -1,11 +1,11 @@ //#define SVNPATH "" #define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" //#define SVNREPPATH "" -#define SVNREPUUIDLIB "0fb1ff01209ad1aa975f39285814c2cc42db2678" -//#define SVNREV 0x1561 +#define SVNREPUUIDLIB "1fd03e9cdd01efd75e3ab8641be71d61b2e1aa10" +//#define SVNREV 0x1571 //#define SVNKIND "" //#define SVNSCHED "" #define SVNAUTHLIB "Dhanya_Maliakal" -#define SVNREVLIB 0x1561 -#define SVNDATELIB 0x20170920 +#define SVNREVLIB 0x1571 +#define SVNDATELIB 0x20171003 //