g2: setting serialnumber allowed

This commit is contained in:
2021-08-11 18:50:49 +02:00
parent 9a777b13bb
commit 6f54402aba
12 changed files with 90 additions and 9 deletions

View File

@ -257,6 +257,32 @@ std::string CmdProxy::FirmwareVersion(int action) {
return os.str();
}
std::string CmdProxy::SerialNumber(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION)
os << "\n\tSerial number of detector.\n\t[Gotthard2] Can overwrite, "
"but must do so for every detector server restart."
<< '\n';
else if (action == slsDetectorDefs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getSerialNumber(std::vector<int>{det_id});
os << OutStringHex(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setSerialNumber(StringTo<int64_t>(args[0]),
std::vector<int>{det_id});
os << args[0] << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::Versions(int action) {
std::ostringstream os;
os << cmd << ' ';