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 300396547..0f48a6b6b 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 " diff --git a/slsSupportLib/include/sls/sls_detector_defs.h b/slsSupportLib/include/sls/sls_detector_defs.h index 8119c8d8b..61138baf1 100644 --- a/slsSupportLib/include/sls/sls_detector_defs.h +++ b/slsSupportLib/include/sls/sls_detector_defs.h @@ -85,6 +85,7 @@ #define DEFAULT_STREAMING_TIMER_IN_MS 500 #define NUM_RX_THREAD_IDS 9 + // NOLINTEND(cppcoreguidelines-macro-usage) #ifdef __cplusplus @@ -105,7 +106,9 @@ class slsDetectorDefs { MOENCH, MYTHEN3, GOTTHARD2, - XILINX_CHIPTESTBOARD + XILINX_CHIPTESTBOARD, + MATTERHORN // TODO: maybe better to have it under a namespace + // slsDetectorDefs instead of grouped in a class }; /** return values */ @@ -761,6 +764,13 @@ struct detParameters { nChipY = 1; nDacs = 14; break; + case slsDetectorDefs::detectorType::MATTERHORN: + nChanX = 256; + nChanY = 256; + nChipX = 4; + nChipY = 2; + nDacs = 31; + break; default: throw sls::RuntimeError("Unknown detector type! " + std::to_string(type)); diff --git a/slsSupportLib/src/ToString.cpp b/slsSupportLib/src/ToString.cpp index 98790f7cd..67d6234f8 100644 --- a/slsSupportLib/src/ToString.cpp +++ b/slsSupportLib/src/ToString.cpp @@ -713,6 +713,8 @@ template <> defs::detectorType StringTo(const std::string &s) { return defs::GOTTHARD2; if (s == "Xilinx_ChipTestBoard") return defs::XILINX_CHIPTESTBOARD; + if (s == "Matterhorn") + return defs::MATTERHORN; throw RuntimeError("Unknown detector type " + s); }