|
|
|
@ -97,10 +97,7 @@ int slsDetector::checkDetectorVersionCompatibility() {
|
|
|
|
|
detector_shm()->onlineFlag = OFFLINE_FLAG;
|
|
|
|
|
|
|
|
|
|
sendToDetector(fnum, &arg, sizeof(arg), nullptr, 0);
|
|
|
|
|
|
|
|
|
|
auto stop =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->stopPort);
|
|
|
|
|
ret = stop.sendCommandThenRead(fnum, &arg, sizeof(arg), nullptr, 0);
|
|
|
|
|
ret = sendToDetectorStop(fnum, &arg, sizeof(arg), nullptr, 0);
|
|
|
|
|
|
|
|
|
|
// success
|
|
|
|
|
detector_shm()->detectorControlAPIVersion = arg;
|
|
|
|
@ -661,27 +658,19 @@ int slsDetector::setControlPort(int port_number) {
|
|
|
|
|
|
|
|
|
|
int slsDetector::setStopPort(int port_number) {
|
|
|
|
|
int fnum = F_SET_PORT;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting stop port "
|
|
|
|
|
<< " to " << port_number;
|
|
|
|
|
|
|
|
|
|
if (port_number >= 0 && port_number != detector_shm()->stopPort) {
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto stop = DetectorSocket(detector_shm()->hostname,
|
|
|
|
|
detector_shm()->stopPort);
|
|
|
|
|
ret = stop.sendCommandThenRead(fnum, &port_number,
|
|
|
|
|
sizeof(port_number), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToDetectorStop(fnum, &port_number, sizeof(port_number), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
detector_shm()->stopPort = retval;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Stop port: " << retval;
|
|
|
|
|
} else {
|
|
|
|
|
detector_shm()->stopPort = port_number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateDetector();
|
|
|
|
|
}
|
|
|
|
|
return detector_shm()->stopPort;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -694,9 +683,9 @@ int slsDetector::setReceiverPort(int port_number) {
|
|
|
|
|
|
|
|
|
|
if (port_number >= 0 && port_number != detector_shm()->receiverTCPPort) {
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto stop = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = stop.sendCommandThenRead(fnum, &port_number,
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &port_number,
|
|
|
|
|
sizeof(port_number), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
detector_shm()->receiverTCPPort = retval;
|
|
|
|
@ -1706,14 +1695,14 @@ int slsDetector::setDAC(int val, dacIndex index, int mV) {
|
|
|
|
|
<< (mV != 0 ? "mV" : "dac units");
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
sendToDetector(fnum, args, sizeof(args), &retval, sizeof(retval));
|
|
|
|
|
sendToDetector(fnum, args, retval);
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Dac index " << index << ": " << retval
|
|
|
|
|
<< (mV != 0 ? "mV" : "dac units");
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::sendToDetector(int fnum, void *args, size_t args_size,
|
|
|
|
|
int slsDetector::sendToDetector(int fnum, const void *args, size_t args_size,
|
|
|
|
|
void *retval, size_t retval_size) {
|
|
|
|
|
auto client =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->controlPort);
|
|
|
|
@ -1726,11 +1715,14 @@ int slsDetector::sendToDetector(int fnum, void *args, size_t args_size,
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::sendToDetector(int fnum) {
|
|
|
|
|
template <typename Arg, typename Ret>
|
|
|
|
|
typename std::enable_if<
|
|
|
|
|
!(std::is_pointer<Arg>::value & std::is_pointer<Ret>::value), int>::type
|
|
|
|
|
slsDetector::sendToDetector(int fnum, const Arg &args, Ret &retval) {
|
|
|
|
|
auto client =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->controlPort);
|
|
|
|
|
auto ret =
|
|
|
|
|
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
|
|
|
|
auto ret = client.sendCommandThenRead(fnum, &args, sizeof(args), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
client.close();
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
ret = updateDetector();
|
|
|
|
@ -1738,6 +1730,43 @@ int slsDetector::sendToDetector(int fnum) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::sendToDetector(int fnum) {
|
|
|
|
|
auto client =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->controlPort);
|
|
|
|
|
auto ret = client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
|
|
|
|
|
client.close();
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
ret = updateDetector();
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::sendToDetectorStop(int fnum, const void *args, size_t args_size,
|
|
|
|
|
void *retval, size_t retval_size) {
|
|
|
|
|
auto client =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->stopPort);
|
|
|
|
|
auto ret =
|
|
|
|
|
client.sendCommandThenRead(fnum, args, args_size, retval, retval_size);
|
|
|
|
|
client.close();
|
|
|
|
|
//no update on stop port
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::sendToReceiver(int fnum, const void *args, size_t args_size,
|
|
|
|
|
void *retval, size_t retval_size) {
|
|
|
|
|
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
|
|
|
|
|
auto ret = receiver.sendCommandThenRead(fnum, args, args_size, retval,
|
|
|
|
|
args_size);
|
|
|
|
|
receiver.close();
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
ret = updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::getADC(dacIndex index) {
|
|
|
|
|
int fnum = F_GET_ADC;
|
|
|
|
|
int arg = static_cast<int>(index);
|
|
|
|
@ -1800,25 +1829,16 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
|
|
|
|
|
updateTotalNumberOfChannels();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// sending to receiver
|
|
|
|
|
if (ret != FAIL) {
|
|
|
|
|
fnum = F_RECEIVER_SET_READOUT_FLAGS;
|
|
|
|
|
ret = FAIL;
|
|
|
|
|
arg = detector_shm()->roFlags;
|
|
|
|
|
retval = static_cast<readOutFlags>(-1);
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting receiver readout flags to " << arg;
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
fnum = F_RECEIVER_SET_READOUT_FLAGS;
|
|
|
|
|
ret = FAIL;
|
|
|
|
|
arg = detector_shm()->roFlags;
|
|
|
|
|
retval = static_cast<readOutFlags>(-1);
|
|
|
|
|
sendToReceiver(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Receiver readout flag: " << retval;
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return detector_shm()->roFlags;
|
|
|
|
|
}
|
|
|
|
@ -1831,7 +1851,7 @@ uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val) {
|
|
|
|
|
<< "data: 0x" << std::hex << val << std::dec;
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
sendToDetector(fnum, args, sizeof(args), &retval, sizeof(retval));
|
|
|
|
|
sendToDetector(fnum, args, retval);
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Register 0x" << std::hex << addr << ": 0x"
|
|
|
|
|
<< std::hex << retval << std::dec;
|
|
|
|
|
}
|
|
|
|
@ -1839,14 +1859,11 @@ uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint32_t slsDetector::readRegister(uint32_t addr) {
|
|
|
|
|
int fnum = F_READ_REGISTER;
|
|
|
|
|
uint32_t retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Reading register 0x" << std::hex << addr
|
|
|
|
|
<< std::dec;
|
|
|
|
|
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Reading reg 0x" << std::hex << addr << std::dec;
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
sendToDetector(fnum, &addr, sizeof(addr), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Register 0x" << std::hex << addr << ": 0x"
|
|
|
|
|
sendToDetector(F_READ_REGISTER, addr, retval);
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Reg 0x" << std::hex << addr << ": 0x"
|
|
|
|
|
<< std::hex << retval << std::dec;
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
@ -2216,25 +2233,15 @@ int slsDetector::getClientStreamingPort() { return detector_shm()->zmqport; }
|
|
|
|
|
void slsDetector::setReceiverStreamingPort(int port) {
|
|
|
|
|
// copy now else it is lost if rx_hostname not set yet
|
|
|
|
|
detector_shm()->receiver_zmqport = port;
|
|
|
|
|
|
|
|
|
|
int fnum = F_SET_RECEIVER_STREAMING_PORT;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
int arg = detector_shm()->receiver_zmqport;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Sending receiver streaming port to receiver: "
|
|
|
|
|
<< arg;
|
|
|
|
|
|
|
|
|
|
<< port;
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToReceiver(fnum, &port, sizeof(port), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Receiver streaming port: " << retval;
|
|
|
|
|
detector_shm()->receiver_zmqport = retval;
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::getReceiverStreamingPort() {
|
|
|
|
@ -2304,6 +2311,7 @@ void slsDetector::setReceiverStreamingIP(std::string sourceIP) {
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, args, sizeof(args), retvals,
|
|
|
|
|
sizeof(retvals));
|
|
|
|
|
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Receiver streaming port: " << retvals;
|
|
|
|
|
memset(detector_shm()->receiver_zmqip, 0, MAX_STR_LENGTH);
|
|
|
|
|
sls::strcpy_safe(detector_shm()->receiver_zmqip, retvals);
|
|
|
|
@ -2337,9 +2345,8 @@ int slsDetector::setDetectorNetworkParameter(networkParameter index,
|
|
|
|
|
std::string
|
|
|
|
|
slsDetector::setAdditionalJsonHeader(const std::string &jsonheader) {
|
|
|
|
|
int fnum = F_ADDITIONAL_JSON_HEADER;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
char args[MAX_STR_LENGTH] = {0};
|
|
|
|
|
char retvals[MAX_STR_LENGTH] = {0};
|
|
|
|
|
char args[MAX_STR_LENGTH]{};
|
|
|
|
|
char retvals[MAX_STR_LENGTH]{};
|
|
|
|
|
sls::strcpy_safe(args, jsonheader.c_str());
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Sending additional json header " << args;
|
|
|
|
|
|
|
|
|
@ -2347,38 +2354,24 @@ slsDetector::setAdditionalJsonHeader(const std::string &jsonheader) {
|
|
|
|
|
sls::strcpy_safe(detector_shm()->rxAdditionalJsonHeader,
|
|
|
|
|
jsonheader.c_str());
|
|
|
|
|
} else {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, args, sizeof(args), retvals,
|
|
|
|
|
sizeof(retvals));
|
|
|
|
|
sendToReceiver(fnum, args, sizeof(args), retvals, sizeof(retvals));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Additional json header: " << retvals;
|
|
|
|
|
memset(detector_shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH);
|
|
|
|
|
sls::strcpy_safe(detector_shm()->rxAdditionalJsonHeader, retvals);
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
return std::string(detector_shm()->rxAdditionalJsonHeader);
|
|
|
|
|
return detector_shm()->rxAdditionalJsonHeader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string slsDetector::getAdditionalJsonHeader() {
|
|
|
|
|
int fnum = F_GET_ADDITIONAL_JSON_HEADER;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
char retvals[MAX_STR_LENGTH] = {0};
|
|
|
|
|
char retvals[MAX_STR_LENGTH]{};
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Getting additional json header ";
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, nullptr, 0, retvals,
|
|
|
|
|
sizeof(retvals));
|
|
|
|
|
sendToReceiver(fnum, nullptr, 0, retvals, sizeof(retvals));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Additional json header: " << retvals;
|
|
|
|
|
memset(detector_shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH);
|
|
|
|
|
sls::strcpy_safe(detector_shm()->rxAdditionalJsonHeader, retvals);
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
return std::string(detector_shm()->rxAdditionalJsonHeader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2461,7 +2454,6 @@ std::string slsDetector::getAdditionalJsonParameter(const std::string &key) {
|
|
|
|
|
return pairs[1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// return empty string as no match found with key
|
|
|
|
|
return std::string();
|
|
|
|
|
}
|
|
|
|
@ -2493,21 +2485,13 @@ int64_t slsDetector::getReceiverUDPSocketBufferSize() {
|
|
|
|
|
|
|
|
|
|
int64_t slsDetector::getReceiverRealUDPSocketBufferSize() {
|
|
|
|
|
int fnum = F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
int64_t retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Getting real UDP Socket Buffer size to receiver";
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, nullptr, 0, &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToReceiver(fnum, nullptr, 0, &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1)
|
|
|
|
|
<< "Real Receiver UDP Socket Buffer size: " << retval;
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2576,10 +2560,6 @@ int slsDetector::setUDPConnection() {
|
|
|
|
|
<< "Receiver UDP MAC2 returned : " << retvals[1];
|
|
|
|
|
detector_shm()->receiverUDPMAC2 = retvals[1];
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
receiver.close();
|
|
|
|
|
ret = updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
// configure detector with udp details
|
|
|
|
|
if (configureMAC() == FAIL) {
|
|
|
|
|
setReceiverOnline(OFFLINE_FLAG);
|
|
|
|
@ -2587,7 +2567,6 @@ int slsDetector::setUDPConnection() {
|
|
|
|
|
} else {
|
|
|
|
|
throw ReceiverError("setUDPConnection: Receiver is OFFLINE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printReceiverConfiguration(logDEBUG1);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
@ -2869,55 +2848,33 @@ int slsDetector::writeAdcRegister(uint32_t addr, uint32_t val) {
|
|
|
|
|
int slsDetector::activate(int enable) {
|
|
|
|
|
int fnum = F_ACTIVATE;
|
|
|
|
|
int ret = FAIL;
|
|
|
|
|
int arg = enable;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting activate flag to " << arg;
|
|
|
|
|
|
|
|
|
|
// detector
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting activate flag to " << enable;
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
ret = sendToDetector(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
|
|
|
|
|
ret = sendToDetector(fnum, &enable, sizeof(enable), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
|
|
|
|
detector_shm()->activated = static_cast<bool>(retval);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// receiver
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG && ret == OK) {
|
|
|
|
|
fnum = F_RECEIVER_ACTIVATE;
|
|
|
|
|
arg = static_cast<int>(detector_shm()->activated);
|
|
|
|
|
enable = static_cast<int>(detector_shm()->activated);
|
|
|
|
|
retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1)
|
|
|
|
|
<< "Setting activate flag " << arg << " to receiver";
|
|
|
|
|
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
receiver.close();
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
<< "Setting activate flag " << enable << " to receiver";
|
|
|
|
|
sendToReceiver(fnum, &enable, sizeof(enable), &retval, sizeof(retval));
|
|
|
|
|
}
|
|
|
|
|
return static_cast<int>(detector_shm()->activated);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool slsDetector::setDeactivatedRxrPaddingMode(int padding) {
|
|
|
|
|
int fnum = F_RECEIVER_DEACTIVATED_PADDING_ENABLE;
|
|
|
|
|
int ret = OK;
|
|
|
|
|
int arg = padding;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable: " << arg;
|
|
|
|
|
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable: " << padding;
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToReceiver(fnum, &padding, sizeof(padding), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable:" << retval;
|
|
|
|
|
detector_shm()->rxPadDeactivatedModules = static_cast<bool>(retval);
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
return detector_shm()->rxPadDeactivatedModules;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2971,19 +2928,12 @@ int slsDetector::setAllTrimbits(int val) {
|
|
|
|
|
int slsDetector::enableGapPixels(int val) {
|
|
|
|
|
if (val >= 0) {
|
|
|
|
|
int fnum = F_ENABLE_GAPPIXELS_IN_RECEIVER;
|
|
|
|
|
int ret = OK;
|
|
|
|
|
int arg = val;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << arg;
|
|
|
|
|
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << val;
|
|
|
|
|
if (detector_shm()->receiverOnlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto receiver = ReceiverSocket(detector_shm()->receiver_hostname,
|
|
|
|
|
detector_shm()->receiverTCPPort);
|
|
|
|
|
ret = receiver.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToReceiver(fnum, &val, sizeof(val), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Gap pixels enable to receiver:" << retval;
|
|
|
|
|
detector_shm()->gappixels = retval;
|
|
|
|
|
|
|
|
|
|
// update databytes
|
|
|
|
|
detector_shm()->dataBytesInclGapPixels = 0;
|
|
|
|
|
if (detector_shm()->dynamicRange != 4) {
|
|
|
|
@ -2997,9 +2947,6 @@ int slsDetector::enableGapPixels(int val) {
|
|
|
|
|
detector_shm()->dynamicRange / 8;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (ret == FORCE_UPDATE) {
|
|
|
|
|
updateCachedReceiverVariables();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return detector_shm()->gappixels;
|
|
|
|
|
}
|
|
|
|
@ -3066,51 +3013,33 @@ int slsDetector::pulseChip(int n) {
|
|
|
|
|
|
|
|
|
|
int slsDetector::setThresholdTemperature(int val) {
|
|
|
|
|
int fnum = F_THRESHOLD_TEMP;
|
|
|
|
|
int arg = val;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting threshold temperature to " << val;
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto stop =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->stopPort);
|
|
|
|
|
stop.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToDetectorStop(fnum, &val, sizeof(val), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Threshold temperature: " << retval;
|
|
|
|
|
// no updateDetector as it is stop server
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::setTemperatureControl(int val) {
|
|
|
|
|
int fnum = F_TEMP_CONTROL;
|
|
|
|
|
int arg = val;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting temperature control to " << val;
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto stop =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->stopPort);
|
|
|
|
|
stop.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToDetectorStop(fnum, &val, sizeof(val), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Temperature control: " << retval;
|
|
|
|
|
// no updateDetector as it is stop server
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int slsDetector::setTemperatureEvent(int val) {
|
|
|
|
|
int fnum = F_TEMP_EVENT;
|
|
|
|
|
int arg = val;
|
|
|
|
|
int retval = -1;
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Setting temperature event to " << val;
|
|
|
|
|
|
|
|
|
|
if (detector_shm()->onlineFlag == ONLINE_FLAG) {
|
|
|
|
|
auto stop =
|
|
|
|
|
DetectorSocket(detector_shm()->hostname, detector_shm()->stopPort);
|
|
|
|
|
stop.sendCommandThenRead(fnum, &arg, sizeof(arg), &retval,
|
|
|
|
|
sizeof(retval));
|
|
|
|
|
sendToDetectorStop(fnum, &val, sizeof(val), &retval, sizeof(retval));
|
|
|
|
|
FILE_LOG(logDEBUG1) << "Temperature event: " << retval;
|
|
|
|
|
// no updateDetector as it is stop server
|
|
|
|
|
}
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|