mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
flippeddataoverxaxis changed to flipRows
This commit is contained in:
@ -156,7 +156,8 @@ int ClientInterface::functionTable(){
|
||||
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
|
||||
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
||||
flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
|
||||
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data;
|
||||
flist[F_GET_FLIP_ROWS_RECEIVER] = &ClientInterface::get_flip_rows;
|
||||
flist[F_SET_FLIP_ROWS_RECEIVER] = &ClientInterface::set_flip_rows;
|
||||
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
|
||||
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
||||
@ -1020,21 +1021,33 @@ int ClientInterface::set_streaming_timer(Interface &socket) {
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_flipped_data(Interface &socket) {
|
||||
int ClientInterface::get_flip_rows(Interface &socket) {
|
||||
if (myDetectorType != EIGER)
|
||||
functionNotImplemented();
|
||||
|
||||
int retval = impl()->getFlipRows();
|
||||
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_flip_rows(Interface &socket) {
|
||||
auto arg = socket.Receive<int>();
|
||||
|
||||
if (myDetectorType != EIGER)
|
||||
functionNotImplemented();
|
||||
|
||||
if (arg >= 0) {
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flipped data:" << arg;
|
||||
impl()->setFlippedDataX(arg);
|
||||
if (arg != 0 && arg != 1) {
|
||||
throw RuntimeError("Could not set flip rows. Invalid argument: " +
|
||||
std::to_string(arg));
|
||||
}
|
||||
int retval = impl()->getFlippedDataX();
|
||||
validate(arg, retval, std::string("set flipped data"), DEC);
|
||||
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
verifyIdle(socket);
|
||||
LOG(logDEBUG1) << "Setting flip rows:" << arg;
|
||||
impl()->setFlipRows(static_cast<bool>(arg));
|
||||
|
||||
int retval = impl()->getFlipRows();
|
||||
validate(arg, retval, std::string("set flip rows"), DEC);
|
||||
LOG(logDEBUG1) << "Flip rows:" << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::set_file_format(Interface &socket) {
|
||||
|
@ -107,7 +107,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_streaming(sls::ServerInterface &socket);
|
||||
int get_streaming(sls::ServerInterface &socket);
|
||||
int set_streaming_timer(sls::ServerInterface &socket);
|
||||
int set_flipped_data(sls::ServerInterface &socket);
|
||||
int get_flip_rows(sls::ServerInterface &socket);
|
||||
int set_flip_rows(sls::ServerInterface &socket);
|
||||
int set_file_format(sls::ServerInterface &socket);
|
||||
int get_file_format(sls::ServerInterface &socket);
|
||||
int set_streaming_port(sls::ServerInterface &socket);
|
||||
|
@ -15,9 +15,9 @@
|
||||
const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
DataStreamer::DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi,
|
||||
int fd, int *nm, bool *qe, uint64_t *tot)
|
||||
bool fr, int *nm, bool *qe, uint64_t *tot)
|
||||
: ThreadObject(ind, TypeName), fifo(f), dynamicRange(dr), roi(r),
|
||||
fileIndex(fi), flippedDataX(fd), quadEnable(qe), totalNumFrames(tot) {
|
||||
fileIndex(fi), flipRows(fr), quadEnable(qe), totalNumFrames(tot) {
|
||||
numMods[0] = nm[0];
|
||||
numMods[1] = nm[1];
|
||||
|
||||
@ -65,7 +65,7 @@ void DataStreamer::SetNumberofModules(int *nm) {
|
||||
numMods[1] = nm[1];
|
||||
}
|
||||
|
||||
void DataStreamer::SetFlippedDataX(int fd) { flippedDataX = fd; }
|
||||
void DataStreamer::SetFlipRows(bool fd) { flipRows = fd; }
|
||||
|
||||
void DataStreamer::SetAdditionalJsonHeader(
|
||||
const std::map<std::string, std::string> &json) {
|
||||
@ -240,7 +240,7 @@ int DataStreamer::SendHeader(sls_receiver_header *rheader, uint32_t size,
|
||||
zHeader.roundRNumber = header.roundRNumber;
|
||||
zHeader.detType = header.detType;
|
||||
zHeader.version = header.version;
|
||||
zHeader.flippedDataX = flippedDataX;
|
||||
zHeader.flipRows = static_cast<int>(flipRows);
|
||||
zHeader.quad = *quadEnable;
|
||||
zHeader.completeImage =
|
||||
(header.packetNumber < generalData->packetsPerFrame ? false : true);
|
||||
|
@ -30,12 +30,12 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x dimension
|
||||
* @param fr flip rows
|
||||
* @param nm pointer to number of modules in each dimension
|
||||
* @param qe pointer to quad Enable
|
||||
* @param tot pointer to total number of frames
|
||||
*/
|
||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, int fd,
|
||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, bool fr,
|
||||
int *nm, bool *qe, uint64_t *tot);
|
||||
|
||||
/**
|
||||
@ -68,10 +68,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetNumberofModules(int *nm);
|
||||
|
||||
/**
|
||||
* Set Flipped data enable across x dimension
|
||||
* @param fd data enable in x dimension
|
||||
* Set Flipped rows
|
||||
* @param fd flip rows enable
|
||||
*/
|
||||
void SetFlippedDataX(int fd);
|
||||
void SetFlipRows(bool fd);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
@ -165,8 +165,8 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
/** Pointer to file index */
|
||||
uint64_t *fileIndex;
|
||||
|
||||
/** flipped data across x axis */
|
||||
int flippedDataX;
|
||||
/** flip rows */
|
||||
bool flipRows;
|
||||
|
||||
/** additional json header */
|
||||
std::map<std::string, std::string> additionalJsonHeader;
|
||||
|
@ -893,15 +893,15 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||
// streamer threads
|
||||
if (dataStreamEnable) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
bool flip = flipRows;
|
||||
int nm[2] = {numMods[0], numMods[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
flip = (i == 1 ? true : false);
|
||||
nm[0] = 1;
|
||||
nm[1] = 2;
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd,
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
@ -1022,15 +1022,15 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
||||
if (enable) {
|
||||
for (int i = 0; i < numThreads; ++i) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
bool flip = flipRows;
|
||||
int nm[2] = {numMods[0], numMods[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
flip = (i == 1 ? true : false);
|
||||
nm[0] = 1;
|
||||
nm[1] = 2;
|
||||
}
|
||||
dataStreamer.push_back(sls::make_unique<DataStreamer>(
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, fd,
|
||||
i, fifo[i].get(), &dynamicRange, &roi, &fileIndex, flip,
|
||||
(int *)nm, &quadEnable, &numberOfTotalFrames));
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(
|
||||
@ -1458,22 +1458,24 @@ void Implementation::setTenGigaEnable(const bool b) {
|
||||
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
||||
}
|
||||
|
||||
int Implementation::getFlippedDataX() const { return flippedDataX; }
|
||||
bool Implementation::getFlipRows() const { return flipRows; }
|
||||
|
||||
void Implementation::setFlippedDataX(int enable) {
|
||||
flippedDataX = (enable == 0) ? 0 : 1;
|
||||
void Implementation::setFlipRows(bool enable) {
|
||||
flipRows = enable;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
} else {
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
it->SetFlipRows(flipRows);
|
||||
}
|
||||
}
|
||||
LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
// quad
|
||||
else {
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlipRows(false);
|
||||
dataStreamer[1]->SetFlipRows(true);
|
||||
}
|
||||
}
|
||||
LOG(logINFO) << "Flip Rows: " << flipRows;
|
||||
}
|
||||
|
||||
bool Implementation::getQuad() const { return quadEnable; }
|
||||
@ -1485,7 +1487,7 @@ void Implementation::setQuad(const bool b) {
|
||||
if (!quadEnable) {
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofModules(numMods);
|
||||
it->SetFlippedDataX(flippedDataX);
|
||||
it->SetFlipRows(flipRows);
|
||||
}
|
||||
} else {
|
||||
int size[2] = {1, 2};
|
||||
@ -1493,8 +1495,8 @@ void Implementation::setQuad(const bool b) {
|
||||
it->SetNumberofModules(size);
|
||||
}
|
||||
if (dataStreamer.size() == 2) {
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
dataStreamer[0]->SetFlipRows(false);
|
||||
dataStreamer[1]->SetFlipRows(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
bool getTenGigaEnable() const;
|
||||
/* [Eiger][Ctb] */
|
||||
void setTenGigaEnable(const bool b);
|
||||
int getFlippedDataX() const;
|
||||
void setFlippedDataX(int enable = -1);
|
||||
bool getFlipRows() const;
|
||||
void setFlipRows(bool enable);
|
||||
bool getQuad() const;
|
||||
/* [Eiger] */
|
||||
void setQuad(const bool b);
|
||||
@ -347,7 +347,7 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint32_t dynamicRange{16};
|
||||
ROI roi{};
|
||||
bool tengigaEnable{false};
|
||||
int flippedDataX{0};
|
||||
bool flipRows{false};
|
||||
bool quadEnable{false};
|
||||
bool activated{true};
|
||||
std::array<bool, 2> detectorDataStream = {{true, true}};
|
||||
|
Reference in New Issue
Block a user