This commit is contained in:
maliakal_d 2019-08-07 15:51:25 +02:00
parent dc1e01b444
commit 0a2a5933da
2 changed files with 69 additions and 69 deletions

View File

@ -203,15 +203,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
}
}
/**
* Creates/open shared memory, initializes detector structure and members
* Called by constructor/ set hostname / read config file
* @param verify true to verify if shared memory version matches existing
* one
* @param update true to update last user pid, date etc
*/
void setupMultiDetector(bool verify = true, bool update = true); // private
/**
* Loop through the detectors serially and return the result as a vector
*/
@ -251,17 +242,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
void parallelCall(void (slsDetector::*somefunc)(CT...) const,
typename NonDeduced<CT>::type... Args) const;
/**
* Decodes which detector and the corresponding channel numbers for it
* Mainly useful in a multi detector setROI (Gotthard)
* @param offsetX channel number or total channel offset in x direction
* @param offsetY channel number or total channel offset in y direction
* @param channelX channel number from detector offset in x direction
* @param channelY channel number from detector offset in x direction
* @returns detector id or -1 if channel number out of range
*/
int decodeNChannel(int offsetX, int offsetY, int &channelX, int &channelY);// private
/**
* Set acquiring flag in shared memory
* @param b acquiring flag
@ -274,12 +254,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
bool getAcquiringFlag() const;//
/**
* Check if acquiring flag is set, set error if set
* @returns FAIL if not ready, OK if ready
*/
bool isAcquireReady(); // private
/**
* Check version compatibility with detector software
* (if hostname/rx_hostname has been set/ sockets created)
@ -2235,6 +2209,15 @@ class multiSlsDetector : public virtual slsDetectorDefs {
void addSlsDetector(std::unique_ptr<slsDetector> det);
private:
/**
* Creates/open shared memory, initializes detector structure and members
* Called by constructor/ set hostname / read config file
* @param verify true to verify if shared memory version matches existing
* one
* @param update true to update last user pid, date etc
*/
void setupMultiDetector(bool verify = true, bool update = true);
/**
* Initialize (open/create) shared memory for the sharedMultiDetector
* structure
@ -2260,6 +2243,23 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
void updateUserdetails();
/**
* Check if acquiring flag is set, set error if set
* @returns FAIL if not ready, OK if ready
*/
bool isAcquireReady();
/**
* Decodes which detector and the corresponding channel numbers for it
* Mainly useful in a multi detector setROI (Gotthard)
* @param offsetX channel number or total channel offset in x direction
* @param offsetY channel number or total channel offset in y direction
* @param channelX channel number from detector offset in x direction
* @param channelY channel number from detector offset in x direction
* @returns detector id or -1 if channel number out of range
*/
int decodeNChannel(int offsetX, int offsetY, int &channelX, int &channelY);
/**
* Execute in command line and return result
* @param cmd command

View File

@ -131,37 +131,6 @@ void multiSlsDetector::parallelCall(
return;
}
int multiSlsDetector::decodeNChannel(int offsetX, int offsetY, int &channelX,
int &channelY) {
channelX = -1;
channelY = -1;
// loop over
for (size_t i = 0; i < detectors.size(); ++i) {
int x = detectors[i]->getDetectorOffset(X);
int y = detectors[i]->getDetectorOffset(Y);
// check x offset range
if ((offsetX >= x) &&
(offsetX <
(x + detectors[i]->getTotalNumberOfChannelsInclGapPixels(X)))) {
if (offsetY == -1) {
channelX = offsetX - x;
return i;
} else {
// check y offset range
if ((offsetY >= y) &&
(offsetY <
(y + detectors[i]->getTotalNumberOfChannelsInclGapPixels(
Y)))) {
channelX = offsetX - x;
channelY = offsetY - y;
return i;
}
}
}
}
return -1;
}
void multiSlsDetector::setAcquiringFlag(bool flag) {
multi_shm()->acquiringFlag = flag;
}
@ -170,18 +139,6 @@ bool multiSlsDetector::getAcquiringFlag() const {
return multi_shm()->acquiringFlag;
}
bool multiSlsDetector::isAcquireReady() {
if (multi_shm()->acquiringFlag) {
FILE_LOG(logWARNING)
<< "Acquire has already started. "
"If previous acquisition terminated unexpectedly, "
"reset busy flag to restart.(sls_detector_put busy 0)";
return FAIL != 0u;
}
multi_shm()->acquiringFlag = true;
return OK != 0u;
}
void multiSlsDetector::checkDetectorVersionCompatibility(int detPos) {
if (detPos >= 0) {
detectors[detPos]->checkDetectorVersionCompatibility();
@ -362,6 +319,49 @@ void multiSlsDetector::updateUserdetails() {
}
}
bool multiSlsDetector::isAcquireReady() {
if (multi_shm()->acquiringFlag) {
FILE_LOG(logWARNING)
<< "Acquire has already started. "
"If previous acquisition terminated unexpectedly, "
"reset busy flag to restart.(sls_detector_put busy 0)";
return FAIL != 0u;
}
multi_shm()->acquiringFlag = true;
return OK != 0u;
}
int multiSlsDetector::decodeNChannel(int offsetX, int offsetY, int &channelX,
int &channelY) {
channelX = -1;
channelY = -1;
// loop over
for (size_t i = 0; i < detectors.size(); ++i) {
int x = detectors[i]->getDetectorOffset(X);
int y = detectors[i]->getDetectorOffset(Y);
// check x offset range
if ((offsetX >= x) &&
(offsetX <
(x + detectors[i]->getTotalNumberOfChannelsInclGapPixels(X)))) {
if (offsetY == -1) {
channelX = offsetX - x;
return i;
} else {
// check y offset range
if ((offsetY >= y) &&
(offsetY <
(y + detectors[i]->getTotalNumberOfChannelsInclGapPixels(
Y)))) {
channelX = offsetX - x;
channelY = offsetY - y;
return i;
}
}
}
}
return -1;
}
std::string multiSlsDetector::exec(const char *cmd) {
int bufsize = 128;
char buffer[bufsize];