From 8fa7e9747052ef219b7bebb79426abd86792f7de Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Wed, 3 Oct 2012 08:08:36 +0000 Subject: [PATCH] receiver works without index git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@278 951219d9-93cf-4727-9268-0efd64621fa3 --- .../multiSlsDetector/multiSlsDetector.cpp | 6 +++--- .../slsDetector/slsDetector.cpp | 3 +-- .../slsDetector/slsDetectorCommand.cpp | 18 +++++++----------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 348056e86..e575259af 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -3595,7 +3595,7 @@ string multiSlsDetector::setReceiverFileName(string fileName) { for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { ret1=detectors[idet]->setReceiverFileName(fileName); - if (ret1=="error") + if (ret=="error") ret=ret1; else if (ret!=ret1) ret=""; @@ -3611,7 +3611,7 @@ string multiSlsDetector::setReceiverFileDir(string fileDir) { for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { ret1=detectors[idet]->setReceiverFileDir(fileDir); - if (ret1=="error") + if (ret=="error") ret=ret1; else if (ret!=ret1) ret=""; @@ -3628,7 +3628,7 @@ int multiSlsDetector::setReceiverFileIndex(int fileIndex) { for (int idet=0; idetnumberOfDetectors; idet++) { if (detectors[idet]) { ret1=detectors[idet]->setReceiverFileIndex(fileIndex); - if (ret1==-100) + if (ret==-100) ret=ret1; else if (ret!=ret1) ret=-1; diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 3da4f7aba..a1a0ae568 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -5511,7 +5511,6 @@ string slsDetector::setReceiverFileDir(string fileDir) { updateReceiver();*/ } } - return string(retval); } @@ -5634,7 +5633,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus(){ dataSocket->ReceiveDataOnly(mess,sizeof(mess)); std::cout<< "Receiver returned error: " << mess << std::endl; }else - stopSocket->ReceiveDataOnly(&retval,sizeof(retval)); + dataSocket->ReceiveDataOnly(&retval,sizeof(retval)); dataSocket->Disconnect(); } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 9a2c2bf44..51bc3edf0 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -1303,8 +1303,7 @@ string slsDetectorCommand::cmdOutDir(int narg, char *args[], int action){ return helpOutDir(narg, args, action); } - if(myDet->getNetworkParameter(RECEIVER_IP)!="none") - if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) + if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) receiver = true; if (action==PUT_ACTION) { @@ -1342,8 +1341,7 @@ string slsDetectorCommand::cmdFileName(int narg, char *args[], int action){ return helpFileName(narg, args, action); } - if(myDet->getNetworkParameter(RECEIVER_IP)!="none") - if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) + if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) receiver = true; if (action==PUT_ACTION) { @@ -1413,8 +1411,7 @@ string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action){ return helpFileName(narg, args, action); } - if(myDet->getNetworkParameter(RECEIVER_IP)!="none") - if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) + if(myDet->setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) receiver = true; if (action==PUT_ACTION) { @@ -2152,10 +2149,10 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG) return string("receiver not online"); //outdir - if(myDet->setReceiverFileDir(myDet->getFilePath())!=myDet->getFilePath()) + if(myDet->setReceiverFileDir(myDet->getFilePath()).compare(myDet->getFilePath())) return string("could not set up receiver file outdir"); //fname - if(myDet->setReceiverFileName(myDet->getFileName())!=myDet->getFileName()) + if(myDet->setReceiverFileName(myDet->getFileName()).compare(myDet->getFileName())) return string("could not set up receiver file name"); //index if(myDet->setReceiverFileIndex(myDet->getFileIndex())!=myDet->getFileIndex()) @@ -3482,15 +3479,14 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) { return string("receiver not online"); if (action==PUT_ACTION) { - - if(strcasecmp(args[1],"start")){ + if(!strcasecmp(args[1],"start")){ //update receiver index if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1) return string("could not set receiver file index"); myDet->startReceiver(); } - else if(strcasecmp(args[1],"stop")){ + else if(!strcasecmp(args[1],"stop")){ if(myDet->stopReceiver()!=FAIL){ //update index int index = myDet->setReceiverFileIndex();