mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 15:57:13 +02:00
WIP
This commit is contained in:
@ -352,9 +352,9 @@ class Detector {
|
|||||||
Result<defs::runStatus> getReceiverStatus(const int udpInterface,
|
Result<defs::runStatus> getReceiverStatus(const int udpInterface,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
Result<int64_t> getFramesCaught(Positions pos = {}) const;
|
Result<uint64_t> getFramesCaught(Positions pos = {}) const;
|
||||||
|
|
||||||
Result<std::vector<uint64_t>> getNumMissingPackets(Positions pos = {}) const;
|
Result<uint64_t> getNumMissingPackets(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Eiger][Jungfrau] */
|
/** [Eiger][Jungfrau] */
|
||||||
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
Result<uint64_t> getStartingFrameNumber(Positions pos = {}) const;
|
||||||
|
@ -538,12 +538,12 @@ Result<defs::runStatus> Detector::getReceiverStatus(const int udpInterface, Posi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64_t> Detector::getFramesCaught(Positions pos) const {
|
Result<uint64_t> Detector::getFramesCaught(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFramesCaughtByReceiver, pos);
|
return pimpl->Parallel3(&Receiver::getFramesCaught);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::vector<uint64_t>> Detector::getNumMissingPackets(Positions pos) const {
|
Result<uint64_t> Detector::getNumMissingPackets(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getNumMissingPackets, pos);
|
return pimpl->Parallel3(&Receiver::getNumMissingPackets);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<uint64_t> Detector::getStartingFrameNumber(Positions pos) const {
|
Result<uint64_t> Detector::getStartingFrameNumber(Positions pos) const {
|
||||||
@ -833,20 +833,20 @@ void Detector::setRxSilentMode(bool value, Positions pos) {
|
|||||||
|
|
||||||
Result<defs::frameDiscardPolicy>
|
Result<defs::frameDiscardPolicy>
|
||||||
Detector::getRxFrameDiscardPolicy(Positions pos) const {
|
Detector::getRxFrameDiscardPolicy(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverFramesDiscardPolicy, pos);
|
return pimpl->Parallel3(&Receiver::getFramesDiscardPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxFrameDiscardPolicy(defs::frameDiscardPolicy f,
|
void Detector::setRxFrameDiscardPolicy(defs::frameDiscardPolicy f,
|
||||||
Positions pos) {
|
Positions pos) {
|
||||||
pimpl->Parallel(&Module::setReceiverFramesDiscardPolicy, pos, f);
|
pimpl->Parallel3(&Receiver::setFramesDiscardPolicy, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getPartialFramesPadding(Positions pos) const {
|
Result<bool> Detector::getPartialFramesPadding(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getPartialFramesPadding, pos);
|
return pimpl->Parallel3(&Receiver::getPartialFramesPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setPartialFramesPadding(bool value, Positions pos) {
|
void Detector::setPartialFramesPadding(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setPartialFramesPadding, pos, value);
|
pimpl->Parallel3(&Receiver::setPartialFramesPadding, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64_t> Detector::getRxUDPSocketBufferSize(Positions pos) const {
|
Result<int64_t> Detector::getRxUDPSocketBufferSize(Positions pos) const {
|
||||||
@ -863,107 +863,107 @@ Result<int64_t> Detector::getRxRealUDPSocketBufferSize(Positions pos) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getRxLock(Positions pos) {
|
Result<bool> Detector::getRxLock(Positions pos) {
|
||||||
return pimpl->Parallel(&Module::lockReceiver, pos, -1);
|
return pimpl->Parallel3(&Receiver::getLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxLock(bool value, Positions pos) {
|
void Detector::setRxLock(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::lockReceiver, pos, static_cast<int>(value));
|
pimpl->Parallel3(&Receiver::setLock, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<sls::IpAddr> Detector::getRxLastClientIP(Positions pos) const {
|
Result<sls::IpAddr> Detector::getRxLastClientIP(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverLastClientIP, pos);
|
return pimpl->Parallel3(&Receiver::getLastClientIP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// File
|
// File
|
||||||
|
|
||||||
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
Result<defs::fileFormat> Detector::getFileFormat(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFileFormat, pos);
|
return pimpl->Parallel3(&Receiver::getFileFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFileFormat(defs::fileFormat f, Positions pos) {
|
void Detector::setFileFormat(defs::fileFormat f, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFileFormat, pos, f);
|
pimpl->Parallel3(&Receiver::setFileFormat, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::string> Detector::getFilePath(Positions pos) const {
|
Result<std::string> Detector::getFilePath(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFilePath, pos);
|
return pimpl->Parallel3(&Receiver::getFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFilePath(const std::string &fpath, Positions pos) {
|
void Detector::setFilePath(const std::string &fpath, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFilePath, pos, fpath);
|
pimpl->Parallel3(&Receiver::setFilePath, fpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<std::string> Detector::getFileNamePrefix(Positions pos) const {
|
Result<std::string> Detector::getFileNamePrefix(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFileName, pos);
|
return pimpl->Parallel3(&Receiver::getFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
void Detector::setFileNamePrefix(const std::string &fname, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFileName, pos, fname);
|
pimpl->Parallel3(&Receiver::setFileName, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64_t> Detector::getAcquisitionIndex(Positions pos) const {
|
Result<int64_t> Detector::getAcquisitionIndex(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFileIndex, pos);
|
return pimpl->Parallel3(&Receiver::getFileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setAcquisitionIndex(int64_t i, Positions pos) {
|
void Detector::setAcquisitionIndex(int64_t i, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFileIndex, pos, i);
|
pimpl->Parallel3(&Receiver::setFileIndex, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getFileWrite(Positions pos) const {
|
Result<bool> Detector::getFileWrite(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFileWrite, pos);
|
return pimpl->Parallel3(&Receiver::getFileWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFileWrite(bool value, Positions pos) {
|
void Detector::setFileWrite(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFileWrite, pos, value);
|
pimpl->Parallel3(&Receiver::setFileWrite, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setMasterFileWrite(bool value, Positions pos) {
|
void Detector::setMasterFileWrite(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setMasterFileWrite, pos, value);
|
pimpl->Parallel3(&Receiver::setMasterFileWrite, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getMasterFileWrite(Positions pos) const {
|
Result<bool> Detector::getMasterFileWrite(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getMasterFileWrite, pos);
|
return pimpl->Parallel3(&Receiver::getMasterFileWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getFileOverWrite(Positions pos) const {
|
Result<bool> Detector::getFileOverWrite(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFileOverWrite, pos);
|
return pimpl->Parallel3(&Receiver::getFileOverWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFileOverWrite(bool value, Positions pos) {
|
void Detector::setFileOverWrite(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFileOverWrite, pos, value);
|
pimpl->Parallel3(&Receiver::setFileOverWrite, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getFramesPerFile(Positions pos) const {
|
Result<int> Detector::getFramesPerFile(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFramesPerFile, pos);
|
return pimpl->Parallel3(&Receiver::getFramesPerFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setFramesPerFile(int n, Positions pos) {
|
void Detector::setFramesPerFile(int n, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFramesPerFile, pos, n);
|
pimpl->Parallel3(&Receiver::setFramesPerFile, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zmq Streaming (Receiver<->Client)
|
// Zmq Streaming (Receiver<->Client)
|
||||||
|
|
||||||
Result<bool> Detector::getRxZmqDataStream(Positions pos) const {
|
Result<bool> Detector::getRxZmqDataStream(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverStreaming, pos);
|
return pimpl->Parallel3(&Receiver::getZmq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxZmqDataStream(bool value, Positions pos) {
|
void Detector::setRxZmqDataStream(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setReceiverStreaming, pos, value);
|
pimpl->Parallel3(&Receiver::setZmq, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getRxZmqFrequency(Positions pos) const {
|
Result<int> Detector::getRxZmqFrequency(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverStreamingFrequency, pos);
|
return pimpl->Parallel3(&Receiver::getZmqFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxZmqFrequency(int freq, Positions pos) {
|
void Detector::setRxZmqFrequency(int freq, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setReceiverStreamingFrequency, pos, freq);
|
pimpl->Parallel3(&Receiver::setZmqFrequency, freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getRxZmqTimer(Positions pos) const {
|
Result<int> Detector::getRxZmqTimer(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::setReceiverStreamingTimer, pos, -1);
|
return pimpl->Parallel3(&Receiver::getZmqTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxZmqTimer(int time_in_ms, Positions pos) {
|
void Detector::setRxZmqTimer(int time_in_ms, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setReceiverStreamingTimer, pos, time_in_ms);
|
pimpl->Parallel3(&Receiver::setZmqTimer, time_in_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getRxZmqPort(Positions pos) const {
|
Result<int> Detector::getRxZmqPort(Positions pos) const {
|
||||||
@ -1150,11 +1150,11 @@ void Detector::setStoreInRamMode(bool value, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getBottom(Positions pos) const {
|
Result<bool> Detector::getBottom(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getFlippedDataX, pos);
|
return pimpl->Parallel3(&Receiver::getFlippedDataX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setBottom(bool value, Positions pos) {
|
void Detector::setBottom(bool value, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setFlippedDataX, pos, value);
|
pimpl->Parallel3(&Receiver::setFlippedDataX, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getAllTrimbits(Positions pos) const {
|
Result<int> Detector::getAllTrimbits(Positions pos) const {
|
||||||
@ -1220,11 +1220,11 @@ void Detector::setActive(bool active, Positions pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getRxPadDeactivatedMode(Positions pos) const {
|
Result<bool> Detector::getRxPadDeactivatedMode(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getDeactivatedRxrPaddingMode, pos);
|
return pimpl->Parallel3(&Receiver::getDeactivatedPaddingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) {
|
void Detector::setRxPadDeactivatedMode(bool pad, Positions pos) {
|
||||||
pimpl->Parallel(&Module::setDeactivatedRxrPaddingMode, pos, pad);
|
pimpl->Parallel3(&Receiver::setDeactivatedPaddingMode, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getPartialReset(Positions pos) const {
|
Result<bool> Detector::getPartialReset(Positions pos) const {
|
||||||
@ -1991,7 +1991,7 @@ Result<ns> Detector::getMeasurementTime(Positions pos) const {
|
|||||||
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
std::string Detector::getUserDetails() const { return pimpl->getUserDetails(); }
|
||||||
|
|
||||||
Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
|
Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getReceiverCurrentFrameIndex, pos);
|
return pimpl->Parallel3(&Receiver::getCurrentFrameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
@ -1287,7 +1287,7 @@ int DetectorImpl::acquire() {
|
|||||||
// external process to be
|
// external process to be
|
||||||
// done sending data to gui
|
// done sending data to gui
|
||||||
|
|
||||||
Parallel(&Module::incrementFileIndex, {});
|
Parallel3(&Receiver::incrementFileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// waiting for the data processing thread to finish!
|
// waiting for the data processing thread to finish!
|
||||||
|
@ -1952,43 +1952,6 @@ void Module::setActivate(const bool enable) {
|
|||||||
sendToDetectorStop(F_ACTIVATE, arg, retval);
|
sendToDetectorStop(F_ACTIVATE, arg, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getDeactivatedRxrPaddingMode() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (deactivated padding)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setDeactivatedRxrPaddingMode(bool padding) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (deactivated padding)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(padding);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getFlippedDataX() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (flipped data x)");
|
|
||||||
}
|
|
||||||
int retval = -1;
|
|
||||||
int arg = -1;
|
|
||||||
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
|
|
||||||
LOG(logDEBUG1) << "Flipped data:" << retval;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFlippedDataX(bool value) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (flipped data x)");
|
|
||||||
}
|
|
||||||
int retval = -1;
|
|
||||||
int arg = static_cast<int>(value);
|
|
||||||
LOG(logDEBUG1) << "Setting flipped data across x axis with value: "
|
|
||||||
<< value;
|
|
||||||
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Module::setAllTrimbits(int val) {
|
int Module::setAllTrimbits(int val) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
LOG(logDEBUG1) << "Setting all trimbits to " << val;
|
LOG(logDEBUG1) << "Setting all trimbits to " << val;
|
||||||
@ -2303,302 +2266,6 @@ void Module::updateRateCorrection() {
|
|||||||
|
|
||||||
bool Module::getUseReceiverFlag() const { return shm()->useReceiver; }
|
bool Module::getUseReceiverFlag() const { return shm()->useReceiver; }
|
||||||
|
|
||||||
int Module::lockReceiver(int lock) {
|
|
||||||
LOG(logDEBUG1) << "Setting receiver server lock to " << lock;
|
|
||||||
int retval = -1;
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_LOCK_RECEIVER, lock, retval);
|
|
||||||
LOG(logDEBUG1) << "Receiver Lock: " << retval;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
sls::IpAddr Module::getReceiverLastClientIP() const {
|
|
||||||
sls::IpAddr retval;
|
|
||||||
LOG(logDEBUG1) << "Getting last client ip to receiver server";
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_GET_LAST_RECEIVER_CLIENT_IP, nullptr, retval);
|
|
||||||
LOG(logDEBUG1) << "Last client IP from receiver: " << retval;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::exitReceiver() {
|
|
||||||
LOG(logDEBUG1) << "Sending exit command to receiver server";
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_EXIT_RECEIVER, nullptr, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::execReceiverCommand(const std::string &cmd) {
|
|
||||||
char arg[MAX_STR_LENGTH]{};
|
|
||||||
char retval[MAX_STR_LENGTH]{};
|
|
||||||
sls::strcpy_safe(arg, cmd.c_str());
|
|
||||||
LOG(logDEBUG1) << "Sending command to receiver: " << arg;
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_EXEC_RECEIVER_COMMAND, arg, retval);
|
|
||||||
LOG(logINFO) << "Receiver " << moduleId << " returned:\n" << retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Module::getFilePath() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file path)");
|
|
||||||
}
|
|
||||||
char retvals[MAX_STR_LENGTH]{};
|
|
||||||
sendToReceiver(F_GET_RECEIVER_FILE_PATH, nullptr, retvals);
|
|
||||||
return std::string(retvals);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFilePath(const std::string &path) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file path)");
|
|
||||||
}
|
|
||||||
if (path.empty()) {
|
|
||||||
throw RuntimeError("Cannot set empty file path");
|
|
||||||
}
|
|
||||||
char args[MAX_STR_LENGTH]{};
|
|
||||||
sls::strcpy_safe(args, path.c_str());
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_PATH, args, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Module::getFileName() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file name prefix)");
|
|
||||||
}
|
|
||||||
char retvals[MAX_STR_LENGTH]{};
|
|
||||||
sendToReceiver(F_GET_RECEIVER_FILE_NAME, nullptr, retvals);
|
|
||||||
return std::string(retvals);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFileName(const std::string &fname) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file name prefix)");
|
|
||||||
}
|
|
||||||
if (fname.empty()) {
|
|
||||||
throw RuntimeError("Cannot set empty file name prefix");
|
|
||||||
}
|
|
||||||
char args[MAX_STR_LENGTH]{};
|
|
||||||
sls::strcpy_safe(args, fname.c_str());
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_NAME, args, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t Module::getFileIndex() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file index)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_FILE_INDEX);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFileIndex(int64_t file_index) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file index)");
|
|
||||||
}
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_INDEX, file_index, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::incrementFileIndex() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (increment file index)");
|
|
||||||
}
|
|
||||||
sendToReceiver(F_INCREMENT_FILE_INDEX, nullptr, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::fileFormat Module::getFileFormat() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file format)");
|
|
||||||
}
|
|
||||||
return static_cast<fileFormat>(
|
|
||||||
sendToReceiver<int>(F_GET_RECEIVER_FILE_FORMAT));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFileFormat(fileFormat f) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file format)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(f);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_FORMAT, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Module::getFramesPerFile() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frames per file)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_FRAMES_PER_FILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFramesPerFile(int n_frames) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frames per file)");
|
|
||||||
}
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::frameDiscardPolicy Module::getReceiverFramesDiscardPolicy() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frame discard policy)");
|
|
||||||
}
|
|
||||||
return static_cast<frameDiscardPolicy>(
|
|
||||||
sendToReceiver<int>(F_GET_RECEIVER_DISCARD_POLICY));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frame discard policy)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(f);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_DISCARD_POLICY, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getPartialFramesPadding() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frame padding)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_PADDING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setPartialFramesPadding(bool padding) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (frame padding)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(padding);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_PADDING, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t Module::getFramesCaughtByReceiver() const {
|
|
||||||
int64_t retval = -1;
|
|
||||||
LOG(logDEBUG1) << "Getting Frames Caught by Receiver";
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_GET_RECEIVER_FRAMES_CAUGHT, nullptr, retval);
|
|
||||||
LOG(logDEBUG1) << "Frames Caught by Receiver: " << retval;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<uint64_t> Module::getNumMissingPackets() const {
|
|
||||||
LOG(logDEBUG1) << "Getting num missing packets";
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
int fnum = F_GET_NUM_MISSING_PACKETS;
|
|
||||||
int ret = FAIL;
|
|
||||||
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
|
|
||||||
client.Send(&fnum, sizeof(fnum));
|
|
||||||
client.Receive(&ret, sizeof(ret));
|
|
||||||
if (ret == FAIL) {
|
|
||||||
char mess[MAX_STR_LENGTH]{};
|
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
|
||||||
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
|
||||||
" returned error: " + std::string(mess));
|
|
||||||
} else {
|
|
||||||
int nports = -1;
|
|
||||||
client.Receive(&nports, sizeof(nports));
|
|
||||||
uint64_t mp[nports];
|
|
||||||
memset(mp, 0, sizeof(mp));
|
|
||||||
client.Receive(mp, sizeof(mp));
|
|
||||||
std::vector<uint64_t> retval(mp, mp + nports);
|
|
||||||
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleId << ": " << sls::ToString(retval);
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw RuntimeError("No receiver to get missing packets.");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Module::getReceiverCurrentFrameIndex() const {
|
|
||||||
uint64_t retval = -1;
|
|
||||||
LOG(logDEBUG1) << "Getting Current Frame Index of Receiver";
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_GET_RECEIVER_FRAME_INDEX, nullptr, retval);
|
|
||||||
LOG(logDEBUG1) << "Current Frame Index of Receiver: " << retval;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFileWrite(bool value) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file write enable)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(value);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_FILE_WRITE, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getFileWrite() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file_write enable)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_FILE_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setMasterFileWrite(bool value) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (master file write enable)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(value);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getMasterFileWrite() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (master file write enable)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_MASTER_FILE_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setFileOverWrite(bool value) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file overwrite enable)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(value);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_OVERWRITE, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getFileOverWrite() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (file overwrite enable)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_OVERWRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Module::getReceiverStreamingFrequency() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (streaming/read frequency)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_FREQUENCY);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setReceiverStreamingFrequency(int freq) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (streaming/read frequency)");
|
|
||||||
}
|
|
||||||
if (freq < 0) {
|
|
||||||
throw RuntimeError("Invalid streaming frequency " + std::to_string(freq));
|
|
||||||
}
|
|
||||||
sendToReceiver(F_SET_RECEIVER_STREAMING_FREQUENCY, freq, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Module::setReceiverStreamingTimer(int time_in_ms) {
|
|
||||||
int retval = -1;
|
|
||||||
LOG(logDEBUG1) << "Sending read timer to receiver: " << time_in_ms;
|
|
||||||
if (shm()->useReceiver) {
|
|
||||||
sendToReceiver(F_RECEIVER_STREAMING_TIMER, time_in_ms, retval);
|
|
||||||
LOG(logDEBUG1) << "Receiver read timer: " << retval;
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getReceiverStreaming() {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to get receiver parameters (zmq enable)");
|
|
||||||
}
|
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setReceiverStreaming(bool enable) {
|
|
||||||
if (!shm()->useReceiver) {
|
|
||||||
throw RuntimeError("Set rx_hostname first to use receiver parameters (zmq enable)");
|
|
||||||
}
|
|
||||||
int arg = static_cast<int>(enable);
|
|
||||||
sendToReceiver(F_SET_RECEIVER_STREAMING, arg, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::enableTenGigabitEthernet(int value) {
|
bool Module::enableTenGigabitEthernet(int value) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << value;
|
LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << value;
|
||||||
|
@ -974,26 +974,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
/** [Eiger] */
|
/** [Eiger] */
|
||||||
void setActivate(const bool enable);
|
void setActivate(const bool enable);
|
||||||
|
|
||||||
bool getDeactivatedRxrPaddingMode();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set deactivated Receiver padding mode (Eiger only)
|
|
||||||
*/
|
|
||||||
void setDeactivatedRxrPaddingMode(bool padding);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the enable if data will be flipped across x axis (Eiger)
|
|
||||||
* @returns if flipped across x axis
|
|
||||||
*/
|
|
||||||
bool getFlippedDataX();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the enable which determines if
|
|
||||||
* data will be flipped across x axis (Eiger)
|
|
||||||
* @param value 0 or 1 to reset/set
|
|
||||||
*/
|
|
||||||
void setFlippedDataX(bool value);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all the trimbits to a particular value (Eiger)
|
* Sets all the trimbits to a particular value (Eiger)
|
||||||
* @param val trimbit value
|
* @param val trimbit value
|
||||||
@ -1164,96 +1144,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
bool getUseReceiverFlag() const;
|
bool getUseReceiverFlag() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Locks/Unlocks the connection to the receiver
|
|
||||||
* @param lock sets (1), usets (0), gets (-1) the lock
|
|
||||||
* @returns lock status of the receiver
|
|
||||||
*/
|
|
||||||
int lockReceiver(int lock = -1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the IP of the last client connecting to the receiver
|
|
||||||
* @returns the IP of the last client connecting to the receiver
|
|
||||||
*/
|
|
||||||
sls::IpAddr getReceiverLastClientIP() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Exits the receiver TCP server
|
|
||||||
*/
|
|
||||||
void exitReceiver();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a system command on the receiver server
|
|
||||||
* e.g. mount an nfs disk, reboot and returns answer etc.
|
|
||||||
* @param cmd command to be executed
|
|
||||||
*/
|
|
||||||
void execReceiverCommand(const std::string &cmd);
|
|
||||||
|
|
||||||
std::string getFilePath();
|
|
||||||
void setFilePath(const std::string &path);
|
|
||||||
std::string getFileName();
|
|
||||||
void setFileName(const std::string &fname);
|
|
||||||
int64_t getFileIndex();
|
|
||||||
void setFileIndex(int64_t file_index);
|
|
||||||
void incrementFileIndex();
|
|
||||||
fileFormat getFileFormat() ;
|
|
||||||
void setFileFormat(fileFormat f);
|
|
||||||
int getFramesPerFile();
|
|
||||||
/** 0 will set frames per file to unlimited */
|
|
||||||
void setFramesPerFile(int n_frames);
|
|
||||||
frameDiscardPolicy getReceiverFramesDiscardPolicy();
|
|
||||||
void setReceiverFramesDiscardPolicy(frameDiscardPolicy f);
|
|
||||||
bool getPartialFramesPadding();
|
|
||||||
void setPartialFramesPadding(bool padding);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the number of frames caught by receiver
|
|
||||||
* @returns number of frames caught by receiver
|
|
||||||
*/
|
|
||||||
int64_t getFramesCaughtByReceiver() const;
|
|
||||||
|
|
||||||
/** Gets number of missing packets */
|
|
||||||
std::vector<uint64_t> getNumMissingPackets() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current frame index of receiver
|
|
||||||
* @returns current frame index of receiver
|
|
||||||
*/
|
|
||||||
uint64_t getReceiverCurrentFrameIndex() const;
|
|
||||||
|
|
||||||
void setFileWrite(bool value);
|
|
||||||
bool getFileWrite();
|
|
||||||
void setMasterFileWrite(bool value);
|
|
||||||
bool getMasterFileWrite();
|
|
||||||
void setFileOverWrite(bool value);
|
|
||||||
bool getFileOverWrite();
|
|
||||||
|
|
||||||
int getReceiverStreamingFrequency();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (previously setReadReceiverFrequency)
|
|
||||||
* Sets the receiver streaming frequency
|
|
||||||
* @param freq nth frame streamed out, if 0, streamed out at a timer of 200
|
|
||||||
* ms
|
|
||||||
* @param detPos -1 for all detectors in list or specific detector position
|
|
||||||
*/
|
|
||||||
void setReceiverStreamingFrequency(int freq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (previously setReceiverReadTimer)
|
|
||||||
* Sets the receiver streaming timer
|
|
||||||
* If receiver streaming frequency is 0, then this timer between each
|
|
||||||
* data stream is set. Default is 200 ms.
|
|
||||||
* @param time_in_ms timer between frames
|
|
||||||
* @returns receiver streaming timer in ms
|
|
||||||
*/
|
|
||||||
int setReceiverStreamingTimer(int time_in_ms = 200);
|
|
||||||
|
|
||||||
bool getReceiverStreaming();
|
|
||||||
|
|
||||||
void setReceiverStreaming(bool enable);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable or 10Gbe
|
* Enable/disable or 10Gbe
|
||||||
* @param i is -1 to get, 0 to disable and 1 to enable
|
* @param i is -1 to get, 0 to disable and 1 to enable
|
||||||
|
@ -267,7 +267,21 @@ void Receiver::restreamStop() {
|
|||||||
sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER, nullptr, nullptr);
|
sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint64_t Receiver::getFramesCaught() const {
|
||||||
|
return sendToReceiver<uint64_t>(F_GET_RECEIVER_FRAMES_CAUGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Receiver::getNumMissingPackets() const {
|
||||||
|
return sendToReceiver<uint64_t>(F_GET_NUM_MISSING_PACKETS);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t Receiver::getCurrentFrameIndex() const {
|
||||||
|
return sendToReceiver<uint64_t>(F_GET_RECEIVER_FRAME_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
/** Network Configuration (Detector<->Receiver) */
|
/** Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
sls::MacAddr Receiver::setUDPIP(const IpAddr ip) {
|
sls::MacAddr Receiver::setUDPIP(const IpAddr ip) {
|
||||||
LOG(logDEBUG1) << "Setting udp ip to receier: " << ip;
|
LOG(logDEBUG1) << "Setting udp ip to receier: " << ip;
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
@ -284,6 +298,16 @@ void Receiver::setUDPPort(const int port) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** ZMQ Streaming Parameters (Receiver<->Client) */
|
/** ZMQ Streaming Parameters (Receiver<->Client) */
|
||||||
|
|
||||||
|
bool Receiver::getZmq() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setZmq(const bool enable) {
|
||||||
|
int arg = static_cast<int>(enable);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_STREAMING, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int Receiver::getClientZmqPort() const {
|
int Receiver::getClientZmqPort() const {
|
||||||
return shm()->zmqPort;
|
return shm()->zmqPort;
|
||||||
}
|
}
|
||||||
@ -300,8 +324,7 @@ void Receiver::setZmqPort(int port) {
|
|||||||
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
sendToReceiver(F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sls::IpAddr Receiver::getClientZmqIP() const {
|
||||||
sls::IpAddr Receiver::getClientZmqIP() {
|
|
||||||
return shm()->zmqIp;
|
return shm()->zmqIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +336,7 @@ void Receiver::setClientZmqIP(const sls::IpAddr ip) {
|
|||||||
shm()->zmqIp = ip;
|
shm()->zmqIp = ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr Receiver::getZmqIP() {
|
sls::IpAddr Receiver::getZmqIP() const {
|
||||||
return sendToReceiver<sls::IpAddr>(F_GET_RECEIVER_STREAMING_SRC_IP);
|
return sendToReceiver<sls::IpAddr>(F_GET_RECEIVER_STREAMING_SRC_IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,8 +352,45 @@ void Receiver::setZmqIP(const sls::IpAddr ip) {
|
|||||||
sendToReceiver(F_SET_RECEIVER_STREAMING_SRC_IP, ip, nullptr);
|
sendToReceiver(F_SET_RECEIVER_STREAMING_SRC_IP, ip, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Receiver::getZmqFrequency() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_FREQUENCY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setZmqFrequency(const int freq) {
|
||||||
|
if (freq < 0) {
|
||||||
|
throw RuntimeError("Invalid streaming frequency " + std::to_string(freq));
|
||||||
|
}
|
||||||
|
sendToReceiver(F_SET_RECEIVER_STREAMING_FREQUENCY, freq, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Receiver::getZmqTimer() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_STREAMING_TIMER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setZmqTimer(const int time_in_ms) {
|
||||||
|
sendToReceiver(F_SET_RECEIVER_STREAMING_TIMER, time_in_ms, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
/** Receiver Parameters */
|
/** Receiver Parameters */
|
||||||
|
|
||||||
|
bool Receiver::getLock() const {
|
||||||
|
return sendToReceiver<int>(F_GET_LOCK_RECEIVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setLock(const bool lock) {
|
||||||
|
LOG(logDEBUG1) << "Setting receiver server lock to " << lock;
|
||||||
|
sendToReceiver(F_SET_LOCK_RECEIVER, lock, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
sls::IpAddr Receiver::getLastClientIP() const {
|
||||||
|
return sendToReceiver<sls::IpAddr>(F_GET_LAST_RECEIVER_CLIENT_IP);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::exitServer() {
|
||||||
|
LOG(logDEBUG1) << "Sending exit command to receiver server";
|
||||||
|
sendToReceiver(F_EXIT_RECEIVER, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t Receiver::getUDPSocketBufferSize() const {
|
int64_t Receiver::getUDPSocketBufferSize() const {
|
||||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_UDP_SOCK_BUF_SIZE);
|
return sendToReceiver<int64_t>(F_GET_RECEIVER_UDP_SOCK_BUF_SIZE);
|
||||||
}
|
}
|
||||||
@ -345,60 +405,188 @@ int64_t Receiver::getRealUDPSocketBufferSize() const {
|
|||||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
|
return sendToReceiver<int64_t>(F_GET_RECEIVER_REAL_UDP_SOCK_BUF_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Receiver::getDeactivatedPaddingMode() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_DEACTIVATED_PADDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setDeactivatedPaddingMode(const bool padding) {
|
||||||
|
int arg = static_cast<int>(padding);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_DEACTIVATED_PADDING, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Receiver::getFlippedDataX() const {
|
||||||
|
int arg = -1;
|
||||||
|
return sendToReceiver<int>(F_GET_FLIPPED_DATA_RECEIVER, arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFlippedDataX(const bool value) {
|
||||||
|
int arg = static_cast<int>(value);
|
||||||
|
LOG(logDEBUG1) << "Setting flipped data across x axis with value: "
|
||||||
|
<< value;
|
||||||
|
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::frameDiscardPolicy Receiver::getFramesDiscardPolicy() const {
|
||||||
|
return static_cast<frameDiscardPolicy>(
|
||||||
|
sendToReceiver<int>(F_GET_RECEIVER_DISCARD_POLICY));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFramesDiscardPolicy(const frameDiscardPolicy f) {
|
||||||
|
int arg = static_cast<int>(f);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_DISCARD_POLICY, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Receiver::getPartialFramesPadding() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_PADDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setPartialFramesPadding(const bool padding) {
|
||||||
|
int arg = static_cast<int>(padding);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_PADDING, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** File */
|
||||||
|
|
||||||
|
std::string Receiver::getFilePath() const {
|
||||||
|
char retvals[MAX_STR_LENGTH]{};
|
||||||
|
sendToReceiver(F_GET_RECEIVER_FILE_PATH, nullptr, retvals);
|
||||||
|
return std::string(retvals);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFilePath(const std::string &path) {
|
||||||
|
if (path.empty()) {
|
||||||
|
throw RuntimeError("Cannot set empty file path");
|
||||||
|
}
|
||||||
|
char args[MAX_STR_LENGTH]{};
|
||||||
|
sls::strcpy_safe(args, path.c_str());
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FILE_PATH, args, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Receiver::getFileName() const {
|
||||||
|
char retvals[MAX_STR_LENGTH]{};
|
||||||
|
sendToReceiver(F_GET_RECEIVER_FILE_NAME, nullptr, retvals);
|
||||||
|
return std::string(retvals);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFileName(const std::string &fname) {
|
||||||
|
if (fname.empty()) {
|
||||||
|
throw RuntimeError("Cannot set empty file name prefix");
|
||||||
|
}
|
||||||
|
char args[MAX_STR_LENGTH]{};
|
||||||
|
sls::strcpy_safe(args, fname.c_str());
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FILE_NAME, args, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t Receiver::getFileIndex() const {
|
||||||
|
return sendToReceiver<int64_t>(F_GET_RECEIVER_FILE_INDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFileIndex(const int64_t file_index) {
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FILE_INDEX, file_index, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::incrementFileIndex() {
|
||||||
|
sendToReceiver(F_INCREMENT_FILE_INDEX, nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::fileFormat Receiver::getFileFormat() const {
|
||||||
|
return static_cast<fileFormat>(
|
||||||
|
sendToReceiver<int>(F_GET_RECEIVER_FILE_FORMAT));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFileFormat(const fileFormat f) {
|
||||||
|
int arg = static_cast<int>(f);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FILE_FORMAT, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Receiver::getFramesPerFile() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_FRAMES_PER_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFramesPerFile(const int n_frames) {
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Receiver::getFileWrite() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_FILE_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFileWrite(const bool value) {
|
||||||
|
int arg = static_cast<int>(value);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_FILE_WRITE, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Receiver::getMasterFileWrite() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_MASTER_FILE_WRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setMasterFileWrite(const bool value) {
|
||||||
|
int arg = static_cast<int>(value);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_MASTER_FILE_WRITE, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Receiver::getFileOverWrite() const {
|
||||||
|
return sendToReceiver<int>(F_GET_RECEIVER_OVERWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setFileOverWrite(const bool value) {
|
||||||
|
int arg = static_cast<int>(value);
|
||||||
|
sendToReceiver(F_SET_RECEIVER_OVERWRITE, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
/** Detector Parameters */
|
/** Detector Parameters */
|
||||||
|
|
||||||
void Receiver::setNumberOfFrames(int64_t value) {
|
void Receiver::setNumberOfFrames(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending number of frames to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending number of frames to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setNumberOfTriggers(int64_t value) {
|
void Receiver::setNumberOfTriggers(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending number of triggers to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending number of triggers to Receiver: " << value;
|
||||||
sendToReceiver(F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setNumberOfBursts(int64_t value) {
|
void Receiver::setNumberOfBursts(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending number of bursts to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending number of bursts to Receiver: " << value;
|
||||||
sendToReceiver(F_SET_RECEIVER_NUM_BURSTS, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_NUM_BURSTS, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setNumberOfAnalogSamples(int value) {
|
void Receiver::setNumberOfAnalogSamples(const int value) {
|
||||||
LOG(logDEBUG1) << "Sending number of analog samples to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending number of analog samples to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setNumberOfDigitalSamples(int value) {
|
void Receiver::setNumberOfDigitalSamples(const int value) {
|
||||||
LOG(logDEBUG1) << "Sending number of digital samples to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending number of digital samples to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setExptime(int64_t value) {
|
void Receiver::setExptime(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setPeriod(int64_t value) {
|
void Receiver::setPeriod(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending period to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending period to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_PERIOD, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_PERIOD, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setSubExptime(int64_t value) {
|
void Receiver::setSubExptime(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setSubDeadTime(int64_t value) {
|
void Receiver::setSubDeadTime(const int64_t value) {
|
||||||
LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value;
|
||||||
sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setTimingMode(timingMode value) {
|
void Receiver::setTimingMode(const timingMode value) {
|
||||||
LOG(logDEBUG1) << "Sending timing mode to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending timing mode to Receiver: " << value;
|
||||||
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setDynamicRange(int n) {
|
void Receiver::setDynamicRange(const int n) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n;
|
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n;
|
||||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval);
|
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval);
|
||||||
@ -420,20 +608,20 @@ void Receiver::setReadNLines(const int value) {
|
|||||||
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setADCEnableMask(uint32_t mask) {
|
void Receiver::setADCEnableMask(const uint32_t mask) {
|
||||||
sendToReceiver(F_RECEIVER_SET_ADC_MASK, mask, nullptr);
|
sendToReceiver(F_RECEIVER_SET_ADC_MASK, mask, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setTenGigaADCEnableMask(uint32_t mask) {
|
void Receiver::setTenGigaADCEnableMask(const uint32_t mask) {
|
||||||
sendToReceiver(F_RECEIVER_SET_ADC_MASK_10G, mask, nullptr);
|
sendToReceiver(F_RECEIVER_SET_ADC_MASK_10G, mask, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setBurstMode(slsDetectorDefs::burstMode value) {
|
void Receiver::setBurstMode(const slsDetectorDefs::burstMode value) {
|
||||||
LOG(logDEBUG1) << "Sending burst mode to Receiver: " << value;
|
LOG(logDEBUG1) << "Sending burst mode to Receiver: " << value;
|
||||||
sendToReceiver(F_SET_RECEIVER_BURST_MODE, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_BURST_MODE, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setROI(slsDetectorDefs::ROI arg) {
|
void Receiver::setROI(const slsDetectorDefs::ROI arg) {
|
||||||
std::array<int, 2> args{arg.xmin, arg.xmax};
|
std::array<int, 2> args{arg.xmin, arg.xmax};
|
||||||
LOG(logDEBUG1) << "Sending ROI to receiver";
|
LOG(logDEBUG1) << "Sending ROI to receiver";
|
||||||
sendToReceiver(F_RECEIVER_SET_ROI, args, nullptr);
|
sendToReceiver(F_RECEIVER_SET_ROI, args, nullptr);
|
||||||
@ -468,11 +656,11 @@ void Receiver::setDbitList(const std::vector<int>& list) {
|
|||||||
sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr);
|
sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Receiver::getDbitOffset() {
|
int Receiver::getDbitOffset() const {
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_DBIT_OFFSET);
|
return sendToReceiver<int>(F_GET_RECEIVER_DBIT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::setDbitOffset(int value) {
|
void Receiver::setDbitOffset(const int value) {
|
||||||
sendToReceiver(F_SET_RECEIVER_DBIT_OFFSET, value, nullptr);
|
sendToReceiver(F_SET_RECEIVER_DBIT_OFFSET, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +669,9 @@ void Receiver::setActivate(const bool enable) {
|
|||||||
sendToReceiver(F_RECEIVER_ACTIVATE, arg, nullptr);
|
sendToReceiver(F_RECEIVER_ACTIVATE, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, std::string> Receiver::getAdditionalJsonHeader() {
|
/** Json */
|
||||||
|
|
||||||
|
std::map<std::string, std::string> Receiver::getAdditionalJsonHeader() const {
|
||||||
int fnum = F_GET_ADDITIONAL_JSON_HEADER;
|
int fnum = F_GET_ADDITIONAL_JSON_HEADER;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
@ -544,7 +734,7 @@ void Receiver::setAdditionalJsonHeader(const std::map<std::string, std::string>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Receiver::getAdditionalJsonParameter(const std::string &key) {
|
std::string Receiver::getAdditionalJsonParameter(const std::string &key) const {
|
||||||
char arg[SHORT_STR_LENGTH]{};
|
char arg[SHORT_STR_LENGTH]{};
|
||||||
sls::strcpy_safe(arg, key.c_str());
|
sls::strcpy_safe(arg, key.c_str());
|
||||||
char retval[SHORT_STR_LENGTH]{};
|
char retval[SHORT_STR_LENGTH]{};
|
||||||
|
@ -70,6 +70,9 @@ class Receiver : public virtual slsDetectorDefs {
|
|||||||
int getProgress() const;
|
int getProgress() const;
|
||||||
void setStoppedFlag();
|
void setStoppedFlag();
|
||||||
void restreamStop();
|
void restreamStop();
|
||||||
|
uint64_t getFramesCaught() const;
|
||||||
|
uint64_t getNumMissingPackets() const;
|
||||||
|
uint64_t getCurrentFrameIndex() const;
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -77,77 +80,123 @@ class Receiver : public virtual slsDetectorDefs {
|
|||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
sls::MacAddr setUDPIP(const sls::IpAddr ip);
|
sls::MacAddr setUDPIP(const sls::IpAddr ip);
|
||||||
void setUDPPort(int udpport);
|
void setUDPPort(const int udpport);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
bool getZmq() const;
|
||||||
|
void setZmq(const bool enable);
|
||||||
int getClientZmqPort() const;
|
int getClientZmqPort() const;
|
||||||
void setClientZmqPort(const int port);
|
void setClientZmqPort(const int port);
|
||||||
int getZmqPort() const;
|
int getZmqPort() const;
|
||||||
void setZmqPort(int port);
|
void setZmqPort(int port);
|
||||||
sls::IpAddr getClientZmqIP();
|
sls::IpAddr getClientZmqIP() const;
|
||||||
void setClientZmqIP(const sls::IpAddr ip);
|
void setClientZmqIP(const sls::IpAddr ip);
|
||||||
sls::IpAddr getZmqIP();
|
sls::IpAddr getZmqIP() const;
|
||||||
void setZmqIP(const sls::IpAddr ip);
|
void setZmqIP(const sls::IpAddr ip);
|
||||||
|
int getZmqFrequency() const;
|
||||||
|
/** Freq = 0 for a timer, else frequency */
|
||||||
|
void setZmqFrequency(const int freq);
|
||||||
|
int getZmqTimer() const;
|
||||||
|
void setZmqTimer(const int time_in_ms = 200);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Receiver Parameters *
|
* Receiver Parameters *
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
bool getLock() const;
|
||||||
|
void setLock(const bool lock);
|
||||||
|
sls::IpAddr getLastClientIP() const;
|
||||||
|
void exitServer();
|
||||||
|
|
||||||
int64_t getUDPSocketBufferSize() const;
|
int64_t getUDPSocketBufferSize() const;
|
||||||
void setUDPSocketBufferSize(int64_t value);
|
void setUDPSocketBufferSize(int64_t value);
|
||||||
int64_t getRealUDPSocketBufferSize() const;
|
int64_t getRealUDPSocketBufferSize() const;
|
||||||
|
|
||||||
/**************************************************
|
bool getDeactivatedPaddingMode() const;
|
||||||
* *
|
void setDeactivatedPaddingMode(const bool padding);
|
||||||
* Detector Parameters *
|
bool getFlippedDataX() const;
|
||||||
* *
|
void setFlippedDataX(const bool value);
|
||||||
* ************************************************/
|
frameDiscardPolicy getFramesDiscardPolicy() const;
|
||||||
void setNumberOfFrames(int64_t value);
|
void setFramesDiscardPolicy(const frameDiscardPolicy f);
|
||||||
void setNumberOfTriggers(int64_t value);
|
bool getPartialFramesPadding() const;
|
||||||
void setNumberOfBursts(int64_t value);
|
void setPartialFramesPadding(const bool padding);
|
||||||
void setNumberOfAnalogSamples(int value);
|
|
||||||
void setNumberOfDigitalSamples(int value);
|
|
||||||
void setExptime(int64_t value);
|
|
||||||
void setPeriod(int64_t value);
|
|
||||||
void setSubExptime(int64_t value);
|
|
||||||
void setSubDeadTime(int64_t value);
|
|
||||||
void setTimingMode(timingMode value);
|
|
||||||
void setDynamicRange(int n);
|
|
||||||
void setReadoutMode(const readoutMode mode);
|
|
||||||
void setQuad(const bool enable);
|
|
||||||
void setReadNLines(const int value);
|
|
||||||
void setADCEnableMask(uint32_t mask);
|
|
||||||
void setTenGigaADCEnableMask(uint32_t mask);
|
|
||||||
void setBurstMode(burstMode value);
|
|
||||||
void setROI(slsDetectorDefs::ROI arg);
|
|
||||||
void clearROI();
|
|
||||||
std::vector<int> getDbitList() const;
|
|
||||||
/** digital data bits enable (CTB only) */
|
|
||||||
void setDbitList(const std::vector<int>& list);
|
|
||||||
int getDbitOffset();
|
|
||||||
/** Set digital data offset in bytes (CTB only) */
|
|
||||||
void setDbitOffset(int value);
|
|
||||||
void setActivate(const bool enable);
|
|
||||||
|
|
||||||
std::map<std::string, std::string> getAdditionalJsonHeader();
|
|
||||||
/** empty vector deletes entire additional json header */
|
|
||||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader);
|
|
||||||
std::string getAdditionalJsonParameter(const std::string &key);
|
|
||||||
/** Sets the value for the additional json header parameter key if found,
|
|
||||||
else append it. If value empty, then deletes parameter */
|
|
||||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* File *
|
* File *
|
||||||
* *
|
* *
|
||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
std::string getFilePath() const;
|
||||||
|
void setFilePath(const std::string &path);
|
||||||
|
std::string getFileName() const;
|
||||||
|
void setFileName(const std::string &fname);
|
||||||
|
int64_t getFileIndex() const;
|
||||||
|
void setFileIndex(const int64_t file_index);
|
||||||
|
void incrementFileIndex();
|
||||||
|
fileFormat getFileFormat() const;
|
||||||
|
void setFileFormat(const fileFormat f);
|
||||||
|
int getFramesPerFile() const;
|
||||||
|
/** 0 will set frames per file to unlimited */
|
||||||
|
void setFramesPerFile(const int n_frames);
|
||||||
|
bool getFileWrite() const;
|
||||||
|
void setFileWrite(const bool value);
|
||||||
|
bool getMasterFileWrite() const;
|
||||||
|
void setMasterFileWrite(const bool value);
|
||||||
|
bool getFileOverWrite() const;
|
||||||
|
void setFileOverWrite(const bool value);
|
||||||
|
|
||||||
|
/**************************************************
|
||||||
|
* *
|
||||||
|
* Detector Parameters *
|
||||||
|
* *
|
||||||
|
* ************************************************/
|
||||||
|
void setNumberOfFrames(const int64_t value);
|
||||||
|
void setNumberOfTriggers(const int64_t value);
|
||||||
|
void setNumberOfBursts(const int64_t value);
|
||||||
|
void setNumberOfAnalogSamples(const int value);
|
||||||
|
void setNumberOfDigitalSamples(const int value);
|
||||||
|
void setExptime(const int64_t value);
|
||||||
|
void setPeriod(const int64_t value);
|
||||||
|
void setSubExptime(const int64_t value);
|
||||||
|
void setSubDeadTime(const int64_t value);
|
||||||
|
void setTimingMode(const timingMode value);
|
||||||
|
void setDynamicRange(const int n);
|
||||||
|
void setReadoutMode(const readoutMode mode);
|
||||||
|
void setQuad(const bool enable);
|
||||||
|
void setReadNLines(const int value);
|
||||||
|
void setADCEnableMask(const uint32_t mask);
|
||||||
|
void setTenGigaADCEnableMask(const uint32_t mask);
|
||||||
|
void setBurstMode(const burstMode value);
|
||||||
|
void setROI(const slsDetectorDefs::ROI arg);
|
||||||
|
void clearROI();
|
||||||
|
std::vector<int> getDbitList() const;
|
||||||
|
/** digital data bits enable (CTB only) */
|
||||||
|
void setDbitList(const std::vector<int>& list);
|
||||||
|
int getDbitOffset() const;
|
||||||
|
/** Set digital data offset in bytes (CTB only) */
|
||||||
|
void setDbitOffset(const int value);
|
||||||
|
void setActivate(const bool enable);
|
||||||
|
|
||||||
|
/**************************************************
|
||||||
|
* *
|
||||||
|
* Json *
|
||||||
|
* *
|
||||||
|
* ************************************************/
|
||||||
|
|
||||||
|
std::map<std::string, std::string> getAdditionalJsonHeader() const;
|
||||||
|
/** empty vector deletes entire additional json header */
|
||||||
|
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader);
|
||||||
|
std::string getAdditionalJsonParameter(const std::string &key) const;
|
||||||
|
/** Sets the value for the additional json header parameter key if found,
|
||||||
|
else append it. If value empty, then deletes parameter */
|
||||||
|
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendToReceiver(int fnum, const void *args, size_t args_size,
|
void sendToReceiver(int fnum, const void *args, size_t args_size,
|
||||||
|
@ -104,7 +104,8 @@ void ClientInterface::startTCPServer() {
|
|||||||
int ClientInterface::functionTable(){
|
int ClientInterface::functionTable(){
|
||||||
flist[F_EXEC_RECEIVER_COMMAND] = &ClientInterface::exec_command;
|
flist[F_EXEC_RECEIVER_COMMAND] = &ClientInterface::exec_command;
|
||||||
flist[F_EXIT_RECEIVER] = &ClientInterface::exit_server;
|
flist[F_EXIT_RECEIVER] = &ClientInterface::exit_server;
|
||||||
flist[F_LOCK_RECEIVER] = &ClientInterface::lock_receiver;
|
flist[F_SET_LOCK_RECEIVER] = &ClientInterface::set_lock_server;
|
||||||
|
flist[F_GET_LOCK_RECEIVER] = &ClientInterface::get_lock_server;
|
||||||
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
|
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
|
||||||
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
|
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
|
||||||
flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version;
|
flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version;
|
||||||
@ -148,8 +149,10 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_RECEIVER_ACTIVATE] = &ClientInterface::set_activate;
|
flist[F_RECEIVER_ACTIVATE] = &ClientInterface::set_activate;
|
||||||
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
|
flist[F_SET_RECEIVER_STREAMING] = &ClientInterface::set_streaming;
|
||||||
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
flist[F_GET_RECEIVER_STREAMING] = &ClientInterface::get_streaming;
|
||||||
flist[F_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
|
flist[F_SET_RECEIVER_STREAMING_TIMER] = &ClientInterface::set_streaming_timer;
|
||||||
|
flist[F_GET_RECEIVER_STREAMING_TIMER] = &ClientInterface::get_streaming_timer;
|
||||||
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data;
|
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data;
|
||||||
|
flist[F_GET_FLIPPED_DATA_RECEIVER] = &ClientInterface::get_flipped_data;
|
||||||
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
|
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
|
||||||
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
|
||||||
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
|
||||||
@ -289,7 +292,7 @@ int ClientInterface::exit_server(Interface &socket) {
|
|||||||
return GOODBYE;
|
return GOODBYE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::lock_receiver(Interface &socket) {
|
int ClientInterface::set_lock_server(Interface &socket) {
|
||||||
auto lock = socket.Receive<int>();
|
auto lock = socket.Receive<int>();
|
||||||
LOG(logDEBUG1) << "Locking Server to " << lock;
|
LOG(logDEBUG1) << "Locking Server to " << lock;
|
||||||
if (lock >= 0) {
|
if (lock >= 0) {
|
||||||
@ -301,6 +304,11 @@ int ClientInterface::lock_receiver(Interface &socket) {
|
|||||||
throw RuntimeError("Receiver locked\n");
|
throw RuntimeError("Receiver locked\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
socket.Send(OK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::get_lock_server(Interface &socket) {
|
||||||
return socket.sendResult(lockedByClient);
|
return socket.sendResult(lockedByClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,7 +915,7 @@ int ClientInterface::get_missing_packets(Interface &socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::get_frames_caught(Interface &socket) {
|
int ClientInterface::get_frames_caught(Interface &socket) {
|
||||||
int64_t retval = impl()->getFramesCaught();
|
uint64_t retval = impl()->getFramesCaught();
|
||||||
LOG(logDEBUG1) << "frames caught:" << retval;
|
LOG(logDEBUG1) << "frames caught:" << retval;
|
||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
@ -1071,9 +1079,17 @@ int ClientInterface::set_streaming_timer(Interface &socket) {
|
|||||||
int retval = impl()->getStreamingTimer();
|
int retval = impl()->getStreamingTimer();
|
||||||
validate(index, retval, "set data stream timer", DEC);
|
validate(index, retval, "set data stream timer", DEC);
|
||||||
LOG(logDEBUG1) << "Streaming timer:" << retval;
|
LOG(logDEBUG1) << "Streaming timer:" << retval;
|
||||||
|
socket.Send(OK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::get_streaming_timer(Interface &socket) {
|
||||||
|
int retval = impl()->getStreamingTimer();
|
||||||
|
LOG(logDEBUG1) << "Streaming timer:" << retval;
|
||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ClientInterface::set_flipped_data(Interface &socket) {
|
int ClientInterface::set_flipped_data(Interface &socket) {
|
||||||
auto arg = socket.Receive<int>();
|
auto arg = socket.Receive<int>();
|
||||||
|
|
||||||
@ -1088,6 +1104,13 @@ int ClientInterface::set_flipped_data(Interface &socket) {
|
|||||||
int retval = impl()->getFlippedDataX();
|
int retval = impl()->getFlippedDataX();
|
||||||
validate(arg, retval, std::string("set flipped data"), DEC);
|
validate(arg, retval, std::string("set flipped data"), DEC);
|
||||||
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||||
|
socket.Send(OK);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ClientInterface::get_flipped_data(Interface &socket) {
|
||||||
|
int retval = impl()->getFlippedDataX();
|
||||||
|
LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
int exec_command(sls::ServerInterface &socket);
|
int exec_command(sls::ServerInterface &socket);
|
||||||
int exit_server(sls::ServerInterface &socket);
|
int exit_server(sls::ServerInterface &socket);
|
||||||
int lock_receiver(sls::ServerInterface &socket);
|
int set_lock_server(sls::ServerInterface &socket);
|
||||||
|
int get_lock_server(sls::ServerInterface &socket);
|
||||||
int get_last_client_ip(sls::ServerInterface &socket);
|
int get_last_client_ip(sls::ServerInterface &socket);
|
||||||
int set_port(sls::ServerInterface &socket);
|
int set_port(sls::ServerInterface &socket);
|
||||||
int get_version(sls::ServerInterface &socket);
|
int get_version(sls::ServerInterface &socket);
|
||||||
@ -108,7 +109,9 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int set_streaming(sls::ServerInterface &socket);
|
int set_streaming(sls::ServerInterface &socket);
|
||||||
int get_streaming(sls::ServerInterface &socket);
|
int get_streaming(sls::ServerInterface &socket);
|
||||||
int set_streaming_timer(sls::ServerInterface &socket);
|
int set_streaming_timer(sls::ServerInterface &socket);
|
||||||
|
int get_streaming_timer(sls::ServerInterface &socket);
|
||||||
int set_flipped_data(sls::ServerInterface &socket);
|
int set_flipped_data(sls::ServerInterface &socket);
|
||||||
|
int get_flipped_data(sls::ServerInterface &socket);
|
||||||
int set_file_format(sls::ServerInterface &socket);
|
int set_file_format(sls::ServerInterface &socket);
|
||||||
int get_file_format(sls::ServerInterface &socket);
|
int get_file_format(sls::ServerInterface &socket);
|
||||||
int set_streaming_port(sls::ServerInterface &socket);
|
int set_streaming_port(sls::ServerInterface &socket);
|
||||||
|
@ -204,7 +204,8 @@ enum detFuncs{
|
|||||||
|
|
||||||
F_EXEC_RECEIVER_COMMAND,
|
F_EXEC_RECEIVER_COMMAND,
|
||||||
F_EXIT_RECEIVER,
|
F_EXIT_RECEIVER,
|
||||||
F_LOCK_RECEIVER,
|
F_SET_LOCK_RECEIVER,
|
||||||
|
F_GET_LOCK_RECEIVER,
|
||||||
F_GET_LAST_RECEIVER_CLIENT_IP,
|
F_GET_LAST_RECEIVER_CLIENT_IP,
|
||||||
F_SET_RECEIVER_PORT,
|
F_SET_RECEIVER_PORT,
|
||||||
F_GET_RECEIVER_VERSION,
|
F_GET_RECEIVER_VERSION,
|
||||||
@ -247,8 +248,10 @@ enum detFuncs{
|
|||||||
F_RECEIVER_ACTIVATE,
|
F_RECEIVER_ACTIVATE,
|
||||||
F_SET_RECEIVER_STREAMING,
|
F_SET_RECEIVER_STREAMING,
|
||||||
F_GET_RECEIVER_STREAMING,
|
F_GET_RECEIVER_STREAMING,
|
||||||
F_RECEIVER_STREAMING_TIMER,
|
F_SET_RECEIVER_STREAMING_TIMER,
|
||||||
|
F_GET_RECEIVER_STREAMING_TIMER,
|
||||||
F_SET_FLIPPED_DATA_RECEIVER,
|
F_SET_FLIPPED_DATA_RECEIVER,
|
||||||
|
F_GET_FLIPPED_DATA_RECEIVER,
|
||||||
F_SET_RECEIVER_FILE_FORMAT,
|
F_SET_RECEIVER_FILE_FORMAT,
|
||||||
F_GET_RECEIVER_FILE_FORMAT,
|
F_GET_RECEIVER_FILE_FORMAT,
|
||||||
F_SET_RECEIVER_STREAMING_PORT,
|
F_SET_RECEIVER_STREAMING_PORT,
|
||||||
@ -493,7 +496,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
|
|
||||||
case F_EXEC_RECEIVER_COMMAND: return "F_EXEC_RECEIVER_COMMAND";
|
case F_EXEC_RECEIVER_COMMAND: return "F_EXEC_RECEIVER_COMMAND";
|
||||||
case F_EXIT_RECEIVER: return "F_EXIT_RECEIVER";
|
case F_EXIT_RECEIVER: return "F_EXIT_RECEIVER";
|
||||||
case F_LOCK_RECEIVER: return "F_LOCK_RECEIVER";
|
case F_SET_LOCK_RECEIVER: return "F_SET_LOCK_RECEIVER";
|
||||||
|
case F_GET_LOCK_RECEIVER: return "F_GET_LOCK_RECEIVER";
|
||||||
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
|
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
|
||||||
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
|
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
|
||||||
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
|
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
|
||||||
@ -537,8 +541,10 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE";
|
case F_RECEIVER_ACTIVATE: return "F_RECEIVER_ACTIVATE";
|
||||||
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
|
case F_SET_RECEIVER_STREAMING: return "F_SET_RECEIVER_STREAMING";
|
||||||
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
|
case F_GET_RECEIVER_STREAMING: return "F_GET_RECEIVER_STREAMING";
|
||||||
case F_RECEIVER_STREAMING_TIMER: return "F_RECEIVER_STREAMING_TIMER";
|
case F_SET_RECEIVER_STREAMING_TIMER: return "F_SET_RECEIVER_STREAMING_TIMER";
|
||||||
|
case F_GET_RECEIVER_STREAMING_TIMER: return "F_GET_RECEIVER_STREAMING_TIMER";
|
||||||
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
|
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
|
||||||
|
case F_GET_FLIPPED_DATA_RECEIVER: return "F_GET_FLIPPED_DATA_RECEIVER";
|
||||||
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
|
||||||
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
|
||||||
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
|
||||||
|
Reference in New Issue
Block a user