From 4977fb2ee0eca35da0f49ed36e45292771029052 Mon Sep 17 00:00:00 2001 From: Alice Date: Mon, 16 Feb 2026 14:37:44 +0100 Subject: [PATCH] WIP --- .../include/MatterhornClientInterface.h | 2 ++ .../src/MatterhornClientInterface.cpp | 13 +++++++++++-- .../slsDetectorServer/include/ClientInterface.h | 2 +- slsDetectorSoftware/src/DetectorImpl.cpp | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/slsDetectorServers/matterhonServer/include/MatterhornClientInterface.h b/slsDetectorServers/matterhonServer/include/MatterhornClientInterface.h index 0cd0c04c5..3fb707511 100644 --- a/slsDetectorServers/matterhonServer/include/MatterhornClientInterface.h +++ b/slsDetectorServers/matterhonServer/include/MatterhornClientInterface.h @@ -13,6 +13,8 @@ class MatterhornClientInterface : public ClientInterface { private: ReturnCode get_version(ServerInterface &socket); + ReturnCode get_detector_type(ServerInterface &socket); + static std::string getMatterhornServerVersion(); }; diff --git a/slsDetectorServers/matterhonServer/src/MatterhornClientInterface.cpp b/slsDetectorServers/matterhonServer/src/MatterhornClientInterface.cpp index 78b379231..bd1551e5b 100644 --- a/slsDetectorServers/matterhonServer/src/MatterhornClientInterface.cpp +++ b/slsDetectorServers/matterhonServer/src/MatterhornClientInterface.cpp @@ -1,5 +1,6 @@ #include "MatterhornClientInterface.h" #include "sls/logger.h" +#include "sls/sls_detector_defs.h" #include "sls/sls_detector_funcs.h" #include "sls/versionAPI.h" @@ -14,18 +15,26 @@ MatterhornClientInterface::MatterhornClientInterface(const uint16_t portNumber) functionTable = { {detFuncs::F_GET_SERVER_VERSION, - [this](ServerInterface &si) { return this->get_version(si); }}}; + [this](ServerInterface &si) { return this->get_version(si); }}, + {detFuncs::F_GET_DETECTOR_TYPE, + [this](ServerInterface &si) { return this->get_detector_type(si); }}}; } ReturnCode MatterhornClientInterface::get_version(ServerInterface &socket) { auto version = getMatterhornServerVersion(); version.resize(MAX_STR_LENGTH); - LOG(TLogLevel::logDEBUG1) << "Matterhorn Server Version: " << version; + LOG(TLogLevel::logINFO) << "Matterhorn Server Version: " << version; return static_cast(socket.sendResult( version)); // TODO: check what would be possible return codes!!! } +ReturnCode +MatterhornClientInterface::get_detector_type(ServerInterface &socket) { + return static_cast( + socket.sendResult(slsDetectorDefs::detectorType::MATTERHORN)); +} + std::string MatterhornClientInterface::getMatterhornServerVersion() { return APIMATTERHORN; } diff --git a/slsDetectorServers/slsDetectorServer/include/ClientInterface.h b/slsDetectorServers/slsDetectorServer/include/ClientInterface.h index c64820ae0..f39d5555b 100644 --- a/slsDetectorServers/slsDetectorServer/include/ClientInterface.h +++ b/slsDetectorServers/slsDetectorServer/include/ClientInterface.h @@ -13,7 +13,7 @@ namespace sls { * @brief ClientInterface class handles communication and processing of commands * from Client to Server. */ -class ClientInterface : private virtual slsDetectorDefs { +class ClientInterface { protected: // TODO probably requires std::variant diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index b83e3a52e..1083c81c5 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -204,6 +204,9 @@ void DetectorImpl::addModule(const std::string &name) { // get type by connecting detectorType type = Module::getTypeFromDetector(hostname, port); + LOG(logDEBUG) << "Detector type of module " << name << " is " + << std::to_string(type); + // gotthard2 cannot have more than 2 modules (50um=1, 25um=2 if (type == GOTTHARD2 && modules.size() > 2) { throw RuntimeError("GotthardII cannot have more than 2 modules. Please "