From 146b012eff62ff2d419225396080edde95b8d2f8 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 27 Oct 2021 11:14:29 +0200 Subject: [PATCH] minor changes --- slsDetectorSoftware/src/CmdProxy.cpp | 3 +-- slsDetectorSoftware/src/Detector.cpp | 2 +- slsDetectorSoftware/src/Module.cpp | 34 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 274e4e7ce..c19eb3913 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -1430,8 +1430,7 @@ std::string CmdProxy::UDPDestinationList(int action) { throw sls::RuntimeError("udp_dstlist must be at module level."); } if (rx_id < 0 || rx_id >= MAX_UDP_DESTINATION) { - throw sls::RuntimeError( - "Invalid receiver index to get round robin entry."); + throw sls::RuntimeError(std::string("Invalid receiver index ") + std::to_string(rx_id) + std::string(" to set round robin entry.")); } auto t = det->getDestinationUDPList(rx_id, std::vector{det_id}); os << OutString(t) << '\n'; diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index c605ec3fe..43f2642b9 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -87,7 +87,7 @@ void Detector::loadParameters(const std::vector ¶meters) { for (const auto ¤t_line : parameters) { parser.Parse(current_line); proxy.Call(parser.command(), parser.arguments(), parser.detector_id(), - defs::PUT_ACTION); + defs::PUT_ACTION, std::cout, parser.receiver_id()); } } diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index e61c525e1..62c42bc04 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -830,7 +830,7 @@ std::vector Module::getNumMissingPackets() const { auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); client.Send(F_GET_NUM_MISSING_PACKETS); if (client.Receive() == FAIL) { - throw RuntimeError("Receiver " + std::to_string(moduleIndex) + + throw ReceiverError("Receiver " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } else { auto nports = client.Receive(); @@ -1522,7 +1522,7 @@ void Module::sendReceiverRateCorrections(const std::vector &t) { receiver.Send(static_cast(t.size())); receiver.Send(t); if (receiver.Receive() == FAIL) { - throw RuntimeError("Receiver " + std::to_string(moduleIndex) + + throw ReceiverError("Receiver " + std::to_string(moduleIndex) + " returned error: " + receiver.readErrorMessage()); } } @@ -1778,7 +1778,7 @@ void Module::sendVetoPhoton(const int chipIndex, client.Send(gainIndices); client.Send(values); if (client.Receive() == FAIL) { - throw RuntimeError("Detector " + std::to_string(moduleIndex) + + throw DetectorError("Detector " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } } @@ -1790,13 +1790,13 @@ void Module::getVetoPhoton(const int chipIndex, client.Send(F_GET_VETO_PHOTON); client.Send(chipIndex); if (client.Receive() == FAIL) { - throw RuntimeError("Detector " + std::to_string(moduleIndex) + + throw DetectorError("Detector " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } auto nch = client.Receive(); 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(nch)); } @@ -2025,7 +2025,7 @@ void Module::getBadChannels(const std::string &fname) const { auto client = DetectorSocket(shm()->hostname, shm()->controlPort); client.Send(F_GET_BAD_CHANNELS); if (client.Receive() == FAIL) { - throw RuntimeError("Detector " + std::to_string(moduleIndex) + + throw DetectorError("Detector " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } // receive badchannels @@ -2082,7 +2082,7 @@ void Module::setBadChannels(const std::string &fname) { client.Send(badchannels); } if (client.Receive() == FAIL) { - throw RuntimeError("Detector " + std::to_string(moduleIndex) + + throw DetectorError("Detector " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } } @@ -2396,7 +2396,7 @@ std::map Module::getAdditionalJsonHeader() const { auto client = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); client.Send(F_GET_ADDITIONAL_JSON_HEADER); if (client.Receive() == FAIL) { - throw RuntimeError("Receiver " + std::to_string(moduleIndex) + + throw ReceiverError("Receiver " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } else { auto size = client.Receive(); @@ -2445,7 +2445,7 @@ void Module::setAdditionalJsonHeader( client.Send(&buff[0], buff.size()); if (client.Receive() == FAIL) { - throw RuntimeError("Receiver " + std::to_string(moduleIndex) + + throw ReceiverError("Receiver " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } } @@ -2507,7 +2507,7 @@ void Module::copyDetectorServer(const std::string &fname, std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname << "): detector server copied"; @@ -3154,7 +3154,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) { client.Send(F_SET_MODULE); sendModule(&module, client); if (client.Receive() == FAIL) { - throw RuntimeError("Detector " + std::to_string(moduleIndex) + + throw DetectorError("Module " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } } @@ -3424,7 +3424,7 @@ void Module::programFPGAviaBlackfin(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } // sending program in parts of 2mb each @@ -3444,7 +3444,7 @@ void Module::programFPGAviaBlackfin(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } filesize -= unitprogramsize; currentPointer += unitprogramsize; @@ -3455,7 +3455,7 @@ void Module::programFPGAviaBlackfin(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } LOG(logINFO) << "Checksum verified for module " << moduleIndex << " (" << shm()->hostname << ")"; @@ -3508,7 +3508,7 @@ void Module::programFPGAviaBlackfin(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } LOG(logINFO) << "FPGA programmed successfully"; } @@ -3535,7 +3535,7 @@ void Module::programFPGAviaNios(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } client.Send(buffer); @@ -3586,7 +3586,7 @@ void Module::programFPGAviaNios(std::vector buffer) { std::ostringstream os; os << "Module " << moduleIndex << " (" << shm()->hostname << ")" << " returned error: " << client.readErrorMessage(); - throw RuntimeError(os.str()); + throw DetectorError(os.str()); } LOG(logINFO) << "FPGA programmed successfully"; }