mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
made sure that server knows whether to stop sending to receiver even if receiver is down, made sure error in configuremac is shown when doing start receiver
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@292 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
f6a2d599a0
commit
733f5b1f3e
@ -2816,7 +2816,7 @@ int configure_mac(int file_des) {
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));printf("retval:%d\n",retval);
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
@ -1011,8 +1011,6 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//receiver
|
||||
|
||||
/**
|
||||
|
@ -4512,13 +4512,15 @@ int slsDetector::configureMAC(){
|
||||
strcpy(arg[2],getServerMAC());
|
||||
|
||||
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "slsDetector configureMAC "<< std::endl;
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
for(i=0;i<3;i++){
|
||||
if(!strcmp(arg[i],"none"))
|
||||
return -1;
|
||||
if(!strcmp(arg[i],"none")){
|
||||
std::cout<< "Configure MAC Error. IP/MAC Addresses has INVALID format"<< std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -5275,9 +5277,11 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
||||
/*receiver*/
|
||||
int slsDetector::setReceiverOnline(int off) {
|
||||
if (off!=GET_ONLINE_FLAG) {
|
||||
thisDetector->receiverOnlineFlag=off;
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG)
|
||||
setReceiverTCPSocket();
|
||||
if(strcmp(thisDetector->receiverIP,"none")){
|
||||
thisDetector->receiverOnlineFlag=off;
|
||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG)
|
||||
setReceiverTCPSocket();
|
||||
}
|
||||
}
|
||||
return thisDetector->receiverOnlineFlag;
|
||||
}
|
||||
@ -5561,7 +5565,8 @@ int slsDetector::startReceiver(){
|
||||
|
||||
int slsDetector::stopReceiver(){
|
||||
int fnum=F_STOP_RECEIVER;
|
||||
int ret = FAIL;
|
||||
//different iret for server, should not return ok if receiver didnt connect
|
||||
int ret = FAIL,iret;
|
||||
char mess[100];
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -5586,20 +5591,18 @@ int slsDetector::stopReceiver(){
|
||||
}
|
||||
|
||||
//tell the server to NOT send to receiver and instead to CPU
|
||||
if(ret==OK){
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
ret=updateDetector();
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->ReceiveDataOnly(&iret,sizeof(iret));
|
||||
if (iret==FAIL){
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (iret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#define SLS_DETECTOR_H
|
||||
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetectorUtils.h"
|
||||
#include "energyConversion.h"
|
||||
#include "angleConversionConstant.h"
|
||||
|
@ -3595,39 +3595,48 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
if (action==HELP_ACTION)
|
||||
return helpReceiver(narg, args, action);
|
||||
|
||||
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||
return string("receiver not online");
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
if(!strcasecmp(args[1],"start")){
|
||||
|
||||
if(myDet->setReceiverOnline()!=ONLINE_FLAG)
|
||||
return string("cannot connect to receiver");
|
||||
|
||||
if(myDet->getReceiverStatus()==IDLE){
|
||||
//update receiver index
|
||||
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||
return string("could not set receiver file index");
|
||||
|
||||
//to configure the server
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->startReceiver();
|
||||
}
|
||||
}
|
||||
|
||||
else if(!strcasecmp(args[1],"stop")){
|
||||
if(myDet->getReceiverStatus()==RUNNING){
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
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(myDet->stopReceiver()!=FAIL){
|
||||
//update index
|
||||
int index = myDet->setReceiverFileIndex();
|
||||
if(index==-1)
|
||||
return string("could not get receiver file index");
|
||||
myDet->setFileIndex(index);
|
||||
}
|
||||
}else
|
||||
else if(myDet->setReceiverOnline()!=ONLINE_FLAG)
|
||||
return string("cannot connect to receiver");
|
||||
}
|
||||
|
||||
else
|
||||
return helpReceiver(narg, args, action);
|
||||
}
|
||||
return myDet->runStatusType(myDet->getReceiverStatus());
|
||||
}
|
||||
|
||||
|
||||
else if(cmd=="framescaught"){
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot put");
|
||||
|
Loading…
x
Reference in New Issue
Block a user