From e94677cbf5aa5e418bfd2351a50a9fc3a3485e93 Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Mon, 29 Oct 2012 13:46:04 +0000 Subject: [PATCH] frame index updated for receiver git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@320 951219d9-93cf-4727-9268-0efd64621fa3 --- .../slsDetector/slsDetector.cpp | 21 +++++++++++++++++++ slsDetectorSoftware/slsDetector/slsDetector.h | 5 +++++ .../slsDetector/slsDetectorCommand.cpp | 16 ++++++++++++++ .../slsDetector/slsDetectorUtils.h | 11 +++++++--- 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index e909447be..e9c5b1754 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -1062,6 +1062,9 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con std::cout<< "offline!" << std::endl; #endif } + //default receiver off. if it was on by default, client doesnt know + if(thisDetector->onlineFlag==ONLINE_FLAG) + detectorSendToReceiver(false); return retval; }; @@ -5643,6 +5646,24 @@ int slsDetector::getFramesCaughtByReceiver(){ +int slsDetector::getCurrentFrameIndex(){ + int fnum=F_GET_FRAME_INDEX; + int ret = FAIL; + int retval=-1; + + if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) { +#ifdef VERBOSE + std::cout << "Getting Current Frame Index of Receiver " << std::endl; +#endif + ret=thisReceiver->getInt(fnum,retval); + if(ret==FORCE_UPDATE) + ret=updateReceiver(); + } + + return retval; +} + + int slsDetector::lockReceiver(int lock){ int fnum=F_LOCK_RECEIVER; diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 32c721e0b..d81ceb18e 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -1454,6 +1454,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion { */ int getFramesCaughtByReceiver(); + /** gets the current frame index of receiver + \returns current frame index of receiver + */ + int getCurrentFrameIndex(); + /** Locks/Unlocks the connection to the receiver /param lock sets (1), usets (0), gets (-1) the lock /returns lock status of the receiver diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 15cb352de..6b8d4a396 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -664,6 +664,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; i++; + descrToFuncMap[i].m_pFuncName="frameindex"; + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; + i++; + descrToFuncMap[i].m_pFuncName="r_lock"; // descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdLock; i++; @@ -3521,6 +3525,17 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) { return string(answer); } } + + else if(cmd=="frameindex"){ + if (action==PUT_ACTION) + return string("cannot put"); + else{ + sprintf(answer,"%d",myDet->getCurrentFrameIndex()); + return string(answer); + } + } + + else return string("could not decode command"); @@ -3536,6 +3551,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) { if (action==GET_ACTION || action==HELP_ACTION){ os << "receiver \t returns the status of receiver - can be running or idle" << std::endl; os << "framescaught \t returns the number of frames caught by receiver(average for multi)" << std::endl; + os << "frameindex \t returns the current frame index of receiver(average for multi)" << std::endl; } return os.str(); diff --git a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h index d3eb74590..0a948bbd6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorUtils.h +++ b/slsDetectorSoftware/slsDetector/slsDetectorUtils.h @@ -439,7 +439,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { double getCurrentProgress(); - void incrementProgress(); + void incrementProgress(int i=-1); @@ -611,9 +611,14 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing { virtual string getFileName()=0; /** - \returns frames caught by receiver(average for multi) + \returns frames caught by receiver */ - virtual int getFramesCaughtByReceiver()=0; + virtual int getFramesCaughtByReceiver()=0; + + /** + \returns current frame index of receiver + */ +virtual int getCurrentFrameIndex()=0; protected: