started the basics for sending every nth frame from receiver to gui.incomplete and will be implemented later

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@506 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-04-11 12:00:44 +00:00
parent 02376bbc62
commit 778cd97317
12 changed files with 174 additions and 16 deletions

View File

@ -6015,6 +6015,7 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
n= dataSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned: " << mess << " " << n << std::endl;
delete [] retval;
dataSocket->Disconnect();
return NULL;
} else {
n=dataSocket->ReceiveDataOnly(fName,MAX_STR_LENGTH);
@ -6027,6 +6028,7 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
std::cout<<endl<< "wrong data size received: received " << n << " but expected from receiver " << thisDetector->dataBytes << std::endl;
ret=FAIL;
delete [] retval;
dataSocket->Disconnect();
return NULL;
}
}
@ -6264,3 +6266,23 @@ int64_t slsDetector::clearAllErrorMask(){
}
int slsDetector::setReadReceiverFrequency(int i){
int fnum=F_READ_RECEIVER_FREQUENCY;
int ret = FAIL;
int retval=-1;
int arg = i;
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
#ifdef VERBOSE
std::cout << "Sending read frequency to receiver " << arg << std::endl;
#endif
if (connectData() == OK)
ret=thisReceiver->sendInt(fnum,retval,arg);
if(ret==FAIL)
retval = -1;
if(ret==FORCE_UPDATE)
updateReceiver();
}
return retval;
}

View File

@ -1581,6 +1581,13 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/** sets the receiver udp port \sa sharedSlsDetector */
int setReceiverUDPPort(int udpport);
/** Sets the variable readRxrFrequency.
if Receiver read upon gui request, readRxrFrequency=0,
else every nth frame to be sent to gui
/returns read receiver frequency
*/
int setReadReceiverFrequency(int i=-1);
protected:

View File

@ -707,6 +707,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdLastClient;
i++;
descrToFuncMap[i].m_pFuncName="r_readfreq"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
numberOfCommands=i;
@ -3634,6 +3637,7 @@ string slsDetectorCommand::helpConfiguration(int narg, char *args[], int action)
string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
char answer[100];
int ival = -1;
if (action==HELP_ACTION)
return helpReceiver(narg, args, action);
@ -3670,10 +3674,20 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
sprintf(answer,"%d",myDet->getReceiverCurrentFrameIndex());
return string(answer);
}
}
else if(cmd=="r_readfreq"){
if (action==PUT_ACTION){
if (!sscanf(args[1],"%d",&ival))
return string("Could not scan read frequency mode ")+string(args[1]);
if(ival>=0)
myDet->setReadReceiverFrequency(ival);
}
sprintf(answer,"%d",myDet->setReadReceiverFrequency());
return string(answer);
}
else
return string("could not decode command");
}
@ -3685,10 +3699,12 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION)
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
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;
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;
os << "r_readfreq \t returns the gui read frequency of the receiver" << std::endl;
}
return os.str();

View File

@ -672,6 +672,14 @@ virtual int setROI(int n=-1,ROI roiLimits[]=NULL)=0;
*/
virtual ROI* getROI(int &n)=0;
/** Sets the variable readRxrFrequency.
if Receiver read upon gui request, readRxrFrequency=0,
else every nth frame to be sent to gui
/returns read receiver frequency
*/
virtual int setReadReceiverFrequency(int i=-1)=0;
protected: