minor changes

This commit is contained in:
2021-10-27 11:14:29 +02:00
parent 95897085ec
commit 146b012eff
3 changed files with 19 additions and 20 deletions

View File

@ -1430,8 +1430,7 @@ std::string CmdProxy::UDPDestinationList(int action) {
throw sls::RuntimeError("udp_dstlist must be at module level."); throw sls::RuntimeError("udp_dstlist must be at module level.");
} }
if (rx_id < 0 || rx_id >= MAX_UDP_DESTINATION) { if (rx_id < 0 || rx_id >= MAX_UDP_DESTINATION) {
throw sls::RuntimeError( throw sls::RuntimeError(std::string("Invalid receiver index ") + std::to_string(rx_id) + std::string(" to set round robin entry."));
"Invalid receiver index to get round robin entry.");
} }
auto t = det->getDestinationUDPList(rx_id, std::vector<int>{det_id}); auto t = det->getDestinationUDPList(rx_id, std::vector<int>{det_id});
os << OutString(t) << '\n'; os << OutString(t) << '\n';

View File

@ -87,7 +87,7 @@ void Detector::loadParameters(const std::vector<std::string> &parameters) {
for (const auto &current_line : parameters) { for (const auto &current_line : parameters) {
parser.Parse(current_line); parser.Parse(current_line);
proxy.Call(parser.command(), parser.arguments(), parser.detector_id(), proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
defs::PUT_ACTION); defs::PUT_ACTION, std::cout, parser.receiver_id());
} }
} }

View File

@ -830,7 +830,7 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
client.Send(F_GET_NUM_MISSING_PACKETS); client.Send(F_GET_NUM_MISSING_PACKETS);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw RuntimeError("Receiver " + std::to_string(moduleIndex) + throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} else { } else {
auto nports = client.Receive<int>(); auto nports = client.Receive<int>();
@ -1522,7 +1522,7 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
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("Receiver " + std::to_string(moduleIndex) + throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
" returned error: " + receiver.readErrorMessage()); " returned error: " + receiver.readErrorMessage());
} }
} }
@ -1778,7 +1778,7 @@ void Module::sendVetoPhoton(const int chipIndex,
client.Send(gainIndices); client.Send(gainIndices);
client.Send(values); client.Send(values);
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw RuntimeError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Detector " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} }
} }
@ -1790,13 +1790,13 @@ void Module::getVetoPhoton(const int chipIndex,
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 RuntimeError("Detector " + std::to_string(moduleIndex) + throw DetectorError("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 RuntimeError("Could not get veto photon. Expected " + throw DetectorError("Could not get veto photon. Expected " +
std::to_string(shm()->nChan.x) + " channels, got " + std::to_string(shm()->nChan.x) + " channels, got " +
std::to_string(nch)); std::to_string(nch));
} }
@ -2025,7 +2025,7 @@ void Module::getBadChannels(const std::string &fname) const {
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 RuntimeError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Detector " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} }
// receive badchannels // receive badchannels
@ -2082,7 +2082,7 @@ void Module::setBadChannels(const std::string &fname) {
client.Send(badchannels); client.Send(badchannels);
} }
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw RuntimeError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Detector " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} }
} }
@ -2396,7 +2396,7 @@ std::map<std::string, std::string> Module::getAdditionalJsonHeader() const {
auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
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 RuntimeError("Receiver " + std::to_string(moduleIndex) + throw ReceiverError("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>();
@ -2445,7 +2445,7 @@ void Module::setAdditionalJsonHeader(
client.Send(&buff[0], buff.size()); client.Send(&buff[0], buff.size());
if (client.Receive<int>() == FAIL) { if (client.Receive<int>() == FAIL) {
throw RuntimeError("Receiver " + std::to_string(moduleIndex) + throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} }
} }
@ -2507,7 +2507,7 @@ void Module::copyDetectorServer(const std::string &fname,
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): detector server copied"; << "): detector server copied";
@ -3154,7 +3154,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) {
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 RuntimeError("Detector " + std::to_string(moduleIndex) + throw DetectorError("Module " + std::to_string(moduleIndex) +
" returned error: " + client.readErrorMessage()); " returned error: " + client.readErrorMessage());
} }
} }
@ -3424,7 +3424,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
// sending program in parts of 2mb each // sending program in parts of 2mb each
@ -3444,7 +3444,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
filesize -= unitprogramsize; filesize -= unitprogramsize;
currentPointer += unitprogramsize; currentPointer += unitprogramsize;
@ -3455,7 +3455,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
LOG(logINFO) << "Checksum verified for module " << moduleIndex << " (" LOG(logINFO) << "Checksum verified for module " << moduleIndex << " ("
<< shm()->hostname << ")"; << shm()->hostname << ")";
@ -3508,7 +3508,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
LOG(logINFO) << "FPGA programmed successfully"; LOG(logINFO) << "FPGA programmed successfully";
} }
@ -3535,7 +3535,7 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
client.Send(buffer); client.Send(buffer);
@ -3586,7 +3586,7 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
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 RuntimeError(os.str()); throw DetectorError(os.str());
} }
LOG(logINFO) << "FPGA programmed successfully"; LOG(logINFO) << "FPGA programmed successfully";
} }