This commit is contained in:
maliakal_d 2019-08-08 11:11:08 +02:00
parent 095a7eac05
commit 553b7d8568
4 changed files with 53 additions and 36 deletions

View File

@ -209,6 +209,26 @@ class Detector {
*/ */
Result<std::string> getDetectorTypeAsString(Positions pos = {}) const; Result<std::string> getDetectorTypeAsString(Positions pos = {}) const;
/**
* Returns the number of detectors in the multidetector structure
* @returns number of detectors
*/
int getNumberOfDetectors() const;
/**
* Returns number of detectors in dimension d
* @param d dimension d
* @returns number of detectors in dimension d
*/
int getNumberOfDetectors(defs::dimension d) const;
/**
* Returns the number of detectors in each direction
@param nx number of detectors in x direction
@param ny number of detectors in y direction
*/
void getNumberOfDetectors(int &nx, int &ny) const;
// Erik // Erik
/** CTB only.Sets the mask applied to every pattern. */ /** CTB only.Sets the mask applied to every pattern. */

View File

@ -347,19 +347,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
std::string getHostname(int detPos = -1) const;// std::string getHostname(int detPos = -1) const;//
/**
* Appends detectors to the end of the list in shared memory
* Connects to them
* @param name concatenated hostname of the sls detectors to be appended to
* the list
*/
void addMultipleDetectors(const char *name);// ????
/** /**
* Get Detector type as an enum * Get Detector type as an enum
* @returns detector type * @returns detector type
*/ */
detectorType getDetectorTypeAsEnum() const; detectorType getDetectorTypeAsEnum() const; //
/** /**
* Get Detector type for a particular sls detector or get the first one * Get Detector type for a particular sls detector or get the first one
@ -367,7 +359,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns detector type of sls detector in position pos, if -1, returns * @returns detector type of sls detector in position pos, if -1, returns
* the first det type * the first det type
*/ */
detectorType getDetectorTypeAsEnum(int detPos);//?? detectorType getDetectorTypeAsEnum(int detPos);//
/** /**
* Concatenates string types of all sls detectors or * Concatenates string types of all sls detectors or
@ -376,27 +368,27 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* @returns detector type of sls detector in position pos, if -1, * @returns detector type of sls detector in position pos, if -1,
* concatenates * concatenates
*/ */
std::string getDetectorTypeAsString(int detPos = -1); std::string getDetectorTypeAsString(int detPos = -1);//
/** /**
* Returns the number of detectors in the multidetector structure * Returns the number of detectors in the multidetector structure
* @returns number of detectors * @returns number of detectors
*/ */
int getNumberOfDetectors() const; int getNumberOfDetectors() const;//
/** /**
* Returns number of detectors in dimension d * Returns number of detectors in dimension d
* @param d dimension d * @param d dimension d
* @returns number of detectors in dimension d * @returns number of detectors in dimension d
*/ */
int getNumberOfDetectors(dimension d) const; int getNumberOfDetectors(dimension d) const;//
/** /**
* Returns the number of detectors in each direction * Returns the number of detectors in each direction
@param nx number of detectors in x direction @param nx number of detectors in x direction
@param ny number of detectors in y direction @param ny number of detectors in y direction
*/ */
void getNumberOfDetectors(int &nx, int &ny) const; void getNumberOfDetectors(int &nx, int &ny) const;//
/** /**
* Returns the total number of channels of all sls detectors from shared * Returns the total number of channels of all sls detectors from shared
@ -2241,6 +2233,14 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/ */
void initializeMembers(bool verify = true); void initializeMembers(bool verify = true);
/**
* Appends detectors to the end of the list in shared memory
* Connects to them
* @param name concatenated hostname of the sls detectors to be appended to
* the list
*/
void addMultipleDetectors(const char *name);//
/** /**
* Update user details in detector structure * Update user details in detector structure
*/ */

View File

@ -169,18 +169,29 @@ Result<std::string> Detector::getDetectorTypeAsString(Positions pos) const {
return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos); return pimpl->Parallel(&slsDetector::getDetectorTypeAsString, pos);
} }
int Detector::getNumberOfDetectors() const {
return pimpl->getNumberOfDetectors();
}
int Detector::getNumberOfDetectors(defs::dimension d) const {
return pimpl->getNumberOfDetectors(d);
}
void Detector::getNumberOfDetectors(int &nx, int &ny) const {
pimpl->getNumberOfDetectors(nx, ny);
}
// Erik // Erik
Result<uint64_t> Detector::getPatternMask(Positions pos) {
Result<uint64_t> Detector::getPatternMask(Positions pos){
return pimpl->Parallel(&slsDetector::getPatternMask, pos); return pimpl->Parallel(&slsDetector::getPatternMask, pos);
} }
void Detector::setPatternBitMask(uint64_t mask, Positions pos){ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
pimpl->Parallel(&slsDetector::setPatternBitMask, pos, mask); pimpl->Parallel(&slsDetector::setPatternBitMask, pos, mask);
} }
Result<uint64_t> Detector::getPatternBitMask(Positions pos) const{ Result<uint64_t> Detector::getPatternBitMask(Positions pos) const {
return pimpl->Parallel(&slsDetector::getPatternBitMask, pos); return pimpl->Parallel(&slsDetector::getPatternBitMask, pos);
} }
@ -192,7 +203,7 @@ Result<bool> Detector::getLEDEnable(Positions pos) const {
return pimpl->Parallel(&slsDetector::setLEDEnable, pos, -1); return pimpl->Parallel(&slsDetector::setLEDEnable, pos, -1);
} }
void Detector::setDigitalIODelay(uint64_t pinMask, int delay, Positions pos){ void Detector::setDigitalIODelay(uint64_t pinMask, int delay, Positions pos) {
pimpl->Parallel(&slsDetector::setDigitalIODelay, pos, pinMask, delay); pimpl->Parallel(&slsDetector::setDigitalIODelay, pos, pinMask, delay);
} }

View File

@ -275,13 +275,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHostname; descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHostname;
++i; ++i;
/*! \page config
- \b add appends a hostname (or IP address) at the end of the multi-detector structure. Only allowed at multi detector level. Cannot get. \c Returns the current list of detector hostnames. \c (string)
*/
descrToFuncMap[i].m_pFuncName = "add";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHostname;
++i;
/*! \page config /*! \page config
- <b>replace</b> \c Sets the hostname (or IP adress) for a single detector. Only allowed at single detector level. Cannot get. \c Returns the hostnames for that detector \c (string) - <b>replace</b> \c Sets the hostname (or IP adress) for a single detector. Only allowed at single detector level. Cannot get. \c Returns the hostnames for that detector \c (string)
*/ */
@ -2379,12 +2372,12 @@ std::string slsDetectorCommand::cmdHostname(int narg, const char * const args[],
return helpHostname(HELP_ACTION); return helpHostname(HELP_ACTION);
} }
if (action == GET_ACTION) { if (action == GET_ACTION) {
if ((cmd == "add") || (cmd == "replace")) if (cmd == "replace")
return std::string("cannot get"); return std::string("cannot get");
} }
if (action == PUT_ACTION) { if (action == PUT_ACTION) {
if (((cmd == "add") || (cmd == "hostname")) && if ((cmd == "hostname") &&
(detPos >= 0)) { (detPos >= 0)) {
return std::string("Wrong usage - setting hostname/add only from " return std::string("Wrong usage - setting hostname/add only from "
"multiDetector level"); "multiDetector level");
@ -2403,10 +2396,7 @@ std::string slsDetectorCommand::cmdHostname(int narg, const char * const args[],
strcat(hostname, "+"); strcat(hostname, "+");
} }
if (cmd == "add") myDet->setHostname(hostname, detPos);
myDet->addMultipleDetectors(hostname);
else
myDet->setHostname(hostname, detPos);
} }
return myDet->getHostname(detPos); return myDet->getHostname(detPos);
@ -2416,15 +2406,11 @@ std::string slsDetectorCommand::helpHostname(int action) {
std::ostringstream os; std::ostringstream os;
if (action == GET_ACTION || action == HELP_ACTION) { if (action == GET_ACTION || action == HELP_ACTION) {
os << std::string("hostname \t returns the hostname(s) of the multi detector structure.\n"); os << std::string("hostname \t returns the hostname(s) of the multi detector structure.\n");
os << std::string("add \t cannot get\n");
os << std::string("replace \t cannot get\n"); os << std::string("replace \t cannot get\n");
} }
if (action == PUT_ACTION || action == HELP_ACTION) { if (action == PUT_ACTION || action == HELP_ACTION) {
os << std::string("hostname name [name name]\t frees shared memory and " os << std::string("hostname name [name name]\t frees shared memory and "
"sets the hostname (or IP adress). Only allowed at multi detector level.\n"); "sets the hostname (or IP adress). Only allowed at multi detector level.\n");
os << std::string("add det [det det]\t appends a hostname (or IP address) at "
"the end of the multi-detector structure. Only allowed at multi detector level."
"Returns hostnames in the multi detector structure\n");
os << std::string("replace det \t Sets the hostname (or IP adress) for a " os << std::string("replace det \t Sets the hostname (or IP adress) for a "
"single detector. Only allowed at single detector level. " "single detector. Only allowed at single detector level. "
"Returns the hostnames for that detector\n"); "Returns the hostnames for that detector\n");