mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-08-03 14:08:12 +02: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 "
|
||||
|
||||
Reference in New Issue
Block a user