This commit is contained in:
maliakal_d 2020-04-08 20:27:10 +02:00
parent b3fe0e79bc
commit 38c31fdada
7 changed files with 372 additions and 436 deletions

View File

@ -6839,6 +6839,47 @@ int get_receiver_parameters(int file_des) {
uint32_t u32 = 0; uint32_t u32 = 0;
uint64_t u64 = 0; uint64_t u64 = 0;
// udp interfaces
#ifdef JUNGFRAUD
i32 = getNumberofUDPInterfaces();
#else
i32 = 1;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst port
i32 = udpDetails.dstport;
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst ip
u32 = udpDetails.dstip;
u32 = __builtin_bswap32(u32);
n = sendData(file_des,&u32,sizeof(u32),INT32);
if (n < 0) return printSocketReadError();
// udp dst mac
u64 = udpDetails.dstmac;
n = sendData(file_des,&u64,sizeof(u64),INT64);
if (n < 0) return printSocketReadError();
// udp dst port2
i32 = udpDetails.dstport2;
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst ip2
u32 = udpDetails.dstip2;
u32 = __builtin_bswap32(u32);
n = sendData(file_des,&u32,sizeof(u32),INT32);
if (n < 0) return printSocketReadError();
// udp dst mac2
u64 = udpDetails.dstmac2;
n = sendData(file_des,&u64,sizeof(u64),INT64);
if (n < 0) return printSocketReadError();
// frames // frames
i64 = getNumFrames(); i64 = getNumFrames();
n = sendData(file_des,&i64,sizeof(i64),INT64); n = sendData(file_des,&i64,sizeof(i64),INT64);
@ -6904,9 +6945,23 @@ int get_receiver_parameters(int file_des) {
n = sendData(file_des,&i64,sizeof(i64),INT64); n = sendData(file_des,&i64,sizeof(i64),INT64);
if (n < 0) return printSocketReadError(); if (n < 0) return printSocketReadError();
// activate
#ifdef EIGERD
i32 = activate(-1);
#else
i32 = 0;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// quad
#ifdef EIGERD
i32 = getQuad();
#else
i32 = 0;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// dynamic range // dynamic range
i32 = setDynamicRange(-1); i32 = setDynamicRange(-1);
@ -6918,15 +6973,6 @@ int get_receiver_parameters(int file_des) {
n = sendData(file_des,&i32,sizeof(i32),INT32); n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError(); if (n < 0) return printSocketReadError();
// activate
#ifdef EIGERD
i32 = activate(-1);
#else
i32 = 0;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// 10 gbe // 10 gbe
#if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) #if defined(EIGERD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
i32 = enableTenGigabitEthernet(-1); i32 = enableTenGigabitEthernet(-1);
@ -6936,15 +6982,6 @@ int get_receiver_parameters(int file_des) {
n = sendData(file_des,&i32,sizeof(i32),INT32); n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError(); if (n < 0) return printSocketReadError();
// quad
#ifdef EIGERD
i32 = getQuad();
#else
i32 = 0;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// readout mode // readout mode
#ifdef CHIPTESTBOARD #ifdef CHIPTESTBOARD
i32 = getReadoutMode(); i32 = getReadoutMode();
@ -7005,49 +7042,5 @@ int get_receiver_parameters(int file_des) {
n = sendData(file_des,&i32,sizeof(i32),INT32); n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError(); if (n < 0) return printSocketReadError();
// udp interfaces
#ifdef JUNGFRAUD
i32 = getNumberofUDPInterfaces();
#else
i32 = 1;
#endif
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst port
i32 = udpDetails.dstport;
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst ip
u32 = udpDetails.dstip;
u32 = __builtin_bswap32(u32);
n = sendData(file_des,&u32,sizeof(u32),INT32);
if (n < 0) return printSocketReadError();
// udp dst mac
u64 = udpDetails.dstmac;
n = sendData(file_des,&u64,sizeof(u64),INT64);
if (n < 0) return printSocketReadError();
// udp dst port2
i32 = udpDetails.dstport2;
n = sendData(file_des,&i32,sizeof(i32),INT32);
if (n < 0) return printSocketReadError();
// udp dst ip2
u32 = udpDetails.dstip2;
u32 = __builtin_bswap32(u32);
n = sendData(file_des,&u32,sizeof(u32),INT32);
if (n < 0) return printSocketReadError();
// udp dst mac2
u64 = udpDetails.dstmac2;
n = sendData(file_des,&u64,sizeof(u64),INT64);
if (n < 0) return printSocketReadError();
return OK; return OK;
} }

View File

@ -526,27 +526,6 @@ Module::getTypeFromDetector(const std::string &hostname, int cport) {
return retval; return retval;
} }
int Module::setDetectorType(detectorType const type) {
int fnum = F_GET_DETECTOR_TYPE;
detectorType retval = GENERIC;
LOG(logDEBUG1) << "Setting detector type to " << type;
// if unspecified, then get from detector
if (type == GET_DETECTOR_TYPE) {
sendToDetector(fnum, nullptr, retval);
shm()->myDetectorType = static_cast<detectorType>(retval);
LOG(logDEBUG1) << "Detector Type: " << retval;
}
if (shm()->useReceiverFlag) {
auto arg = static_cast<int>(shm()->myDetectorType);
retval = GENERIC;
LOG(logDEBUG1) << "Sending detector type to Receiver: " << arg;
sendToReceiver(F_SET_RECEIVER_TYPE, arg, retval);
LOG(logDEBUG1) << "Receiver Type: " << retval;
}
return retval;
}
slsDetectorDefs::detectorType Module::getDetectorType() const { slsDetectorDefs::detectorType Module::getDetectorType() const {
return shm()->myDetectorType; return shm()->myDetectorType;
} }
@ -1510,14 +1489,13 @@ uint32_t Module::clearBit(uint32_t addr, int n) {
} }
} }
std::string Module::setReceiverHostname(const std::string &receiverIP) { void Module::setReceiverHostname(const std::string &receiverIP) {
LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
// recieverIP is none // recieverIP is none
if (receiverIP == "none") { if (receiverIP == "none") {
memset(shm()->rxHostname, 0, MAX_STR_LENGTH); memset(shm()->rxHostname, 0, MAX_STR_LENGTH);
sls::strcpy_safe(shm()->rxHostname, "none"); sls::strcpy_safe(shm()->rxHostname, "none");
shm()->useReceiverFlag = false; shm()->useReceiverFlag = false;
return std::string(shm()->rxHostname);
} }
// stop acquisition if running // stop acquisition if running
@ -1537,96 +1515,31 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
shm()->useReceiverFlag = true; shm()->useReceiverFlag = true;
checkReceiverVersionCompatibility(); checkReceiverVersionCompatibility();
if (setDetectorType(shm()->myDetectorType) != GENERIC) { // populate parameters for receiver
sendMultiDetectorSize();
setDetectorId();
setDetectorHostname();
// setup udp
updateRxDestinationUDPIP();
setDestinationUDPPort(getDestinationUDPPort());
if (shm()->myDetectorType == JUNGFRAU || shm()->myDetectorType == EIGER ) {
setDestinationUDPPort2(getDestinationUDPPort2());
}
if (shm()->myDetectorType == JUNGFRAU) {
updateRxDestinationUDPIP2();
setNumberofUDPInterfaces(getNumberofUDPInterfaces());
}
LOG(logDEBUG1) << printReceiverConfiguration();
setReceiverUDPSocketBufferSize(0);
setNumberOfFrames(getNumberOfFrames());
setNumberOfTriggers(getNumberOfTriggers());
setTimingMode(getTimingMode());
setExptime(getExptime());
setPeriod(getPeriod());
// detector specific
switch (shm()->myDetectorType) {
case EIGER:
setSubExptime(getSubExptime());
setSubDeadTime(getSubDeadTime());
setDynamicRange(getDynamicRange());
activate(-1);
enableTenGigabitEthernet(-1);
setQuad(getQuad());
break;
case CHIPTESTBOARD:
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
enableTenGigabitEthernet(-1);
setReadoutMode(getReadoutMode());
setADCEnableMask(getADCEnableMask());
setTenGigaADCEnableMask(getTenGigaADCEnableMask());
break;
case MOENCH:
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
enableTenGigabitEthernet(-1);
setADCEnableMask(getADCEnableMask());
setTenGigaADCEnableMask(getTenGigaADCEnableMask());
break;
case GOTTHARD:
setROI(getROI());
break;
case MYTHEN3:
sendNumberofCounterstoReceiver(getCounterMask());
setDynamicRange(getDynamicRange());
break;
case GOTTHARD2:
setNumberOfBursts(getNumberOfBursts());
setBurstMode(getBurstMode());
break;
default:
break;
}
// to use rx_hostname if empty and also update client zmqip
updateReceiverStreamingIP();
test();
}
return std::string(shm()->rxHostname);
}
void Module::test() {
int n = 0; int n = 0;
rxParameters retval; rxParameters retval;
// populate from shared memory // populate from shared memory
retval.detType = shm()->myDetectorType; retval.detType = shm()->myDetectorType;
n += sizeof(retval.detType); n += sizeof(retval.detType);
retval.multiSize.x = shm()->multiSize.x;
retval.multiSize.y = shm()->multiSize.y;
n += sizeof(retval.multiSize);
retval.detId = detId;
n += sizeof(retval.detId);
memset(retval.hostname, 0, sizeof(retval.hostname));
strcpy_safe(retval.hostname, shm()->hostname);
n += sizeof(retval.hostname);
// populate from detector // populate from detector
auto client = DetectorSocket(shm()->hostname, shm()->controlPort); auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
client.sendCommandThenRead(F_GET_RECEIVER_PARAMETERS, nullptr, 0, nullptr, 0); client.sendCommandThenRead(F_GET_RECEIVER_PARAMETERS, nullptr, 0, nullptr, 0);
n += client.Receive(&retval.udpInterfaces, sizeof(retval.udpInterfaces));
n += client.Receive(&retval.udp_dstport, sizeof(retval.udp_dstport));
n += client.Receive(&retval.udp_dstip, sizeof(retval.udp_dstip));
n += client.Receive(&retval.udp_dstmac, sizeof(retval.udp_dstmac));
n += client.Receive(&retval.udp_dstport2, sizeof(retval.udp_dstport2));
n += client.Receive(&retval.udp_dstip2, sizeof(retval.udp_dstip2));
n += client.Receive(&retval.udp_dstmac2, sizeof(retval.udp_dstmac2));
n += client.Receive(&retval.frames, sizeof(retval.frames)); n += client.Receive(&retval.frames, sizeof(retval.frames));
n += client.Receive(&retval.triggers, sizeof(retval.triggers)); n += client.Receive(&retval.triggers, sizeof(retval.triggers));
n += client.Receive(&retval.bursts, sizeof(retval.bursts)); n += client.Receive(&retval.bursts, sizeof(retval.bursts));
@ -1636,12 +1549,11 @@ void Module::test() {
n += client.Receive(&retval.periodNs, sizeof(retval.periodNs)); n += client.Receive(&retval.periodNs, sizeof(retval.periodNs));
n += client.Receive(&retval.subExpTimeNs, sizeof(retval.subExpTimeNs)); n += client.Receive(&retval.subExpTimeNs, sizeof(retval.subExpTimeNs));
n += client.Receive(&retval.subDeadTimeNs, sizeof(retval.subDeadTimeNs)); n += client.Receive(&retval.subDeadTimeNs, sizeof(retval.subDeadTimeNs));
n += client.Receive(&retval.activate, sizeof(retval.activate));
n += client.Receive(&retval.quad, sizeof(retval.quad));
n += client.Receive(&retval.dynamicRange, sizeof(retval.dynamicRange)); n += client.Receive(&retval.dynamicRange, sizeof(retval.dynamicRange));
n += client.Receive(&retval.timMode, sizeof(retval.timMode)); n += client.Receive(&retval.timMode, sizeof(retval.timMode));
n += client.Receive(&retval.activate, sizeof(retval.activate));
n += client.Receive(&retval.tenGiga, sizeof(retval.tenGiga)); n += client.Receive(&retval.tenGiga, sizeof(retval.tenGiga));
n += client.Receive(&retval.quad, sizeof(retval.quad));
n += client.Receive(&retval.roMode, sizeof(retval.roMode)); n += client.Receive(&retval.roMode, sizeof(retval.roMode));
n += client.Receive(&retval.adcMask, sizeof(retval.adcMask)); n += client.Receive(&retval.adcMask, sizeof(retval.adcMask));
n += client.Receive(&retval.adc10gMask, sizeof(retval.adc10gMask)); n += client.Receive(&retval.adc10gMask, sizeof(retval.adc10gMask));
@ -1650,51 +1562,70 @@ void Module::test() {
n += client.Receive(&retval.countermask, sizeof(retval.countermask)); n += client.Receive(&retval.countermask, sizeof(retval.countermask));
n += client.Receive(&retval.burstType, sizeof(retval.burstType)); n += client.Receive(&retval.burstType, sizeof(retval.burstType));
n += client.Receive(&retval.udpInterfaces, sizeof(retval.udpInterfaces));
n += client.Receive(&retval.udp_dstport, sizeof(retval.udp_dstport));
n += client.Receive(&retval.udp_dstip, sizeof(retval.udp_dstip));
n += client.Receive(&retval.udp_dstmac, sizeof(retval.udp_dstmac));
n += client.Receive(&retval.udp_dstport2, sizeof(retval.udp_dstport2));
n += client.Receive(&retval.udp_dstip2, sizeof(retval.udp_dstip2));
n += client.Receive(&retval.udp_dstmac2, sizeof(retval.udp_dstmac2));
LOG(logINFO) << "n:" << n << " retvalsize:" << sizeof(retval); LOG(logINFO) << "n:" << n << " retvalsize:" << sizeof(retval);
if (n != sizeof(retval)) { if (n != sizeof(retval)) {
throw RuntimeError("Could not get parameters from detector to configure receiver"); throw RuntimeError("Could not get parameters from detector to configure receiver");
} }
LOG(logINFO)
<< "detType:" << retval.detType << std::endl
<< "multiSize.x:" << retval.multiSize.x << std::endl
<< "multiSize.y:" << retval.multiSize.y << std::endl
<< "detId:" << retval.detId << 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;
LOG(logINFO) << "detType:" << retval.detType;
LOG(logINFO) << "frames:" << retval.frames; sls::MacAddr retvals[2];
LOG(logINFO) << "triggers:" << retval.triggers; sendToReceiver(F_SETUP_RECEIVER, retval, retvals);
LOG(logINFO) << "bursts:" << retval.bursts; // update detectors with dest mac
LOG(logINFO) << "analogSamples:" << retval.analogSamples; if (retval.udp_dstmac == 0 && retvals[0] != 0) {
LOG(logINFO) << "digitalSamples:" << retval.digitalSamples; LOG(logINFO) << "Setting destination udp mac of "
LOG(logINFO) << "expTimeNs:" << retval.expTimeNs; "detector " << detId << " to " << retvals[0];
LOG(logINFO) << "periodNs:" << retval.periodNs; sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
LOG(logINFO) << "subExpTimeNs:" << retval.subExpTimeNs; }
LOG(logINFO) << "subDeadTimeNs:" << retval.subDeadTimeNs; if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
LOG(logINFO) << "Setting destination udp mac2 of "
"detector " << detId << " to " << retvals[1];
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
}
LOG(logINFO) << "dynamicRange:" << retval.dynamicRange; // update numinterfaces if different
LOG(logINFO) << "timMode:" << retval.timMode; shm()->numUDPInterfaces = retval.udpInterfaces;
LOG(logINFO) << "activate:" << retval.activate;
LOG(logINFO) << "tenGiga:" << retval.tenGiga;
LOG(logINFO) << "quad:" << retval.quad;
LOG(logINFO) << "roMode:" << retval.roMode;
LOG(logINFO) << "adcMask:" << retval.adcMask;
LOG(logINFO) << "adc10gMask:" << retval.adc10gMask;
LOG(logINFO) << "roi.xmin:" << retval.roi.xmin;
LOG(logINFO) << "roi.xmax:" << retval.roi.xmax;
LOG(logINFO) << "countermask:" << retval.countermask;
LOG(logINFO) << "burstType:" << retval.burstType;
LOG(logINFO) << "udpInterfaces:" << retval.udpInterfaces; if (shm()->myDetectorType == MOENCH) {
LOG(logINFO) << "udp_dstport:" << retval.udp_dstport; setAdditionalJsonParameter("adcmask_1g", std::to_string(retval.adcMask));
LOG(logINFO) << "udp_dstip:" << sls::IpAddr(retval.udp_dstip); setAdditionalJsonParameter("adcmask_10g", std::to_string(retval.adc10gMask));
LOG(logINFO) << "udp_dstmac:" << sls::MacAddr(retval.udp_dstmac); }
LOG(logINFO) << "udp_dstport2:" << retval.udp_dstport2;
LOG(logINFO) << "udp_dstip2:" << sls::IpAddr(retval.udp_dstip2); // to use rx_hostname if empty and also update client zmqip
LOG(logINFO) << "udp_dstmac2:" << sls::MacAddr(retval.udp_dstmac2); updateReceiverStreamingIP();
} }
std::string Module::getReceiverHostname() const { std::string Module::getReceiverHostname() const {
@ -1789,13 +1720,6 @@ sls::IpAddr Module::getDestinationUDPIP() {
return retval; return retval;
} }
void Module::updateRxDestinationUDPIP() {
auto ip = getDestinationUDPIP();
if (ip != 0) {
setDestinationUDPIP(ip);
}
}
void Module::setDestinationUDPIP2(const IpAddr ip) { void Module::setDestinationUDPIP2(const IpAddr ip) {
LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip; LOG(logDEBUG1) << "Setting destination udp ip2 to " << ip;
if (ip == 0) { if (ip == 0) {
@ -1819,13 +1743,6 @@ sls::IpAddr Module::getDestinationUDPIP2() {
return retval; return retval;
} }
void Module::updateRxDestinationUDPIP2() {
auto ip = getDestinationUDPIP2();
if (ip != 0) {
setDestinationUDPIP2(ip);
}
}
void Module::setDestinationUDPMAC(const MacAddr mac) { void Module::setDestinationUDPMAC(const MacAddr mac) {
LOG(logDEBUG1) << "Setting destination udp mac to " << mac; LOG(logDEBUG1) << "Setting destination udp mac to " << mac;
if (mac == 0) { if (mac == 0) {
@ -2970,38 +2887,6 @@ void Module::execReceiverCommand(const std::string &cmd) {
} }
} }
void Module::sendMultiDetectorSize() {
int args[]{shm()->multiSize.x, shm()->multiSize.y};
int retval = -1;
LOG(logDEBUG1) << "Sending multi detector size to receiver: ("
<< shm()->multiSize.x << "," << shm()->multiSize.y
<< ")";
if (shm()->useReceiverFlag) {
sendToReceiver(F_SEND_RECEIVER_MULTIDETSIZE, args, retval);
LOG(logDEBUG1) << "Receiver multi size returned: " << retval;
}
}
void Module::setDetectorId() {
LOG(logDEBUG1) << "Sending detector pos id to receiver: " << detId;
if (shm()->useReceiverFlag) {
int retval = -1;
sendToReceiver(F_SEND_RECEIVER_DETPOSID, detId, retval);
LOG(logDEBUG1) << "Receiver Position Id returned: " << retval;
}
}
void Module::setDetectorHostname() {
char args[MAX_STR_LENGTH]{};
char retvals[MAX_STR_LENGTH]{};
sls::strcpy_safe(args, shm()->hostname);
LOG(logDEBUG1) << "Sending detector hostname to receiver: " << args;
if (shm()->useReceiverFlag) {
sendToReceiver(F_SEND_RECEIVER_DETHOSTNAME, args, retvals);
LOG(logDEBUG1) << "Receiver set detector hostname: " << retvals;
}
}
std::string Module::getFilePath() { std::string Module::getFilePath() {
if (!shm()->useReceiverFlag) { if (!shm()->useReceiverFlag) {
throw RuntimeError("Set rx_hostname first to use receiver parameters (file path)"); throw RuntimeError("Set rx_hostname first to use receiver parameters (file path)");
@ -3546,10 +3431,6 @@ void Module::setPipeline(int clkIndex, int value) {
void Module::setCounterMask(uint32_t countermask) { void Module::setCounterMask(uint32_t countermask) {
LOG(logDEBUG1) << "Setting Counter mask to " << countermask; LOG(logDEBUG1) << "Setting Counter mask to " << countermask;
sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr); sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr);
sendNumberofCounterstoReceiver(countermask);
}
void Module::sendNumberofCounterstoReceiver(uint32_t countermask) {
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
int ncounters = __builtin_popcount(countermask); int ncounters = __builtin_popcount(countermask);
LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters; LOG(logDEBUG1) << "Sending Reciver #counters: " << ncounters;

View File

@ -176,13 +176,6 @@ class Module : public virtual slsDetectorDefs {
*/ */
detectorType getDetectorType() const; detectorType getDetectorType() const;
/**
* Gets detector type from detector and set it in receiver
* @param type the detector type
* @returns detector type in receiver
*/
int setDetectorType(detectorType type = GET_DETECTOR_TYPE);
/** /**
* Update total number of channels (chiptestboard or moench) * Update total number of channels (chiptestboard or moench)
* from the detector server * from the detector server
@ -647,9 +640,8 @@ class Module : public virtual slsDetectorDefs {
* significant for the receiver Also configures the detector to the receiver * significant for the receiver Also configures the detector to the receiver
* as UDP destination * as UDP destination
* @param receiver receiver hostname or IP address * @param receiver receiver hostname or IP address
* @returns the receiver IP address from shared memory
*/ */
std::string setReceiverHostname(const std::string &receiver); void setReceiverHostname(const std::string &receiver);
void test(); void test();
/** /**
@ -722,13 +714,6 @@ class Module : public virtual slsDetectorDefs {
*/ */
sls::IpAddr getDestinationUDPIP(); sls::IpAddr getDestinationUDPIP();
/**
* Gets destination udp ip from detector,
* if 0, it converts rx_hostname to ip and
* updates both detector and receiver
*/
void updateRxDestinationUDPIP();
/** /**
* Validates the format of the receiver UDP IP address (bottom half) and * Validates the format of the receiver UDP IP address (bottom half) and
* sets it(Jungfrau only) * sets it(Jungfrau only)
@ -744,13 +729,6 @@ class Module : public virtual slsDetectorDefs {
*/ */
sls::IpAddr getDestinationUDPIP2(); sls::IpAddr getDestinationUDPIP2();
/**
* Gets destination udp ip2 from detector,
* if 0, it converts rx_hostname to ip and
* updates both detector and receiver
*/
void updateRxDestinationUDPIP2();
/** /**
* Validates the format of the receiver UDP MAC address and sets it * Validates the format of the receiver UDP MAC address and sets it
* @param mac receiver UDP MAC address * @param mac receiver UDP MAC address
@ -1345,26 +1323,6 @@ class Module : public virtual slsDetectorDefs {
*/ */
void execReceiverCommand(const std::string &cmd); void execReceiverCommand(const std::string &cmd);
/**
* Send the multi detector size to the detector
* @param detx number of detectors in x dir
* @param dety number of detectors in y dir
*/
void sendMultiDetectorSize();
/**
* Send the detector pos id to the receiver
* for various file naming conventions for multi detectors in receiver
*/
void setDetectorId();
/**
* Send the detector host name to the receiver
* for various handshaking required with the detector
*/
void setDetectorHostname();
std::string getFilePath(); std::string getFilePath();
void setFilePath(const std::string &path); void setFilePath(const std::string &path);
std::string getFileName(); std::string getFileName();
@ -1607,9 +1565,6 @@ class Module : public virtual slsDetectorDefs {
/** [Mythen3] */ /** [Mythen3] */
void setCounterMask(uint32_t countermask); void setCounterMask(uint32_t countermask);
/** [Mythen3] */
void sendNumberofCounterstoReceiver(uint32_t countermask);
/** [Mythen3] */ /** [Mythen3] */
uint32_t getCounterMask(); uint32_t getCounterMask();

View File

@ -115,8 +115,7 @@ int ClientInterface::functionTable(){
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip; flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port; flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version; flist[F_GET_RECEIVER_VERSION] = &ClientInterface::get_version;
flist[F_SET_RECEIVER_TYPE] = &ClientInterface::set_detector_type; flist[F_SETUP_RECEIVER] = &ClientInterface::setup_receiver;
flist[F_SEND_RECEIVER_DETHOSTNAME] = &ClientInterface::set_detector_hostname;
flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi; flist[F_RECEIVER_SET_ROI] = &ClientInterface::set_roi;
flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames; flist[F_RECEIVER_SET_NUM_FRAMES] = &ClientInterface::set_num_frames;
flist[F_SET_RECEIVER_NUM_TRIGGERS] = &ClientInterface::set_num_triggers; flist[F_SET_RECEIVER_NUM_TRIGGERS] = &ClientInterface::set_num_triggers;
@ -160,8 +159,6 @@ int ClientInterface::functionTable(){
flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data; flist[F_SET_FLIPPED_DATA_RECEIVER] = &ClientInterface::set_flipped_data;
flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format; flist[F_SET_RECEIVER_FILE_FORMAT] = &ClientInterface::set_file_format;
flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format; flist[F_GET_RECEIVER_FILE_FORMAT] = &ClientInterface::get_file_format;
flist[F_SEND_RECEIVER_DETPOSID] = &ClientInterface::set_detector_posid;
flist[F_SEND_RECEIVER_MULTIDETSIZE] = &ClientInterface::set_multi_detector_size;
flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port; flist[F_SET_RECEIVER_STREAMING_PORT] = &ClientInterface::set_streaming_port;
flist[F_GET_RECEIVER_STREAMING_PORT] = &ClientInterface::get_streaming_port; flist[F_GET_RECEIVER_STREAMING_PORT] = &ClientInterface::get_streaming_port;
flist[F_SET_RECEIVER_STREAMING_SRC_IP] = &ClientInterface::set_streaming_source_ip; flist[F_SET_RECEIVER_STREAMING_SRC_IP] = &ClientInterface::set_streaming_source_ip;
@ -336,69 +333,210 @@ int ClientInterface::get_version(Interface &socket) {
return socket.sendResult(getReceiverVersion()); return socket.sendResult(getReceiverVersion());
} }
int ClientInterface::set_detector_type(Interface &socket) { int ClientInterface::setup_receiver(Interface &socket) {
auto arg = socket.Receive<detectorType>(); auto arg = socket.Receive<rxParameters>();
// set LOG(logINFO)
if (arg >= 0) { << "detType:" << arg.detType << std::endl
// if object exists, verify unlocked and idle, else only verify lock << "multiSize.x:" << arg.multiSize.x << std::endl
// (connecting first time) << "multiSize.y:" << arg.multiSize.y << std::endl
if (receiver != nullptr) { << "detId:" << arg.detId << std::endl
verifyIdle(socket); << "hostname:" << arg.hostname << std::endl
} << "udpInterfaces:" << arg.udpInterfaces << std::endl
switch (arg) { << "udp_dstport:" << arg.udp_dstport << std::endl
case GOTTHARD: << "udp_dstip:" << sls::IpAddr(arg.udp_dstip) << std::endl
case EIGER: << "udp_dstmac:" << sls::MacAddr(arg.udp_dstmac) << std::endl
case CHIPTESTBOARD: << "udp_dstport2:" << arg.udp_dstport2 << std::endl
case MOENCH: << "udp_dstip2:" << sls::IpAddr(arg.udp_dstip2) << std::endl
case JUNGFRAU: << "udp_dstmac2:" << sls::MacAddr(arg.udp_dstmac2) << std::endl
case MYTHEN3: << "frames:" << arg.frames << std::endl
case GOTTHARD2: << "triggers:" << arg.triggers << std::endl
break; << "bursts:" << arg.bursts << std::endl
default: << "analogSamples:" << arg.analogSamples << std::endl
throw RuntimeError("Unknown detector type: " + std::to_string(arg)); << "digitalSamples:" << arg.digitalSamples << std::endl
break; << "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;
try {
myDetectorType = GENERIC;
receiver = sls::make_unique<Implementation>(arg);
myDetectorType = arg;
} catch (...) {
throw RuntimeError("Could not set detector type");
}
// callbacks after (in setdetectortype, the object is reinitialized) // if object exists, verify unlocked and idle, else only verify lock
if (startAcquisitionCallBack != nullptr) // (connecting first time)
impl()->registerCallBackStartAcquisition(startAcquisitionCallBack, if (receiver != nullptr) {
pStartAcquisition); verifyIdle(socket);
if (acquisitionFinishedCallBack != nullptr)
impl()->registerCallBackAcquisitionFinished(
acquisitionFinishedCallBack, pAcquisitionFinished);
if (rawDataReadyCallBack != nullptr)
impl()->registerCallBackRawDataReady(rawDataReadyCallBack,
pRawDataReady);
if (rawDataModifyReadyCallBack != nullptr)
impl()->registerCallBackRawDataModifyReady(
rawDataModifyReadyCallBack, pRawDataReady);
} }
return socket.sendResult(myDetectorType);
// basic setup
setDetectorType(arg.detType);
{
int msize[2] = {arg.multiSize.x, arg.multiSize.y};
impl()->setMultiDetectorSize(msize);
}
impl()->setDetectorPositionId(arg.detId);
impl()->setDetectorHostname(arg.hostname);
// udp setup
sls::MacAddr retvals[2];
if (arg.udp_dstmac == 0 && arg.udp_dstip != 0) {
retvals[0] = setUdpIp(sls::IpAddr(arg.udp_dstip));
}
if (arg.udp_dstmac2 == 0 && arg.udp_dstip2 != 0) {
retvals[1] = setUdpIp2(sls::IpAddr(arg.udp_dstip2));
}
impl()->setUDPPortNumber(arg.udp_dstport);
impl()->setUDPPortNumber2(arg.udp_dstport2);
if (myDetectorType == JUNGFRAU) {
try {
impl()->setNumberofUDPInterfaces(arg.udpInterfaces);
} catch(const RuntimeError &e) {
throw RuntimeError("Failed to set number of interfaces to " +
std::to_string(arg.udpInterfaces));
}
}
impl()->setUDPSocketBufferSize(0);
// acquisition parameters
impl()->setNumberOfFrames(arg.frames);
impl()->setNumberOfTriggers(arg.triggers);
if (myDetectorType == GOTTHARD) {
impl()->setNumberOfBursts(arg.bursts);
}
if (myDetectorType == MOENCH || myDetectorType == CHIPTESTBOARD) {
try {
impl()->setNumberofAnalogSamples(arg.analogSamples);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set num analog samples to " +
std::to_string(arg.analogSamples) +
" due to fifo structure memory allocation.");
}
}
if (myDetectorType == CHIPTESTBOARD) {
try {
impl()->setNumberofDigitalSamples(arg.digitalSamples);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set num digital samples to "
+ std::to_string(arg.analogSamples) +
" due to fifo structure memory allocation.");
}
}
impl()->setAcquisitionTime(arg.expTimeNs);
impl()->setAcquisitionPeriod(arg.periodNs);
if (myDetectorType == EIGER) {
impl()->setSubExpTime(arg.subExpTimeNs);
impl()->setSubPeriod(arg.subExpTimeNs + arg.subDeadTimeNs);
impl()->setActivate(static_cast<bool>(arg.activate));
try {
impl()->setQuad(arg.quad == 0 ? false : true);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set quad to " +
std::to_string(arg.quad) +
" due to fifo strucutre memory allocation");
}
}
if (myDetectorType == EIGER || myDetectorType == MYTHEN3) {
try {
impl()->setDynamicRange(arg.dynamicRange);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set dynamic range. Could not allocate "
"memory for fifo or could not start listening/writing threads");
}
}
impl()->setTimingMode(arg.timMode);
if (myDetectorType == EIGER || myDetectorType == MOENCH ||
myDetectorType == CHIPTESTBOARD) {
try {
impl()->setTenGigaEnable(arg.tenGiga);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set 10GbE.");
}
}
if (myDetectorType == CHIPTESTBOARD) {
try {
impl()->setReadoutMode(arg.roMode);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set read out mode "
"due to fifo memory allocation.");
}
}
if (myDetectorType == CHIPTESTBOARD || myDetectorType == MOENCH) {
try {
impl()->setADCEnableMask(arg.adcMask);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set adc enable mask "
"due to fifo memory allcoation");
}
try {
impl()->setTenGigaADCEnableMask(arg.adc10gMask);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set 10Gb adc enable mask "
"due to fifo memory allcoation");
}
}
if (myDetectorType == GOTTHARD) {
try {
impl()->setROI(arg.roi);
} catch(const RuntimeError &e) {
throw RuntimeError("Could not set ROI");
}
}
if (myDetectorType == MYTHEN3) {
int ncounters = __builtin_popcount(arg.countermask);
impl()->setNumberofCounters(ncounters);
}
if (myDetectorType == GOTTHARD) {
impl()->setBurstMode(arg.burstType);
}
return socket.sendResult(retvals);
} }
int ClientInterface::set_detector_hostname(Interface &socket) { void ClientInterface::setDetectorType(detectorType arg) {
char hostname[MAX_STR_LENGTH]{}; switch (arg) {
char retval[MAX_STR_LENGTH]{}; case GOTTHARD:
socket.Receive(hostname); case EIGER:
case CHIPTESTBOARD:
case MOENCH:
case JUNGFRAU:
case MYTHEN3:
case GOTTHARD2:
break;
default:
throw RuntimeError("Unknown detector type: " + std::to_string(arg));
break;
}
if (strlen(hostname) != 0) { try {
verifyIdle(socket); myDetectorType = GENERIC;
impl()->setDetectorHostname(hostname); receiver = sls::make_unique<Implementation>(arg);
myDetectorType = arg;
} catch (...) {
throw RuntimeError("Could not set detector type");
} }
auto s = impl()->getDetectorHostname();
sls::strcpy_safe(retval, s.c_str()); // callbacks after (in setdetectortype, the object is reinitialized)
if (s.empty()) { if (startAcquisitionCallBack != nullptr)
throw RuntimeError("Hostname not set"); impl()->registerCallBackStartAcquisition(startAcquisitionCallBack,
} pStartAcquisition);
return socket.sendResult(retval); if (acquisitionFinishedCallBack != nullptr)
impl()->registerCallBackAcquisitionFinished(
acquisitionFinishedCallBack, pAcquisitionFinished);
if (rawDataReadyCallBack != nullptr)
impl()->registerCallBackRawDataReady(rawDataReadyCallBack,
pRawDataReady);
if (rawDataModifyReadyCallBack != nullptr)
impl()->registerCallBackRawDataModifyReady(
rawDataModifyReadyCallBack, pRawDataReady);
} }
int ClientInterface::set_roi(Interface &socket) { int ClientInterface::set_roi(Interface &socket) {
@ -514,7 +652,6 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
} catch(const RuntimeError &e) { } catch(const RuntimeError &e) {
throw RuntimeError("Could not set num analog samples to " + std::to_string(value) + " due to fifo structure memory allocation."); throw RuntimeError("Could not set num analog samples to " + std::to_string(value) + " due to fifo structure memory allocation.");
} }
return socket.Send(OK); return socket.Send(OK);
} }
@ -831,7 +968,7 @@ int ClientInterface::enable_tengiga(Interface &socket) {
try { try {
impl()->setTenGigaEnable(val); impl()->setTenGigaEnable(val);
} catch(const RuntimeError &e) { } catch(const RuntimeError &e) {
throw RuntimeError("Could not set 10GbE."); throw RuntimeError("Could not set 10GbE." );
} }
} }
int retval = impl()->getTenGigaEnable(); int retval = impl()->getTenGigaEnable();
@ -952,34 +1089,6 @@ int ClientInterface::get_file_format(Interface &socket) {
return socket.sendResult(retval); return socket.sendResult(retval);
} }
int ClientInterface::set_detector_posid(Interface &socket) {
auto arg = socket.Receive<int>();
if (arg >= 0) {
verifyIdle(socket);
LOG(logDEBUG1) << "Setting detector position id:" << arg;
impl()->setDetectorPositionId(arg);
}
auto retval = impl()->getDetectorPositionId();
validate(arg, retval, "set detector position id", DEC);
LOG(logDEBUG1) << "Position Id:" << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_multi_detector_size(Interface &socket) {
int arg[]{-1, -1};
socket.Receive(arg);
if ((arg[0] > 0) && (arg[1] > 0)) {
verifyIdle(socket);
LOG(logDEBUG1)
<< "Setting multi detector size:" << arg[0] << "," << arg[1];
impl()->setMultiDetectorSize(arg);
}
int *temp = impl()->getMultiDetectorSize(); // TODO! return by value!
int retval = temp[0] * temp[1];
LOG(logDEBUG1) << "Multi Detector Size:" << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_streaming_port(Interface &socket) { int ClientInterface::set_streaming_port(Interface &socket) {
auto port = socket.Receive<int>(); auto port = socket.Receive<int>();
if (port < 0) { if (port < 0) {
@ -1363,11 +1472,7 @@ int ClientInterface::set_read_n_lines(Interface &socket) {
return socket.Send(OK); return socket.Send(OK);
} }
sls::MacAddr ClientInterface::setUdpIp(sls::IpAddr arg) {
int ClientInterface::set_udp_ip(Interface &socket) {
auto arg = socket.Receive<sls::IpAddr>();
verifyIdle(socket);
LOG(logINFO) << "Received UDP IP: " << arg;
// getting eth // getting eth
std::string eth = sls::IpToInterfaceName(arg.str()); std::string eth = sls::IpToInterfaceName(arg.str());
if (eth == "none") { if (eth == "none") {
@ -1386,18 +1491,19 @@ int ClientInterface::set_udp_ip(Interface &socket) {
if (retval == 0) { if (retval == 0) {
throw RuntimeError("Failed to get udp mac adddress to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n"); throw RuntimeError("Failed to get udp mac adddress to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n");
} }
return retval;
}
int ClientInterface::set_udp_ip(Interface &socket) {
auto arg = socket.Receive<sls::IpAddr>();
verifyIdle(socket);
LOG(logINFO) << "Received UDP IP: " << arg;
auto retval = setUdpIp(arg);
LOG(logINFO) << "Receiver MAC Address: " << retval; LOG(logINFO) << "Receiver MAC Address: " << retval;
return socket.sendResult(retval); return socket.sendResult(retval);
} }
sls::MacAddr ClientInterface::setUdpIp2(sls::IpAddr arg) {
int ClientInterface::set_udp_ip2(Interface &socket) {
auto arg = socket.Receive<sls::IpAddr>();
verifyIdle(socket);
if (myDetectorType != JUNGFRAU) {
throw RuntimeError("UDP Destination IP2 not implemented for this detector");
}
LOG(logINFO) << "Received UDP IP2: " << arg;
// getting eth // getting eth
std::string eth = sls::IpToInterfaceName(arg.str()); std::string eth = sls::IpToInterfaceName(arg.str());
if (eth == "none") { if (eth == "none") {
@ -1414,6 +1520,17 @@ int ClientInterface::set_udp_ip2(Interface &socket) {
if (retval == 0) { if (retval == 0) {
throw RuntimeError("Failed to get udp mac adddress2 to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n"); throw RuntimeError("Failed to get udp mac adddress2 to listen to (eth:" + eth + ", ip:" + arg.str() + ")\n");
} }
return retval;
}
int ClientInterface::set_udp_ip2(Interface &socket) {
auto arg = socket.Receive<sls::IpAddr>();
verifyIdle(socket);
if (myDetectorType != JUNGFRAU) {
throw RuntimeError("UDP Destination IP2 not implemented for this detector");
}
LOG(logINFO) << "Received UDP IP2: " << arg;
auto retval = setUdpIp2(arg);
LOG(logINFO) << "Receiver MAC Address2: " << retval; LOG(logINFO) << "Receiver MAC Address2: " << retval;
return socket.sendResult(retval); return socket.sendResult(retval);
} }

View File

@ -56,8 +56,8 @@ class ClientInterface : private virtual slsDetectorDefs {
int get_last_client_ip(sls::ServerInterface &socket); int get_last_client_ip(sls::ServerInterface &socket);
int set_port(sls::ServerInterface &socket); int set_port(sls::ServerInterface &socket);
int get_version(sls::ServerInterface &socket); int get_version(sls::ServerInterface &socket);
int set_detector_type(sls::ServerInterface &socket); int setup_receiver(sls::ServerInterface &socket);
int set_detector_hostname(sls::ServerInterface &socket); void setDetectorType(detectorType arg);
int set_roi(sls::ServerInterface &socket); int set_roi(sls::ServerInterface &socket);
int set_num_frames(sls::ServerInterface &socket); int set_num_frames(sls::ServerInterface &socket);
int set_num_triggers(sls::ServerInterface &socket); int set_num_triggers(sls::ServerInterface &socket);
@ -102,8 +102,6 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_flipped_data(sls::ServerInterface &socket); int set_flipped_data(sls::ServerInterface &socket);
int set_file_format(sls::ServerInterface &socket); int set_file_format(sls::ServerInterface &socket);
int get_file_format(sls::ServerInterface &socket); int get_file_format(sls::ServerInterface &socket);
int set_detector_posid(sls::ServerInterface &socket);
int set_multi_detector_size(sls::ServerInterface &socket);
int set_streaming_port(sls::ServerInterface &socket); int set_streaming_port(sls::ServerInterface &socket);
int get_streaming_port(sls::ServerInterface &socket); int get_streaming_port(sls::ServerInterface &socket);
int set_streaming_source_ip(sls::ServerInterface &socket); int set_streaming_source_ip(sls::ServerInterface &socket);
@ -132,7 +130,9 @@ class ClientInterface : private virtual slsDetectorDefs {
int get_dbit_offset(sls::ServerInterface &socket); int get_dbit_offset(sls::ServerInterface &socket);
int set_quad_type(sls::ServerInterface &socket); int set_quad_type(sls::ServerInterface &socket);
int set_read_n_lines(sls::ServerInterface &socket); int set_read_n_lines(sls::ServerInterface &socket);
sls::MacAddr setUdpIp(sls::IpAddr arg);
int set_udp_ip(sls::ServerInterface &socket); int set_udp_ip(sls::ServerInterface &socket);
sls::MacAddr setUdpIp2(sls::IpAddr arg);
int set_udp_ip2(sls::ServerInterface &socket); int set_udp_ip2(sls::ServerInterface &socket);
int set_udp_port(sls::ServerInterface &socket); int set_udp_port(sls::ServerInterface &socket);
int set_udp_port2(sls::ServerInterface &socket); int set_udp_port2(sls::ServerInterface &socket);

View File

@ -175,7 +175,7 @@ class slsDetectorDefs {
struct ROI { struct ROI {
int xmin{-1}; /**< is the roi xmin (in channel number) */ int xmin{-1}; /**< is the roi xmin (in channel number) */
int xmax{-1}; /**< is the roi xmax (in channel number)*/ int xmax{-1}; /**< is the roi xmax (in channel number)*/
}; }__attribute__((packed));
#else #else
typedef struct { typedef struct {
int xmin; /**< is the roi xmin (in channel number) */ int xmin; /**< is the roi xmin (in channel number) */
@ -203,7 +203,7 @@ class slsDetectorDefs {
int y{0}; int y{0};
xy() = default; xy() = default;
xy(int x, int y):x(x),y(y){}; xy(int x, int y):x(x),y(y){};
}; }__attribute__((packed));
#endif #endif
@ -466,7 +466,16 @@ class slsDetectorDefs {
*/ */
struct rxParameters { struct rxParameters {
detectorType detType{GENERIC}; detectorType detType{GENERIC};
xy multiSize;
int detId{0};
char hostname[MAX_STR_LENGTH];
int udpInterfaces{1};
int udp_dstport{0};
uint32_t udp_dstip{0U};
uint64_t udp_dstmac{0LU};
int udp_dstport2{0};
uint32_t udp_dstip2{0U};
uint64_t udp_dstmac2{0LU};
int64_t frames{0}; int64_t frames{0};
int64_t triggers{0}; int64_t triggers{0};
int64_t bursts{0}; int64_t bursts{0};
@ -476,28 +485,17 @@ class slsDetectorDefs {
int64_t periodNs{0}; int64_t periodNs{0};
int64_t subExpTimeNs{0}; int64_t subExpTimeNs{0};
int64_t subDeadTimeNs{0}; int64_t subDeadTimeNs{0};
int activate{0};
int quad{0};
int dynamicRange{16}; int dynamicRange{16};
timingMode timMode{AUTO_TIMING}; timingMode timMode{AUTO_TIMING};
int activate{0};
int tenGiga{0}; int tenGiga{0};
int quad{0};
readoutMode roMode{ANALOG_ONLY}; readoutMode roMode{ANALOG_ONLY};
uint32_t adcMask{0}; uint32_t adcMask{0};
uint32_t adc10gMask{0}; uint32_t adc10gMask{0};
ROI roi; ROI roi;
uint32_t countermask{0}; uint32_t countermask{0};
burstMode burstType{BURST_OFF}; burstMode burstType{BURST_OFF};
int udpInterfaces{1};
int udp_dstport{0};
uint32_t udp_dstip{0U};
uint64_t udp_dstmac{0LU};
int udp_dstport2{0};
uint32_t udp_dstip2{0U};
uint64_t udp_dstmac2{0LU};
}__attribute__((packed)); }__attribute__((packed));
#endif #endif

View File

@ -208,8 +208,6 @@ enum detFuncs{
F_GET_LAST_RECEIVER_CLIENT_IP, F_GET_LAST_RECEIVER_CLIENT_IP,
F_SET_RECEIVER_PORT, F_SET_RECEIVER_PORT,
F_GET_RECEIVER_VERSION, F_GET_RECEIVER_VERSION,
F_SET_RECEIVER_TYPE,
F_SEND_RECEIVER_DETHOSTNAME,
F_RECEIVER_SET_ROI, F_RECEIVER_SET_ROI,
F_RECEIVER_SET_NUM_FRAMES, F_RECEIVER_SET_NUM_FRAMES,
F_SET_RECEIVER_NUM_TRIGGERS, F_SET_RECEIVER_NUM_TRIGGERS,
@ -253,8 +251,6 @@ enum detFuncs{
F_SET_FLIPPED_DATA_RECEIVER, F_SET_FLIPPED_DATA_RECEIVER,
F_SET_RECEIVER_FILE_FORMAT, F_SET_RECEIVER_FILE_FORMAT,
F_GET_RECEIVER_FILE_FORMAT, F_GET_RECEIVER_FILE_FORMAT,
F_SEND_RECEIVER_DETPOSID,
F_SEND_RECEIVER_MULTIDETSIZE,
F_SET_RECEIVER_STREAMING_PORT, F_SET_RECEIVER_STREAMING_PORT,
F_GET_RECEIVER_STREAMING_PORT, F_GET_RECEIVER_STREAMING_PORT,
F_SET_RECEIVER_STREAMING_SRC_IP, F_SET_RECEIVER_STREAMING_SRC_IP,
@ -501,8 +497,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT"; case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION"; case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
case F_SETUP_RECEIVER: return "F_SETUP_RECEIVER"; case F_SETUP_RECEIVER: return "F_SETUP_RECEIVER";
case F_SET_RECEIVER_TYPE: return "F_SET_RECEIVER_TYPE";
case F_SEND_RECEIVER_DETHOSTNAME: return "F_SEND_RECEIVER_DETHOSTNAME";
case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI"; case F_RECEIVER_SET_ROI: return "F_RECEIVER_SET_ROI";
case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES"; case F_RECEIVER_SET_NUM_FRAMES: return "F_RECEIVER_SET_NUM_FRAMES";
case F_SET_RECEIVER_NUM_TRIGGERS: return "F_SET_RECEIVER_NUM_TRIGGERS"; case F_SET_RECEIVER_NUM_TRIGGERS: return "F_SET_RECEIVER_NUM_TRIGGERS";
@ -546,8 +540,6 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER"; case F_SET_FLIPPED_DATA_RECEIVER: return "F_SET_FLIPPED_DATA_RECEIVER";
case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT"; case F_SET_RECEIVER_FILE_FORMAT: return "F_SET_RECEIVER_FILE_FORMAT";
case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT"; case F_GET_RECEIVER_FILE_FORMAT: return "F_GET_RECEIVER_FILE_FORMAT";
case F_SEND_RECEIVER_DETPOSID: return "F_SEND_RECEIVER_DETPOSID";
case F_SEND_RECEIVER_MULTIDETSIZE: return "F_SEND_RECEIVER_MULTIDETSIZE";
case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT"; case F_SET_RECEIVER_STREAMING_PORT: return "F_SET_RECEIVER_STREAMING_PORT";
case F_GET_RECEIVER_STREAMING_PORT: return "F_GET_RECEIVER_STREAMING_PORT"; case F_GET_RECEIVER_STREAMING_PORT: return "F_GET_RECEIVER_STREAMING_PORT";
case F_SET_RECEIVER_STREAMING_SRC_IP: return "F_SET_RECEIVER_STREAMING_SRC_IP"; case F_SET_RECEIVER_STREAMING_SRC_IP: return "F_SET_RECEIVER_STREAMING_SRC_IP";