From 96caf728c862639a43bf8ca0fb0f0b2e12efb9af Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Tue, 3 Oct 2017 14:17:48 +0200 Subject: [PATCH] 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