frame index updated for receiver

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@320 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-10-29 13:46:04 +00:00
parent 1f69778a6f
commit e94677cbf5
4 changed files with 50 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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: