This commit is contained in:
2021-06-28 13:32:44 +02:00
15 changed files with 226 additions and 71 deletions

View File

@ -1193,6 +1193,41 @@ std::string CmdProxy::Scan(int action) {
return os.str();
}
std::string CmdProxy::Trigger(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "trigger") {
os << "[Eiger][Mythen3] Sends software trigger signal to detector";
} else if (cmd == "blockingtrigger") {
os << "[Eiger] Sends software trigger signal to detector and "
"blocks till "
"the frames are sent out for that trigger.";
} else {
throw sls::RuntimeError("unknown command " + cmd);
}
os << '\n';
} else if (action == slsDetectorDefs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw sls::RuntimeError("Cannot execute this at module level");
}
if (!args.empty()) {
WrongNumberOfParameters(0);
}
bool block = false;
if (cmd == "blockingtrigger") {
block = true;
}
det->sendSoftwareTrigger(block);
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
/* Network Configuration (Detector<->Receiver) */
std::string CmdProxy::UDPDestinationIP(int action) {

View File

@ -571,7 +571,6 @@ class CmdProxy {
return ToString(value, unit);
}
using FunctionMap = std::map<std::string, std::string (CmdProxy::*)(int)>;
using StringMap = std::map<std::string, std::string>;
@ -839,7 +838,7 @@ class CmdProxy {
{"rx_framescaught", &CmdProxy::rx_framescaught},
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
{"nextframenumber", &CmdProxy::nextframenumber},
{"trigger", &CmdProxy::trigger},
{"trigger", &CmdProxy::Trigger},
{"scan", &CmdProxy::Scan},
{"scanerrmsg", &CmdProxy::scanerrmsg},
@ -900,6 +899,7 @@ class CmdProxy {
{"rx_zmqhwm", &CmdProxy::rx_zmqhwm},
/* Eiger Specific */
{"blockingtrigger", &CmdProxy::Trigger},
{"subexptime", &CmdProxy::subexptime},
{"subdeadtime", &CmdProxy::subdeadtime},
{"overflow", &CmdProxy::overflow},
@ -1094,6 +1094,7 @@ class CmdProxy {
std::string ReceiverStatus(int action);
std::string DetectorStatus(int action);
std::string Scan(int action);
std::string Trigger(int action);
/* Network Configuration (Detector<->Receiver) */
std::string UDPDestinationIP(int action);
std::string UDPDestinationIP2(int action);
@ -1445,8 +1446,8 @@ class CmdProxy {
"and automatically returns to idle at the end of readout.");
EXECUTE_SET_COMMAND(stop, stopDetector,
"\n\tAbort detector acquisition. Status changes "
"to IDLE or STOPPED. Goes to stop server.");
"\n\tAbort detector acquisition. Status changes "
"to IDLE or STOPPED. Goes to stop server.");
GET_COMMAND(rx_framescaught, getFramesCaught,
"\n\tNumber of frames caught by receiver.");
@ -1460,10 +1461,6 @@ class CmdProxy {
"Stopping acquisition might result in "
"different frame numbers for different modules.");
EXECUTE_SET_COMMAND(
trigger, sendSoftwareTrigger,
"\n\t[Eiger][Mythen3] Sends software trigger signal to detector.");
GET_COMMAND(scanerrmsg, getScanErrorMessage,
"\n\tGets Scan error message if scan ended in error for non "
"blocking acquisitions.");

View File

@ -725,8 +725,8 @@ void Detector::setNextFrameNumber(uint64_t value, Positions pos) {
pimpl->Parallel(&Module::setNextFrameNumber, pos, value);
}
void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&Module::sendSoftwareTrigger, pos);
void Detector::sendSoftwareTrigger(const bool block, Positions pos) {
pimpl->Parallel(&Module::sendSoftwareTrigger, pos, block);
}
Result<defs::scanParameters> Detector::getScan(Positions pos) const {

View File

@ -776,7 +776,9 @@ void Module::setNextFrameNumber(uint64_t value) {
sendToDetector(F_SET_NEXT_FRAME_NUMBER, value, nullptr);
}
void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); }
void Module::sendSoftwareTrigger(const bool block) {
sendToDetectorStop(F_SOFTWARE_TRIGGER, static_cast<int>(block), nullptr);
}
defs::scanParameters Module::getScan() const {
return sendToDetector<defs::scanParameters>(F_GET_SCAN);

View File

@ -185,7 +185,7 @@ class Module : public virtual slsDetectorDefs {
std::vector<uint64_t> getNumMissingPackets() const;
uint64_t getNextFrameNumber() const;
void setNextFrameNumber(uint64_t value);
void sendSoftwareTrigger();
void sendSoftwareTrigger(const bool block);
defs::scanParameters getScan() const;
void setScan(const defs::scanParameters t);
std::string getScanErrorMessage() const;