mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
indenting to emacs format and including check and start receiver before doing acquire or status start
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@291 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
29a540818f
commit
f6a2d599a0
@ -985,10 +985,6 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
delete stopSocket;
|
||||
stopSocket=NULL;
|
||||
}
|
||||
if (dataSocket){
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
}
|
||||
} else
|
||||
strcpy(thisName,thisDetector->hostname);
|
||||
|
||||
@ -1049,25 +1045,7 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
||||
std::cout<< "Stop socket connected " << thisName << " " << thisSP << std::endl;
|
||||
#endif
|
||||
}
|
||||
if (!dataSocket) {
|
||||
dataSocket=new MySocketTCP(thisName, thisDP);
|
||||
if (dataSocket->getErrorStatus()){
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Could not connect Data socket "<<thisName << " " << thisDP << std::endl;
|
||||
#endif
|
||||
|
||||
|
||||
delete dataSocket;
|
||||
dataSocket=NULL;
|
||||
|
||||
|
||||
retval=FAIL;
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
else
|
||||
std::cout<< "Data socket connected "<< thisName << " " << thisDP << std::endl;
|
||||
#endif
|
||||
}
|
||||
if (retval!=FAIL) {
|
||||
checkOnline();
|
||||
} else {
|
||||
@ -4534,9 +4512,9 @@ 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"))
|
||||
@ -4555,24 +4533,27 @@ int slsDetector::configureMAC(){
|
||||
pcword = strtok (NULL, ".");
|
||||
}
|
||||
strcpy(arg[0],cword);
|
||||
std::cout<<"arg0:"<<arg[0]<<"."<<std::endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<<"receiver ip:"<<arg[0]<<"."<<std::endl;
|
||||
#endif
|
||||
//converting MACaddress to hex.
|
||||
sword.assign(arg[1]);
|
||||
strcpy(arg[1],"");
|
||||
stringstream sstr(sword);
|
||||
while(getline(sstr,sword,':'))
|
||||
strcat(arg[1],sword.c_str());
|
||||
std::cout<<"arg1:"<<arg[1]<<"."<<std::endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<<"receiver mac:"<<arg[1]<<"."<<std::endl;
|
||||
#endif
|
||||
//converting server MACaddress to hex.
|
||||
sword.assign(arg[2]);
|
||||
strcpy(arg[2],"");
|
||||
stringstream ssstr(sword);
|
||||
while(getline(ssstr,sword,':'))
|
||||
strcat(arg[2],sword.c_str());
|
||||
std::cout<<"arg2:"<<arg[2]<<"."<<std::endl;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<<"server mac:"<<arg[2]<<"."<<std::endl;
|
||||
#endif
|
||||
//send to server
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
@ -5777,9 +5758,9 @@ int slsDetector::updateReceiverNoWait() {
|
||||
char lastClientIP[INET_ADDRSTRLEN];
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
||||
//thisDetector->xx=xx;update file index how?
|
||||
|
@ -771,7 +771,26 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
#ifdef VERBOSE
|
||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||
#endif
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
//receiver
|
||||
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||
return string("can not connect to receiver");
|
||||
if(myDet->getReceiverStatus()!=RUNNING){
|
||||
//update receiver index
|
||||
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||
return string("could not set receiver file index");
|
||||
//start receiver
|
||||
myDet->startReceiver();
|
||||
usleep(2000000);
|
||||
if(myDet->getReceiverStatus()!=RUNNING)
|
||||
return string("could not start receiver");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
myDet->acquire();
|
||||
return string("");
|
||||
|
||||
@ -864,8 +883,24 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
//myDet->setThreadedProcessing(0);
|
||||
if (string(args[1])=="start")
|
||||
if (string(args[1])=="start"){
|
||||
//receiver
|
||||
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||
if(myDet->setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG)
|
||||
return string("can not connect to receiver");
|
||||
if(myDet->getReceiverStatus()!=RUNNING){
|
||||
//update receiver index
|
||||
if(myDet->setReceiverFileIndex(myDet->getFileIndex())==-1)
|
||||
return string("could not set receiver file index");
|
||||
//start receiver
|
||||
myDet->startReceiver();
|
||||
usleep(2000000);
|
||||
if(myDet->getReceiverStatus()!=RUNNING)
|
||||
return string("could not start receiver");
|
||||
}
|
||||
}
|
||||
myDet->startAcquisition();
|
||||
}
|
||||
else if (string(args[1])=="stop")
|
||||
myDet->stopAcquisition();
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user