moved updateDetector/Receiver

This commit is contained in:
Erik Frojdh 2019-01-25 19:12:28 +01:00
parent 82ce6b639c
commit f1d055138c
5 changed files with 436 additions and 545 deletions

View File

@ -763,12 +763,30 @@ std::string multiSlsDetector::checkOnline(int detPos) {
return sls::concatenateNonEmptyStrings(r); return sls::concatenateNonEmptyStrings(r);
} }
int multiSlsDetector::setPort(portType t, int num, int detPos) { int multiSlsDetector::setControlPort(int port_number, int detPos) {
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setPort(t, num); return detectors[detPos]->setControlPort(port_number);
} }
auto r = serialCall(&slsDetector::setPort, t, num); auto r = serialCall(&slsDetector::setControlPort, port_number);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setStopPort(int port_number, int detPos) {
if (detPos >= 0) {
return detectors[detPos]->setStopPort(port_number);
}
auto r = serialCall(&slsDetector::setStopPort, port_number);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReceiverPort(int port_number, int detPos) {
if (detPos >= 0) {
return detectors[detPos]->setReceiverPort(port_number);
}
auto r = serialCall(&slsDetector::setReceiverPort, port_number);
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }

View File

@ -418,13 +418,30 @@ class multiSlsDetector : public virtual slsDetectorDefs,
std::string checkOnline(int detPos = -1); std::string checkOnline(int detPos = -1);
/** /**
* Set/Gets TCP Port of detector or receiver * Set/Gets TCP Port of the detector
* @param t port type * @param port_number (-1 gets)
* @param num port number (-1 gets)
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns port number * @returns port number
*/ */
int setPort(portType t, int num = -1, int detPos = -1); int setControlPort(int port_number = -1, int detPos = -1);
/**
* Set/Gets TCP STOP Port of the detector
* @param port_number (-1 gets)
* @param detPos -1 for all detectors in list or specific detector position
* @returns port number
*/
int setStopPort(int port_number = -1, int detPos = -1);
/**
* Set/Gets TCP Port of the receiver
* @param port_number (-1 gets)
* @param detPos -1 for all detectors in list or specific detector position
* @returns port number
*/
int setReceiverPort(int port_number = -1, int detPos = -1);
/** /**
* Lock server for this client IP * Lock server for this client IP

File diff suppressed because it is too large Load Diff

View File

@ -470,16 +470,6 @@ public:
*/ */
std::string checkOnline(); std::string checkOnline();
/**
* Set/Gets TCP Port of detector or receiver
* @param t port type
* @param num port number (-1 gets)
* @returns port number
*/
int setPort(portType index, int num=-1);
int setControlPort(int port_number); int setControlPort(int port_number);
/** /**
@ -496,6 +486,8 @@ public:
*/ */
int getStopPort() const; int getStopPort() const;
int setReceiverPort(int port_number);
/** /**
* Returns the receiver TCP port \sa sharedSlsDetector * Returns the receiver TCP port \sa sharedSlsDetector
* @returns the receiver TCP port * @returns the receiver TCP port

View File

@ -2919,9 +2919,7 @@ std::string slsDetectorCommand::cmdPort(int narg, char *args[], int action, int
if (action == HELP_ACTION) if (action == HELP_ACTION)
return helpPort(action); return helpPort(action);
int val; //ret, int val; //ret,
char ans[1000]; char ans[MAX_STR_LENGTH];
portType index;
if (action == PUT_ACTION) { if (action == PUT_ACTION) {
if (sscanf(args[1], "%d", &val)) if (sscanf(args[1], "%d", &val))
; ;
@ -2929,20 +2927,22 @@ std::string slsDetectorCommand::cmdPort(int narg, char *args[], int action, int
return std::string("could not scan port number") + std::string(args[1]); return std::string("could not scan port number") + std::string(args[1]);
} }
myDet->setOnline(ONLINE_FLAG, detPos);
if (cmd == "port") { if (cmd == "port") {
index = CONTROL_PORT; if (action == PUT_ACTION)
myDet->setControlPort(val, detPos);
sprintf(ans, "%d", myDet->setControlPort(-1, detPos));
} else if (cmd == "rx_tcpport") { } else if (cmd == "rx_tcpport") {
index = DATA_PORT; if (action == PUT_ACTION)
myDet->setReceiverPort(val, detPos);
sprintf(ans, "%d", myDet->setReceiverPort(-1, detPos));
} else if (cmd == "stopport") { } else if (cmd == "stopport") {
index = STOP_PORT; if (action == PUT_ACTION)
myDet->setStopPort(val, detPos);
sprintf(ans, "%d", myDet->setStopPort(-1, detPos));
} else } else
return std::string("unknown port type ") + cmd; return std::string("unknown port type ") + cmd;
myDet->setOnline(ONLINE_FLAG, detPos);
if (action == PUT_ACTION)
myDet->setPort(index, val, detPos);
sprintf(ans, "%d", myDet->setPort(index, -1, detPos));
return std::string(ans); return std::string(ans);
} }