mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
wip
This commit is contained in:
@ -667,7 +667,7 @@ class Detector {
|
||||
void setSourceUDPMAC2(const MacAddr mac, Positions pos = {});
|
||||
|
||||
Result<defs::udpDestination>
|
||||
getDestinationUDPList(const int entry, Positions pos = {}) const;
|
||||
getDestinationUDPList(const uint32_t entry, Positions pos = {}) const;
|
||||
|
||||
void setDestinationUDPList(const defs::udpDestination, const int module_id);
|
||||
|
||||
|
@ -1380,40 +1380,69 @@ IpAddr CmdProxy::getIpFromAuto() {
|
||||
}
|
||||
|
||||
defs::udpDestination CmdProxy::getUdpList() {
|
||||
defs::udpDestination dest{};
|
||||
uint32_t entry{};
|
||||
uint32_t port{};
|
||||
uint32_t port2{};
|
||||
uint32_t ip{};
|
||||
uint32_t ip2{};
|
||||
uint64_t mac{};
|
||||
uint64_t mac2{};
|
||||
|
||||
bool hasEntry = false;
|
||||
|
||||
for (auto it : args) {
|
||||
size_t pos = it.find('=');
|
||||
std::string key = it.substr(0, pos);
|
||||
std::string value = it.substr(pos + 1);
|
||||
if (key == "ip") {
|
||||
if (key == "entry") {
|
||||
entry = StringTo<int>(value);
|
||||
hasEntry = true;
|
||||
} else if (key == "ip") {
|
||||
if (value == "auto") {
|
||||
auto val = getIpFromAuto();
|
||||
LOG(logINFO) << "Setting udp_dstip of detector " << det_id
|
||||
<< " to " << val;
|
||||
dest.ip = val.uint32();
|
||||
ip = val.uint32();
|
||||
} else {
|
||||
dest.ip = IpAddr(value).uint32();
|
||||
ip = IpAddr(value).uint32();
|
||||
}
|
||||
} else if (key == "ip2") {
|
||||
if (value == "auto") {
|
||||
auto val = getIpFromAuto();
|
||||
LOG(logINFO) << "Setting udp_dstip2 of detector " << det_id
|
||||
<< " to " << val;
|
||||
dest.ip2 = val.uint32();
|
||||
ip2 = val.uint32();
|
||||
} else {
|
||||
dest.ip2 = IpAddr(value).uint32();
|
||||
ip2 = IpAddr(value).uint32();
|
||||
}
|
||||
} else if (key == "mac") {
|
||||
dest.mac = MacAddr(value).uint64();
|
||||
mac = MacAddr(value).uint64();
|
||||
} else if (key == "mac2") {
|
||||
dest.mac2 = MacAddr(value).uint64();
|
||||
mac2 = MacAddr(value).uint64();
|
||||
} else if (key == "port") {
|
||||
dest.port = StringTo<int>(value);
|
||||
port = StringTo<uint32_t>(value);
|
||||
} else if (key == "port2") {
|
||||
dest.port2 = StringTo<int>(value);
|
||||
port2 = StringTo<uint32_t>(value);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
// necessary arguments
|
||||
if (hasEntry && ip != 0 && mac != 0 && port != 0) {
|
||||
if (ip2 == 0 && mac2 == 0) {
|
||||
// default (no second interface)
|
||||
if (port2 == 0) {
|
||||
return defs::udpDestination(entry, port, ip, mac);
|
||||
}
|
||||
// eiger (second udp port)
|
||||
else {
|
||||
return defs::udpDestination(entry, port, ip, mac, port2);
|
||||
}
|
||||
}
|
||||
// jungfrau and gotthard2 (second interface)
|
||||
if (ip2 != 0 && mac2 != 0 && port2 != 0) {
|
||||
return defs::udpDestination(entry, port, ip, mac, port2, ip2, mac2);
|
||||
}
|
||||
}
|
||||
throw sls::RuntimeError("Insufficient arguments");
|
||||
}
|
||||
|
||||
std::string CmdProxy::UDPDestinationList(int action) {
|
||||
|
@ -909,7 +909,7 @@ void Detector::setSourceUDPMAC2(const MacAddr mac, Positions pos) {
|
||||
}
|
||||
|
||||
Result<defs::udpDestination>
|
||||
Detector::getDestinationUDPList(const int entry, Positions pos) const {
|
||||
Detector::getDestinationUDPList(const uint32_t entry, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getDestinationUDPList, pos, entry);
|
||||
}
|
||||
|
||||
|
@ -940,21 +940,26 @@ void Module::setSourceUDPMAC2(const sls::MacAddr mac) {
|
||||
}
|
||||
|
||||
slsDetectorDefs::udpDestination
|
||||
Module::getDestinationUDPList(const int entry) const {
|
||||
// return sendToDetector<udpDestination>(F_GET_DEST_UDP_LIST);
|
||||
return bla;
|
||||
Module::getDestinationUDPList(const uint32_t entry) const {
|
||||
return sendToDetector<udpDestination>(F_GET_DEST_UDP_LIST, entry);
|
||||
}
|
||||
|
||||
void Module::setDestinationUDPList(const slsDetectorDefs::udpDestination dest) {
|
||||
LOG(logINFO) << "setting stuff to " << dest;
|
||||
bla.entry = dest.entry;
|
||||
bla.ip = dest.ip;
|
||||
bla.ip2 = dest.ip2;
|
||||
bla.mac = dest.mac;
|
||||
bla.mac2 = dest.mac2;
|
||||
bla.port = dest.port;
|
||||
bla.port2 = dest.port2;
|
||||
// sendToDetector(F_SET_DEST_UDP_LIST, dest, nullptr);
|
||||
// set them in the default way so the receivers are also set up
|
||||
if (dest.entry_ == 0) {
|
||||
setDestinationUDPPort(dest.port_);
|
||||
setDestinationUDPIP(dest.ip_);
|
||||
setDestinationUDPMAC(dest.mac_);
|
||||
if (dest.port_ != 0) {
|
||||
setDestinationUDPPort2(dest.port2_);
|
||||
}
|
||||
if (dest.ip2_ != 0) {
|
||||
setDestinationUDPIP2(dest.ip2_);
|
||||
setDestinationUDPMAC2(dest.mac2_);
|
||||
}
|
||||
} else {
|
||||
sendToDetector(F_SET_DEST_UDP_LIST, dest, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
sls::IpAddr Module::getDestinationUDPIP() const {
|
||||
|
@ -222,7 +222,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setSourceUDPMAC(const sls::MacAddr mac);
|
||||
sls::MacAddr getSourceUDPMAC2() const;
|
||||
void setSourceUDPMAC2(const sls::MacAddr mac);
|
||||
udpDestination getDestinationUDPList(const int entry) const;
|
||||
udpDestination getDestinationUDPList(const uint32_t entry) const;
|
||||
void setDestinationUDPList(const defs::udpDestination dest);
|
||||
sls::IpAddr getDestinationUDPIP() const;
|
||||
void setDestinationUDPIP(const sls::IpAddr ip);
|
||||
@ -745,7 +745,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
|
||||
const int moduleId;
|
||||
mutable sls::SharedMemory<sharedSlsDetector> shm{0, 0};
|
||||
udpDestination bla{};
|
||||
};
|
||||
|
||||
} // namespace sls
|
Reference in New Issue
Block a user