mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-09 06:10:02 +02:00
WIP, rxhostname
This commit is contained in:
parent
1d31695cc1
commit
601be462af
@ -6863,6 +6863,16 @@ int get_receiver_parameters(int file_des) {
|
||||
n += sendData(file_des, hostname, MAX_STR_LENGTH, OTHER);
|
||||
if (n < 0) return printSocketReadError();
|
||||
}
|
||||
// primary interface
|
||||
{
|
||||
char c = '0';
|
||||
n += sendData(file_des, &c, 1, OTHER);
|
||||
if (n < 0) return printSocketReadError();
|
||||
}
|
||||
// zmq ip
|
||||
i32 = 0;
|
||||
n += sendData(file_des,&i32,sizeof(i32),INT32);
|
||||
if (n < 0) return printSocketReadError();
|
||||
// end of shared memory variables in struct
|
||||
|
||||
|
||||
|
@ -1011,10 +1011,6 @@ std::string CmdProxy::ReceiverHostname(int action) {
|
||||
if (port == 0) {
|
||||
det->setRxHostname(udpInterface, hostname, {det_id});
|
||||
} else {
|
||||
if (det_id == -1 && det->size() > 1) {
|
||||
throw sls::RuntimeError("Cannot set same tcp port "
|
||||
"for all receiver hostnames");
|
||||
}
|
||||
det->setRxHostname(udpInterface, hostname, port, det_id);
|
||||
}
|
||||
auto t = det->getRxHostname(udpInterface, {det_id});
|
||||
|
@ -679,7 +679,7 @@ void Detector::setDestinationUDPPort2(int port, int module_id) {
|
||||
}
|
||||
|
||||
Result<std::string> Detector::printRxConfiguration(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::printReceiverConfiguration, pos);
|
||||
return pimpl->Parallel3(&Receiver::printConfiguration); // ignoring pos FIXME
|
||||
}
|
||||
|
||||
Result<bool> Detector::getTenGiga(Positions pos) const {
|
||||
@ -747,32 +747,16 @@ Result<std::string> Detector::getRxHostname(const int udpInterface, Positions po
|
||||
}
|
||||
|
||||
void Detector::setRxHostname(const int udpInterface, const std::string &hostname, Positions pos) {
|
||||
if (getDetectorStatus(pos).squash(defs::ERROR) == defs::RUNNING) {
|
||||
LOG(logWARNING) << "Acquisition already running, Stopping it.";
|
||||
stopDetector();
|
||||
}
|
||||
if (!pimpl->isReceiverInitialized(udpInterface)) {
|
||||
pimpl->initReceiver(udpInterface);
|
||||
}
|
||||
if (udpInterface == 1) {
|
||||
pimpl->Parallel1(&Receiver::setHostname, pos, {}, hostname);
|
||||
} else {
|
||||
pimpl->Parallel2(&Receiver::setHostname, pos, {}, hostname);
|
||||
}
|
||||
int port = 0;
|
||||
pimpl->configureReceiver(udpInterface, pos, hostname, port);
|
||||
}
|
||||
|
||||
void Detector::setRxHostname(const int udpInterface, const std::string &hostname, const int port,
|
||||
int module_id) {
|
||||
if (!pimpl->isReceiverInitialized(udpInterface)) {
|
||||
pimpl->initReceiver(udpInterface);
|
||||
}
|
||||
if (udpInterface == 1) {
|
||||
pimpl->Parallel1(&Receiver::setTCPPort, {module_id}, {}, port);
|
||||
pimpl->Parallel1(&Receiver::setHostname, {module_id}, {}, hostname);
|
||||
} else {
|
||||
pimpl->Parallel2(&Receiver::setTCPPort, {module_id}, {}, port);
|
||||
pimpl->Parallel2(&Receiver::setHostname, {module_id}, {}, hostname);
|
||||
if (module_id == -1 && size() > 1) {
|
||||
throw sls::RuntimeError("Cannot set same rx_tcpport and rx_hostname for multiple receivers");
|
||||
}
|
||||
pimpl->configureReceiver(udpInterface, {module_id}, hostname, port);
|
||||
}
|
||||
|
||||
Result<int> Detector::getRxPort(const int udpInterface, Positions pos) const {
|
||||
|
@ -437,6 +437,39 @@ void DetectorImpl::removeReceivers(const int udpInterface) {
|
||||
}
|
||||
}
|
||||
|
||||
void DetectorImpl::configureReceiver(const int udpInterface, Positions pos,
|
||||
const std::string &hostname, const int port) {
|
||||
|
||||
if (Parallel(&Module::getRunStatus, pos).squash(defs::ERROR) == defs::RUNNING) {
|
||||
LOG(logWARNING) << "Acquisition already running, Stopping it.";
|
||||
Parallel(&Module::stopAcquisition, {});
|
||||
}
|
||||
if (!isReceiverInitialized(udpInterface)) {
|
||||
initReceiver(udpInterface);
|
||||
}
|
||||
if (udpInterface == 1) {
|
||||
if (port != 0) {
|
||||
Parallel1(&Receiver::setTCPPort, pos, {}, port);
|
||||
}
|
||||
Parallel1(&Receiver::setHostname, pos, {}, hostname);
|
||||
/*auto t = Parallel(&Module::getReceiverParameters, pos).squash();
|
||||
auto m = Parallel1(&Receiver::configure, pos, {}, t).squash();
|
||||
if (m != 0) {
|
||||
Parallel(&Module::setDestinationUDPMAC, pos, m);
|
||||
}*/
|
||||
} else {
|
||||
if (port != 0) {
|
||||
Parallel2(&Receiver::setTCPPort, pos, {}, port);
|
||||
}
|
||||
Parallel2(&Receiver::setHostname, pos, {}, hostname);
|
||||
/*auto t = Parallel(&Module::getReceiverParameters, pos).squash();
|
||||
auto m = Parallel2(&Receiver::configure, pos, {}, t).squash();
|
||||
if (m != 0) {
|
||||
Parallel(&Module::setDestinationUDPMAC2, pos, m);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void DetectorImpl::updateDetectorSize() {
|
||||
LOG(logDEBUG) << "Updating Detector Size: " << size();
|
||||
|
||||
|
@ -663,6 +663,8 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
||||
void initReceiver(const int udpInterface);
|
||||
bool isReceiverInitialized(const int udpInterface);
|
||||
void removeReceivers(const int udpInterface);
|
||||
void configureReceiver(const int udpInterface, Positions pos,
|
||||
const std::string &hostname, const int port);
|
||||
|
||||
/** Gets the total number of detectors */
|
||||
int size() const;
|
||||
|
@ -1478,16 +1478,10 @@ uint32_t Module::clearBit(uint32_t addr, int n) {
|
||||
}
|
||||
}
|
||||
|
||||
void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
|
||||
|
||||
|
||||
|
||||
sls::strcpy_safe(shm()->rxHostname, host.c_str());
|
||||
shm()->useReceiver = true;
|
||||
|
||||
slsDetectorDefs::rxParameters Module::getReceiverParameters() {
|
||||
// populate parameters from detector
|
||||
rxParameters retval;
|
||||
|
||||
sendToDetector(F_GET_RECEIVER_PARAMETERS, nullptr, retval);
|
||||
|
||||
// populate from shared memory
|
||||
@ -1495,74 +1489,13 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
retval.detectorSize.x = shm()->detectorSize.x;
|
||||
retval.detectorSize.y = shm()->detectorSize.y;
|
||||
retval.moduleId = moduleId;
|
||||
memset(retval.hostname, 0, sizeof(retval.hostname));
|
||||
strcpy_safe(retval.hostname, shm()->hostname);
|
||||
|
||||
LOG(logDEBUG1)
|
||||
<< "detType:" << retval.detType << std::endl
|
||||
<< "detectorSize.x:" << retval.detectorSize.x << std::endl
|
||||
<< "detectorSize.y:" << retval.detectorSize.y << std::endl
|
||||
<< "moduleId:" << retval.moduleId << std::endl
|
||||
<< "hostname:" << retval.hostname << std::endl
|
||||
<< "udpInterfaces:" << retval.udpInterfaces << std::endl
|
||||
<< "udp_dstport:" << retval.udp_dstport << std::endl
|
||||
<< "udp_dstip:" << sls::IpAddr(retval.udp_dstip) << std::endl
|
||||
<< "udp_dstmac:" << sls::MacAddr(retval.udp_dstmac) << std::endl
|
||||
<< "udp_dstport2:" << retval.udp_dstport2 << std::endl
|
||||
<< "udp_dstip2:" << sls::IpAddr(retval.udp_dstip2) << std::endl
|
||||
<< "udp_dstmac2:" << sls::MacAddr(retval.udp_dstmac2) << std::endl
|
||||
<< "frames:" << retval.frames << std::endl
|
||||
<< "triggers:" << retval.triggers << std::endl
|
||||
<< "bursts:" << retval.bursts << std::endl
|
||||
<< "analogSamples:" << retval.analogSamples << std::endl
|
||||
<< "digitalSamples:" << retval.digitalSamples << std::endl
|
||||
<< "expTimeNs:" << retval.expTimeNs << std::endl
|
||||
<< "periodNs:" << retval.periodNs << std::endl
|
||||
<< "subExpTimeNs:" << retval.subExpTimeNs << std::endl
|
||||
<< "subDeadTimeNs:" << retval.subDeadTimeNs << std::endl
|
||||
<< "activate:" << retval.activate << std::endl
|
||||
<< "quad:" << retval.quad << std::endl
|
||||
<< "dynamicRange:" << retval.dynamicRange << std::endl
|
||||
<< "timMode:" << retval.timMode << std::endl
|
||||
<< "tenGiga:" << retval.tenGiga << std::endl
|
||||
<< "roMode:" << retval.roMode << std::endl
|
||||
<< "adcMask:" << retval.adcMask << std::endl
|
||||
<< "adc10gMask:" << retval.adc10gMask << std::endl
|
||||
<< "roi.xmin:" << retval.roi.xmin << std::endl
|
||||
<< "roi.xmax:" << retval.roi.xmax << std::endl
|
||||
<< "countermask:" << retval.countermask << std::endl
|
||||
<< "burstType:" << retval.burstType << std::endl;
|
||||
|
||||
|
||||
sls::MacAddr retvals[2];
|
||||
sendToReceiver(F_SETUP_RECEIVER, retval, retvals);
|
||||
// update detectors with dest mac
|
||||
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||
LOG(logINFO) << "Setting destination udp mac of "
|
||||
"detector " << moduleId << " to " << retvals[0];
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
||||
}
|
||||
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
||||
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||
"detector " << moduleId << " to " << retvals[1];
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
||||
}
|
||||
|
||||
// update numinterfaces if different
|
||||
shm()->numUDPInterfaces = retval.udpInterfaces;
|
||||
|
||||
if (shm()->myDetectorType == MOENCH) {
|
||||
setAdditionalJsonParameter("adcmask_1g", std::to_string(retval.adcMask));
|
||||
setAdditionalJsonParameter("adcmask_10g", std::to_string(retval.adc10gMask));
|
||||
}
|
||||
|
||||
// to use rx_hostname if empty and also update client zmqip
|
||||
updateReceiverStreamingIP();
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string Module::getReceiverHostname() const {
|
||||
return std::string(shm()->rxHostname);
|
||||
}
|
||||
|
||||
|
||||
void Module::setSourceUDPMAC(const sls::MacAddr mac) {
|
||||
LOG(logDEBUG1) << "Setting source udp mac to " << mac;
|
||||
@ -1676,11 +1609,11 @@ sls::IpAddr Module::getDestinationUDPIP2() {
|
||||
}
|
||||
|
||||
void Module::setDestinationUDPMAC(const MacAddr mac) {
|
||||
LOG(logDEBUG1) << "Setting destination udp mac to " << mac;
|
||||
if (mac == 0) {
|
||||
throw RuntimeError("Invalid destination udp mac address");
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Setting destination udp mac of "
|
||||
"detector " << moduleId << " to " << mac;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC, mac, nullptr);
|
||||
}
|
||||
|
||||
@ -1693,11 +1626,11 @@ sls::MacAddr Module::getDestinationUDPMAC() {
|
||||
}
|
||||
|
||||
void Module::setDestinationUDPMAC2(const MacAddr mac) {
|
||||
LOG(logDEBUG1) << "Setting destination udp mac2 to " << mac;
|
||||
if (mac == 0) {
|
||||
throw RuntimeError("Invalid desinaion udp mac address2");
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||
"detector " << moduleId << " to " << mac;
|
||||
sendToDetector(F_SET_DEST_UDP_MAC2, mac, nullptr);
|
||||
}
|
||||
|
||||
@ -2750,35 +2683,6 @@ void Module::updateRateCorrection() {
|
||||
sendToDetector(F_UPDATE_RATE_CORRECTION);
|
||||
}
|
||||
|
||||
std::string Module::printReceiverConfiguration() {
|
||||
std::ostringstream os;
|
||||
os << "\n\nDetector " << moduleId << "\nReceiver Hostname:\t"
|
||||
<< getReceiverHostname();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||
}
|
||||
|
||||
os << "\nDetector UDP IP:\t"
|
||||
<< getSourceUDPIP() << "\nDetector UDP MAC:\t"
|
||||
<< getSourceUDPMAC() << "\nReceiver UDP IP:\t"
|
||||
<< getDestinationUDPIP() << "\nReceiver UDP MAC:\t" << getDestinationUDPMAC();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nDetector UDP IP2:\t" << getSourceUDPIP2()
|
||||
<< "\nDetector UDP MAC2:\t" << getSourceUDPMAC2()
|
||||
<< "\nReceiver UDP IP2:\t" << getDestinationUDPIP2()
|
||||
<< "\nReceiver UDP MAC2:\t" << getDestinationUDPMAC2();
|
||||
}
|
||||
os << "\nReceiver UDP Port:\t" << getDestinationUDPPort();
|
||||
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER) {
|
||||
os << "\nReceiver UDP Port2:\t" << getDestinationUDPPort2();
|
||||
}
|
||||
os << "\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool Module::getUseReceiverFlag() const { return shm()->useReceiver; }
|
||||
|
||||
int Module::lockReceiver(int lock) {
|
||||
|
@ -633,22 +633,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint32_t clearBit(uint32_t addr, int n);
|
||||
|
||||
/**
|
||||
* Validates and sets the receiver.
|
||||
* Also updates the receiver with all the shared memory parameters
|
||||
* significant for the receiver Also configures the detector to the receiver
|
||||
* as UDP destination
|
||||
* @param receiver receiver hostname or IP address
|
||||
*/
|
||||
void setReceiverHostname(const std::string &receiver);
|
||||
|
||||
void test();
|
||||
/**
|
||||
* Returns the receiver IP address
|
||||
* @returns the receiver IP address
|
||||
*/
|
||||
std::string getReceiverHostname() const;
|
||||
|
||||
/** gets receiver parameters from detector and shared memory */
|
||||
rxParameters getReceiverParameters();
|
||||
|
||||
/**
|
||||
* Validates the format of the detector MAC address and sets it
|
||||
* @param mac detector MAC address
|
||||
@ -1284,12 +1271,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
void updateRateCorrection();
|
||||
|
||||
/**
|
||||
* Prints receiver configuration
|
||||
* @returns receiver configuration
|
||||
*/
|
||||
std::string printReceiverConfiguration();
|
||||
|
||||
/**
|
||||
* Gets the use receiver flag from shared memory
|
||||
*/
|
||||
|
@ -117,6 +117,7 @@ Receiver::Receiver(int detector_id, int module_id, int receiver_id,
|
||||
shm()->shmversion = RECEIVER_SHMVERSION;
|
||||
memset(shm()->hostname, 0, MAX_STR_LENGTH);
|
||||
shm()->tcpPort = DEFAULT_RX_PORTNO + receiver_id;
|
||||
shm()->primaryInterface = primaryInterface;
|
||||
shm()-> stoppedFlag = false;
|
||||
shm()->zmqPort = DEFAULT_ZMQ_RX_PORTNO + receiver_id;
|
||||
shm()->zmqIp = IpAddr{};
|
||||
@ -151,6 +152,8 @@ Receiver::Receiver(int detector_id, int module_id, int receiver_id,
|
||||
|
||||
Receiver::~Receiver() = default;
|
||||
|
||||
/** Configuration */
|
||||
|
||||
void Receiver::freeSharedMemory() {
|
||||
if (shm.IsExisting()) {
|
||||
shm.RemoveSharedMemory();
|
||||
@ -166,7 +169,7 @@ void Receiver::setHostname(const std::string &hostname) {
|
||||
throw RuntimeError("Invalid receiver hostname. Cannot be empty.");
|
||||
}
|
||||
sls::strcpy_safe(shm()->hostname, hostname.c_str());
|
||||
configure();
|
||||
checkVersionCompatibility();
|
||||
}
|
||||
|
||||
int Receiver::getTCPPort() const {
|
||||
@ -185,12 +188,6 @@ void Receiver::setTCPPort(const int port) {
|
||||
shm()->tcpPort = port;
|
||||
}
|
||||
}
|
||||
return shm()->tcpPort;
|
||||
}
|
||||
|
||||
void Receiver::configure() {
|
||||
LOG(logINFOBLUE) << receiverId << " configured!";
|
||||
checkVersionCompatibility();
|
||||
}
|
||||
|
||||
void Receiver::checkVersionCompatibility() {
|
||||
@ -201,6 +198,117 @@ void Receiver::checkVersionCompatibility() {
|
||||
sendToReceiver(F_RECEIVER_CHECK_VERSION, arg, nullptr);
|
||||
}
|
||||
|
||||
sls::MacAddr Receiver::configure(slsDetectorDefs::rxParameters arg) {
|
||||
// hostname
|
||||
memset(arg.hostname, 0, sizeof(arg.hostname));
|
||||
strcpy_safe(arg.hostname, shm()->hostname);
|
||||
// primary interface
|
||||
arg.primaryInterface = shm()->primaryInterface;
|
||||
// zmqip
|
||||
{
|
||||
sls::IpAddr ip;
|
||||
// Hostname could be ip try to decode otherwise look up the hostname
|
||||
ip = sls::IpAddr{shm()->hostname};
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->hostname);
|
||||
}
|
||||
LOG(logINFO) << "Setting default receiver " << moduleId
|
||||
<< " streaming zmq ip to " << ip;
|
||||
// if client zmqip is empty, update it
|
||||
if (shm()->zmqIp == 0) {
|
||||
shm()->zmqIp = ip;
|
||||
}
|
||||
memcpy(&arg.zmq_ip, &ip, sizeof(ip));
|
||||
}
|
||||
|
||||
LOG(logDEBUG1)
|
||||
<< "detType:" << arg.detType << std::endl
|
||||
<< "detectorSize.x:" << arg.detectorSize.x << std::endl
|
||||
<< "detectorSize.y:" << arg.detectorSize.y << std::endl
|
||||
<< "moduleId:" << arg.moduleId << std::endl
|
||||
<< "hostname:" << arg.hostname << std::endl
|
||||
<< "primary Interace: " << arg.primaryInterface << std::endl
|
||||
<< "zmq ip:" << arg.zmq_ip << std::endl
|
||||
<< "udpInterfaces:" << arg.udpInterfaces << std::endl
|
||||
<< "udp_dstport:" << arg.udp_dstport << std::endl
|
||||
<< "udp_dstip:" << sls::IpAddr(arg.udp_dstip) << std::endl
|
||||
<< "udp_dstmac:" << sls::MacAddr(arg.udp_dstmac) << std::endl
|
||||
<< "udp_dstport2:" << arg.udp_dstport2 << std::endl
|
||||
<< "udp_dstip2:" << sls::IpAddr(arg.udp_dstip2) << std::endl
|
||||
<< "udp_dstmac2:" << sls::MacAddr(arg.udp_dstmac2) << std::endl
|
||||
<< "frames:" << arg.frames << std::endl
|
||||
<< "triggers:" << arg.triggers << std::endl
|
||||
<< "bursts:" << arg.bursts << std::endl
|
||||
<< "analogSamples:" << arg.analogSamples << std::endl
|
||||
<< "digitalSamples:" << arg.digitalSamples << std::endl
|
||||
<< "expTimeNs:" << arg.expTimeNs << std::endl
|
||||
<< "periodNs:" << arg.periodNs << std::endl
|
||||
<< "subExpTimeNs:" << arg.subExpTimeNs << std::endl
|
||||
<< "subDeadTimeNs:" << arg.subDeadTimeNs << std::endl
|
||||
<< "activate:" << arg.activate << std::endl
|
||||
<< "quad:" << arg.quad << std::endl
|
||||
<< "dynamicRange:" << arg.dynamicRange << std::endl
|
||||
<< "timMode:" << arg.timMode << std::endl
|
||||
<< "tenGiga:" << arg.tenGiga << std::endl
|
||||
<< "roMode:" << arg.roMode << std::endl
|
||||
<< "adcMask:" << arg.adcMask << std::endl
|
||||
<< "adc10gMask:" << arg.adc10gMask << std::endl
|
||||
<< "roi.xmin:" << arg.roi.xmin << std::endl
|
||||
<< "roi.xmax:" << arg.roi.xmax << std::endl
|
||||
<< "countermask:" << arg.countermask << std::endl
|
||||
<< "burstType:" << arg.burstType << std::endl;
|
||||
|
||||
sls::MacAddr mac;
|
||||
{
|
||||
sls::MacAddr retval;
|
||||
sendToReceiver(F_SETUP_RECEIVER, arg, retval);
|
||||
// detector does not have customized udp mac
|
||||
if (arg.udp_dstmac == 0) {
|
||||
mac = retval;
|
||||
}
|
||||
}
|
||||
if (arg.detType == MOENCH) {
|
||||
//setAdditionalJsonParameter("adcmask_1g", std::to_string(arg.adcMask));
|
||||
//setAdditionalJsonParameter("adcmask_10g", std::to_string(arg.adc10gMask));
|
||||
}
|
||||
|
||||
LOG(logINFOBLUE) << receiverId << " configured!";
|
||||
return mac;
|
||||
}
|
||||
|
||||
std::string Receiver::printConfiguration() {
|
||||
std::ostringstream os;
|
||||
/*
|
||||
os << "\n\nModuler " << moduleId
|
||||
<< "\nReceiver Hostname:\t"<< getReceiverHostname();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||
}
|
||||
|
||||
os << "\nDetector UDP IP:\t"
|
||||
<< getSourceUDPIP() << "\nDetector UDP MAC:\t"
|
||||
<< getSourceUDPMAC() << "\nReceiver UDP IP:\t"
|
||||
<< getDestinationUDPIP() << "\nReceiver UDP MAC:\t" << getDestinationUDPMAC();
|
||||
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
os << "\nDetector UDP IP2:\t" << getSourceUDPIP2()
|
||||
<< "\nDetector UDP MAC2:\t" << getSourceUDPMAC2()
|
||||
<< "\nReceiver UDP IP2:\t" << getDestinationUDPIP2()
|
||||
<< "\nReceiver UDP MAC2:\t" << getDestinationUDPMAC2();
|
||||
}
|
||||
os << "\nReceiver UDP Port:\t" << getDestinationUDPPort();
|
||||
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER) {
|
||||
os << "\nReceiver UDP Port2:\t" << getDestinationUDPPort2();
|
||||
}
|
||||
*/
|
||||
os << "\n";
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/** Acquisition */
|
||||
|
||||
void Receiver::start() {
|
||||
LOG(logDEBUG1) << "Starting Receiver";
|
||||
shm()->stoppedFlag = false;
|
||||
|
@ -13,6 +13,7 @@ namespace sls {
|
||||
int shmversion;
|
||||
char hostname[MAX_STR_LENGTH];
|
||||
int tcpPort;
|
||||
bool primaryInterface;
|
||||
/** END OF FIXED PATTERN -----------------------------------------------*/
|
||||
|
||||
int stoppedFlag;
|
||||
@ -34,7 +35,11 @@ namespace sls {
|
||||
|
||||
virtual ~Receiver();
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Configuration *
|
||||
* *
|
||||
* ************************************************/
|
||||
/**
|
||||
* Free shared memory and delete shared memory structure
|
||||
* occupied by the sharedReceiver structure
|
||||
@ -45,9 +50,23 @@ namespace sls {
|
||||
void freeSharedMemory();
|
||||
std::string getHostname() const;
|
||||
void setHostname(const std::string &hostname);
|
||||
sls::MacAddr configure(slsDetectorDefs::rxParameters arg);
|
||||
int getTCPPort() const;
|
||||
void setTCPPort(const int port);
|
||||
std::string printConfiguration();
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
* *
|
||||
* ************************************************/
|
||||
void start();
|
||||
void stop();
|
||||
slsDetectorDefs::runStatus getStatus() const;
|
||||
@ -55,6 +74,29 @@ namespace sls {
|
||||
void setStoppedFlag();
|
||||
void restreamStop();
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Network Configuration (Detector<->Receiver) *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* File *
|
||||
* *
|
||||
* ************************************************/
|
||||
/**************************************************
|
||||
* *
|
||||
* ZMQ Streaming Parameters (Receiver<->Client)*
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Detector Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
private:
|
||||
/**
|
||||
* Send function parameters to receiver
|
||||
@ -100,7 +142,6 @@ namespace sls {
|
||||
template <typename Ret, typename Arg>
|
||||
Ret sendToReceiver(int fnum, const Arg &args) const;
|
||||
|
||||
void configure();
|
||||
void checkVersionCompatibility();
|
||||
const int receiverId{0};
|
||||
const int moduleId{0};
|
||||
|
@ -341,6 +341,8 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
<< "detectorSize.y:" << arg.detectorSize.y << std::endl
|
||||
<< "moduleId:" << arg.moduleId << std::endl
|
||||
<< "hostname:" << arg.hostname << std::endl
|
||||
<< "primary Interace: " << arg.primaryInterface << std::endl
|
||||
<< "zmq ip:" << arg.zmq_ip << std::endl
|
||||
<< "udpInterfaces:" << arg.udpInterfaces << std::endl
|
||||
<< "udp_dstport:" << arg.udp_dstport << std::endl
|
||||
<< "udp_dstip:" << sls::IpAddr(arg.udp_dstip) << std::endl
|
||||
@ -387,7 +389,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
impl()->setDetectorHostname(arg.hostname);
|
||||
|
||||
// udp setup
|
||||
sls::MacAddr retvals[2];
|
||||
sls::MacAddr retvals[2]; // primary interface.. only udpip, else udpip2
|
||||
if (arg.udp_dstmac == 0 && arg.udp_dstip != 0) {
|
||||
retvals[0] = setUdpIp(sls::IpAddr(arg.udp_dstip));
|
||||
}
|
||||
@ -497,7 +499,13 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
||||
if (myDetectorType == GOTTHARD) {
|
||||
impl()->setBurstMode(arg.burstType);
|
||||
}
|
||||
|
||||
{
|
||||
sls::IpAddr ip(arg.zmq_ip);
|
||||
if (ip == 0) {
|
||||
throw RuntimeError("Invalid zmq ip: " + ip.str());
|
||||
}
|
||||
impl()->setStreamingSourceIP(ip);
|
||||
}
|
||||
return socket.sendResult(retvals);
|
||||
}
|
||||
|
||||
|
@ -470,6 +470,8 @@ class slsDetectorDefs {
|
||||
xy detectorSize;
|
||||
int moduleId{0};
|
||||
char hostname[MAX_STR_LENGTH];
|
||||
bool primaryInterface{true};
|
||||
uint32_t zmq_ip{0U};
|
||||
int udpInterfaces{1};
|
||||
int udp_dstport{0};
|
||||
uint32_t udp_dstip{0U};
|
||||
|
Loading…
x
Reference in New Issue
Block a user