mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
merge fix
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
set(SOURCES
|
||||
src/DetectorImpl.cpp
|
||||
src/Module.cpp
|
||||
@ -41,6 +43,8 @@ if(SLS_BUILD_SHARED_LIBRARIES)
|
||||
add_library(slsDetectorShared SHARED $<TARGET_OBJECTS:slsDetectorObject>)
|
||||
target_link_libraries(slsDetectorShared PUBLIC slsDetectorObject)
|
||||
set_target_properties(slsDetectorShared PROPERTIES
|
||||
VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}
|
||||
SOVERSION ${PACKAGE_VERSION_MAJOR}
|
||||
LIBRARY_OUTPUT_NAME SlsDetector
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
PUBLIC_HEADER "${PUBLICHEADERS}"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include "sls/Pattern.h"
|
||||
#include "sls/Result.h"
|
||||
@ -81,7 +83,8 @@ class Detector {
|
||||
/* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */
|
||||
Result<int64_t> getSerialNumber(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is streamed out in the UDP header of the detector.*/
|
||||
/** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is
|
||||
* streamed out in the UDP header of the detector.*/
|
||||
Result<int> getModuleId(Positions pos = {}) const;
|
||||
|
||||
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
|
||||
@ -300,16 +303,21 @@ class Detector {
|
||||
/** list of possible timing modes for this detector */
|
||||
std::vector<defs::timingMode> getTimingModeList() const;
|
||||
|
||||
/** [Eiger][Jungfrau] */
|
||||
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
||||
/** [Eiger][Jungfrau][Gotthard2] */
|
||||
Result<defs::speedLevel> getReadoutSpeed(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Jungfrau]
|
||||
* Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED \n
|
||||
* [Jungfrau] FULL_SPEED option only available from v2.0 boards and with
|
||||
* setting number of interfaces to 2. \n Also overwrites adcphase to
|
||||
* recommended default.
|
||||
/** [Eiger][Jungfrau][Gotthard2]
|
||||
* [Jungfrau] Options: FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED \n
|
||||
* [Eiger] Options: FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED \n
|
||||
* [Gotthard2] Options: G2_108MHZ (Default), G2_144MHZ \n
|
||||
* [Jungfrau] FULL_SPEED option only available from v2.0 boards and is
|
||||
* recommended to set number of interfaces to 2. \n Also overwrites adcphase
|
||||
* to recommended default.
|
||||
*/
|
||||
void setSpeed(defs::speedLevel value, Positions pos = {});
|
||||
void setReadoutSpeed(defs::speedLevel value, Positions pos = {});
|
||||
|
||||
/** list of possible readoutspeed modes for this detector */
|
||||
std::vector<defs::speedLevel> getReadoutSpeedList() const;
|
||||
|
||||
/** [Jungfrau][CTB][Moench] */
|
||||
Result<int> getADCPhase(Positions pos = {}) const;
|
||||
@ -397,8 +405,9 @@ class Detector {
|
||||
* [Moench] Default is disabled. \n
|
||||
* [Jungfrau] Default is disabled. Get will return power status. Can be off
|
||||
* if temperature event occured (temperature over temp_threshold with
|
||||
* temp_control enabled. Will configure chip (only chip v1.1)\n [Mythen3][Gotthard2] Default is 1. If module not
|
||||
* connected or wrong module, powerchip will fail.
|
||||
* temp_control enabled. Will configure chip (only chip v1.1)\n
|
||||
* [Mythen3][Gotthard2] Default is 1. If module not connected or wrong
|
||||
* module, powerchip will fail.
|
||||
*/
|
||||
void setPowerChip(bool on, Positions pos = {});
|
||||
|
||||
@ -511,7 +520,9 @@ class Detector {
|
||||
|
||||
/** [Eiger] Number of rows to read out per half module
|
||||
* Options: 0 - 256. 256 is default. The permissible values depend on
|
||||
* dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.
|
||||
* dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module
|
||||
* starting from the centre. Options: 8 - 512, must be multiples of 8.
|
||||
* Default is 512.
|
||||
*/
|
||||
void setReadNRows(const int lines, Positions pos = {});
|
||||
|
||||
@ -1219,7 +1230,8 @@ class Detector {
|
||||
Result<int> getStorageCellStart(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
|
||||
* of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1.
|
||||
* of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3
|
||||
* (default) for chipv1.1.
|
||||
*/
|
||||
void setStorageCellStart(int cell, Positions pos = {});
|
||||
|
||||
@ -1228,7 +1240,7 @@ class Detector {
|
||||
|
||||
/** [Jungfrau] Advanced \n Additional time delay between 2 consecutive
|
||||
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)\n
|
||||
* Only applicable for chipv1.0.
|
||||
* Only applicable for chipv1.0.
|
||||
*/
|
||||
void setStorageCellDelay(ns value, Positions pos = {});
|
||||
|
||||
@ -1360,14 +1372,15 @@ class Detector {
|
||||
/** [Gotthard2] */
|
||||
Result<defs::streamingInterface> getVetoStream(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB (debugging), ALL
|
||||
* Enable or disable the 2 veto streaming interfaces available. Can
|
||||
* concatenate more than one interface. \nLOW_LATENCY_LINK is the default
|
||||
* interface to work with. \nETHERNET_10GB is for debugging and also enables second
|
||||
* interface in receiver for listening to veto packets (writes a separate
|
||||
* file if writing enabled). Also restarts client and receiver zmq sockets
|
||||
* if zmq streaming enabled.*/
|
||||
void setVetoStream(const defs::streamingInterface value, Positions pos = {});
|
||||
/** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB
|
||||
* (debugging), ALL Enable or disable the 2 veto streaming interfaces
|
||||
* available. Can concatenate more than one interface. \nLOW_LATENCY_LINK is
|
||||
* the default interface to work with. \nETHERNET_10GB is for debugging and
|
||||
* also enables second interface in receiver for listening to veto packets
|
||||
* (writes a separate file if writing enabled). Also restarts client and
|
||||
* receiver zmq sockets if zmq streaming enabled.*/
|
||||
void setVetoStream(const defs::streamingInterface value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::vetoAlgorithm>
|
||||
@ -1539,7 +1552,7 @@ class Detector {
|
||||
/** [CTB] */
|
||||
void setDBITClock(int value_in_MHz, Positions pos = {});
|
||||
|
||||
/**
|
||||
/**
|
||||
* [CTB] mV
|
||||
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
|
||||
Result<int> getMeasuredVoltage(defs::dacIndex index,
|
||||
@ -1723,21 +1736,24 @@ class Detector {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/** Advanced user Function!
|
||||
* [Jungfrau][CTB][Moench] fname is a pof file, rebooting the controller is
|
||||
* recommended \n [Mythen3][Gotthard2] fname is an rbf file, power cycling
|
||||
* the detector is recommended
|
||||
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||
* Advanced user Function!
|
||||
* Program firmware from command line, after which detector controller is
|
||||
* rebooted. [Jungfrau][CTB][Moench] fname is a pof file (full path) \n
|
||||
* [Mythen3][Gotthard2] fname is an rbf file (full path)
|
||||
*/
|
||||
void programFPGA(const std::string &fname, Positions pos = {});
|
||||
|
||||
/** [Jungfrau][CTB][Moench] Advanced user Function! */
|
||||
void resetFPGA(Positions pos = {});
|
||||
|
||||
/** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||
/** [Jungfrau][Eiger][Gotthard][CTB][Moench][Mythen3][Gotthard2]
|
||||
* Advanced user Function! \n
|
||||
* Copy detector server fname from tftp folder of hostname to detector \n
|
||||
* [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server, which is
|
||||
* effective after a reboot.
|
||||
* Copy detector server fname from tftp folder of hostname to detector. Also
|
||||
* creates a symbolic link to a shorter name (without vx.x.x). Then the
|
||||
* detector controller reboots (except eiger) \n
|
||||
* [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server (to the
|
||||
* link), which is effective after a reboot.
|
||||
*/
|
||||
void copyDetectorServer(const std::string &fname,
|
||||
const std::string &hostname, Positions pos = {});
|
||||
@ -1748,11 +1764,11 @@ class Detector {
|
||||
|
||||
/**
|
||||
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
|
||||
* firmware, detector server and then reboots detector controller blackfin.
|
||||
* \n [Mythen3][Gotthard2] Will still have old server starting up as the new
|
||||
* server is not respawned \n sname is name of detector server binary found
|
||||
* on tftp folder of host pc \n hostname is name of pc to tftp from \n fname
|
||||
* is programming file name
|
||||
* firmware, detector server, make a soft link and then reboots detector
|
||||
* controller. \n [Mythen3][Gotthard2] Will require a script to start up the
|
||||
* shorter named server link at start up \n sname is name of detector
|
||||
* server binary found on tftp folder of host pc \n hostname is name of pc
|
||||
* to tftp from \n fname is programming file name with full path to it
|
||||
*/
|
||||
void updateFirmwareAndServer(const std::string &sname,
|
||||
const std::string &hostname,
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
@ -68,7 +70,7 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
||||
* @tparam Args template paramter pack to forward
|
||||
*/
|
||||
template <typename... Args>
|
||||
Result(Args &&... args) : vec(std::forward<Args>(args)...) {}
|
||||
Result(Args &&...args) : vec(std::forward<Args>(args)...) {}
|
||||
|
||||
using value_type = typename std::vector<T>::value_type;
|
||||
using iterator = typename std::vector<T>::iterator;
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
/*
|
||||
This file is used to generate the command line binaries
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
#include "CmdParser.h"
|
||||
#include "sls/string_utils.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/*
|
||||
|
||||
This class parses command line input or string input to extract the
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "HelpDacs.h"
|
||||
#include "sls/TimeHelper.h"
|
||||
@ -605,57 +607,38 @@ std::string CmdProxy::Exptime(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Speed(int action) {
|
||||
std::string CmdProxy::ReadoutSpeed(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[0 or full_speed|1 or half_speed|2 or "
|
||||
"quarter_speed]\n\t[Eiger][Jungfrau] Readout speed of "
|
||||
"chip.\n\t[Jungfrau] FULL_SPEED option only available from v2.0 "
|
||||
"boards and with setting number of interfaces to 2. Also "
|
||||
"overwrites adcphase to recommended default. "
|
||||
os << "\n\t[0 or full_speed|1 or half_speed|2 or "
|
||||
"quarter_speed]\n\t\t[Eiger][Jungfrau] Readout "
|
||||
"speed of chip.\n\t\t[Eiger] Default speed is full_speed."
|
||||
"\n\t\t[Jungfrau] Default speed is half_speed. full_speed "
|
||||
"option only available from v2.0 boards and is recommended to "
|
||||
"set "
|
||||
"number of interfaces to 2. Also overwrites "
|
||||
"adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] "
|
||||
"Readout speed of chip in MHz. Default is 108."
|
||||
<< '\n';
|
||||
} else {
|
||||
defs::detectorType type = det->getDetectorType().squash();
|
||||
if (type == defs::CHIPTESTBOARD || type == defs::MOENCH) {
|
||||
throw sls::RuntimeError(
|
||||
"Speed not implemented. Did you mean runclk?");
|
||||
}
|
||||
if (type != defs::EIGER && type != defs::JUNGFRAU) {
|
||||
throw sls::RuntimeError(
|
||||
"Speed not implemented."); // setspped one function problem. tbr
|
||||
// after change
|
||||
"ReadoutSpeed not implemented. Did you mean runclk?");
|
||||
}
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getSpeed(std::vector<int>{det_id});
|
||||
auto t = det->getReadoutSpeed(std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::speedLevel t;
|
||||
try {
|
||||
int ival = StringTo<int>(args[0]);
|
||||
switch (ival) {
|
||||
case 0:
|
||||
t = defs::FULL_SPEED;
|
||||
break;
|
||||
case 1:
|
||||
t = defs::HALF_SPEED;
|
||||
break;
|
||||
case 2:
|
||||
t = defs::QUARTER_SPEED;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError("Unknown speed " + args[0]);
|
||||
}
|
||||
} catch (...) {
|
||||
t = sls::StringTo<defs::speedLevel>(args[0]);
|
||||
}
|
||||
det->setSpeed(t, std::vector<int>{det_id});
|
||||
defs::speedLevel t = sls::StringTo<defs::speedLevel>(args[0]);
|
||||
det->setReadoutSpeed(t, std::vector<int>{det_id});
|
||||
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
@ -965,7 +948,8 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. Default "
|
||||
os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. "
|
||||
"Default "
|
||||
"is disabled.\n\t[0|1] [fix|nofix] [select source] [(only for "
|
||||
"chipv1.1)normal|low]\n\t\t[Jungfrau] Disable or enable current "
|
||||
"source with some parameters. The select source is 0-63 for "
|
||||
@ -995,7 +979,7 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
}
|
||||
if (args.size() == 3) {
|
||||
det->setCurrentSource(defs::currentSrcParameters(
|
||||
fix, StringTo<int64_t>(args[2])));
|
||||
fix, StringTo<uint64_t>(args[2])));
|
||||
} else if (args.size() == 4) {
|
||||
bool normalCurrent = false;
|
||||
if (args[3] == "normal") {
|
||||
@ -1007,7 +991,7 @@ std::string CmdProxy::CurrentSource(int action) {
|
||||
". Did you mean normal or low?");
|
||||
}
|
||||
det->setCurrentSource(defs::currentSrcParameters(
|
||||
fix, StringTo<int64_t>(args[2]), normalCurrent));
|
||||
fix, StringTo<uint64_t>(args[2]), normalCurrent));
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Invalid number of parareters for this command.");
|
||||
@ -1338,7 +1322,8 @@ std::string CmdProxy::Trigger(int action) {
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "trigger") {
|
||||
os << "\n\t[Eiger][Mythen3] Sends software trigger signal to detector";
|
||||
os << "\n\t[Eiger][Mythen3] Sends software trigger signal to "
|
||||
"detector";
|
||||
} else if (cmd == "blockingtrigger") {
|
||||
os << "\n\t[Eiger] Sends software trigger signal to detector and "
|
||||
"blocks till "
|
||||
@ -2050,7 +2035,8 @@ std::string CmdProxy::VetoStreaming(int action) {
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[none|lll|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 "
|
||||
"veto streaming interfaces available. Can include more than one "
|
||||
"interface. \n\tDefault: none. lll (low latency link) is the default "
|
||||
"interface. \n\tDefault: none. lll (low latency link) is the "
|
||||
"default "
|
||||
"interface to work with. \n\t10GbE is for debugging and also "
|
||||
"enables second interface in receiver for listening to veto "
|
||||
"packets (writes a separate file if writing enabled). Also "
|
||||
@ -2833,10 +2819,11 @@ std::string CmdProxy::ProgramFpga(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs "
|
||||
"FPGA from pof file. Rebooting controller is recommended. "
|
||||
"\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file. Power "
|
||||
"cycling the detector is recommended. "
|
||||
os << "[fname.pof | fname.rbf (full path)]\n\t[Jungfrau][Ctb][Moench] "
|
||||
"Programs FPGA from pof file (full path). Then, detector "
|
||||
"controller is rebooted \n\t[Mythen3][Gotthard2] Programs FPGA "
|
||||
"from rbf file (full path). Then, detector controller is "
|
||||
"rebooted."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
@ -2856,11 +2843,13 @@ std::string CmdProxy::CopyDetectorServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[server_name] "
|
||||
"[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] "
|
||||
"Copies detector server via tftp from pc. "
|
||||
"\n\t[Jungfrau][Ctb][Moench]Also changes respawn server, which "
|
||||
"is effective after a reboot."
|
||||
os << "[server_name (in tftp folder)] "
|
||||
"[pc_host_name]\n\t[Jungfrau][Eiger][Ctb][Moench][Mythen3]["
|
||||
"Gotthard2] Copies detector server via tftp from pc. Ensure that "
|
||||
"server is in the pc's tftp folder. Makes a symbolic link with a "
|
||||
"shorter name (without vx.x.x). Then, detector reboots (except "
|
||||
"Eiger).\n\t[Jungfrau][Ctb][Moench]Also changes respawn server "
|
||||
"to the link, which is effective after a reboot."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
@ -2880,14 +2869,14 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[server_name] [pc_host_name] "
|
||||
"[fname.pof]\n\t[Jungfrau][Gotthard][CTB][Moench] Updates the "
|
||||
"firmware, detector server and then reboots detector controller "
|
||||
"blackfin. \n\t[Mythen3][Gotthard2] Will still have old server "
|
||||
"starting up as the new server is not respawned \n\tsname is "
|
||||
"name of detector server binary found on tftp folder of host pc "
|
||||
"\n\thostname is name of pc to tftp from \n\tfname is "
|
||||
"programming file name"
|
||||
os << "[server_name (in tftp folder)] [pc_host_name] [fname.pof (incl "
|
||||
"full path)]\n\t[Jungfrau][Gotthard][CTB][Moench] Updates the "
|
||||
"firmware, detector server, creates the symbolic link and then "
|
||||
"reboots detector controller. \n\t[Mythen3][Gotthard2] will "
|
||||
"require a script to start up the shorter named server link at "
|
||||
"start up. \n\tsname is name of detector server binary found on "
|
||||
"tftp folder of host pc \n\thostname is name of pc to tftp from "
|
||||
"\n\tfname is programming file name"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
throw sls::RuntimeError("Cannot get");
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
|
||||
#include "sls/Detector.h"
|
||||
@ -591,7 +593,8 @@ class CmdProxy {
|
||||
/* acquisition parameters */
|
||||
{"cycles", "triggers"},
|
||||
{"cyclesl", "triggersl"},
|
||||
{"clkdivider", "speed"},
|
||||
{"clkdivider", "readoutspeed"},
|
||||
{"speed", "readoutspeed"},
|
||||
{"vhighvoltage", "highvoltage"},
|
||||
{"digitest", "imagetest"},
|
||||
{"filter", "filterresistor"},
|
||||
@ -792,7 +795,8 @@ class CmdProxy {
|
||||
{"drlist", &CmdProxy::drlist},
|
||||
{"timing", &CmdProxy::timing},
|
||||
{"timinglist", &CmdProxy::timinglist},
|
||||
{"speed", &CmdProxy::Speed},
|
||||
{"readoutspeed", &CmdProxy::ReadoutSpeed},
|
||||
{"readoutspeedlist", &CmdProxy::readoutspeedlist},
|
||||
{"adcphase", &CmdProxy::Adcphase},
|
||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||
{"dbitphase", &CmdProxy::Dbitphase},
|
||||
@ -1097,7 +1101,7 @@ class CmdProxy {
|
||||
std::string Acquire(int action);
|
||||
std::string Exptime(int action);
|
||||
std::string DynamicRange(int action);
|
||||
std::string Speed(int action);
|
||||
std::string ReadoutSpeed(int action);
|
||||
std::string Adcphase(int action);
|
||||
std::string Dbitphase(int action);
|
||||
std::string ClockFrequency(int action);
|
||||
@ -1205,10 +1209,10 @@ class CmdProxy {
|
||||
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
||||
"Serial number of detector.");
|
||||
|
||||
GET_COMMAND(
|
||||
moduleid, getModuleId,
|
||||
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
||||
"that is streamed out in the UDP header of the detector. Picked up from a file on the module.");
|
||||
GET_COMMAND(moduleid, getModuleId,
|
||||
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
||||
"that is streamed out in the UDP header of the detector. "
|
||||
"Picked up from a file on the module.");
|
||||
|
||||
GET_COMMAND(type, getDetectorType,
|
||||
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
|
||||
@ -1328,6 +1332,10 @@ class CmdProxy {
|
||||
GET_COMMAND_NOID(timinglist, getTimingModeList,
|
||||
"\n\tGets the list of timing modes for this detector.");
|
||||
|
||||
GET_COMMAND_NOID(
|
||||
readoutspeedlist, getReadoutSpeedList,
|
||||
"\n\tList of readout speed levels implemented for this detector.");
|
||||
|
||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
||||
"ADC clock.");
|
||||
@ -1349,7 +1357,8 @@ class CmdProxy {
|
||||
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
||||
"will return power status. Can be off if temperature event occured "
|
||||
"(temperature over temp_threshold with temp_control "
|
||||
"enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not "
|
||||
"enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] "
|
||||
"Default is 1. If module not "
|
||||
"connected or wrong module, powerchip will fail.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
@ -1382,7 +1391,10 @@ class CmdProxy {
|
||||
readnrows, getReadNRows, setReadNRows, StringTo<int>,
|
||||
"\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module "
|
||||
"starting from the centre. Options: 0 - 256. 256 is default. The "
|
||||
"permissible values depend on dynamic range and 10Gbe enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");
|
||||
"permissible values depend on dynamic range and 10Gbe "
|
||||
"enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows "
|
||||
"per module starting from the centre. Options: 8 - 512, must be "
|
||||
"multiples of 8. Default is 512.");
|
||||
|
||||
/** temperature */
|
||||
GET_COMMAND_NOID(
|
||||
@ -1537,10 +1549,11 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
|
||||
"Effective only when number of interfaces is 1. Default: 0 (outer)");
|
||||
|
||||
GET_COMMAND(udp_numdst, getNumberofUDPDestinations,
|
||||
"\n\t[Jungfrau][Eiger] One can enter upto 32 "
|
||||
"destinations that the detector will stream images "
|
||||
"out in a round robin fashion. This is get only command. Default: 1");
|
||||
GET_COMMAND(
|
||||
udp_numdst, getNumberofUDPDestinations,
|
||||
"\n\t[Jungfrau][Eiger] One can enter upto 32 "
|
||||
"destinations that the detector will stream images "
|
||||
"out in a round robin fashion. This is get only command. Default: 1");
|
||||
|
||||
EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations,
|
||||
"\n\tClears udp destination details on the detector.");
|
||||
@ -1548,7 +1561,8 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
|
||||
StringTo<int>,
|
||||
"[0 - 31 (or number of udp destinations)]\n\t[Jungfrau] One can set which is the first "
|
||||
"[0 - 31 (or number of udp destinations)]\n\t[Jungfrau] One can set "
|
||||
"which is the first "
|
||||
"destination that the detector will stream images "
|
||||
"out from in a round robin fashion. The entry must not have been "
|
||||
"empty. Default: 0");
|
||||
@ -1856,10 +1870,9 @@ class CmdProxy {
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
|
||||
"frame period between last sub frame and previous one.");
|
||||
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
activate, getActive, setActive, StringTo<int>,
|
||||
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data.");
|
||||
INTEGER_COMMAND_VEC_ID(activate, getActive, setActive, StringTo<int>,
|
||||
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates "
|
||||
"readout and does not send data.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
partialreset, getPartialReset, setPartialReset, StringTo<int>,
|
||||
@ -1912,7 +1925,8 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||
storagecells, getNumberOfAdditionalStorageCells,
|
||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage cells. Default is "
|
||||
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage "
|
||||
"cells. Default is "
|
||||
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
||||
"(#storagecells + 1).");
|
||||
|
||||
@ -1920,13 +1934,15 @@ class CmdProxy {
|
||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||
StringTo<int>,
|
||||
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
||||
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. For advanced users only.");
|
||||
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for "
|
||||
"chipv1.1. For advanced users only.");
|
||||
|
||||
TIME_COMMAND(
|
||||
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
||||
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
||||
"Additional time delay between 2 consecutive exposures in burst mode "
|
||||
"(resolution of 25ns). Only applicable for chipv1.0. For advanced users only.");
|
||||
"(resolution of 25ns). Only applicable for chipv1.0. For advanced "
|
||||
"users only.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
gainmode, getGainMode, setGainMode,
|
||||
@ -1935,9 +1951,10 @@ class CmdProxy {
|
||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||
"you can damage the detector!!!");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
filtercell, getFilterCell, setFilterCell, sls::StringTo<int>,
|
||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for chipv1.1. Advanced user Command");
|
||||
INTEGER_COMMAND_VEC_ID(filtercell, getFilterCell, setFilterCell,
|
||||
sls::StringTo<int>,
|
||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
||||
"chipv1.1. Advanced user Command");
|
||||
|
||||
/* Gotthard Specific */
|
||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "sls/Detector.h"
|
||||
#include "sls/detectorData.h"
|
||||
|
||||
@ -412,18 +414,25 @@ std::vector<defs::timingMode> Detector::getTimingModeList() const {
|
||||
}
|
||||
}
|
||||
|
||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
|
||||
Result<defs::speedLevel> speedResult(res.size());
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
|
||||
}
|
||||
return speedResult;
|
||||
Result<defs::speedLevel> Detector::getReadoutSpeed(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getReadoutSpeed, pos);
|
||||
}
|
||||
|
||||
void Detector::setSpeed(defs::speedLevel value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setClockDivider, pos, defs::RUN_CLOCK,
|
||||
static_cast<int>(value));
|
||||
void Detector::setReadoutSpeed(defs::speedLevel value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setReadoutSpeed, pos, value);
|
||||
}
|
||||
|
||||
std::vector<defs::speedLevel> Detector::getReadoutSpeedList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::EIGER:
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::speedLevel>{defs::FULL_SPEED, defs::HALF_SPEED,
|
||||
defs::QUARTER_SPEED};
|
||||
case defs::GOTTHARD2:
|
||||
return std::vector<defs::speedLevel>{defs::G2_108MHZ, defs::G2_144MHZ};
|
||||
default:
|
||||
throw RuntimeError("Readout speed not implemented for this detector");
|
||||
}
|
||||
}
|
||||
|
||||
Result<int> Detector::getADCPhase(Positions pos) const {
|
||||
@ -657,10 +666,6 @@ void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
||||
pimpl->setDefaultDac(index, defaultValue, sett, pos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
|
||||
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
|
||||
}
|
||||
@ -822,10 +827,6 @@ Result<std::string> Detector::getScanErrorMessage(Positions pos) const {
|
||||
// Network Configuration (Detector<->Receiver)
|
||||
|
||||
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
|
||||
if (getDetectorType().squash() != defs::JUNGFRAU) {
|
||||
throw sls::RuntimeError(
|
||||
"Cannot set number of udp interfaces for this detector.");
|
||||
}
|
||||
// also called by vetostream (for gotthard2)
|
||||
return pimpl->getNumberofUDPInterfaces(pos);
|
||||
}
|
||||
@ -1450,7 +1451,6 @@ void Detector::setActive(const bool active, Positions pos) {
|
||||
pimpl->Parallel(&Module::setActivate, pos, active);
|
||||
}
|
||||
|
||||
|
||||
Result<bool> Detector::getPartialReset(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getCounterBit, pos);
|
||||
}
|
||||
@ -1565,12 +1565,9 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::gainMode>{defs::DYNAMIC,
|
||||
defs::FORCE_SWITCH_G1,
|
||||
defs::FORCE_SWITCH_G2,
|
||||
defs::FIX_G1,
|
||||
defs::FIX_G2,
|
||||
defs::FIX_G0};
|
||||
return std::vector<defs::gainMode>{
|
||||
defs::DYNAMIC, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
|
||||
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||
@ -1717,19 +1714,22 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
||||
return res;
|
||||
}
|
||||
|
||||
void Detector::setVetoStream(defs::streamingInterface interface, Positions pos) {
|
||||
void Detector::setVetoStream(defs::streamingInterface interface,
|
||||
Positions pos) {
|
||||
// 3gbe
|
||||
bool LOW_LATENCY_LINK = ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
|
||||
defs::streamingInterface::LOW_LATENCY_LINK);
|
||||
bool LOW_LATENCY_LINK =
|
||||
((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
|
||||
defs::streamingInterface::LOW_LATENCY_LINK);
|
||||
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
||||
|
||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
|
||||
"retrieved inconsistent number of udp interfaces");
|
||||
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||
defs::streamingInterface::ETHERNET_10GB)
|
||||
? 2
|
||||
: 1);
|
||||
int numinterfaces =
|
||||
(((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||
defs::streamingInterface::ETHERNET_10GB)
|
||||
? 2
|
||||
: 1);
|
||||
if (numinterfaces != old_numinterfaces) {
|
||||
setNumberofUDPInterfaces_(numinterfaces, pos);
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "SharedMemory.h"
|
||||
@ -289,7 +291,9 @@ void DetectorImpl::updateDetectorSize() {
|
||||
const slsDetectorDefs::xy det_size = modules[0]->getNumberOfChannels();
|
||||
|
||||
if (det_size.x == 0 || det_size.y == 0) {
|
||||
throw sls::RuntimeError("Module size for x or y dimensions is 0. Unable to proceed in updating detector size. ");
|
||||
throw sls::RuntimeError(
|
||||
"Module size for x or y dimensions is 0. Unable to proceed in "
|
||||
"updating detector size. ");
|
||||
}
|
||||
|
||||
int maxx = shm()->numberOfChannels.x;
|
||||
@ -1092,13 +1096,13 @@ int DetectorImpl::acquire() {
|
||||
// start and read all
|
||||
try {
|
||||
if (detector_type == defs::MYTHEN3 && modules.size() > 1) {
|
||||
//Multi module mythen
|
||||
// Multi module mythen
|
||||
std::vector<int> master;
|
||||
std::vector<int> slaves;
|
||||
auto is_master = Parallel(&Module::isMaster, {});
|
||||
slaves.reserve(modules.size() - 1); // check this one!!
|
||||
for (size_t i = 0; i < modules.size(); ++i) {
|
||||
if(is_master[i])
|
||||
if (is_master[i])
|
||||
master.push_back(i);
|
||||
else
|
||||
slaves.push_back(i);
|
||||
@ -1106,7 +1110,7 @@ int DetectorImpl::acquire() {
|
||||
Parallel(&Module::startAcquisition, slaves);
|
||||
Parallel(&Module::startAndReadAll, master);
|
||||
} else {
|
||||
//Normal acquire
|
||||
// Normal acquire
|
||||
Parallel(&Module::startAndReadAll, {});
|
||||
}
|
||||
|
||||
@ -1358,7 +1362,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||
LOG(logINFOBLUE) << "File has been converted to " << destfname;
|
||||
|
||||
// loading dst file to memory
|
||||
// FILE *fp = fopen("/tmp/SLS_DET_MCB.tzgmUT", "r");
|
||||
// FILE *fp = fopen("/tmp/SLS_DET_MCB.tzgmUT", "r");
|
||||
FILE *fp = fopen(destfname, "r");
|
||||
if (fp == nullptr) {
|
||||
throw RuntimeError("Program FPGA: Could not open rawbin file");
|
||||
@ -1382,7 +1386,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
||||
"Program FPGA: Could not close destination file after converting");
|
||||
}
|
||||
|
||||
//unlink(destfname); // delete temporary file
|
||||
// unlink(destfname); // delete temporary file
|
||||
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
|
||||
LOG(logDEBUG1) << "Read file into memory";
|
||||
return buffer;
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
|
||||
#include "SharedMemory.h"
|
||||
@ -17,7 +19,7 @@ class detectorData;
|
||||
|
||||
#define DETECTOR_SHMAPIVERSION 0x190809
|
||||
#define DETECTOR_SHMVERSION 0x201007
|
||||
#define SHORT_STRING_LENGTH 50
|
||||
#define SHORT_STRING_LENGTH 50
|
||||
|
||||
#include <future>
|
||||
#include <numeric>
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "sls/string_utils.h"
|
||||
|
||||
std::string GetHelpDac(std::string dac) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "Module.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "sls/ClientSocket.h"
|
||||
@ -475,7 +477,8 @@ bool Module::getFlipRows() const {
|
||||
void Module::setFlipRows(bool value) {
|
||||
if (shm()->detType == EIGER) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver<int>(rxIndex, F_SET_FLIP_ROWS_RECEIVER, static_cast<int>(value));
|
||||
sendToReceiver<int>(rxIndex, F_SET_FLIP_ROWS_RECEIVER,
|
||||
static_cast<int>(value));
|
||||
} else {
|
||||
sendToDetector(F_SET_FLIP_ROWS, static_cast<int>(value), nullptr);
|
||||
}
|
||||
@ -505,7 +508,7 @@ void Module::setNumberOfTriggers(int64_t value) {
|
||||
sendToDetector(F_SET_NUM_TRIGGERS, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,7 +525,7 @@ void Module::setExptime(int gateIndex, int64_t value) {
|
||||
sendToDetector(F_SET_EXPTIME, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_EXPTIME, args, nullptr);
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_EXPTIME, args, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
@ -537,7 +540,7 @@ void Module::setPeriod(int64_t value) {
|
||||
sendToDetector(F_SET_PERIOD, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_PERIOD, value, nullptr);
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_PERIOD, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,11 +589,11 @@ void Module::setDynamicRange(int dr) {
|
||||
if (dr == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
|
||||
"Dynamic Range of 32";
|
||||
setClockDivider(RUN_CLOCK, 2);
|
||||
setReadoutSpeed(defs::QUARTER_SPEED);
|
||||
} else {
|
||||
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of "
|
||||
<< dr;
|
||||
setClockDivider(RUN_CLOCK, 0);
|
||||
setReadoutSpeed(defs::FULL_SPEED);
|
||||
}
|
||||
// EIGER only, update speed and rate correction when dr changes
|
||||
if (dr != prev_val) {
|
||||
@ -607,10 +610,18 @@ void Module::setTimingMode(timingMode value) {
|
||||
sendToDetector<int>(F_SET_TIMING_MODE, value);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
slsDetectorDefs::speedLevel Module::getReadoutSpeed() const {
|
||||
return sendToDetector<speedLevel>(F_GET_READOUT_SPEED);
|
||||
}
|
||||
|
||||
void Module::setReadoutSpeed(speedLevel value) {
|
||||
sendToDetector(F_SET_READOUT_SPEED, value, nullptr);
|
||||
}
|
||||
|
||||
int Module::getClockDivider(int clkIndex) const {
|
||||
return sendToDetector<int>(F_GET_CLOCK_DIVIDER, clkIndex);
|
||||
}
|
||||
@ -758,14 +769,14 @@ void Module::setReadNRows(const int value) {
|
||||
|
||||
void Module::startReceiver() {
|
||||
shm()->stoppedFlag = false;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_START_RECEIVER);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_START_RECEIVER);
|
||||
}
|
||||
|
||||
void Module::stopReceiver() {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_STOP_RECEIVER, static_cast<int>(shm()->stoppedFlag),
|
||||
nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_STOP_RECEIVER,
|
||||
static_cast<int>(shm()->stoppedFlag), nullptr);
|
||||
}
|
||||
|
||||
void Module::startAcquisition() {
|
||||
@ -803,8 +814,8 @@ void Module::stopAcquisition() {
|
||||
}
|
||||
|
||||
void Module::restreamStopFromReceiver() {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RESTREAM_STOP_FROM_RECEIVER);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RESTREAM_STOP_FROM_RECEIVER);
|
||||
}
|
||||
|
||||
void Module::startAndReadAll() {
|
||||
@ -817,17 +828,17 @@ slsDetectorDefs::runStatus Module::getRunStatus() const {
|
||||
}
|
||||
|
||||
slsDetectorDefs::runStatus Module::getReceiverStatus() const {
|
||||
const int rxIndex = -1;
|
||||
const int rxIndex = -1;
|
||||
return sendToReceiver<runStatus>(rxIndex, F_GET_RECEIVER_STATUS);
|
||||
}
|
||||
|
||||
double Module::getReceiverProgress() const {
|
||||
const int rxIndex = -1;
|
||||
const int rxIndex = -1;
|
||||
return sendToReceiver<double>(rxIndex, F_GET_RECEIVER_PROGRESS);
|
||||
}
|
||||
|
||||
int64_t Module::getFramesCaughtByReceiver() const {
|
||||
const int rxIndex = -1;
|
||||
const int rxIndex = -1;
|
||||
return sendToReceiver<int64_t>(rxIndex, F_GET_RECEIVER_FRAMES_CAUGHT);
|
||||
}
|
||||
|
||||
@ -836,7 +847,8 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
||||
LOG(logDEBUG1) << "Getting num missing packets";
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = 0;
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname, shm()->receivers[rxIndex].tcpPort);
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname,
|
||||
shm()->receivers[rxIndex].tcpPort);
|
||||
client.Send(F_GET_NUM_MISSING_PACKETS);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw ReceiverError(
|
||||
@ -847,7 +859,7 @@ std::vector<uint64_t> Module::getNumMissingPackets() const {
|
||||
std::vector<uint64_t> retval(nports);
|
||||
client.Receive(retval);
|
||||
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleIndex
|
||||
<< ": " << sls::ToString(retval);
|
||||
<< ": " << sls::ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
@ -874,7 +886,7 @@ void Module::setScan(const defs::scanParameters t) {
|
||||
auto retval = sendToDetector<int64_t>(F_SET_SCAN, t);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_SCAN, t, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_SCAN, t, nullptr);
|
||||
}
|
||||
// if disabled, retval is 1, else its number of steps
|
||||
setNumberOfFrames(retval);
|
||||
@ -902,7 +914,7 @@ void Module::setNumberofUDPInterfaces(int n) {
|
||||
shm()->numUDPInterfaces = n;
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1024,7 +1036,7 @@ void Module::setDestinationUDPIP(const IpAddr ip, const int rxIndex) {
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0LU);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac of Module [" << moduleIndex
|
||||
<< ", " << rxIndex << "] to " << retval;
|
||||
if (rxIndex == 0) {
|
||||
@ -1061,7 +1073,7 @@ void Module::setDestinationUDPIP2(const IpAddr ip, const int rxIndex) {
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
sls::MacAddr retval(0LU);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_IP2, ip, retval);
|
||||
LOG(logINFO) << "Setting destination udp mac2 of Module " << moduleIndex
|
||||
<< " to " << retval;
|
||||
if (rxIndex == 0) {
|
||||
@ -1096,7 +1108,7 @@ void Module::setDestinationUDPMAC(const MacAddr mac, const int rxIndex) {
|
||||
}
|
||||
|
||||
sls::MacAddr Module::getDestinationUDPMAC2(const int rxIndex) const {
|
||||
if (rxIndex == 0) {
|
||||
if (rxIndex == 0) {
|
||||
return sendToDetector<sls::MacAddr>(F_GET_DEST_UDP_MAC2);
|
||||
}
|
||||
auto t = getDestinationUDPList(rxIndex);
|
||||
@ -1117,7 +1129,7 @@ void Module::setDestinationUDPMAC2(const MacAddr mac, const int rxIndex) {
|
||||
}
|
||||
|
||||
int Module::getDestinationUDPPort(const int rxIndex) const {
|
||||
if (rxIndex == 0) {
|
||||
if (rxIndex == 0) {
|
||||
return sendToDetector<int>(F_GET_DEST_UDP_PORT);
|
||||
}
|
||||
auto t = getDestinationUDPList(rxIndex);
|
||||
@ -1133,12 +1145,12 @@ void Module::setDestinationUDPPort(const int port, const int rxIndex) {
|
||||
setDestinationUDPList(t);
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT, port, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT, port, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getDestinationUDPPort2(const int rxIndex) const {
|
||||
if (rxIndex == 0) {
|
||||
if (rxIndex == 0) {
|
||||
return sendToDetector<int>(F_GET_DEST_UDP_PORT2);
|
||||
}
|
||||
auto t = getDestinationUDPList(rxIndex);
|
||||
@ -1154,7 +1166,7 @@ void Module::setDestinationUDPPort2(const int port, const int rxIndex) {
|
||||
setDestinationUDPList(t);
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT2, port, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_UDP_PORT2, port, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1166,15 +1178,15 @@ void Module::validateUDPConfiguration() {
|
||||
|
||||
std::string Module::printReceiverConfiguration(const int rxIndex) {
|
||||
std::ostringstream os;
|
||||
os << "\n\nModule " << moduleIndex << "\nReceiver [" << rxIndex << "] Hostname:\t"
|
||||
<< getReceiverHostname(rxIndex);
|
||||
os << "\n\nModule " << moduleIndex << "\nReceiver [" << rxIndex
|
||||
<< "] Hostname:\t" << getReceiverHostname(rxIndex);
|
||||
|
||||
if (shm()->detType == JUNGFRAU) {
|
||||
os << "\nNumber of Interfaces:\t" << getNumberofUDPInterfaces()
|
||||
<< "\nSelected Interface:\t" << getSelectedUDPInterface();
|
||||
}
|
||||
auto t = getDestinationUDPList(rxIndex);
|
||||
|
||||
|
||||
os << "\nSource UDP IP:\t" << getSourceUDPIP() << "\nSource UDP MAC:\t"
|
||||
<< getSourceUDPMAC() << "\nDestination UDP IP:\t" << t.ip
|
||||
<< "\nDestination UDP MAC:\t" << t.mac;
|
||||
@ -1182,8 +1194,8 @@ std::string Module::printReceiverConfiguration(const int rxIndex) {
|
||||
if (shm()->detType == JUNGFRAU) {
|
||||
os << "\nSource UDP IP2:\t" << getSourceUDPIP2()
|
||||
<< "\nSource UDP MAC2:\t" << getSourceUDPMAC2()
|
||||
<< "\nDestination UDP IP2:\t" << t.ip2
|
||||
<< "\nDestination UDP MAC2:\t" << t.mac2;
|
||||
<< "\nDestination UDP IP2:\t" << t.ip2 << "\nDestination UDP MAC2:\t"
|
||||
<< t.mac2;
|
||||
}
|
||||
os << "\nDestination UDP Port:\t" << t.port;
|
||||
if (shm()->detType == JUNGFRAU || shm()->detType == EIGER) {
|
||||
@ -1249,7 +1261,8 @@ std::string Module::getReceiverHostname(const int rxIndex) const {
|
||||
return std::string(shm()->receivers[rxIndex].hostname);
|
||||
}
|
||||
|
||||
void Module::setReceiverHostname(const std::string &receiverIP, const int rxIndex) {
|
||||
void Module::setReceiverHostname(const std::string &receiverIP,
|
||||
const int rxIndex) {
|
||||
LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP;
|
||||
|
||||
if (receiverIP == "none") {
|
||||
@ -1287,7 +1300,7 @@ void Module::setReceiverHostname(const std::string &receiverIP, const int rxInde
|
||||
strcpy_safe(retval.hostname, shm()->hostname);
|
||||
|
||||
sls::MacAddr retvals[2];
|
||||
sendToReceiver(rxIndex, F_SETUP_RECEIVER, retval, retvals);
|
||||
sendToReceiver(rxIndex, F_SETUP_RECEIVER, retval, retvals);
|
||||
// update Modules with dest mac
|
||||
if (retval.udp_dstmac == 0 && retvals[0] != 0) {
|
||||
LOG(logINFO) << "Setting destination udp mac of "
|
||||
@ -1308,7 +1321,9 @@ void Module::setReceiverHostname(const std::string &receiverIP, const int rxInde
|
||||
updateReceiverStreamingIP(rxIndex);
|
||||
}
|
||||
|
||||
int Module::getReceiverPort(const int rxIndex) const { return shm()->receivers[rxIndex].tcpPort; }
|
||||
int Module::getReceiverPort(const int rxIndex) const {
|
||||
return shm()->receivers[rxIndex].tcpPort;
|
||||
}
|
||||
|
||||
int Module::setReceiverPort(int port_number, const int rxIndex) {
|
||||
if (port_number >= 0 && port_number != shm()->receivers[rxIndex].tcpPort) {
|
||||
@ -1334,19 +1349,21 @@ bool Module::getReceiverSilentMode() const {
|
||||
|
||||
void Module::setReceiverSilentMode(bool enable) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_SILENT_MODE, static_cast<int>(enable),
|
||||
nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_SILENT_MODE,
|
||||
static_cast<int>(enable), nullptr);
|
||||
}
|
||||
|
||||
slsDetectorDefs::frameDiscardPolicy
|
||||
Module::getReceiverFramesDiscardPolicy() const {
|
||||
const int rxIndex = 0;
|
||||
return sendToReceiver<frameDiscardPolicy>(rxIndex, F_GET_RECEIVER_DISCARD_POLICY);
|
||||
return sendToReceiver<frameDiscardPolicy>(rxIndex,
|
||||
F_GET_RECEIVER_DISCARD_POLICY);
|
||||
}
|
||||
|
||||
void Module::setReceiverFramesDiscardPolicy(frameDiscardPolicy f) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DISCARD_POLICY, static_cast<int>(f), nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DISCARD_POLICY, static_cast<int>(f),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool Module::getPartialFramesPadding() const {
|
||||
@ -1356,7 +1373,8 @@ bool Module::getPartialFramesPadding() const {
|
||||
|
||||
void Module::setPartialFramesPadding(bool padding) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_PADDING, static_cast<int>(padding), nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_PADDING, static_cast<int>(padding),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
int Module::getReceiverUDPSocketBufferSize() const {
|
||||
@ -1392,8 +1410,8 @@ sls::IpAddr Module::getReceiverLastClientIP() const {
|
||||
|
||||
std::array<pid_t, NUM_RX_THREAD_IDS> Module::getReceiverThreadIds() const {
|
||||
const int rxIndex = 0;
|
||||
return sendToReceiver<std::array<pid_t, NUM_RX_THREAD_IDS>>(rxIndex,
|
||||
F_GET_RECEIVER_THREAD_IDS);
|
||||
return sendToReceiver<std::array<pid_t, NUM_RX_THREAD_IDS>>(
|
||||
rxIndex, F_GET_RECEIVER_THREAD_IDS);
|
||||
}
|
||||
|
||||
// File
|
||||
@ -1404,13 +1422,13 @@ slsDetectorDefs::fileFormat Module::getFileFormat() const {
|
||||
|
||||
void Module::setFileFormat(fileFormat f) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_FORMAT, f, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_FORMAT, f, nullptr);
|
||||
}
|
||||
|
||||
std::string Module::getFilePath() const {
|
||||
char ret[MAX_STR_LENGTH]{};
|
||||
const int rxIndex = 0;
|
||||
sendToReceiver(rxIndex, F_GET_RECEIVER_FILE_PATH, nullptr, ret);
|
||||
sendToReceiver(rxIndex, F_GET_RECEIVER_FILE_PATH, nullptr, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1421,13 +1439,13 @@ void Module::setFilePath(const std::string &path) {
|
||||
char args[MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(args, path.c_str());
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_PATH, args, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_PATH, args, nullptr);
|
||||
}
|
||||
|
||||
std::string Module::getFileName() const {
|
||||
char buff[MAX_STR_LENGTH]{};
|
||||
const int rxIndex = 0;
|
||||
sendToReceiver(rxIndex, F_GET_RECEIVER_FILE_NAME, nullptr, buff);
|
||||
sendToReceiver(rxIndex, F_GET_RECEIVER_FILE_NAME, nullptr, buff);
|
||||
return buff;
|
||||
}
|
||||
|
||||
@ -1438,7 +1456,7 @@ void Module::setFileName(const std::string &fname) {
|
||||
char args[MAX_STR_LENGTH]{};
|
||||
sls::strcpy_safe(args, fname.c_str());
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_NAME, args, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_NAME, args, nullptr);
|
||||
}
|
||||
|
||||
int64_t Module::getFileIndex() const {
|
||||
@ -1448,12 +1466,12 @@ int64_t Module::getFileIndex() const {
|
||||
|
||||
void Module::setFileIndex(int64_t file_index) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_INDEX, file_index, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_INDEX, file_index, nullptr);
|
||||
}
|
||||
|
||||
void Module::incrementFileIndex() {
|
||||
void Module::incrementFileIndex() {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_INCREMENT_FILE_INDEX);
|
||||
sendToReceiver(rxIndex, F_INCREMENT_FILE_INDEX);
|
||||
}
|
||||
|
||||
bool Module::getFileWrite() const {
|
||||
@ -1463,7 +1481,8 @@ bool Module::getFileWrite() const {
|
||||
|
||||
void Module::setFileWrite(bool value) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_WRITE, static_cast<int>(value), nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FILE_WRITE, static_cast<int>(value),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool Module::getMasterFileWrite() const {
|
||||
@ -1473,8 +1492,8 @@ bool Module::getMasterFileWrite() const {
|
||||
|
||||
void Module::setMasterFileWrite(bool value) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_MASTER_FILE_WRITE, static_cast<int>(value),
|
||||
nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_MASTER_FILE_WRITE,
|
||||
static_cast<int>(value), nullptr);
|
||||
}
|
||||
|
||||
bool Module::getFileOverWrite() const {
|
||||
@ -1484,7 +1503,8 @@ bool Module::getFileOverWrite() const {
|
||||
|
||||
void Module::setFileOverWrite(bool value) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_OVERWRITE, static_cast<int>(value), nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_OVERWRITE, static_cast<int>(value),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
int Module::getFramesPerFile() const {
|
||||
@ -1494,7 +1514,7 @@ int Module::getFramesPerFile() const {
|
||||
|
||||
void Module::setFramesPerFile(int n_frames) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_FRAMES_PER_FILE, n_frames, nullptr);
|
||||
}
|
||||
|
||||
// ZMQ Streaming Parameters (Receiver<->Client)
|
||||
@ -1506,7 +1526,8 @@ bool Module::getReceiverStreaming() const {
|
||||
|
||||
void Module::setReceiverStreaming(bool enable) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING, static_cast<int>(enable), nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING, static_cast<int>(enable),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
int Module::getReceiverStreamingFrequency() const {
|
||||
@ -1520,7 +1541,7 @@ void Module::setReceiverStreamingFrequency(int freq) {
|
||||
std::to_string(freq));
|
||||
}
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_FREQUENCY, freq, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_FREQUENCY, freq, nullptr);
|
||||
}
|
||||
|
||||
int Module::getReceiverStreamingTimer() const {
|
||||
@ -1544,7 +1565,7 @@ void Module::setReceiverStreamingStartingFrame(int fnum) {
|
||||
std::to_string(fnum));
|
||||
}
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_START_FNUM, fnum, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_START_FNUM, fnum, nullptr);
|
||||
}
|
||||
|
||||
int Module::getReceiverStreamingPort() const {
|
||||
@ -1554,12 +1575,13 @@ int Module::getReceiverStreamingPort() const {
|
||||
|
||||
void Module::setReceiverStreamingPort(int port) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_PORT, port, nullptr);
|
||||
}
|
||||
|
||||
sls::IpAddr Module::getReceiverStreamingIP() const {
|
||||
const int rxIndex = 0;
|
||||
return sendToReceiver<sls::IpAddr>(rxIndex, F_GET_RECEIVER_STREAMING_SRC_IP);
|
||||
return sendToReceiver<sls::IpAddr>(rxIndex,
|
||||
F_GET_RECEIVER_STREAMING_SRC_IP);
|
||||
}
|
||||
|
||||
void Module::setReceiverStreamingIP(const sls::IpAddr ip, const int rxIndex) {
|
||||
@ -1593,7 +1615,7 @@ int Module::getReceiverStreamingHwm() const {
|
||||
|
||||
void Module::setReceiverStreamingHwm(const int limit) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_HWM, limit, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_STREAMING_HWM, limit, nullptr);
|
||||
}
|
||||
|
||||
// Eiger Specific
|
||||
@ -1609,8 +1631,8 @@ void Module::setSubExptime(int64_t value) {
|
||||
}
|
||||
sendToDetector(F_SET_SUB_EXPTIME, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
@ -1624,8 +1646,8 @@ int64_t Module::getSubDeadTime() const {
|
||||
void Module::setSubDeadTime(int64_t value) {
|
||||
sendToDetector(F_SET_SUB_DEADTIME, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1654,7 +1676,8 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
||||
LOG(logDEBUG) << "Sending to receiver 0 [rate corrections: " << ToString(t)
|
||||
<< ']';
|
||||
// only to master receiver
|
||||
auto client = ReceiverSocket(shm()->receivers[0].hostname, shm()->receivers[0].tcpPort);
|
||||
auto client = ReceiverSocket(shm()->receivers[0].hostname,
|
||||
shm()->receivers[0].tcpPort);
|
||||
client.Send(F_SET_RECEIVER_RATE_CORRECT);
|
||||
client.Send(static_cast<int>(t.size()));
|
||||
client.Send(t);
|
||||
@ -1697,8 +1720,8 @@ void Module::setActivate(const bool enable) {
|
||||
auto retval = sendToDetector<int>(F_ACTIVATE, arg);
|
||||
sendToDetectorStop<int>(F_ACTIVATE, arg);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_ACTIVATE, retval, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_ACTIVATE, retval, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1731,8 +1754,8 @@ void Module::setQuad(const bool enable) {
|
||||
int value = enable ? 1 : 0;
|
||||
sendToDetector(F_SET_QUAD, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_QUAD, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_QUAD, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1744,8 +1767,8 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
||||
int args[]{static_cast<int>(port), static_cast<int>(enable)};
|
||||
sendToDetector(F_SET_DATASTREAM, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_DATASTREAM, args, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_DATASTREAM, args, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1853,8 +1876,8 @@ void Module::setROI(slsDetectorDefs::ROI arg) {
|
||||
}
|
||||
sendToDetector(F_SET_ROI, arg, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_ROI, arg, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_ROI, arg, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1873,8 +1896,8 @@ int64_t Module::getNumberOfBursts() const {
|
||||
void Module::setNumberOfBursts(int64_t value) {
|
||||
sendToDetector(F_SET_NUM_BURSTS, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_BURSTS, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_BURSTS, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2106,8 +2129,8 @@ slsDetectorDefs::burstMode Module::getBurstMode() const {
|
||||
void Module::setBurstMode(slsDetectorDefs::burstMode value) {
|
||||
sendToDetector(F_SET_BURST_MODE, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_BURST_MODE, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_BURST_MODE, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2241,8 +2264,9 @@ void Module::setCounterMask(uint32_t countermask) {
|
||||
sendToDetector(F_SET_COUNTER_MASK, countermask, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending Reciver counter mask: " << countermask;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_COUNTER_MASK, countermask, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_COUNTER_MASK, countermask,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2253,8 +2277,8 @@ int Module::getNumberOfGates() const {
|
||||
void Module::setNumberOfGates(int value) {
|
||||
sendToDetector(F_SET_NUM_GATES, value, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_GATES, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_GATES, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2270,8 +2294,8 @@ void Module::setGateDelay(int gateIndex, int64_t value) {
|
||||
int64_t args[]{static_cast<int64_t>(gateIndex), value};
|
||||
sendToDetector(F_SET_GATE_DELAY, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_GATE_DELAY, args, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_GATE_DELAY, args, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2301,8 +2325,9 @@ void Module::setNumberOfAnalogSamples(int value) {
|
||||
// update #nchan, as it depends on #samples, adcmask
|
||||
updateNumberOfChannels();
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2324,7 +2349,7 @@ void Module::setADCEnableMask(uint32_t mask) {
|
||||
updateNumberOfChannels();
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver<int>(rxIndex, F_RECEIVER_SET_ADC_MASK, mask);
|
||||
}
|
||||
}
|
||||
@ -2338,7 +2363,7 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) {
|
||||
updateNumberOfChannels(); // depends on samples and adcmask
|
||||
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver<int>(rxIndex, F_RECEIVER_SET_ADC_MASK_10G, mask);
|
||||
}
|
||||
}
|
||||
@ -2356,8 +2381,9 @@ void Module::setNumberOfDigitalSamples(int value) {
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of digital samples to Receiver: "
|
||||
<< value;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_NUM_DIGITAL_SAMPLES, value,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2373,8 +2399,8 @@ void Module::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
|
||||
updateNumberOfChannels();
|
||||
}
|
||||
if (shm()->useReceiverFlag) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2396,8 +2422,8 @@ void Module::setExternalSampling(bool value) {
|
||||
|
||||
std::vector<int> Module::getReceiverDbitList() const {
|
||||
const int rxIndex = 0;
|
||||
return sendToReceiver<sls::StaticVector<int, MAX_RX_DBIT>>(rxIndex,
|
||||
F_GET_RECEIVER_DBIT_LIST);
|
||||
return sendToReceiver<sls::StaticVector<int, MAX_RX_DBIT>>(
|
||||
rxIndex, F_GET_RECEIVER_DBIT_LIST);
|
||||
}
|
||||
|
||||
void Module::setReceiverDbitList(std::vector<int> list) {
|
||||
@ -2417,7 +2443,7 @@ void Module::setReceiverDbitList(std::vector<int> list) {
|
||||
|
||||
sls::StaticVector<int, MAX_RX_DBIT> arg = list;
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DBIT_LIST, arg, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DBIT_LIST, arg, nullptr);
|
||||
}
|
||||
|
||||
int Module::getReceiverDbitOffset() const {
|
||||
@ -2427,7 +2453,7 @@ int Module::getReceiverDbitOffset() const {
|
||||
|
||||
void Module::setReceiverDbitOffset(int value) {
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DBIT_OFFSET, value, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_RECEIVER_DBIT_OFFSET, value, nullptr);
|
||||
}
|
||||
|
||||
void Module::setDigitalIODelay(uint64_t pinMask, int delay) {
|
||||
@ -2549,11 +2575,12 @@ std::map<std::string, std::string> Module::getAdditionalJsonHeader() const {
|
||||
"(zmq json header)");
|
||||
}
|
||||
const int rxIndex = 0;
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname, shm()->receivers[rxIndex].tcpPort);
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname,
|
||||
shm()->receivers[rxIndex].tcpPort);
|
||||
client.Send(F_GET_ADDITIONAL_JSON_HEADER);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw ReceiverError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
" returned error: " + client.readErrorMessage());
|
||||
} else {
|
||||
auto size = client.Receive<int>();
|
||||
std::string buff(size, '\0');
|
||||
@ -2595,7 +2622,8 @@ void Module::setAdditionalJsonHeader(
|
||||
LOG(logDEBUG) << "Sending to receiver additional json header "
|
||||
<< ToString(jsonHeader);
|
||||
const int rxIndex = -1;
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname, shm()->receivers[rxIndex].tcpPort);
|
||||
auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname,
|
||||
shm()->receivers[rxIndex].tcpPort);
|
||||
client.Send(F_SET_ADDITIONAL_JSON_HEADER);
|
||||
client.Send(size);
|
||||
if (size > 0)
|
||||
@ -2603,7 +2631,7 @@ void Module::setAdditionalJsonHeader(
|
||||
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
throw RuntimeError("Receiver " + std::to_string(moduleIndex) +
|
||||
" returned error: " + client.readErrorMessage());
|
||||
" returned error: " + client.readErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2612,7 +2640,7 @@ std::string Module::getAdditionalJsonParameter(const std::string &key) const {
|
||||
sls::strcpy_safe(arg, key.c_str());
|
||||
char retval[SHORT_STR_LENGTH]{};
|
||||
const int rxIndex = 0;
|
||||
sendToReceiver(rxIndex, F_GET_ADDITIONAL_JSON_PARAMETER, arg, retval);
|
||||
sendToReceiver(rxIndex, F_GET_ADDITIONAL_JSON_PARAMETER, arg, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -2629,7 +2657,7 @@ void Module::setAdditionalJsonParameter(const std::string &key,
|
||||
sls::strcpy_safe(args[0], key.c_str());
|
||||
sls::strcpy_safe(args[1], value.c_str());
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_SET_ADDITIONAL_JSON_PARAMETER, args, nullptr);
|
||||
sendToReceiver(rxIndex, F_SET_ADDITIONAL_JSON_PARAMETER, args, nullptr);
|
||||
}
|
||||
|
||||
// Advanced
|
||||
@ -2658,7 +2686,18 @@ void Module::copyDetectorServer(const std::string &fname,
|
||||
sls::strcpy_safe(args[1], hostname.c_str());
|
||||
LOG(logINFO) << "Sending detector server " << args[0] << " from host "
|
||||
<< args[1];
|
||||
sendToDetector(F_COPY_DET_SERVER, args, nullptr);
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.Send(F_COPY_DET_SERVER);
|
||||
client.Send(args);
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::cout << '\n';
|
||||
std::ostringstream os;
|
||||
os << "Module " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
<< " returned error: " << client.readErrorMessage();
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
|
||||
<< "): detector server copied";
|
||||
}
|
||||
|
||||
void Module::rebootController() {
|
||||
@ -2727,9 +2766,7 @@ void Module::setControlPort(int port_number) {
|
||||
|
||||
int Module::getStopPort() const { return shm()->stopPort; }
|
||||
|
||||
void Module::setStopPort(int port_number) {
|
||||
shm()->stopPort = port_number;
|
||||
}
|
||||
void Module::setStopPort(int port_number) { shm()->stopPort = port_number; }
|
||||
|
||||
bool Module::getLockDetector() const {
|
||||
return sendToDetector<int>(F_LOCK_SERVER, GET_FLAG);
|
||||
@ -3023,8 +3060,9 @@ Ret Module::sendToDetectorStop(int fnum, const Arg &args) {
|
||||
|
||||
//-------------------------------------------------------------- sendToReceiver
|
||||
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args, size_t args_size,
|
||||
void *retval, size_t retval_size) const {
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args,
|
||||
size_t args_size, void *retval,
|
||||
size_t retval_size) const {
|
||||
// This is the only function that actually sends data to the receiver
|
||||
// the other versions use templates to deduce sizes and create
|
||||
// the return type
|
||||
@ -3036,7 +3074,8 @@ void Module::sendToReceiver(const int rxIndex, int fnum, const void *args, size_
|
||||
}
|
||||
checkArgs(args, args_size, retval, retval_size);
|
||||
if (rxIndex >= MAX_UDP_DESTINATION) {
|
||||
throw RuntimeError("Invalid destination index " + std::to_string(rxIndex));
|
||||
throw RuntimeError("Invalid destination index " +
|
||||
std::to_string(rxIndex));
|
||||
}
|
||||
int startReceiver = 0;
|
||||
int endReceiver = MAX_UDP_DESTINATION;
|
||||
@ -3051,26 +3090,30 @@ void Module::sendToReceiver(const int rxIndex, int fnum, const void *args, size_
|
||||
LOG(logDEBUG1) << "Receiver [" << shm()->receivers[i].hostname << ", "
|
||||
<< shm()->receivers[i].tcpPort << ']';
|
||||
try {
|
||||
auto receiver = ReceiverSocket(shm()->receivers[i].hostname, shm()->receivers[i].tcpPort);
|
||||
auto receiver = ReceiverSocket(shm()->receivers[i].hostname,
|
||||
shm()->receivers[i].tcpPort);
|
||||
receiver.sendCommandThenRead(fnum, args, args_size, retval,
|
||||
retval_size);
|
||||
retval_size);
|
||||
receiver.close();
|
||||
} catch (ReceiverError& e) {
|
||||
} catch (ReceiverError &e) {
|
||||
std::ostringstream oss;
|
||||
oss << e.what() << '[' << shm()->receivers[i].hostname << ", " << shm()->receivers[i].tcpPort << ']';
|
||||
throw ReceiverError (oss.str());
|
||||
oss << e.what() << '[' << shm()->receivers[i].hostname << ", "
|
||||
<< shm()->receivers[i].tcpPort << ']';
|
||||
throw ReceiverError(oss.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args, size_t args_size,
|
||||
void *retval, size_t retval_size) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, args, args_size,
|
||||
retval, retval_size);
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const void *args,
|
||||
size_t args_size, void *retval,
|
||||
size_t retval_size) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(
|
||||
rxIndex, fnum, args, args_size, retval, retval_size);
|
||||
}
|
||||
|
||||
template <typename Arg, typename Ret>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, Ret &retval) const {
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args,
|
||||
Ret &retval) const {
|
||||
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||
<< ", " << args << ", " << sizeof(args) << ", "
|
||||
@ -3082,12 +3125,15 @@ void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, Ret &r
|
||||
}
|
||||
|
||||
template <typename Arg, typename Ret>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, Ret &retval) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, args, retval);
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args,
|
||||
Ret &retval) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, args,
|
||||
retval);
|
||||
}
|
||||
|
||||
template <typename Arg>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, std::nullptr_t) const {
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args,
|
||||
std::nullptr_t) const {
|
||||
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||
<< ", " << typeid(Arg).name() << ", " << sizeof(Arg)
|
||||
@ -3097,12 +3143,15 @@ void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, std::n
|
||||
}
|
||||
|
||||
template <typename Arg>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args, std::nullptr_t) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, args, nullptr);
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args,
|
||||
std::nullptr_t) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, args,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
template <typename Ret>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t, Ret &retval) const {
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
|
||||
Ret &retval) const {
|
||||
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||
<< ", nullptr, 0, " << typeid(Ret).name() << ", "
|
||||
@ -3113,11 +3162,14 @@ void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t, Ret &re
|
||||
}
|
||||
|
||||
template <typename Ret>
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t, Ret &retval) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, nullptr, retval);
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum, std::nullptr_t,
|
||||
Ret &retval) {
|
||||
static_cast<const Module &>(*this).sendToReceiver(rxIndex, fnum, nullptr,
|
||||
retval);
|
||||
}
|
||||
|
||||
template <typename Ret> Ret Module::sendToReceiver(const int rxIndex, int fnum) const {
|
||||
template <typename Ret>
|
||||
Ret Module::sendToReceiver(const int rxIndex, int fnum) const {
|
||||
LOG(logDEBUG1) << "Sending to Receiver " << rxIndex << ": ["
|
||||
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
|
||||
<< ", nullptr, 0, " << typeid(Ret).name() << ", "
|
||||
@ -3129,8 +3181,10 @@ template <typename Ret> Ret Module::sendToReceiver(const int rxIndex, int fnum)
|
||||
return retval;
|
||||
}
|
||||
|
||||
template <typename Ret> Ret Module::sendToReceiver(const int rxIndex, int fnum) {
|
||||
return static_cast<const Module &>(*this).sendToReceiver<Ret>(rxIndex, fnum);
|
||||
template <typename Ret>
|
||||
Ret Module::sendToReceiver(const int rxIndex, int fnum) {
|
||||
return static_cast<const Module &>(*this).sendToReceiver<Ret>(rxIndex,
|
||||
fnum);
|
||||
}
|
||||
|
||||
void Module::sendToReceiver(const int rxIndex, int fnum) const {
|
||||
@ -3160,7 +3214,8 @@ Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args) const {
|
||||
|
||||
template <typename Ret, typename Arg>
|
||||
Ret Module::sendToReceiver(const int rxIndex, int fnum, const Arg &args) {
|
||||
return static_cast<const Module &>(*this).sendToReceiver<Ret>(rxIndex, fnum, args);
|
||||
return static_cast<const Module &>(*this).sendToReceiver<Ret>(rxIndex, fnum,
|
||||
args);
|
||||
}
|
||||
|
||||
slsDetectorDefs::detectorType Module::getDetectorTypeFromShm(int det_id,
|
||||
@ -3267,7 +3322,8 @@ void Module::checkDetectorVersionCompatibility() {
|
||||
void Module::checkReceiverVersionCompatibility() {
|
||||
// TODO! Verify that this works as intended when version don't match
|
||||
const int rxIndex = -1;
|
||||
sendToReceiver(rxIndex, F_RECEIVER_CHECK_VERSION, int64_t(APIRECEIVER), nullptr);
|
||||
sendToReceiver(rxIndex, F_RECEIVER_CHECK_VERSION, int64_t(APIRECEIVER),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
int Module::sendModule(sls_detector_module *myMod, sls::ClientSocket &client) {
|
||||
@ -3337,7 +3393,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO Will need to update to each round robin entry
|
||||
// TODO Will need to update to each round robin entry
|
||||
void Module::updateReceiverStreamingIP(const int rxIndex) {
|
||||
auto ip = getReceiverStreamingIP();
|
||||
if (ip == 0) {
|
||||
@ -3346,8 +3402,8 @@ void Module::updateReceiverStreamingIP(const int rxIndex) {
|
||||
if (ip == 0) {
|
||||
ip = HostnameToIp(shm()->receivers[rxIndex].hostname);
|
||||
}
|
||||
LOG(logINFO) << "Setting default receiver [" << moduleIndex
|
||||
<< " , " << rxIndex << "] streaming zmq ip to " << ip;
|
||||
LOG(logINFO) << "Setting default receiver [" << moduleIndex << " , "
|
||||
<< rxIndex << "] streaming zmq ip to " << ip;
|
||||
}
|
||||
setReceiverStreamingIP(ip, rxIndex);
|
||||
}
|
||||
@ -3629,7 +3685,7 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
currentPointer += unitprogramsize;
|
||||
}
|
||||
|
||||
// checksum
|
||||
// checksum
|
||||
if (client.Receive<int>() == FAIL) {
|
||||
std::ostringstream os;
|
||||
os << "Module " << moduleIndex << " (" << shm()->hostname << ")"
|
||||
@ -3641,8 +3697,8 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
|
||||
// simulating erasing flash
|
||||
{
|
||||
LOG(logINFO) << "(Simulating) Erasing Flash for module " << moduleIndex << " ("
|
||||
<< shm()->hostname << ")";
|
||||
LOG(logINFO) << "(Simulating) Erasing Flash for module " << moduleIndex
|
||||
<< " (" << shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
// erasing takes 65 seconds, printing here (otherwise need threads
|
||||
@ -3652,10 +3708,10 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
while (count > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
--count;
|
||||
printf(
|
||||
"%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||
printf("%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) *
|
||||
100));
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
@ -3663,7 +3719,8 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
|
||||
// simulating writing to flash
|
||||
{
|
||||
LOG(logINFO) << "(Simulating) Writing to Flash for module " << moduleIndex << " (" << shm()->hostname << ")";
|
||||
LOG(logINFO) << "(Simulating) Writing to Flash for module "
|
||||
<< moduleIndex << " (" << shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
// writing takes 30 seconds, printing here (otherwise need threads
|
||||
@ -3673,10 +3730,10 @@ void Module::programFPGAviaBlackfin(std::vector<char> buffer) {
|
||||
while (count > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
--count;
|
||||
printf(
|
||||
"%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||
printf("%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) *
|
||||
100));
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
@ -3719,8 +3776,8 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
|
||||
// simulating erasing flash
|
||||
{
|
||||
LOG(logINFO) << "(Simulating) Erasing Flash for module " << moduleIndex << " ("
|
||||
<< shm()->hostname << ")";
|
||||
LOG(logINFO) << "(Simulating) Erasing Flash for module " << moduleIndex
|
||||
<< " (" << shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
// erasing takes 10 seconds, printing here (otherwise need threads
|
||||
@ -3730,10 +3787,10 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
while (count > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
--count;
|
||||
printf(
|
||||
"%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||
printf("%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) *
|
||||
100));
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
@ -3741,7 +3798,8 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
|
||||
// simulating writing to flash
|
||||
{
|
||||
LOG(logINFO) << "(Simulating) Writing to Flash for module " << moduleIndex << " (" << shm()->hostname << ")";
|
||||
LOG(logINFO) << "(Simulating) Writing to Flash for module "
|
||||
<< moduleIndex << " (" << shm()->hostname << ")";
|
||||
printf("%d%%\r", 0);
|
||||
std::cout << std::flush;
|
||||
// writing takes 45 seconds, printing here (otherwise need threads
|
||||
@ -3751,10 +3809,10 @@ void Module::programFPGAviaNios(std::vector<char> buffer) {
|
||||
while (count > 0) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
--count;
|
||||
printf(
|
||||
"%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) * 100));
|
||||
printf("%d%%\r",
|
||||
static_cast<int>(
|
||||
(static_cast<double>(ERASE_TIME - count) / ERASE_TIME) *
|
||||
100));
|
||||
std::cout << std::flush;
|
||||
}
|
||||
printf("\n");
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include "SharedMemory.h"
|
||||
#include "sls/ClientSocket.h"
|
||||
@ -152,6 +154,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setDynamicRange(int dr);
|
||||
timingMode getTimingMode() const;
|
||||
void setTimingMode(timingMode value);
|
||||
speedLevel getReadoutSpeed() const;
|
||||
void setReadoutSpeed(speedLevel value);
|
||||
int getClockDivider(int clkIndex) const;
|
||||
void setClockDivider(int clkIndex, int value);
|
||||
int getClockPhase(int clkIndex, bool inDegrees) const;
|
||||
@ -393,7 +397,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setGainMode(const gainMode mode);
|
||||
int getFilterCell() const;
|
||||
void setFilterCell(int value);
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Gotthard Specific *
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "sls/Pattern.h"
|
||||
#include "sls/ToString.h"
|
||||
#include "sls/logger.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
/************************************************
|
||||
* @file SharedMemory.h
|
||||
@ -24,7 +26,7 @@
|
||||
|
||||
#define SHM_DETECTOR_PREFIX "/slsDetectorPackage_detector_"
|
||||
#define SHM_MODULE_PREFIX "_module_"
|
||||
#define SHM_ENV_NAME "SLSDETNAME"
|
||||
#define SHM_ENV_NAME "SLSDETNAME"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -1,3 +1,5 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
target_sources(tests PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-SharedMemory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdParser.h"
|
||||
#include "catch.hpp"
|
||||
#include <exception>
|
||||
@ -147,18 +149,18 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Parse string with --help"){
|
||||
TEST_CASE("Parse string with --help") {
|
||||
CmdParser p;
|
||||
p.Parse("list --help");
|
||||
REQUIRE(p.isHelp()==true);
|
||||
REQUIRE(p.command()=="list");
|
||||
REQUIRE(p.isHelp() == true);
|
||||
REQUIRE(p.command() == "list");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse string with -h"){
|
||||
TEST_CASE("Parse string with -h") {
|
||||
CmdParser p;
|
||||
p.Parse("list -h");
|
||||
REQUIRE(p.isHelp()==true);
|
||||
REQUIRE(p.command()=="list");
|
||||
REQUIRE(p.isHelp() == true);
|
||||
REQUIRE(p.command() == "list");
|
||||
}
|
||||
|
||||
TEST_CASE("Parsing consecutive strings resets not found det id") {
|
||||
@ -270,9 +272,7 @@ TEST_CASE("Double digit id", "[support]") {
|
||||
REQUIRE(p.arguments().empty());
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Allows space between mod id and command"){
|
||||
TEST_CASE("Allows space between mod id and command") {
|
||||
CmdParser p;
|
||||
p.Parse("7: exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 7);
|
||||
@ -281,7 +281,7 @@ TEST_CASE("Allows space between mod id and command"){
|
||||
REQUIRE(p.arguments()[0] == "0.5");
|
||||
}
|
||||
|
||||
TEST_CASE("Allows space between mod id and command also without :"){
|
||||
TEST_CASE("Allows space between mod id and command also without :") {
|
||||
CmdParser p;
|
||||
p.Parse("1 exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 1);
|
||||
@ -290,7 +290,7 @@ TEST_CASE("Allows space between mod id and command also without :"){
|
||||
REQUIRE(p.arguments()[0] == "0.5");
|
||||
}
|
||||
|
||||
TEST_CASE("Allows space between mod id and command when detector id is used"){
|
||||
TEST_CASE("Allows space between mod id and command when detector id is used") {
|
||||
CmdParser p;
|
||||
p.Parse("1-5 exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 5);
|
||||
@ -300,7 +300,7 @@ TEST_CASE("Allows space between mod id and command when detector id is used"){
|
||||
REQUIRE(p.arguments()[0] == "0.5");
|
||||
}
|
||||
|
||||
TEST_CASE("Allows space between mod id and command with detector id and :"){
|
||||
TEST_CASE("Allows space between mod id and command with detector id and :") {
|
||||
CmdParser p;
|
||||
p.Parse("1-5: exptime 0.5");
|
||||
REQUIRE(p.detector_id() == 5);
|
||||
@ -310,7 +310,7 @@ TEST_CASE("Allows space between mod id and command with detector id and :"){
|
||||
REQUIRE(p.arguments()[0] == "0.5");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse receiver ID"){
|
||||
TEST_CASE("Parse receiver ID") {
|
||||
CmdParser p;
|
||||
p.Parse("2-5:3 flowcontrol10g 1");
|
||||
REQUIRE(p.detector_id() == 5);
|
||||
@ -318,84 +318,81 @@ TEST_CASE("Parse receiver ID"){
|
||||
REQUIRE(p.command() == "flowcontrol10g");
|
||||
REQUIRE(p.arguments().size() == 1);
|
||||
REQUIRE(p.arguments()[0] == "1");
|
||||
REQUIRE(p.receiver_id()==3);
|
||||
REQUIRE(p.receiver_id() == 3);
|
||||
}
|
||||
|
||||
TEST_CASE("Parse receiver ID no det id"){
|
||||
TEST_CASE("Parse receiver ID no det id") {
|
||||
CmdParser p;
|
||||
p.Parse("5:95 flowcontrol10g");
|
||||
REQUIRE(p.detector_id() == 5);
|
||||
REQUIRE(p.multi_id() == 0);
|
||||
REQUIRE(p.command() == "flowcontrol10g");
|
||||
REQUIRE(p.arguments().size() == 0);
|
||||
REQUIRE(p.receiver_id()==95);
|
||||
REQUIRE(p.receiver_id() == 95);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Det id but no mod id"){
|
||||
TEST_CASE("Det id but no mod id") {
|
||||
CmdParser p;
|
||||
p.Parse("1-exptime");
|
||||
REQUIRE(p.detector_id() == -1); //not there
|
||||
REQUIRE(p.detector_id() == -1); // not there
|
||||
REQUIRE(p.multi_id() == 1);
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("Det id but no mod id but with space after -"){
|
||||
TEST_CASE("Det id but no mod id but with space after -") {
|
||||
CmdParser p;
|
||||
p.Parse("1- exptime");
|
||||
REQUIRE(p.detector_id() == -1); //not there
|
||||
REQUIRE(p.detector_id() == -1); // not there
|
||||
REQUIRE(p.multi_id() == 1);
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse receiver ID no det id no mod"){
|
||||
TEST_CASE("Parse receiver ID no det id no mod") {
|
||||
CmdParser p;
|
||||
p.Parse(":95 flowcontrol10g");
|
||||
REQUIRE(p.detector_id() == -1); //not there
|
||||
REQUIRE(p.detector_id() == -1); // not there
|
||||
REQUIRE(p.multi_id() == 0);
|
||||
REQUIRE(p.command() == "flowcontrol10g");
|
||||
REQUIRE(p.arguments().size() == 0);
|
||||
REQUIRE(p.receiver_id()==95);
|
||||
REQUIRE(p.receiver_id() == 95);
|
||||
}
|
||||
|
||||
TEST_CASE("Parse mod and receiver id"){
|
||||
TEST_CASE("Parse mod and receiver id") {
|
||||
CmdParser p;
|
||||
p.Parse("1:3 exptime");
|
||||
REQUIRE(p.detector_id() == 1);
|
||||
REQUIRE(p.receiver_id()==3);
|
||||
REQUIRE(p.detector_id() == 1);
|
||||
REQUIRE(p.receiver_id() == 3);
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("Det id but no no mod"){
|
||||
TEST_CASE("Det id but no no mod") {
|
||||
CmdParser p;
|
||||
p.Parse("2-:35 exptime");
|
||||
REQUIRE(p.detector_id() == -1);
|
||||
REQUIRE(p.receiver_id()==35);
|
||||
REQUIRE(p.detector_id() == -1);
|
||||
REQUIRE(p.receiver_id() == 35);
|
||||
REQUIRE(p.multi_id() == 2);
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("All stuff"){
|
||||
TEST_CASE("All stuff") {
|
||||
CmdParser p;
|
||||
p.Parse("3-4:2 exptime");
|
||||
REQUIRE(p.detector_id() == 4);
|
||||
REQUIRE(p.receiver_id()==2);
|
||||
REQUIRE(p.detector_id() == 4);
|
||||
REQUIRE(p.receiver_id() == 2);
|
||||
REQUIRE(p.multi_id() == 3);
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse a command that has -h in it"){
|
||||
TEST_CASE("Parse a command that has -h in it") {
|
||||
CmdParser p;
|
||||
p.Parse("1-hostname somepc");
|
||||
REQUIRE(p.multi_id() == 1);
|
||||
REQUIRE(p.command() == "hostname");
|
||||
REQUIRE(p.arguments().size() == 1);
|
||||
REQUIRE(p.arguments()[0]== "somepc");
|
||||
|
||||
REQUIRE(p.arguments()[0] == "somepc");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse a command in the form 0-1 command"){
|
||||
TEST_CASE("Parse a command in the form 0-1 command") {
|
||||
CmdParser p;
|
||||
p.Parse("3-5 exptime");
|
||||
REQUIRE(p.multi_id() == 3);
|
||||
@ -403,7 +400,7 @@ TEST_CASE("Parse a command in the form 0-1 command"){
|
||||
REQUIRE(p.command() == "exptime");
|
||||
}
|
||||
|
||||
TEST_CASE("Parse a command in the form 0-1:command"){
|
||||
TEST_CASE("Parse a command in the form 0-1:command") {
|
||||
CmdParser p;
|
||||
p.Parse("3-5:exptime");
|
||||
REQUIRE(p.multi_id() == 3);
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
@ -488,23 +490,13 @@ TEST_CASE("activate", "[.cmd]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"1", "nopadding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 1 nopadding\n");
|
||||
proxy.Call("activate", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "activate 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"0", "padding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 0 padding\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"0", "nopadding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 0 nopadding\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("activate", {"1", "padding"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 1 padding\n");
|
||||
proxy.Call("activate", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "activate 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setActive(prev_val[i], {i});
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "test-CmdProxy-global.h"
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
@ -287,7 +289,8 @@ TEST_CASE("comp_disable_time", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
if (det_type == defs::JUNGFRAU &&
|
||||
det.getChipVersion().squash() * 10 == 11) {
|
||||
auto prev_val = det.getComparatorDisableTime();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -319,7 +322,7 @@ TEST_CASE("storagecells", "[.cmd]") {
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
if (det.getChipVersion().squash() * 10 == 10) {
|
||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||
"inconsistent #additional storage cells to test");
|
||||
{
|
||||
@ -344,11 +347,11 @@ TEST_CASE("storagecells", "[.cmd]") {
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"16"}, -1, PUT));
|
||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||
}
|
||||
}
|
||||
// chip version 1.1
|
||||
else {
|
||||
// cannot set number of addl. storage cells
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {"1"}, -1, PUT));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecells", {}, -1, GET));
|
||||
@ -368,11 +371,11 @@ TEST_CASE("storagecell_start", "[.cmd]") {
|
||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||
}
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
if (det.getChipVersion().squash() * 10 == 10) {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||
}
|
||||
}
|
||||
// chip version 1.1
|
||||
else {
|
||||
// max is 3
|
||||
@ -407,7 +410,7 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
// chip version 1.0
|
||||
if (det.getChipVersion().squash()*10 == 10) {
|
||||
if (det.getChipVersion().squash() * 10 == 10) {
|
||||
auto prev_val = det.getStorageCellDelay();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -424,15 +427,17 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setStorageCellDelay(prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
}
|
||||
// chip version 1.1
|
||||
else {
|
||||
// cannot set storage cell delay
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
@ -308,12 +310,13 @@ TEST_CASE("rx_udpsocksize", "[.cmd][.rx]") {
|
||||
CmdProxy proxy(&det);
|
||||
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
|
||||
"Need same udp socket buffer size to test");
|
||||
std::string s_new_val = std::to_string(prev_val - 1000);
|
||||
{
|
||||
std::string s_new_val = std::to_string(prev_val);
|
||||
/*std::string s_new_val = std::to_string(prev_val - 1000);
|
||||
{ Need permissions
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_udpsocksize", {s_new_val}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() >= "rx_udpsocksize " + s_new_val + "\n");
|
||||
}
|
||||
}*/
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("rx_udpsocksize", {}, -1, GET, oss);
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "CmdProxy.h"
|
||||
#include "catch.hpp"
|
||||
#include "sls/Detector.h"
|
||||
@ -345,7 +347,8 @@ TEST_CASE("thresholdnotb", "[.cmd]") {
|
||||
std::string senergy = std::to_string(prev_energies[0]);
|
||||
std::ostringstream oss1, oss2;
|
||||
proxy.Call("thresholdnotb", {senergy, "standard"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "threshold [" + senergy + ", standard]\n");
|
||||
REQUIRE(oss1.str() ==
|
||||
"thresholdnotb [" + senergy + ", standard]\n");
|
||||
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "threshold " + senergy + "\n");
|
||||
REQUIRE_THROWS(proxy.Call("thresholdnotb",
|
||||
@ -889,54 +892,101 @@ TEST_CASE("timinglist", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("timinglist", {}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("speed", "[.cmd]") {
|
||||
TEST_CASE("readoutspeed", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getSpeed();
|
||||
// full speed for jungfrau only works for new boards
|
||||
/*
|
||||
{
|
||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getReadoutSpeed();
|
||||
|
||||
// full speed for jungfrau only works for new boards (chipv1.1 is with
|
||||
// new board [hw1.0 and chipv1.0 not tested here])
|
||||
if ((det_type == defs::JUNGFRAU &&
|
||||
det.getChipVersion().squash() * 10 == 11) ||
|
||||
(det_type == defs::EIGER)) {
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("speed", {"0"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "speed full_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "speed full_speed\n");
|
||||
proxy.Call("speed", {"full_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "speed full_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "speed full_speed\n");
|
||||
proxy.Call("readoutspeed", {"0"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "readoutspeed full_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "readoutspeed full_speed\n");
|
||||
proxy.Call("readoutspeed", {"full_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "readoutspeed full_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "readoutspeed full_speed\n");
|
||||
}
|
||||
*/
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("speed", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "speed half_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "speed half_speed\n");
|
||||
proxy.Call("speed", {"half_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "speed half_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "speed half_speed\n");
|
||||
|
||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("readoutspeed", {"1"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "readoutspeed half_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "readoutspeed half_speed\n");
|
||||
proxy.Call("readoutspeed", {"half_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "readoutspeed half_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "readoutspeed half_speed\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("readoutspeed", {"2"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "readoutspeed quarter_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "readoutspeed quarter_speed\n");
|
||||
proxy.Call("readoutspeed", {"quarter_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "readoutspeed quarter_speed\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "readoutspeed quarter_speed\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"108"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"144"}, -1, PUT));
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("speed", {"2"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "speed quarter_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "speed quarter_speed\n");
|
||||
proxy.Call("speed", {"quarter_speed"}, -1, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "speed quarter_speed\n");
|
||||
proxy.Call("speed", {}, -1, GET, oss4);
|
||||
REQUIRE(oss4.str() == "speed quarter_speed\n");
|
||||
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("readoutspeed", {"108"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "readoutspeed 108\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "readoutspeed 108\n");
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream oss1, oss2, oss3, oss4;
|
||||
proxy.Call("readoutspeed", {"144"}, -1, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "readoutspeed 144\n");
|
||||
proxy.Call("readoutspeed", {}, -1, GET, oss2);
|
||||
REQUIRE(oss2.str() == "readoutspeed 144\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"full_speed"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"half_speed"}, -1, PUT));
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("readoutspeed", {"quarter_speed"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"2"}, -1, PUT));
|
||||
}
|
||||
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setSpeed(prev_val[i], {i});
|
||||
det.setReadoutSpeed(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("speed", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("speed", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"0"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("readoutspeedlist", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU ||
|
||||
det_type == defs::EIGER) {
|
||||
REQUIRE_NOTHROW(proxy.Call("readoutspeedlist", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeedlist", {}, -1, PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("readoutspeedlist", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1538,17 +1588,17 @@ TEST_CASE("currentsource", "[.cmd]") {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "currentsource 1\n");
|
||||
REQUIRE(oss.str() == "currentsource [1]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "currentsource 0\n");
|
||||
REQUIRE(oss.str() == "currentsource [0]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("currentsource", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "currentsource 0\n");
|
||||
REQUIRE(oss.str() == "currentsource [disabled]\n");
|
||||
}
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("currentsource", {"1", "fix", "42"}, -1, PUT));
|
||||
@ -1735,6 +1785,9 @@ TEST_CASE("defaultdac", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("defaultdac", {"blabla"}, -1, PUT));
|
||||
auto daclist = det.getDacList();
|
||||
for (auto it : daclist) {
|
||||
if (it == defs::VTHRESHOLD) {
|
||||
continue;
|
||||
}
|
||||
auto dacname = sls::ToString(it);
|
||||
auto prev_val = det.getDefaultDac(it);
|
||||
{
|
||||
@ -1747,33 +1800,30 @@ TEST_CASE("defaultdac", "[.cmd]") {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("defaultdac", {dacname}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||
std::string(" 1000\n"));
|
||||
std::string(" 1000\n"));
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDefaultDac(it, prev_val[i], {i});
|
||||
}
|
||||
}
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
std::vector<defs::dacIndex> daclist = {defs::VREF_PRECH, defs::VREF_DS,
|
||||
defs::VREF_COMP};
|
||||
std::vector<defs::dacIndex> daclist = {
|
||||
defs::VREF_PRECH, defs::VREF_DS, defs::VREF_COMP};
|
||||
for (auto it : daclist) {
|
||||
auto dacname = sls::ToString(it);
|
||||
auto prev_val = det.getDefaultDac(it, defs::GAIN0);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("defaultdac", {dacname, "1000", "gain0"}, -1,
|
||||
PUT, oss);
|
||||
REQUIRE(oss.str() ==
|
||||
std::string("defaultdac ") + dacname +
|
||||
std::string(" gain0 1000\n"));
|
||||
PUT, oss);
|
||||
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||
std::string(" gain0 1000\n"));
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET,
|
||||
oss);
|
||||
REQUIRE(oss.str() ==
|
||||
std::string("defaultdac ") + dacname +
|
||||
std::string(" gain0 1000\n"));
|
||||
proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||
std::string(" gain0 1000\n"));
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setDefaultDac(it, prev_val[i], defs::GAIN0, {i});
|
||||
@ -1781,7 +1831,7 @@ TEST_CASE("defaultdac", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("defaultdac", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1879,6 +1929,10 @@ TEST_CASE("blockingtrigger", "[.cmd]") {
|
||||
proxy.Call("blockingtrigger", {}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "blockingtrigger successful\n");
|
||||
}
|
||||
if (det.isVirtualDetectorServer().tsquash(
|
||||
"inconsistent virtual detectors")) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
auto currentfnum =
|
||||
det.getNextFrameNumber().tsquash("inconsistent frame nr in test");
|
||||
REQUIRE(nextframenumber + 1 == currentfnum);
|
||||
@ -2235,7 +2289,6 @@ TEST_CASE("udp_numdst", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("udp_cleardst", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
@ -2273,7 +2326,7 @@ TEST_CASE("udp_firstdst", "[.cmd]") {
|
||||
det.setFirstUDPDestination(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("udp_numdst", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("udp_firstdst", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "Module.h"
|
||||
#include "SharedMemory.h"
|
||||
#include "catch.hpp"
|
||||
|
@ -1,23 +1,25 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "catch.hpp"
|
||||
#include "sls/Pattern.h"
|
||||
|
||||
using sls::Pattern;
|
||||
|
||||
TEST_CASE("Pattern is default constructable and has zeroed fields"){
|
||||
TEST_CASE("Pattern is default constructable and has zeroed fields") {
|
||||
Pattern p;
|
||||
for (int i = 0; i!=MAX_PATTERN_LENGTH; ++i)
|
||||
for (int i = 0; i != MAX_PATTERN_LENGTH; ++i)
|
||||
REQUIRE(p.data()->word[i] == 0);
|
||||
REQUIRE(p.data()->ioctrl == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Copy construct pattern"){
|
||||
TEST_CASE("Copy construct pattern") {
|
||||
Pattern p;
|
||||
p.data()->loop[0] = 7;
|
||||
Pattern p1(p);
|
||||
REQUIRE(p1.data()->loop[0] == 7);
|
||||
}
|
||||
|
||||
TEST_CASE("Compare patterns"){
|
||||
TEST_CASE("Compare patterns") {
|
||||
Pattern p;
|
||||
Pattern p1;
|
||||
REQUIRE(p == p1);
|
||||
@ -25,7 +27,3 @@ TEST_CASE("Compare patterns"){
|
||||
p1.data()->word[500] = 1;
|
||||
REQUIRE_FALSE(p == p1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "catch.hpp"
|
||||
#include "sls/Result.h"
|
||||
#include "sls/ToString.h"
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
#include "SharedMemory.h"
|
||||
#include "catch.hpp"
|
||||
@ -19,8 +21,8 @@ TEST_CASE("Create SharedMemory read and write", "[detector]") {
|
||||
|
||||
SharedMemory<Data> shm(shm_id, -1);
|
||||
shm.CreateSharedMemory();
|
||||
CHECK(shm.GetName() ==
|
||||
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||
CHECK(shm.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id));
|
||||
|
||||
shm()->x = 3;
|
||||
shm()->y = 5.7;
|
||||
@ -90,8 +92,8 @@ TEST_CASE("Open two shared memories to the same place", "[detector]") {
|
||||
TEST_CASE("Move SharedMemory", "[detector]") {
|
||||
|
||||
SharedMemory<Data> shm(shm_id, -1);
|
||||
CHECK(shm.GetName() ==
|
||||
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||
CHECK(shm.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id));
|
||||
shm.CreateSharedMemory();
|
||||
shm()->x = 9;
|
||||
|
||||
@ -104,8 +106,8 @@ TEST_CASE("Move SharedMemory", "[detector]") {
|
||||
CHECK(shm() == nullptr);
|
||||
CHECK(shm.size() == 0);
|
||||
|
||||
CHECK(shm2.GetName() ==
|
||||
std::string("/slsDetectorPackage_multi_") + std::to_string(shm_id));
|
||||
CHECK(shm2.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(shm_id));
|
||||
shm2.RemoveSharedMemory();
|
||||
}
|
||||
|
||||
@ -123,7 +125,7 @@ TEST_CASE("Create several shared memories", "[detector]") {
|
||||
|
||||
for (int i = 0; i != N; ++i) {
|
||||
CHECK(*v[i]() == i);
|
||||
CHECK(v[i].GetName() == std::string("/slsDetectorPackage_multi_") +
|
||||
CHECK(v[i].GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||
std::to_string(i + shm_id));
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
// #include "catch.hpp"
|
||||
// #include "sls/container_utils.h"
|
||||
|
Reference in New Issue
Block a user