mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 14:38:14 +02:00
merge fix
This commit is contained in:
parent
f2b8aa9dbd
commit
5508f0135d
@ -211,7 +211,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** int or enum */
|
/** int or enum */
|
||||||
#define INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
#define INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
|
||||||
|
HLPSTR) \
|
||||||
std::string CMDNAME(const int action) { \
|
std::string CMDNAME(const int action) { \
|
||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
@ -236,7 +237,8 @@
|
|||||||
return os.str(); \
|
return os.str(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, HLPSTR) \
|
#define INTEGER_COMMAND_VEC_ID_P_RX_SINGLE_ID(CMDNAME, GETFCN, SETFCN, CONV, \
|
||||||
|
HLPSTR) \
|
||||||
std::string CMDNAME(const int action) { \
|
std::string CMDNAME(const int action) { \
|
||||||
std::ostringstream os; \
|
std::ostringstream os; \
|
||||||
os << cmd << ' '; \
|
os << cmd << ' '; \
|
||||||
@ -1352,7 +1354,7 @@ class CmdProxy {
|
|||||||
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
||||||
"does not handle.");
|
"does not handle.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID_GET(
|
INTEGER_COMMAND_VEC_ID_PUT_SINGLE_ID(
|
||||||
master, getMaster, setMaster, StringTo<int>,
|
master, getMaster, setMaster, StringTo<int>,
|
||||||
"[0, 1]\n\t[Eiger] Sets half module to master and "
|
"[0, 1]\n\t[Eiger] Sets half module to master and "
|
||||||
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
||||||
|
@ -1115,6 +1115,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sls::IpAddr Module::getDestinationUDPIP2(const int rxIndex) const {
|
sls::IpAddr Module::getDestinationUDPIP2(const int rxIndex) const {
|
||||||
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
if (rxIndex < 0 || rxIndex >= MAX_UDP_DESTINATION) {
|
||||||
@ -1135,8 +1136,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ip.str() == LOCALHOST_IP && !isVirtualDetectorServer()) {
|
if (ip.str() == LOCALHOST_IP && !isVirtualDetectorServer()) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Invalid destination udp ip2. Change rx_hostname "
|
||||||
"Invalid destination udp ip2. Change rx_hostname "
|
|
||||||
"from localhost or change udp_dstip from auto?");
|
"from localhost or change udp_dstip from auto?");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1152,11 +1152,10 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
sls::MacAddr retval(0LU);
|
sls::MacAddr retval(0LU);
|
||||||
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_IP2, ip,
|
sendToReceiver(entries[iEntry], F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||||
retval);
|
LOG(logINFO) << "Setting destination udp mac2 of Module "
|
||||||
LOG(logINFO)
|
<< moduleIndex << ", " << entries[iEntry] << "] to "
|
||||||
<< "Setting destination udp mac2 of Module " << moduleIndex
|
<< retval;
|
||||||
<< ", " << entries[iEntry] << "] to " << retval;
|
|
||||||
if (entries[iEntry] == 0) {
|
if (entries[iEntry] == 0) {
|
||||||
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
sendToDetector(F_SET_DEST_UDP_MAC2, retval, nullptr);
|
||||||
} else {
|
} else {
|
||||||
@ -1280,9 +1279,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::reconfigureUDPDestination() {
|
void Module::reconfigureUDPDestination() { sendToDetector(F_RECONFIGURE_UDP); }
|
||||||
sendToDetector(F_RECONFIGURE_UDP);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::validateUDPConfiguration() {
|
void Module::validateUDPConfiguration() {
|
||||||
sendToDetector(F_VALIDATE_UDP_CONFIG);
|
sendToDetector(F_VALIDATE_UDP_CONFIG);
|
||||||
@ -1292,9 +1289,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
std::vector<int> entries = getEntryList(rxIndex);
|
std::vector<int> entries = getEntryList(rxIndex);
|
||||||
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
for (int iEntry = 0; iEntry != (int)entries.size(); ++iEntry) {
|
||||||
os << "\n\nModule " << moduleIndex << "\nReceiver ["
|
os << "\n\nModule " << moduleIndex << "\nReceiver [" << entries[iEntry]
|
||||||
<< entries[iEntry] << "] Hostname:\t"
|
<< "] Hostname:\t" << getReceiverHostname(entries[iEntry]);
|
||||||
<< getReceiverHostname(entries[iEntry]);
|
|
||||||
|
|
||||||
if (shm()->detType == JUNGFRAU) {
|
if (shm()->detType == JUNGFRAU) {
|
||||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||||
@ -1302,9 +1298,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
auto t = getDestinationUDPList(entries[iEntry]);
|
auto t = getDestinationUDPList(entries[iEntry]);
|
||||||
|
|
||||||
os << "\nSource UDP IP:\t" << getSourceUDPIP()
|
os << "\nSource UDP IP:\t" << getSourceUDPIP() << "\nSource UDP MAC:\t"
|
||||||
<< "\nSource UDP MAC:\t" << getSourceUDPMAC()
|
<< getSourceUDPMAC() << "\nDestination UDP IP:\t" << t.ip
|
||||||
<< "\nDestination UDP IP:\t" << t.ip
|
|
||||||
<< "\nDestination UDP MAC:\t" << t.mac;
|
<< "\nDestination UDP MAC:\t" << t.mac;
|
||||||
|
|
||||||
if (shm()->detType == JUNGFRAU) {
|
if (shm()->detType == JUNGFRAU) {
|
||||||
@ -1378,8 +1373,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
return std::string(shm()->receivers[rxIndex].hostname);
|
return std::string(shm()->receivers[rxIndex].hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setAllReceiverHostnames(
|
void Module::setAllReceiverHostnames(const std::vector<std::string> &receiver) {
|
||||||
const std::vector<std::string> &receiver) {
|
|
||||||
if (receiver.size() == 1) {
|
if (receiver.size() == 1) {
|
||||||
setReceiverHostname(receiver[0], 0);
|
setReceiverHostname(receiver[0], 0);
|
||||||
} else {
|
} else {
|
||||||
@ -1494,8 +1488,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
int Module::getReceiverFifoDepth() const {
|
int Module::getReceiverFifoDepth() const {
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
return sendToReceiver<int>(rxIndex, F_SET_RECEIVER_FIFO_DEPTH,
|
return sendToReceiver<int>(rxIndex, F_SET_RECEIVER_FIFO_DEPTH, GET_FLAG);
|
||||||
GET_FLAG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverFifoDepth(int n_frames) {
|
void Module::setReceiverFifoDepth(int n_frames) {
|
||||||
@ -1514,17 +1507,17 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
static_cast<int>(enable), nullptr);
|
static_cast<int>(enable), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::frameDiscardPolicy Module::getReceiverFramesDiscardPolicy()
|
slsDetectorDefs::frameDiscardPolicy
|
||||||
const {
|
Module::getReceiverFramesDiscardPolicy() const {
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
return sendToReceiver<frameDiscardPolicy>(
|
return sendToReceiver<frameDiscardPolicy>(rxIndex,
|
||||||
rxIndex, F_GET_RECEIVER_DISCARD_POLICY);
|
F_GET_RECEIVER_DISCARD_POLICY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) {
|
void Module::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DISCARD_POLICY,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_DISCARD_POLICY, static_cast<int>(f),
|
||||||
static_cast<int>(f), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getPartialFramesPadding() const {
|
bool Module::getPartialFramesPadding() const {
|
||||||
@ -1534,8 +1527,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setPartialFramesPadding(bool padding) {
|
void Module::setPartialFramesPadding(bool padding) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_PADDING,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_PADDING, static_cast<int>(padding),
|
||||||
static_cast<int>(padding), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverUDPSocketBufferSize() const {
|
int Module::getReceiverUDPSocketBufferSize() const {
|
||||||
@ -1551,8 +1544,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
|
void Module::setReceiverUDPSocketBufferSize(int udpsockbufsize) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver<int>(rxIndex, F_RECEIVER_UDP_SOCK_BUF_SIZE,
|
sendToReceiver<int>(rxIndex, F_RECEIVER_UDP_SOCK_BUF_SIZE, udpsockbufsize);
|
||||||
udpsockbufsize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getReceiverLock() const {
|
bool Module::getReceiverLock() const {
|
||||||
@ -1567,8 +1559,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
sls::IpAddr Module::getReceiverLastClientIP() const {
|
sls::IpAddr Module::getReceiverLastClientIP() const {
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
return sendToReceiver<sls::IpAddr>(rxIndex,
|
return sendToReceiver<sls::IpAddr>(rxIndex, F_GET_LAST_RECEIVER_CLIENT_IP);
|
||||||
F_GET_LAST_RECEIVER_CLIENT_IP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
||||||
@ -1578,11 +1569,13 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getRxArping() const {
|
bool Module::getRxArping() const {
|
||||||
return sendToReceiver<int>(F_GET_RECEIVER_ARPING);
|
const int rxIndex = 0;
|
||||||
|
return sendToReceiver<int>(rxIndex, F_GET_RECEIVER_ARPING);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setRxArping(bool enable) {
|
void Module::setRxArping(bool enable) {
|
||||||
sendToReceiver(F_SET_RECEIVER_ARPING, static_cast<int>(enable),
|
const int rxIndex = -1;
|
||||||
|
sendToReceiver(rxIndex, F_SET_RECEIVER_ARPING, static_cast<int>(enable),
|
||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1653,8 +1646,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setFileWrite(bool value) {
|
void Module::setFileWrite(bool value) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_WRITE,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_WRITE, static_cast<int>(value),
|
||||||
static_cast<int>(value), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getMasterFileWrite() const {
|
bool Module::getMasterFileWrite() const {
|
||||||
@ -1675,8 +1668,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setFileOverWrite(bool value) {
|
void Module::setFileOverWrite(bool value) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_OVERWRITE,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_OVERWRITE, static_cast<int>(value),
|
||||||
static_cast<int>(value), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getFramesPerFile() const {
|
int Module::getFramesPerFile() const {
|
||||||
@ -1686,8 +1679,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setFramesPerFile(int n_frames) {
|
void Module::setFramesPerFile(int n_frames) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FRAMES_PER_FILE, n_frames,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZMQ Streaming Parameters (Receiver<->Client)
|
// ZMQ Streaming Parameters (Receiver<->Client)
|
||||||
@ -1699,8 +1691,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setReceiverStreaming(bool enable) {
|
void Module::setReceiverStreaming(bool enable) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING, static_cast<int>(enable),
|
||||||
static_cast<int>(enable), nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverStreamingFrequency() const {
|
int Module::getReceiverStreamingFrequency() const {
|
||||||
@ -1714,14 +1706,12 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
std::to_string(freq));
|
std::to_string(freq));
|
||||||
}
|
}
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_FREQUENCY, freq,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_FREQUENCY, freq, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverStreamingTimer() const {
|
int Module::getReceiverStreamingTimer() const {
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
return sendToReceiver<int>(rxIndex, F_RECEIVER_STREAMING_TIMER,
|
return sendToReceiver<int>(rxIndex, F_RECEIVER_STREAMING_TIMER, GET_FLAG);
|
||||||
GET_FLAG);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverStreamingTimer(int time_in_ms) {
|
void Module::setReceiverStreamingTimer(int time_in_ms) {
|
||||||
@ -1731,8 +1721,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
int Module::getReceiverStreamingStartingFrame() const {
|
int Module::getReceiverStreamingStartingFrame() const {
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
return sendToReceiver<int>(rxIndex,
|
return sendToReceiver<int>(rxIndex, F_GET_RECEIVER_STREAMING_START_FNUM);
|
||||||
F_GET_RECEIVER_STREAMING_START_FNUM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverStreamingStartingFrame(int fnum) {
|
void Module::setReceiverStreamingStartingFrame(int fnum) {
|
||||||
@ -1741,8 +1730,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
std::to_string(fnum));
|
std::to_string(fnum));
|
||||||
}
|
}
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_START_FNUM, fnum,
|
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_START_FNUM, fnum, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReceiverStreamingPort() const {
|
int Module::getReceiverStreamingPort() const {
|
||||||
@ -1763,8 +1751,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
F_GET_RECEIVER_STREAMING_SRC_IP);
|
F_GET_RECEIVER_STREAMING_SRC_IP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setReceiverStreamingIP(const sls::IpAddr ip,
|
void Module::setReceiverStreamingIP(const sls::IpAddr ip, const int rxIndex) {
|
||||||
const int rxIndex) {
|
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
throw RuntimeError("Invalid receiver zmq ip address");
|
throw RuntimeError("Invalid receiver zmq ip address");
|
||||||
}
|
}
|
||||||
@ -1831,8 +1818,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sendToDetector(F_SET_SUB_DEADTIME, value, nullptr);
|
sendToDetector(F_SET_SUB_DEADTIME, value, nullptr);
|
||||||
if (shm()->useReceiverFlag) {
|
if (shm()->useReceiverFlag) {
|
||||||
const int rxIndex = -1;
|
const int rxIndex = -1;
|
||||||
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_DEADTIME, value,
|
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1858,8 +1844,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
||||||
LOG(logDEBUG) << "Sending to receiver 0 [rate corrections: "
|
LOG(logDEBUG) << "Sending to receiver 0 [rate corrections: " << ToString(t)
|
||||||
<< ToString(t) << ']';
|
<< ']';
|
||||||
// only to master receiver
|
// only to master receiver
|
||||||
auto receiver = ReceiverSocket(shm()->receivers[0].hostname,
|
auto receiver = ReceiverSocket(shm()->receivers[0].hostname,
|
||||||
shm()->receivers[0].tcpPort);
|
shm()->receivers[0].tcpPort);
|
||||||
@ -1867,8 +1853,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
receiver.Send(static_cast<int>(t.size()));
|
receiver.Send(static_cast<int>(t.size()));
|
||||||
receiver.Send(t);
|
receiver.Send(t);
|
||||||
if (receiver.Receive<int>() == FAIL) {
|
if (receiver.Receive<int>() == FAIL) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||||
"Receiver " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + receiver.readErrorMessage());
|
" returned error: " + receiver.readErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1878,8 +1863,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::setInterruptSubframe(const bool enable) {
|
void Module::setInterruptSubframe(const bool enable) {
|
||||||
sendToDetector(F_SET_INTERRUPT_SUBFRAME, static_cast<int>(enable),
|
sendToDetector(F_SET_INTERRUPT_SUBFRAME, static_cast<int>(enable), nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t Module::getMeasuredPeriod() const {
|
int64_t Module::getMeasuredPeriod() const {
|
||||||
@ -1913,8 +1897,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getCounterBit() const {
|
bool Module::getCounterBit() const {
|
||||||
return (!static_cast<bool>(
|
return (
|
||||||
sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
|
!static_cast<bool>(sendToDetector<int>(F_SET_COUNTER_BIT, GET_FLAG)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setCounterBit(bool cb) {
|
void Module::setCounterBit(bool cb) {
|
||||||
@ -1935,9 +1919,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sendToDetector(F_PULSE_CHIP, n_pulses, nullptr);
|
sendToDetector(F_PULSE_CHIP, n_pulses, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getQuad() const {
|
bool Module::getQuad() const { return sendToDetector<int>(F_GET_QUAD) != 0; }
|
||||||
return sendToDetector<int>(F_GET_QUAD) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setQuad(const bool enable) {
|
void Module::setQuad(const bool enable) {
|
||||||
int value = enable ? 1 : 0;
|
int value = enable ? 1 : 0;
|
||||||
@ -2125,14 +2107,13 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
const std::vector<int> &values) {
|
const std::vector<int> &values) {
|
||||||
const int nch = gainIndices.size();
|
const int nch = gainIndices.size();
|
||||||
if (gainIndices.size() != values.size()) {
|
if (gainIndices.size() != values.size()) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Number of Gain Indices and values do not match! "
|
||||||
"Number of Gain Indices and values do not match! "
|
|
||||||
"Gain Indices size: " +
|
"Gain Indices size: " +
|
||||||
std::to_string(gainIndices.size()) +
|
std::to_string(gainIndices.size()) +
|
||||||
", values size: " + std::to_string(values.size()));
|
", values size: " + std::to_string(values.size()));
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1) << "Sending veto photon/file to detector [chip:"
|
LOG(logDEBUG1) << "Sending veto photon/file to detector [chip:" << chipIndex
|
||||||
<< chipIndex << ", nch:" << nch << "]";
|
<< ", nch:" << nch << "]";
|
||||||
|
|
||||||
const int args[]{chipIndex, nch};
|
const int args[]{chipIndex, nch};
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
@ -2141,29 +2122,27 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
client.Send(gainIndices);
|
client.Send(gainIndices);
|
||||||
client.Send(values);
|
client.Send(values);
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw DetectorError(
|
throw DetectorError("Detector " + std::to_string(moduleIndex) +
|
||||||
"Detector " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::getVetoPhoton(const int chipIndex, const std::string &fname)
|
void Module::getVetoPhoton(const int chipIndex,
|
||||||
const {
|
const std::string &fname) const {
|
||||||
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]\n";
|
LOG(logDEBUG1) << "Getting veto photon [" << chipIndex << "]\n";
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
client.Send(F_GET_VETO_PHOTON);
|
client.Send(F_GET_VETO_PHOTON);
|
||||||
client.Send(chipIndex);
|
client.Send(chipIndex);
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw DetectorError(
|
throw DetectorError("Detector " + std::to_string(moduleIndex) +
|
||||||
"Detector " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nch = client.Receive<int>();
|
auto nch = client.Receive<int>();
|
||||||
if (nch != shm()->nChan.x) {
|
if (nch != shm()->nChan.x) {
|
||||||
throw DetectorError("Could not get veto photon. Expected " +
|
throw DetectorError("Could not get veto photon. Expected " +
|
||||||
std::to_string(shm()->nChan.x) +
|
std::to_string(shm()->nChan.x) + " channels, got " +
|
||||||
" channels, got " + std::to_string(nch));
|
std::to_string(nch));
|
||||||
}
|
}
|
||||||
std::vector<int> gainIndices(nch);
|
std::vector<int> gainIndices(nch);
|
||||||
std::vector<int> values(nch);
|
std::vector<int> values(nch);
|
||||||
@ -2188,8 +2167,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
"Set Veto reference is not implemented for this detector");
|
"Set Veto reference is not implemented for this detector");
|
||||||
}
|
}
|
||||||
if (chipIndex < -1 || chipIndex >= shm()->nChip.x) {
|
if (chipIndex < -1 || chipIndex >= shm()->nChip.x) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Could not set veto photon. Invalid chip index: " +
|
||||||
"Could not set veto photon. Invalid chip index: " +
|
|
||||||
std::to_string(chipIndex));
|
std::to_string(chipIndex));
|
||||||
}
|
}
|
||||||
if (numPhotons < 1) {
|
if (numPhotons < 1) {
|
||||||
@ -2203,8 +2181,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
std::ifstream infile(fname.c_str());
|
std::ifstream infile(fname.c_str());
|
||||||
if (!infile) {
|
if (!infile) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Could not set veto photon. Could not open file: " +
|
||||||
"Could not set veto photon. Could not open file: " + fname);
|
fname);
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1) << "Setting veto photon. Reading Gain values from file";
|
LOG(logDEBUG1) << "Setting veto photon. Reading Gain values from file";
|
||||||
|
|
||||||
@ -2228,11 +2206,10 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
double gainValue[3] = {-1, -1, -1};
|
double gainValue[3] = {-1, -1, -1};
|
||||||
int gainThreshold[2] = {-1, -1};
|
int gainThreshold[2] = {-1, -1};
|
||||||
ss >> gainPedestal[0] >> gainPedestal[1] >> gainPedestal[2] >>
|
ss >> gainPedestal[0] >> gainPedestal[1] >> gainPedestal[2] >>
|
||||||
gainValue[0] >> gainValue[1] >> gainValue[2] >>
|
gainValue[0] >> gainValue[1] >> gainValue[2] >> gainThreshold[0] >>
|
||||||
gainThreshold[0] >> gainThreshold[1];
|
gainThreshold[1];
|
||||||
if (ss.fail()) {
|
if (ss.fail()) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Could not set veto photon. Invalid pedestals, "
|
||||||
"Could not set veto photon. Invalid pedestals, "
|
|
||||||
"gain values or gain thresholds for channel " +
|
"gain values or gain thresholds for channel " +
|
||||||
std::to_string(gainIndices.size()));
|
std::to_string(gainIndices.size()));
|
||||||
}
|
}
|
||||||
@ -2305,9 +2282,9 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
try {
|
try {
|
||||||
value = StringTo<int>(val);
|
value = StringTo<int>(val);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Could not set veto file. Invalid value " +
|
||||||
"Could not set veto file. Invalid value " + val +
|
val + " for channel " +
|
||||||
" for channel " + std::to_string(gainIndices.size()));
|
std::to_string(gainIndices.size()));
|
||||||
}
|
}
|
||||||
gainIndices.push_back(gainIndex);
|
gainIndices.push_back(gainIndex);
|
||||||
values.push_back(value);
|
values.push_back(value);
|
||||||
@ -2336,9 +2313,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Module::getCDSGain() const {
|
bool Module::getCDSGain() const { return sendToDetector<int>(F_GET_CDS_GAIN); }
|
||||||
return sendToDetector<int>(F_GET_CDS_GAIN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setCDSGain(bool value) {
|
void Module::setCDSGain(bool value) {
|
||||||
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
|
sendToDetector(F_SET_CDS_GAIN, static_cast<int>(value), nullptr);
|
||||||
@ -2379,8 +2354,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr);
|
sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getADCConfiguration(const int chipIndex, const int adcIndex)
|
int Module::getADCConfiguration(const int chipIndex, const int adcIndex) const {
|
||||||
const {
|
|
||||||
int args[]{chipIndex, adcIndex};
|
int args[]{chipIndex, adcIndex};
|
||||||
return sendToDetector<int>(F_GET_ADC_CONFIGURATION, args);
|
return sendToDetector<int>(F_GET_ADC_CONFIGURATION, args);
|
||||||
}
|
}
|
||||||
@ -2396,8 +2370,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
client.Send(F_GET_BAD_CHANNELS);
|
client.Send(F_GET_BAD_CHANNELS);
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw DetectorError(
|
throw DetectorError("Detector " + std::to_string(moduleIndex) +
|
||||||
"Detector " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
// receive badchannels
|
// receive badchannels
|
||||||
@ -2436,8 +2409,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
int ival = 0;
|
int ival = 0;
|
||||||
iss >> ival;
|
iss >> ival;
|
||||||
if (iss.fail()) {
|
if (iss.fail()) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Could not load bad channels file. Invalid "
|
||||||
"Could not load bad channels file. Invalid "
|
|
||||||
"channel number at position " +
|
"channel number at position " +
|
||||||
std::to_string(badchannels.size()));
|
std::to_string(badchannels.size()));
|
||||||
}
|
}
|
||||||
@ -2455,8 +2427,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
client.Send(badchannels);
|
client.Send(badchannels);
|
||||||
}
|
}
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw DetectorError(
|
throw DetectorError("Detector " + std::to_string(moduleIndex) +
|
||||||
"Detector " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2508,8 +2479,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
|
std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
|
||||||
return sendToDetector<std::array<time::ns, 3>>(
|
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||||
F_GET_GATE_DELAY_ALL_GATES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getChipStatusRegister() const {
|
int Module::getChipStatusRegister() const {
|
||||||
@ -2636,8 +2606,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
void Module::setReceiverDbitList(std::vector<int> list) {
|
void Module::setReceiverDbitList(std::vector<int> list) {
|
||||||
LOG(logDEBUG1) << "Setting Receiver Dbit List";
|
LOG(logDEBUG1) << "Setting Receiver Dbit List";
|
||||||
if (list.size() > 64) {
|
if (list.size() > 64) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError("Dbit list size cannot be greater than 64\n");
|
||||||
"Dbit list size cannot be greater than 64\n");
|
|
||||||
}
|
}
|
||||||
for (auto &it : list) {
|
for (auto &it : list) {
|
||||||
if (it < 0 || it > 63) {
|
if (it < 0 || it > 63) {
|
||||||
@ -2689,9 +2658,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
return pat;
|
return pat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::loadDefaultPattern() {
|
void Module::loadDefaultPattern() { sendToDetector(F_LOAD_DEFAULT_PATTERN); }
|
||||||
sendToDetector(F_LOAD_DEFAULT_PATTERN);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Module::getPatternIOControl() const {
|
uint64_t Module::getPatternIOControl() const {
|
||||||
return sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL,
|
return sendToDetector<uint64_t>(F_SET_PATTERN_IO_CONTROL,
|
||||||
@ -2781,8 +2748,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
// TODO, refactor this function with a more robust sending.
|
// TODO, refactor this function with a more robust sending.
|
||||||
// Now assuming whitespace separated key value
|
// Now assuming whitespace separated key value
|
||||||
if (!shm()->useReceiverFlag) {
|
if (!shm()->useReceiverFlag) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Set rx_hostname first to use receiver parameters "
|
||||||
"Set rx_hostname first to use receiver parameters "
|
|
||||||
"(zmq json header)");
|
"(zmq json header)");
|
||||||
}
|
}
|
||||||
const int rxIndex = 0;
|
const int rxIndex = 0;
|
||||||
@ -2790,8 +2756,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
shm()->receivers[rxIndex].tcpPort);
|
shm()->receivers[rxIndex].tcpPort);
|
||||||
client.Send(F_GET_ADDITIONAL_JSON_HEADER);
|
client.Send(F_GET_ADDITIONAL_JSON_HEADER);
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw ReceiverError(
|
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||||
"Receiver " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
} else {
|
} else {
|
||||||
auto size = client.Receive<int>();
|
auto size = client.Receive<int>();
|
||||||
@ -2806,8 +2771,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
retval[key] = value;
|
retval[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logDEBUG) << "Getting additional json header "
|
LOG(logDEBUG) << "Getting additional json header " << ToString(retval);
|
||||||
<< ToString(retval);
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2815,8 +2779,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
void Module::setAdditionalJsonHeader(
|
void Module::setAdditionalJsonHeader(
|
||||||
const std::map<std::string, std::string> &jsonHeader) {
|
const std::map<std::string, std::string> &jsonHeader) {
|
||||||
if (!shm()->useReceiverFlag) {
|
if (!shm()->useReceiverFlag) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("Set rx_hostname first to use receiver parameters "
|
||||||
"Set rx_hostname first to use receiver parameters "
|
|
||||||
"(zmq json header)");
|
"(zmq json header)");
|
||||||
}
|
}
|
||||||
for (auto &it : jsonHeader) {
|
for (auto &it : jsonHeader) {
|
||||||
@ -2844,14 +2807,12 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
client.Send(&buff[0], buff.size());
|
client.Send(&buff[0], buff.size());
|
||||||
|
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw ReceiverError(
|
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||||
"Receiver " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Module::getAdditionalJsonParameter(const std::string &key)
|
std::string Module::getAdditionalJsonParameter(const std::string &key) const {
|
||||||
const {
|
|
||||||
char arg[SHORT_STR_LENGTH]{};
|
char arg[SHORT_STR_LENGTH]{};
|
||||||
sls::strcpy_safe(arg, key.c_str());
|
sls::strcpy_safe(arg, key.c_str());
|
||||||
char retval[SHORT_STR_LENGTH]{};
|
char retval[SHORT_STR_LENGTH]{};
|
||||||
@ -2902,8 +2863,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sls::strcpy_safe(args[0], fname.c_str());
|
sls::strcpy_safe(args[0], fname.c_str());
|
||||||
sls::strcpy_safe(args[1], hostname.c_str());
|
sls::strcpy_safe(args[1], hostname.c_str());
|
||||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||||
<< "): Sending detector server " << args[0]
|
<< "): Sending detector server " << args[0] << " from host "
|
||||||
<< " from host " << args[1];
|
<< args[1];
|
||||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||||
client.Send(F_COPY_DET_SERVER);
|
client.Send(F_COPY_DET_SERVER);
|
||||||
client.Send(args);
|
client.Send(args);
|
||||||
@ -2952,8 +2913,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sendProgram(false, buffer, F_UPDATE_KERNEL, "Update Kernel");
|
sendProgram(false, buffer, F_UPDATE_KERNEL, "Update Kernel");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError(
|
throw RuntimeError("Updating Kernel via the package is not implemented "
|
||||||
"Updating Kernel via the package is not implemented "
|
|
||||||
"for this detector");
|
"for this detector");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2969,8 +2929,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Module::setUpdateMode(const bool updatemode) {
|
void Module::setUpdateMode(const bool updatemode) {
|
||||||
sendToDetector(F_SET_UPDATE_MODE, static_cast<int>(updatemode),
|
sendToDetector(F_SET_UPDATE_MODE, static_cast<int>(updatemode), nullptr);
|
||||||
nullptr);
|
|
||||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||||
<< "): Update Mode set to " << updatemode << "!";
|
<< "): Update Mode set to " << updatemode << "!";
|
||||||
}
|
}
|
||||||
@ -2986,8 +2945,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::setBit(uint32_t addr, int n) {
|
void Module::setBit(uint32_t addr, int n) {
|
||||||
if (n < 0 || n > 31) {
|
if (n < 0 || n > 31) {
|
||||||
throw RuntimeError("Bit number " + std::to_string(n) +
|
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
|
||||||
" out of Range");
|
|
||||||
} else {
|
} else {
|
||||||
uint32_t val = readRegister(addr);
|
uint32_t val = readRegister(addr);
|
||||||
writeRegister(addr, val | 1 << n);
|
writeRegister(addr, val | 1 << n);
|
||||||
@ -2996,8 +2954,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
void Module::clearBit(uint32_t addr, int n) {
|
void Module::clearBit(uint32_t addr, int n) {
|
||||||
if (n < 0 || n > 31) {
|
if (n < 0 || n > 31) {
|
||||||
throw RuntimeError("Bit number " + std::to_string(n) +
|
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
|
||||||
" out of Range");
|
|
||||||
} else {
|
} else {
|
||||||
uint32_t val = readRegister(addr);
|
uint32_t val = readRegister(addr);
|
||||||
writeRegister(addr, val & ~(1 << n));
|
writeRegister(addr, val & ~(1 << n));
|
||||||
@ -3006,8 +2963,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
int Module::getBit(uint32_t addr, int n) {
|
int Module::getBit(uint32_t addr, int n) {
|
||||||
if (n < 0 || n > 31) {
|
if (n < 0 || n > 31) {
|
||||||
throw RuntimeError("Bit number " + std::to_string(n) +
|
throw RuntimeError("Bit number " + std::to_string(n) + " out of Range");
|
||||||
" out of Range");
|
|
||||||
} else {
|
} else {
|
||||||
return ((readRegister(addr) >> n) & 0x1);
|
return ((readRegister(addr) >> n) & 0x1);
|
||||||
}
|
}
|
||||||
@ -3153,8 +3109,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
void Module::sendToDetector(int fnum, const Arg &args, std::nullptr_t)
|
void Module::sendToDetector(int fnum, const Arg &args, std::nullptr_t) const {
|
||||||
const {
|
|
||||||
LOG(logDEBUG1) << "Sending: ["
|
LOG(logDEBUG1) << "Sending: ["
|
||||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||||
<< ", " << typeid(Arg).name() << ", " << sizeof(Arg)
|
<< ", " << typeid(Arg).name() << ", " << sizeof(Arg)
|
||||||
@ -3181,8 +3136,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
void Module::sendToDetector(int fnum, std::nullptr_t, Ret &retval) {
|
void Module::sendToDetector(int fnum, std::nullptr_t, Ret &retval) {
|
||||||
static_cast<const Module &>(*this).sendToDetector(fnum, nullptr,
|
static_cast<const Module &>(*this).sendToDetector(fnum, nullptr, retval);
|
||||||
retval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::sendToDetector(int fnum) const {
|
void Module::sendToDetector(int fnum) const {
|
||||||
@ -3228,16 +3182,14 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
template <typename Ret, typename Arg>
|
template <typename Ret, typename Arg>
|
||||||
Ret Module::sendToDetector(int fnum, const Arg &args) {
|
Ret Module::sendToDetector(int fnum, const Arg &args) {
|
||||||
return static_cast<const Module &>(*this).sendToDetector<Ret>(fnum,
|
return static_cast<const Module &>(*this).sendToDetector<Ret>(fnum, args);
|
||||||
args);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// sendToDetectorStop
|
// sendToDetectorStop
|
||||||
|
|
||||||
void Module::sendToDetectorStop(int fnum, const void *args,
|
void Module::sendToDetectorStop(int fnum, const void *args, size_t args_size,
|
||||||
size_t args_size, void *retval,
|
void *retval, size_t retval_size) const {
|
||||||
size_t retval_size) const {
|
|
||||||
// This is the only function that actually sends data to the detector
|
// This is the only function that actually sends data to the detector
|
||||||
// stop the other versions use templates to deduce sizes and create the
|
// stop the other versions use templates to deduce sizes and create the
|
||||||
// return type
|
// return type
|
||||||
@ -3247,16 +3199,14 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
stop.close();
|
stop.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::sendToDetectorStop(int fnum, const void *args,
|
void Module::sendToDetectorStop(int fnum, const void *args, size_t args_size,
|
||||||
size_t args_size, void *retval,
|
void *retval, size_t retval_size) {
|
||||||
size_t retval_size) {
|
static_cast<const Module &>(*this).sendToDetectorStop(fnum, args, args_size,
|
||||||
static_cast<const Module &>(*this).sendToDetectorStop(
|
retval, retval_size);
|
||||||
fnum, args, args_size, retval, retval_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Arg, typename Ret>
|
template <typename Arg, typename Ret>
|
||||||
void Module::sendToDetectorStop(int fnum, const Arg &args, Ret &retval)
|
void Module::sendToDetectorStop(int fnum, const Arg &args, Ret &retval) const {
|
||||||
const {
|
|
||||||
LOG(logDEBUG1) << "Sending to Stop: ["
|
LOG(logDEBUG1) << "Sending to Stop: ["
|
||||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||||
<< ", " << args << ", " << sizeof(args) << ", "
|
<< ", " << args << ", " << sizeof(args) << ", "
|
||||||
@ -3269,13 +3219,12 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
template <typename Arg, typename Ret>
|
template <typename Arg, typename Ret>
|
||||||
void Module::sendToDetectorStop(int fnum, const Arg &args, Ret &retval) {
|
void Module::sendToDetectorStop(int fnum, const Arg &args, Ret &retval) {
|
||||||
static_cast<const Module &>(*this).sendToDetectorStop(fnum, args,
|
static_cast<const Module &>(*this).sendToDetectorStop(fnum, args, retval);
|
||||||
retval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
void Module::sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t)
|
void Module::sendToDetectorStop(int fnum, const Arg &args,
|
||||||
const {
|
std::nullptr_t) const {
|
||||||
LOG(logDEBUG1) << "Sending to Stop: ["
|
LOG(logDEBUG1) << "Sending to Stop: ["
|
||||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||||
<< ", " << typeid(Arg).name() << ", " << sizeof(Arg)
|
<< ", " << typeid(Arg).name() << ", " << sizeof(Arg)
|
||||||
@ -3286,13 +3235,11 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
|
|
||||||
template <typename Arg>
|
template <typename Arg>
|
||||||
void Module::sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t) {
|
void Module::sendToDetectorStop(int fnum, const Arg &args, std::nullptr_t) {
|
||||||
static_cast<const Module &>(*this).sendToDetectorStop(fnum, args,
|
static_cast<const Module &>(*this).sendToDetectorStop(fnum, args, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
void Module::sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval)
|
void Module::sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval) const {
|
||||||
const {
|
|
||||||
LOG(logDEBUG1) << "Sending to Stop: ["
|
LOG(logDEBUG1) << "Sending to Stop: ["
|
||||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||||
<< ", nullptr, 0, " << typeid(Ret).name() << ", "
|
<< ", nullptr, 0, " << typeid(Ret).name() << ", "
|
||||||
@ -3397,9 +3344,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
if (!strcmp(shm()->receivers[entries[i]].hostname, "none")) {
|
if (!strcmp(shm()->receivers[entries[i]].hostname, "none")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1) << "Receiver ["
|
LOG(logDEBUG1) << "Receiver [" << shm()->receivers[entries[i]].hostname
|
||||||
<< shm()->receivers[entries[i]].hostname << ", "
|
<< ", " << shm()->receivers[entries[i]].tcpPort << ']';
|
||||||
<< shm()->receivers[entries[i]].tcpPort << ']';
|
|
||||||
try {
|
try {
|
||||||
auto receiver =
|
auto receiver =
|
||||||
ReceiverSocket(shm()->receivers[entries[i]].hostname,
|
ReceiverSocket(shm()->receivers[entries[i]].hostname,
|
||||||
@ -3432,8 +3378,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]";
|
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]";
|
||||||
STATIC_ASSERT_ARG(Arg, "sendToReceiver")
|
STATIC_ASSERT_ARG(Arg, "sendToReceiver")
|
||||||
STATIC_ASSERT_ARG(Ret, "sendToReceiver")
|
STATIC_ASSERT_ARG(Ret, "sendToReceiver")
|
||||||
sendToReceiver(rxIndex, fnum, &args, sizeof(args), &retval,
|
sendToReceiver(rxIndex, fnum, &args, sizeof(args), &retval, sizeof(retval));
|
||||||
sizeof(retval));
|
|
||||||
LOG(logDEBUG1) << "Got back: " << retval;
|
LOG(logDEBUG1) << "Got back: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3477,8 +3422,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
|
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
|
||||||
Ret &retval) {
|
Ret &retval) {
|
||||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum,
|
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, nullptr,
|
||||||
nullptr, retval);
|
retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret>
|
template <typename Ret>
|
||||||
@ -3512,8 +3457,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret, typename Arg>
|
template <typename Ret, typename Arg>
|
||||||
Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args)
|
Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args) const {
|
||||||
const {
|
|
||||||
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
||||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||||
<< ", " << args << ", " << sizeof(args) << ", "
|
<< ", " << args << ", " << sizeof(args) << ", "
|
||||||
@ -3521,16 +3465,15 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
STATIC_ASSERT_ARG(Arg, "sendToReceiver")
|
STATIC_ASSERT_ARG(Arg, "sendToReceiver")
|
||||||
STATIC_ASSERT_ARG(Ret, "sendToReceiver")
|
STATIC_ASSERT_ARG(Ret, "sendToReceiver")
|
||||||
Ret retval{};
|
Ret retval{};
|
||||||
sendToReceiver(rxIndex, fnum, &args, sizeof(args), &retval,
|
sendToReceiver(rxIndex, fnum, &args, sizeof(args), &retval, sizeof(retval));
|
||||||
sizeof(retval));
|
|
||||||
LOG(logDEBUG1) << "Got back: " << retval;
|
LOG(logDEBUG1) << "Got back: " << retval;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Ret, typename Arg>
|
template <typename Ret, typename Arg>
|
||||||
Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args) {
|
Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args) {
|
||||||
return static_cast<const Module &>(*this).sendToReceiver<Ret>(
|
return static_cast<const Module &>(*this).sendToReceiver<Ret>(rxIndex, fnum,
|
||||||
rxIndex, fnum, args);
|
args);
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int det_id,
|
slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int det_id,
|
||||||
@ -3545,9 +3488,9 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
if (verify && shm()->shmversion != MODULE_SHMVERSION) {
|
if (verify && shm()->shmversion != MODULE_SHMVERSION) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
||||||
<< ":)version mismatch (expected 0x" << std::hex
|
<< ":)version mismatch (expected 0x" << std::hex << MODULE_SHMVERSION
|
||||||
<< MODULE_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
<< " but got 0x" << shm()->shmversion << ")" << std::dec
|
||||||
<< std::dec << ". Clear Shared memory to continue.";
|
<< ". Clear Shared memory to continue.";
|
||||||
shm.UnmapSharedMemory();
|
shm.UnmapSharedMemory();
|
||||||
throw SharedMemoryError(ss.str());
|
throw SharedMemoryError(ss.str());
|
||||||
}
|
}
|
||||||
@ -3565,8 +3508,8 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
ss << "Single shared memory (" << det_id << "-" << moduleIndex
|
||||||
<< ":) version mismatch (expected 0x" << std::hex
|
<< ":) version mismatch (expected 0x" << std::hex
|
||||||
<< MODULE_SHMVERSION << " but got 0x" << shm()->shmversion
|
<< MODULE_SHMVERSION << " but got 0x" << shm()->shmversion << ")"
|
||||||
<< ")" << std::dec << ". Clear Shared memory to continue.";
|
<< std::dec << ". Clear Shared memory to continue.";
|
||||||
throw SharedMemoryError(ss.str());
|
throw SharedMemoryError(ss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3641,8 +3584,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
nullptr);
|
nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::sendModule(sls_detector_module * myMod,
|
int Module::sendModule(sls_detector_module *myMod, sls::ClientSocket &client) {
|
||||||
sls::ClientSocket & client) {
|
|
||||||
constexpr TLogLevel level = logDEBUG1;
|
constexpr TLogLevel level = logDEBUG1;
|
||||||
LOG(level) << "Sending Module";
|
LOG(level) << "Sending Module";
|
||||||
int ts = 0;
|
int ts = 0;
|
||||||
@ -3704,8 +3646,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
client.Send(F_SET_MODULE);
|
client.Send(F_SET_MODULE);
|
||||||
sendModule(&module, client);
|
sendModule(&module, client);
|
||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
throw DetectorError(
|
throw DetectorError("Module " + std::to_string(moduleIndex) +
|
||||||
"Module " + std::to_string(moduleIndex) +
|
|
||||||
" returned error: " + client.readErrorMessage());
|
" returned error: " + client.readErrorMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3729,9 +3670,10 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sendToDetector(F_UPDATE_RATE_CORRECTION);
|
sendToDetector(F_UPDATE_RATE_CORRECTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
sls_detector_module Module::interpolateTrim(
|
sls_detector_module Module::interpolateTrim(sls_detector_module *a,
|
||||||
sls_detector_module * a, sls_detector_module * b, const int energy,
|
sls_detector_module *b,
|
||||||
const int e1, const int e2, bool trimbits) {
|
const int energy, const int e1,
|
||||||
|
const int e2, bool trimbits) {
|
||||||
// dacs specified only for eiger and mythen3
|
// dacs specified only for eiger and mythen3
|
||||||
if (shm()->detType != EIGER && shm()->detType != MYTHEN3) {
|
if (shm()->detType != EIGER && shm()->detType != MYTHEN3) {
|
||||||
throw NotImplementedError("Interpolation of Trim values not "
|
throw NotImplementedError("Interpolation of Trim values not "
|
||||||
@ -3788,10 +3730,9 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS});
|
E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS});
|
||||||
} else {
|
} else {
|
||||||
dacs_to_copy.insert(dacs_to_copy.end(),
|
dacs_to_copy.insert(dacs_to_copy.end(),
|
||||||
{M_VCASSH, M_VRSHAPER, M_VRSHAPER_N,
|
{M_VCASSH, M_VRSHAPER, M_VRSHAPER_N, M_VIPRE_OUT,
|
||||||
M_VIPRE_OUT, M_VICIN, M_VCAS, M_VRPREAMP,
|
M_VICIN, M_VCAS, M_VRPREAMP, M_VCAL_N, M_VIPRE,
|
||||||
M_VCAL_N, M_VIPRE, M_VISHAPER, M_VCAL_P,
|
M_VISHAPER, M_VCAL_P, M_VDCSH});
|
||||||
M_VDCSH});
|
|
||||||
// interpolate vtrim, vth1, vth2, vth3
|
// interpolate vtrim, vth1, vth2, vth3
|
||||||
dacs_to_interpolate.insert(dacs_to_interpolate.end(),
|
dacs_to_interpolate.insert(dacs_to_interpolate.end(),
|
||||||
{M_VTH1, M_VTH2, M_VTH3, M_VTRIM});
|
{M_VTH1, M_VTH2, M_VTH3, M_VTRIM});
|
||||||
@ -3800,16 +3741,16 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
// Copy Dacs
|
// Copy Dacs
|
||||||
for (size_t i = 0; i < dacs_to_copy.size(); ++i) {
|
for (size_t i = 0; i < dacs_to_copy.size(); ++i) {
|
||||||
if (a->dacs[dacs_to_copy[i]] != b->dacs[dacs_to_copy[i]]) {
|
if (a->dacs[dacs_to_copy[i]] != b->dacs[dacs_to_copy[i]]) {
|
||||||
throw RuntimeError("Interpolate module: dacs " +
|
throw RuntimeError("Interpolate module: dacs " + std::to_string(i) +
|
||||||
std::to_string(i) + " different");
|
" different");
|
||||||
}
|
}
|
||||||
myMod.dacs[dacs_to_copy[i]] = a->dacs[dacs_to_copy[i]];
|
myMod.dacs[dacs_to_copy[i]] = a->dacs[dacs_to_copy[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interpolate Dacs
|
// Interpolate Dacs
|
||||||
for (size_t i = 0; i < dacs_to_interpolate.size(); ++i) {
|
for (size_t i = 0; i < dacs_to_interpolate.size(); ++i) {
|
||||||
myMod.dacs[dacs_to_interpolate[i]] = linearInterpolation(
|
myMod.dacs[dacs_to_interpolate[i]] =
|
||||||
energy, e1, e2, a->dacs[dacs_to_interpolate[i]],
|
linearInterpolation(energy, e1, e2, a->dacs[dacs_to_interpolate[i]],
|
||||||
b->dacs[dacs_to_interpolate[i]]);
|
b->dacs[dacs_to_interpolate[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3817,9 +3758,9 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
if (shm()->detType == EIGER) {
|
if (shm()->detType == EIGER) {
|
||||||
// CAL
|
// CAL
|
||||||
if (a->dacs[E_CAL] != b->dacs[E_CAL]) {
|
if (a->dacs[E_CAL] != b->dacs[E_CAL]) {
|
||||||
LOG(logWARNING) << "DAC CAL differs in both energies ("
|
LOG(logWARNING)
|
||||||
<< a->dacs[E_CAL] << "," << b->dacs[E_CAL]
|
<< "DAC CAL differs in both energies (" << a->dacs[E_CAL] << ","
|
||||||
<< ")!\nTaking first: " << a->dacs[E_CAL];
|
<< b->dacs[E_CAL] << ")!\nTaking first: " << a->dacs[E_CAL];
|
||||||
}
|
}
|
||||||
myMod.dacs[E_CAL] = a->dacs[E_CAL];
|
myMod.dacs[E_CAL] = a->dacs[E_CAL];
|
||||||
}
|
}
|
||||||
@ -3902,8 +3843,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sizeof(int) * (myMod.ndac));
|
sizeof(int) * (myMod.ndac));
|
||||||
infile.read(reinterpret_cast<char *>(&myMod.iodelay),
|
infile.read(reinterpret_cast<char *>(&myMod.iodelay),
|
||||||
sizeof(myMod.iodelay));
|
sizeof(myMod.iodelay));
|
||||||
infile.read(reinterpret_cast<char *>(&myMod.tau),
|
infile.read(reinterpret_cast<char *>(&myMod.tau), sizeof(myMod.tau));
|
||||||
sizeof(myMod.tau));
|
|
||||||
for (int i = 0; i < myMod.ndac; ++i) {
|
for (int i = 0; i < myMod.ndac; ++i) {
|
||||||
LOG(logDEBUG1) << "dac " << i << ":" << myMod.dacs[i];
|
LOG(logDEBUG1) << "dac " << i << ":" << myMod.dacs[i];
|
||||||
}
|
}
|
||||||
@ -3914,8 +3854,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sizeof(int) * (myMod.nchan));
|
sizeof(int) * (myMod.nchan));
|
||||||
}
|
}
|
||||||
if (!infile) {
|
if (!infile) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("readSettingsFile: Could not load all values "
|
||||||
"readSettingsFile: Could not load all values "
|
|
||||||
"for settings for " +
|
"for settings for " +
|
||||||
fname);
|
fname);
|
||||||
}
|
}
|
||||||
@ -3931,8 +3870,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
std::to_string(file_size) + " instead of " +
|
std::to_string(file_size) + " instead of " +
|
||||||
std::to_string(expected_size) + " bytes");
|
std::to_string(expected_size) + " bytes");
|
||||||
}
|
}
|
||||||
infile.read(reinterpret_cast<char *>(&myMod.reg),
|
infile.read(reinterpret_cast<char *>(&myMod.reg), sizeof(myMod.reg));
|
||||||
sizeof(myMod.reg));
|
|
||||||
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
||||||
sizeof(int) * (myMod.ndac));
|
sizeof(int) * (myMod.ndac));
|
||||||
for (int i = 0; i < myMod.ndac; ++i) {
|
for (int i = 0; i < myMod.ndac; ++i) {
|
||||||
@ -3943,8 +3881,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
sizeof(int) * (myMod.nchan));
|
sizeof(int) * (myMod.nchan));
|
||||||
}
|
}
|
||||||
if (!infile) {
|
if (!infile) {
|
||||||
throw RuntimeError(
|
throw RuntimeError("readSettingsFile: Could not load all values "
|
||||||
"readSettingsFile: Could not load all values "
|
|
||||||
"for settings for " +
|
"for settings for " +
|
||||||
fname);
|
fname);
|
||||||
}
|
}
|
||||||
@ -3957,9 +3894,10 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
return myMod;
|
return myMod;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::sendProgram(
|
void Module::sendProgram(bool blackfin, std::vector<char> buffer,
|
||||||
bool blackfin, std::vector<char> buffer, const int functionEnum,
|
const int functionEnum,
|
||||||
const std::string &functionType, const std::string serverName) {
|
const std::string &functionType,
|
||||||
|
const std::string serverName) {
|
||||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||||
<< "): Sending " << functionType;
|
<< "): Sending " << functionType;
|
||||||
|
|
||||||
@ -3970,8 +3908,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
client.Send(filesize);
|
client.Send(filesize);
|
||||||
|
|
||||||
// send checksum
|
// send checksum
|
||||||
std::string checksum =
|
std::string checksum = sls::md5_calculate_checksum(buffer.data(), filesize);
|
||||||
sls::md5_calculate_checksum(buffer.data(), filesize);
|
|
||||||
LOG(logDEBUG1) << "Checksum:" << checksum;
|
LOG(logDEBUG1) << "Checksum:" << checksum;
|
||||||
char cChecksum[MAX_STR_LENGTH] = {0};
|
char cChecksum[MAX_STR_LENGTH] = {0};
|
||||||
strcpy(cChecksum, checksum.c_str());
|
strcpy(cChecksum, checksum.c_str());
|
||||||
@ -4008,8 +3945,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
if (client.Receive<int>() == FAIL) {
|
if (client.Receive<int>() == FAIL) {
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Module " << moduleIndex << " (" << shm()->hostname
|
os << "Module " << moduleIndex << " (" << shm()->hostname << ")"
|
||||||
<< ")"
|
|
||||||
<< " returned error: " << client.readErrorMessage();
|
<< " returned error: " << client.readErrorMessage();
|
||||||
throw DetectorError(os.str());
|
throw DetectorError(os.str());
|
||||||
}
|
}
|
||||||
@ -4074,10 +4010,10 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
|||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
--count;
|
--count;
|
||||||
printf("%d%%\r",
|
printf(
|
||||||
|
"%d%%\r",
|
||||||
static_cast<int>(
|
static_cast<int>(
|
||||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) *
|
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||||
100));
|
|
||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user