mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 08:39:21 +01:00
WIP
This commit is contained in:
@@ -337,7 +337,6 @@ class Detector {
|
|||||||
void setReceiverPort(int value, Positions pos = {});
|
void setReceiverPort(int value, Positions pos = {});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Erik
|
// Erik
|
||||||
|
|
||||||
Result<int> getFramesCaughtByReceiver(Positions pos = {}) const;
|
Result<int> getFramesCaughtByReceiver(Positions pos = {}) const;
|
||||||
|
|||||||
@@ -520,14 +520,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int getReadNLines(int detPos = -1);//
|
int getReadNLines(int detPos = -1);//
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if each of the detectors are online/offline
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
* @returns empty string if they are all online,
|
|
||||||
* else returns concatenation of strings of all detectors that are offline
|
|
||||||
*/
|
|
||||||
std::string checkOnline(int detPos = -1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/Gets TCP Port of the detector
|
* Set/Gets TCP Port of the detector
|
||||||
* @param port_number (-1 gets)
|
* @param port_number (-1 gets)
|
||||||
@@ -1761,14 +1753,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
bool getUseReceiverFlag(int detPos = -1); //
|
bool getUseReceiverFlag(int detPos = -1); //
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the receiver is really online
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
* @returns empty string if all online, else concatenates hostnames of all
|
|
||||||
* detectors that are offline
|
|
||||||
*/
|
|
||||||
std::string checkReceiverOnline(int detPos = -1); //not needed
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks/Unlocks the connection to the receiver
|
* Locks/Unlocks the connection to the receiver
|
||||||
* @param lock sets (1), usets (0), gets (-1) the lock
|
* @param lock sets (1), usets (0), gets (-1) the lock
|
||||||
|
|||||||
@@ -456,12 +456,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void updateMultiSize(int detx, int dety);
|
void updateMultiSize(int detx, int dety);
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if each of the detector is online/offline
|
|
||||||
* @returns empty string if it is online
|
|
||||||
* else returns hostname if it is offline
|
|
||||||
*/
|
|
||||||
std::string checkOnline();
|
|
||||||
|
|
||||||
int setControlPort(int port_number);
|
int setControlPort(int port_number);
|
||||||
|
|
||||||
@@ -1474,12 +1468,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
bool getUseReceiverFlag() const;
|
bool getUseReceiverFlag() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if the receiver is really online
|
|
||||||
* @returns empty string if online, else returns receiver hostname
|
|
||||||
*/
|
|
||||||
std::string checkReceiverOnline();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks/Unlocks the connection to the receiver
|
* Locks/Unlocks the connection to the receiver
|
||||||
* @param lock sets (1), usets (0), gets (-1) the lock
|
* @param lock sets (1), usets (0), gets (-1) the lock
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ void Detector::setReceiverPort(int value, Positions pos) {
|
|||||||
pimpl->Parallel(&slsDetector::setReceiverPort, pos, value);
|
pimpl->Parallel(&slsDetector::setReceiverPort, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Erik
|
// Erik
|
||||||
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
|
Result<int> Detector::getFramesCaughtByReceiver(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
|
return pimpl->Parallel(&slsDetector::getFramesCaughtByReceiver, pos);
|
||||||
|
|||||||
@@ -788,15 +788,6 @@ int multiSlsDetector::getReadNLines(int detPos) {
|
|||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string multiSlsDetector::checkOnline(int detPos) {
|
|
||||||
if (detPos >= 0) {
|
|
||||||
return detectors[detPos]->checkOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto r = parallelCall(&slsDetector::checkOnline);
|
|
||||||
return sls::concatenateNonEmptyStrings(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int multiSlsDetector::setControlPort(int port_number, int detPos) {
|
int multiSlsDetector::setControlPort(int port_number, int detPos) {
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->setControlPort(port_number);
|
return detectors[detPos]->setControlPort(port_number);
|
||||||
@@ -2995,17 +2986,6 @@ bool multiSlsDetector::getUseReceiverFlag(int detPos) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string multiSlsDetector::checkReceiverOnline(int detPos) {
|
|
||||||
// single
|
|
||||||
if (detPos >= 0) {
|
|
||||||
return detectors[detPos]->checkReceiverOnline();
|
|
||||||
}
|
|
||||||
|
|
||||||
// multi
|
|
||||||
auto r = parallelCall(&slsDetector::checkReceiverOnline);
|
|
||||||
return sls::concatenateNonEmptyStrings(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
int multiSlsDetector::lockReceiver(int lock, int detPos) {
|
int multiSlsDetector::lockReceiver(int lock, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
|
|||||||
@@ -716,17 +716,6 @@ void slsDetector::updateMultiSize(int detx, int dety) {
|
|||||||
shm()->multiSize[1] = dety;
|
shm()->multiSize[1] = dety;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string slsDetector::checkOnline() {
|
|
||||||
std::string retval;
|
|
||||||
try {
|
|
||||||
// Need both control and stop socket to work!
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
|
||||||
auto stop = DetectorSocket(shm()->hostname, shm()->stopPort);
|
|
||||||
} catch (...) {
|
|
||||||
retval = shm()->hostname;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetector::setControlPort(int port_number) {
|
int slsDetector::setControlPort(int port_number) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
@@ -2970,15 +2959,6 @@ void slsDetector::printReceiverConfiguration(TLogLevel level) {
|
|||||||
|
|
||||||
bool slsDetector::getUseReceiverFlag() const { return shm()->useReceiverFlag; }
|
bool slsDetector::getUseReceiverFlag() const { return shm()->useReceiverFlag; }
|
||||||
|
|
||||||
std::string slsDetector::checkReceiverOnline() {
|
|
||||||
try {
|
|
||||||
getReceiverSoftwareVersion();
|
|
||||||
} catch (...) {
|
|
||||||
return shm()->rxHostname;
|
|
||||||
}
|
|
||||||
return std::string();
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetector::lockReceiver(int lock) {
|
int slsDetector::lockReceiver(int lock) {
|
||||||
FILE_LOG(logDEBUG1) << "Setting receiver server lock to " << lock;
|
FILE_LOG(logDEBUG1) << "Setting receiver server lock to " << lock;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|||||||
@@ -287,12 +287,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
commands to configure detector status
|
commands to configure detector status
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \page config
|
|
||||||
- <b>checkonline</b> returns the hostnames of all detectors without connecting to them. \c Returns (string) "All online" or "[list of offline hostnames] : Not online".
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "checkonline";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
|
||||||
++i;
|
|
||||||
/*! \page config
|
/*! \page config
|
||||||
- <b>activate [b] [p]</b> Activates/Deactivates the detector. \c b is 1 for activate, 0 for deactivate. Deactivated detector does not send data. \c p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Used for EIGER only. \c Returns \c (int) (string)
|
- <b>activate [b] [p]</b> Activates/Deactivates the detector. \c b is 1 for activate, 0 for deactivate. Deactivated detector does not send data. \c p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Used for EIGER only. \c Returns \c (int) (string)
|
||||||
*/
|
*/
|
||||||
@@ -1797,13 +1791,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdReceiver;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
/*! \page receiver
|
|
||||||
- <b>rx_checkonline</b> Checks the receiver if it is online/offline mode. Only get! \c Returns (string) "All online" or "[list of offline hostnames] : Not online".
|
|
||||||
*/
|
|
||||||
descrToFuncMap[i].m_pFuncName = "rx_checkonline";
|
|
||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdOnline;
|
|
||||||
++i;
|
|
||||||
|
|
||||||
/*! \page receiver
|
/*! \page receiver
|
||||||
- <b>framescaught</b> gets the number of frames caught by receiver. Average of all for multi-detector command. Only get! \c Returns \c (int)
|
- <b>framescaught</b> gets the number of frames caught by receiver. Average of all for multi-detector command. Only get! \c Returns \c (int)
|
||||||
*/
|
*/
|
||||||
@@ -3207,15 +3194,7 @@ std::string slsDetectorCommand::cmdOnline(int narg, const char * const args[], i
|
|||||||
int ival;
|
int ival;
|
||||||
char ans[1000];
|
char ans[1000];
|
||||||
|
|
||||||
if (cmd == "checkonline") {
|
if (cmd == "activate") {
|
||||||
if (action == PUT_ACTION)
|
|
||||||
return std::string("cannot set");
|
|
||||||
strcpy(ans, myDet->checkOnline(detPos).c_str());
|
|
||||||
if (!strlen(ans))
|
|
||||||
strcpy(ans, "All online");
|
|
||||||
else
|
|
||||||
strcat(ans, " :Not online");
|
|
||||||
} else if (cmd == "activate") {
|
|
||||||
|
|
||||||
if (action == PUT_ACTION) {
|
if (action == PUT_ACTION) {
|
||||||
if (!sscanf(args[1], "%d", &ival))
|
if (!sscanf(args[1], "%d", &ival))
|
||||||
@@ -3235,13 +3214,7 @@ std::string slsDetectorCommand::cmdOnline(int narg, const char * const args[], i
|
|||||||
int ret = myDet->setDeactivatedRxrPaddingMode(-1, detPos);
|
int ret = myDet->setDeactivatedRxrPaddingMode(-1, detPos);
|
||||||
sprintf(ans, "%d %s", myDet->activate(-1, detPos), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
sprintf(ans, "%d %s", myDet->activate(-1, detPos), ret == 1 ? "padding" : (ret == 0 ? "nopadding" : "unknown"));
|
||||||
} else {
|
} else {
|
||||||
if (action == PUT_ACTION)
|
return std::string("unknown command");
|
||||||
return std::string("cannot set");
|
|
||||||
strcpy(ans, myDet->checkReceiverOnline(detPos).c_str());
|
|
||||||
if (!strlen(ans))
|
|
||||||
strcpy(ans, "All receiver online");
|
|
||||||
else
|
|
||||||
strcat(ans, " :Not all receiver online");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ans;
|
return ans;
|
||||||
@@ -3254,8 +3227,6 @@ std::string slsDetectorCommand::helpOnline(int action) {
|
|||||||
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger." << std::endl;
|
os << "activate i [p]\n sets the detector in activated (1) or deactivated (0) mode (does not send data). p is optional and can be padding (default) or nonpadding for receivers for deactivated detectors. Only for Eiger." << std::endl;
|
||||||
}
|
}
|
||||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||||
os << "checkonline \n returns the hostnames of all detectors in offline mode" << std::endl;
|
|
||||||
os << "rx_checkonline \n returns the hostnames of all receiver in offline mode" << std::endl;
|
|
||||||
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger." << std::endl;
|
os << "activate \n gets the detector activated (1) or deactivated (0) mode. And padding or nonpadding for the deactivated receiver. Only for Eiger." << std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
|
|||||||
Reference in New Issue
Block a user