exposing receiver thread ids to client (#102)

* exposing receiver thread ids to client

Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
Dhanya Thattil
2020-06-09 16:18:37 +02:00
committed by GitHub
parent 2a2bb5f63a
commit f5160b0978
48 changed files with 1151 additions and 580 deletions

View File

@ -331,6 +331,25 @@ std::string CmdProxy::DetectorSize(int action) {
return os.str();
}
std::string CmdProxy::SettingsList(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tList of settings implemented for this detector" << '\n';
} else if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getSettingsList();
os << ToString(t) << "\n";
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::GapPixels(int action) {
std::ostringstream os;
os << cmd << ' ';
@ -877,7 +896,11 @@ std::string CmdProxy::DacList(int action) {
os << "\n\tGets the list of commands for every dac for this detector."
<< '\n';
} else if (action == defs::GET_ACTION) {
os << sls::ToString(DacCommands()) << '\n';
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDacList();
os << ToString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else {
@ -890,29 +913,32 @@ std::string CmdProxy::DacValues(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "\n\tGets the list of commands for every dac for this detector."
os << "[(optional unit) mv] \n\tGets the list of commands for every "
"dac for this detector."
<< '\n';
} else if (action == defs::GET_ACTION) {
std::vector<std::string> names = DacCommands();
std::vector<std::string> res(names.size());
std::vector<std::string> args;
for (size_t i = 0; i < names.size(); ++i) {
// for multiple values for each command (to use ToString on vector)
std::ostringstream each;
size_t spacepos = names[i].find(' ');
// chip test board (dac)
if (spacepos != std::string::npos) {
if (args.empty()) {
args.resize(1);
}
args[0] = names[i].substr(spacepos + 1 - 1);
names[i] = names[i].substr(0, spacepos);
bool mv = false;
if (args.size() == 1) {
if (args[0] != "mv") {
throw sls::RuntimeError("Unknown argument " + args[0] +
". Did you mean mv?");
}
Call(names[i], args, det_id, action, each);
res[i] = each.str();
res[i].pop_back(); // remove last \n character
mv = true;
} else if (args.size() > 1) {
WrongNumberOfParameters(1);
}
os << sls::ToString(res) << '\n';
auto t = det->getDacList();
os << '[';
auto it = t.cbegin();
os << ToString(*it) << ' '
<< OutString(det->getDAC(*it++, mv, {det_id}))
<< (args.size() > 0 ? " mv" : "");
while (it != t.cend()) {
os << ", " << ToString(*it) << ' '
<< OutString(det->getDAC(*it++, mv, {det_id}))
<< (args.size() > 0 ? " mv" : "");
}
os << "]\n";
} else if (action == defs::PUT_ACTION) {
throw sls::RuntimeError("Cannot put");
} else {
@ -921,53 +947,6 @@ std::string CmdProxy::DacValues(int action) {
return os.str();
}
std::vector<std::string> CmdProxy::DacCommands() {
switch (det->getDetectorType().squash(defs::GENERIC)) {
case defs::EIGER:
return std::vector<std::string>{
"vsvp", "vtr", "vrf", "vrs", "vsvn", "vtgstv",
"vcmp_ll", "vcmp_lr", "vcal", "vcmp_rl", "rxb_rb", "rxb_lb",
"vcmp_rr", "vcp", "vcn", "vis", "vthreshold"};
break;
case defs::JUNGFRAU:
return std::vector<std::string>{"vb_comp", "vdd_prot", "vin_com",
"vref_prech", "vb_pixbuf", "vb_ds",
"vref_ds", "vref_comp"};
break;
case defs::GOTTHARD:
return std::vector<std::string>{"vref_ds", "vcascn_pb", "vcascp_pb",
"vout_cm", "vcasc_out", "vin_cm",
"vref_comp", "ib_test_c"};
break;
case defs::GOTTHARD2:
return std::vector<std::string>{
"vref_h_adc", "vb_comp_fe", "vb_comp_adc", "vcom_cds",
"vref_rstore", "vb_opa_1st", "vref_comp_fe", "vcom_adc1",
"vref_prech", "vref_l_adc", "vref_cds", "vb_cs",
"vb_opa_fd", "vcom_adc2"};
break;
case defs::MYTHEN3:
return std::vector<std::string>{
"vcassh", "vth2", "vshaper", "vshaperneg", "vipre_out", "vth3",
"vth1", "vicin", "vcas", "vpreamp", "vpl", "vipre",
"viinsh", "vph", "vtrim", "vdcsh"};
break;
case defs::MOENCH:
return std::vector<std::string>{"vbp_colbuf", "vipre", "vin_cm",
"vb_sda", "vcasc_sfp", "vout_cm",
"vipre_cds", "ibias_sfp"};
break;
case defs::CHIPTESTBOARD:
return std::vector<std::string>{
"dac 0", "dac 1", "dac 2", "dac 3", "dac 4", "dac 5",
"dac 6", "dac 7", "dac 8", "dac 9", "dac 10", "dac 11",
"dac 12", "dac 13", "dac 14", "dac 15", "dac 16", "dac 17"};
break;
default:
throw sls::RuntimeError("Unknown detector type.");
}
}
/* acquisition */
std::string CmdProxy::ReceiverStatus(int action) {