This commit is contained in:
2019-10-28 12:26:30 +01:00
parent 19b85b8e40
commit 7b59b7e7d5
4 changed files with 72 additions and 42 deletions

View File

@@ -1276,18 +1276,53 @@ std::string CmdProxy::MinMaxEnergyThreshold(int action) {
} else {
throw sls::RuntimeError("Unknown command, use list to list all commands");
}
} else if (action == defs::GET_ACTION) {
if (args.size() != 0) {
WrongNumberOfParameters(0);
} else {
bool emax = false;
if (cmd == "emin") {
emax = false;
} else if (cmd == "emax") {
emax = true;
} else {
throw sls::RuntimeError("Unknown command, use list to list all commands");
}
if (action == defs::GET_ACTION) {
if (args.size() != 0) {
WrongNumberOfParameters(0);
}
auto t = det->getDetectorMinMaxEnergyThreshold(emax, {det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setDetectorMinMaxEnergyThreshold(emax, std::stoi(args[0]), {det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
auto t = det->getDetectorMinMaxEnergyThreshold((cmd == "emax" ? true :false), {det_id});
os << OutString(t) << '\n';
}
return os.str();
}
/* Advanced */
std::string CmdProxy::ProgramFpga(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[fname.pof]\n\t[Jungfrau][Ctb] Programs FPGA from pof file." << '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setDetectorMinMaxEnergyThreshold((cmd == "emax" ? true : false), std::stoi(args[0]), {det_id});
os << args.front() << '\n';
if (args[0].find(".pof") == std::string::npos) {
throw sls::RuntimeError("Programming file must be a pof file.");
}
det->programFPGA(args[0], {det_id});
os << "successful\n";
} else {
throw sls::RuntimeError("Unknown action");
}
@@ -1295,5 +1330,4 @@ std::string CmdProxy::MinMaxEnergyThreshold(int action) {
}
} // namespace sls