mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-10 12:00:43 +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:
@ -985,10 +985,6 @@ int slsDetector::setTCPSocket(string const name, int const control_port, int con
|
|||||||
delete stopSocket;
|
delete stopSocket;
|
||||||
stopSocket=NULL;
|
stopSocket=NULL;
|
||||||
}
|
}
|
||||||
if (dataSocket){
|
|
||||||
delete dataSocket;
|
|
||||||
dataSocket=NULL;
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
strcpy(thisName,thisDetector->hostname);
|
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;
|
std::cout<< "Stop socket connected " << thisName << " " << thisSP << std::endl;
|
||||||
#endif
|
#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) {
|
if (retval!=FAIL) {
|
||||||
checkOnline();
|
checkOnline();
|
||||||
} else {
|
} else {
|
||||||
@ -4534,9 +4512,9 @@ 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"))
|
||||||
@ -4555,24 +4533,27 @@ int slsDetector::configureMAC(){
|
|||||||
pcword = strtok (NULL, ".");
|
pcword = strtok (NULL, ".");
|
||||||
}
|
}
|
||||||
strcpy(arg[0],cword);
|
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.
|
//converting MACaddress to hex.
|
||||||
sword.assign(arg[1]);
|
sword.assign(arg[1]);
|
||||||
strcpy(arg[1],"");
|
strcpy(arg[1],"");
|
||||||
stringstream sstr(sword);
|
stringstream sstr(sword);
|
||||||
while(getline(sstr,sword,':'))
|
while(getline(sstr,sword,':'))
|
||||||
strcat(arg[1],sword.c_str());
|
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.
|
//converting server MACaddress to hex.
|
||||||
sword.assign(arg[2]);
|
sword.assign(arg[2]);
|
||||||
strcpy(arg[2],"");
|
strcpy(arg[2],"");
|
||||||
stringstream ssstr(sword);
|
stringstream ssstr(sword);
|
||||||
while(getline(ssstr,sword,':'))
|
while(getline(ssstr,sword,':'))
|
||||||
strcat(arg[2],sword.c_str());
|
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
|
//send to server
|
||||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||||
if (controlSocket) {
|
if (controlSocket) {
|
||||||
@ -5777,9 +5758,9 @@ int slsDetector::updateReceiverNoWait() {
|
|||||||
char lastClientIP[INET_ADDRSTRLEN];
|
char lastClientIP[INET_ADDRSTRLEN];
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
n = dataSocket->ReceiveDataOnly(lastClientIP,sizeof(lastClientIP));
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
cout << "Updating receiver last modified by " << lastClientIP << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
n = dataSocket->ReceiveDataOnly(&ind,sizeof(ind)); cout<<"index:"<<ind<<endl;
|
||||||
//thisDetector->xx=xx;update file index how?
|
//thisDetector->xx=xx;update file index how?
|
||||||
|
@ -771,7 +771,26 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
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();
|
myDet->acquire();
|
||||||
return string("");
|
return string("");
|
||||||
|
|
||||||
@ -864,8 +883,24 @@ string slsDetectorCommand::cmdStatus(int narg, char *args[], int action) {
|
|||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
//myDet->setThreadedProcessing(0);
|
//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();
|
myDet->startAcquisition();
|
||||||
|
}
|
||||||
else if (string(args[1])=="stop")
|
else if (string(args[1])=="stop")
|
||||||
myDet->stopAcquisition();
|
myDet->stopAcquisition();
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user