diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index f7acdf3e2..4d4058838 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -8237,9 +8237,14 @@ int get_datastream(int file_des) { leftFpga); LOG(logERROR, (mess)); } else { - retval = getDataStream(leftFpga, &retval); + ret = getDataStream(leftFpga, &retval); LOG(logDEBUG1, ("datastream (%s) retval: %u\n", (leftFpga ? "left" : "right"), retval)); + if (ret == FAIL) { + sprintf(mess, "Could not get %s data stream enable.\n", + (leftFpga ? "left" : "right")); + LOG(logERROR, (mess)); + } } #endif return Server_SendResult(file_des, INT32, &retval, sizeof(retval)); @@ -8283,8 +8288,14 @@ int set_datastream(int file_des) { sprintf(mess, "Could not %s\n", msg); LOG(logERROR, (mess)); } else { - int retval = getDataStream(leftFpga, &retval); + int retval = -1; + ret = getDataStream(leftFpga, &retval); LOG(logDEBUG1, ("%s retval: %u\n", msg, retval)); + if (ret == FAIL) { + sprintf(mess, "Could not get %s data stream enable.\n", + (leftFpga ? "left" : "right")); + LOG(logERROR, (mess)); + } validate(&ret, mess, enable, retval, msg, DEC); } } diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 9b4073c14..2e6463362 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1062,7 +1062,7 @@ class Detector { /** [Eiger] enable or disable data streaming from left or right of detector */ - void setDataStream(const bool enable, const bool left, Positions pos = {}); + void setDataStream(const bool left, const bool enable, Positions pos = {}); ///@{ diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 1aa7b1f81..16c14d085 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -1560,7 +1560,7 @@ std::string CmdProxy::DataStream(int action) { os << cmd << ' '; bool left = true; if (action == defs::HELP_ACTION) { - os << "[0, 1] [left|right]\n\t[Eiger] Enables or disables data " + os << "[left|right] [0, 1]\n\t[Eiger] Enables or disables data " "streaming from left or/and right side of detector. 1 (enabled) " "by default." << '\n'; @@ -1582,16 +1582,16 @@ std::string CmdProxy::DataStream(int action) { if (args.size() != 2) { WrongNumberOfParameters(2); } - if (args[1] == "left") { + if (args[0] == "left") { left = true; - } else if (args[1] == "right") { + } else if (args[0] == "right") { left = false; } else { - throw sls::RuntimeError("Unknown data argument " + args[1]); + throw sls::RuntimeError("Unknown data argument " + args[0]); } - det->setDataStream(left, StringTo(args[0]), + det->setDataStream(left, StringTo(args[1]), std::vector{det_id}); - os << args.front() << '\n'; + os << args << '\n'; } else { throw sls::RuntimeError("Unknown action"); } diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 9ed070545..cfdbda6ca 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -1373,9 +1373,9 @@ Result Detector::getDataStream(const bool left, Positions pos) const { return pimpl->Parallel(&Module::getDataStream, pos, left); } -void Detector::setDataStream(const bool enable, const bool left, +void Detector::setDataStream(const bool left, const bool enable, Positions pos) { - pimpl->Parallel(&Module::setDataStream, pos, enable, left); + pimpl->Parallel(&Module::setDataStream, pos, left, enable); } // Jungfrau Specific diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 125f5f886..110bd13ef 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1511,9 +1511,9 @@ bool Module::getDataStream(const bool left) const { return sendToDetector(F_GET_DATASTREAM, static_cast(left)); } -void Module::setDataStream(const bool enable, const bool left) { - int args[]{static_cast(enable), static_cast(left)}; - sendToDetector(F_GET_DATASTREAM, args, nullptr); +void Module::setDataStream(const bool left, const bool enable) { + int args[]{static_cast(left), static_cast(enable)}; + sendToDetector(F_SET_DATASTREAM, args, nullptr); } // Jungfrau Specific diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index a611ab5b6..cb502e50b 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -344,7 +344,7 @@ class Module : public virtual slsDetectorDefs { bool getQuad() const; void setQuad(const bool enable); bool getDataStream(const bool left) const; - void setDataStream(const bool enable, const bool left); + void setDataStream(const bool left, const bool enable); /************************************************** * * diff --git a/slsDetectorSoftware/tests/test-CmdProxy-eiger.cpp b/slsDetectorSoftware/tests/test-CmdProxy-eiger.cpp index a2b9625b3..29249720c 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-eiger.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-eiger.cpp @@ -661,23 +661,23 @@ TEST_CASE("datastream", "[.cmd]") { REQUIRE_THROWS(proxy.Call("datastream", {"1"}, -1, PUT)); { std::ostringstream oss; - proxy.Call("datastream", {"0", "left"}, -1, PUT, oss); - REQUIRE(oss.str() == "datastream 0 left\n"); + proxy.Call("datastream", {"left", "0"}, -1, PUT, oss); + REQUIRE(oss.str() == "datastream left 0\n"); } { std::ostringstream oss; - proxy.Call("datastream", {"0", "right"}, -1, PUT, oss); - REQUIRE(oss.str() == "datastream 0 right\n"); + proxy.Call("datastream", {"right", "0"}, -1, PUT, oss); + REQUIRE(oss.str() == "datastream right 0\n"); } { std::ostringstream oss; - proxy.Call("datastream", {"1", "left"}, -1, PUT, oss); - REQUIRE(oss.str() == "datastream 1 left\n"); + proxy.Call("datastream", {"left", "1"}, -1, PUT, oss); + REQUIRE(oss.str() == "datastream left 1\n"); } { std::ostringstream oss; - proxy.Call("datastream", {"1", "right"}, -1, PUT, oss); - REQUIRE(oss.str() == "datastream 1 right\n"); + proxy.Call("datastream", {"right", "1"}, -1, PUT, oss); + REQUIRE(oss.str() == "datastream right 1\n"); } for (int i = 0; i != det.size(); ++i) { det.setDataStream(prev_val_left[i], {i}); @@ -686,6 +686,6 @@ TEST_CASE("datastream", "[.cmd]") { } else { REQUIRE_THROWS(proxy.Call("datastream", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("datastream", {"1"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("datastream", {"1", "left"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("datastream", {"left", "1"}, -1, PUT)); } } \ No newline at end of file