mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +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:
@ -2816,7 +2816,7 @@ int configure_mac(int file_des) {
|
|||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
n += sendDataOnly(file_des,&retval,sizeof(retval));printf("retval:%d\n",retval);
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
|
@ -1011,8 +1011,6 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//receiver
|
//receiver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4512,13 +4512,15 @@ int slsDetector::configureMAC(){
|
|||||||
strcpy(arg[2],getServerMAC());
|
strcpy(arg[2],getServerMAC());
|
||||||
|
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "slsDetector configureMAC "<< std::endl;
|
std::cout<< "slsDetector configureMAC "<< std::endl;
|
||||||
//#endif
|
#endif
|
||||||
|
|
||||||
for(i=0;i<3;i++){
|
for(i=0;i<3;i++){
|
||||||
if(!strcmp(arg[i],"none"))
|
if(!strcmp(arg[i],"none")){
|
||||||
return -1;
|
std::cout<< "Configure MAC Error. IP/MAC Addresses has INVALID format"<< std::endl;
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -5275,9 +5277,11 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
|||||||
/*receiver*/
|
/*receiver*/
|
||||||
int slsDetector::setReceiverOnline(int off) {
|
int slsDetector::setReceiverOnline(int off) {
|
||||||
if (off!=GET_ONLINE_FLAG) {
|
if (off!=GET_ONLINE_FLAG) {
|
||||||
thisDetector->receiverOnlineFlag=off;
|
if(strcmp(thisDetector->receiverIP,"none")){
|
||||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG)
|
thisDetector->receiverOnlineFlag=off;
|
||||||
setReceiverTCPSocket();
|
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG)
|
||||||
|
setReceiverTCPSocket();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return thisDetector->receiverOnlineFlag;
|
return thisDetector->receiverOnlineFlag;
|
||||||
}
|
}
|
||||||
@ -5561,7 +5565,8 @@ int slsDetector::startReceiver(){
|
|||||||
|
|
||||||
int slsDetector::stopReceiver(){
|
int slsDetector::stopReceiver(){
|
||||||
int fnum=F_STOP_RECEIVER;
|
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];
|
char mess[100];
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -5586,20 +5591,18 @@ int slsDetector::stopReceiver(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
//tell the server to NOT send to receiver and instead to CPU
|
//tell the server to NOT send to receiver and instead to CPU
|
||||||
if(ret==OK){
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (controlSocket) {
|
||||||
if (controlSocket) {
|
if (controlSocket->Connect()>=0) {
|
||||||
if (controlSocket->Connect()>=0) {
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->ReceiveDataOnly(&iret,sizeof(iret));
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
if (iret==FAIL){
|
||||||
if (ret==FAIL){
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
|
||||||
}
|
|
||||||
controlSocket->Disconnect();
|
|
||||||
if (ret==FORCE_UPDATE)
|
|
||||||
ret=updateDetector();
|
|
||||||
}
|
}
|
||||||
|
controlSocket->Disconnect();
|
||||||
|
if (iret==FORCE_UPDATE)
|
||||||
|
updateDetector();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#define SLS_DETECTOR_H
|
#define SLS_DETECTOR_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "multiSlsDetector.h"
|
||||||
#include "slsDetectorUtils.h"
|
#include "slsDetectorUtils.h"
|
||||||
#include "energyConversion.h"
|
#include "energyConversion.h"
|
||||||
#include "angleConversionConstant.h"
|
#include "angleConversionConstant.h"
|
||||||
|
@ -3595,39 +3595,48 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
|||||||
if (action==HELP_ACTION)
|
if (action==HELP_ACTION)
|
||||||
return helpReceiver(narg, args, 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(cmd=="receiver"){
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if(!strcasecmp(args[1],"start")){
|
if(!strcasecmp(args[1],"start")){
|
||||||
|
|
||||||
|
if(myDet->setReceiverOnline()!=ONLINE_FLAG)
|
||||||
|
return string("cannot connect to receiver");
|
||||||
|
|
||||||
if(myDet->getReceiverStatus()==IDLE){
|
if(myDet->getReceiverStatus()==IDLE){
|
||||||
//update receiver index
|
//update receiver index
|
||||||
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||||
return string("could not set receiver file index");
|
return string("could not set receiver file index");
|
||||||
|
|
||||||
//to configure the server
|
//to configure the server
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
|
||||||
myDet->startReceiver();
|
myDet->startReceiver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!strcasecmp(args[1],"stop")){
|
else if(!strcasecmp(args[1],"stop")){
|
||||||
if(myDet->getReceiverStatus()==RUNNING){
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
if(myDet->stopReceiver()!=FAIL){
|
||||||
if(myDet->stopReceiver()!=FAIL){
|
//update index
|
||||||
//update index
|
int index = myDet->setReceiverFileIndex();
|
||||||
int index = myDet->setReceiverFileIndex();
|
if(index==-1)
|
||||||
if(index==-1)
|
return string("could not get receiver file index");
|
||||||
return string("could not get receiver file index");
|
myDet->setFileIndex(index);
|
||||||
myDet->setFileIndex(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}else
|
else if(myDet->setReceiverOnline()!=ONLINE_FLAG)
|
||||||
|
return string("cannot connect to receiver");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
return helpReceiver(narg, args, action);
|
return helpReceiver(narg, args, action);
|
||||||
}
|
}
|
||||||
return myDet->runStatusType(myDet->getReceiverStatus());
|
return myDet->runStatusType(myDet->getReceiverStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else if(cmd=="framescaught"){
|
else if(cmd=="framescaught"){
|
||||||
if (action==PUT_ACTION)
|
if (action==PUT_ACTION)
|
||||||
return string("cannot put");
|
return string("cannot put");
|
||||||
|
Reference in New Issue
Block a user