mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 07:01:33 +01:00
@@ -238,6 +238,16 @@ class Detector {
|
||||
* channel list. */
|
||||
void setBadChannels(const std::vector<std::vector<int>> list);
|
||||
|
||||
Result<int> getRow(Positions pos = {}) const;
|
||||
|
||||
/** Set it in udp header. Gui uses it to rearrange for complete image */
|
||||
void setRow(const int value, Positions pos = {});
|
||||
|
||||
Result<int> getColumn(Positions pos = {}) const;
|
||||
|
||||
/** Set it in udp header. Gui uses it to rearrange for complete image */
|
||||
void setColumn(const int value, Positions pos = {});
|
||||
|
||||
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
||||
///@}
|
||||
|
||||
|
||||
@@ -992,6 +992,8 @@ class CmdProxy {
|
||||
{"master", &CmdProxy::master},
|
||||
{"sync", &CmdProxy::sync},
|
||||
{"badchannels", &CmdProxy::BadChannels},
|
||||
{"row", &CmdProxy::row},
|
||||
{"column", &CmdProxy::column},
|
||||
|
||||
/* acquisition parameters */
|
||||
{"acquire", &CmdProxy::Acquire},
|
||||
@@ -1542,6 +1544,15 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Jungfrau][Moench] Enables or disables "
|
||||
"synchronization between modules.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(row, getRow, setRow, StringTo<int>,
|
||||
"[value]\n\tSet Detector row (udp header) to value. "
|
||||
"\n\tGui uses it to rearrange for complete image");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
column, getColumn, setColumn, StringTo<int>,
|
||||
"[value]\n\tSet Detector column (udp header) to value. \n\tGui uses it "
|
||||
"to rearrange for complete image");
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||
|
||||
@@ -379,6 +379,22 @@ void Detector::setBadChannels(const std::vector<int> list, Positions pos) {
|
||||
pimpl->setBadChannels(list, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getRow(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getRow, pos);
|
||||
}
|
||||
|
||||
void Detector::setRow(const int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setRow, pos, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getColumn(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getColumn, pos);
|
||||
}
|
||||
|
||||
void Detector::setColumn(const int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setColumn, pos, value);
|
||||
}
|
||||
|
||||
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
||||
}
|
||||
|
||||
@@ -589,6 +589,24 @@ void Module::setBadChannels(std::vector<int> list) {
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getRow() const { return sendToDetector<int>(F_GET_ROW); }
|
||||
|
||||
void Module::setRow(int value) {
|
||||
sendToDetector(F_SET_ROW, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_RECEIVER_SET_ROW, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getColumn() const { return sendToDetector<int>(F_GET_COLUMN); }
|
||||
|
||||
void Module::setColumn(int value) {
|
||||
sendToDetector(F_SET_COLUMN, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_RECEIVER_SET_COLUMN, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::isVirtualDetectorServer() const {
|
||||
return sendToDetector<int>(F_IS_VIRTUAL);
|
||||
}
|
||||
|
||||
@@ -134,6 +134,10 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setSynchronization(const bool value);
|
||||
std::vector<int> getBadChannels() const;
|
||||
void setBadChannels(std::vector<int> list);
|
||||
int getRow() const;
|
||||
void setRow(const int value);
|
||||
int getColumn() const;
|
||||
void setColumn(const int value);
|
||||
|
||||
bool isVirtualDetectorServer() const;
|
||||
|
||||
|
||||
@@ -715,6 +715,52 @@ TEST_CASE("badchannels", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("row", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getRow()[0];
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("row", {"1"}, 0, PUT, oss);
|
||||
REQUIRE(oss.str() == "row 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("row", {}, 0, GET, oss);
|
||||
REQUIRE(oss.str() == "row 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("row", {"0"}, 0, PUT, oss);
|
||||
REQUIRE(oss.str() == "row 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("row", {"-5"}, -1, PUT));
|
||||
det.setRow(prev_val, {0});
|
||||
}
|
||||
|
||||
TEST_CASE("column", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto prev_val = det.getColumn()[0];
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("column", {"1"}, 0, PUT, oss);
|
||||
REQUIRE(oss.str() == "column 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("column", {}, 0, GET, oss);
|
||||
REQUIRE(oss.str() == "column 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("column", {"0"}, 0, PUT, oss);
|
||||
REQUIRE(oss.str() == "column 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("column", {"-5"}, -1, PUT));
|
||||
det.setColumn(prev_val, {0});
|
||||
}
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
// acquire: not testing
|
||||
|
||||
Reference in New Issue
Block a user