mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-03-03 03:12:39 +01:00
WIP
This commit is contained in:
@@ -13,6 +13,8 @@ class MatterhornClientInterface : public ClientInterface {
|
||||
private:
|
||||
ReturnCode get_version(ServerInterface &socket);
|
||||
|
||||
ReturnCode get_detector_type(ServerInterface &socket);
|
||||
|
||||
static std::string getMatterhornServerVersion();
|
||||
};
|
||||
|
||||
|
||||
@@ -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<ReturnCode>(socket.sendResult(
|
||||
version)); // TODO: check what would be possible return codes!!!
|
||||
}
|
||||
|
||||
ReturnCode
|
||||
MatterhornClientInterface::get_detector_type(ServerInterface &socket) {
|
||||
return static_cast<ReturnCode>(
|
||||
socket.sendResult(slsDetectorDefs::detectorType::MATTERHORN));
|
||||
}
|
||||
|
||||
std::string MatterhornClientInterface::getMatterhornServerVersion() {
|
||||
return APIMATTERHORN;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user