mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 01:00:02 +02:00
update frames caught
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@282 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
eb58540e2e
commit
8b3c4c21eb
@ -115,7 +115,9 @@ enum {
|
||||
|
||||
F_STOP_RECEIVER, /**< stops the receiver listening mode */
|
||||
|
||||
F_GET_RECEIVER_STATUS /**< gets the status of receiver listening mode */
|
||||
F_GET_RECEIVER_STATUS, /**< gets the status of receiver listening mode */
|
||||
|
||||
F_GET_FRAMES_CAUGHT /**< gets the number of frames caught by receiver */
|
||||
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
|
@ -874,7 +874,7 @@ int multiSlsDetector::setOnline(int off) {
|
||||
|
||||
if (off!=GET_ONLINE_FLAG) {
|
||||
thisMultiDetector->onlineFlag=off;
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors+1; i++) {
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
if (detectors[i])
|
||||
detectors[i]->setOnline(off);
|
||||
}
|
||||
@ -3561,7 +3561,7 @@ int multiSlsDetector::readDataFile(string fname, int *data) {
|
||||
int multiSlsDetector::setReceiverOnline(int off) {
|
||||
if (off!=GET_ONLINE_FLAG) {
|
||||
int ret=-100,ret1;
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors+1; i++)
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++)
|
||||
if (detectors[i]){
|
||||
ret1=detectors[i]->setReceiverOnline(off);
|
||||
if(ret==-100)
|
||||
@ -3717,3 +3717,22 @@ slsDetectorDefs::runStatus multiSlsDetector::getReceiverStatus(){
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::getFramesCaughtByReciver() {
|
||||
int ret=-100,ret1;
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++)
|
||||
if (detectors[i]){
|
||||
ret1=detectors[i]->getFramesCaughtByReciver();
|
||||
if(ret==-100)
|
||||
ret=ret1;
|
||||
else if (ret!=ret1)
|
||||
ret=-1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1058,6 +1058,11 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
runStatus getReceiverStatus();
|
||||
|
||||
/** gets the number of frames caught by receiver
|
||||
\returns number of frames caught by receiver
|
||||
*/
|
||||
int getFramesCaughtByReciver();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -5642,3 +5642,36 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus(){
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int slsDetector::getFramesCaughtByReciver(){
|
||||
int fnum=F_GET_FRAMES_CAUGHT;
|
||||
int ret = FAIL;
|
||||
char mess[100];
|
||||
int retval=-1;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Starting Receiver " << std::endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG) {
|
||||
if (dataSocket) {
|
||||
if (dataSocket->Connect()>=0) {
|
||||
dataSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
dataSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
dataSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
else{
|
||||
dataSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Receiver returned error: " << mess << std::endl;
|
||||
}
|
||||
dataSocket->Disconnect();
|
||||
/*if (ret==FORCE_UPDATE)
|
||||
updateReceiver();*/
|
||||
}
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -1423,6 +1423,12 @@ typedef struct sharedSlsDetector {
|
||||
*/
|
||||
runStatus getReceiverStatus();
|
||||
|
||||
/** gets the number of frames caught by receiver
|
||||
\returns number of frames caught by receiver
|
||||
*/
|
||||
int getFramesCaughtByReciver();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@ -472,6 +472,11 @@ int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
|
||||
*/
|
||||
virtual runStatus getReceiverStatus()=0;
|
||||
|
||||
/** gets the number of frames caught by receiver
|
||||
\returns number of frames caught by receiver
|
||||
*/
|
||||
virtual int getFramesCaughtByReciver()=0;
|
||||
|
||||
|
||||
/** returns detector type string from detector type index
|
||||
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
||||
|
@ -651,6 +651,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="framescaught";
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||
i++;
|
||||
|
||||
|
||||
|
||||
numberOfCommands=i;
|
||||
@ -1433,8 +1437,11 @@ string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action){
|
||||
}
|
||||
}
|
||||
|
||||
if(receiver)
|
||||
if(receiver){
|
||||
//int ret=myDet->setReceiverFileIndex();
|
||||
//myDet->setFileIndex(ret);
|
||||
sprintf(ans,"%d", myDet->setReceiverFileIndex());
|
||||
}
|
||||
else
|
||||
sprintf(ans,"%d", myDet->getFileIndex());
|
||||
|
||||
@ -3481,33 +3488,48 @@ string slsDetectorCommand::helpConfiguration(int narg, char *args[], int action)
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
char answer[100];
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpReceiver(narg, args, action);
|
||||
|
||||
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||
return string("receiver not online");
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
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")){
|
||||
if(myDet->stopReceiver()!=FAIL){
|
||||
//update index
|
||||
int index = myDet->setReceiverFileIndex();
|
||||
if(index==-1)
|
||||
return string("could not get receiver file index");
|
||||
myDet->setFileIndex(index);
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
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
|
||||
return helpReceiver(narg, args, action);
|
||||
|
||||
else if(!strcasecmp(args[1],"stop")){
|
||||
if(myDet->stopReceiver()!=FAIL){
|
||||
//update index
|
||||
int index = myDet->setReceiverFileIndex();
|
||||
if(index==-1)
|
||||
return string("could not get receiver file index");
|
||||
myDet->setFileIndex(index);
|
||||
}
|
||||
}else
|
||||
return helpReceiver(narg, args, action);
|
||||
}
|
||||
return myDet->runStatusType(myDet->getReceiverStatus());
|
||||
}
|
||||
|
||||
return myDet->runStatusType(myDet->getReceiverStatus());
|
||||
else if(cmd=="framescaught"){
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot put");
|
||||
else{
|
||||
sprintf(answer,"%d",myDet->getFramesCaughtByReciver());
|
||||
return string(answer);
|
||||
}
|
||||
}
|
||||
else
|
||||
return string("could not decode command");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -3517,9 +3539,10 @@ 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;
|
||||
if (action==GET_ACTION || action==HELP_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" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user