inbetween WIP, startstatemachien ugly

This commit is contained in:
2020-06-26 19:08:03 +02:00
parent ee67c28711
commit 902366fede
11 changed files with 335 additions and 27 deletions

View File

@ -178,7 +178,7 @@ std::string CmdProxy::VirtualServer(int action) {
return os.str();
}
std::string CmdProxy::acquire(int action) {
std::string CmdProxy::Acquire(int action) {
std::ostringstream os;
if (action == defs::HELP_ACTION) {
os << cmd << " - Acquire the number of frames set up.\n";
@ -991,6 +991,41 @@ std::string CmdProxy::DetectorStatus(int action) {
return os.str();
}
std::string CmdProxy::Scan(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[dac_name|0|trimbit_scan] [start_val] [stop_val] "
"[step_size]\n\tConfigures to scan "
"dac. Must acquire after this. To cancel the scan configuration "
"set dac to '0' without further arguments."
"\n\t[Eiger]Use trimbit_scan as dac name for a trimbit scan."
<< '\n';
} else if (action == defs::GET_ACTION) {
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getScan();
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() == 1) {
det->disableScan();
os << "scan disabled" << '\n';
} else if (args.size() != 4) {
WrongNumberOfParameters(4);
} else {
auto t = det->enableScan(
StringTo<defs::dacIndex>(args[0]), StringTo<int>(args[1]),
StringTo<int>(args[2]), StringTo<int>(args[3]));
auto nsteps = det->getNumScanSteps().tsquash(
"inconsistent number of scan steps");
os << "scan enabled for " << nsteps << "steps" << '\n';
}
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
/* Network Configuration (Detector<->Receiver) */
std::string CmdProxy::UDPDestinationIP(int action) {

View File

@ -612,7 +612,7 @@ class CmdProxy {
{"gappixels", &CmdProxy::GapPixels},
/* acquisition parameters */
{"acquire", &CmdProxy::acquire},
{"acquire", &CmdProxy::Acquire},
{"frames", &CmdProxy::frames},
{"triggers", &CmdProxy::triggers},
{"exptime", &CmdProxy::Exptime},
@ -737,6 +737,7 @@ class CmdProxy {
{"rx_missingpackets", &CmdProxy::rx_missingpackets},
{"startingfnum", &CmdProxy::startingfnum},
{"trigger", &CmdProxy::trigger},
{"scan", &CmdProxy::Scan},
/* Network Configuration (Detector<->Receiver) */
{"numinterfaces", &CmdProxy::numinterfaces},
@ -965,7 +966,7 @@ class CmdProxy {
std::string SettingsList(int action);
std::string GapPixels(int action);
/* acquisition parameters */
std::string acquire(int action);
std::string Acquire(int action);
std::string Exptime(int action);
std::string Speed(int action);
std::string Adcphase(int action);
@ -983,6 +984,7 @@ class CmdProxy {
/* acquisition */
std::string ReceiverStatus(int action);
std::string DetectorStatus(int action);
std::string Scan(int action);
/* Network Configuration (Detector<->Receiver) */
std::string UDPDestinationIP(int action);
std::string UDPDestinationIP2(int action);

View File

@ -562,6 +562,27 @@ void Detector::sendSoftwareTrigger(Positions pos) {
pimpl->Parallel(&Module::sendSoftwareTrigger, pos);
}
Result<bool> getScan(Positions pos = {}) const {
return pimpl->Parallel(&Module::getScan, pos);
}
Result<int> getNumberOfScanSteps(Positions pos = {}) const {
return pimpl->Parallel(&Module::getNumberOfScanSteps, pos);
}
void disableScan() {
pimpl->Parallel(&Module::disableScan);
setNumberOfFrames(1);
}
void Detector::enableScan(const defs::dacIndex dac, const int start_offset,
const int end_offset, const int step_size) {
pimpl->Parallel(&Module::scan, start_offset, end_offset, step_size, {-1});
auto t =
getNumberOfScanSteps().tsquash("inconsistent number of scan steps");
setNumberOfFrames(nsteps);
}
// Network Configuration (Detector<->Receiver)
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {

View File

@ -451,6 +451,22 @@ void Module::setStartingFrameNumber(uint64_t value) {
void Module::sendSoftwareTrigger() { sendToDetectorStop(F_SOFTWARE_TRIGGER); }
bool Module::getScan() const {
return static_cast<bool>(sendToDetector<int>(F_GET_SCAN));
}
int Module::getNumberOfScanSteps() const {
return sendToDetector<int>(F_GET_NUM_SCAN_STEPS);
}
void Module::disableScan() { sendToDetector(F_DISABLE_SCAN); }
void Module::enableScan(const defs::dacIndex dac, const int start_offset,
const int end_offset, const int step_size) {
int args[]{static_cast<int>(dac), start_offset, end_offset, step_size};
sendToDetector(F_ENABLE_SCAN, args, nullptr);
}
// Network Configuration (Detector<->Receiver)
int Module::getNumberofUDPInterfacesFromShm() {

View File

@ -167,6 +167,11 @@ class Module : public virtual slsDetectorDefs {
uint64_t getStartingFrameNumber();
void setStartingFrameNumber(uint64_t value);
void sendSoftwareTrigger();
bool getScan() const;
int getNumberOfScanSteps() const;
void disableScan();
void enableScan(const defs::dacIndex dac, const int start_offset,
const int end_offset, const int step_size);
/**************************************************
* *