mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
wip
This commit is contained in:
@ -1739,7 +1739,7 @@ class Detector {
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
void updateRxRateCorrections();
|
||||
defs::EthernetInterface in_{defs::NONE};
|
||||
defs::EthernetInterface in_{defs::EthernetInterface::NONE};
|
||||
};
|
||||
|
||||
} // namespace sls
|
@ -1825,20 +1825,21 @@ std::string CmdProxy::VetoStreaming(int action) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::EthernetInterface interface = defs::EthernetInterface::none;
|
||||
defs::EthernetInterface interface = defs::EthernetInterface::NONE;
|
||||
for (const auto &arg : args) {
|
||||
if (arg == "none") {
|
||||
if (args.size() > 1) {
|
||||
throw sls::RuntimeError(
|
||||
"cannot have other arguments with 'none'. args: " +
|
||||
arg);
|
||||
ToString(args));
|
||||
}
|
||||
break;
|
||||
}
|
||||
StringTo<defs::EthernetInterface>(arg);
|
||||
interface = interface | (StringTo<defs::EthernetInterface>(arg));
|
||||
}
|
||||
det->setVetoStream(interface, std::vector<int>{det_id});
|
||||
os << ToString(args) << '\n';
|
||||
os << ToString(interface) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
|
@ -1549,7 +1549,9 @@ void Detector::setVeto(bool enable, Positions pos) {
|
||||
|
||||
Result<defs::EthernetInterface> Detector::getVetoStream(Positions pos) const {
|
||||
// return pimpl->Parallel(&Module::getVetoStream, pos);
|
||||
return Result<defs::EthernetInterface> res{in_};
|
||||
Result<defs::EthernetInterface> res(1);
|
||||
res[0] = in_;
|
||||
return res;
|
||||
}
|
||||
|
||||
void Detector::setVetoStream(defs::EthernetInterface interface, Positions pos) {
|
||||
|
@ -557,27 +557,44 @@ TEST_CASE("vetostream", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
// auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
// "inconsistent numinterfaces to test");
|
||||
/* {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"sdf"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 1\n");
|
||||
}*/
|
||||
// det.setNumberofUDPInterfaces(prev_val);
|
||||
auto prev_val = det.getVetoStream();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"none"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream none\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream none\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"3gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"3gbe", "10gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"3gbe", "none"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVetoStream(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"none"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"dfgd"}, -1, GET));
|
||||
}
|
||||
|
Reference in New Issue
Block a user