mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 17:18:00 +02:00
configuremac after starting receiver, also telling the server to send packets to receiver or cpu with receiver start and receiver stop
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@290 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -5543,10 +5543,35 @@ int slsDetector::startReceiver(){
|
||||
}
|
||||
dataSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
ret=updateReceiver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//configuremac for gotthard
|
||||
if(ret==OK)
|
||||
if(thisDetector->myDetectorType==GOTTHARD)
|
||||
ret=configureMAC();
|
||||
|
||||
//tell the server to send to receiver and not 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -5574,10 +5599,30 @@ int slsDetector::stopReceiver(){
|
||||
|
||||
dataSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
ret=updateReceiver();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3566,19 +3566,26 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
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();
|
||||
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->stopReceiver()!=FAIL){
|
||||
//update index
|
||||
int index = myDet->setReceiverFileIndex();
|
||||
if(index==-1)
|
||||
return string("could not get receiver file index");
|
||||
myDet->setFileIndex(index);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}else
|
||||
return helpReceiver(narg, args, action);
|
||||
|
Reference in New Issue
Block a user