mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-30 18:00:05 +02:00
WIP
This commit is contained in:
parent
a7f5300455
commit
2921cbfac8
@ -3,6 +3,7 @@ set(SOURCES
|
|||||||
src/slsDetectorUsers.cpp
|
src/slsDetectorUsers.cpp
|
||||||
src/Module.cpp
|
src/Module.cpp
|
||||||
src/Detector.cpp
|
src/Detector.cpp
|
||||||
|
src/Receiver.cpp
|
||||||
src/CmdProxy.cpp
|
src/CmdProxy.cpp
|
||||||
src/CmdParser.cpp
|
src/CmdParser.cpp
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@ class IpAddr;
|
|||||||
//Free function to avoid dependence on class
|
//Free function to avoid dependence on class
|
||||||
//and avoid the option to free another objects
|
//and avoid the option to free another objects
|
||||||
//shm by mistake
|
//shm by mistake
|
||||||
void freeSharedMemory(int multiId, int detPos = -1);
|
void freeSharedMemory(int detectorId, int detPos = -1);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,29 +13,29 @@
|
|||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
void freeSharedMemory(int multiId, int detPos) {
|
void freeSharedMemory(int detectorId, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
SharedMemory<sharedSlsDetector> temp_shm(multiId, detPos);
|
SharedMemory<sharedModule> moduleShm(detectorId, detPos);
|
||||||
if (temp_shm.IsExisting()) {
|
if (moduleShm.IsExisting()) {
|
||||||
temp_shm.RemoveSharedMemory();
|
moduleShm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi - get number of detectors from shm
|
// multi - get number of detectors from shm
|
||||||
SharedMemory<sharedMultiSlsDetector> multiShm(multiId, -1);
|
SharedMemory<sharedDetector> detectorShm(detectorId, -1);
|
||||||
int numDetectors = 0;
|
int numDetectors = 0;
|
||||||
|
|
||||||
if (multiShm.IsExisting()) {
|
if (detectorShm.IsExisting()) {
|
||||||
multiShm.OpenSharedMemory();
|
detectorShm.OpenSharedMemory();
|
||||||
numDetectors = multiShm()->numberOfDetectors;
|
numDetectors = detectorShm()->numberOfDetectors;
|
||||||
multiShm.RemoveSharedMemory();
|
detectorShm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numDetectors; ++i) {
|
for (int i = 0; i < numDetectors; ++i) {
|
||||||
SharedMemory<sharedSlsDetector> shm(multiId, i);
|
SharedMemory<sharedModule> moduleShm(detectorId, i);
|
||||||
shm.RemoveSharedMemory();
|
moduleShm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ void Detector::setVirtualDetectorServers(int numServers, int startingPort) {
|
|||||||
pimpl->setVirtualDetectorServers(numServers, startingPort);
|
pimpl->setVirtualDetectorServers(numServers, startingPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Detector::getShmId() const { return pimpl->getMultiId(); }
|
int Detector::getShmId() const { return pimpl->getDetectorId(); }
|
||||||
|
|
||||||
std::string Detector::getPackageVersion() const {
|
std::string Detector::getPackageVersion() const {
|
||||||
return GITBRANCH;
|
return GITBRANCH;
|
||||||
|
@ -28,14 +28,14 @@
|
|||||||
|
|
||||||
namespace sls{
|
namespace sls{
|
||||||
|
|
||||||
DetectorImpl::DetectorImpl(int multi_id, bool verify, bool update)
|
DetectorImpl::DetectorImpl(int detector_id, bool verify, bool update)
|
||||||
: multiId(multi_id), multi_shm(multi_id, -1) {
|
: detectorId(detector_id), detector_shm(detector_id, -1) {
|
||||||
setupMultiDetector(verify, update);
|
setupDetector(verify, update);
|
||||||
}
|
}
|
||||||
|
|
||||||
DetectorImpl::~DetectorImpl() = default;
|
DetectorImpl::~DetectorImpl() = default;
|
||||||
|
|
||||||
void DetectorImpl::setupMultiDetector(bool verify, bool update) {
|
void DetectorImpl::setupDetector(bool verify, bool update) {
|
||||||
initSharedMemory(verify);
|
initSharedMemory(verify);
|
||||||
initializeMembers(verify);
|
initializeMembers(verify);
|
||||||
if (update) {
|
if (update) {
|
||||||
@ -44,34 +44,34 @@ void DetectorImpl::setupMultiDetector(bool verify, bool update) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setAcquiringFlag(bool flag) {
|
void DetectorImpl::setAcquiringFlag(bool flag) {
|
||||||
multi_shm()->acquiringFlag = flag;
|
detector_shm()->acquiringFlag = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DetectorImpl::getMultiId() const { return multiId; }
|
int DetectorImpl::getDetectorId() const { return detectorId; }
|
||||||
|
|
||||||
void DetectorImpl::freeSharedMemory(int multiId, int detPos) {
|
void DetectorImpl::freeSharedMemory(int detectorId, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
SharedMemory<sharedSlsDetector> temp_shm(multiId, detPos);
|
SharedMemory<sharedModule> module_shm(detectorId, detPos);
|
||||||
if (temp_shm.IsExisting()) {
|
if (module_shm.IsExisting()) {
|
||||||
temp_shm.RemoveSharedMemory();
|
module_shm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi - get number of detectors from shm
|
// multi - get number of detectors from shm
|
||||||
SharedMemory<sharedMultiSlsDetector> multiShm(multiId, -1);
|
SharedMemory<sharedDetector> detectorShm(detectorId, -1);
|
||||||
int numDetectors = 0;
|
int numDetectors = 0;
|
||||||
|
|
||||||
if (multiShm.IsExisting()) {
|
if (detectorShm.IsExisting()) {
|
||||||
multiShm.OpenSharedMemory();
|
detectorShm.OpenSharedMemory();
|
||||||
numDetectors = multiShm()->numberOfDetectors;
|
numDetectors = detectorShm()->numberOfDetectors;
|
||||||
multiShm.RemoveSharedMemory();
|
detectorShm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < numDetectors; ++i) {
|
for (int i = 0; i < numDetectors; ++i) {
|
||||||
SharedMemory<sharedSlsDetector> shm(multiId, i);
|
SharedMemory<sharedModule> module_shm(detectorId, i);
|
||||||
shm.RemoveSharedMemory();
|
module_shm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ void DetectorImpl::freeSharedMemory() {
|
|||||||
detectors.clear();
|
detectors.clear();
|
||||||
|
|
||||||
// clear multi detector shm
|
// clear multi detector shm
|
||||||
multi_shm.RemoveSharedMemory();
|
detector_shm.RemoveSharedMemory();
|
||||||
client_downstream = false;
|
client_downstream = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ std::string DetectorImpl::getUserDetails() {
|
|||||||
}
|
}
|
||||||
sstream << "\nType: ";
|
sstream << "\nType: ";
|
||||||
// get type from multi shm
|
// get type from multi shm
|
||||||
if (multi_shm()->shmversion >= MULTI_SHMAPIVERSION) {
|
if (detector_shm()->shmversion >= DETECTOR_SHMAPIVERSION) {
|
||||||
sstream << ToString(multi_shm()->multiDetectorType);
|
sstream << ToString(detector_shm()->multiDetectorType);
|
||||||
}
|
}
|
||||||
// get type from slsdet shm
|
// get type from slsdet shm
|
||||||
else {
|
else {
|
||||||
@ -114,33 +114,33 @@ std::string DetectorImpl::getUserDetails() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sstream << "\nPID: " << multi_shm()->lastPID
|
sstream << "\nPID: " << detector_shm()->lastPID
|
||||||
<< "\nUser: " << multi_shm()->lastUser
|
<< "\nUser: " << detector_shm()->lastUser
|
||||||
<< "\nDate: " << multi_shm()->lastDate << std::endl;
|
<< "\nDate: " << detector_shm()->lastDate << std::endl;
|
||||||
|
|
||||||
return sstream.str();
|
return sstream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectorImpl::getInitialChecks() const {
|
bool DetectorImpl::getInitialChecks() const {
|
||||||
return multi_shm()->initialChecks;
|
return detector_shm()->initialChecks;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setInitialChecks(const bool value) {
|
void DetectorImpl::setInitialChecks(const bool value) {
|
||||||
multi_shm()->initialChecks = value;
|
detector_shm()->initialChecks = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::initSharedMemory(bool verify) {
|
void DetectorImpl::initSharedMemory(bool verify) {
|
||||||
if (!multi_shm.IsExisting()) {
|
if (!detector_shm.IsExisting()) {
|
||||||
multi_shm.CreateSharedMemory();
|
detector_shm.CreateSharedMemory();
|
||||||
initializeDetectorStructure();
|
initializeDetectorStructure();
|
||||||
} else {
|
} else {
|
||||||
multi_shm.OpenSharedMemory();
|
detector_shm.OpenSharedMemory();
|
||||||
if (verify && multi_shm()->shmversion != MULTI_SHMVERSION) {
|
if (verify && detector_shm()->shmversion != DETECTOR_SHMVERSION) {
|
||||||
LOG(logERROR) << "Multi shared memory (" << multiId
|
LOG(logERROR) << "Detector shared memory (" << detectorId
|
||||||
<< ") version mismatch "
|
<< ") version mismatch "
|
||||||
"(expected 0x"
|
"(expected 0x"
|
||||||
<< std::hex << MULTI_SHMVERSION << " but got 0x"
|
<< std::hex << DETECTOR_SHMVERSION << " but got 0x"
|
||||||
<< multi_shm()->shmversion << std::dec
|
<< detector_shm()->shmversion << std::dec
|
||||||
<< ". Clear Shared memory to continue.";
|
<< ". Clear Shared memory to continue.";
|
||||||
throw SharedMemoryError("Shared memory version mismatch!");
|
throw SharedMemoryError("Shared memory version mismatch!");
|
||||||
}
|
}
|
||||||
@ -148,16 +148,16 @@ void DetectorImpl::initSharedMemory(bool verify) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::initializeDetectorStructure() {
|
void DetectorImpl::initializeDetectorStructure() {
|
||||||
multi_shm()->shmversion = MULTI_SHMVERSION;
|
detector_shm()->shmversion = DETECTOR_SHMVERSION;
|
||||||
multi_shm()->numberOfDetectors = 0;
|
detector_shm()->numberOfDetectors = 0;
|
||||||
multi_shm()->multiDetectorType = GENERIC;
|
detector_shm()->multiDetectorType = GENERIC;
|
||||||
multi_shm()->numberOfDetector.x = 0;
|
detector_shm()->numberOfDetector.x = 0;
|
||||||
multi_shm()->numberOfDetector.y = 0;
|
detector_shm()->numberOfDetector.y = 0;
|
||||||
multi_shm()->numberOfChannels.x = 0;
|
detector_shm()->numberOfChannels.x = 0;
|
||||||
multi_shm()->numberOfChannels.y = 0;
|
detector_shm()->numberOfChannels.y = 0;
|
||||||
multi_shm()->acquiringFlag = false;
|
detector_shm()->acquiringFlag = false;
|
||||||
multi_shm()->initialChecks = true;
|
detector_shm()->initialChecks = true;
|
||||||
multi_shm()->gapPixels = false;
|
detector_shm()->gapPixels = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::initializeMembers(bool verify) {
|
void DetectorImpl::initializeMembers(bool verify) {
|
||||||
@ -165,10 +165,10 @@ void DetectorImpl::initializeMembers(bool verify) {
|
|||||||
zmqSocket.clear();
|
zmqSocket.clear();
|
||||||
|
|
||||||
// get objects from single det shared memory (open)
|
// get objects from single det shared memory (open)
|
||||||
for (int i = 0; i < multi_shm()->numberOfDetectors; i++) {
|
for (int i = 0; i < detector_shm()->numberOfDetectors; i++) {
|
||||||
try {
|
try {
|
||||||
detectors.push_back(
|
detectors.push_back(
|
||||||
sls::make_unique<Module>(multiId, i, verify));
|
sls::make_unique<Module>(detectorId, i, verify));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
detectors.clear();
|
detectors.clear();
|
||||||
throw;
|
throw;
|
||||||
@ -177,27 +177,27 @@ void DetectorImpl::initializeMembers(bool verify) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::updateUserdetails() {
|
void DetectorImpl::updateUserdetails() {
|
||||||
multi_shm()->lastPID = getpid();
|
detector_shm()->lastPID = getpid();
|
||||||
memset(multi_shm()->lastUser, 0, sizeof(multi_shm()->lastUser));
|
memset(detector_shm()->lastUser, 0, sizeof(detector_shm()->lastUser));
|
||||||
memset(multi_shm()->lastDate, 0, sizeof(multi_shm()->lastDate));
|
memset(detector_shm()->lastDate, 0, sizeof(detector_shm()->lastDate));
|
||||||
try {
|
try {
|
||||||
sls::strcpy_safe(multi_shm()->lastUser, exec("whoami").c_str());
|
sls::strcpy_safe(detector_shm()->lastUser, exec("whoami").c_str());
|
||||||
sls::strcpy_safe(multi_shm()->lastDate, exec("date").c_str());
|
sls::strcpy_safe(detector_shm()->lastDate, exec("date").c_str());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
sls::strcpy_safe(multi_shm()->lastUser, "errorreading");
|
sls::strcpy_safe(detector_shm()->lastUser, "errorreading");
|
||||||
sls::strcpy_safe(multi_shm()->lastDate, "errorreading");
|
sls::strcpy_safe(detector_shm()->lastDate, "errorreading");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectorImpl::isAcquireReady() {
|
bool DetectorImpl::isAcquireReady() {
|
||||||
if (multi_shm()->acquiringFlag) {
|
if (detector_shm()->acquiringFlag) {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING)
|
||||||
<< "Acquire has already started. "
|
<< "Acquire has already started. "
|
||||||
"If previous acquisition terminated unexpectedly, "
|
"If previous acquisition terminated unexpectedly, "
|
||||||
"reset busy flag to restart.(sls_detector_put clearbusy)";
|
"reset busy flag to restart.(sls_detector_put clearbusy)";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
multi_shm()->acquiringFlag = true;
|
detector_shm()->acquiringFlag = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,14 +232,14 @@ void DetectorImpl::setVirtualDetectorServers(const int numdet, const int port) {
|
|||||||
|
|
||||||
void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
void DetectorImpl::setHostname(const std::vector<std::string> &name) {
|
||||||
// this check is there only to allow the previous detsizechan command
|
// this check is there only to allow the previous detsizechan command
|
||||||
if (multi_shm()->numberOfDetectors != 0) {
|
if (detector_shm()->numberOfDetectors != 0) {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING)
|
||||||
<< "There are already detector(s) in shared memory."
|
<< "There are already detector(s) in shared memory."
|
||||||
"Freeing Shared memory now.";
|
"Freeing Shared memory now.";
|
||||||
bool initialChecks = multi_shm()->initialChecks;
|
bool initialChecks = detector_shm()->initialChecks;
|
||||||
freeSharedMemory();
|
freeSharedMemory();
|
||||||
setupMultiDetector();
|
setupDetector();
|
||||||
multi_shm()->initialChecks = initialChecks;
|
detector_shm()->initialChecks = initialChecks;
|
||||||
}
|
}
|
||||||
for (const auto &hostname : name) {
|
for (const auto &hostname : name) {
|
||||||
addSlsDetector(hostname);
|
addSlsDetector(hostname);
|
||||||
@ -263,7 +263,7 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
|||||||
if (d->getHostname() == host) {
|
if (d->getHostname() == host) {
|
||||||
LOG(logWARNING)
|
LOG(logWARNING)
|
||||||
<< "Detector " << host
|
<< "Detector " << host
|
||||||
<< "already part of the multiDetector!" << std::endl
|
<< "already part of the Detector!" << std::endl
|
||||||
<< "Remove it before adding it back in a new position!";
|
<< "Remove it before adding it back in a new position!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -274,13 +274,13 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
|||||||
detectorType type = Module::getTypeFromDetector(host, port);
|
detectorType type = Module::getTypeFromDetector(host, port);
|
||||||
auto pos = detectors.size();
|
auto pos = detectors.size();
|
||||||
detectors.emplace_back(
|
detectors.emplace_back(
|
||||||
sls::make_unique<Module>(type, multiId, pos, false));
|
sls::make_unique<Module>(type, detectorId, pos, false));
|
||||||
multi_shm()->numberOfDetectors = detectors.size();
|
detector_shm()->numberOfDetectors = detectors.size();
|
||||||
detectors[pos]->setControlPort(port);
|
detectors[pos]->setControlPort(port);
|
||||||
detectors[pos]->setStopPort(port + 1);
|
detectors[pos]->setStopPort(port + 1);
|
||||||
detectors[pos]->setHostname(host, multi_shm()->initialChecks);
|
detectors[pos]->setHostname(host, detector_shm()->initialChecks);
|
||||||
// detector type updated by now
|
// detector type updated by now
|
||||||
multi_shm()->multiDetectorType =
|
detector_shm()->multiDetectorType =
|
||||||
Parallel(&Module::getDetectorType, {})
|
Parallel(&Module::getDetectorType, {})
|
||||||
.tsquash("Inconsistent detector types.");
|
.tsquash("Inconsistent detector types.");
|
||||||
// for moench and ctb
|
// for moench and ctb
|
||||||
@ -288,11 +288,11 @@ void DetectorImpl::addSlsDetector(const std::string &hostname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::updateDetectorSize() {
|
void DetectorImpl::updateDetectorSize() {
|
||||||
LOG(logDEBUG) << "Updating Multi-Detector Size: " << size();
|
LOG(logDEBUG) << "Updating Detector Size: " << size();
|
||||||
|
|
||||||
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
|
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
|
||||||
|
|
||||||
int maxy = multi_shm()->numberOfChannels.y;
|
int maxy = detector_shm()->numberOfChannels.y;
|
||||||
if (maxy == 0) {
|
if (maxy == 0) {
|
||||||
maxy = det_size.y * size();
|
maxy = det_size.y * size();
|
||||||
}
|
}
|
||||||
@ -303,33 +303,33 @@ void DetectorImpl::updateDetectorSize() {
|
|||||||
++ndetx;
|
++ndetx;
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_shm()->numberOfDetector.x = ndetx;
|
detector_shm()->numberOfDetector.x = ndetx;
|
||||||
multi_shm()->numberOfDetector.y = ndety;
|
detector_shm()->numberOfDetector.y = ndety;
|
||||||
multi_shm()->numberOfChannels.x = det_size.x * ndetx;
|
detector_shm()->numberOfChannels.x = det_size.x * ndetx;
|
||||||
multi_shm()->numberOfChannels.y = det_size.y * ndety;
|
detector_shm()->numberOfChannels.y = det_size.y * ndety;
|
||||||
|
|
||||||
LOG(logDEBUG) << "\n\tNumber of Detectors in X direction:"
|
LOG(logDEBUG) << "\n\tNumber of Detectors in X direction:"
|
||||||
<< multi_shm()->numberOfDetector.x
|
<< detector_shm()->numberOfDetector.x
|
||||||
<< "\n\tNumber of Detectors in Y direction:"
|
<< "\n\tNumber of Detectors in Y direction:"
|
||||||
<< multi_shm()->numberOfDetector.y
|
<< detector_shm()->numberOfDetector.y
|
||||||
<< "\n\tNumber of Channels in X direction:"
|
<< "\n\tNumber of Channels in X direction:"
|
||||||
<< multi_shm()->numberOfChannels.x
|
<< detector_shm()->numberOfChannels.x
|
||||||
<< "\n\tNumber of Channels in Y direction:"
|
<< "\n\tNumber of Channels in Y direction:"
|
||||||
<< multi_shm()->numberOfChannels.y;
|
<< detector_shm()->numberOfChannels.y;
|
||||||
|
|
||||||
for (auto &d : detectors) {
|
for (auto &d : detectors) {
|
||||||
d->updateMultiSize(multi_shm()->numberOfDetector);
|
d->updateDetectorSize(detector_shm()->numberOfDetector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DetectorImpl::size() const { return detectors.size(); }
|
int DetectorImpl::size() const { return detectors.size(); }
|
||||||
|
|
||||||
slsDetectorDefs::xy DetectorImpl::getNumberOfDetectors() const {
|
slsDetectorDefs::xy DetectorImpl::getNumberOfDetectors() const {
|
||||||
return multi_shm()->numberOfDetector;
|
return detector_shm()->numberOfDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::xy DetectorImpl::getNumberOfChannels() const {
|
slsDetectorDefs::xy DetectorImpl::getNumberOfChannels() const {
|
||||||
return multi_shm()->numberOfChannels;
|
return detector_shm()->numberOfChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setNumberOfChannels(const slsDetectorDefs::xy c) {
|
void DetectorImpl::setNumberOfChannels(const slsDetectorDefs::xy c) {
|
||||||
@ -337,33 +337,33 @@ void DetectorImpl::setNumberOfChannels(const slsDetectorDefs::xy c) {
|
|||||||
throw RuntimeError(
|
throw RuntimeError(
|
||||||
"Set the number of channels before setting hostname.");
|
"Set the number of channels before setting hostname.");
|
||||||
}
|
}
|
||||||
multi_shm()->numberOfChannels = c;
|
detector_shm()->numberOfChannels = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DetectorImpl::getGapPixelsinCallback() const {
|
bool DetectorImpl::getGapPixelsinCallback() const {
|
||||||
return multi_shm()->gapPixels;
|
return detector_shm()->gapPixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setGapPixelsinCallback(const bool enable) {
|
void DetectorImpl::setGapPixelsinCallback(const bool enable) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
switch (multi_shm()->multiDetectorType) {
|
switch (detector_shm()->multiDetectorType) {
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
break;
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
if (size() && detectors[0]->getQuad()) {
|
if (size() && detectors[0]->getQuad()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (multi_shm()->numberOfDetector.y % 2 != 0) {
|
if (detector_shm()->numberOfDetector.y % 2 != 0) {
|
||||||
throw RuntimeError("Gap pixels can only be used "
|
throw RuntimeError("Gap pixels can only be used "
|
||||||
"for full modules.");
|
"for full modules.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Gap Pixels is not implemented for "
|
throw RuntimeError("Gap Pixels is not implemented for "
|
||||||
+ multi_shm()->multiDetectorType);
|
+ detector_shm()->multiDetectorType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
multi_shm()->gapPixels = enable;
|
detector_shm()->gapPixels = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
||||||
@ -383,7 +383,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
|||||||
|
|
||||||
size_t numSockets = detectors.size();
|
size_t numSockets = detectors.size();
|
||||||
size_t numSocketsPerDetector = 1;
|
size_t numSocketsPerDetector = 1;
|
||||||
if (multi_shm()->multiDetectorType == EIGER) {
|
if (detector_shm()->multiDetectorType == EIGER) {
|
||||||
numSocketsPerDetector = 2;
|
numSocketsPerDetector = 2;
|
||||||
}
|
}
|
||||||
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() ==
|
if (Parallel(&Module::getNumberofUDPInterfacesFromShm, {}).squash() ==
|
||||||
@ -420,7 +420,7 @@ int DetectorImpl::createReceivingDataSockets(const bool destroy) {
|
|||||||
|
|
||||||
void DetectorImpl::readFrameFromReceiver() {
|
void DetectorImpl::readFrameFromReceiver() {
|
||||||
|
|
||||||
bool gapPixels = multi_shm()->gapPixels;
|
bool gapPixels = detector_shm()->gapPixels;
|
||||||
LOG(logDEBUG) << "Gap pixels: " << gapPixels;
|
LOG(logDEBUG) << "Gap pixels: " << gapPixels;
|
||||||
|
|
||||||
int nX = 0;
|
int nX = 0;
|
||||||
@ -577,7 +577,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
|||||||
uint32_t yoffset = coordY * nPixelsY;
|
uint32_t yoffset = coordY * nPixelsY;
|
||||||
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
|
uint32_t singledetrowoffset = nPixelsX * bytesPerPixel;
|
||||||
uint32_t rowoffset = nX * singledetrowoffset;
|
uint32_t rowoffset = nX * singledetrowoffset;
|
||||||
if (multi_shm()->multiDetectorType == CHIPTESTBOARD) {
|
if (detector_shm()->multiDetectorType == CHIPTESTBOARD) {
|
||||||
singledetrowoffset = size;
|
singledetrowoffset = size;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1)
|
||||||
@ -755,7 +755,7 @@ int DetectorImpl::InsertGapPixels(char *image, char *&gpImage,
|
|||||||
// eiger requires inter chip gap pixels are halved
|
// eiger requires inter chip gap pixels are halved
|
||||||
// jungfrau prefers same inter chip gap pixels as the boundary pixels
|
// jungfrau prefers same inter chip gap pixels as the boundary pixels
|
||||||
int divisionValue = 2;
|
int divisionValue = 2;
|
||||||
slsDetectorDefs::detectorType detType = multi_shm()->multiDetectorType;
|
slsDetectorDefs::detectorType detType = detector_shm()->multiDetectorType;
|
||||||
if (detType == JUNGFRAU) {
|
if (detType == JUNGFRAU) {
|
||||||
divisionValue = 1;
|
divisionValue = 1;
|
||||||
}
|
}
|
||||||
@ -1048,7 +1048,7 @@ int DetectorImpl::acquire() {
|
|||||||
|
|
||||||
// start and read all
|
// start and read all
|
||||||
try {
|
try {
|
||||||
if (multi_shm()->multiDetectorType == EIGER) {
|
if (detector_shm()->multiDetectorType == EIGER) {
|
||||||
Parallel(&Module::prepareAcquisition, {});
|
Parallel(&Module::prepareAcquisition, {});
|
||||||
}
|
}
|
||||||
Parallel(&Module::startAndReadAll, {});
|
Parallel(&Module::startAndReadAll, {});
|
||||||
@ -1172,7 +1172,7 @@ int DetectorImpl::kbhit() {
|
|||||||
std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||||
// validate type of file
|
// validate type of file
|
||||||
bool isPof = false;
|
bool isPof = false;
|
||||||
switch (multi_shm()->multiDetectorType) {
|
switch (detector_shm()->multiDetectorType) {
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
case CHIPTESTBOARD:
|
case CHIPTESTBOARD:
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
|
@ -15,8 +15,8 @@ class detectorData;
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define MULTI_SHMAPIVERSION 0x190809
|
#define DETECTOR_SHMAPIVERSION 0x190809
|
||||||
#define MULTI_SHMVERSION 0x200319
|
#define DETECTOR_SHMVERSION 0x200319
|
||||||
#define SHORT_STRING_LENGTH 50
|
#define SHORT_STRING_LENGTH 50
|
||||||
|
|
||||||
#include <future>
|
#include <future>
|
||||||
@ -30,7 +30,7 @@ class Module;
|
|||||||
* @short structure allocated in shared memory to store detector settings
|
* @short structure allocated in shared memory to store detector settings
|
||||||
* for IPC and cache
|
* for IPC and cache
|
||||||
*/
|
*/
|
||||||
struct sharedMultiSlsDetector {
|
struct sharedDetector {
|
||||||
|
|
||||||
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND
|
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND
|
||||||
* ------*/
|
* ------*/
|
||||||
@ -68,12 +68,12 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param id multi detector id
|
* @param detector_id multi detector id
|
||||||
* @param verify true to verify if shared memory version matches existing
|
* @param verify true to verify if shared memory version matches existing
|
||||||
* one
|
* one
|
||||||
* @param update true to update last user pid, date etc
|
* @param update true to update last user pid, date etc
|
||||||
*/
|
*/
|
||||||
explicit DetectorImpl(int multi_id = 0, bool verify = true,
|
explicit DetectorImpl(int detector_id = 0, bool verify = true,
|
||||||
bool update = true);
|
bool update = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,11 +192,11 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
/** set acquiring flag in shared memory */
|
/** set acquiring flag in shared memory */
|
||||||
void setAcquiringFlag(bool flag);
|
void setAcquiringFlag(bool flag);
|
||||||
|
|
||||||
/** return multi detector shared memory ID */
|
/** return detector shared memory ID */
|
||||||
int getMultiId() const;
|
int getDetectorId() const;
|
||||||
|
|
||||||
/** Free specific shared memory from the command line without creating object */
|
/** Free specific shared memory from the command line without creating object */
|
||||||
static void freeSharedMemory(int multiId, int detPos = -1);
|
static void freeSharedMemory(int detectorId, int detPos = -1);
|
||||||
|
|
||||||
/** Free all modules from current multi Id shared memory and delete members */
|
/** Free all modules from current multi Id shared memory and delete members */
|
||||||
void freeSharedMemory();
|
void freeSharedMemory();
|
||||||
@ -298,7 +298,7 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
* one
|
* one
|
||||||
* @param update true to update last user pid, date etc
|
* @param update true to update last user pid, date etc
|
||||||
*/
|
*/
|
||||||
void setupMultiDetector(bool verify = true, bool update = true);
|
void setupDetector(bool verify = true, bool update = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates shm and initializes shm structure OR
|
* Creates shm and initializes shm structure OR
|
||||||
@ -377,10 +377,10 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
int kbhit();
|
int kbhit();
|
||||||
|
|
||||||
/** Multi detector Id */
|
/** Multi detector Id */
|
||||||
const int multiId{0};
|
const int detectorId{0};
|
||||||
|
|
||||||
/** Shared Memory object */
|
/** Shared Memory object */
|
||||||
sls::SharedMemory<sharedMultiSlsDetector> multi_shm{0, -1};
|
sls::SharedMemory<sharedDetector> detector_shm{0, -1};
|
||||||
|
|
||||||
/** pointers to the Module structures */
|
/** pointers to the Module structures */
|
||||||
std::vector<std::unique_ptr<sls::Module>> detectors;
|
std::vector<std::unique_ptr<sls::Module>> detectors;
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
namespace sls{
|
namespace sls{
|
||||||
|
|
||||||
// create shm
|
// create shm
|
||||||
Module::Module(detectorType type, int multi_id, int det_id,
|
Module::Module(detectorType type, int detector_id, int module_id,
|
||||||
bool verify)
|
bool verify)
|
||||||
: detId(det_id), shm(multi_id, det_id) {
|
: moduleId(module_id), shm(detector_id, module_id) {
|
||||||
|
|
||||||
// ensure shared memory was not created before
|
// ensure shared memory was not created before
|
||||||
if (shm.IsExisting()) {
|
if (shm.IsExisting()) {
|
||||||
@ -37,22 +37,22 @@ Module::Module(detectorType type, int multi_id, int det_id,
|
|||||||
shm.RemoveSharedMemory();
|
shm.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
initSharedMemory(type, multi_id, verify);
|
initSharedMemory(type, detector_id, verify);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pick up from shm
|
// pick up from shm
|
||||||
Module::Module(int multi_id, int det_id, bool verify)
|
Module::Module(int detector_id, int module_id, bool verify)
|
||||||
: detId(det_id), shm(multi_id, det_id) {
|
: moduleId(module_id), shm(detector_id, module_id) {
|
||||||
|
|
||||||
// getDetectorType From shm will check if it was already existing
|
// getDetectorType From shm will check if it was already existing
|
||||||
detectorType type = getDetectorTypeFromShm(multi_id, verify);
|
detectorType type = getDetectorTypeFromShm(detector_id, verify);
|
||||||
initSharedMemory(type, multi_id, verify);
|
initSharedMemory(type, detector_id, verify);
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::~Module() = default;
|
Module::~Module() = default;
|
||||||
|
|
||||||
bool Module::isFixedPatternSharedMemoryCompatible() {
|
bool Module::isFixedPatternSharedMemoryCompatible() {
|
||||||
return (shm()->shmversion >= SLS_SHMAPIVERSION);
|
return (shm()->shmversion >= MODULE_SHMAPIVERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::checkDetectorVersionCompatibility() {
|
void Module::checkDetectorVersionCompatibility() {
|
||||||
@ -363,19 +363,19 @@ void Module::setHostname(const std::string &hostname, const bool initialChecks)
|
|||||||
|
|
||||||
std::string Module::getHostname() const { return shm()->hostname; }
|
std::string Module::getHostname() const { return shm()->hostname; }
|
||||||
|
|
||||||
void Module::initSharedMemory(detectorType type, int multi_id,
|
void Module::initSharedMemory(detectorType type, int detector_id,
|
||||||
bool verify) {
|
bool verify) {
|
||||||
shm = SharedMemory<sharedSlsDetector>(multi_id, detId);
|
shm = SharedMemory<sharedModule>(detector_id, moduleId);
|
||||||
if (!shm.IsExisting()) {
|
if (!shm.IsExisting()) {
|
||||||
shm.CreateSharedMemory();
|
shm.CreateSharedMemory();
|
||||||
initializeDetectorStructure(type);
|
initializeDetectorStructure(type);
|
||||||
} else {
|
} else {
|
||||||
shm.OpenSharedMemory();
|
shm.OpenSharedMemory();
|
||||||
if (verify && shm()->shmversion != SLS_SHMVERSION) {
|
if (verify && shm()->shmversion != MODULE_SHMVERSION) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "Single shared memory (" << multi_id << "-" << detId
|
ss << "Module shared memory (" << detector_id << "-" << moduleId
|
||||||
<< ":) version mismatch (expected 0x" << std::hex
|
<< ":) version mismatch (expected 0x" << std::hex
|
||||||
<< SLS_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
<< MODULE_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
||||||
<< std::dec << ". Clear Shared memory to continue.";
|
<< std::dec << ". Clear Shared memory to continue.";
|
||||||
throw SharedMemoryError(ss.str());
|
throw SharedMemoryError(ss.str());
|
||||||
}
|
}
|
||||||
@ -383,11 +383,11 @@ void Module::initSharedMemory(detectorType type, int multi_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::initializeDetectorStructure(detectorType type) {
|
void Module::initializeDetectorStructure(detectorType type) {
|
||||||
shm()->shmversion = SLS_SHMVERSION;
|
shm()->shmversion = MODULE_SHMVERSION;
|
||||||
memset(shm()->hostname, 0, MAX_STR_LENGTH);
|
memset(shm()->hostname, 0, MAX_STR_LENGTH);
|
||||||
shm()->myDetectorType = type;
|
shm()->myDetectorType = type;
|
||||||
shm()->multiSize.x = 0;
|
shm()->detectorSize.x = 0;
|
||||||
shm()->multiSize.y = 0;
|
shm()->detectorSize.y = 0;
|
||||||
shm()->controlPort = DEFAULT_PORTNO;
|
shm()->controlPort = DEFAULT_PORTNO;
|
||||||
shm()->stopPort = DEFAULT_PORTNO + 1;
|
shm()->stopPort = DEFAULT_PORTNO + 1;
|
||||||
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
|
sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
|
||||||
@ -395,7 +395,7 @@ void Module::initializeDetectorStructure(detectorType type) {
|
|||||||
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
shm()->rxTCPPort = DEFAULT_PORTNO + 2;
|
||||||
shm()->useReceiverFlag = false;
|
shm()->useReceiverFlag = false;
|
||||||
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
|
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
|
||||||
(detId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
(moduleId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
||||||
shm()->zmqip = IpAddr{};
|
shm()->zmqip = IpAddr{};
|
||||||
shm()->numUDPInterfaces = 1;
|
shm()->numUDPInterfaces = 1;
|
||||||
shm()->stoppedFlag = false;
|
shm()->stoppedFlag = false;
|
||||||
@ -489,19 +489,19 @@ int Module::receiveModule(sls_detector_module *myMod,
|
|||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int multi_id,
|
slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int detector_id,
|
||||||
bool verify) {
|
bool verify) {
|
||||||
if (!shm.IsExisting()) {
|
if (!shm.IsExisting()) {
|
||||||
throw SharedMemoryError("Shared memory " + shm.GetName() +
|
throw SharedMemoryError("Shared memory " + shm.GetName() +
|
||||||
"does not exist.\n Corrupted Multi Shared "
|
"does not exist.\n Corrupted Detector Shared "
|
||||||
"memory. Please free shared memory.");
|
"memory. Please free shared memory.");
|
||||||
}
|
}
|
||||||
|
|
||||||
shm.OpenSharedMemory();
|
shm.OpenSharedMemory();
|
||||||
if (verify && shm()->shmversion != SLS_SHMVERSION) {
|
if (verify && shm()->shmversion != MODULE_SHMVERSION) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "Single shared memory (" << multi_id << "-" << detId
|
ss << "Module shared memory (" << detector_id << "-" << moduleId
|
||||||
<< ":)version mismatch (expected 0x" << std::hex << SLS_SHMVERSION
|
<< ":)version mismatch (expected 0x" << std::hex << MODULE_SHMVERSION
|
||||||
<< " but got 0x" << shm()->shmversion << ")" << std::dec
|
<< " but got 0x" << shm()->shmversion << ")" << std::dec
|
||||||
<< ". Clear Shared memory to continue.";
|
<< ". Clear Shared memory to continue.";
|
||||||
shm.UnmapSharedMemory();
|
shm.UnmapSharedMemory();
|
||||||
@ -585,9 +585,9 @@ int Module::getReadNLines() {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::updateMultiSize(slsDetectorDefs::xy det) {
|
void Module::updateDetectorSize(slsDetectorDefs::xy det) {
|
||||||
shm()->multiSize = det;
|
shm()->detectorSize = det;
|
||||||
int args[2] = {shm()->multiSize.y, detId};
|
int args[2] = {shm()->detectorSize.y, moduleId};
|
||||||
sendToDetector(F_SET_POSITION, args, nullptr);
|
sendToDetector(F_SET_POSITION, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,7 +673,7 @@ void Module::execCommand(const std::string &cmd) {
|
|||||||
LOG(logDEBUG1) << "Sending command to detector " << arg;
|
LOG(logDEBUG1) << "Sending command to detector " << arg;
|
||||||
sendToDetector(F_EXEC_COMMAND, arg, retval);
|
sendToDetector(F_EXEC_COMMAND, arg, retval);
|
||||||
if (strlen(retval) != 0U) {
|
if (strlen(retval) != 0U) {
|
||||||
LOG(logINFO) << "Detector " << detId << " returned:\n" << retval;
|
LOG(logINFO) << "Detector " << moduleId << " returned:\n" << retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ std::vector<std::string> Module::getConfigFileCommands() {
|
|||||||
std::vector<std::string> commands;
|
std::vector<std::string> commands;
|
||||||
for (const auto &cmd : base) {
|
for (const auto &cmd : base) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << detId << ':' << cmd;
|
os << moduleId << ':' << cmd;
|
||||||
commands.emplace_back(os.str());
|
commands.emplace_back(os.str());
|
||||||
}
|
}
|
||||||
return commands;
|
return commands;
|
||||||
@ -917,7 +917,7 @@ void Module::loadSettingsFile(const std::string &fname) {
|
|||||||
std::ostringstream ostfn;
|
std::ostringstream ostfn;
|
||||||
ostfn << fname;
|
ostfn << fname;
|
||||||
|
|
||||||
// find specific file if it has detid in file name (.snxxx)
|
// find specific file if it has moduleId in file name (.snxxx)
|
||||||
if (shm()->myDetectorType == EIGER) {
|
if (shm()->myDetectorType == EIGER) {
|
||||||
if (fname.find(".sn") == std::string::npos &&
|
if (fname.find(".sn") == std::string::npos &&
|
||||||
fname.find(".trim") == std::string::npos &&
|
fname.find(".trim") == std::string::npos &&
|
||||||
@ -936,7 +936,7 @@ void Module::saveSettingsFile(const std::string &fname) {
|
|||||||
std::ostringstream ostfn;
|
std::ostringstream ostfn;
|
||||||
ostfn << fname;
|
ostfn << fname;
|
||||||
|
|
||||||
// find specific file if it has detid in file name (.snxxx)
|
// find specific file if it has moduleId in file name (.snxxx)
|
||||||
if (shm()->myDetectorType == EIGER) {
|
if (shm()->myDetectorType == EIGER) {
|
||||||
ostfn << ".sn" << std::setfill('0') << std::setw(3) << std::dec
|
ostfn << ".sn" << std::setfill('0') << std::setw(3) << std::dec
|
||||||
<< getSerialNumber();
|
<< getSerialNumber();
|
||||||
@ -1521,17 +1521,17 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
|||||||
|
|
||||||
// populate from shared memory
|
// populate from shared memory
|
||||||
retval.detType = shm()->myDetectorType;
|
retval.detType = shm()->myDetectorType;
|
||||||
retval.multiSize.x = shm()->multiSize.x;
|
retval.detectorSize.x = shm()->detectorSize.x;
|
||||||
retval.multiSize.y = shm()->multiSize.y;
|
retval.detectorSize.y = shm()->detectorSize.y;
|
||||||
retval.detId = detId;
|
retval.moduleId = moduleId;
|
||||||
memset(retval.hostname, 0, sizeof(retval.hostname));
|
memset(retval.hostname, 0, sizeof(retval.hostname));
|
||||||
strcpy_safe(retval.hostname, shm()->hostname);
|
strcpy_safe(retval.hostname, shm()->hostname);
|
||||||
|
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1)
|
||||||
<< "detType:" << retval.detType << std::endl
|
<< "detType:" << retval.detType << std::endl
|
||||||
<< "multiSize.x:" << retval.multiSize.x << std::endl
|
<< "detectorSize.x:" << retval.detectorSize.x << std::endl
|
||||||
<< "multiSize.y:" << retval.multiSize.y << std::endl
|
<< "detectorSize.y:" << retval.detectorSize.y << std::endl
|
||||||
<< "detId:" << retval.detId << std::endl
|
<< "moduleId:" << retval.moduleId << std::endl
|
||||||
<< "hostname:" << retval.hostname << std::endl
|
<< "hostname:" << retval.hostname << std::endl
|
||||||
<< "udpInterfaces:" << retval.udpInterfaces << std::endl
|
<< "udpInterfaces:" << retval.udpInterfaces << std::endl
|
||||||
<< "udp_dstport:" << retval.udp_dstport << std::endl
|
<< "udp_dstport:" << retval.udp_dstport << std::endl
|
||||||
@ -1568,12 +1568,12 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
|||||||
// update detectors with dest mac
|
// update detectors with dest mac
|
||||||
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||||
LOG(logINFO) << "Setting destination udp mac of "
|
LOG(logINFO) << "Setting destination udp mac of "
|
||||||
"detector " << detId << " to " << retvals[0];
|
"detector " << moduleId << " to " << retvals[0];
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
||||||
}
|
}
|
||||||
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
||||||
LOG(logINFO) << "Setting destination udp mac2 of "
|
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||||
"detector " << detId << " to " << retvals[1];
|
"detector " << moduleId << " to " << retvals[1];
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1668,7 +1668,7 @@ void Module::setDestinationUDPIP(const IpAddr ip) {
|
|||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
sls::MacAddr retval(0LU);
|
sls::MacAddr retval(0LU);
|
||||||
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
|
sendToReceiver(F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||||
LOG(logINFO) << "Setting destination udp mac of detector " << detId << " to " << retval;
|
LOG(logINFO) << "Setting destination udp mac of detector " << moduleId << " to " << retval;
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC, retval, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1691,7 +1691,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip) {
|
|||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
sls::MacAddr retval(0LU);
|
sls::MacAddr retval(0LU);
|
||||||
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
|
sendToReceiver(F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||||
LOG(logINFO) << "Setting destination udp mac2 of detector " << detId << " to " << retval;
|
LOG(logINFO) << "Setting destination udp mac2 of detector " << moduleId << " to " << retval;
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1865,7 +1865,7 @@ void Module::updateReceiverStreamingIP() {
|
|||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = HostnameToIp(shm()->rxHostname);
|
ip = HostnameToIp(shm()->rxHostname);
|
||||||
}
|
}
|
||||||
LOG(logINFO) << "Setting default receiver " << detId << " streaming zmq ip to " << ip;
|
LOG(logINFO) << "Setting default receiver " << moduleId << " streaming zmq ip to " << ip;
|
||||||
}
|
}
|
||||||
setReceiverStreamingIP(ip);
|
setReceiverStreamingIP(ip);
|
||||||
}
|
}
|
||||||
@ -1953,7 +1953,7 @@ void Module::setAdditionalJsonHeader(const std::map<std::string, std::string> &j
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Receiver " + std::to_string(detId) +
|
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1971,7 +1971,7 @@ std::map<std::string, std::string> Module::getAdditionalJsonHeader() {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Receiver " + std::to_string(detId) +
|
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
} else {
|
} else {
|
||||||
client.Receive(&size, sizeof(size));
|
client.Receive(&size, sizeof(size));
|
||||||
@ -2079,7 +2079,7 @@ std::vector<int> Module::getVetoPhoton(const int chipIndex) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
} else {
|
} else {
|
||||||
int nch = -1;
|
int nch = -1;
|
||||||
@ -2174,7 +2174,7 @@ void Module::setVetoPhoton(const int chipIndex, const int numPhotons, const int
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2573,7 +2573,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
|||||||
int fnum = F_PROGRAM_FPGA;
|
int fnum = F_PROGRAM_FPGA;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
char mess[MAX_STR_LENGTH] = {0};
|
char mess[MAX_STR_LENGTH] = {0};
|
||||||
LOG(logINFO) << "Sending programming binary (from pof) to detector " << detId
|
LOG(logINFO) << "Sending programming binary (from pof) to detector " << moduleId
|
||||||
<< " (" << shm()->hostname << ")";
|
<< " (" << shm()->hostname << ")";
|
||||||
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
@ -2584,13 +2584,13 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
client.Receive(mess, sizeof(mess));
|
client.Receive(mess, sizeof(mess));
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Detector " << detId << " (" << shm()->hostname << ")"
|
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||||
<< " returned error: " << mess;
|
<< " returned error: " << mess;
|
||||||
throw RuntimeError(os.str());
|
throw RuntimeError(os.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// erasing flash
|
// erasing flash
|
||||||
LOG(logINFO) << "Erasing Flash for detector " << detId << " ("
|
LOG(logINFO) << "Erasing Flash for detector " << moduleId << " ("
|
||||||
<< shm()->hostname << ")";
|
<< shm()->hostname << ")";
|
||||||
printf("%d%%\r", 0);
|
printf("%d%%\r", 0);
|
||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
@ -2608,7 +2608,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
|||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
LOG(logINFO) << "Writing to Flash to detector " << detId << " ("
|
LOG(logINFO) << "Writing to Flash to detector " << moduleId << " ("
|
||||||
<< shm()->hostname << ")";
|
<< shm()->hostname << ")";
|
||||||
printf("%d%%\r", 0);
|
printf("%d%%\r", 0);
|
||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
@ -2632,7 +2632,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
client.Receive(mess, sizeof(mess));
|
client.Receive(mess, sizeof(mess));
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Detector " << detId << " (" << shm()->hostname << ")"
|
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||||
<< " returned error: " << mess;
|
<< " returned error: " << mess;
|
||||||
throw RuntimeError(os.str());
|
throw RuntimeError(os.str());
|
||||||
}
|
}
|
||||||
@ -2656,7 +2656,7 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
|||||||
int fnum = F_PROGRAM_FPGA;
|
int fnum = F_PROGRAM_FPGA;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
char mess[MAX_STR_LENGTH] = {0};
|
char mess[MAX_STR_LENGTH] = {0};
|
||||||
LOG(logINFO) << "Sending programming binary (from rbf) to detector " << detId
|
LOG(logINFO) << "Sending programming binary (from rbf) to detector " << moduleId
|
||||||
<< " (" << shm()->hostname << ")";
|
<< " (" << shm()->hostname << ")";
|
||||||
|
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
@ -2667,7 +2667,7 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
client.Receive(mess, sizeof(mess));
|
client.Receive(mess, sizeof(mess));
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Detector " << detId << " (" << shm()->hostname << ")"
|
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||||
<< " returned error: " << mess;
|
<< " returned error: " << mess;
|
||||||
throw RuntimeError(os.str());
|
throw RuntimeError(os.str());
|
||||||
}
|
}
|
||||||
@ -2677,7 +2677,7 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
client.Receive(mess, sizeof(mess));
|
client.Receive(mess, sizeof(mess));
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Detector " << detId << " (" << shm()->hostname << ")"
|
os << "Detector " << moduleId << " (" << shm()->hostname << ")"
|
||||||
<< " returned error: " << mess;
|
<< " returned error: " << mess;
|
||||||
throw RuntimeError(os.str());
|
throw RuntimeError(os.str());
|
||||||
}
|
}
|
||||||
@ -2739,7 +2739,7 @@ void Module::setModule(sls_detector_module &module, int tb) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH] = {0};
|
char mess[MAX_STR_LENGTH] = {0};
|
||||||
client.Receive(mess, sizeof(mess));
|
client.Receive(mess, sizeof(mess));
|
||||||
throw RuntimeError("Detector " + std::to_string(detId) +
|
throw RuntimeError("Detector " + std::to_string(moduleId) +
|
||||||
" returned error: " + mess);
|
" returned error: " + mess);
|
||||||
}
|
}
|
||||||
client.Receive(&retval, sizeof(retval));
|
client.Receive(&retval, sizeof(retval));
|
||||||
@ -2781,7 +2781,7 @@ void Module::updateRateCorrection() {
|
|||||||
|
|
||||||
std::string Module::printReceiverConfiguration() {
|
std::string Module::printReceiverConfiguration() {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "\n\nDetector " << detId << "\nReceiver Hostname:\t"
|
os << "\n\nDetector " << moduleId << "\nReceiver Hostname:\t"
|
||||||
<< getReceiverHostname();
|
<< getReceiverHostname();
|
||||||
|
|
||||||
if (shm()->myDetectorType == JUNGFRAU) {
|
if (shm()->myDetectorType == JUNGFRAU) {
|
||||||
@ -2844,7 +2844,7 @@ void Module::execReceiverCommand(const std::string &cmd) {
|
|||||||
LOG(logDEBUG1) << "Sending command to receiver: " << arg;
|
LOG(logDEBUG1) << "Sending command to receiver: " << arg;
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
sendToReceiver(F_EXEC_RECEIVER_COMMAND, arg, retval);
|
sendToReceiver(F_EXEC_RECEIVER_COMMAND, arg, retval);
|
||||||
LOG(logINFO) << "Receiver " << detId << " returned:\n" << retval;
|
LOG(logINFO) << "Receiver " << moduleId << " returned:\n" << retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3019,7 +3019,7 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
char mess[MAX_STR_LENGTH]{};
|
char mess[MAX_STR_LENGTH]{};
|
||||||
client.Receive(mess, MAX_STR_LENGTH);
|
client.Receive(mess, MAX_STR_LENGTH);
|
||||||
throw RuntimeError("Receiver " + std::to_string(detId) +
|
throw RuntimeError("Receiver " + std::to_string(moduleId) +
|
||||||
" returned error: " + std::string(mess));
|
" returned error: " + std::string(mess));
|
||||||
} else {
|
} else {
|
||||||
int nports = -1;
|
int nports = -1;
|
||||||
@ -3028,7 +3028,7 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
|||||||
memset(mp, 0, sizeof(mp));
|
memset(mp, 0, sizeof(mp));
|
||||||
client.Receive(mp, sizeof(mp));
|
client.Receive(mp, sizeof(mp));
|
||||||
std::vector<uint64_t> retval(mp, mp + nports);
|
std::vector<uint64_t> retval(mp, mp + nports);
|
||||||
LOG(logDEBUG1) << "Missing packets of Receiver" << detId << ": " << sls::ToString(retval);
|
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleId << ": " << sls::ToString(retval);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
|
|
||||||
class ServerInterface;
|
class ServerInterface;
|
||||||
|
|
||||||
#define SLS_SHMAPIVERSION 0x190726
|
#define MODULE_SHMAPIVERSION 0x190726
|
||||||
#define SLS_SHMVERSION 0x200402
|
#define MODULE_SHMVERSION 0x200402
|
||||||
|
|
||||||
namespace sls{
|
namespace sls{
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ namespace sls{
|
|||||||
* @short structure allocated in shared memory to store detector settings for
|
* @short structure allocated in shared memory to store detector settings for
|
||||||
* IPC and cache
|
* IPC and cache
|
||||||
*/
|
*/
|
||||||
struct sharedSlsDetector {
|
struct sharedModule {
|
||||||
|
|
||||||
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/
|
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ struct sharedSlsDetector {
|
|||||||
/** END OF FIXED PATTERN -----------------------------------------------*/
|
/** END OF FIXED PATTERN -----------------------------------------------*/
|
||||||
|
|
||||||
/** Number of detectors in multi list in x dir and y dir */
|
/** Number of detectors in multi list in x dir and y dir */
|
||||||
slsDetectorDefs::xy multiSize;
|
slsDetectorDefs::xy detectorSize;
|
||||||
|
|
||||||
/** is the port used for control functions */
|
/** is the port used for control functions */
|
||||||
int controlPort;
|
int controlPort;
|
||||||
@ -90,22 +90,22 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
/**
|
/**
|
||||||
* Constructor called when creating new shared memory
|
* Constructor called when creating new shared memory
|
||||||
* @param type detector type
|
* @param type detector type
|
||||||
* @param multi_id multi detector shared memory id
|
* @param detector_id multi detector shared memory id
|
||||||
* @param id sls detector id (position in detectors list)
|
* @param module_id module id (position in detectors list)
|
||||||
* @param verify true to verify if shared memory version matches existing
|
* @param verify true to verify if shared memory version matches existing
|
||||||
* one
|
* one
|
||||||
*/
|
*/
|
||||||
explicit Module(detectorType type, int multi_id = 0, int det_id = 0,
|
explicit Module(detectorType type, int detector_id = 0, int module_id = 0,
|
||||||
bool verify = true);
|
bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor called when opening existing shared memory
|
* Constructor called when opening existing shared memory
|
||||||
* @param multi_id multi detector shared memory id
|
* @param detector_id multi detector shared memory id
|
||||||
* @param id sls detector id (position in detectors list)
|
* @param module_id module id (position in detectors list)
|
||||||
* @param verify true to verify if shared memory version matches existing
|
* @param verify true to verify if shared memory version matches existing
|
||||||
* one
|
* one
|
||||||
*/
|
*/
|
||||||
explicit Module(int multi_id = 0, int det_id = 0, bool verify = true);
|
explicit Module(int detector_id = 0, int module_id = 0, bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@ -141,7 +141,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Free shared memory and delete shared memory structure
|
* Free shared memory and delete shared memory structure
|
||||||
* occupied by the sharedSlsDetector structure
|
* occupied by the sharedModule structure
|
||||||
* Is only safe to call if one deletes the Module object afterward
|
* Is only safe to call if one deletes the Module object afterward
|
||||||
* and frees multi shared memory/updates
|
* and frees multi shared memory/updates
|
||||||
* thisMultiDetector->numberOfDetectors
|
* thisMultiDetector->numberOfDetectors
|
||||||
@ -213,12 +213,12 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
* Set Detector offset in shared memory in dimension d
|
* Set Detector offset in shared memory in dimension d
|
||||||
* @param det detector size
|
* @param det detector size
|
||||||
*/
|
*/
|
||||||
void updateMultiSize(slsDetectorDefs::xy det);
|
void updateDetectorSize(slsDetectorDefs::xy det);
|
||||||
|
|
||||||
int setControlPort(int port_number);
|
int setControlPort(int port_number);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the detector TCP control port \sa sharedSlsDetector
|
* Returns the detector TCP control port
|
||||||
* @returns the detector TCP control port
|
* @returns the detector TCP control port
|
||||||
*/
|
*/
|
||||||
int getControlPort() const;
|
int getControlPort() const;
|
||||||
@ -226,7 +226,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int setStopPort(int port_number);
|
int setStopPort(int port_number);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the detector TCP stop port \sa sharedSlsDetector
|
* Returns the detector TCP stop port
|
||||||
* @returns the detector TCP stop port
|
* @returns the detector TCP stop port
|
||||||
*/
|
*/
|
||||||
int getStopPort() const;
|
int getStopPort() const;
|
||||||
@ -234,7 +234,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int setReceiverPort(int port_number);
|
int setReceiverPort(int port_number);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver TCP port \sa sharedSlsDetector
|
* Returns the receiver TCP port
|
||||||
* @returns the receiver TCP port
|
* @returns the receiver TCP port
|
||||||
*/
|
*/
|
||||||
int getReceiverPort() const;
|
int getReceiverPort() const;
|
||||||
@ -306,13 +306,13 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int tb = 1);
|
int tb = 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the detector trimbit/settings directory \sa sharedSlsDetector
|
* Returns the detector trimbit/settings directory
|
||||||
* @returns the trimbit/settings directory
|
* @returns the trimbit/settings directory
|
||||||
*/
|
*/
|
||||||
std::string getSettingsDir();
|
std::string getSettingsDir();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the detector trimbit/settings directory \sa sharedSlsDetector
|
* Sets the detector trimbit/settings directory
|
||||||
* @param s trimbits/settings directory
|
* @param s trimbits/settings directory
|
||||||
* @returns the trimbit/settings directory
|
* @returns the trimbit/settings directory
|
||||||
*/
|
*/
|
||||||
@ -645,7 +645,7 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
void test();
|
void test();
|
||||||
/**
|
/**
|
||||||
* Returns the receiver IP address\sa sharedSlsDetector
|
* Returns the receiver IP address
|
||||||
* @returns the receiver IP address
|
* @returns the receiver IP address
|
||||||
*/
|
*/
|
||||||
std::string getReceiverHostname() const;
|
std::string getReceiverHostname() const;
|
||||||
@ -755,26 +755,26 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
sls::MacAddr getDestinationUDPMAC2();
|
sls::MacAddr getDestinationUDPMAC2();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver UDP port\sa sharedSlsDetector
|
* Sets the receiver UDP port
|
||||||
* @param udpport receiver UDP port
|
* @param udpport receiver UDP port
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPPort(int udpport);
|
void setDestinationUDPPort(int udpport);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver UDP port\sa sharedSlsDetector
|
* Returns the receiver UDP port
|
||||||
* @returns the receiver UDP port
|
* @returns the receiver UDP port
|
||||||
*/
|
*/
|
||||||
int getDestinationUDPPort();
|
int getDestinationUDPPort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver UDP port 2\sa sharedSlsDetector (Eiger and Jungfrau
|
* Sets the receiver UDP port 2 (Eiger and Jungfrau
|
||||||
* only)
|
* only)
|
||||||
* @param udpport receiver UDP port 2
|
* @param udpport receiver UDP port 2
|
||||||
*/
|
*/
|
||||||
void setDestinationUDPPort2(int udpport);
|
void setDestinationUDPPort2(int udpport);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver UDP port 2 of same interface\sa sharedSlsDetector
|
* Returns the receiver UDP port 2 of same interface
|
||||||
* (Eiger and Jungfrau only)
|
* (Eiger and Jungfrau only)
|
||||||
* @returns the receiver UDP port 2 of same interface
|
* @returns the receiver UDP port 2 of same interface
|
||||||
*/
|
*/
|
||||||
@ -814,49 +814,49 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int getSelectedUDPInterface();
|
int getSelectedUDPInterface();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the client zmq port\sa sharedSlsDetector
|
* Sets the client zmq port
|
||||||
* @param port client zmq port
|
* @param port client zmq port
|
||||||
*/
|
*/
|
||||||
void setClientStreamingPort(int port);
|
void setClientStreamingPort(int port);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client zmq port \sa sharedSlsDetector
|
* Returns the client zmq port
|
||||||
* @returns the client zmq port
|
* @returns the client zmq port
|
||||||
*/
|
*/
|
||||||
int getClientStreamingPort();
|
int getClientStreamingPort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver zmq port\sa sharedSlsDetector
|
* Sets the receiver zmq port
|
||||||
* @param port receiver zmq port
|
* @param port receiver zmq port
|
||||||
*/
|
*/
|
||||||
void setReceiverStreamingPort(int port);
|
void setReceiverStreamingPort(int port);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver zmq port \sa sharedSlsDetector
|
* Returns the receiver zmq port
|
||||||
* @returns the receiver zmq port
|
* @returns the receiver zmq port
|
||||||
*/
|
*/
|
||||||
int getReceiverStreamingPort();
|
int getReceiverStreamingPort();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the client zmq ip\sa sharedSlsDetector
|
* Sets the client zmq ip
|
||||||
* @param ip client zmq ip
|
* @param ip client zmq ip
|
||||||
*/
|
*/
|
||||||
void setClientStreamingIP(const sls::IpAddr ip);
|
void setClientStreamingIP(const sls::IpAddr ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the client zmq ip \sa sharedSlsDetector
|
* Returns the client zmq ip
|
||||||
* @returns the client zmq ip
|
* @returns the client zmq ip
|
||||||
*/
|
*/
|
||||||
sls::IpAddr getClientStreamingIP();
|
sls::IpAddr getClientStreamingIP();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the receiver zmq ip\sa sharedSlsDetector
|
* Sets the receiver zmq ip
|
||||||
* @param ip receiver zmq ip
|
* @param ip receiver zmq ip
|
||||||
*/
|
*/
|
||||||
void setReceiverStreamingIP(const sls::IpAddr ip);
|
void setReceiverStreamingIP(const sls::IpAddr ip);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver zmq ip \sa sharedSlsDetector
|
* Returns the receiver zmq ip
|
||||||
* @returns the receiver zmq ip
|
* @returns the receiver zmq ip
|
||||||
*/
|
*/
|
||||||
sls::IpAddr getReceiverStreamingIP();
|
sls::IpAddr getReceiverStreamingIP();
|
||||||
@ -921,13 +921,13 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
int64_t setReceiverUDPSocketBufferSize(int64_t udpsockbufsize = -1);
|
int64_t setReceiverUDPSocketBufferSize(int64_t udpsockbufsize = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver UDP socket buffer size\sa sharedSlsDetector
|
* Returns the receiver UDP socket buffer size
|
||||||
* @returns the receiver UDP socket buffer size
|
* @returns the receiver UDP socket buffer size
|
||||||
*/
|
*/
|
||||||
int64_t getReceiverUDPSocketBufferSize();
|
int64_t getReceiverUDPSocketBufferSize();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the receiver real UDP socket buffer size\sa sharedSlsDetector
|
* Returns the receiver real UDP socket buffer size
|
||||||
* @returns the receiver real UDP socket buffer size
|
* @returns the receiver real UDP socket buffer size
|
||||||
*/
|
*/
|
||||||
int64_t getReceiverRealUDPSocketBufferSize() const;
|
int64_t getReceiverRealUDPSocketBufferSize() const;
|
||||||
@ -1129,7 +1129,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the number of trim energies and their value (Eiger)
|
* Sets the number of trim energies and their value (Eiger)
|
||||||
* \sa sharedSlsDetector
|
|
||||||
* @param nen number of energies
|
* @param nen number of energies
|
||||||
* @param vector os trimmed energies
|
* @param vector os trimmed energies
|
||||||
* @returns number of trim energies
|
* @returns number of trim energies
|
||||||
@ -1138,7 +1137,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a vector with the trimmed energies (Eiger)
|
* Returns a vector with the trimmed energies (Eiger)
|
||||||
* \sa sharedSlsDetector
|
|
||||||
* @returns vector with the trimmed energies
|
* @returns vector with the trimmed energies
|
||||||
*/
|
*/
|
||||||
std::vector<int> getTrimEn();
|
std::vector<int> getTrimEn();
|
||||||
@ -1676,21 +1674,21 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Detector Type from Shared Memory (opening shm without verifying size)
|
* Get Detector Type from Shared Memory (opening shm without verifying size)
|
||||||
* @param multi_id multi detector Id
|
* @param detector_id multi detector Id
|
||||||
* @param verify true to verify if shm size matches existing one
|
* @param verify true to verify if shm size matches existing one
|
||||||
* @returns detector type
|
* @returns detector type
|
||||||
*/
|
*/
|
||||||
detectorType getDetectorTypeFromShm(int multi_id, bool verify = true);
|
detectorType getDetectorTypeFromShm(int detector_id, bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize shared memory
|
* Initialize shared memory
|
||||||
* @param created true if shared memory must be created, else false to open
|
* @param created true if shared memory must be created, else false to open
|
||||||
* @param type type of detector
|
* @param type type of detector
|
||||||
* @param multi_id multi detector Id
|
* @param detector_id multi detector Id
|
||||||
* @param verify true to verify if shm size matches existing one
|
* @param verify true to verify if shm size matches existing one
|
||||||
* @returns true if the shared memory was created now
|
* @returns true if the shared memory was created now
|
||||||
*/
|
*/
|
||||||
void initSharedMemory(detectorType type, int multi_id, bool verify = true);
|
void initSharedMemory(detectorType type, int detector_id, bool verify = true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize detector structure to defaults
|
* Initialize detector structure to defaults
|
||||||
@ -1773,10 +1771,10 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
std::vector<std::string> getSettingsFileDacNames();
|
std::vector<std::string> getSettingsFileDacNames();
|
||||||
|
|
||||||
/** Module Id or position in the detectors list */
|
/** Module Id or position in the detectors list */
|
||||||
const int detId;
|
const int moduleId;
|
||||||
|
|
||||||
/** Shared Memory object */
|
/** Shared Memory object */
|
||||||
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
|
mutable sls::SharedMemory<sharedModule> shm{0, 0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}// sls
|
}// sls
|
84
slsDetectorSoftware/src/Receiver.cpp
Executable file
84
slsDetectorSoftware/src/Receiver.cpp
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#include "Receiver.h"
|
||||||
|
#include "string_utils.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
size_t Receiver::NUM_RECEIVERS{0};
|
||||||
|
|
||||||
|
size_t Receiver::getNumReceivers() {
|
||||||
|
return NUM_RECEIVERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// create shm
|
||||||
|
Receiver::Receiver(int detector_id, int module_id, int receiver_id,
|
||||||
|
int tcp_port, std::string hostname)
|
||||||
|
: receiverId(receiver_id), shm(detector_id, module_id, receiver_id) {
|
||||||
|
|
||||||
|
// ensure shared memory was not created before
|
||||||
|
if (shm.IsExisting()) {
|
||||||
|
LOG(logWARNING) << "This shared memory should have been "
|
||||||
|
"deleted before! "
|
||||||
|
<< shm.GetName() << ". Freeing it again";
|
||||||
|
shm.RemoveSharedMemory();
|
||||||
|
}
|
||||||
|
shm = SharedMemory<sharedReceiver>(detector_id, module_id, receiver_id);
|
||||||
|
++NUM_RECEIVERS;
|
||||||
|
|
||||||
|
// initalize receiver structure
|
||||||
|
shm()->shmversion = RECEIVER_SHMVERSION;
|
||||||
|
memset(shm()->hostname, 0, MAX_STR_LENGTH);
|
||||||
|
shm()->tcpPort = DEFAULT_RX_PORTNO + NUM_RECEIVERS - 1;
|
||||||
|
shm()->zmqPort = DEFAULT_ZMQ_RX_PORTNO + NUM_RECEIVERS - 1;
|
||||||
|
shm()->zmqIp = IpAddr{};
|
||||||
|
|
||||||
|
// copy port, hostname if given
|
||||||
|
if (tcp_port != 0) {
|
||||||
|
shm()->tcpPort = tcp_port;
|
||||||
|
}
|
||||||
|
if (!hostname.empty()) {
|
||||||
|
setHostname(hostname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// open shm
|
||||||
|
Receiver::Receiver(int detector_id, int module_id, int receiver_id,
|
||||||
|
bool verify)
|
||||||
|
: receiverId(receiver_id), shm(detector_id, module_id, receiver_id) {
|
||||||
|
shm.OpenSharedMemory();
|
||||||
|
if (verify && shm()->shmversion != RECEIVER_SHMVERSION) {
|
||||||
|
std::ostringstream ss;
|
||||||
|
ss << "Receiver shared memory (" << detector_id << "-" << receiverId
|
||||||
|
<< ":) version mismatch (expected 0x" << std::hex
|
||||||
|
<< RECEIVER_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
||||||
|
<< std::dec << ". Clear Shared memory to continue.";
|
||||||
|
throw SharedMemoryError(ss.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Receiver::~Receiver() {
|
||||||
|
--NUM_RECEIVERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::setHostname(const std::string &ip_port) {
|
||||||
|
if (ip_port.empty()) {
|
||||||
|
throw RuntimeError("Invalid receiver hostname. Cannot be empty.");
|
||||||
|
}
|
||||||
|
// parse tcp port from this hostname:port string
|
||||||
|
std::string host = ip_port;
|
||||||
|
auto res = sls::split(host, ':');
|
||||||
|
if (res.size() > 1) {
|
||||||
|
host = res[0];
|
||||||
|
shm()->tcpPort = std::stoi(res[1]);
|
||||||
|
}
|
||||||
|
sls::strcpy_safe(shm()->hostname, host.c_str());
|
||||||
|
|
||||||
|
updateReceiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Receiver::updateReceiver() {
|
||||||
|
//checkReceiverVersionCompatibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace sls
|
46
slsDetectorSoftware/src/Receiver.h
Executable file
46
slsDetectorSoftware/src/Receiver.h
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "SharedMemory.h"
|
||||||
|
#include "logger.h"
|
||||||
|
#include "sls_detector_defs.h"
|
||||||
|
#include "network_utils.h"
|
||||||
|
|
||||||
|
#define RECEIVER_SHMVERSION 0x200414
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
struct sharedReceiver {
|
||||||
|
|
||||||
|
/* FIXED PATTERN FOR STATIC FUNCTIONS. DO NOT CHANGE, ONLY APPEND ------*/
|
||||||
|
|
||||||
|
int shmversion;
|
||||||
|
char hostname[MAX_STR_LENGTH];
|
||||||
|
int tcpPort;
|
||||||
|
|
||||||
|
/** END OF FIXED PATTERN -----------------------------------------------*/
|
||||||
|
|
||||||
|
int zmqPort;
|
||||||
|
sls::IpAddr zmqIp;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class Receiver : public virtual slsDetectorDefs {
|
||||||
|
public:
|
||||||
|
static size_t getNumReceivers();
|
||||||
|
// create shm
|
||||||
|
explicit Receiver(int detector_id, int module_id, int receiver_id,
|
||||||
|
int tcp_port = 0, std::string hostname = "");
|
||||||
|
// open shm
|
||||||
|
explicit Receiver(int detector_id, int module_id, int receiver_id,
|
||||||
|
bool verify);
|
||||||
|
|
||||||
|
virtual ~Receiver();
|
||||||
|
|
||||||
|
void setHostname(const std::string &ip_port);
|
||||||
|
void updateReceiver();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static size_t NUM_RECEIVERS;
|
||||||
|
const int receiverId{0};
|
||||||
|
mutable sls::SharedMemory<sharedReceiver> shm{0, 0, 0};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // sls
|
@ -23,7 +23,8 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define SHM_MULTI_PREFIX "/slsDetectorPackage_multi_"
|
#define SHM_MULTI_PREFIX "/slsDetectorPackage_multi_"
|
||||||
#define SHM_SLS_PREFIX "_sls_"
|
#define SHM_MODULE_PREFIX "_module_"
|
||||||
|
#define SHM_RECEIVER_PREFIX "_receiver_"
|
||||||
#define SHM_ENV_NAME "SLSDETNAME"
|
#define SHM_ENV_NAME "SLSDETNAME"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -39,10 +40,11 @@ class SharedMemory {
|
|||||||
* Constructor
|
* Constructor
|
||||||
* creates the single/multi detector shared memory name
|
* creates the single/multi detector shared memory name
|
||||||
* @param multiId multi detector id
|
* @param multiId multi detector id
|
||||||
* @param slsId sls detector id, -1 if a multi detector shared memory
|
* @param moduleId module detector id, -1 if a multi detector shared memory
|
||||||
|
* @param receiverId receiver id, -1 if a multi detector or module shared memory
|
||||||
*/
|
*/
|
||||||
SharedMemory(int multiId, int slsId) {
|
SharedMemory(int multiId, int moduleId, int receiverId = -1) {
|
||||||
name = ConstructSharedMemoryName(multiId, slsId);
|
name = ConstructSharedMemoryName(multiId, moduleId, receiverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -215,10 +217,11 @@ class SharedMemory {
|
|||||||
* Create Shared memory name
|
* Create Shared memory name
|
||||||
* throws exception if name created is longer than required 255(manpages)
|
* throws exception if name created is longer than required 255(manpages)
|
||||||
* @param multiId multi detector id
|
* @param multiId multi detector id
|
||||||
* @param slsId sls detector id, -1 if a multi detector shared memory
|
* @param moduleId module detector id, -1 if a multi detector shared memory
|
||||||
|
* @param receiverId receiver id, -1 if a multi detector or module shared memory
|
||||||
* @returns shared memory name
|
* @returns shared memory name
|
||||||
*/
|
*/
|
||||||
std::string ConstructSharedMemoryName(int multiId, int slsId) {
|
std::string ConstructSharedMemoryName(int multiId, int moduleId, int receiverId) {
|
||||||
|
|
||||||
// using environment path
|
// using environment path
|
||||||
std::string sEnvPath = "";
|
std::string sEnvPath = "";
|
||||||
@ -229,14 +232,20 @@ class SharedMemory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
if (slsId < 0)
|
if (moduleId < 0)
|
||||||
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
ss << SHM_MULTI_PREFIX << multiId << sEnvPath;
|
||||||
|
else if (receiverId < 0)
|
||||||
|
ss << SHM_MULTI_PREFIX << multiId << SHM_MODULE_PREFIX << moduleId << sEnvPath;
|
||||||
else
|
else
|
||||||
ss << SHM_MULTI_PREFIX << multiId << SHM_SLS_PREFIX << slsId << sEnvPath;
|
ss << SHM_MULTI_PREFIX << multiId << SHM_MODULE_PREFIX << moduleId <<
|
||||||
|
SHM_RECEIVER_PREFIX << receiverId << sEnvPath;
|
||||||
|
|
||||||
std::string temp = ss.str();
|
std::string temp = ss.str();
|
||||||
if (temp.length() > NAME_MAX_LENGTH) {
|
if (temp.length() > NAME_MAX_LENGTH) {
|
||||||
std::string msg = "Shared memory initialization failed. " + temp + " has " + std::to_string(temp.length()) + " characters. \n" + "Maximum is " + std::to_string(NAME_MAX_LENGTH) + ". Change the environment variable " + SHM_ENV_NAME;
|
std::string msg = "Shared memory initialization failed. " +
|
||||||
|
temp + " has " + std::to_string(temp.length()) + " characters. \n" +
|
||||||
|
"Maximum is " + std::to_string(NAME_MAX_LENGTH) +
|
||||||
|
". Change the environment variable " + SHM_ENV_NAME;
|
||||||
LOG(logERROR) << msg;
|
LOG(logERROR) << msg;
|
||||||
throw SharedMemoryError(msg);
|
throw SharedMemoryError(msg);
|
||||||
}
|
}
|
||||||
|
@ -337,9 +337,9 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
|||||||
auto arg = socket.Receive<rxParameters>();
|
auto arg = socket.Receive<rxParameters>();
|
||||||
LOG(logDEBUG1)
|
LOG(logDEBUG1)
|
||||||
<< "detType:" << arg.detType << std::endl
|
<< "detType:" << arg.detType << std::endl
|
||||||
<< "multiSize.x:" << arg.multiSize.x << std::endl
|
<< "detectorSize.x:" << arg.detectorSize.x << std::endl
|
||||||
<< "multiSize.y:" << arg.multiSize.y << std::endl
|
<< "detectorSize.y:" << arg.detectorSize.y << std::endl
|
||||||
<< "detId:" << arg.detId << std::endl
|
<< "moduleId:" << arg.moduleId << std::endl
|
||||||
<< "hostname:" << arg.hostname << std::endl
|
<< "hostname:" << arg.hostname << std::endl
|
||||||
<< "udpInterfaces:" << arg.udpInterfaces << std::endl
|
<< "udpInterfaces:" << arg.udpInterfaces << std::endl
|
||||||
<< "udp_dstport:" << arg.udp_dstport << std::endl
|
<< "udp_dstport:" << arg.udp_dstport << std::endl
|
||||||
@ -380,10 +380,10 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
|||||||
// basic setup
|
// basic setup
|
||||||
setDetectorType(arg.detType);
|
setDetectorType(arg.detType);
|
||||||
{
|
{
|
||||||
int msize[2] = {arg.multiSize.x, arg.multiSize.y};
|
int msize[2] = {arg.detectorSize.x, arg.detectorSize.y};
|
||||||
impl()->setMultiDetectorSize(msize);
|
impl()->setDetectorSize(msize);
|
||||||
}
|
}
|
||||||
impl()->setDetectorPositionId(arg.detId);
|
impl()->setDetectorPositionId(arg.moduleId);
|
||||||
impl()->setDetectorHostname(arg.hostname);
|
impl()->setDetectorHostname(arg.hostname);
|
||||||
|
|
||||||
// udp setup
|
// udp setup
|
||||||
|
@ -308,7 +308,7 @@ int *Implementation::getMultiDetectorSize() const {
|
|||||||
return (int *)numDet;
|
return (int *)numDet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setMultiDetectorSize(const int *size) {
|
void Implementation::setDetectorSize(const int *size) {
|
||||||
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
std::string log_message = "Detector Size (ports): (";
|
std::string log_message = "Detector Size (ports): (";
|
||||||
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
||||||
@ -1008,7 +1008,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
|
|
||||||
// update (from 1 to 2 interface) & also for printout
|
// update (from 1 to 2 interface) & also for printout
|
||||||
setMultiDetectorSize(numDet);
|
setDetectorSize(numDet);
|
||||||
// update row and column in dataprocessor
|
// update row and column in dataprocessor
|
||||||
setDetectorPositionId(detID);
|
setDetectorPositionId(detID);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
void setDetectorType(const detectorType d);
|
void setDetectorType(const detectorType d);
|
||||||
int *getMultiDetectorSize() const;
|
int *getMultiDetectorSize() const;
|
||||||
void setMultiDetectorSize(const int *size);
|
void setDetectorSize(const int *size);
|
||||||
int getDetectorPositionId() const;
|
int getDetectorPositionId() const;
|
||||||
void setDetectorPositionId(const int id);
|
void setDetectorPositionId(const int id);
|
||||||
std::string getDetectorHostname() const;
|
std::string getDetectorHostname() const;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
/** default ports */
|
/** default ports */
|
||||||
#define DEFAULT_PORTNO 1952
|
#define DEFAULT_PORTNO 1952
|
||||||
|
#define DEFAULT_RX_PORTNO 1954
|
||||||
#define DEFAULT_UDP_PORTNO 50001
|
#define DEFAULT_UDP_PORTNO 50001
|
||||||
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
||||||
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
||||||
@ -466,8 +467,8 @@ class slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
struct rxParameters {
|
struct rxParameters {
|
||||||
detectorType detType{GENERIC};
|
detectorType detType{GENERIC};
|
||||||
xy multiSize;
|
xy detectorSize;
|
||||||
int detId{0};
|
int moduleId{0};
|
||||||
char hostname[MAX_STR_LENGTH];
|
char hostname[MAX_STR_LENGTH];
|
||||||
int udpInterfaces{1};
|
int udpInterfaces{1};
|
||||||
int udp_dstport{0};
|
int udp_dstport{0};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user