changed dataport to receiver port

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@352 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-11-21 08:27:12 +00:00
parent ffd392c7eb
commit a86141a608
3 changed files with 48 additions and 42 deletions

View File

@ -465,7 +465,7 @@ int slsDetector::initializeDetectorSize(detectorType type) {
/** set ports to defaults */ /** set ports to defaults */
thisDetector->controlPort=DEFAULT_PORTNO; thisDetector->controlPort=DEFAULT_PORTNO;
thisDetector->stopPort=DEFAULT_PORTNO+1; thisDetector->stopPort=DEFAULT_PORTNO+1;
thisDetector->dataPort=DEFAULT_PORTNO+2; thisDetector->receiverPort=DEFAULT_PORTNO+2;
/** set thisDetector->myDetectorType to type and according to this set nChans, nChips, nDacs, nAdcs, nModMax, dynamicRange, nMod*/ /** set thisDetector->myDetectorType to type and according to this set nChans, nChips, nDacs, nAdcs, nModMax, dynamicRange, nMod*/
thisDetector->myDetectorType=type; thisDetector->myDetectorType=type;
switch(thisDetector->myDetectorType) { switch(thisDetector->myDetectorType) {
@ -3498,7 +3498,7 @@ int slsDetector::setPort(portType index, int num){
break; break;
case DATA_PORT: case DATA_PORT:
s=dataSocket; s=dataSocket;
retval=thisDetector->dataPort; retval=thisDetector->receiverPort;
if(strcmp(thisDetector->receiverIP,"none")){ if(strcmp(thisDetector->receiverIP,"none")){
if (s==NULL) setReceiverTCPSocket("",DEFAULT_PORTNO+2); if (s==NULL) setReceiverTCPSocket("",DEFAULT_PORTNO+2);
if (dataSocket) s=dataSocket; if (dataSocket) s=dataSocket;
@ -3542,7 +3542,7 @@ int slsDetector::setPort(portType index, int num){
thisDetector->controlPort=retval; thisDetector->controlPort=retval;
break; break;
case DATA_PORT: case DATA_PORT:
thisDetector->dataPort=retval; thisDetector->receiverPort=retval;
break; break;
case STOP_PORT: case STOP_PORT:
thisDetector->stopPort=retval; thisDetector->stopPort=retval;
@ -3563,9 +3563,9 @@ int slsDetector::setPort(portType index, int num){
break; break;
case DATA_PORT: case DATA_PORT:
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG) if(thisDetector->receiverOnlineFlag==ONLINE_FLAG)
thisDetector->dataPort=retval; thisDetector->receiverPort=retval;
else else
thisDetector->dataPort=num; thisDetector->receiverPort=num;
break; break;
case STOP_PORT: case STOP_PORT:
@ -3581,7 +3581,7 @@ int slsDetector::setPort(portType index, int num){
retval=thisDetector->controlPort; retval=thisDetector->controlPort;
break; break;
case DATA_PORT: case DATA_PORT:
retval=thisDetector->dataPort; retval=thisDetector->receiverPort;
break; break;
case STOP_PORT: case STOP_PORT:
retval=thisDetector->stopPort; retval=thisDetector->stopPort;
@ -3594,7 +3594,7 @@ int slsDetector::setPort(portType index, int num){
#ifdef VERBOSE #ifdef VERBOSE
cout << thisDetector->controlPort<< " " << thisDetector->dataPort << " " << thisDetector->stopPort << endl; cout << thisDetector->controlPort<< " " << thisDetector->receiverPort << " " << thisDetector->stopPort << endl;
#endif #endif
@ -4948,6 +4948,7 @@ int slsDetector::writeConfigurationFile(string const fname){
int slsDetector::writeConfigurationFile(ofstream &outfile, int id){ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
slsDetectorCommand *cmd=new slsDetectorCommand(this); slsDetectorCommand *cmd=new slsDetectorCommand(this);
int nvar=15;
string names[]={ \ string names[]={ \
"hostname", \ "hostname", \
@ -4968,24 +4969,29 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
// to be added in the future // to be added in the future
// "trimen", // "trimen",
// "dataport", // "receiverPort",
if (thisDetector->myDetectorType==GOTTHARD) { if (thisDetector->myDetectorType==GOTTHARD) {
names[4]= "angdir"; names[0]= "hostname";
names[5]= "moveflag"; names[1]= "port";
names[6]= "lock"; names[2]= "stopport";
names[7]= "caldir"; names[3]= "receiverport";
names[8]= "ffdir"; names[4]= "settingsdir";
names[9]= "extsig"; names[5]= "angdir";
names[10]="receivermac"; names[6]= "moveflag";
names[11]="servermac"; names[7]= "lock";
names[12]="receiverip"; names[8]= "caldir";
names[13]="outdir"; names[9]= "ffdir";
names[14]="vhighvoltage"; names[10]= "extsig";
names[11]="receivermac";
names[12]="servermac";
names[13]="receiverip";
names[14]="outdir";
names[15]="vhighvoltage";
nvar=16;
} }
int nvar=15;
int nsig=4;//-1; int nsig=4;//-1;
int iv=0; int iv=0;
char *args[100]; char *args[100];
@ -5309,10 +5315,10 @@ string slsDetector::checkReceiverOnline() {
int slsDetector::setReceiverTCPSocket(string const name, int const data_port){ int slsDetector::setReceiverTCPSocket(string const name, int const receiver_port){
char thisName[MAX_STR_LENGTH]; char thisName[MAX_STR_LENGTH];
int thisDP; int thisRP;
int retval=OK; int retval=OK;
//if receiver ip given //if receiver ip given
@ -5329,26 +5335,26 @@ int slsDetector::setReceiverTCPSocket(string const name, int const data_port){
} else } else
strcpy(thisName,thisDetector->receiverIP); strcpy(thisName,thisDetector->receiverIP);
//if dataport given //if receiverPort given
if (data_port>0) { if (receiver_port>0) {
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "setting data port" << std::endl; std::cout<< "setting data port" << std::endl;
#endif #endif
thisDP=data_port; thisRP=receiver_port;
thisDetector->dataPort=thisDP; thisDetector->receiverPort=thisRP;
if (dataSocket){ if (dataSocket){
delete dataSocket; delete dataSocket;
dataSocket=NULL; dataSocket=NULL;
} }
} else } else
thisDP=thisDetector->dataPort; thisRP=thisDetector->receiverPort;
//create data socket //create data socket
if (!dataSocket) { if (!dataSocket) {
dataSocket=new MySocketTCP(thisName, thisDP); dataSocket=new MySocketTCP(thisName, thisRP);
if (dataSocket->getErrorStatus()){ if (dataSocket->getErrorStatus()){
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Could not connect Data socket "<<thisName << " " << thisDP << std::endl; std::cout<< "Could not connect Data socket "<<thisName << " " << thisRP << std::endl;
#endif #endif
delete dataSocket; delete dataSocket;
dataSocket=NULL; dataSocket=NULL;
@ -5356,7 +5362,7 @@ int slsDetector::setReceiverTCPSocket(string const name, int const data_port){
} }
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
else else
std::cout<< "Data socket connected "<< thisName << " " << thisDP << std::endl; std::cout<< "Data socket connected "<< thisName << " " << thisRP << std::endl;
#endif #endif
} }
//check if it connects //check if it connects

View File

@ -81,8 +81,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
int controlPort; int controlPort;
/** is the port used to stop the acquisition normally it should not be changed*/ /** is the port used to stop the acquisition normally it should not be changed*/
int stopPort; int stopPort;
/** is the port used to acquire the data normally it should not be changed*/ /** is the port used to communicate with the receiver*/
int dataPort; int receiverPort;
/** detector type \ see :: detectorType*/ /** detector type \ see :: detectorType*/
detectorType myDetectorType; detectorType myDetectorType;
@ -363,8 +363,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
int getControlPort() {return thisDetector->controlPort;}; int getControlPort() {return thisDetector->controlPort;};
/** returns the detector stop port \sa sharedSlsDetector */ /** returns the detector stop port \sa sharedSlsDetector */
int getStopPort() {return thisDetector->stopPort;}; int getStopPort() {return thisDetector->stopPort;};
/** returns the detector data port \sa sharedSlsDetector */ /** returns the receiver port \sa sharedSlsDetector */
int getDataPort() {return thisDetector->dataPort;}; int getReceiverPort() {return thisDetector->receiverPort;};
/** Locks/Unlocks the connection to the server /** Locks/Unlocks the connection to the server
/param lock sets (1), usets (0), gets (-1) the lock /param lock sets (1), usets (0), gets (-1) the lock
@ -386,9 +386,9 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
/** disconnect from the control port */ /** disconnect from the control port */
int disconnectControl(); int disconnectControl();
/** connect to the data port */ /** connect to the receiver port */
int connectData(); int connectData();
/** disconnect from the data port */ /** disconnect from the receiver port */
int disconnectData(); int disconnectData();
/** connect to the stop port */ /** connect to the stop port */
@ -1384,12 +1384,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
configure the socket communication and initializes the socket instances configure the socket communication and initializes the socket instances
\param name receiver ip - if "" the current receiver hostname is used \param name receiver ip - if "" the current receiver hostname is used
\param data_port port for receiving data - if -1 the current is used \param receiver_port port for receiving data - if -1 the current is used
\returns OK is connection succeded, FAIL otherwise \returns OK is connection succeded, FAIL otherwise
\sa sharedSlsDetector \sa sharedSlsDetector
*/ */
int setReceiverTCPSocket(string const name="", int const data_port=-1); int setReceiverTCPSocket(string const name="", int const receiver_port=-1);
/** /**

View File

@ -340,7 +340,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPort; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPort;
i++; i++;
descrToFuncMap[i].m_pFuncName="dataport"; // descrToFuncMap[i].m_pFuncName="receiverport"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPort; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdPort;
i++; i++;
@ -2253,7 +2253,7 @@ string slsDetectorCommand::cmdPort(int narg, char *args[], int action) {
if (cmd=="port") { if (cmd=="port") {
index=CONTROL_PORT; index=CONTROL_PORT;
} else if (cmd=="dataport") { } else if (cmd=="receiverport") {
index=DATA_PORT; index=DATA_PORT;
} else if (cmd=="stopport") { } else if (cmd=="stopport") {
index=STOP_PORT; index=STOP_PORT;
@ -2277,13 +2277,13 @@ string slsDetectorCommand::helpPort(int narg, char *args[], int action) {
ostringstream os; ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) { if (action==PUT_ACTION || action==HELP_ACTION) {
os << "port i \n sets the communication control port"<< std::endl; os << "port i \n sets the communication control port"<< std::endl;
os << "dataport i \n sets the communication data port"<< std::endl; os << "receiverport i \n sets the communication receiver port"<< std::endl;
os << "stopport i \n sets the communication stop port "<< std::endl; os << "stopport i \n sets the communication stop port "<< std::endl;
} }
if (action==GET_ACTION || action==HELP_ACTION) { if (action==GET_ACTION || action==HELP_ACTION) {
os << "port \n gets the communication control port"<< std::endl; os << "port \n gets the communication control port"<< std::endl;
os << "dataport \n gets the communication data port"<< std::endl; os << "receiverport \n gets the communication receiver port"<< std::endl;
os << "stopport \n gets the communication stop port "<< std::endl; os << "stopport \n gets the communication stop port "<< std::endl;
} }
return os.str(); return os.str();