mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-09 11:30:43 +02:00
Merge pull request #92 from slsdetectorgroup/setrxhostname
Setrxhostname
This commit is contained in:
commit
a7f5300455
Binary file not shown.
Binary file not shown.
@ -759,7 +759,7 @@ int64_t getSubExpTime() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDeadTime(int64_t val) {
|
int setSubDeadTime(int64_t val) {
|
||||||
LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val));
|
LOG(logINFO, ("Setting subdeadtime %lld ns\n", (long long int)val));
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
// get subexptime
|
// get subexptime
|
||||||
@ -781,7 +781,7 @@ int setDeadTime(int64_t val) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getDeadTime() {
|
int64_t getSubDeadTime() {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
// get subexptime
|
// get subexptime
|
||||||
int64_t subexptime = Feb_Control_GetSubFrameExposureTime();
|
int64_t subexptime = Feb_Control_GetSubFrameExposureTime();
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -52,12 +52,11 @@ int Server_VerifyLock();
|
|||||||
* Server sends result to client (also set ret to force_update if different clients)
|
* Server sends result to client (also set ret to force_update if different clients)
|
||||||
* @param fileDes file descriptor for the socket
|
* @param fileDes file descriptor for the socket
|
||||||
* @param itype 32 or 64 or others to determine to swap data from big endian to little endian
|
* @param itype 32 or 64 or others to determine to swap data from big endian to little endian
|
||||||
* @param update 1 if one must update if different clients, else 0
|
|
||||||
* @param retval pointer to result
|
* @param retval pointer to result
|
||||||
* @param retvalSize size of result
|
* @param retvalSize size of result
|
||||||
* @returns result of operation
|
* @returns result of operation
|
||||||
*/
|
*/
|
||||||
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize);
|
int Server_SendResult(int fileDes, intType itype, void* retval, int retvalSize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert mac address from integer to char array
|
* Convert mac address from integer to char array
|
||||||
|
@ -206,8 +206,8 @@ int64_t getBurstPeriod();
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int setSubExpTime(int64_t val);
|
int setSubExpTime(int64_t val);
|
||||||
int64_t getSubExpTime();
|
int64_t getSubExpTime();
|
||||||
int setDeadTime(int64_t val);
|
int setSubDeadTime(int64_t val);
|
||||||
int64_t getDeadTime();
|
int64_t getSubDeadTime();
|
||||||
int64_t getMeasuredPeriod();
|
int64_t getMeasuredPeriod();
|
||||||
int64_t getMeasuredSubPeriod();
|
int64_t getMeasuredSubPeriod();
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,4 +216,5 @@ int get_timing_source(int);
|
|||||||
int set_timing_source(int);
|
int set_timing_source(int);
|
||||||
int get_num_channels(int);
|
int get_num_channels(int);
|
||||||
int update_rate_correction(int);
|
int update_rate_correction(int);
|
||||||
|
int get_receiver_parameters(int);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ int Server_VerifyLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize) {
|
int Server_SendResult(int fileDes, intType itype, void* retval, int retvalSize) {
|
||||||
|
|
||||||
// send success of operation
|
// send success of operation
|
||||||
int ret1 = ret;
|
int ret1 = ret;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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_GET_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,81 +1515,78 @@ std::string Module::setReceiverHostname(const std::string &receiverIP) {
|
|||||||
shm()->useReceiverFlag = true;
|
shm()->useReceiverFlag = true;
|
||||||
checkReceiverVersionCompatibility();
|
checkReceiverVersionCompatibility();
|
||||||
|
|
||||||
if (setDetectorType(shm()->myDetectorType) != GENERIC) {
|
// populate parameters from detector
|
||||||
sendMultiDetectorSize();
|
rxParameters retval;
|
||||||
setDetectorId();
|
sendToDetector(F_GET_RECEIVER_PARAMETERS, nullptr, retval);
|
||||||
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);
|
// populate from shared memory
|
||||||
setNumberOfFrames(getNumberOfFrames());
|
retval.detType = shm()->myDetectorType;
|
||||||
setNumberOfTriggers(getNumberOfTriggers());
|
retval.multiSize.x = shm()->multiSize.x;
|
||||||
setTimingMode(getTimingMode());
|
retval.multiSize.y = shm()->multiSize.y;
|
||||||
setExptime(getExptime());
|
retval.detId = detId;
|
||||||
setPeriod(getPeriod());
|
memset(retval.hostname, 0, sizeof(retval.hostname));
|
||||||
|
strcpy_safe(retval.hostname, shm()->hostname);
|
||||||
|
|
||||||
// detector specific
|
LOG(logDEBUG1)
|
||||||
switch (shm()->myDetectorType) {
|
<< "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;
|
||||||
|
|
||||||
case EIGER:
|
|
||||||
setSubExptime(getSubExptime());
|
|
||||||
setSubDeadTime(getSubDeadTime());
|
|
||||||
setDynamicRange(getDynamicRange());
|
|
||||||
activate(-1);
|
|
||||||
enableTenGigabitEthernet(-1);
|
|
||||||
setQuad(getQuad());
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CHIPTESTBOARD:
|
sls::MacAddr retvals[2];
|
||||||
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
|
sendToReceiver(F_SETUP_RECEIVER, retval, retvals);
|
||||||
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
|
// update detectors with dest mac
|
||||||
enableTenGigabitEthernet(-1);
|
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||||
setReadoutMode(getReadoutMode());
|
LOG(logINFO) << "Setting destination udp mac of "
|
||||||
setADCEnableMask(getADCEnableMask());
|
"detector " << detId << " to " << retvals[0];
|
||||||
setTenGigaADCEnableMask(getTenGigaADCEnableMask());
|
sendToDetector(F_SET_DEST_UDP_MAC, retvals[0], nullptr);
|
||||||
break;
|
}
|
||||||
|
if (retval.udp_dstmac2 == 0 && retvals[1] != 0) {
|
||||||
case MOENCH:
|
LOG(logINFO) << "Setting destination udp mac2 of "
|
||||||
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
|
"detector " << detId << " to " << retvals[1];
|
||||||
enableTenGigabitEthernet(-1);
|
sendToDetector(F_SET_DEST_UDP_MAC2, retvals[1], nullptr);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::string(shm()->rxHostname);
|
// 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Module::getReceiverHostname() const {
|
std::string Module::getReceiverHostname() const {
|
||||||
@ -1706,13 +1681,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) {
|
||||||
@ -1736,13 +1704,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) {
|
||||||
@ -2887,38 +2848,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)");
|
||||||
@ -3463,10 +3392,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;
|
||||||
|
@ -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,10 +640,10 @@ 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();
|
||||||
/**
|
/**
|
||||||
* Returns the receiver IP address\sa sharedSlsDetector
|
* Returns the receiver IP address\sa sharedSlsDetector
|
||||||
* @returns the receiver IP address
|
* @returns the receiver IP address
|
||||||
@ -721,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)
|
||||||
@ -743,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
|
||||||
@ -1344,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();
|
||||||
@ -1606,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();
|
||||||
|
|
||||||
|
@ -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_GET_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(logDEBUG1)
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
@ -460,6 +460,44 @@ class slsDetectorDefs {
|
|||||||
TIMING_EXTERNAL
|
TIMING_EXTERNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
/**
|
||||||
|
* structure to udpate receiver
|
||||||
|
*/
|
||||||
|
struct rxParameters {
|
||||||
|
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 triggers{0};
|
||||||
|
int64_t bursts{0};
|
||||||
|
int analogSamples{0};
|
||||||
|
int digitalSamples{0};
|
||||||
|
int64_t expTimeNs{0};
|
||||||
|
int64_t periodNs{0};
|
||||||
|
int64_t subExpTimeNs{0};
|
||||||
|
int64_t subDeadTimeNs{0};
|
||||||
|
int activate{0};
|
||||||
|
int quad{0};
|
||||||
|
int dynamicRange{16};
|
||||||
|
timingMode timMode{AUTO_TIMING};
|
||||||
|
int tenGiga{0};
|
||||||
|
readoutMode roMode{ANALOG_ONLY};
|
||||||
|
uint32_t adcMask{0};
|
||||||
|
uint32_t adc10gMask{0};
|
||||||
|
ROI roi;
|
||||||
|
uint32_t countermask{0};
|
||||||
|
burstMode burstType{BURST_OFF};
|
||||||
|
}__attribute__((packed));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
protected:
|
protected:
|
||||||
|
@ -197,6 +197,7 @@ enum detFuncs{
|
|||||||
F_SET_TIMING_SOURCE,
|
F_SET_TIMING_SOURCE,
|
||||||
F_GET_NUM_CHANNELS,
|
F_GET_NUM_CHANNELS,
|
||||||
F_UPDATE_RATE_CORRECTION,
|
F_UPDATE_RATE_CORRECTION,
|
||||||
|
F_GET_RECEIVER_PARAMETERS,
|
||||||
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||||
@ -207,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_GET_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,
|
||||||
@ -252,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,
|
||||||
@ -293,6 +290,7 @@ enum detFuncs{
|
|||||||
F_SET_ADDITIONAL_JSON_PARAMETER,
|
F_SET_ADDITIONAL_JSON_PARAMETER,
|
||||||
F_GET_ADDITIONAL_JSON_PARAMETER,
|
F_GET_ADDITIONAL_JSON_PARAMETER,
|
||||||
F_GET_RECEIVER_PROGRESS,
|
F_GET_RECEIVER_PROGRESS,
|
||||||
|
F_SETUP_RECEIVER,
|
||||||
|
|
||||||
NUM_REC_FUNCTIONS
|
NUM_REC_FUNCTIONS
|
||||||
};
|
};
|
||||||
@ -487,6 +485,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
case F_SET_TIMING_SOURCE: return "F_SET_TIMING_SOURCE";
|
||||||
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
case F_GET_NUM_CHANNELS: return "F_GET_NUM_CHANNELS";
|
||||||
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
case F_UPDATE_RATE_CORRECTION: return "F_UPDATE_RATE_CORRECTION";
|
||||||
|
case F_GET_RECEIVER_PARAMETERS: return "F_GET_RECEIVER_PARAMETERS";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
@ -497,8 +496,7 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
|
case F_GET_LAST_RECEIVER_CLIENT_IP: return "F_GET_LAST_RECEIVER_CLIENT_IP";
|
||||||
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
|
case F_SET_RECEIVER_PORT: return "F_SET_RECEIVER_PORT";
|
||||||
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
|
case F_GET_RECEIVER_VERSION: return "F_GET_RECEIVER_VERSION";
|
||||||
case F_GET_RECEIVER_TYPE: return "F_GET_RECEIVER_TYPE";
|
case F_SETUP_RECEIVER: return "F_SETUP_RECEIVER";
|
||||||
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";
|
||||||
@ -542,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";
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/** API versions */
|
/** API versions */
|
||||||
#define GITBRANCH "removeshm"
|
#define GITBRANCH "setrxhostname"
|
||||||
#define APILIB 0x200402
|
#define APILIB 0x200409
|
||||||
#define APIRECEIVER 0x200402
|
#define APIRECEIVER 0x200409
|
||||||
#define APIGUI 0x200331
|
#define APIGUI 0x200409
|
||||||
#define APICTB 0x200407
|
#define APIEIGER 0x200409
|
||||||
#define APIGOTTHARD 0x200407
|
#define APICTB 0x200409
|
||||||
#define APIGOTTHARD2 0x200407
|
#define APIGOTTHARD 0x200409
|
||||||
#define APIJUNGFRAU 0x200407
|
#define APIGOTTHARD2 0x200409
|
||||||
#define APIMYTHEN3 0x200407
|
#define APIJUNGFRAU 0x200409
|
||||||
#define APIMOENCH 0x200407
|
#define APIMYTHEN3 0x200409
|
||||||
#define APIEIGER 0x200408
|
#define APIMOENCH 0x200409
|
||||||
|
Loading…
x
Reference in New Issue
Block a user