new socket for slsDetector

This commit is contained in:
Erik Frojdh
2019-01-25 16:44:29 +01:00
parent a1c0d28ddb
commit 89ee1d5bcf
19 changed files with 1341 additions and 1283 deletions

View File

@ -215,12 +215,21 @@ bool multiSlsDetector::isAcquireReady() {
return OK;
}
int multiSlsDetector::checkVersionCompatibility(portType t, int detPos) {
int multiSlsDetector::checkDetectorVersionCompatibility(int detPos) {
if (detPos >= 0) {
return detectors[detPos]->checkVersionCompatibility(t);
return detectors[detPos]->checkDetectorVersionCompatibility();
}
auto r = parallelCall(&slsDetector::checkVersionCompatibility, t);
auto r = parallelCall(&slsDetector::checkDetectorVersionCompatibility);
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::checkReceiverVersionCompatibility(int detPos) {
if (detPos >= 0) {
return detectors[detPos]->checkReceiverVersionCompatibility();
}
auto r = parallelCall(&slsDetector::checkReceiverVersionCompatibility);
return sls::minusOneIfDifferent(r);
}
@ -482,14 +491,28 @@ void multiSlsDetector::addSlsDetector(const std::string &hostname) {
}
}
// get type by connecting
detectorType type = slsDetector::getTypeFromDetector(hostname.c_str(), DEFAULT_PORTNO);
if (type == GENERIC) {
FILE_LOG(logERROR) << "Could not connect to Detector " << hostname
<< " to determine the type!";
setErrorMask(getErrorMask() | MULTI_DETECTORS_NOT_ADDED);
appendNotAddedList(hostname.c_str());
return;
}
int pos = (int)detectors.size();
detectors.push_back(sls::make_unique<slsDetector>(hostname, detId, pos, false));
detectors.push_back(sls::make_unique<slsDetector>(type, detId, pos, false));
thisMultiDetector->numberOfDetectors = detectors.size();
thisMultiDetector->dataBytes += detectors[pos]->getDataBytes();
thisMultiDetector->dataBytesInclGapPixels +=
detectors[pos]->getDataBytesInclGapPixels();
thisMultiDetector->numberOfChannels +=
detectors[pos]->getTotalNumberOfChannels();
detectors[pos]->setHostname(hostname);
detectors[pos]->setOnline(true);
}
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {

View File

@ -216,14 +216,22 @@ class multiSlsDetector : public virtual slsDetectorDefs,
bool isAcquireReady();
/**
* Check version compatibility with detector/receiver software
* Check version compatibility with detector software
* (if hostname/rx_hostname has been set/ sockets created)
* @param p port type control port or receiver port
* @param detPos -1 for all detectors in list or specific detector position
* @returns FAIL for incompatibility, OK for compatibility
*/
int checkVersionCompatibility(portType t, int detPos = -1);
int checkDetectorVersionCompatibility(int detPos = -1);
/**
* Check version compatibility with receiver software
* (if hostname/rx_hostname has been set/ sockets created)
* @param p port type control port or receiver port
* @param detPos -1 for all detectors in list or specific detector position
* @returns FAIL for incompatibility, OK for compatibility
*/
int checkReceiverVersionCompatibility(int detPos = -1);
/**
* Get ID or version numbers
* @param mode version type

View File

@ -88,8 +88,14 @@ class multiSlsDetectorClient {
// call multi detector command line
slsDetectorCommand myCmd(detPtr);
std::cout << "narg: " << parser.n_arguments()+1 << '\n';
std::cout << "narg: " << parser.argv().data() << '\n';
std::cout << "narg: " << parser.detector_id() << '\n';
std::cout << "HEY!!!!!!!!!!!!!!!!!!!!!!! 55555\n";
std::string answer = myCmd.executeLine(parser.n_arguments()+1, parser.argv().data(), action_, parser.detector_id());
std::cout << "HEY!!!!!!!!!!!!!!!!!!!!!!! 9999\n";
if (parser.multi_id()!=0)
std::cout << parser.multi_id() << '-';
if (parser.detector_id() != -1)