mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
commands code generation (#871)
* commands code generation (#803) * commands code generation for only frames command * fix cmake file and add Caller files * working exptime, fully extended commands file and its variants * start adding template commands * add INT_CMD_VEC_ID template * add list command, generate multiple bins, format code * reach 208 commands using the cpp macros * add tests for command parser * start adding tests for commands parser * fix typo to use commands.yaml * add more tests for command_parser * add all template functions (up to 218 commands) * finish template functions and add more CmdProxy.cpp functions (250+) * 257 commands * 300 commands the rest are very special commands * add special commands without generation * separate special functions from generated c++ file * implementing one command for put and get (buggy) * add infer action in a separate file * generate header for special commands from yaml * allow only 0 or 1 for bool inputs * group all commands in gen_commands.py * add help to gen_commands.py * add autocomplete bash script * autocompletion: add support for module levels and help * remove debugging line * add autocompletion, help to commands, change int [0,1] to bool * copy tests for Caller.cpp. Tests pass * update with the new developer branch changes * fix errors after merging (there is problems with tests) * fixed port/stopport in yaml (intput typo), added '_caller' to the test dac and test on chip dac command in global test for cmdcaller * undo previous test simulator debug change * add documentation for the generated code * reducing the comment to be replaced in length so formatting does not split into 2 lines * removed formatting specific style of C++11 in gen_commands.py to keep with the top level clang format of the project * regeneratign code for commands * automation generated * Redirect deprecated commands (#872) * working implementation, need to fix dac * fixed deprecation redirect for dac command * Detector specific autocomplete (#873) * working implementation, need to fix dac * fixed deprecation redirect for dac command * detector specific completion for dac * added autocomplete using detector specific * fixed error when autocompleting partial words * Generate commands/fix commands (#875) * fix vm_a, im_a etc have deg Celsius suffix, also help missing or changed in some places * dac: require det id for all, arg0 to be printed at output, help for onchip dac and dac, onchipdac: spacing * getscan detid and blocking trigger help * udp_Dstlist det_id fixed, but rx_id invalid * cmdApp in line with cmdLineApp (missing version, receiver_id, not creating det object in help action * added set_command to differentiate between check_det_id and require_det_id (mixed up), args: -1 needs to check for at least one argument * reordering * reordering and checked till integer_command_hex * fixed a lot more commands * fix caller tests for eiger * changes to tests after Bechir left * changing .cmd to .cmdcall for the caller commands * fixed tests for caller, still warning for setexptime about cast input * autocomplete ran * add moench test * regenerating autocomplete and commands * fixing other things from merge conflicts (renaming slsDetectorDefs to defs in commands.yaml) * formatting * added code injection to help (#876) * updated 3 commands to have get output that can be put into put (#877) * updated some commands to have get output that can be put into put * fix tests for clkdiv * adding help to free (#878) * removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) (#879) * More helpful error messages for unsupported actions (#880) * removing old commands and renaming them, (also making it work for parameters command as it was still calling cmdproxy) * Added specific help for unsupported actions * fixed a vetofile get special exception message. more specific warning for special exception message instead of no function warning * added condition checking true in exceptions for special message --------- Co-authored-by: Bechir Brahem <bachbrahem@gmail.com> Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com> Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
This commit is contained in:
parent
d72c9e29a4
commit
ce7270e8a2
1
CMakeFiles/cmake.check_cache
Normal file
1
CMakeFiles/cmake.check_cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
# This file is generated by cmake for dependency checking of the CMakeCache.txt file
|
@ -244,6 +244,7 @@ if(SLS_USE_SANITIZER)
|
|||||||
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
# target_link_libraries(slsProjectOptions INTERFACE -fsanitize=thread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(SLS_TUNE_LOCAL)
|
if(SLS_TUNE_LOCAL)
|
||||||
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
target_compile_options(slsProjectOptions INTERFACE -mtune=native -march=native)
|
||||||
endif()
|
endif()
|
||||||
|
@ -4,10 +4,13 @@ set(SOURCES
|
|||||||
src/DetectorImpl.cpp
|
src/DetectorImpl.cpp
|
||||||
src/Module.cpp
|
src/Module.cpp
|
||||||
src/Detector.cpp
|
src/Detector.cpp
|
||||||
src/CmdProxy.cpp
|
src/HelpDacs.cpp
|
||||||
src/CmdParser.cpp
|
src/CmdParser.cpp
|
||||||
src/Pattern.cpp
|
src/Pattern.cpp
|
||||||
src/CtbConfig.cpp
|
src/CtbConfig.cpp
|
||||||
|
src/Caller.cpp
|
||||||
|
src/CallerSpecial.cpp
|
||||||
|
src/inferAction.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(slsDetectorObject OBJECT
|
add_library(slsDetectorObject OBJECT
|
||||||
@ -76,26 +79,30 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
if(SLS_USE_TEXTCLIENT)
|
if(SLS_USE_TEXTCLIENT)
|
||||||
# Loop over list to generate command line binaries
|
set(det_bin_names "sls_detector_put"
|
||||||
set(bin_names "sls_detector_put"
|
|
||||||
"sls_detector_get"
|
"sls_detector_get"
|
||||||
"sls_detector_acquire"
|
"sls_detector_acquire"
|
||||||
"sls_detector_help")
|
"sls_detector_help"
|
||||||
set(cmd_name "PUT" "GET" "READOUT" "HELP")
|
"sls_detector"
|
||||||
list(LENGTH bin_names len1)
|
)
|
||||||
|
set(det_cmd_name "PUT" "GET" "READOUT" "HELP" "INFER")
|
||||||
|
list(LENGTH det_bin_names len1)
|
||||||
math(EXPR len2 "${len1} - 1")
|
math(EXPR len2 "${len1} - 1")
|
||||||
|
|
||||||
foreach(val RANGE ${len2})
|
foreach(val RANGE ${len2})
|
||||||
list(GET bin_names ${val} val1)
|
list(GET det_bin_names ${val} val1)
|
||||||
list(GET cmd_name ${val} val2)
|
list(GET det_cmd_name ${val} val2)
|
||||||
message(STATUS "${val1} ${val2}")
|
message(STATUS "${val1} ${val2}")
|
||||||
|
|
||||||
add_executable(${val1} src/CmdLineApp.cpp)
|
add_executable(${val1} src/CmdApp.cpp)
|
||||||
|
|
||||||
target_link_libraries(${val1}
|
target_link_libraries(${val1}
|
||||||
slsDetectorStatic
|
slsDetectorStatic
|
||||||
pthread
|
pthread
|
||||||
rt
|
rt
|
||||||
)
|
)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( src/Caller.cpp PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-but-set-variable")
|
||||||
|
|
||||||
set_target_properties(${val1} PROPERTIES
|
set_target_properties(${val1} PROPERTIES
|
||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||||
COMPILE_DEFINITIONS ${val2}=1
|
COMPILE_DEFINITIONS ${val2}=1
|
||||||
@ -104,7 +111,8 @@ if(SLS_USE_TEXTCLIENT)
|
|||||||
set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
set_property(TARGET ${val1} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
install(TARGETS ${bin_names} DESTINATION bin)
|
install(TARGETS ${det_bin_names} DESTINATION bin) # was not there for detp. Include? FIXME
|
||||||
|
|
||||||
|
|
||||||
endif(SLS_USE_TEXTCLIENT)
|
endif(SLS_USE_TEXTCLIENT)
|
||||||
|
|
||||||
|
10
slsDetectorSoftware/generator/Caller.in.cpp
Normal file
10
slsDetectorSoftware/generator/Caller.in.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "Caller.h"
|
||||||
|
#include "sls/logger.h"
|
||||||
|
#include "sls/string_utils.h"
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE
|
||||||
|
|
||||||
|
}
|
88
slsDetectorSoftware/generator/Caller.in.h
Normal file
88
slsDetectorSoftware/generator/Caller.in.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
// This file is used as input to generate the caller class
|
||||||
|
|
||||||
|
#include "CmdParser.h"
|
||||||
|
#include "HelpDacs.h"
|
||||||
|
#include "sls/Detector.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
class Caller {
|
||||||
|
public:
|
||||||
|
Caller(Detector *ptr) : det(ptr) {}
|
||||||
|
void call(const std::string &command,
|
||||||
|
const std::vector<std::string> &arguments, int detector_id,
|
||||||
|
int action, std::ostream &os = std::cout, int receiver_id = -1);
|
||||||
|
|
||||||
|
IpAddr getDstIpFromAuto();
|
||||||
|
IpAddr getSrcIpFromAuto();
|
||||||
|
UdpDestination getUdpEntry();
|
||||||
|
void GetLevelAndUpdateArgIndex(int action,
|
||||||
|
std::string levelSeparatedCommand,
|
||||||
|
int &level, int &iArg, size_t nGetArgs,
|
||||||
|
size_t nPutArgs);
|
||||||
|
void WrongNumberOfParameters(size_t expected);
|
||||||
|
|
||||||
|
template <typename V> std::string OutStringHex(const V &value) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToStringHex(value.front());
|
||||||
|
return ToStringHex(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutStringHex(const V &value, int width) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToStringHex(value.front(), width);
|
||||||
|
return ToStringHex(value, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutString(const Result<V> &value) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToString(value.front());
|
||||||
|
return ToString(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutString(const V &value) {
|
||||||
|
return ToString(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
std::string OutString(const V &value, const std::string &unit) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToString(value.front(), unit);
|
||||||
|
return ToString(value, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> getAllCommands();
|
||||||
|
std::string list(int action);
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1)
|
||||||
|
|
||||||
|
std::vector<std::string> args;
|
||||||
|
std::string cmd;
|
||||||
|
Detector *det;
|
||||||
|
int det_id{-1};
|
||||||
|
int rx_id{-1};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ReplaceIfDepreciated(std::string &command);
|
||||||
|
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
||||||
|
using StringMap = std::map<std::string, std::string>;
|
||||||
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
|
|
||||||
|
FunctionMap functions{
|
||||||
|
{"list", &Caller::list},
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (2)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
StringMap depreciated_functions{
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
236
slsDetectorSoftware/generator/autocomplete/autocomplete.py
Normal file
236
slsDetectorSoftware/generator/autocomplete/autocomplete.py
Normal file
@ -0,0 +1,236 @@
|
|||||||
|
import argparse
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# command to generate the ast
|
||||||
|
# clang version: 14.0.0-1ubuntu1.1
|
||||||
|
# clang++ -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang StringTo -c ToString.cpp -I ../include/ -std=gnu++11
|
||||||
|
#
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
AUTOCOMPLETE_PATH = Path(__file__).parent
|
||||||
|
DUMP_PATH = AUTOCOMPLETE_PATH / 'dump.json'
|
||||||
|
FIXED_PATH = AUTOCOMPLETE_PATH / 'fixed.json'
|
||||||
|
|
||||||
|
type_values = {
|
||||||
|
'special::mv': ["mv", "mV"],
|
||||||
|
"special::deg": ["deg"],
|
||||||
|
"special::time_unit": ["s", "ms", "us", "ns"],
|
||||||
|
"special::hard": ["hard"],
|
||||||
|
"special::force-delete-normal-file": ["--force-delete-normal-file"],
|
||||||
|
"special::currentSourceFix": ["fix", "nofix"],
|
||||||
|
"special::currentSourceLow": ["normal", "low"],
|
||||||
|
"special::path": [],
|
||||||
|
"special::pedestal_parameters" : ["", "0"]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_types(arg_types):
|
||||||
|
ret = set()
|
||||||
|
for arg_type in arg_types:
|
||||||
|
if type_info(arg_type) == 'base':
|
||||||
|
if arg_type == 'bool':
|
||||||
|
ret = ret.union(["0", "1"])
|
||||||
|
else:
|
||||||
|
tmp = [not_list for not_list in type_values[arg_type] if not isinstance(not_list, list)]
|
||||||
|
ret = ret.union(tmp)
|
||||||
|
|
||||||
|
#Intercept the options and in case detector specific options appear replace the
|
||||||
|
#list of options with a command line call that fetches them
|
||||||
|
#TODO! Rename detg
|
||||||
|
if "defs::dacIndex" in arg_types:
|
||||||
|
return "`detg daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`"
|
||||||
|
elif "defs::detectorSettings" in arg_types:
|
||||||
|
return "`detg settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`"
|
||||||
|
elif "defs::timingMode" in arg_types:
|
||||||
|
return "`detg timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`"
|
||||||
|
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
def type_info(type_name):
|
||||||
|
if type_name.startswith('defs::') or type_name.startswith('slsDetectorDefs::'):
|
||||||
|
return 'enum'
|
||||||
|
if type_name.startswith('special::'):
|
||||||
|
return 'special'
|
||||||
|
return 'base'
|
||||||
|
|
||||||
|
|
||||||
|
def get_enum(function):
|
||||||
|
return function['type']['qualType'].split(' ')[0]
|
||||||
|
|
||||||
|
|
||||||
|
def get_literal(ifstmt):
|
||||||
|
stringliteral = []
|
||||||
|
expression = ifstmt['inner'][0]
|
||||||
|
if expression['kind'] == 'BinaryOperator':
|
||||||
|
if expression['opcode'] == '!=':
|
||||||
|
return None, None
|
||||||
|
for cxxOperatorCall in expression['inner']:
|
||||||
|
if cxxOperatorCall['kind'] == 'CXXOperatorCallExpr':
|
||||||
|
implicitCastExpr = cxxOperatorCall['inner'][2]
|
||||||
|
stringliteral.append(implicitCastExpr['inner'][0]['value'][1:-1])
|
||||||
|
else:
|
||||||
|
cxxOperatorCall = expression
|
||||||
|
implicitCastExpr = cxxOperatorCall['inner'][2]
|
||||||
|
stringliteral = implicitCastExpr['inner'][0]['value'][1:-1]
|
||||||
|
|
||||||
|
retstmt = get_object_by_kind(ifstmt['inner'], 'ReturnStmt')
|
||||||
|
declrefexpt = get_object_by_kind(retstmt['inner'], 'DeclRefExpr')
|
||||||
|
enum_val = declrefexpt["referencedDecl"]["name"]
|
||||||
|
|
||||||
|
return enum_val, stringliteral
|
||||||
|
|
||||||
|
|
||||||
|
def get_object_by_kind(inner, kind, position=1):
|
||||||
|
for obj in inner:
|
||||||
|
if obj['kind'] == kind:
|
||||||
|
position -= 1
|
||||||
|
if position == 0:
|
||||||
|
return obj
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def generate_type_values():
|
||||||
|
functions = json.loads(FIXED_PATH.read_text())
|
||||||
|
for function in functions:
|
||||||
|
if function['kind'] != 'FunctionDecl' or function['name'] != 'StringTo':
|
||||||
|
continue
|
||||||
|
enum = get_enum(function)
|
||||||
|
|
||||||
|
if not enum.startswith('defs::'):
|
||||||
|
continue
|
||||||
|
# if enum != 'defs::dacIndex':
|
||||||
|
# continue
|
||||||
|
if not function['loc']['file'].endswith('ToString.cpp'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
compound_stmt = get_object_by_kind(function['inner'], 'CompoundStmt')
|
||||||
|
|
||||||
|
for ifstmt in compound_stmt['inner']:
|
||||||
|
if ifstmt['kind'] != 'IfStmt':
|
||||||
|
continue
|
||||||
|
enum_val, stringliteral = get_literal(ifstmt)
|
||||||
|
if enum_val is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if enum not in type_values or type_values[enum] is None:
|
||||||
|
type_values[enum] = []
|
||||||
|
type_values[enum].append(stringliteral)
|
||||||
|
items = list(type_values.items())
|
||||||
|
for key, val in items:
|
||||||
|
if key.startswith('defs::'):
|
||||||
|
new_key = key.split('::')[1]
|
||||||
|
new_key = 'slsDetectorDefs::' + new_key
|
||||||
|
type_values[new_key] = val
|
||||||
|
elif key.startswith('slsDetectorDefs::'):
|
||||||
|
new_key = key.split('::')[1]
|
||||||
|
new_key = 'defs::' + new_key
|
||||||
|
type_values[new_key] = val
|
||||||
|
|
||||||
|
return json.dumps(type_values, indent=2)
|
||||||
|
|
||||||
|
|
||||||
|
def fix_json():
|
||||||
|
with DUMP_PATH.open('r') as f:
|
||||||
|
tmp = '[\n'
|
||||||
|
for line in f.read().split('\n'):
|
||||||
|
if line.startswith('}'):
|
||||||
|
tmp += line + ',\n'
|
||||||
|
else:
|
||||||
|
tmp += line + '\n'
|
||||||
|
tmp = tmp[:-3] + '\n]'
|
||||||
|
with FIXED_PATH.open('w') as f:
|
||||||
|
f.write(tmp)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_bash_autocomplete(output_path=Path(__file__).parent / 'bash_autocomplete.sh', input_path=Path(__file__).parent / 'bash_autocomplete.in.sh'):
|
||||||
|
generate_type_values()
|
||||||
|
output_file = output_path.open('w')
|
||||||
|
template_file = input_path.open('r')
|
||||||
|
|
||||||
|
def writeline(line):
|
||||||
|
output_file.write(line + '\n')
|
||||||
|
|
||||||
|
class if_block:
|
||||||
|
def __init__(self, condition):
|
||||||
|
self.condition = condition
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
output_file.write('if [[ ' + self.condition + ' ]]; then\n')
|
||||||
|
|
||||||
|
def __exit__(self, type, value, traceback):
|
||||||
|
output_file.write('fi\n')
|
||||||
|
|
||||||
|
class function:
|
||||||
|
def __init__(self, name):
|
||||||
|
self.name = name
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
output_file.write(self.name + '() {\n')
|
||||||
|
|
||||||
|
def __exit__(self, type, value, traceback):
|
||||||
|
output_file.write('}\n')
|
||||||
|
|
||||||
|
command_path = Path(__file__).parent.parent / 'extended_commands.yaml'
|
||||||
|
commands = yaml.unsafe_load(command_path.open('r'))
|
||||||
|
|
||||||
|
for line in template_file:
|
||||||
|
if '-- THIS LINE WILL BE REPLACED WITH GENERATED CODE --' not in line:
|
||||||
|
output_file.write(line)
|
||||||
|
continue
|
||||||
|
writeline(f'local SLS_COMMANDS=" {" ".join(commands.keys())} "')
|
||||||
|
# generate functions
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
# added for debugging
|
||||||
|
if command_name == 'xxxexptime':
|
||||||
|
continue
|
||||||
|
with function('__' + command_name):
|
||||||
|
writeline('FCN_RETURN=""')
|
||||||
|
|
||||||
|
actions = ['GET', 'PUT']
|
||||||
|
for action in actions:
|
||||||
|
if action in command['actions'] and 'args' in command['actions'][action]:
|
||||||
|
args = command['actions'][action]['args']
|
||||||
|
possible_argc = {}
|
||||||
|
for arg in args:
|
||||||
|
if arg['argc'] == 0:
|
||||||
|
pass
|
||||||
|
for i in range(arg['argc']):
|
||||||
|
if i + 1 not in possible_argc:
|
||||||
|
possible_argc[i + 1] = []
|
||||||
|
possible_argc[i + 1].append(arg['arg_types'][i])
|
||||||
|
if possible_argc:
|
||||||
|
with if_block(f'${{IS_GET}} -eq {"1" if action == "GET" else "0"}'):
|
||||||
|
for argc in possible_argc:
|
||||||
|
with if_block(f'"${{cword}}" == "{argc + 1}"'):
|
||||||
|
if "defs::detectorSettings" in possible_argc[argc]:
|
||||||
|
print(argc, command_name, possible_argc[argc])
|
||||||
|
choices = get_types(possible_argc[argc])
|
||||||
|
|
||||||
|
#check if we got choices back or a bash command
|
||||||
|
if isinstance(choices, (list,set)):
|
||||||
|
writeline(f'FCN_RETURN="{" ".join(sorted(choices))}"')
|
||||||
|
else:
|
||||||
|
writeline(f'FCN_RETURN="{choices}"')
|
||||||
|
if 'special::path' in possible_argc[argc]:
|
||||||
|
writeline('IS_PATH=1')
|
||||||
|
|
||||||
|
writeline('return 0')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
output_file.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description='use parsed c++ code to generate autocomplete snippets')
|
||||||
|
parser.add_argument('-f', '--fix', action='store_true', help='fix the parsed ast to make it loadable')
|
||||||
|
# parser.add_argument('-p', '--path', type=str, help='output path to the fixed ast', default='ast.json')
|
||||||
|
args = parser.parse_known_args()
|
||||||
|
if args[0].fix:
|
||||||
|
fix_json()
|
||||||
|
ret = generate_type_values()
|
||||||
|
print(ret)
|
@ -0,0 +1,164 @@
|
|||||||
|
# GENERATED FILE - DO NOT EDIT
|
||||||
|
# ANY CHANGES TO THIS FILE WILL BE OVERWRITTEN
|
||||||
|
|
||||||
|
_sd() {
|
||||||
|
|
||||||
|
# Taken from https://github.com/scop/bash-completion/blob/15b74b1050333f425877a7cbd99af2998b95c476/bash_completion#L770C12-L770C12
|
||||||
|
# Reassemble command line words, excluding specified characters from the
|
||||||
|
# list of word completion separators (COMP_WORDBREAKS).
|
||||||
|
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
|
||||||
|
# NOT be considered word breaks. This is useful for things like scp where
|
||||||
|
# we want to return host:path and not only path, so we would pass the
|
||||||
|
# colon (:) as $1 here.
|
||||||
|
# @param $2 words Name of variable to return words to
|
||||||
|
# @param $3 cword Name of variable to return cword to
|
||||||
|
#
|
||||||
|
_comp__reassemble_words()
|
||||||
|
{
|
||||||
|
local exclude="" i j line ref
|
||||||
|
# Exclude word separator characters?
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
# Yes, exclude word separator characters;
|
||||||
|
# Exclude only those characters, which were really included
|
||||||
|
exclude="[${1//[^$COMP_WORDBREAKS]/}]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Default to cword unchanged
|
||||||
|
printf -v "$3" %s "$COMP_CWORD"
|
||||||
|
# Are characters excluded which were former included?
|
||||||
|
if [[ $exclude ]]; then
|
||||||
|
# Yes, list of word completion separators has shrunk;
|
||||||
|
line=$COMP_LINE
|
||||||
|
# Re-assemble words to complete
|
||||||
|
for ((i = 0, j = 0; i < ${#COMP_WORDS[@]}; i++, j++)); do
|
||||||
|
# Is current word not word 0 (the command itself) and is word not
|
||||||
|
# empty and is word made up of just word separator characters to
|
||||||
|
# be excluded and is current word not preceded by whitespace in
|
||||||
|
# original line?
|
||||||
|
while [[ $i -gt 0 && ${COMP_WORDS[i]} == +($exclude) ]]; do
|
||||||
|
# Is word separator not preceded by whitespace in original line
|
||||||
|
# and are we not going to append to word 0 (the command
|
||||||
|
# itself), then append to current word.
|
||||||
|
[[ $line != [[:blank:]]* ]] && ((j >= 2)) && ((j--))
|
||||||
|
# Append word separator to current or new word
|
||||||
|
ref="$2[$j]"
|
||||||
|
printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"
|
||||||
|
# Indicate new cword
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
# Remove optional whitespace + word separator from line copy
|
||||||
|
line=${line#*"${COMP_WORDS[i]}"}
|
||||||
|
# Indicate next word if available, else end *both* while and
|
||||||
|
# for loop
|
||||||
|
if ((i < ${#COMP_WORDS[@]} - 1)); then
|
||||||
|
((i++))
|
||||||
|
else
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
# Start new word if word separator in original line is
|
||||||
|
# followed by whitespace.
|
||||||
|
[[ $line == [[:blank:]]* ]] && ((j++))
|
||||||
|
done
|
||||||
|
# Append word to current word
|
||||||
|
ref="$2[$j]"
|
||||||
|
printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"
|
||||||
|
# Remove optional whitespace + word from line copy
|
||||||
|
line=${line#*"${COMP_WORDS[i]}"}
|
||||||
|
# Indicate new cword
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
done
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
else
|
||||||
|
# No, list of word completions separators hasn't changed;
|
||||||
|
for i in "${!COMP_WORDS[@]}"; do
|
||||||
|
printf -v "$2[i]" %s "${COMP_WORDS[i]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local FCN_RETURN=""
|
||||||
|
local IS_PATH=0
|
||||||
|
|
||||||
|
|
||||||
|
# -- THIS LINE WILL BE REPLACED WITH GENERATED CODE --
|
||||||
|
|
||||||
|
|
||||||
|
COMPREPLY=()
|
||||||
|
local OPTIONS_NEW=""
|
||||||
|
|
||||||
|
# check if bash or zsh
|
||||||
|
# _get_comp_words_by_ref is a bash built-in function, we check if it exists
|
||||||
|
declare -Ff _get_comp_words_by_ref > /dev/null && IS_BASH=1 || IS_BASH=0
|
||||||
|
|
||||||
|
|
||||||
|
# bash interprets the colon character : as a special character and splits the argument in two
|
||||||
|
# different than what zsh does
|
||||||
|
# https://stackoverflow.com/a/3224910
|
||||||
|
# https://stackoverflow.com/a/12495727
|
||||||
|
local cur
|
||||||
|
local cword words=()
|
||||||
|
_comp__reassemble_words ":" words cword
|
||||||
|
cur=${words[cword]}
|
||||||
|
|
||||||
|
# check the action (get or put)
|
||||||
|
case "${words[0]}" in
|
||||||
|
"sls_detector_get" | "g" | "detg")
|
||||||
|
local IS_GET=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
local IS_GET=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# if no command is written, autocomplete with the commands
|
||||||
|
if [[ ${cword} -eq 1 ]]; then
|
||||||
|
# local SLS_COMMANDS="trimbits exptime"
|
||||||
|
local SLS_COMMANDS_NEW=""
|
||||||
|
|
||||||
|
case "$cur" in
|
||||||
|
[0-9]*:*)
|
||||||
|
local suggestions=($(compgen -W "${SLS_COMMANDS}" -- "${cur#*:}"))
|
||||||
|
COMPREPLY=( ${suggestions[*]} )
|
||||||
|
;;
|
||||||
|
[0-9]*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( compgen -W "$SLS_COMMANDS -h" -- "$cur" ) );;
|
||||||
|
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${cword} -eq 2 ]] && [[ ${words[1]} == "-h" ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W "$SLS_COMMANDS" -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if a command is written, autocomplete with the options
|
||||||
|
# call the function for the command
|
||||||
|
|
||||||
|
if [[ "$SLS_COMMANDS" == *"${words[1]##*:}"* ]]; then
|
||||||
|
__"${words[1]##*:}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if IS_PATH is activated, autocomplete with the path
|
||||||
|
if [[ ${IS_PATH} -eq 1 ]]; then
|
||||||
|
COMPREPLY=($(compgen -f -- "${cur}"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# autocomplete with the options
|
||||||
|
COMPREPLY=($(compgen -W "${FCN_RETURN}" -- "${cur}"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_get
|
||||||
|
complete -F _sd -o filenames g
|
||||||
|
complete -F _sd -o filenames detg
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_put
|
||||||
|
complete -F _sd -o filenames p
|
||||||
|
complete -F _sd -o filenames detp
|
3252
slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh
Normal file
3252
slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh
Normal file
File diff suppressed because it is too large
Load Diff
62035
slsDetectorSoftware/generator/autocomplete/dump.json
Normal file
62035
slsDetectorSoftware/generator/autocomplete/dump.json
Normal file
File diff suppressed because it is too large
Load Diff
62037
slsDetectorSoftware/generator/autocomplete/fixed.json
Normal file
62037
slsDetectorSoftware/generator/autocomplete/fixed.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,171 @@
|
|||||||
|
#### simpler version of autocomplete.sh to understand the logic
|
||||||
|
#### each command has its own function when called it will produce the possible values for autocompletion
|
||||||
|
|
||||||
|
|
||||||
|
_sd() {
|
||||||
|
|
||||||
|
# Reassemble command line words, excluding specified characters from the
|
||||||
|
# list of word completion separators (COMP_WORDBREAKS).
|
||||||
|
# @param $1 chars Characters out of $COMP_WORDBREAKS which should
|
||||||
|
# NOT be considered word breaks. This is useful for things like scp where
|
||||||
|
# we want to return host:path and not only path, so we would pass the
|
||||||
|
# colon (:) as $1 here.
|
||||||
|
# @param $2 words Name of variable to return words to
|
||||||
|
# @param $3 cword Name of variable to return cword to
|
||||||
|
#
|
||||||
|
_comp__reassemble_words()
|
||||||
|
{
|
||||||
|
local exclude="" i j line ref
|
||||||
|
# Exclude word separator characters?
|
||||||
|
if [[ $1 ]]; then
|
||||||
|
# Yes, exclude word separator characters;
|
||||||
|
# Exclude only those characters, which were really included
|
||||||
|
exclude="[${1//[^$COMP_WORDBREAKS]/}]"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Default to cword unchanged
|
||||||
|
printf -v "$3" %s "$COMP_CWORD"
|
||||||
|
# Are characters excluded which were former included?
|
||||||
|
if [[ $exclude ]]; then
|
||||||
|
# Yes, list of word completion separators has shrunk;
|
||||||
|
line=$COMP_LINE
|
||||||
|
# Re-assemble words to complete
|
||||||
|
for ((i = 0, j = 0; i < ${#COMP_WORDS[@]}; i++, j++)); do
|
||||||
|
# Is current word not word 0 (the command itself) and is word not
|
||||||
|
# empty and is word made up of just word separator characters to
|
||||||
|
# be excluded and is current word not preceded by whitespace in
|
||||||
|
# original line?
|
||||||
|
while [[ $i -gt 0 && ${COMP_WORDS[i]} == +($exclude) ]]; do
|
||||||
|
# Is word separator not preceded by whitespace in original line
|
||||||
|
# and are we not going to append to word 0 (the command
|
||||||
|
# itself), then append to current word.
|
||||||
|
[[ $line != [[:blank:]]* ]] && ((j >= 2)) && ((j--))
|
||||||
|
# Append word separator to current or new word
|
||||||
|
ref="$2[$j]"
|
||||||
|
printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"
|
||||||
|
# Indicate new cword
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
# Remove optional whitespace + word separator from line copy
|
||||||
|
line=${line#*"${COMP_WORDS[i]}"}
|
||||||
|
# Indicate next word if available, else end *both* while and
|
||||||
|
# for loop
|
||||||
|
if ((i < ${#COMP_WORDS[@]} - 1)); then
|
||||||
|
((i++))
|
||||||
|
else
|
||||||
|
break 2
|
||||||
|
fi
|
||||||
|
# Start new word if word separator in original line is
|
||||||
|
# followed by whitespace.
|
||||||
|
[[ $line == [[:blank:]]* ]] && ((j++))
|
||||||
|
done
|
||||||
|
# Append word to current word
|
||||||
|
ref="$2[$j]"
|
||||||
|
printf -v "$ref" %s "${!ref-}${COMP_WORDS[i]}"
|
||||||
|
# Remove optional whitespace + word from line copy
|
||||||
|
line=${line#*"${COMP_WORDS[i]}"}
|
||||||
|
# Indicate new cword
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
done
|
||||||
|
((i == COMP_CWORD)) && printf -v "$3" %s "$j"
|
||||||
|
else
|
||||||
|
# No, list of word completions separators hasn't changed;
|
||||||
|
for i in "${!COMP_WORDS[@]}"; do
|
||||||
|
printf -v "$2[i]" %s "${COMP_WORDS[i]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
__exptime(){
|
||||||
|
if [ "${IS_GET}" == "1" ]; then
|
||||||
|
if [ "${cword}" == "2" ]; then
|
||||||
|
FCN_RETURN="s ms us ns"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "${cword}" == "2" ]; then
|
||||||
|
FCN_RETURN=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${cword}" == "3" ]; then
|
||||||
|
FCN_RETURN="s ms us ns"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# trimbits will activate IS_PATH and signal that its input is a path
|
||||||
|
__trimbits(){
|
||||||
|
if [ "${IS_GET}" == "1" ]; then
|
||||||
|
if [ "${cword}" == "2" ]; then
|
||||||
|
FCN_RETURN=""
|
||||||
|
IS_PATH=1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "${cword}" == "2" ]; then
|
||||||
|
FCN_RETURN=""
|
||||||
|
IS_PATH=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
local cword words=()
|
||||||
|
_comp__reassemble_words ":" words cword
|
||||||
|
local FCN_RETURN=""
|
||||||
|
local IS_PATH=0
|
||||||
|
COMPREPLY=()
|
||||||
|
local OPTIONS_NEW=""
|
||||||
|
# _get_comp_words_by_ref -n : cur
|
||||||
|
local cur=${words[cword]}
|
||||||
|
# check the action (get or put)
|
||||||
|
if [ "${words[0]}" == "sls_detector_get" ]; then
|
||||||
|
local IS_GET=1
|
||||||
|
else
|
||||||
|
local IS_GET=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# if no command is written, autocomplete with the commands
|
||||||
|
if [[ ${cword} -eq 1 ]]; then
|
||||||
|
local SLS_COMMANDS="trimbits exptime"
|
||||||
|
local SLS_COMMANDS_NEW=""
|
||||||
|
|
||||||
|
case "$cur" in
|
||||||
|
[0-9]*:*)
|
||||||
|
local suggestions=($(compgen -W "${SLS_COMMANDS}" -- "${cur#*:}"))
|
||||||
|
COMPREPLY=( ${suggestions[*]} )
|
||||||
|
;;
|
||||||
|
[0-9]*)
|
||||||
|
COMPREPLY=()
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( compgen -W "$SLS_COMMANDS -h" -- "$cur" ) );;
|
||||||
|
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if a command is written, autocomplete with the options
|
||||||
|
# call the function for the command
|
||||||
|
__"${words[1]##*:}"
|
||||||
|
|
||||||
|
# if IS_PATH is activated, autocomplete with the path
|
||||||
|
if [[ ${IS_PATH} -eq 1 ]]; then
|
||||||
|
COMPREPLY=($(compgen -f -- "${cur}"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# autocomplete with the options
|
||||||
|
COMPREPLY=($(compgen -W "${FCN_RETURN}" -- "${cur}"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_get
|
||||||
|
complete -F _sd -o filenames g
|
||||||
|
complete -F _sd -o filenames p
|
||||||
|
complete -F _sd -o filenames detg
|
||||||
|
complete -F _sd -o filenames detp
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_put
|
@ -0,0 +1,74 @@
|
|||||||
|
# GENERATED FILE - DO NOT EDIT
|
||||||
|
# ANY CHANGES TO THIS FILE WILL BE OVERWRITTEN
|
||||||
|
|
||||||
|
_sd() {
|
||||||
|
|
||||||
|
|
||||||
|
# -- THIS LINE WILL BE REPLACED WITH GENERATED CODE --
|
||||||
|
|
||||||
|
|
||||||
|
local FCN_RETURN=""
|
||||||
|
local IS_PATH=0
|
||||||
|
COMPREPLY=()
|
||||||
|
local OPTIONS_NEW=""
|
||||||
|
words=("${COMP_WORDS[@]}")
|
||||||
|
cword=$COMP_CWORD
|
||||||
|
|
||||||
|
local cur=${words[cword]}
|
||||||
|
# check the action (get or put)
|
||||||
|
case "${words[0]}" in
|
||||||
|
"sls_detector_get" | "g" | "detg")
|
||||||
|
local IS_GET=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
local IS_GET=0
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# if no command is written, autocomplete with the commands
|
||||||
|
if [[ ${cword} -eq 1 ]]; then
|
||||||
|
|
||||||
|
case "$cur" in
|
||||||
|
[0-9]*)
|
||||||
|
for i in $SLS_COMMANDS; do
|
||||||
|
SLS_COMMANDS_NEW="${SLS_COMMANDS_NEW} ${cur%%:*}:$i"
|
||||||
|
done
|
||||||
|
COMPREPLY=( $( compgen -W "${SLS_COMMANDS_NEW}" -- "$cur" ) );;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( compgen -W "$SLS_COMMANDS -h" -- "$cur" ) );;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${cword} -eq 2 ]] && [[ ${words[1]} == "-h" ]]; then
|
||||||
|
COMPREPLY=( $( compgen -W "$SLS_COMMANDS" -- "$cur" ) )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if a command is written, autocomplete with the options
|
||||||
|
# call the function for the command
|
||||||
|
|
||||||
|
if [[ "$SLS_COMMANDS" == *"${words[1]##*:}"* ]]; then
|
||||||
|
__"${words[1]##*:}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if IS_PATH is activated, autocomplete with the path
|
||||||
|
if [[ ${IS_PATH} -eq 1 ]]; then
|
||||||
|
COMPREPLY=($(compgen -f -- "${cur}"))
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# autocomplete with the options
|
||||||
|
COMPREPLY=($(compgen -W "${FCN_RETURN}" -- "${cur}"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_get
|
||||||
|
complete -F _sd -o filenames g
|
||||||
|
complete -F _sd -o filenames detg
|
||||||
|
|
||||||
|
complete -F _sd -o filenames sls_detector_put
|
||||||
|
complete -F _sd -o filenames p
|
||||||
|
complete -F _sd -o filenames detp
|
3162
slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh
Normal file
3162
slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh
Normal file
File diff suppressed because it is too large
Load Diff
4264
slsDetectorSoftware/generator/commands.yaml
Normal file
4264
slsDetectorSoftware/generator/commands.yaml
Normal file
File diff suppressed because it is too large
Load Diff
379
slsDetectorSoftware/generator/commands_parser/commands_parser.py
Normal file
379
slsDetectorSoftware/generator/commands_parser/commands_parser.py
Normal file
@ -0,0 +1,379 @@
|
|||||||
|
import copy
|
||||||
|
import logging
|
||||||
|
import yaml
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
class CommandParser:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
commands_file: Path = Path(__file__).parent.parent / 'commands.yaml',
|
||||||
|
output_file: Path = Path(__file__).parent.parent / 'extended_commands.yaml'
|
||||||
|
):
|
||||||
|
|
||||||
|
self.output_file = output_file
|
||||||
|
self.commands_file = commands_file
|
||||||
|
self.fp = self.commands_file.open('r')
|
||||||
|
self.simple_commands = yaml.unsafe_load(self.fp)
|
||||||
|
self.extended_commands = {}
|
||||||
|
self.argc_set = set()
|
||||||
|
self.logger = logging.getLogger('command_parser')
|
||||||
|
self.__current_action: str = ''
|
||||||
|
FORMAT = '[%(levelname)s] %(message)s'
|
||||||
|
logging.basicConfig(format=FORMAT, level=logging.INFO)
|
||||||
|
|
||||||
|
self.propagate_config = {
|
||||||
|
'require_det_id': False,
|
||||||
|
'convert_det_id': True,
|
||||||
|
'input': [],
|
||||||
|
'input_types': [],
|
||||||
|
'function': '',
|
||||||
|
'output': [],
|
||||||
|
'cast_input': [],
|
||||||
|
'check_det_id': False,
|
||||||
|
'arg_types': [],
|
||||||
|
# 'store_result_in_t': False, # always true in GET action
|
||||||
|
}
|
||||||
|
self.default_config = {
|
||||||
|
'infer_action': True,
|
||||||
|
'help': '',
|
||||||
|
'actions': {}
|
||||||
|
}
|
||||||
|
|
||||||
|
def _verify_argument(self, arg, infer_action, command_name, action):
|
||||||
|
if arg['function'] == '' and 'ctb_output_list' not in arg:
|
||||||
|
special_exception_message_list = ["Cannot put", "Cannot get"]
|
||||||
|
if 'exceptions' in arg and arg['exceptions'][0]['condition'] == 'true' and any(ele in arg['exceptions'][0]['message'] for ele in special_exception_message_list):
|
||||||
|
self.logger.warning(f"{command_name} has a special exception message for {action}.")
|
||||||
|
else:
|
||||||
|
self.logger.warning(f"{command_name} [{action}] does not have a function")
|
||||||
|
if len(arg['input_types']) != len(arg['input']):
|
||||||
|
raise ValueError(f'Argument {arg} does not have the correct number of inputs')
|
||||||
|
if 'separate_time_units' in arg:
|
||||||
|
|
||||||
|
if arg['separate_time_units']['input'] == "":
|
||||||
|
raise ValueError(f'Argument {arg} does not have the correct number of inputs for separate_time_units')
|
||||||
|
if len(arg['separate_time_units']['output']) != 2:
|
||||||
|
raise ValueError(f'Argument {arg} does not have the correct number of outputs for separate_time_units')
|
||||||
|
if 'convert_to_time' in arg:
|
||||||
|
if len(arg['convert_to_time']['input']) != 2:
|
||||||
|
raise ValueError(f'Argument {arg} does not have the correct number of inputs for convert_to_time')
|
||||||
|
if len(arg['convert_to_time']['output']) == "":
|
||||||
|
raise ValueError(f'Argument {arg} does not have the correct number of outputs for convert_to_time')
|
||||||
|
# if infer_action:
|
||||||
|
# if arg['argc'] in self.argc_set:
|
||||||
|
# raise ValueError(f'Argument {arg} has a duplicate argc')
|
||||||
|
# self.argc_set.add(arg['argc'])
|
||||||
|
|
||||||
|
def verify_format(self):
|
||||||
|
# todo verify detectors
|
||||||
|
# todo verify circular inheritance
|
||||||
|
# todo verify child commands (those that inherit)
|
||||||
|
# todo verify that there is no wrongly typed parameters
|
||||||
|
# todo verify that the same number of input_types and input are given
|
||||||
|
# todo verify that each argument has argc (error can happen when inheriting)
|
||||||
|
for command_name, command in self.simple_commands.items():
|
||||||
|
if 'inherit_actions' in command or 'template' in command and command[
|
||||||
|
'template'] or 'is_description' in command and command['is_description']:
|
||||||
|
continue
|
||||||
|
self.argc_set = set()
|
||||||
|
if 'infer_action' not in command:
|
||||||
|
command['infer_action'] = True
|
||||||
|
if 'actions' not in command:
|
||||||
|
raise ValueError(f'Command {command_name} does not have any actions')
|
||||||
|
for action, action_params in command['actions'].items():
|
||||||
|
if 'argc' in action_params:
|
||||||
|
if 'args' in action_params:
|
||||||
|
raise ValueError(f'Action {action} has both argc and args')
|
||||||
|
arg = {**self.propagate_config, **action_params}
|
||||||
|
self._verify_argument(arg, command['infer_action'], command_name, action)
|
||||||
|
elif 'args' in action_params:
|
||||||
|
if type(action_params['args']) is not list:
|
||||||
|
raise ValueError(f'Action {action} args is not a list')
|
||||||
|
if len(action_params['args']) == 0:
|
||||||
|
raise ValueError(f'Action {action} args is empty')
|
||||||
|
action_args = {**self.propagate_config, **action_params}
|
||||||
|
del action_args['args']
|
||||||
|
for arg in action_params['args']:
|
||||||
|
arg = {**action_args, **arg}
|
||||||
|
self._verify_argument(arg, command['infer_action'], command_name, action)
|
||||||
|
self.logger.info('Commands file is valid ✅️')
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _parse_inherited_command(self, parent, command, simple_parent):
|
||||||
|
"""
|
||||||
|
parse a command that inherits from parent command
|
||||||
|
:param parent: parsed parent command
|
||||||
|
:param command: the current command
|
||||||
|
:param simple_parent: unparsed parent command
|
||||||
|
:return: parsed command
|
||||||
|
"""
|
||||||
|
# deepcopy parent and command to avoid modifying the originals
|
||||||
|
command = copy.deepcopy(command)
|
||||||
|
config = copy.deepcopy(parent)
|
||||||
|
# add help
|
||||||
|
if 'help' in command:
|
||||||
|
config['help'] = command['help']
|
||||||
|
if 'actions' not in command:
|
||||||
|
return config
|
||||||
|
for action, command_params in command['actions'].items():
|
||||||
|
self.__current_action = action
|
||||||
|
if action not in config['actions']:
|
||||||
|
# todo: handle this case
|
||||||
|
pass
|
||||||
|
parent_params = config['actions'][action]
|
||||||
|
if 'args' in command_params:
|
||||||
|
# child has args => inherit action level params from parent + override with child args + use child's
|
||||||
|
# action level params
|
||||||
|
context = {**self.propagate_config, **simple_parent['actions'][action], **command_params}
|
||||||
|
config['actions'][action]['args'] = self.parse_action(context, command_params['args'])
|
||||||
|
elif 'argc' in command_params:
|
||||||
|
# child has action level args (argc)
|
||||||
|
context = {**self.propagate_config, **simple_parent['actions'][action], **command_params}
|
||||||
|
config['actions'][action]['args'] = self.parse_action(context, [])
|
||||||
|
else:
|
||||||
|
# child does not have args => use parent's action level params + override with child's action level
|
||||||
|
if 'args' in parent_params:
|
||||||
|
config['actions'][action]['args'] = self.parse_action({}, parent_params['args'], command_params)
|
||||||
|
|
||||||
|
if 'detectors' in command_params:
|
||||||
|
if command_params['detectors'] is None:
|
||||||
|
# if child has an empty detector section, then delete the parent's detector section
|
||||||
|
del config['actions'][action]['detectors']
|
||||||
|
continue
|
||||||
|
|
||||||
|
for detector_name, detector_params in command_params['detectors'].items():
|
||||||
|
if 'detectors' not in config['actions'][action]:
|
||||||
|
config['actions'][action]['detectors'] = {}
|
||||||
|
config_detector = config['actions'][action]['detectors']
|
||||||
|
if 'detectors' not in parent_params or detector_name not in parent_params['detectors']:
|
||||||
|
if 'args' in detector_params:
|
||||||
|
# if child has detector args and parent does not have detectors
|
||||||
|
# => use child's detector args
|
||||||
|
context = {**self.propagate_config, **simple_parent['actions'][action], **detector_params}
|
||||||
|
config_detector[detector_name] = self.parse_action(context, detector_params['args'])
|
||||||
|
elif 'args' in parent_params:
|
||||||
|
# if child does not have detector args and parent does not have detectors
|
||||||
|
# => use the child's action args
|
||||||
|
context = {**self.propagate_config, **simple_parent['actions'][action]}
|
||||||
|
config_detector[detector_name] = self.parse_action(context,
|
||||||
|
config['actions'][action]['args'],
|
||||||
|
detector_params)
|
||||||
|
elif detector_name in parent_params['detectors']:
|
||||||
|
|
||||||
|
if 'args' in detector_params:
|
||||||
|
# child and parent have the same detector and child has detector args
|
||||||
|
# => use child's detector args
|
||||||
|
context = {
|
||||||
|
**self.propagate_config,
|
||||||
|
**simple_parent['actions'][action],
|
||||||
|
**simple_parent['actions'][action]['detectors'][detector_name],
|
||||||
|
|
||||||
|
}
|
||||||
|
config_detector[detector_name] = self.parse_action(context, detector_params['args'])
|
||||||
|
else:
|
||||||
|
# child and parent have the same detector and child does not have detector args
|
||||||
|
# => use parent's detector args
|
||||||
|
priority_context = {**command_params, **detector_params}
|
||||||
|
config_detector[detector_name] = self.parse_action(
|
||||||
|
{},
|
||||||
|
parent_params['detectors'][detector_name],
|
||||||
|
priority_context
|
||||||
|
)
|
||||||
|
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return config
|
||||||
|
|
||||||
|
def _parse_command(self, command):
|
||||||
|
"""
|
||||||
|
logic function for parse_command.
|
||||||
|
This function is recursive
|
||||||
|
:return: parsed command
|
||||||
|
"""
|
||||||
|
config = self.default_config.copy()
|
||||||
|
config.update(command)
|
||||||
|
config['actions'] = {}
|
||||||
|
|
||||||
|
# check if command inherits from another command
|
||||||
|
if 'inherit_actions' in command:
|
||||||
|
if command['inherit_actions'] in self.extended_commands:
|
||||||
|
# if parent command has already been parsed, use that
|
||||||
|
parent = self.extended_commands[command['inherit_actions']]
|
||||||
|
else:
|
||||||
|
# if parent command has not been parsed, parse it
|
||||||
|
parent = self.parse_command(command['inherit_actions'])
|
||||||
|
# parse the current command and merge it with the parent command
|
||||||
|
config = self._parse_inherited_command(parent, command, self.simple_commands[command['inherit_actions']])
|
||||||
|
return config
|
||||||
|
|
||||||
|
if 'actions' not in command:
|
||||||
|
return config
|
||||||
|
|
||||||
|
for action, action_params in command['actions'].items():
|
||||||
|
self.__current_action = action
|
||||||
|
|
||||||
|
config['actions'][action] = {}
|
||||||
|
config_action = config['actions'][action]
|
||||||
|
# the context in the current command and the current action
|
||||||
|
action_context = {**self.propagate_config, **action_params}
|
||||||
|
if 'args' not in action_params:
|
||||||
|
# parse the action with the action context
|
||||||
|
if action_params.keys() != {'detectors'}:
|
||||||
|
config_action['args'] = self.parse_action(action_context, [])
|
||||||
|
else:
|
||||||
|
config_action['args'] = self.parse_action(action_context, action_params['args'])
|
||||||
|
|
||||||
|
# check if the action has detectors
|
||||||
|
if 'detectors' in action_params:
|
||||||
|
config_action['detectors'] = {}
|
||||||
|
for detector_name, detector_params in action_params['detectors'].items():
|
||||||
|
# get the context for the detector and merge it with the action context
|
||||||
|
detector_context = {**action_context, **detector_params}
|
||||||
|
|
||||||
|
# if the detector does not have args, then use the action args
|
||||||
|
# otherwise, use the detector args and override the action args
|
||||||
|
tmp_args = []
|
||||||
|
if 'args' not in detector_params:
|
||||||
|
if 'args' in config_action:
|
||||||
|
tmp_args = config_action['args']
|
||||||
|
else:
|
||||||
|
tmp_args = detector_params['args']
|
||||||
|
detector_params['args'] = tmp_args
|
||||||
|
|
||||||
|
# parse the action with the detector context
|
||||||
|
config_action['detectors'][detector_name] = self.parse_action(detector_context,
|
||||||
|
tmp_args,
|
||||||
|
detector_params)
|
||||||
|
return config
|
||||||
|
|
||||||
|
def sanitize_argument(func):
|
||||||
|
def f(self, action_context, args_old, priority_context={}):
|
||||||
|
args = func(self, action_context, args_old, priority_context)
|
||||||
|
for i, arg in enumerate(args):
|
||||||
|
if 'args' in arg:
|
||||||
|
del arg['args']
|
||||||
|
if 'detectors' in arg:
|
||||||
|
del arg['detectors']
|
||||||
|
if not arg['cast_input']:
|
||||||
|
# if the cast_input is empty, then set it to False
|
||||||
|
arg['cast_input'] = [False] * len(arg['input'])
|
||||||
|
|
||||||
|
elif len(arg['cast_input']) != len(arg['input']):
|
||||||
|
# if the cast_input is not the same length as the input, then set it to False
|
||||||
|
arg['cast_input'] = [False] * len(arg['input'])
|
||||||
|
self.logger.warning(f'cast_input for {arg["function"]} '
|
||||||
|
f'with argc: {arg["argc"]} has different length than input')
|
||||||
|
if 'store_result_in_t' not in arg:
|
||||||
|
if self.__current_action == 'GET':
|
||||||
|
arg['store_result_in_t'] = True
|
||||||
|
else:
|
||||||
|
arg['store_result_in_t'] = False
|
||||||
|
return args
|
||||||
|
|
||||||
|
return f
|
||||||
|
|
||||||
|
@sanitize_argument
|
||||||
|
def parse_action(self, action_context, args, priority_context={}):
|
||||||
|
"""
|
||||||
|
parse an action
|
||||||
|
:param action_context: context of the action
|
||||||
|
:param args: arguments to be used in the action
|
||||||
|
:param priority_context: context that should override the arguments params
|
||||||
|
:return: parsed action
|
||||||
|
"""
|
||||||
|
|
||||||
|
def add_cast_input(argument):
|
||||||
|
return argument
|
||||||
|
|
||||||
|
# deepcopy action_context to avoid modifying the original
|
||||||
|
action_context = {**self.propagate_config, **copy.deepcopy(action_context)}
|
||||||
|
priority_context = copy.deepcopy(priority_context)
|
||||||
|
|
||||||
|
if 'detectors' in action_context:
|
||||||
|
del action_context['detectors']
|
||||||
|
if 'detectors' in priority_context:
|
||||||
|
del priority_context['detectors']
|
||||||
|
|
||||||
|
if args == []:
|
||||||
|
# if there are no arguments, then the action has only one argument
|
||||||
|
context = {**action_context, **priority_context}
|
||||||
|
return [add_cast_input(context)]
|
||||||
|
|
||||||
|
ret_args = []
|
||||||
|
if 'args' in action_context:
|
||||||
|
del action_context['args']
|
||||||
|
if 'args' in priority_context:
|
||||||
|
del priority_context['args']
|
||||||
|
|
||||||
|
# if there are arguments, then merge them with the action context and priority context
|
||||||
|
for arg in args:
|
||||||
|
arg = {**action_context, **arg, **priority_context}
|
||||||
|
ret_args.append(add_cast_input(arg))
|
||||||
|
return ret_args
|
||||||
|
|
||||||
|
def parse_command(self, command_name):
|
||||||
|
"""
|
||||||
|
parse a single command
|
||||||
|
This function is recursive
|
||||||
|
|
||||||
|
:param command_name: name of the command to parse
|
||||||
|
:return: the parsed command
|
||||||
|
"""
|
||||||
|
command = self.simple_commands[command_name]
|
||||||
|
parsed_command = self._parse_command(command)
|
||||||
|
if 'function_alias' not in command:
|
||||||
|
if 'command_name' in command:
|
||||||
|
parsed_command['function_alias'] = command['command_name']
|
||||||
|
else:
|
||||||
|
parsed_command['function_alias'] = command_name
|
||||||
|
|
||||||
|
if 'command_name' not in command:
|
||||||
|
parsed_command['command_name'] = command_name
|
||||||
|
|
||||||
|
if 'template' in command and command['template']:
|
||||||
|
return parsed_command
|
||||||
|
self.extended_commands[command_name] = parsed_command
|
||||||
|
return self.extended_commands[command_name]
|
||||||
|
|
||||||
|
def parse_all_commands(self):
|
||||||
|
"""
|
||||||
|
iterate over all commands in yaml file and parse them
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
|
||||||
|
for command_name in self.simple_commands:
|
||||||
|
# todo remove this (added for debugging)
|
||||||
|
if command_name != 'xtiming':
|
||||||
|
self.parse_command(command_name)
|
||||||
|
|
||||||
|
# post-process the parsed commands
|
||||||
|
self.post_process_all_commands()
|
||||||
|
|
||||||
|
yaml.Dumper.ignore_aliases = lambda *args: True
|
||||||
|
self.logger.info(f'parsed {len(self.extended_commands)} commands')
|
||||||
|
yaml.dump(self.extended_commands, self.output_file.open('w'), default_flow_style=False)
|
||||||
|
|
||||||
|
def post_process_all_commands(self):
|
||||||
|
for command_name, command in self.extended_commands.items():
|
||||||
|
if 'is_description' in command and command['is_description']:
|
||||||
|
continue
|
||||||
|
for action_name, action, in command['actions'].items():
|
||||||
|
for arg in action['args']:
|
||||||
|
if arg['argc'] == 0:
|
||||||
|
arg['arg_types'] = []
|
||||||
|
continue
|
||||||
|
if arg['argc'] == -1:
|
||||||
|
pass
|
||||||
|
if arg['arg_types'] == []:
|
||||||
|
arg['arg_types'] = arg['input_types']
|
||||||
|
|
||||||
|
|
||||||
|
# command_parser = CommandParser(Path(
|
||||||
|
# '/afs/psi.ch/user/b/braham_b/github/slsDetectorPackage/slsDetectorSoftware/generator/tests/command_parser/data/detectors.yaml'))
|
||||||
|
command_parser = CommandParser()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
282
slsDetectorSoftware/generator/cpp_codegen/codegen.py
Normal file
282
slsDetectorSoftware/generator/cpp_codegen/codegen.py
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
class CodeGenerator:
|
||||||
|
def __init__(self):
|
||||||
|
self.file = None
|
||||||
|
self.actions_dict = {
|
||||||
|
'GET': 'slsDetectorDefs::GET_ACTION',
|
||||||
|
'PUT': 'slsDetectorDefs::PUT_ACTION',
|
||||||
|
'READOUT': 'slsDetectorDefs::READOUT_ACTION',
|
||||||
|
'HELP': 'slsDetectorDefs::HELP_ACTION',
|
||||||
|
}
|
||||||
|
self.template_file = None
|
||||||
|
|
||||||
|
def open(self, path):
|
||||||
|
self.file = path.open('w')
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.file.close()
|
||||||
|
self.file = None
|
||||||
|
|
||||||
|
def write_line(self, line):
|
||||||
|
self.file.write(line + '\n')
|
||||||
|
|
||||||
|
def write(self, text):
|
||||||
|
self.file.write(text)
|
||||||
|
|
||||||
|
def write_opening(self, path):
|
||||||
|
"""Write the opening file for the caller.cpp file"""
|
||||||
|
self.template_file = path.open('r')
|
||||||
|
for line in self.template_file:
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE" in line:
|
||||||
|
return
|
||||||
|
self.file.write(line)
|
||||||
|
|
||||||
|
def write_closing(self):
|
||||||
|
"""Write the closing file for the caller.cpp file"""
|
||||||
|
for line in self.template_file.readlines():
|
||||||
|
self.file.write(line)
|
||||||
|
self.template_file.close()
|
||||||
|
|
||||||
|
def write_header(self, in_path, out_path, commands, deprecated_commands):
|
||||||
|
"""Write the header file for the caller.h file"""
|
||||||
|
with out_path.open('w') as fp:
|
||||||
|
with in_path.open('r') as fp2:
|
||||||
|
for line in fp2:
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1)" in line:
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
if 'duplicate_function' in command and command['duplicate_function']:
|
||||||
|
continue
|
||||||
|
fp.write(f'std::string {command["function_alias"]}(int action);\n')
|
||||||
|
continue
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (2)" in line:
|
||||||
|
map_string = ''
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
map_string += f'{{"{command_name}", &Caller::{command["function_alias"]}}},'
|
||||||
|
fp.write(map_string[:-1] + '\n')
|
||||||
|
continue
|
||||||
|
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (3)" in line:
|
||||||
|
for key, value in deprecated_commands.items():
|
||||||
|
fp.write(f'{{"{key}", "{value}"}},\n')
|
||||||
|
continue
|
||||||
|
|
||||||
|
fp.write(line)
|
||||||
|
|
||||||
|
def write_infer_header(self, in_path, out_path, commands):
|
||||||
|
"""Write the header file for the inferAction.h file"""
|
||||||
|
with out_path.open('w+') as fp:
|
||||||
|
with in_path.open('r') as fp2:
|
||||||
|
for line in fp2:
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1) - DO NOT REMOVE" in line:
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
if 'duplicate_function' in command and command['duplicate_function']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
fp.write(f'int {command["function_alias"]}();\n')
|
||||||
|
continue
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (2) - DO NOT REMOVE" in line:
|
||||||
|
map_string = ''
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
map_string += f'{{"{command_name}", &InferAction::{command["function_alias"]}}},'
|
||||||
|
fp.write(map_string[:-1] + '\n')
|
||||||
|
continue
|
||||||
|
fp.write(line)
|
||||||
|
|
||||||
|
def write_infer_cpp(self, in_path, out_path, commands, non_dist, type_dist):
|
||||||
|
"""Write the source file for the inferAction.cpp file"""
|
||||||
|
with in_path.open('r') as fp2:
|
||||||
|
for line in fp2:
|
||||||
|
if "THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1) - DO NOT REMOVE" in line:
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
if 'duplicate_function' in command and command['duplicate_function']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
with function('int', f"InferAction::{command['function_alias']}", []) as f:
|
||||||
|
if (command_name, -1) in non_dist| type_dist:
|
||||||
|
self.write_line(
|
||||||
|
f'throw RuntimeError("det is disabled for command: {command_name}. Use detg or detp");')
|
||||||
|
elif not command['infer_action']:
|
||||||
|
self.write_line('throw RuntimeError("infer_action is disabled");')
|
||||||
|
else:
|
||||||
|
checked_argcs = set()
|
||||||
|
for action, action_params in command['actions'].items():
|
||||||
|
for arg in action_params['args']:
|
||||||
|
if arg['argc'] in checked_argcs:
|
||||||
|
continue
|
||||||
|
checked_argcs.add(arg['argc'])
|
||||||
|
with if_block(f'args.size() == {arg["argc"]}'):
|
||||||
|
# check if this argc is not distinguishable
|
||||||
|
if (command_name, arg["argc"]) in non_dist | type_dist:
|
||||||
|
self.write_line(
|
||||||
|
f'throw RuntimeError("det is disabled for command: {command_name} with number of arguments {arg["argc"]}. Use detg or detp");')
|
||||||
|
else:
|
||||||
|
self.write_line(f'return {self.actions_dict[action]};')
|
||||||
|
with else_block():
|
||||||
|
self.write_line(
|
||||||
|
'throw RuntimeError("Could not infer action: Wrong number of arguments");')
|
||||||
|
continue
|
||||||
|
self.write_line(line)
|
||||||
|
|
||||||
|
def write_check_arg(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def write_arg(self, args, action, command_name):
|
||||||
|
for arg in args:
|
||||||
|
if arg['argc'] != -1:
|
||||||
|
if_block(f'args.size() == {arg["argc"]}',).__enter__()
|
||||||
|
if 'pattern_command' in arg and arg['pattern_command']:
|
||||||
|
self.write_line(f'int level = -1, iArg = 0, '
|
||||||
|
f'nGetArgs = {arg["pattern_command"]["nGetArgs"]},'
|
||||||
|
f' nPutArgs = {arg["pattern_command"]["nPutArgs"]};\nGetLevelAndUpdateArgIndex(action, '
|
||||||
|
f'"{arg["pattern_command"]["command_name"]}", level, iArg, nGetArgs,nPutArgs);'
|
||||||
|
)
|
||||||
|
|
||||||
|
if 'extra_variables' in arg:
|
||||||
|
for var in arg['extra_variables']:
|
||||||
|
codegen.write_line(f'{var["type"]} {var["name"]} = {var["value"]};')
|
||||||
|
if 'separate_time_units' in arg and arg['separate_time_units']:
|
||||||
|
self.write_line(f'std::string tmp_time({arg["separate_time_units"]["input"]});')
|
||||||
|
self.write_line(f'std::string {arg["separate_time_units"]["output"][1]}'
|
||||||
|
f' = RemoveUnit(tmp_time);')
|
||||||
|
self.write_line(f'auto {arg["separate_time_units"]["output"][0]} = '
|
||||||
|
f'StringTo < time::ns > (tmp_time,'
|
||||||
|
f' {arg["separate_time_units"]["output"][1]});')
|
||||||
|
if 'convert_to_time' in arg and arg['convert_to_time']:
|
||||||
|
self.write_line(f'auto {arg["convert_to_time"]["output"]} = '
|
||||||
|
f'StringTo < time::ns > ({", ".join(arg["convert_to_time"]["input"])});')
|
||||||
|
input_arguments = []
|
||||||
|
if 'exceptions' in arg:
|
||||||
|
for exception in arg['exceptions']:
|
||||||
|
self.write_line(f'if ({exception["condition"]}) {{ throw RuntimeError({exception["message"]}); }}')
|
||||||
|
if 'check_det_id' in arg and arg['check_det_id']:
|
||||||
|
self.write_line(
|
||||||
|
f'if (det_id != -1) {{ throw RuntimeError("Cannot execute {command_name} at module level"); }} '
|
||||||
|
)
|
||||||
|
# only used for 3 commands :(
|
||||||
|
if 'ctb_output_list' in arg:
|
||||||
|
self.write_line(f"""
|
||||||
|
std::string suffix = " {arg['ctb_output_list']['suffix']}";
|
||||||
|
auto t = det->{arg['ctb_output_list']['GETFCNLIST']}();""")
|
||||||
|
if arg['ctb_output_list']['GETFCNNAME'] != '':
|
||||||
|
self.write_line(f"""
|
||||||
|
auto names = det->{arg['ctb_output_list']['GETFCNNAME']}();
|
||||||
|
auto name_it = names.begin();""")
|
||||||
|
self.write_line("os << '[';")
|
||||||
|
with if_block(f't.size() > 0'):
|
||||||
|
self.write_line(f"""
|
||||||
|
auto it = t.cbegin();
|
||||||
|
os << ToString({arg['ctb_output_list']['printable_name']}) << ' ';
|
||||||
|
os << OutString(det->{arg['ctb_output_list']['GETFCN']}(*it++, std::vector<int>{{det_id}}))<< suffix;
|
||||||
|
while (it != t.cend()) {{
|
||||||
|
os << ", " << ToString({arg['ctb_output_list']['printable_name']}) << ' ';
|
||||||
|
os << OutString(det->{arg['ctb_output_list']['GETFCN']}(*it++, std::vector<int>{{det_id}}))<< suffix;
|
||||||
|
}}
|
||||||
|
""")
|
||||||
|
self.write_line('os << "]\\n";')
|
||||||
|
if arg['argc'] != -1:
|
||||||
|
if_block().__exit__()
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
for i in range(len(arg['input'])):
|
||||||
|
if arg['cast_input'][i]:
|
||||||
|
self.write_line(
|
||||||
|
f'auto arg{i} = StringTo<{arg["input_types"][i]}>({arg["input"][i]});')
|
||||||
|
input_arguments.append(f'arg{i}')
|
||||||
|
else:
|
||||||
|
input_arguments.append(arg["input"][i])
|
||||||
|
if 'require_det_id' in arg and arg['require_det_id']:
|
||||||
|
if 'convert_det_id' in arg and arg['convert_det_id']:
|
||||||
|
input_arguments.append("std::vector<int>{ det_id }")
|
||||||
|
else:
|
||||||
|
input_arguments.append("det_id")
|
||||||
|
|
||||||
|
input_arguments = ", ".join(input_arguments)
|
||||||
|
# call function
|
||||||
|
if arg["function"]:
|
||||||
|
if arg['store_result_in_t']:
|
||||||
|
self.write_line(f'auto t = det->{arg["function"]}({input_arguments});')
|
||||||
|
else:
|
||||||
|
self.write_line(f'det->{arg["function"]}({input_arguments});')
|
||||||
|
else:
|
||||||
|
pass #We have no function so skip block
|
||||||
|
|
||||||
|
output_args = []
|
||||||
|
for output in arg['output']:
|
||||||
|
output_args.append(output)
|
||||||
|
if len(output_args) > 0:
|
||||||
|
self.write_line(f"os << {'<< '.join(output_args)} << '\\n';")
|
||||||
|
|
||||||
|
if arg['argc'] != -1:
|
||||||
|
if_block().__exit__()
|
||||||
|
|
||||||
|
|
||||||
|
class if_block:
|
||||||
|
def __init__(self, condition="", elseif=False):
|
||||||
|
self.condition = condition
|
||||||
|
self.elseif = elseif
|
||||||
|
self.block = False
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
if self.elseif:
|
||||||
|
codegen.write_line('else if (' + self.condition + ') {')
|
||||||
|
else:
|
||||||
|
codegen.write_line('if (' + self.condition + ') {')
|
||||||
|
if self.block:
|
||||||
|
codegen.write_line('{\n')
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
codegen.write_line('}')
|
||||||
|
if self.block:
|
||||||
|
codegen.write_line('}')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
|
||||||
|
class else_block:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
codegen.write_line('else {')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
codegen.write_line('}')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
|
||||||
|
class for_block:
|
||||||
|
def __init__(self, condition):
|
||||||
|
self.condition = condition
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
codegen.write_line('for (' + self.condition + ') {')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
codegen.write_line('}')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
|
||||||
|
class function:
|
||||||
|
def __init__(self, return_type, name, args: list[tuple[str, str]]):
|
||||||
|
self.name = name
|
||||||
|
self.args = args
|
||||||
|
self.return_type = return_type
|
||||||
|
|
||||||
|
def __enter__(self):
|
||||||
|
s = ""
|
||||||
|
for arg in self.args:
|
||||||
|
arg_type, arg_name = arg
|
||||||
|
s += arg_type + ' ' + arg_name + ', '
|
||||||
|
s = s[:-2]
|
||||||
|
codegen.write_line(self.return_type + ' ' + self.name +
|
||||||
|
f'({s}) {{')
|
||||||
|
codegen.write_line('')
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __exit__(self, *args):
|
||||||
|
codegen.write_line('}')
|
||||||
|
codegen.write_line('')
|
||||||
|
|
||||||
|
|
||||||
|
codegen = CodeGenerator()
|
176
slsDetectorSoftware/generator/deprecated_commands.yaml
Normal file
176
slsDetectorSoftware/generator/deprecated_commands.yaml
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
#configuration
|
||||||
|
detectorversion: firmwareversion
|
||||||
|
softwareversion: detectorserverversion
|
||||||
|
receiverversion: rx_version
|
||||||
|
detectornumber: serialnumber
|
||||||
|
thisversion: clientversion
|
||||||
|
detsizechan: detsize
|
||||||
|
trimdir: settingspath
|
||||||
|
settingsdir: settingspath
|
||||||
|
flippeddatax: fliprows
|
||||||
|
|
||||||
|
#acquisition parameters
|
||||||
|
cycles: triggers
|
||||||
|
cyclesl: triggersl
|
||||||
|
clkdivider: readoutspeed
|
||||||
|
speed: readoutspeed
|
||||||
|
vhighvoltage: highvoltage
|
||||||
|
digitest: imagetest
|
||||||
|
filter: filterresistor
|
||||||
|
readnlines: readnrows
|
||||||
|
|
||||||
|
# temperature
|
||||||
|
|
||||||
|
# super old dacs
|
||||||
|
vtr: vtrim
|
||||||
|
vrf: vrpreamp
|
||||||
|
vrs: vrshaper
|
||||||
|
vcall: vcal
|
||||||
|
vis: vishaper
|
||||||
|
vshaper: vrshaper
|
||||||
|
vpreamp: vrpreamp
|
||||||
|
vshaperneg: vrshaper_n
|
||||||
|
viinsh: vishaper
|
||||||
|
vpl: vcal_n
|
||||||
|
vph: vcal_p
|
||||||
|
|
||||||
|
# dacs
|
||||||
|
vthreshold: dac
|
||||||
|
vsvp: dac
|
||||||
|
vsvn: dac
|
||||||
|
vtrim: dac
|
||||||
|
vrpreamp: dac
|
||||||
|
vrshaper: dac
|
||||||
|
vtgstv: dac
|
||||||
|
vcmp_ll: dac
|
||||||
|
vcmp_lr: dac
|
||||||
|
vcal: dac
|
||||||
|
vcmp_rl: dac
|
||||||
|
vcmp_rr: dac
|
||||||
|
rxb_rb: dac
|
||||||
|
rxb_lb: dac
|
||||||
|
vcp: dac
|
||||||
|
vcn: dac
|
||||||
|
vishaper: dac
|
||||||
|
iodelay: dac
|
||||||
|
vref_ds: dac
|
||||||
|
vcascn_pb: dac
|
||||||
|
vcascp_pb: dac
|
||||||
|
vout_cm: dac
|
||||||
|
vcasc_out: dac
|
||||||
|
vin_cm: dac
|
||||||
|
vref_comp: dac
|
||||||
|
ib_test_c: dac
|
||||||
|
vrshaper_n: dac
|
||||||
|
vipre: dac
|
||||||
|
vdcsh: dac
|
||||||
|
vth1: dac
|
||||||
|
vth2: dac
|
||||||
|
vth3: dac
|
||||||
|
vcal_n: dac
|
||||||
|
vcal_p: dac
|
||||||
|
vcassh: dac
|
||||||
|
vcas: dac
|
||||||
|
vicin: dac
|
||||||
|
vipre_out: dac
|
||||||
|
vref_h_adc: dac
|
||||||
|
vb_comp_fe: dac
|
||||||
|
vb_comp_adc: dac
|
||||||
|
vcom_cds: dac
|
||||||
|
vref_rstore: dac
|
||||||
|
vb_opa_1st: dac
|
||||||
|
vref_comp_fe: dac
|
||||||
|
vcom_adc1: dac
|
||||||
|
vref_prech: dac
|
||||||
|
vref_l_adc: dac
|
||||||
|
vref_cds: dac
|
||||||
|
vb_cs: dac
|
||||||
|
vb_opa_fd: dac
|
||||||
|
vcom_adc2: dac
|
||||||
|
vb_ds: dac
|
||||||
|
vb_comp: dac
|
||||||
|
vb_pixbuf: dac
|
||||||
|
vin_com: dac
|
||||||
|
vdd_prot: dac
|
||||||
|
vbp_colbuf: dac
|
||||||
|
vb_sda: dac
|
||||||
|
vcasc_sfp: dac
|
||||||
|
vipre_cds: dac
|
||||||
|
ibias_sfp: dac
|
||||||
|
|
||||||
|
defaultdacs: resetdacs
|
||||||
|
|
||||||
|
#acquisition
|
||||||
|
busy: clearbusy
|
||||||
|
receiver: rx_status
|
||||||
|
framescaught: rx_framescaught
|
||||||
|
startingfnum: nextframenumber
|
||||||
|
|
||||||
|
#Network Configuration (Detector<->Receiver)
|
||||||
|
detectorip: udp_srcip
|
||||||
|
detectorip2: udp_srcip2
|
||||||
|
detectormac: udp_srcmac
|
||||||
|
detectormac2: udp_srcmac2
|
||||||
|
rx_udpip: udp_dstip
|
||||||
|
rx_udpip2: udp_dstip2
|
||||||
|
rx_udpmac: udp_dstmac
|
||||||
|
rx_udpmac2: udp_dstmac2
|
||||||
|
rx_udpport: udp_dstport
|
||||||
|
rx_udpport2: udp_dstport2
|
||||||
|
flowcontrol_10g: flowcontrol10g
|
||||||
|
txndelay_frame: txdelay_frame
|
||||||
|
txndelay_left: txdelay_left
|
||||||
|
txndelay_right: txdelay_right
|
||||||
|
|
||||||
|
#Receiver Config
|
||||||
|
r_silent: rx_silent
|
||||||
|
r_discardpolicy: rx_discardpolicy
|
||||||
|
r_padding: rx_padding
|
||||||
|
r_lock: rx_lock
|
||||||
|
r_lastclient: rx_lastclient
|
||||||
|
|
||||||
|
#File
|
||||||
|
fileformat: fformat
|
||||||
|
outdir: fpath
|
||||||
|
index: findex
|
||||||
|
enablefwrite: fwrite
|
||||||
|
masterfile: fmaster
|
||||||
|
overwrite: foverwrite
|
||||||
|
r_framesperfile: rx_framesperfile
|
||||||
|
|
||||||
|
#ZMQ Streaming Parameters (Receiver<->Client)
|
||||||
|
r_readfreq: rx_zmqfreq
|
||||||
|
rx_readfreq: rx_zmqfreq
|
||||||
|
rx_datastream: rx_zmqstream
|
||||||
|
|
||||||
|
#Eiger Specific
|
||||||
|
resmat: partialreset
|
||||||
|
|
||||||
|
#Jungfrau Specific
|
||||||
|
storagecells: extrastoragecells
|
||||||
|
auto_comp_disable: autocompdisable
|
||||||
|
comp_disable_time: compdisabletime
|
||||||
|
|
||||||
|
#Gotthard Specific
|
||||||
|
#Gotthard2 Specific
|
||||||
|
#Mythen3 Specific
|
||||||
|
#CTB Specific
|
||||||
|
adc: slowadc
|
||||||
|
flags: romode
|
||||||
|
i_a: im_a
|
||||||
|
i_b: im_b
|
||||||
|
i_c: im_c
|
||||||
|
i_d: im_d
|
||||||
|
i_io: im_io
|
||||||
|
|
||||||
|
#Pattern
|
||||||
|
#Moench
|
||||||
|
|
||||||
|
#Advanced
|
||||||
|
copydetectorserver: updatedetectorserver
|
||||||
|
|
||||||
|
#Insignificant
|
||||||
|
nframes: framecounter
|
||||||
|
now: runtime
|
||||||
|
timestamp: frametime
|
||||||
|
frameindex: rx_frameindex
|
13726
slsDetectorSoftware/generator/extended_commands.yaml
Normal file
13726
slsDetectorSoftware/generator/extended_commands.yaml
Normal file
File diff suppressed because it is too large
Load Diff
276
slsDetectorSoftware/generator/gen_commands.py
Normal file
276
slsDetectorSoftware/generator/gen_commands.py
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from autocomplete.autocomplete import type_info
|
||||||
|
from cpp_codegen.codegen import codegen, if_block, for_block, function, else_block
|
||||||
|
from infer_action.check_infer import check_infer
|
||||||
|
from autocomplete.autocomplete import type_values
|
||||||
|
|
||||||
|
GEN_PATH = Path(__file__).parent
|
||||||
|
|
||||||
|
COMMANDS_PATH = GEN_PATH / 'extended_commands.yaml'
|
||||||
|
DEPRECATED_COMMANDS_PATH = GEN_PATH / 'deprecated_commands.yaml'
|
||||||
|
CPP_INPUT_PATH = GEN_PATH / 'Caller.in.cpp'
|
||||||
|
HEADER_INPUT_PATH = GEN_PATH / 'Caller.in.h'
|
||||||
|
CPP_OUTPUT_PATH = GEN_PATH.parent / 'src' / 'Caller.cpp'
|
||||||
|
HEADER_OUTPUT_PATH = GEN_PATH.parent / 'src' / 'Caller.h'
|
||||||
|
|
||||||
|
INFER_HEADER_INPUT_PATH = GEN_PATH / 'inferAction.in.h'
|
||||||
|
INFER_CPP_INPUT_PATH = GEN_PATH / 'inferAction.in.cpp'
|
||||||
|
INFER_HEADER_OUTPUT_PATH = GEN_PATH.parent / 'src' / 'inferAction.h'
|
||||||
|
INFER_CPP_OUTPUT_PATH = GEN_PATH.parent / 'src' / 'inferAction.cpp'
|
||||||
|
|
||||||
|
|
||||||
|
def generate(
|
||||||
|
commands_path=COMMANDS_PATH,
|
||||||
|
cpp_input_path=CPP_INPUT_PATH,
|
||||||
|
header_input_path=HEADER_INPUT_PATH,
|
||||||
|
cpp_output_path=CPP_OUTPUT_PATH,
|
||||||
|
header_output_path=HEADER_OUTPUT_PATH,
|
||||||
|
infer_header_input_path=INFER_HEADER_INPUT_PATH,
|
||||||
|
infer_cpp_input_path=INFER_CPP_INPUT_PATH,
|
||||||
|
infer_header_output_path=INFER_HEADER_OUTPUT_PATH,
|
||||||
|
infer_cpp_output_path=INFER_CPP_OUTPUT_PATH,
|
||||||
|
|
||||||
|
):
|
||||||
|
commands_config = yaml.unsafe_load(commands_path.open('r'))
|
||||||
|
deprecated_commands_config = yaml.unsafe_load(DEPRECATED_COMMANDS_PATH.open('r'))
|
||||||
|
type_dist, non_dist = check_infer(commands=commands_config)
|
||||||
|
|
||||||
|
codegen.open(cpp_output_path)
|
||||||
|
# write call function
|
||||||
|
codegen.write_opening(cpp_input_path)
|
||||||
|
|
||||||
|
# iterate over the commands and generate code for each
|
||||||
|
print(f"[X] found {len(commands_config)} commands")
|
||||||
|
print('[*] generating code for commands')
|
||||||
|
for command_name, command in commands_config.items():
|
||||||
|
if 'is_description' in command and command['is_description']:
|
||||||
|
continue
|
||||||
|
with function('std::string', 'Caller::' + command['function_alias'], [('int', 'action')]) as fn:
|
||||||
|
codegen.write_line('std::ostringstream os;')
|
||||||
|
|
||||||
|
# print help
|
||||||
|
codegen.write_line('// print help')
|
||||||
|
with if_block('action == slsDetectorDefs::HELP_ACTION'):
|
||||||
|
if command["help"].startswith('code:'):
|
||||||
|
codegen.write_line(command["help"].strip('code:'))
|
||||||
|
else:
|
||||||
|
codegen.write_line(f'os << "Command: {command_name}" << std::endl;')
|
||||||
|
codegen.write_line(f'os << R"V0G0N({command["help"]} )V0G0N" << std::endl;')
|
||||||
|
codegen.write_line('return os.str();')
|
||||||
|
|
||||||
|
# check if action and arguments are valid
|
||||||
|
|
||||||
|
codegen.write_line('// check if action and arguments are valid')
|
||||||
|
first = True
|
||||||
|
for action, action_params in command['actions'].items():
|
||||||
|
|
||||||
|
with if_block(f'action == {codegen.actions_dict[action]}', elseif=not first):
|
||||||
|
|
||||||
|
check_argc = True
|
||||||
|
for arg in action_params['args']:
|
||||||
|
if arg['argc'] == -1:
|
||||||
|
check_argc = False
|
||||||
|
break
|
||||||
|
# check number of arguments
|
||||||
|
condition = "1" if check_argc else "0"
|
||||||
|
|
||||||
|
if check_argc:
|
||||||
|
for arg in action_params['args']:
|
||||||
|
condition += f' && args.size() != {arg["argc"]}'
|
||||||
|
|
||||||
|
with if_block(condition):
|
||||||
|
codegen.write_line(f'throw RuntimeError("Wrong number of arguments for action {action}");')
|
||||||
|
|
||||||
|
for arg in action_params['args']:
|
||||||
|
if not check_argc:
|
||||||
|
continue
|
||||||
|
with if_block(f'args.size() == {arg["argc"]}'):
|
||||||
|
# check argument types
|
||||||
|
if 'extra_variables' in arg:
|
||||||
|
for var in arg['extra_variables']:
|
||||||
|
codegen.write_line(f'{var["type"]} {var["name"]} = {var["value"]};')
|
||||||
|
|
||||||
|
if 'separate_time_units' in arg and arg['separate_time_units']:
|
||||||
|
codegen.write_line(f'try {{')
|
||||||
|
# TODO: refactor this repeating code
|
||||||
|
codegen.write_line(f'std::string tmp_time({arg["separate_time_units"]["input"]});')
|
||||||
|
codegen.write_line(f'std::string {arg["separate_time_units"]["output"][1]}'
|
||||||
|
f' = RemoveUnit(tmp_time);')
|
||||||
|
codegen.write_line(f'auto {arg["separate_time_units"]["output"][0]} = '
|
||||||
|
f'StringTo < time::ns > (tmp_time,'
|
||||||
|
f' {arg["separate_time_units"]["output"][1]});')
|
||||||
|
codegen.write_line(
|
||||||
|
f'}} catch (...) {{ throw RuntimeError("Could not convert argument to time::ns");}}')
|
||||||
|
|
||||||
|
elif 'convert_to_time' in arg and arg['convert_to_time']:
|
||||||
|
codegen.write_line(f'try {{')
|
||||||
|
|
||||||
|
codegen.write_line(
|
||||||
|
f'StringTo < time::ns > ({", ".join(arg["convert_to_time"]["input"])});')
|
||||||
|
codegen.write_line(
|
||||||
|
f'}} catch (...) {{ throw RuntimeError("Could not convert arguments to time::ns");}}')
|
||||||
|
|
||||||
|
for i in range(len(arg['input'])):
|
||||||
|
if not arg['cast_input'][i]:
|
||||||
|
continue
|
||||||
|
codegen.write_line(f'try {{')
|
||||||
|
codegen.write_line(f'StringTo<{arg["input_types"][i]}>({arg["input"][i]});')
|
||||||
|
codegen.write_line(f'}} catch (...) {{')
|
||||||
|
codegen.write_line(
|
||||||
|
f' throw RuntimeError("Could not convert argument {i} to {arg["input_types"][i]}");')
|
||||||
|
codegen.write_line(f'}}')
|
||||||
|
first = False
|
||||||
|
with else_block():
|
||||||
|
codegen.write_line(
|
||||||
|
f'throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions are {list(command["actions"].keys())}");')
|
||||||
|
|
||||||
|
# generate code for each action
|
||||||
|
codegen.write_line('// generate code for each action')
|
||||||
|
for action, action_params in command['actions'].items():
|
||||||
|
if 'detectors' in action_params:
|
||||||
|
codegen.write_line('auto detector_type = det->getDetectorType().squash();')
|
||||||
|
|
||||||
|
with if_block(f'action == {codegen.actions_dict[action]}'):
|
||||||
|
if 'detectors' in action_params:
|
||||||
|
first = True
|
||||||
|
for detector, detector_params in action_params['detectors'].items():
|
||||||
|
with if_block(f'detector_type == defs::{detector}', elseif=not first):
|
||||||
|
codegen.write_arg(detector_params, action, command_name)
|
||||||
|
|
||||||
|
else_block().__enter__()
|
||||||
|
|
||||||
|
if not action_params:
|
||||||
|
codegen.write_line(f'throw RuntimeError("detector not supported for action: {action}");')
|
||||||
|
else:
|
||||||
|
tmp_args = []
|
||||||
|
if 'args' in action_params:
|
||||||
|
tmp_args = action_params['args']
|
||||||
|
codegen.write_arg(tmp_args, action, command_name)
|
||||||
|
|
||||||
|
if 'detectors' in action_params:
|
||||||
|
else_block().__exit__()
|
||||||
|
|
||||||
|
codegen.write_line('return os.str();')
|
||||||
|
|
||||||
|
# close sls namespace
|
||||||
|
codegen.write_closing()
|
||||||
|
codegen.close()
|
||||||
|
print('[X] .cpp code generated')
|
||||||
|
deprecated_commands = []
|
||||||
|
codegen.write_header(header_input_path, header_output_path, commands_config, deprecated_commands_config)
|
||||||
|
print('[X] header code generated')
|
||||||
|
|
||||||
|
|
||||||
|
codegen.write_infer_header(infer_header_input_path, infer_header_output_path, commands_config) #TODO: add deprecated commands
|
||||||
|
print('[X] infer header code generated')
|
||||||
|
codegen.open(infer_cpp_output_path)
|
||||||
|
|
||||||
|
codegen.write_infer_cpp(infer_cpp_input_path, infer_cpp_output_path, commands_config, non_dist, type_dist)
|
||||||
|
codegen.close()
|
||||||
|
print('[X] infer cpp code generated')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description='generate c++ code for cli commands from the commands.yaml file',
|
||||||
|
)
|
||||||
|
parser.add_argument('-f', '--format', action='store_true', default=False, dest='format',
|
||||||
|
help='format header and cpp file using clang-format')
|
||||||
|
parser.add_argument('-p', '--parse', action='store_true', default=False, dest='parse',
|
||||||
|
help='parse the commands.yaml file into extended_commands.yaml')
|
||||||
|
parser.add_argument('-c', '--check', action='store_true', default=False, dest='check',
|
||||||
|
help='check missing commands')
|
||||||
|
parser.add_argument('-g', '--generate', action='store_true', default=False, dest='generate', help='generate code (C++ or bash if -a is used)')
|
||||||
|
parser.add_argument('-a', '--autocomplete', action='store_true', default=False, dest='autocomplete',
|
||||||
|
help='print bash autocomplete values')
|
||||||
|
cli_args = parser.parse_args()
|
||||||
|
|
||||||
|
if cli_args.autocomplete:
|
||||||
|
from autocomplete.autocomplete import generate_type_values, generate_bash_autocomplete
|
||||||
|
if cli_args.generate:
|
||||||
|
generate_bash_autocomplete()
|
||||||
|
print('[X] bash autocomplete generated')
|
||||||
|
generate_bash_autocomplete(
|
||||||
|
output_path=Path(__file__).parent / 'autocomplete' / 'zsh_autocomplete.sh',
|
||||||
|
input_path=Path(__file__).parent / 'autocomplete' / 'zsh_autocomplete.in.sh'
|
||||||
|
)
|
||||||
|
print('[X] zsh autocomplete generated')
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
ret = generate_type_values()
|
||||||
|
print(ret)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if cli_args.check:
|
||||||
|
from commands_parser.commands_parser import command_parser
|
||||||
|
|
||||||
|
commands_config = yaml.unsafe_load(COMMANDS_PATH.open('r'))
|
||||||
|
|
||||||
|
# infer action based on number of arguments and types
|
||||||
|
type_dist, non_dist = check_infer(commands=commands_config)
|
||||||
|
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
# generate list of commands found in sls_detector_get
|
||||||
|
glist_path = GEN_PATH / 'glist'
|
||||||
|
ret = subprocess.run([f"sls_detector_get list | tail -n +2 | sort > {glist_path.absolute()}"], shell=True,
|
||||||
|
capture_output=True, check=True)
|
||||||
|
if ret.stderr != b'':
|
||||||
|
print('[!] glist generation failed and glist not found')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if not COMMANDS_PATH.exists():
|
||||||
|
print('[!] extended_commands.yaml not found')
|
||||||
|
exit(1)
|
||||||
|
detglist = set(command['command_name'] for __, command in commands_config.items())
|
||||||
|
detglist.add('free')
|
||||||
|
detglist.add('list')
|
||||||
|
|
||||||
|
g_path = GEN_PATH / 'glist'
|
||||||
|
if not g_path.exists():
|
||||||
|
print('[!] glist not found')
|
||||||
|
exit(1)
|
||||||
|
glist = set(g_path.read_text().split('\n'))
|
||||||
|
if "" in glist:
|
||||||
|
glist.remove("")
|
||||||
|
if "" in detglist:
|
||||||
|
detglist.remove("")
|
||||||
|
|
||||||
|
not_found = set()
|
||||||
|
for command in glist:
|
||||||
|
if command not in detglist:
|
||||||
|
not_found.add(command)
|
||||||
|
print()
|
||||||
|
if len(not_found) > 0:
|
||||||
|
print(f'[!] found {len(not_found)} missing')
|
||||||
|
print(f"not_found: {not_found}")
|
||||||
|
else:
|
||||||
|
print(f'[X] found no missing commands')
|
||||||
|
|
||||||
|
for command in detglist:
|
||||||
|
if command not in glist:
|
||||||
|
print(f'[!] command {command} found in commands.yaml but not found in g list')
|
||||||
|
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
if cli_args.parse:
|
||||||
|
from commands_parser.commands_parser import command_parser
|
||||||
|
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
|
||||||
|
if cli_args.generate:
|
||||||
|
generate()
|
||||||
|
|
||||||
|
if cli_args.format:
|
||||||
|
files = [CPP_OUTPUT_PATH, HEADER_OUTPUT_PATH, INFER_HEADER_OUTPUT_PATH, INFER_CPP_OUTPUT_PATH]
|
||||||
|
for file in files:
|
||||||
|
os.system(f'clang-format -i {file.absolute()}')
|
||||||
|
#os.system(f'clang-format -i --style="{{Standard: C++11}}" {file.absolute()}')
|
||||||
|
print('[X] code formatted')
|
19
slsDetectorSoftware/generator/inferAction.in.cpp
Normal file
19
slsDetectorSoftware/generator/inferAction.in.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include "inferAction.h"
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
int InferAction::infer(sls::CmdParser &parser, std::ostream &os) {
|
||||||
|
args = parser.arguments();
|
||||||
|
cmd = parser.command();
|
||||||
|
auto it = functions.find(parser.command());
|
||||||
|
if (it != functions.end()) {
|
||||||
|
return ((*this).*(it->second))();
|
||||||
|
} else {
|
||||||
|
throw RuntimeError("det not implemented for command: " +
|
||||||
|
parser.command());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1) - DO NOT REMOVE
|
||||||
|
|
||||||
|
} // namespace sls
|
30
slsDetectorSoftware/generator/inferAction.in.h
Normal file
30
slsDetectorSoftware/generator/inferAction.in.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include "CmdParser.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
class InferAction {
|
||||||
|
public:
|
||||||
|
InferAction() {}
|
||||||
|
int infer(sls::CmdParser &parser, std::ostream &os = std::cout);
|
||||||
|
std::vector<std::string> args;
|
||||||
|
std::string cmd;
|
||||||
|
|
||||||
|
// generated functions
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (1) - DO NOT REMOVE
|
||||||
|
// int frames();
|
||||||
|
|
||||||
|
private:
|
||||||
|
using FunctionMap = std::map<std::string, int (InferAction::*)()>;
|
||||||
|
FunctionMap functions{
|
||||||
|
// generated functions
|
||||||
|
|
||||||
|
// THIS COMMENT TO BE REPLACED BY THE ACTUAL CODE (2) - DO NOT REMOVE
|
||||||
|
|
||||||
|
// {"frames",&InferAction::frames}
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
64
slsDetectorSoftware/generator/infer_action/check_infer.py
Normal file
64
slsDetectorSoftware/generator/infer_action/check_infer.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
def check_infer(EXTENDED_COMMANDS_PATH=Path(__file__).parent.parent / "extended_commands.yaml", commands=None):
|
||||||
|
if commands is None:
|
||||||
|
# load yaml file
|
||||||
|
with EXTENDED_COMMANDS_PATH.open('r') as f:
|
||||||
|
commands = yaml.safe_load(f)
|
||||||
|
|
||||||
|
type_distinguishable = {}
|
||||||
|
non_distinguishable = {}
|
||||||
|
|
||||||
|
for command_name, command in commands.items():
|
||||||
|
# todo: remove this (added for debug)
|
||||||
|
# if command_name != 'badchannels':
|
||||||
|
# continue
|
||||||
|
if len(command["actions"]) == 1:
|
||||||
|
action = list(command["actions"].items())[0][1]
|
||||||
|
for arg in action['args']:
|
||||||
|
if arg['argc'] == -1:
|
||||||
|
non_distinguishable[(command_name, arg['argc'])] = ([], arg['arg_types'])
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
get_argcs = {}
|
||||||
|
get_args = command['actions']['GET']['args']
|
||||||
|
for arg in get_args:
|
||||||
|
if arg['argc'] != -1:
|
||||||
|
get_argcs[arg["argc"]] = arg['arg_types']
|
||||||
|
else:
|
||||||
|
non_distinguishable[(command_name, arg['argc'])] = ([], arg['arg_types'])
|
||||||
|
put_args = command['actions']['PUT']['args']
|
||||||
|
for arg in put_args:
|
||||||
|
if arg['argc'] == -1:
|
||||||
|
non_distinguishable[(command_name, arg['argc'])] = ([], arg['arg_types'])
|
||||||
|
elif arg['argc'] in get_argcs:
|
||||||
|
if arg['arg_types'] != get_argcs[arg['argc']]:
|
||||||
|
type_distinguishable[(command_name, arg['argc'])] = (get_argcs[arg['argc']], arg['arg_types'])
|
||||||
|
else:
|
||||||
|
non_distinguishable[(command_name, arg['argc'])] = (get_argcs[arg['argc']], arg['arg_types'])
|
||||||
|
|
||||||
|
return type_distinguishable, non_distinguishable
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
argparse = argparse.ArgumentParser()
|
||||||
|
argparse.add_argument("--print", choices=['all', 'type', 'impossible'], default="all", help="command name")
|
||||||
|
args = argparse.parse_args()
|
||||||
|
|
||||||
|
type_distinguishable, non_distinguishable = check_infer()
|
||||||
|
if args.print == 'type' or args.print == 'all':
|
||||||
|
print("type distinguishable:")
|
||||||
|
print("command_name: argc get_arg_type put_arg_type\n")
|
||||||
|
for (command_name, argc), (get_arg_types, put_arg_types) in type_distinguishable.items():
|
||||||
|
print(f"{command_name}: {argc} {get_arg_types} {put_arg_types}")
|
||||||
|
|
||||||
|
if args.print == 'impossible' or args.print == 'all':
|
||||||
|
print("\n\nimpossible to distinguish:")
|
||||||
|
print("command_name: argc get_arg_type put_arg_type")
|
||||||
|
for (command_name, argc), (get_arg_types, put_arg_types) in non_distinguishable.items():
|
||||||
|
print(f"{command_name}: {argc} {get_arg_types} {put_arg_types}")
|
288
slsDetectorSoftware/generator/readme.md
Normal file
288
slsDetectorSoftware/generator/readme.md
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
# Generator
|
||||||
|
used to generate C++ cli commands. and bash autocompletion scripts.
|
||||||
|
## Autocomplete
|
||||||
|
|
||||||
|
### Overview
|
||||||
|
|
||||||
|
Looks through the `dump.json` file for the different values of an enum and stores them in the dictionary `type_values`.
|
||||||
|
```sh
|
||||||
|
# To print the different values for enums
|
||||||
|
python gen_commands.py -a
|
||||||
|
```
|
||||||
|
|
||||||
|
also the autocomplete.py generates shell autocompletion scripts for both bash and zsh. It uses the template file `bash_autocomplete.in.sh` and adds the necessary code in an output file `bash_autocomplete.sh` (same for zsh).
|
||||||
|
To use the bash autocompletion the `bash_autocomplete.sh` must be sourced.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source bash_autocomplete.sh
|
||||||
|
# g <Tab><Tab> will give the list of all commands
|
||||||
|
# p 0:<Tab><Tab> will also give the list of all commands
|
||||||
|
# g exp<Tab> will autocomplete to g exptime
|
||||||
|
# g exptime <Tab><Tab> will return "s ms us ns"
|
||||||
|
# p timing <Tab><Tab> will return "auto,burst_trigger,gating..."
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:**
|
||||||
|
The dump.json is the AST of the file `slsDetectorPackage/slsSupportLib/src/ToString.cpp`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# to generate the dump.json file
|
||||||
|
cd slsSupportLib/src/ToString.cpp
|
||||||
|
clang++ -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang StringTo -c ToString.cpp -I ../include/ -std=gnu++11
|
||||||
|
# clang version used: 14.0.0-1ubuntu1.1
|
||||||
|
```
|
||||||
|
|
||||||
|
the `dump.json` file produced by clang is not a correct json file because we used the `-ast-dump-filter`. autocomplete.py can be used to fix the format of `dump.json` and produce a new file called `fixed.json` that is json format.
|
||||||
|
```
|
||||||
|
# to convert dump.json into correct json format.
|
||||||
|
python autocomplete.py -f # produces the file fixed.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### Code components
|
||||||
|
|
||||||
|
- `type_values` is a dictionary that contains the different values for commands args. It is populated with enum values that stard with defs:: or slsDetectorDefs:: (eg. defs::burstMode). Also it contains values added manually such as "mv,mV" and those start with special::
|
||||||
|
- `generate_type_values` parses the AST file to find the part that contains if statements. and extracts the different possible values for an enum.
|
||||||
|
- `generate_bash_autocomplete` generates autocompletion scripts for bash or zsh. the difference between zsh and bash scripts can be found in the template files. (bash handles 0:<Tab><Tab> completion differently than zsh more details can be found in the comments of the template files )
|
||||||
|
- `fix_json` fixes the file 'autocomplete/dump.json' and outputs a new corrected file in 'autocomplete/fixed.json'
|
||||||
|
|
||||||
|
## Command Parser
|
||||||
|
|
||||||
|
Definitely the most important component of all the generator module.
|
||||||
|
|
||||||
|
command_parser exist to keep the commands.yaml file concise and easy to read and produce a complete version of the commands.yaml for the code generator to work on.
|
||||||
|
|
||||||
|
The goal is that the code generator works on a version of commands.yaml that is easy to iterate over and generate code.
|
||||||
|
```
|
||||||
|
# complete version
|
||||||
|
some_command:
|
||||||
|
help: "do this"
|
||||||
|
infer_action: true
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
function: "getCommand"
|
||||||
|
...
|
||||||
|
- argc: 1
|
||||||
|
function: "getCommand"
|
||||||
|
...
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
- argc: 0
|
||||||
|
function: "getCommandMythen"
|
||||||
|
...
|
||||||
|
PUT:
|
||||||
|
args:
|
||||||
|
- argc: 2
|
||||||
|
function: "setCommand"
|
||||||
|
...
|
||||||
|
- argc: 3
|
||||||
|
function: "setCommand"
|
||||||
|
...
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
the complete vesion can only have `args` or `detectors` field inside an action (GET or PUT). **Each element in the args array have a different argc**. and in each element in the args array we can find all the information needed to generate the code for that one argc case. for example in the code `if(action == 'GET')` and `if (args.size() == 1)` then we can generate the code for that one case independetly.
|
||||||
|
|
||||||
|
|
||||||
|
commands.yaml has a lot on ~inheritance~. examples show best what it is:
|
||||||
|
|
||||||
|
> fields insides an action will be passed to args and detectors
|
||||||
|
|
||||||
|
> the extended args for default actions will be used for detectors
|
||||||
|
|
||||||
|
> any field can be overriden
|
||||||
|
|
||||||
|
```
|
||||||
|
resetdacs:
|
||||||
|
help: "[(optional) hard] ..."
|
||||||
|
actions:
|
||||||
|
PUT:
|
||||||
|
function: resetToDefaultDacs
|
||||||
|
require_det_id: true
|
||||||
|
output: [ '"successful"' ]
|
||||||
|
input_types: [ bool ]
|
||||||
|
args:
|
||||||
|
- argc: 1
|
||||||
|
arg_types: [ special::hard ]
|
||||||
|
input: [ '"1"' ]
|
||||||
|
- argc: 0
|
||||||
|
input: [ '"0"' ]
|
||||||
|
|
||||||
|
# this will be converted to
|
||||||
|
|
||||||
|
resetdacs:
|
||||||
|
actions:
|
||||||
|
PUT:
|
||||||
|
args:
|
||||||
|
- arg_types:
|
||||||
|
- special::hard
|
||||||
|
argc: 1
|
||||||
|
cast_input:
|
||||||
|
- false
|
||||||
|
check_det_id: false
|
||||||
|
convert_det_id: true
|
||||||
|
function: resetToDefaultDacs
|
||||||
|
input:
|
||||||
|
- '"1"'
|
||||||
|
input_types:
|
||||||
|
- bool
|
||||||
|
output:
|
||||||
|
- '"successful"'
|
||||||
|
require_det_id: true
|
||||||
|
store_result_in_t: false
|
||||||
|
- arg_types: []
|
||||||
|
argc: 0
|
||||||
|
cast_input:
|
||||||
|
- false
|
||||||
|
check_det_id: false
|
||||||
|
convert_det_id: true
|
||||||
|
function: resetToDefaultDacs
|
||||||
|
input:
|
||||||
|
- '"0"'
|
||||||
|
input_types:
|
||||||
|
- bool
|
||||||
|
output:
|
||||||
|
- '"successful"'
|
||||||
|
require_det_id: true
|
||||||
|
store_result_in_t: false
|
||||||
|
command_name: resetdacs
|
||||||
|
function_alias: resetdacs
|
||||||
|
help: "[(optional) hard] ..."
|
||||||
|
infer_action: true
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
command_parser does not have a specific schema for the commands.yaml this is by design so it can be very extensible and future-proof. This also can have problems when there is typos (writing intput instead of input...)
|
||||||
|
|
||||||
|
command_parser first verifies the commands.yaml and checks if there's some obvious problems in it.
|
||||||
|
|
||||||
|
templates found in commands.yaml were taken from the CmdProxy code they were added for debugging purposes when writing the generator.
|
||||||
|
|
||||||
|
|
||||||
|
tricky things:
|
||||||
|
--
|
||||||
|
- if input array has n elements and cast_input array is empty. command_parser will fill it with n false values.
|
||||||
|
- store_result_in_t will be added by default as true to GET action. but as false to PUT action. (unless it is written in the action)
|
||||||
|
- infer_action by default is true
|
||||||
|
- commands that have is_description true won't be verified
|
||||||
|
- function_alias is the name of the function in the c++ code. by default it is the command name. errors came up with the command virtual as virtual is a reserved keyword in c++
|
||||||
|
- command_name is the string of the command that will be typed in cli. (frames, exptime, ...). by default it is the command name. pattern is a special keyword in yaml. problems came up with the command pattern
|
||||||
|
- arg_types is by default input_types unless otherwise specified
|
||||||
|
- when the parent has specific detector behaviour and the child does not. writing an empty detector section in the action would not inherit any detector specific fields (check exptime1)
|
||||||
|
- commands can inherit other commands (check exptime1 and exptime2)
|
||||||
|
- argc: -1 means that the command has an unknown number of arguments
|
||||||
|
|
||||||
|
|
||||||
|
### Code Walkthrough
|
||||||
|
the code is well commented it is well explained in the script
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
tests for command_parser can be found in `generator/tests/command_parser/`
|
||||||
|
```
|
||||||
|
pip install -r requirements.txt
|
||||||
|
python -m pytests
|
||||||
|
```
|
||||||
|
|
||||||
|
verification is not well tested
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## codegen
|
||||||
|
|
||||||
|
Now for C++ code generation. After parsing the commands.yaml file and producing the extended_commands.yaml `gen_commands.py` will iterate over the commands and generate `Caller.h`, `Caller.cpp`, `inferAction.cpp` and `inferAction.h` .
|
||||||
|
|
||||||
|
### infer action
|
||||||
|
|
||||||
|
the generated code will produce 5 new targets: "detg detp deta deth det"
|
||||||
|
|
||||||
|
`detg` will set the action as GET
|
||||||
|
`detp` will the action as PUT
|
||||||
|
|
||||||
|
`det` will guess the action depending on the number of arguments
|
||||||
|
|
||||||
|
the codegen module will generate a function for every command that will return the action based on the number of arguments
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
int InferAction::activate() {
|
||||||
|
|
||||||
|
if (args.size() == 0) {
|
||||||
|
return slsDetectorDefs::GET_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 1) {
|
||||||
|
return slsDetectorDefs::PUT_ACTION;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
throw RuntimeError("Could not infer action: Wrong number of arguments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
the `inferAction` class will be called from `CmdApp.cpp` to infer the action and the command function will be called with the appropriate action.
|
||||||
|
|
||||||
|
some commands have the same number of argument count for both get and put. These commands can be found using the the `check_infer.py` script. in the generated code it will say that "det is disabled"
|
||||||
|
```bash
|
||||||
|
# to see these commands
|
||||||
|
python infer_action/check_infer.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### Caller.cpp code
|
||||||
|
|
||||||
|
in this level we only use the extended_commands.yaml file.
|
||||||
|
the `generate()` function in `gen_commands.py` will iterate over all of the commands and :
|
||||||
|
- write the function signature
|
||||||
|
- write the help
|
||||||
|
- write c++ code to check the inputs: check argument count and check if we are able to convert the arguments into the required types
|
||||||
|
- iterate over actions and arguments
|
||||||
|
- iterate over the detectors and write code for each one of them (if mythen3 ... if eiger ... else default code... ) and call `codegen.write_arg()` to write the argument for a single argument
|
||||||
|
|
||||||
|
codegen.write_arg()
|
||||||
|
-
|
||||||
|
write_arg in codegen reads the argument fields and generate c++ code accordingly.
|
||||||
|
|
||||||
|
## fields explanations
|
||||||
|
- arg_types:[array of types] it is only used for autocompletion no C++ code is dependent on it
|
||||||
|
- is_description:[boolean] same as above
|
||||||
|
- template:[boolean] only used in commands.yaml and it won't present in extended_commands.yaml. it is inspired by the CmdProxy.h code
|
||||||
|
- help:[string] command help
|
||||||
|
- input:[array of variable names] the input arguments that will be passed to the function
|
||||||
|
- input_types:[array of types] the types of the input arguments given to the function
|
||||||
|
- cast_input:[array of boolean] if true it will cast the corresponding input to the type in input_types
|
||||||
|
- output:[array] outputs that will be printed (eg. ["123", "'a'"] will be os<<123<<'a')
|
||||||
|
- function: the function that will be called
|
||||||
|
- function_alias: the name of the function in the c++ code (more on it in tricky things)
|
||||||
|
- command_name: the string of the command that will be typed in cli. (more on it in tricky things)
|
||||||
|
- require_det_id: if true it will require a detector id to be passed as the last argument
|
||||||
|
- check_det_id: if true it will check the detector id and throw an error if it is not valid
|
||||||
|
- convert_det_id: if true it will convert the detector id to the correct type `std::vector<int>{ det_id }`
|
||||||
|
- store_result_in_t: if true it will store the result of the function in the variable t (more on it in tricky things)
|
||||||
|
- infer_action: if true it will infer the action (only if det is used)
|
||||||
|
- detectors: the detectors that have specific behaviour
|
||||||
|
- args: the arguments of the command
|
||||||
|
- argc: the number of arguments
|
||||||
|
- extra_variables[array]: each element takes three parameters: value, name, type and creates that variable in the beginning of the argument code
|
||||||
|
- exceptions[array]: each element takes two parameters: condition, message
|
||||||
|
- pattern_command: takes three arguments: nGetArgs, nPutArgs and command_name and it will write this code
|
||||||
|
```cpp
|
||||||
|
int level = -1, iArg = 0, nGetArgs = $nGetArgs$, nPutArgs = $nPutArgs$;
|
||||||
|
GetLevelAndUpdateArgIndex(action, $command_name$, level, iArg, nGetArgs,nPutArgs);
|
||||||
|
```
|
||||||
|
- separate_time_units: takes three parameters: input, output[0], output[1] each one is a variable name
|
||||||
|
```cpp
|
||||||
|
std::string tmp_time($input$);
|
||||||
|
std::string $output[1]$ = RemoveUnit(tmp_time);
|
||||||
|
auto $output[0]$ = StringTo<time::ns>(tmp_time, $output[1]$);
|
||||||
|
```
|
||||||
|
- convert_to_time: takes three parameters: input[0], input[1], output
|
||||||
|
```cpp
|
||||||
|
auto output = StringTo<time::ns>(input[0], input[1]);
|
||||||
|
```
|
||||||
|
- ctb_output_list: **maybe it should be removed?** takes 5 parameters: GETFCNLIST, GETFCNNAME, GETFCN, suffix, printable_name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
slsDetectorSoftware/generator/requirements.txt
Normal file
6
slsDetectorSoftware/generator/requirements.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
coverage==7.3.1
|
||||||
|
iniconfig==2.0.0
|
||||||
|
packaging==23.1
|
||||||
|
pluggy==1.3.0
|
||||||
|
pytest==7.4.2
|
||||||
|
PyYAML==6.0.1
|
@ -0,0 +1,16 @@
|
|||||||
|
basic:
|
||||||
|
infer_action: false
|
||||||
|
help: "xx11"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'func1'
|
||||||
|
output: [ OutString(t) ]
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
PUT:
|
||||||
|
function: 'func2'
|
||||||
|
output: [ 'args.front()' ]
|
||||||
|
input: [ 'args[0]' ]
|
||||||
|
input_types: [ int ]
|
||||||
|
cast_input: [ true ]
|
||||||
|
argc: 1
|
@ -0,0 +1,66 @@
|
|||||||
|
---
|
||||||
|
template:
|
||||||
|
infer_action: false
|
||||||
|
help: ""
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'func1'
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
output: [ OutString(t) ]
|
||||||
|
PUT:
|
||||||
|
function: 'func2'
|
||||||
|
output: [ 'args.front()' ]
|
||||||
|
input: [ 'args[0]' ]
|
||||||
|
input_types: [ int ]
|
||||||
|
cast_input: [ true ]
|
||||||
|
argc: 1
|
||||||
|
|
||||||
|
basic:
|
||||||
|
help: "xx11"
|
||||||
|
inherit_actions: template
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'x'
|
||||||
|
argc: 2
|
||||||
|
args:
|
||||||
|
- check_det_id: true
|
||||||
|
|
||||||
|
|
||||||
|
template2:
|
||||||
|
infer_action: false
|
||||||
|
template: true
|
||||||
|
help: ""
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
convert_to_time:
|
||||||
|
input: [ 'args[0]', 'args[1]' ]
|
||||||
|
output: converted_time
|
||||||
|
separate_time_units:
|
||||||
|
input: 'args[0]'
|
||||||
|
output: [ converted_time, unit ]
|
||||||
|
function: 'func1'
|
||||||
|
output: [ OutString(t) ]
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
- argc: 99
|
||||||
|
PUT:
|
||||||
|
function: funcTemplatePUT
|
||||||
|
args:
|
||||||
|
- argc: 19
|
||||||
|
function: 'func19'
|
||||||
|
- argc: 91
|
||||||
|
|
||||||
|
basic2:
|
||||||
|
inherit_actions: template2
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'x'
|
||||||
|
argc: 2
|
||||||
|
args:
|
||||||
|
- check_det_id: true
|
||||||
|
input: [ 'args[0]', a,b,c ]
|
||||||
|
input_types: [ int, int, int, int ]
|
||||||
|
PUT:
|
||||||
|
function: 'y'
|
||||||
|
|
@ -0,0 +1,208 @@
|
|||||||
|
basic:
|
||||||
|
infer_action: false
|
||||||
|
help: "xx11"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'func1'
|
||||||
|
output: [ OutString(t) ]
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
- argc : 1
|
||||||
|
output: [ testytest ]
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen3'
|
||||||
|
CHIPTESTBOARD:
|
||||||
|
args:
|
||||||
|
- argc: 55
|
||||||
|
output: [ ctbOutput ]
|
||||||
|
PUT:
|
||||||
|
detectors:
|
||||||
|
EIGER:
|
||||||
|
function: 'do_eiger'
|
||||||
|
argc: 99
|
||||||
|
output: [ eigerOutput ]
|
||||||
|
|
||||||
|
|
||||||
|
# classes of tests:
|
||||||
|
# classes of template tests: has args or has detectors => 4 cases noted (0,0) ... (1,1)
|
||||||
|
# classes of childs: has args or has detectors => 4 cases noted (0,0) ... (1,1)
|
||||||
|
# => 16 cases
|
||||||
|
# example: case_0111: template (0,1) and child (1,1)
|
||||||
|
#################### exhaustive testing over chosen classes of tests
|
||||||
|
|
||||||
|
template_01:
|
||||||
|
infer_action: true
|
||||||
|
help: "vv12"
|
||||||
|
template: true
|
||||||
|
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen3'
|
||||||
|
argc: 99
|
||||||
|
CHIPTESTBOARD:
|
||||||
|
function: 'do_ctb'
|
||||||
|
argc: 98
|
||||||
|
|
||||||
|
case_0100:
|
||||||
|
inherit_actions: template_01
|
||||||
|
help: "0100"
|
||||||
|
|
||||||
|
case_0101:
|
||||||
|
inherit_actions: template_01
|
||||||
|
help: "0101"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
function: 'get_function'
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen23'
|
||||||
|
argc: 420
|
||||||
|
|
||||||
|
case_0110:
|
||||||
|
inherit_actions: template_01
|
||||||
|
help: "0110"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
argc: 111
|
||||||
|
function: 'get_function'
|
||||||
|
|
||||||
|
case_0110v2:
|
||||||
|
inherit_actions: template_01
|
||||||
|
help: "0110v2"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 111
|
||||||
|
function: 'get_function'
|
||||||
|
|
||||||
|
|
||||||
|
case_0111:
|
||||||
|
inherit_actions: template_01
|
||||||
|
help: "0111"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 111
|
||||||
|
function: 'get_function'
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen23'
|
||||||
|
argc: 420
|
||||||
|
|
||||||
|
##### cases 10** tests
|
||||||
|
template_10:
|
||||||
|
template: true
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
- argc : 1
|
||||||
|
output: [ testytest ]
|
||||||
|
|
||||||
|
case_1000:
|
||||||
|
inherit_actions: template_10
|
||||||
|
help: "1000"
|
||||||
|
|
||||||
|
case_1001:
|
||||||
|
inherit_actions: template_10
|
||||||
|
help: "1001"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
args:
|
||||||
|
- function: 'do_mythen23'
|
||||||
|
argc: 420
|
||||||
|
- function: 'do_mythen3'
|
||||||
|
argc: 99
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case_1010:
|
||||||
|
inherit_actions: template_10
|
||||||
|
help: "1010"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 111
|
||||||
|
function: 'get_function'
|
||||||
|
|
||||||
|
case_1011:
|
||||||
|
inherit_actions: template_10
|
||||||
|
help: "1011"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 111
|
||||||
|
function: 'get_function'
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen23'
|
||||||
|
|
||||||
|
##### cases 11** tests
|
||||||
|
template_11:
|
||||||
|
template: true
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
args:
|
||||||
|
- argc: 0
|
||||||
|
- argc : 1
|
||||||
|
output: [ testytest ]
|
||||||
|
detectors:
|
||||||
|
EIGER:
|
||||||
|
function: 'do_eiger'
|
||||||
|
args:
|
||||||
|
- argc: 99
|
||||||
|
output: [ eigerOutput ]
|
||||||
|
POTATO:
|
||||||
|
function: 'do_potato'
|
||||||
|
|
||||||
|
|
||||||
|
case_1100:
|
||||||
|
inherit_actions: template_11
|
||||||
|
help: "1100"
|
||||||
|
|
||||||
|
case_1101:
|
||||||
|
inherit_actions: template_11
|
||||||
|
help: "1101"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen3'
|
||||||
|
POTATO:
|
||||||
|
function: 'do_potato'
|
||||||
|
args:
|
||||||
|
- argc: 101
|
||||||
|
function: 'potato_function'
|
||||||
|
- argc: 202
|
||||||
|
|
||||||
|
case_1110:
|
||||||
|
inherit_actions: template_11
|
||||||
|
help: "1110"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
argc: 77
|
||||||
|
function: 'get_function'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case_1111:
|
||||||
|
inherit_actions: template_11
|
||||||
|
help: "1111"
|
||||||
|
actions:
|
||||||
|
GET:
|
||||||
|
argc: 77
|
||||||
|
function: 'get_function'
|
||||||
|
detectors:
|
||||||
|
MYTHEN3:
|
||||||
|
function: 'do_mythen3'
|
||||||
|
POTATO:
|
||||||
|
function: 'do_potato'
|
||||||
|
args:
|
||||||
|
- argc: 101
|
||||||
|
function: 'potato_function'
|
||||||
|
- argc: 202
|
@ -0,0 +1,101 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from commands_parser.commands_parser import CommandParser
|
||||||
|
|
||||||
|
data_path = Path(__file__).parent.parent / "data"
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_propagation(tmp_path):
|
||||||
|
output_file = tmp_path / "basic.yaml"
|
||||||
|
command_parser = CommandParser(commands_file=data_path / "basic.yaml", output_file=output_file)
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
|
||||||
|
assert output_file.exists()
|
||||||
|
command = yaml.unsafe_load(output_file.open('r'))['basic']
|
||||||
|
assert command['help'] == "xx11"
|
||||||
|
assert len(command['actions']) == 2
|
||||||
|
# test 'GET' action
|
||||||
|
assert 'args' in command['actions']['GET']
|
||||||
|
assert len(command['actions']['GET'].keys()) == 1 # only 'args' key
|
||||||
|
assert len(command['actions']['GET']['args']) == 1 # only one argument
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'func1'
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == ['OutString(t)']
|
||||||
|
assert command['actions']['GET']['args'][0]['input'] == []
|
||||||
|
assert command['actions']['GET']['args'][0]['cast_input'] == []
|
||||||
|
assert command['actions']['GET']['args'][0]['require_det_id'] is False
|
||||||
|
# test PUT action
|
||||||
|
assert 'args' in command['actions']['PUT']
|
||||||
|
assert len(command['actions']['PUT'].keys()) == 1 # only 'args' key
|
||||||
|
assert len(command['actions']['PUT']['args']) == 1 # only one argument
|
||||||
|
assert command['actions']['PUT']['args'][0]['argc'] == 1
|
||||||
|
assert command['actions']['PUT']['args'][0]['function'] == 'func2'
|
||||||
|
assert command['actions']['PUT']['args'][0]['cast_input'] == [True]
|
||||||
|
assert command['actions']['PUT']['args'][0]['output'] == ['args.front()']
|
||||||
|
assert command['actions']['PUT']['args'][0]['input_types'] == ['int']
|
||||||
|
assert command['actions']['PUT']['args'][0]['require_det_id'] is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_inheritance(tmp_path):
|
||||||
|
output_file = tmp_path / "basic_inheritance.yaml"
|
||||||
|
command_parser = CommandParser(commands_file=data_path / "basic_inheritance.yaml", output_file=output_file)
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
assert output_file.exists()
|
||||||
|
command = yaml.unsafe_load(output_file.open('r'))['basic']
|
||||||
|
assert command['help'] == "xx11"
|
||||||
|
assert command['actions'].keys() == {'GET', 'PUT'}
|
||||||
|
# test 'GET' action
|
||||||
|
assert 'args' in command['actions']['GET']
|
||||||
|
assert command['actions']['GET'].keys() == {'args'} # only 'args' key
|
||||||
|
assert len(command['actions']['GET']['args']) == 1 # only one argument
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 2
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'x'
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == [] # test overwriting args when they are present in child
|
||||||
|
assert command['actions']['GET']['args'][0]['input'] == []
|
||||||
|
assert command['actions']['GET']['args'][0]['cast_input'] == []
|
||||||
|
assert command['actions']['GET']['args'][0]['require_det_id'] is False
|
||||||
|
# test PUT action
|
||||||
|
assert 'args' in command['actions']['PUT']
|
||||||
|
assert command['actions']['PUT'].keys() == {'args'} # only 'args' key
|
||||||
|
assert len(command['actions']['PUT']['args']) == 1 # only one argument
|
||||||
|
assert command['actions']['PUT']['args'][0]['argc'] == 1
|
||||||
|
assert command['actions']['PUT']['args'][0]['function'] == 'func2'
|
||||||
|
assert command['actions']['PUT']['args'][0]['cast_input'] == [True]
|
||||||
|
assert command['actions']['PUT']['args'][0]['output'] == ['args.front()']
|
||||||
|
assert command['actions']['PUT']['args'][0]['input_types'] == ['int']
|
||||||
|
assert command['actions']['PUT']['args'][0]['require_det_id'] is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_inheritance2(tmp_path):
|
||||||
|
output_file = tmp_path / "basic_inheritance.yaml"
|
||||||
|
command_parser = CommandParser(commands_file=data_path / "basic_inheritance.yaml", output_file=output_file)
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
assert output_file.exists()
|
||||||
|
command = yaml.unsafe_load(output_file.open('r'))['basic2']
|
||||||
|
# check GET
|
||||||
|
assert len(command['actions']['GET']['args']) == 1
|
||||||
|
assert command['actions']['GET'].keys() == {'args'}
|
||||||
|
arg = command['actions']['GET']['args'][0]
|
||||||
|
assert arg['argc'] == 2
|
||||||
|
assert arg['output'] == ['OutString(t)']
|
||||||
|
# check that length of cast input is equal to length of input_types and input
|
||||||
|
assert len(arg['input']) == len(arg['input_types']) == len(arg['cast_input']) == 4
|
||||||
|
assert arg['function'] == 'x'
|
||||||
|
assert 'convert_to_time' in arg
|
||||||
|
assert arg['convert_to_time'].keys() == {'input', 'output'}
|
||||||
|
assert 'separate_time_units' in arg
|
||||||
|
assert arg['separate_time_units'].keys() == {'input', 'output'}
|
||||||
|
|
||||||
|
# check PUT
|
||||||
|
assert command['actions']['PUT'].keys() == {'args'}
|
||||||
|
assert len(command['actions']['PUT']['args']) == 2
|
||||||
|
assert command['actions']['PUT']['args'][0]['argc'] == 19
|
||||||
|
assert command['actions']['PUT']['args'][0]['function'] == 'y'
|
||||||
|
assert command['actions']['PUT']['args'][1]['argc'] == 91
|
||||||
|
assert command['actions']['PUT']['args'][1]['function'] == 'y'
|
||||||
|
|
@ -0,0 +1,309 @@
|
|||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest as pytest
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from commands_parser.commands_parser import CommandParser
|
||||||
|
|
||||||
|
data_path = Path(__file__).parent.parent / "data"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def detector_file_commands(tmp_path):
|
||||||
|
output_file = tmp_path / "detectors.yaml"
|
||||||
|
command_parser = CommandParser(commands_file=data_path / "detectors.yaml", output_file=output_file)
|
||||||
|
command_parser.verify_format()
|
||||||
|
|
||||||
|
def func(command):
|
||||||
|
return command_parser.parse_command(command)
|
||||||
|
|
||||||
|
return func
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_propagation(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('basic')
|
||||||
|
|
||||||
|
assert command['help'] == "xx11"
|
||||||
|
|
||||||
|
# GET
|
||||||
|
assert command['actions']['GET'].keys() == {'detectors', 'args'}
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3', 'CHIPTESTBOARD'}
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 2
|
||||||
|
assert mythen[0]['argc'] == 0
|
||||||
|
assert mythen[1]['argc'] == 1
|
||||||
|
assert mythen[0]['function'] == mythen[1]['function'] == 'do_mythen3'
|
||||||
|
assert mythen[0]['output'] == ['OutString(t)']
|
||||||
|
assert mythen[1]['output'] == ['testytest']
|
||||||
|
|
||||||
|
ctb = command['actions']['GET']['detectors']['CHIPTESTBOARD']
|
||||||
|
assert len(ctb) == 1
|
||||||
|
assert ctb[0]['argc'] == 55
|
||||||
|
assert ctb[0]['function'] == 'func1'
|
||||||
|
|
||||||
|
# PUT
|
||||||
|
assert command['actions']['PUT'].keys() == {'detectors'}
|
||||||
|
assert command['actions']['PUT']['detectors'].keys() == {'EIGER'}
|
||||||
|
eiger = command['actions']['PUT']['detectors']['EIGER']
|
||||||
|
assert len(eiger) == 1
|
||||||
|
assert eiger[0]['argc'] == 99
|
||||||
|
assert eiger[0]['function'] == 'do_eiger'
|
||||||
|
assert eiger[0]['output'] == ['eigerOutput']
|
||||||
|
|
||||||
|
# 16 test cases for inheritance
|
||||||
|
# 1st bit: parent has args
|
||||||
|
# 2nd bit: parent has detectors
|
||||||
|
# 3rd bit: child has args
|
||||||
|
# 4th bit: child has detectors
|
||||||
|
# each test case is a combination of the above bits
|
||||||
|
# all the possible combinations are tested
|
||||||
|
|
||||||
|
def test_inheritance_0100(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_0100')
|
||||||
|
assert command['help'] == "0100"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'detectors'}
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3', 'CHIPTESTBOARD'}
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert mythen[0]['argc'] == 99
|
||||||
|
assert mythen[0]['function'] == 'do_mythen3'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_0101(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_0101')
|
||||||
|
assert command['help'] == "0101"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'detectors'}
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3', 'CHIPTESTBOARD'}
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert mythen[0]['argc'] == 420
|
||||||
|
assert mythen[0]['function'] == 'do_mythen23'
|
||||||
|
ctb = command['actions']['GET']['detectors']['CHIPTESTBOARD']
|
||||||
|
assert len(ctb) == 1
|
||||||
|
assert ctb[0]['argc'] == 98
|
||||||
|
assert ctb[0]['function'] == 'do_ctb'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_0110(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_0110')
|
||||||
|
assert command['help'] == "0110"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 111
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert mythen[0]['argc'] == 99
|
||||||
|
assert mythen[0]['function'] == 'do_mythen3'
|
||||||
|
ctb = command['actions']['GET']['detectors']['CHIPTESTBOARD']
|
||||||
|
assert len(ctb) == 1
|
||||||
|
assert ctb[0]['argc'] == 98
|
||||||
|
assert ctb[0]['function'] == 'do_ctb'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_0110v2(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_0110v2')
|
||||||
|
assert command['help'] == "0110v2"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 111
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert mythen[0]['argc'] == 99
|
||||||
|
assert mythen[0]['function'] == 'do_mythen3'
|
||||||
|
ctb = command['actions']['GET']['detectors']['CHIPTESTBOARD']
|
||||||
|
assert len(ctb) == 1
|
||||||
|
assert ctb[0]['argc'] == 98
|
||||||
|
assert ctb[0]['function'] == 'do_ctb'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritacnce_0111(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_0111')
|
||||||
|
assert command['help'] == "0111"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3', 'CHIPTESTBOARD'}
|
||||||
|
mythen = command['actions']['GET']['detectors']['MYTHEN3']
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 111
|
||||||
|
assert len(mythen) == 1
|
||||||
|
assert mythen[0]['argc'] == 420
|
||||||
|
assert mythen[0]['function'] == 'do_mythen23'
|
||||||
|
ctb = command['actions']['GET']['detectors']['CHIPTESTBOARD']
|
||||||
|
assert len(ctb) == 1
|
||||||
|
assert ctb[0]['argc'] == 98
|
||||||
|
assert ctb[0]['function'] == 'do_ctb'
|
||||||
|
|
||||||
|
|
||||||
|
# cases 1000, 1001, 1010, 1011
|
||||||
|
def test_inheritance_1000(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1000')
|
||||||
|
assert command['help'] == "1000"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 2
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == []
|
||||||
|
|
||||||
|
assert command['actions']['GET']['args'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['args'][1]['output'] == ['testytest']
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1001(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1001')
|
||||||
|
assert command['help'] == "1001"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 2
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == []
|
||||||
|
assert command['actions']['GET']['args'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['args'][1]['output'] == ['testytest']
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['MYTHEN3']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['argc'] == 420
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['function'] == 'do_mythen23'
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][1]['argc'] == 99
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][1]['function'] == 'do_mythen3'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1010(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1010')
|
||||||
|
assert command['help'] == "1010"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 1
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 111
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'get_function'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1011(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1011')
|
||||||
|
assert command['help'] == "1011"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 1
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 111
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'get_function'
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'MYTHEN3'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['MYTHEN3']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['argc'] == 111
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['function'] == 'do_mythen23'
|
||||||
|
|
||||||
|
|
||||||
|
# cases 1100, 1101, 1110, 1111
|
||||||
|
|
||||||
|
def test_inheritance_1100(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1100')
|
||||||
|
assert command['help'] == "1100"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 2
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == []
|
||||||
|
|
||||||
|
assert command['actions']['GET']['args'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['args'][1]['output'] == ['testytest']
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'EIGER', 'POTATO'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['EIGER']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['argc'] == 99
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['function'] == 'do_eiger'
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['output'] == ['eigerOutput']
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['POTATO']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['function'] == 'do_potato'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1101(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1101')
|
||||||
|
assert command['help'] == "1101"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 2
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['args'][0]['output'] == []
|
||||||
|
assert command['actions']['GET']['args'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['args'][1]['output'] == ['testytest']
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'EIGER', 'MYTHEN3', 'POTATO'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['MYTHEN3']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['function'] == 'do_mythen3'
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][1]['function'] == 'do_mythen3'
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['EIGER']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['argc'] == 99
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['function'] == 'do_eiger'
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['output'] == ['eigerOutput']
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['POTATO']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['argc'] == 101
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['function'] == 'potato_function'
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['argc'] == 202
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['function'] == 'do_potato'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1110(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1110')
|
||||||
|
assert command['help'] == "1110"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 1
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 77
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'get_function'
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'EIGER', 'POTATO'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['EIGER']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['argc'] == 99
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['function'] == 'do_eiger'
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['POTATO']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['argc'] == 0
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['function'] == 'do_potato'
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['argc'] == 1
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['function'] == 'do_potato'
|
||||||
|
|
||||||
|
|
||||||
|
def test_inheritance_1111(tmp_path, detector_file_commands):
|
||||||
|
command = detector_file_commands('case_1111')
|
||||||
|
assert command['help'] == "1111"
|
||||||
|
assert 'actions' in command
|
||||||
|
assert command['actions'].keys() == {'GET'}
|
||||||
|
assert command['actions']['GET'].keys() == {'args', 'detectors'}
|
||||||
|
assert len(command['actions']['GET']['args']) == 1
|
||||||
|
assert command['actions']['GET']['args'][0]['argc'] == 77
|
||||||
|
assert command['actions']['GET']['args'][0]['function'] == 'get_function'
|
||||||
|
|
||||||
|
assert command['actions']['GET']['detectors'].keys() == {'EIGER', 'MYTHEN3', 'POTATO'}
|
||||||
|
assert len(command['actions']['GET']['detectors']['MYTHEN3']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['argc'] == 77
|
||||||
|
assert command['actions']['GET']['detectors']['MYTHEN3'][0]['function'] == 'do_mythen3'
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['EIGER']) == 1
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['argc'] == 99
|
||||||
|
assert command['actions']['GET']['detectors']['EIGER'][0]['function'] == 'do_eiger'
|
||||||
|
|
||||||
|
assert len(command['actions']['GET']['detectors']['POTATO']) == 2
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['argc'] == 101
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][0]['function'] == 'potato_function'
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['argc'] == 202
|
||||||
|
assert command['actions']['GET']['detectors']['POTATO'][1]['function'] == 'do_potato'
|
@ -0,0 +1,29 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
from commands_parser.commands_parser import CommandParser
|
||||||
|
import gen_commands
|
||||||
|
|
||||||
|
data_path = Path(__file__).parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
def test_parse_and_generate(tmp_path):
|
||||||
|
"""
|
||||||
|
tests that the parse and generate functions work without errors
|
||||||
|
:param tmp_path:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
output_file = tmp_path / "detectors.yaml"
|
||||||
|
command_parser = CommandParser(commands_file=data_path / "commands.yaml", output_file=output_file)
|
||||||
|
command_parser.verify_format()
|
||||||
|
command_parser.parse_all_commands()
|
||||||
|
assert output_file.exists()
|
||||||
|
|
||||||
|
GEN_PATH = Path(__file__).parent.parent
|
||||||
|
gen_commands.generate(
|
||||||
|
output_file,
|
||||||
|
GEN_PATH / "Caller.in.cpp",
|
||||||
|
GEN_PATH / "Caller.in.h",
|
||||||
|
tmp_path / "Caller.cpp",
|
||||||
|
tmp_path / "Caller.h",
|
||||||
|
)
|
||||||
|
assert (tmp_path / "Caller.cpp").exists()
|
||||||
|
assert (tmp_path / "Caller.h").exists()
|
28
slsDetectorSoftware/generator/very_special_functions.txt
Normal file
28
slsDetectorSoftware/generator/very_special_functions.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
hostname (find +)
|
||||||
|
acquire
|
||||||
|
versions (maybe with few tweaks)
|
||||||
|
threshold (+++++)
|
||||||
|
trimen (maybe with few tweaks)
|
||||||
|
badchannels (somewhat special)
|
||||||
|
currentsource (special)
|
||||||
|
dacvalues (can be done with the ctb_output_list)
|
||||||
|
udp_srcip (could be done if I add condition functionality for logging)
|
||||||
|
udp_srcip2 (same as above)
|
||||||
|
udp_dstip (same as above)
|
||||||
|
udp_dstip2
|
||||||
|
rx_hostname (split('+'))
|
||||||
|
rx_roi (can be done if there;s condition support?)
|
||||||
|
ratecorr (can be done if there's condition support?)
|
||||||
|
burstmode (very special)
|
||||||
|
vetostream
|
||||||
|
counters
|
||||||
|
gaincaps (has for loop and condition)
|
||||||
|
samples (ask Dhanya if it is okay to change the order of calling the ctb functions in PUT)
|
||||||
|
slowadc (has for loop)
|
||||||
|
rx_dbitlist (very special)
|
||||||
|
rx_jsonaddheader (very special)
|
||||||
|
execcommand (has for loop)
|
||||||
|
thresholdnotb
|
||||||
|
# notes
|
||||||
|
# ReceiverStatus error on put is not done
|
||||||
|
# ask about burstmode function
|
@ -71,7 +71,6 @@ class Detector {
|
|||||||
/** Gets shared memory ID */
|
/** Gets shared memory ID */
|
||||||
int getShmId() const;
|
int getShmId() const;
|
||||||
|
|
||||||
/** package git branch */
|
|
||||||
std::string getPackageVersion() const;
|
std::string getPackageVersion() const;
|
||||||
|
|
||||||
std::string getClientVersion() const;
|
std::string getClientVersion() const;
|
||||||
|
18155
slsDetectorSoftware/src/Caller.cpp
Normal file
18155
slsDetectorSoftware/src/Caller.cpp
Normal file
File diff suppressed because it is too large
Load Diff
878
slsDetectorSoftware/src/Caller.h
Normal file
878
slsDetectorSoftware/src/Caller.h
Normal file
@ -0,0 +1,878 @@
|
|||||||
|
// This file is used as input to generate the caller class
|
||||||
|
|
||||||
|
#include "CmdParser.h"
|
||||||
|
#include "HelpDacs.h"
|
||||||
|
#include "sls/Detector.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
class Caller {
|
||||||
|
public:
|
||||||
|
Caller(Detector *ptr) : det(ptr) {}
|
||||||
|
void call(const std::string &command,
|
||||||
|
const std::vector<std::string> &arguments, int detector_id,
|
||||||
|
int action, std::ostream &os = std::cout, int receiver_id = -1);
|
||||||
|
|
||||||
|
IpAddr getDstIpFromAuto();
|
||||||
|
IpAddr getSrcIpFromAuto();
|
||||||
|
UdpDestination getUdpEntry();
|
||||||
|
void GetLevelAndUpdateArgIndex(int action,
|
||||||
|
std::string levelSeparatedCommand,
|
||||||
|
int &level, int &iArg, size_t nGetArgs,
|
||||||
|
size_t nPutArgs);
|
||||||
|
void WrongNumberOfParameters(size_t expected);
|
||||||
|
|
||||||
|
template <typename V> std::string OutStringHex(const V &value) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToStringHex(value.front());
|
||||||
|
return ToStringHex(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutStringHex(const V &value, int width) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToStringHex(value.front(), width);
|
||||||
|
return ToStringHex(value, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutString(const Result<V> &value) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToString(value.front());
|
||||||
|
return ToString(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V> std::string OutString(const V &value) {
|
||||||
|
return ToString(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
std::string OutString(const V &value, const std::string &unit) {
|
||||||
|
if (value.equal())
|
||||||
|
return ToString(value.front(), unit);
|
||||||
|
return ToString(value, unit);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> getAllCommands();
|
||||||
|
std::string list(int action);
|
||||||
|
|
||||||
|
std::string acquire(int action);
|
||||||
|
std::string activate(int action);
|
||||||
|
std::string adcclk(int action);
|
||||||
|
std::string adcenable(int action);
|
||||||
|
std::string adcenable10g(int action);
|
||||||
|
std::string adcindex(int action);
|
||||||
|
std::string adcinvert(int action);
|
||||||
|
std::string adclist(int action);
|
||||||
|
std::string adcname(int action);
|
||||||
|
std::string adcphase(int action);
|
||||||
|
std::string adcpipeline(int action);
|
||||||
|
std::string adcreg(int action);
|
||||||
|
std::string adcvpp(int action);
|
||||||
|
std::string apulse(int action);
|
||||||
|
std::string asamples(int action);
|
||||||
|
std::string autocompdisable(int action);
|
||||||
|
std::string badchannels(int action);
|
||||||
|
std::string blockingtrigger(int action);
|
||||||
|
std::string burstmode(int action);
|
||||||
|
std::string burstperiod(int action);
|
||||||
|
std::string bursts(int action);
|
||||||
|
std::string burstsl(int action);
|
||||||
|
std::string bustest(int action);
|
||||||
|
std::string cdsgain(int action);
|
||||||
|
std::string chipversion(int action);
|
||||||
|
std::string clearbit(int action);
|
||||||
|
std::string clearbusy(int action);
|
||||||
|
std::string clearroi(int action);
|
||||||
|
std::string clientversion(int action);
|
||||||
|
std::string clkdiv(int action);
|
||||||
|
std::string clkfreq(int action);
|
||||||
|
std::string clkphase(int action);
|
||||||
|
std::string column(int action);
|
||||||
|
std::string compdisabletime(int action);
|
||||||
|
std::string confadc(int action);
|
||||||
|
std::string config(int action);
|
||||||
|
std::string counters(int action);
|
||||||
|
std::string currentsource(int action);
|
||||||
|
std::string dac(int action);
|
||||||
|
std::string dacindex(int action);
|
||||||
|
std::string daclist(int action);
|
||||||
|
std::string dacname(int action);
|
||||||
|
std::string dacvalues(int action);
|
||||||
|
std::string datastream(int action);
|
||||||
|
std::string dbitclk(int action);
|
||||||
|
std::string dbitphase(int action);
|
||||||
|
std::string dbitpipeline(int action);
|
||||||
|
std::string defaultdac(int action);
|
||||||
|
std::string defaultpattern(int action);
|
||||||
|
std::string delay(int action);
|
||||||
|
std::string delayl(int action);
|
||||||
|
std::string detectorserverversion(int action);
|
||||||
|
std::string detsize(int action);
|
||||||
|
std::string diodelay(int action);
|
||||||
|
std::string dpulse(int action);
|
||||||
|
std::string dr(int action);
|
||||||
|
std::string drlist(int action);
|
||||||
|
std::string dsamples(int action);
|
||||||
|
std::string execcommand(int action);
|
||||||
|
std::string exptime(int action);
|
||||||
|
std::string exptime1(int action);
|
||||||
|
std::string exptime2(int action);
|
||||||
|
std::string exptime3(int action);
|
||||||
|
std::string exptimel(int action);
|
||||||
|
std::string extrastoragecells(int action);
|
||||||
|
std::string extsampling(int action);
|
||||||
|
std::string extsamplingsrc(int action);
|
||||||
|
std::string extsig(int action);
|
||||||
|
std::string fformat(int action);
|
||||||
|
std::string filtercells(int action);
|
||||||
|
std::string filterresistor(int action);
|
||||||
|
std::string findex(int action);
|
||||||
|
std::string firmwaretest(int action);
|
||||||
|
std::string firmwareversion(int action);
|
||||||
|
std::string fliprows(int action);
|
||||||
|
std::string flowcontrol10g(int action);
|
||||||
|
std::string fmaster(int action);
|
||||||
|
std::string fname(int action);
|
||||||
|
std::string foverwrite(int action);
|
||||||
|
std::string fpath(int action);
|
||||||
|
std::string framecounter(int action);
|
||||||
|
std::string frames(int action);
|
||||||
|
std::string framesl(int action);
|
||||||
|
std::string frametime(int action);
|
||||||
|
std::string free(int action);
|
||||||
|
std::string fwrite(int action);
|
||||||
|
std::string gaincaps(int action);
|
||||||
|
std::string gainmode(int action);
|
||||||
|
std::string gappixels(int action);
|
||||||
|
std::string gatedelay(int action);
|
||||||
|
std::string gatedelay1(int action);
|
||||||
|
std::string gatedelay2(int action);
|
||||||
|
std::string gatedelay3(int action);
|
||||||
|
std::string gates(int action);
|
||||||
|
std::string getbit(int action);
|
||||||
|
std::string hardwareversion(int action);
|
||||||
|
std::string highvoltage(int action);
|
||||||
|
std::string hostname(int action);
|
||||||
|
std::string im_a(int action);
|
||||||
|
std::string im_b(int action);
|
||||||
|
std::string im_c(int action);
|
||||||
|
std::string im_d(int action);
|
||||||
|
std::string im_io(int action);
|
||||||
|
std::string imagetest(int action);
|
||||||
|
std::string initialchecks(int action);
|
||||||
|
std::string inj_ch(int action);
|
||||||
|
std::string interpolation(int action);
|
||||||
|
std::string interruptsubframe(int action);
|
||||||
|
std::string kernelversion(int action);
|
||||||
|
std::string lastclient(int action);
|
||||||
|
std::string led(int action);
|
||||||
|
std::string lock(int action);
|
||||||
|
std::string master(int action);
|
||||||
|
std::string maxadcphaseshift(int action);
|
||||||
|
std::string maxclkphaseshift(int action);
|
||||||
|
std::string maxdbitphaseshift(int action);
|
||||||
|
std::string measuredperiod(int action);
|
||||||
|
std::string measuredsubperiod(int action);
|
||||||
|
std::string moduleid(int action);
|
||||||
|
std::string nextframenumber(int action);
|
||||||
|
std::string nmod(int action);
|
||||||
|
std::string numinterfaces(int action);
|
||||||
|
std::string overflow(int action);
|
||||||
|
std::string packageversion(int action);
|
||||||
|
std::string parallel(int action);
|
||||||
|
std::string parameters(int action);
|
||||||
|
std::string partialreset(int action);
|
||||||
|
std::string patfname(int action);
|
||||||
|
std::string patioctrl(int action);
|
||||||
|
std::string patlimits(int action);
|
||||||
|
std::string patloop(int action);
|
||||||
|
std::string patloop0(int action);
|
||||||
|
std::string patloop1(int action);
|
||||||
|
std::string patloop2(int action);
|
||||||
|
std::string patmask(int action);
|
||||||
|
std::string patnloop(int action);
|
||||||
|
std::string patnloop0(int action);
|
||||||
|
std::string patnloop1(int action);
|
||||||
|
std::string patnloop2(int action);
|
||||||
|
std::string patsetbit(int action);
|
||||||
|
std::string pattern(int action);
|
||||||
|
std::string patternstart(int action);
|
||||||
|
std::string patwait(int action);
|
||||||
|
std::string patwait0(int action);
|
||||||
|
std::string patwait1(int action);
|
||||||
|
std::string patwait2(int action);
|
||||||
|
std::string patwaittime(int action);
|
||||||
|
std::string patwaittime0(int action);
|
||||||
|
std::string patwaittime1(int action);
|
||||||
|
std::string patwaittime2(int action);
|
||||||
|
std::string patword(int action);
|
||||||
|
std::string pedestalmode(int action);
|
||||||
|
std::string period(int action);
|
||||||
|
std::string periodl(int action);
|
||||||
|
std::string polarity(int action);
|
||||||
|
std::string port(int action);
|
||||||
|
std::string powerchip(int action);
|
||||||
|
std::string powerindex(int action);
|
||||||
|
std::string powerlist(int action);
|
||||||
|
std::string powername(int action);
|
||||||
|
std::string powervalues(int action);
|
||||||
|
std::string programfpga(int action);
|
||||||
|
std::string pulse(int action);
|
||||||
|
std::string pulsechip(int action);
|
||||||
|
std::string pulsenmove(int action);
|
||||||
|
std::string pumpprobe(int action);
|
||||||
|
std::string quad(int action);
|
||||||
|
std::string ratecorr(int action);
|
||||||
|
std::string readnrows(int action);
|
||||||
|
std::string readout(int action);
|
||||||
|
std::string readoutspeed(int action);
|
||||||
|
std::string readoutspeedlist(int action);
|
||||||
|
std::string rebootcontroller(int action);
|
||||||
|
std::string reg(int action);
|
||||||
|
std::string resetdacs(int action);
|
||||||
|
std::string resetfpga(int action);
|
||||||
|
std::string roi(int action);
|
||||||
|
std::string romode(int action);
|
||||||
|
std::string row(int action);
|
||||||
|
std::string runclk(int action);
|
||||||
|
std::string runtime(int action);
|
||||||
|
std::string rx_arping(int action);
|
||||||
|
std::string rx_clearroi(int action);
|
||||||
|
std::string rx_dbitlist(int action);
|
||||||
|
std::string rx_dbitoffset(int action);
|
||||||
|
std::string rx_discardpolicy(int action);
|
||||||
|
std::string rx_fifodepth(int action);
|
||||||
|
std::string rx_frameindex(int action);
|
||||||
|
std::string rx_framescaught(int action);
|
||||||
|
std::string rx_framesperfile(int action);
|
||||||
|
std::string rx_hostname(int action);
|
||||||
|
std::string rx_jsonaddheader(int action);
|
||||||
|
std::string rx_jsonpara(int action);
|
||||||
|
std::string rx_lastclient(int action);
|
||||||
|
std::string rx_lock(int action);
|
||||||
|
std::string rx_missingpackets(int action);
|
||||||
|
std::string rx_padding(int action);
|
||||||
|
std::string rx_printconfig(int action);
|
||||||
|
std::string rx_realudpsocksize(int action);
|
||||||
|
std::string rx_roi(int action);
|
||||||
|
std::string rx_silent(int action);
|
||||||
|
std::string rx_start(int action);
|
||||||
|
std::string rx_status(int action);
|
||||||
|
std::string rx_stop(int action);
|
||||||
|
std::string rx_tcpport(int action);
|
||||||
|
std::string rx_threads(int action);
|
||||||
|
std::string rx_udpsocksize(int action);
|
||||||
|
std::string rx_version(int action);
|
||||||
|
std::string rx_zmqfreq(int action);
|
||||||
|
std::string rx_zmqhwm(int action);
|
||||||
|
std::string rx_zmqip(int action);
|
||||||
|
std::string rx_zmqport(int action);
|
||||||
|
std::string rx_zmqstartfnum(int action);
|
||||||
|
std::string rx_zmqstream(int action);
|
||||||
|
std::string samples(int action);
|
||||||
|
std::string savepattern(int action);
|
||||||
|
std::string scan(int action);
|
||||||
|
std::string scanerrmsg(int action);
|
||||||
|
std::string selinterface(int action);
|
||||||
|
std::string serialnumber(int action);
|
||||||
|
std::string setbit(int action);
|
||||||
|
std::string settings(int action);
|
||||||
|
std::string settingslist(int action);
|
||||||
|
std::string settingspath(int action);
|
||||||
|
std::string signalindex(int action);
|
||||||
|
std::string signallist(int action);
|
||||||
|
std::string signalname(int action);
|
||||||
|
std::string slowadc(int action);
|
||||||
|
std::string slowadcindex(int action);
|
||||||
|
std::string slowadclist(int action);
|
||||||
|
std::string slowadcname(int action);
|
||||||
|
std::string slowadcvalues(int action);
|
||||||
|
std::string start(int action);
|
||||||
|
std::string status(int action);
|
||||||
|
std::string stop(int action);
|
||||||
|
std::string stopport(int action);
|
||||||
|
std::string storagecell_delay(int action);
|
||||||
|
std::string storagecell_start(int action);
|
||||||
|
std::string subdeadtime(int action);
|
||||||
|
std::string subexptime(int action);
|
||||||
|
std::string sync(int action);
|
||||||
|
std::string syncclk(int action);
|
||||||
|
std::string temp_10ge(int action);
|
||||||
|
std::string temp_adc(int action);
|
||||||
|
std::string temp_control(int action);
|
||||||
|
std::string temp_dcdc(int action);
|
||||||
|
std::string temp_event(int action);
|
||||||
|
std::string temp_fpga(int action);
|
||||||
|
std::string temp_fpgaext(int action);
|
||||||
|
std::string temp_fpgafl(int action);
|
||||||
|
std::string temp_fpgafr(int action);
|
||||||
|
std::string temp_slowadc(int action);
|
||||||
|
std::string temp_sodl(int action);
|
||||||
|
std::string temp_sodr(int action);
|
||||||
|
std::string temp_threshold(int action);
|
||||||
|
std::string templist(int action);
|
||||||
|
std::string tempvalues(int action);
|
||||||
|
std::string tengiga(int action);
|
||||||
|
std::string threshold(int action);
|
||||||
|
std::string timing(int action);
|
||||||
|
std::string timinglist(int action);
|
||||||
|
std::string timingsource(int action);
|
||||||
|
std::string top(int action);
|
||||||
|
std::string transceiverenable(int action);
|
||||||
|
std::string trigger(int action);
|
||||||
|
std::string triggers(int action);
|
||||||
|
std::string triggersl(int action);
|
||||||
|
std::string trimbits(int action);
|
||||||
|
std::string trimen(int action);
|
||||||
|
std::string trimval(int action);
|
||||||
|
std::string tsamples(int action);
|
||||||
|
std::string txdelay(int action);
|
||||||
|
std::string txdelay_frame(int action);
|
||||||
|
std::string txdelay_left(int action);
|
||||||
|
std::string txdelay_right(int action);
|
||||||
|
std::string type(int action);
|
||||||
|
std::string udp_cleardst(int action);
|
||||||
|
std::string udp_dstip(int action);
|
||||||
|
std::string udp_dstip2(int action);
|
||||||
|
std::string udp_dstlist(int action);
|
||||||
|
std::string udp_dstmac(int action);
|
||||||
|
std::string udp_dstmac2(int action);
|
||||||
|
std::string udp_dstport(int action);
|
||||||
|
std::string udp_dstport2(int action);
|
||||||
|
std::string udp_firstdst(int action);
|
||||||
|
std::string udp_numdst(int action);
|
||||||
|
std::string udp_reconfigure(int action);
|
||||||
|
std::string udp_srcip(int action);
|
||||||
|
std::string udp_srcip2(int action);
|
||||||
|
std::string udp_srcmac(int action);
|
||||||
|
std::string udp_srcmac2(int action);
|
||||||
|
std::string udp_validate(int action);
|
||||||
|
std::string update(int action);
|
||||||
|
std::string updatedetectorserver(int action);
|
||||||
|
std::string updatekernel(int action);
|
||||||
|
std::string updatemode(int action);
|
||||||
|
std::string user(int action);
|
||||||
|
std::string v_a(int action);
|
||||||
|
std::string v_b(int action);
|
||||||
|
std::string v_c(int action);
|
||||||
|
std::string v_chip(int action);
|
||||||
|
std::string v_d(int action);
|
||||||
|
std::string v_io(int action);
|
||||||
|
std::string v_limit(int action);
|
||||||
|
std::string vchip_comp_adc(int action);
|
||||||
|
std::string vchip_comp_fe(int action);
|
||||||
|
std::string vchip_cs(int action);
|
||||||
|
std::string vchip_opa_1st(int action);
|
||||||
|
std::string vchip_opa_fd(int action);
|
||||||
|
std::string vchip_ref_comp_fe(int action);
|
||||||
|
std::string versions(int action);
|
||||||
|
std::string veto(int action);
|
||||||
|
std::string vetoalg(int action);
|
||||||
|
std::string vetofile(int action);
|
||||||
|
std::string vetophoton(int action);
|
||||||
|
std::string vetoref(int action);
|
||||||
|
std::string vetostream(int action);
|
||||||
|
std::string virtualFunction(int action);
|
||||||
|
std::string vm_a(int action);
|
||||||
|
std::string vm_b(int action);
|
||||||
|
std::string vm_c(int action);
|
||||||
|
std::string vm_d(int action);
|
||||||
|
std::string vm_io(int action);
|
||||||
|
std::string zmqhwm(int action);
|
||||||
|
std::string zmqip(int action);
|
||||||
|
std::string zmqport(int action);
|
||||||
|
|
||||||
|
std::vector<std::string> args;
|
||||||
|
std::string cmd;
|
||||||
|
Detector *det;
|
||||||
|
int det_id{-1};
|
||||||
|
int rx_id{-1};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool ReplaceIfDepreciated(std::string &command);
|
||||||
|
using FunctionMap = std::map<std::string, std::string (Caller::*)(int)>;
|
||||||
|
using StringMap = std::map<std::string, std::string>;
|
||||||
|
Detector *ptr; // pointer to the detector that executes the command
|
||||||
|
|
||||||
|
FunctionMap functions{
|
||||||
|
{"list", &Caller::list},
|
||||||
|
|
||||||
|
{"acquire", &Caller::acquire},
|
||||||
|
{"activate", &Caller::activate},
|
||||||
|
{"adcclk", &Caller::adcclk},
|
||||||
|
{"adcenable", &Caller::adcenable},
|
||||||
|
{"adcenable10g", &Caller::adcenable10g},
|
||||||
|
{"adcindex", &Caller::adcindex},
|
||||||
|
{"adcinvert", &Caller::adcinvert},
|
||||||
|
{"adclist", &Caller::adclist},
|
||||||
|
{"adcname", &Caller::adcname},
|
||||||
|
{"adcphase", &Caller::adcphase},
|
||||||
|
{"adcpipeline", &Caller::adcpipeline},
|
||||||
|
{"adcreg", &Caller::adcreg},
|
||||||
|
{"adcvpp", &Caller::adcvpp},
|
||||||
|
{"apulse", &Caller::apulse},
|
||||||
|
{"asamples", &Caller::asamples},
|
||||||
|
{"autocompdisable", &Caller::autocompdisable},
|
||||||
|
{"badchannels", &Caller::badchannels},
|
||||||
|
{"blockingtrigger", &Caller::blockingtrigger},
|
||||||
|
{"burstmode", &Caller::burstmode},
|
||||||
|
{"burstperiod", &Caller::burstperiod},
|
||||||
|
{"bursts", &Caller::bursts},
|
||||||
|
{"burstsl", &Caller::burstsl},
|
||||||
|
{"bustest", &Caller::bustest},
|
||||||
|
{"cdsgain", &Caller::cdsgain},
|
||||||
|
{"chipversion", &Caller::chipversion},
|
||||||
|
{"clearbit", &Caller::clearbit},
|
||||||
|
{"clearbusy", &Caller::clearbusy},
|
||||||
|
{"clearroi", &Caller::clearroi},
|
||||||
|
{"clientversion", &Caller::clientversion},
|
||||||
|
{"clkdiv", &Caller::clkdiv},
|
||||||
|
{"clkfreq", &Caller::clkfreq},
|
||||||
|
{"clkphase", &Caller::clkphase},
|
||||||
|
{"column", &Caller::column},
|
||||||
|
{"compdisabletime", &Caller::compdisabletime},
|
||||||
|
{"confadc", &Caller::confadc},
|
||||||
|
{"config", &Caller::config},
|
||||||
|
{"counters", &Caller::counters},
|
||||||
|
{"currentsource", &Caller::currentsource},
|
||||||
|
{"dac", &Caller::dac},
|
||||||
|
{"dacindex", &Caller::dacindex},
|
||||||
|
{"daclist", &Caller::daclist},
|
||||||
|
{"dacname", &Caller::dacname},
|
||||||
|
{"dacvalues", &Caller::dacvalues},
|
||||||
|
{"datastream", &Caller::datastream},
|
||||||
|
{"dbitclk", &Caller::dbitclk},
|
||||||
|
{"dbitphase", &Caller::dbitphase},
|
||||||
|
{"dbitpipeline", &Caller::dbitpipeline},
|
||||||
|
{"defaultdac", &Caller::defaultdac},
|
||||||
|
{"defaultpattern", &Caller::defaultpattern},
|
||||||
|
{"delay", &Caller::delay},
|
||||||
|
{"delayl", &Caller::delayl},
|
||||||
|
{"detectorserverversion", &Caller::detectorserverversion},
|
||||||
|
{"detsize", &Caller::detsize},
|
||||||
|
{"diodelay", &Caller::diodelay},
|
||||||
|
{"dpulse", &Caller::dpulse},
|
||||||
|
{"dr", &Caller::dr},
|
||||||
|
{"drlist", &Caller::drlist},
|
||||||
|
{"dsamples", &Caller::dsamples},
|
||||||
|
{"execcommand", &Caller::execcommand},
|
||||||
|
{"exptime", &Caller::exptime},
|
||||||
|
{"exptime1", &Caller::exptime1},
|
||||||
|
{"exptime2", &Caller::exptime2},
|
||||||
|
{"exptime3", &Caller::exptime3},
|
||||||
|
{"exptimel", &Caller::exptimel},
|
||||||
|
{"extrastoragecells", &Caller::extrastoragecells},
|
||||||
|
{"extsampling", &Caller::extsampling},
|
||||||
|
{"extsamplingsrc", &Caller::extsamplingsrc},
|
||||||
|
{"extsig", &Caller::extsig},
|
||||||
|
{"fformat", &Caller::fformat},
|
||||||
|
{"filtercells", &Caller::filtercells},
|
||||||
|
{"filterresistor", &Caller::filterresistor},
|
||||||
|
{"findex", &Caller::findex},
|
||||||
|
{"firmwaretest", &Caller::firmwaretest},
|
||||||
|
{"firmwareversion", &Caller::firmwareversion},
|
||||||
|
{"fliprows", &Caller::fliprows},
|
||||||
|
{"flowcontrol10g", &Caller::flowcontrol10g},
|
||||||
|
{"fmaster", &Caller::fmaster},
|
||||||
|
{"fname", &Caller::fname},
|
||||||
|
{"foverwrite", &Caller::foverwrite},
|
||||||
|
{"fpath", &Caller::fpath},
|
||||||
|
{"framecounter", &Caller::framecounter},
|
||||||
|
{"frames", &Caller::frames},
|
||||||
|
{"framesl", &Caller::framesl},
|
||||||
|
{"frametime", &Caller::frametime},
|
||||||
|
{"free", &Caller::free},
|
||||||
|
{"fwrite", &Caller::fwrite},
|
||||||
|
{"gaincaps", &Caller::gaincaps},
|
||||||
|
{"gainmode", &Caller::gainmode},
|
||||||
|
{"gappixels", &Caller::gappixels},
|
||||||
|
{"gatedelay", &Caller::gatedelay},
|
||||||
|
{"gatedelay1", &Caller::gatedelay1},
|
||||||
|
{"gatedelay2", &Caller::gatedelay2},
|
||||||
|
{"gatedelay3", &Caller::gatedelay3},
|
||||||
|
{"gates", &Caller::gates},
|
||||||
|
{"getbit", &Caller::getbit},
|
||||||
|
{"hardwareversion", &Caller::hardwareversion},
|
||||||
|
{"highvoltage", &Caller::highvoltage},
|
||||||
|
{"hostname", &Caller::hostname},
|
||||||
|
{"im_a", &Caller::im_a},
|
||||||
|
{"im_b", &Caller::im_b},
|
||||||
|
{"im_c", &Caller::im_c},
|
||||||
|
{"im_d", &Caller::im_d},
|
||||||
|
{"im_io", &Caller::im_io},
|
||||||
|
{"imagetest", &Caller::imagetest},
|
||||||
|
{"initialchecks", &Caller::initialchecks},
|
||||||
|
{"inj_ch", &Caller::inj_ch},
|
||||||
|
{"interpolation", &Caller::interpolation},
|
||||||
|
{"interruptsubframe", &Caller::interruptsubframe},
|
||||||
|
{"kernelversion", &Caller::kernelversion},
|
||||||
|
{"lastclient", &Caller::lastclient},
|
||||||
|
{"led", &Caller::led},
|
||||||
|
{"lock", &Caller::lock},
|
||||||
|
{"master", &Caller::master},
|
||||||
|
{"maxadcphaseshift", &Caller::maxadcphaseshift},
|
||||||
|
{"maxclkphaseshift", &Caller::maxclkphaseshift},
|
||||||
|
{"maxdbitphaseshift", &Caller::maxdbitphaseshift},
|
||||||
|
{"measuredperiod", &Caller::measuredperiod},
|
||||||
|
{"measuredsubperiod", &Caller::measuredsubperiod},
|
||||||
|
{"moduleid", &Caller::moduleid},
|
||||||
|
{"nextframenumber", &Caller::nextframenumber},
|
||||||
|
{"nmod", &Caller::nmod},
|
||||||
|
{"numinterfaces", &Caller::numinterfaces},
|
||||||
|
{"overflow", &Caller::overflow},
|
||||||
|
{"packageversion", &Caller::packageversion},
|
||||||
|
{"parallel", &Caller::parallel},
|
||||||
|
{"parameters", &Caller::parameters},
|
||||||
|
{"partialreset", &Caller::partialreset},
|
||||||
|
{"patfname", &Caller::patfname},
|
||||||
|
{"patioctrl", &Caller::patioctrl},
|
||||||
|
{"patlimits", &Caller::patlimits},
|
||||||
|
{"patloop", &Caller::patloop},
|
||||||
|
{"patloop0", &Caller::patloop0},
|
||||||
|
{"patloop1", &Caller::patloop1},
|
||||||
|
{"patloop2", &Caller::patloop2},
|
||||||
|
{"patmask", &Caller::patmask},
|
||||||
|
{"patnloop", &Caller::patnloop},
|
||||||
|
{"patnloop0", &Caller::patnloop0},
|
||||||
|
{"patnloop1", &Caller::patnloop1},
|
||||||
|
{"patnloop2", &Caller::patnloop2},
|
||||||
|
{"patsetbit", &Caller::patsetbit},
|
||||||
|
{"patternX", &Caller::pattern},
|
||||||
|
{"patternstart", &Caller::patternstart},
|
||||||
|
{"patwait", &Caller::patwait},
|
||||||
|
{"patwait0", &Caller::patwait0},
|
||||||
|
{"patwait1", &Caller::patwait1},
|
||||||
|
{"patwait2", &Caller::patwait2},
|
||||||
|
{"patwaittime", &Caller::patwaittime},
|
||||||
|
{"patwaittime0", &Caller::patwaittime0},
|
||||||
|
{"patwaittime1", &Caller::patwaittime1},
|
||||||
|
{"patwaittime2", &Caller::patwaittime2},
|
||||||
|
{"patword", &Caller::patword},
|
||||||
|
{"pedestalmode", &Caller::pedestalmode},
|
||||||
|
{"period", &Caller::period},
|
||||||
|
{"periodl", &Caller::periodl},
|
||||||
|
{"polarity", &Caller::polarity},
|
||||||
|
{"port", &Caller::port},
|
||||||
|
{"powerchip", &Caller::powerchip},
|
||||||
|
{"powerindex", &Caller::powerindex},
|
||||||
|
{"powerlist", &Caller::powerlist},
|
||||||
|
{"powername", &Caller::powername},
|
||||||
|
{"powervalues", &Caller::powervalues},
|
||||||
|
{"programfpga", &Caller::programfpga},
|
||||||
|
{"pulse", &Caller::pulse},
|
||||||
|
{"pulsechip", &Caller::pulsechip},
|
||||||
|
{"pulsenmove", &Caller::pulsenmove},
|
||||||
|
{"pumpprobe", &Caller::pumpprobe},
|
||||||
|
{"quad", &Caller::quad},
|
||||||
|
{"ratecorr", &Caller::ratecorr},
|
||||||
|
{"readnrows", &Caller::readnrows},
|
||||||
|
{"readout", &Caller::readout},
|
||||||
|
{"readoutspeed", &Caller::readoutspeed},
|
||||||
|
{"readoutspeedlist", &Caller::readoutspeedlist},
|
||||||
|
{"rebootcontroller", &Caller::rebootcontroller},
|
||||||
|
{"reg", &Caller::reg},
|
||||||
|
{"resetdacs", &Caller::resetdacs},
|
||||||
|
{"resetfpga", &Caller::resetfpga},
|
||||||
|
{"roi", &Caller::roi},
|
||||||
|
{"romode", &Caller::romode},
|
||||||
|
{"row", &Caller::row},
|
||||||
|
{"runclk", &Caller::runclk},
|
||||||
|
{"runtime", &Caller::runtime},
|
||||||
|
{"rx_arping", &Caller::rx_arping},
|
||||||
|
{"rx_clearroi", &Caller::rx_clearroi},
|
||||||
|
{"rx_dbitlist", &Caller::rx_dbitlist},
|
||||||
|
{"rx_dbitoffset", &Caller::rx_dbitoffset},
|
||||||
|
{"rx_discardpolicy", &Caller::rx_discardpolicy},
|
||||||
|
{"rx_fifodepth", &Caller::rx_fifodepth},
|
||||||
|
{"rx_frameindex", &Caller::rx_frameindex},
|
||||||
|
{"rx_framescaught", &Caller::rx_framescaught},
|
||||||
|
{"rx_framesperfile", &Caller::rx_framesperfile},
|
||||||
|
{"rx_hostname", &Caller::rx_hostname},
|
||||||
|
{"rx_jsonaddheader", &Caller::rx_jsonaddheader},
|
||||||
|
{"rx_jsonpara", &Caller::rx_jsonpara},
|
||||||
|
{"rx_lastclient", &Caller::rx_lastclient},
|
||||||
|
{"rx_lock", &Caller::rx_lock},
|
||||||
|
{"rx_missingpackets", &Caller::rx_missingpackets},
|
||||||
|
{"rx_padding", &Caller::rx_padding},
|
||||||
|
{"rx_printconfig", &Caller::rx_printconfig},
|
||||||
|
{"rx_realudpsocksize", &Caller::rx_realudpsocksize},
|
||||||
|
{"rx_roi", &Caller::rx_roi},
|
||||||
|
{"rx_silent", &Caller::rx_silent},
|
||||||
|
{"rx_start", &Caller::rx_start},
|
||||||
|
{"rx_status", &Caller::rx_status},
|
||||||
|
{"rx_stop", &Caller::rx_stop},
|
||||||
|
{"rx_tcpport", &Caller::rx_tcpport},
|
||||||
|
{"rx_threads", &Caller::rx_threads},
|
||||||
|
{"rx_udpsocksize", &Caller::rx_udpsocksize},
|
||||||
|
{"rx_version", &Caller::rx_version},
|
||||||
|
{"rx_zmqfreq", &Caller::rx_zmqfreq},
|
||||||
|
{"rx_zmqhwm", &Caller::rx_zmqhwm},
|
||||||
|
{"rx_zmqip", &Caller::rx_zmqip},
|
||||||
|
{"rx_zmqport", &Caller::rx_zmqport},
|
||||||
|
{"rx_zmqstartfnum", &Caller::rx_zmqstartfnum},
|
||||||
|
{"rx_zmqstream", &Caller::rx_zmqstream},
|
||||||
|
{"samples", &Caller::samples},
|
||||||
|
{"savepattern", &Caller::savepattern},
|
||||||
|
{"scan", &Caller::scan},
|
||||||
|
{"scanerrmsg", &Caller::scanerrmsg},
|
||||||
|
{"selinterface", &Caller::selinterface},
|
||||||
|
{"serialnumber", &Caller::serialnumber},
|
||||||
|
{"setbit", &Caller::setbit},
|
||||||
|
{"settings", &Caller::settings},
|
||||||
|
{"settingslist", &Caller::settingslist},
|
||||||
|
{"settingspath", &Caller::settingspath},
|
||||||
|
{"signalindex", &Caller::signalindex},
|
||||||
|
{"signallist", &Caller::signallist},
|
||||||
|
{"signalname", &Caller::signalname},
|
||||||
|
{"slowadc", &Caller::slowadc},
|
||||||
|
{"slowadcindex", &Caller::slowadcindex},
|
||||||
|
{"slowadclist", &Caller::slowadclist},
|
||||||
|
{"slowadcname", &Caller::slowadcname},
|
||||||
|
{"slowadcvalues", &Caller::slowadcvalues},
|
||||||
|
{"start", &Caller::start},
|
||||||
|
{"status", &Caller::status},
|
||||||
|
{"stop", &Caller::stop},
|
||||||
|
{"stopport", &Caller::stopport},
|
||||||
|
{"storagecell_delay", &Caller::storagecell_delay},
|
||||||
|
{"storagecell_start", &Caller::storagecell_start},
|
||||||
|
{"subdeadtime", &Caller::subdeadtime},
|
||||||
|
{"subexptime", &Caller::subexptime},
|
||||||
|
{"sync", &Caller::sync},
|
||||||
|
{"syncclk", &Caller::syncclk},
|
||||||
|
{"temp_10ge", &Caller::temp_10ge},
|
||||||
|
{"temp_adc", &Caller::temp_adc},
|
||||||
|
{"temp_control", &Caller::temp_control},
|
||||||
|
{"temp_dcdc", &Caller::temp_dcdc},
|
||||||
|
{"temp_event", &Caller::temp_event},
|
||||||
|
{"temp_fpga", &Caller::temp_fpga},
|
||||||
|
{"temp_fpgaext", &Caller::temp_fpgaext},
|
||||||
|
{"temp_fpgafl", &Caller::temp_fpgafl},
|
||||||
|
{"temp_fpgafr", &Caller::temp_fpgafr},
|
||||||
|
{"temp_slowadc", &Caller::temp_slowadc},
|
||||||
|
{"temp_sodl", &Caller::temp_sodl},
|
||||||
|
{"temp_sodr", &Caller::temp_sodr},
|
||||||
|
{"temp_threshold", &Caller::temp_threshold},
|
||||||
|
{"templist", &Caller::templist},
|
||||||
|
{"tempvalues", &Caller::tempvalues},
|
||||||
|
{"tengiga", &Caller::tengiga},
|
||||||
|
{"threshold", &Caller::threshold},
|
||||||
|
{"thresholdnotb", &Caller::threshold},
|
||||||
|
{"timing", &Caller::timing},
|
||||||
|
{"timinglist", &Caller::timinglist},
|
||||||
|
{"timingsource", &Caller::timingsource},
|
||||||
|
{"top", &Caller::top},
|
||||||
|
{"transceiverenable", &Caller::transceiverenable},
|
||||||
|
{"trigger", &Caller::trigger},
|
||||||
|
{"triggers", &Caller::triggers},
|
||||||
|
{"triggersl", &Caller::triggersl},
|
||||||
|
{"trimbits", &Caller::trimbits},
|
||||||
|
{"trimen", &Caller::trimen},
|
||||||
|
{"trimval", &Caller::trimval},
|
||||||
|
{"tsamples", &Caller::tsamples},
|
||||||
|
{"txdelay", &Caller::txdelay},
|
||||||
|
{"txdelay_frame", &Caller::txdelay_frame},
|
||||||
|
{"txdelay_left", &Caller::txdelay_left},
|
||||||
|
{"txdelay_right", &Caller::txdelay_right},
|
||||||
|
{"type", &Caller::type},
|
||||||
|
{"udp_cleardst", &Caller::udp_cleardst},
|
||||||
|
{"udp_dstip", &Caller::udp_dstip},
|
||||||
|
{"udp_dstip2", &Caller::udp_dstip2},
|
||||||
|
{"udp_dstlist", &Caller::udp_dstlist},
|
||||||
|
{"udp_dstmac", &Caller::udp_dstmac},
|
||||||
|
{"udp_dstmac2", &Caller::udp_dstmac2},
|
||||||
|
{"udp_dstport", &Caller::udp_dstport},
|
||||||
|
{"udp_dstport2", &Caller::udp_dstport2},
|
||||||
|
{"udp_firstdst", &Caller::udp_firstdst},
|
||||||
|
{"udp_numdst", &Caller::udp_numdst},
|
||||||
|
{"udp_reconfigure", &Caller::udp_reconfigure},
|
||||||
|
{"udp_srcip", &Caller::udp_srcip},
|
||||||
|
{"udp_srcip2", &Caller::udp_srcip2},
|
||||||
|
{"udp_srcmac", &Caller::udp_srcmac},
|
||||||
|
{"udp_srcmac2", &Caller::udp_srcmac2},
|
||||||
|
{"udp_validate", &Caller::udp_validate},
|
||||||
|
{"update", &Caller::update},
|
||||||
|
{"updatedetectorserver", &Caller::updatedetectorserver},
|
||||||
|
{"updatekernel", &Caller::updatekernel},
|
||||||
|
{"updatemode", &Caller::updatemode},
|
||||||
|
{"user", &Caller::user},
|
||||||
|
{"v_a", &Caller::v_a},
|
||||||
|
{"v_b", &Caller::v_b},
|
||||||
|
{"v_c", &Caller::v_c},
|
||||||
|
{"v_chip", &Caller::v_chip},
|
||||||
|
{"v_d", &Caller::v_d},
|
||||||
|
{"v_io", &Caller::v_io},
|
||||||
|
{"v_limit", &Caller::v_limit},
|
||||||
|
{"vchip_comp_adc", &Caller::vchip_comp_adc},
|
||||||
|
{"vchip_comp_fe", &Caller::vchip_comp_fe},
|
||||||
|
{"vchip_cs", &Caller::vchip_cs},
|
||||||
|
{"vchip_opa_1st", &Caller::vchip_opa_1st},
|
||||||
|
{"vchip_opa_fd", &Caller::vchip_opa_fd},
|
||||||
|
{"vchip_ref_comp_fe", &Caller::vchip_ref_comp_fe},
|
||||||
|
{"versions", &Caller::versions},
|
||||||
|
{"veto", &Caller::veto},
|
||||||
|
{"vetoalg", &Caller::vetoalg},
|
||||||
|
{"vetofile", &Caller::vetofile},
|
||||||
|
{"vetophoton", &Caller::vetophoton},
|
||||||
|
{"vetoref", &Caller::vetoref},
|
||||||
|
{"vetostream", &Caller::vetostream},
|
||||||
|
{"virtual", &Caller::virtualFunction},
|
||||||
|
{"vm_a", &Caller::vm_a},
|
||||||
|
{"vm_b", &Caller::vm_b},
|
||||||
|
{"vm_c", &Caller::vm_c},
|
||||||
|
{"vm_d", &Caller::vm_d},
|
||||||
|
{"vm_io", &Caller::vm_io},
|
||||||
|
{"zmqhwm", &Caller::zmqhwm},
|
||||||
|
{"zmqip", &Caller::zmqip},
|
||||||
|
{"zmqport", &Caller::zmqport}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
StringMap depreciated_functions{
|
||||||
|
|
||||||
|
{"detectorversion", "firmwareversion"},
|
||||||
|
{"softwareversion", "detectorserverversion"},
|
||||||
|
{"receiverversion", "rx_version"},
|
||||||
|
{"detectornumber", "serialnumber"},
|
||||||
|
{"thisversion", "clientversion"},
|
||||||
|
{"detsizechan", "detsize"},
|
||||||
|
{"trimdir", "settingspath"},
|
||||||
|
{"settingsdir", "settingspath"},
|
||||||
|
{"flippeddatax", "fliprows"},
|
||||||
|
{"cycles", "triggers"},
|
||||||
|
{"cyclesl", "triggersl"},
|
||||||
|
{"clkdivider", "readoutspeed"},
|
||||||
|
{"speed", "readoutspeed"},
|
||||||
|
{"vhighvoltage", "highvoltage"},
|
||||||
|
{"digitest", "imagetest"},
|
||||||
|
{"filter", "filterresistor"},
|
||||||
|
{"readnlines", "readnrows"},
|
||||||
|
{"vtr", "vtrim"},
|
||||||
|
{"vrf", "vrpreamp"},
|
||||||
|
{"vrs", "vrshaper"},
|
||||||
|
{"vcall", "vcal"},
|
||||||
|
{"vis", "vishaper"},
|
||||||
|
{"vshaper", "vrshaper"},
|
||||||
|
{"vpreamp", "vrpreamp"},
|
||||||
|
{"vshaperneg", "vrshaper_n"},
|
||||||
|
{"viinsh", "vishaper"},
|
||||||
|
{"vpl", "vcal_n"},
|
||||||
|
{"vph", "vcal_p"},
|
||||||
|
{"vthreshold", "dac"},
|
||||||
|
{"vsvp", "dac"},
|
||||||
|
{"vsvn", "dac"},
|
||||||
|
{"vtrim", "dac"},
|
||||||
|
{"vrpreamp", "dac"},
|
||||||
|
{"vrshaper", "dac"},
|
||||||
|
{"vtgstv", "dac"},
|
||||||
|
{"vcmp_ll", "dac"},
|
||||||
|
{"vcmp_lr", "dac"},
|
||||||
|
{"vcal", "dac"},
|
||||||
|
{"vcmp_rl", "dac"},
|
||||||
|
{"vcmp_rr", "dac"},
|
||||||
|
{"rxb_rb", "dac"},
|
||||||
|
{"rxb_lb", "dac"},
|
||||||
|
{"vcp", "dac"},
|
||||||
|
{"vcn", "dac"},
|
||||||
|
{"vishaper", "dac"},
|
||||||
|
{"iodelay", "dac"},
|
||||||
|
{"vref_ds", "dac"},
|
||||||
|
{"vcascn_pb", "dac"},
|
||||||
|
{"vcascp_pb", "dac"},
|
||||||
|
{"vout_cm", "dac"},
|
||||||
|
{"vcasc_out", "dac"},
|
||||||
|
{"vin_cm", "dac"},
|
||||||
|
{"vref_comp", "dac"},
|
||||||
|
{"ib_test_c", "dac"},
|
||||||
|
{"vrshaper_n", "dac"},
|
||||||
|
{"vipre", "dac"},
|
||||||
|
{"vdcsh", "dac"},
|
||||||
|
{"vth1", "dac"},
|
||||||
|
{"vth2", "dac"},
|
||||||
|
{"vth3", "dac"},
|
||||||
|
{"vcal_n", "dac"},
|
||||||
|
{"vcal_p", "dac"},
|
||||||
|
{"vcassh", "dac"},
|
||||||
|
{"vcas", "dac"},
|
||||||
|
{"vicin", "dac"},
|
||||||
|
{"vipre_out", "dac"},
|
||||||
|
{"vref_h_adc", "dac"},
|
||||||
|
{"vb_comp_fe", "dac"},
|
||||||
|
{"vb_comp_adc", "dac"},
|
||||||
|
{"vcom_cds", "dac"},
|
||||||
|
{"vref_rstore", "dac"},
|
||||||
|
{"vb_opa_1st", "dac"},
|
||||||
|
{"vref_comp_fe", "dac"},
|
||||||
|
{"vcom_adc1", "dac"},
|
||||||
|
{"vref_prech", "dac"},
|
||||||
|
{"vref_l_adc", "dac"},
|
||||||
|
{"vref_cds", "dac"},
|
||||||
|
{"vb_cs", "dac"},
|
||||||
|
{"vb_opa_fd", "dac"},
|
||||||
|
{"vcom_adc2", "dac"},
|
||||||
|
{"vb_ds", "dac"},
|
||||||
|
{"vb_comp", "dac"},
|
||||||
|
{"vb_pixbuf", "dac"},
|
||||||
|
{"vin_com", "dac"},
|
||||||
|
{"vdd_prot", "dac"},
|
||||||
|
{"vbp_colbuf", "dac"},
|
||||||
|
{"vb_sda", "dac"},
|
||||||
|
{"vcasc_sfp", "dac"},
|
||||||
|
{"vipre_cds", "dac"},
|
||||||
|
{"ibias_sfp", "dac"},
|
||||||
|
{"defaultdacs", "resetdacs"},
|
||||||
|
{"busy", "clearbusy"},
|
||||||
|
{"receiver", "rx_status"},
|
||||||
|
{"framescaught", "rx_framescaught"},
|
||||||
|
{"startingfnum", "nextframenumber"},
|
||||||
|
{"detectorip", "udp_srcip"},
|
||||||
|
{"detectorip2", "udp_srcip2"},
|
||||||
|
{"detectormac", "udp_srcmac"},
|
||||||
|
{"detectormac2", "udp_srcmac2"},
|
||||||
|
{"rx_udpip", "udp_dstip"},
|
||||||
|
{"rx_udpip2", "udp_dstip2"},
|
||||||
|
{"rx_udpmac", "udp_dstmac"},
|
||||||
|
{"rx_udpmac2", "udp_dstmac2"},
|
||||||
|
{"rx_udpport", "udp_dstport"},
|
||||||
|
{"rx_udpport2", "udp_dstport2"},
|
||||||
|
{"flowcontrol_10g", "flowcontrol10g"},
|
||||||
|
{"txndelay_frame", "txdelay_frame"},
|
||||||
|
{"txndelay_left", "txdelay_left"},
|
||||||
|
{"txndelay_right", "txdelay_right"},
|
||||||
|
{"r_silent", "rx_silent"},
|
||||||
|
{"r_discardpolicy", "rx_discardpolicy"},
|
||||||
|
{"r_padding", "rx_padding"},
|
||||||
|
{"r_lock", "rx_lock"},
|
||||||
|
{"r_lastclient", "rx_lastclient"},
|
||||||
|
{"fileformat", "fformat"},
|
||||||
|
{"outdir", "fpath"},
|
||||||
|
{"index", "findex"},
|
||||||
|
{"enablefwrite", "fwrite"},
|
||||||
|
{"masterfile", "fmaster"},
|
||||||
|
{"overwrite", "foverwrite"},
|
||||||
|
{"r_framesperfile", "rx_framesperfile"},
|
||||||
|
{"r_readfreq", "rx_zmqfreq"},
|
||||||
|
{"rx_readfreq", "rx_zmqfreq"},
|
||||||
|
{"rx_datastream", "rx_zmqstream"},
|
||||||
|
{"resmat", "partialreset"},
|
||||||
|
{"storagecells", "extrastoragecells"},
|
||||||
|
{"auto_comp_disable", "autocompdisable"},
|
||||||
|
{"comp_disable_time", "compdisabletime"},
|
||||||
|
{"adc", "slowadc"},
|
||||||
|
{"flags", "romode"},
|
||||||
|
{"i_a", "im_a"},
|
||||||
|
{"i_b", "im_b"},
|
||||||
|
{"i_c", "im_c"},
|
||||||
|
{"i_d", "im_d"},
|
||||||
|
{"i_io", "im_io"},
|
||||||
|
{"copydetectorserver", "updatedetectorserver"},
|
||||||
|
{"nframes", "framecounter"},
|
||||||
|
{"now", "runtime"},
|
||||||
|
{"timestamp", "frametime"},
|
||||||
|
{"frameindex", "rx_frameindex"},
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
1149
slsDetectorSoftware/src/CallerSpecial.cpp
Normal file
1149
slsDetectorSoftware/src/CallerSpecial.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,12 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
#include "Caller.h"
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
|
|
||||||
/*
|
|
||||||
This file is used to generate the command line binaries
|
|
||||||
(sls_detector_get/put/acquire/help). By defines in CMake
|
|
||||||
we get the different files.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#include "sls/Detector.h"
|
|
||||||
|
|
||||||
#include "CmdParser.h"
|
#include "CmdParser.h"
|
||||||
#include "CmdProxy.h"
|
#include "inferAction.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/Detector.h"
|
||||||
|
#include "sls/logger.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include <cstring> //strcmp
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// To genereate sepereate binaries for put, get, acquire and help
|
// To genereate sepereate binaries for put, get, acquire and help
|
||||||
#ifdef PUT
|
#ifdef PUT
|
||||||
int action = slsDetectorDefs::PUT_ACTION;
|
int action = slsDetectorDefs::PUT_ACTION;
|
||||||
@ -33,6 +23,9 @@ int main(int argc, char *argv[]) {
|
|||||||
#ifdef HELP
|
#ifdef HELP
|
||||||
int action = slsDetectorDefs::HELP_ACTION;
|
int action = slsDetectorDefs::HELP_ACTION;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef INFER
|
||||||
|
int action = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for --version in the arguments
|
// Check for --version in the arguments
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
@ -45,14 +38,12 @@ int main(int argc, char *argv[]) {
|
|||||||
sls::CmdParser parser;
|
sls::CmdParser parser;
|
||||||
parser.Parse(argc, argv);
|
parser.Parse(argc, argv);
|
||||||
|
|
||||||
// If we called sls_detector_acquire, add the acquire command
|
|
||||||
if (action == slsDetectorDefs::READOUT_ACTION)
|
if (action == slsDetectorDefs::READOUT_ACTION)
|
||||||
parser.setCommand("acquire");
|
parser.setCommand("acquire");
|
||||||
|
|
||||||
if (parser.isHelp())
|
if (parser.isHelp())
|
||||||
action = slsDetectorDefs::HELP_ACTION;
|
action = slsDetectorDefs::HELP_ACTION;
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// Free shared memory should work also without a detector
|
// Free shared memory should work also without a detector
|
||||||
// if we have an option for verify in the detector constructor
|
// if we have an option for verify in the detector constructor
|
||||||
// we could avoid this but clutter the code
|
// we could avoid this but clutter the code
|
||||||
@ -65,22 +56,30 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent mem size check
|
|
||||||
if (parser.command() == "config" && action == slsDetectorDefs::PUT_ACTION) {
|
if (parser.command() == "config" && action == slsDetectorDefs::PUT_ACTION) {
|
||||||
sls::freeSharedMemory(parser.multi_id());
|
sls::freeSharedMemory(parser.multi_id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sls::InferAction inferAction = sls::InferAction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::unique_ptr<sls::Detector> det{nullptr};
|
if (action == -1) {
|
||||||
if (action != slsDetectorDefs::HELP_ACTION) {
|
action = inferAction.infer(parser);
|
||||||
det = sls::make_unique<sls::Detector>(parser.multi_id());
|
std::string actionString =
|
||||||
}
|
(action == slsDetectorDefs::GET_ACTION) ? "GET" : "PUT";
|
||||||
sls::CmdProxy proxy(det.get());
|
std::cout << "inferred action: " << actionString << std::endl;
|
||||||
proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
|
|
||||||
action, std::cout, parser.receiver_id());
|
|
||||||
} catch (const sls::RuntimeError &e) {
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<sls::Detector> d{nullptr};
|
||||||
|
if (action != slsDetectorDefs::HELP_ACTION) {
|
||||||
|
d = sls::make_unique<sls::Detector>(parser.multi_id());
|
||||||
|
}
|
||||||
|
sls::Caller c(d.get());
|
||||||
|
|
||||||
|
c.call(parser.command(), parser.arguments(), parser.detector_id(),
|
||||||
|
action, std::cout, parser.receiver_id());
|
||||||
|
} catch (sls::RuntimeError &e) {
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
@ -20,7 +20,6 @@ reason that the header file is not exposed.
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
class CmdParser {
|
class CmdParser {
|
||||||
public:
|
public:
|
||||||
void Parse(int argc, const char *const argv[]);
|
void Parse(int argc, const char *const argv[]);
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
#include "sls/detectorData.h"
|
#include "sls/detectorData.h"
|
||||||
|
|
||||||
#include "CmdParser.h"
|
#include "CmdParser.h"
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "CtbConfig.h"
|
#include "CtbConfig.h"
|
||||||
#include "DetectorImpl.h"
|
#include "DetectorImpl.h"
|
||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
@ -91,11 +91,11 @@ void Detector::loadParameters(const std::string &fname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Detector::loadParameters(const std::vector<std::string> ¶meters) {
|
void Detector::loadParameters(const std::vector<std::string> ¶meters) {
|
||||||
CmdProxy proxy(this);
|
Caller caller(this);
|
||||||
CmdParser parser;
|
CmdParser parser;
|
||||||
for (const auto ¤t_line : parameters) {
|
for (const auto ¤t_line : parameters) {
|
||||||
parser.Parse(current_line);
|
parser.Parse(current_line);
|
||||||
proxy.Call(parser.command(), parser.arguments(), parser.detector_id(),
|
caller.call(parser.command(), parser.arguments(), parser.detector_id(),
|
||||||
defs::PUT_ACTION, std::cout, parser.receiver_id());
|
defs::PUT_ACTION, std::cout, parser.receiver_id());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
319
slsDetectorSoftware/src/HelpDacs.cpp
Normal file
319
slsDetectorSoftware/src/HelpDacs.cpp
Normal file
@ -0,0 +1,319 @@
|
|||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#include "sls/string_utils.h"
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
std::string GetHelpDac(std::string dac) {
|
||||||
|
if (sls::is_int(dac)) {
|
||||||
|
return std::string("[dac name] [dac or mV value] [(optional unit) mV] "
|
||||||
|
"\n\t[Ctb] Use dac index for dac name.");
|
||||||
|
}
|
||||||
|
if (dac == "vthreshold") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
|
||||||
|
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
|
||||||
|
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same "
|
||||||
|
"value. \n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value "
|
||||||
|
"for enabled counters.");
|
||||||
|
}
|
||||||
|
if (dac == "vsvp") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? ");
|
||||||
|
}
|
||||||
|
if (dac == "vsvn") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
||||||
|
"Dac for ?? \n\t[Mythen3] voltage to define "
|
||||||
|
"feedback resistance of the first shaper");
|
||||||
|
}
|
||||||
|
if (dac == "vtrim") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? "
|
||||||
|
"\n\t[Mythen3] Dac for the voltage defining the trim bit size.");
|
||||||
|
}
|
||||||
|
if (dac == "vrpreamp") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
||||||
|
"Dac for ?? \n\t[Mythen3] voltage to define the "
|
||||||
|
"preamplifier feedback resistance.");
|
||||||
|
}
|
||||||
|
if (dac == "vrshaper") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
||||||
|
"Dac for ?? \n\t[Mythen3] voltage to define "
|
||||||
|
"feedback resistance of the first shaper");
|
||||||
|
}
|
||||||
|
if (dac == "vtgstv") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcmp_ll") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcmp_lr") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcal") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcmp_rl") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcmp_rr") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "rxb_rb") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "rxb_lb") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcp") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcn") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vishaper") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "iodelay") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vref_ds") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard][Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcascn_pb") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vcascp_pb") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vout_cm") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
|
||||||
|
}
|
||||||
|
if (dac == "vcasc_out") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vin_cm") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
|
||||||
|
}
|
||||||
|
if (dac == "vref_comp") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard][Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "ib_test_c") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vrshaper_n") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage to "
|
||||||
|
"define feedback resistance of the second shaper.");
|
||||||
|
}
|
||||||
|
if (dac == "vipre") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
|
||||||
|
}
|
||||||
|
if (dac == "vdcsh") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"reference (DC) voltage for the shaper.");
|
||||||
|
}
|
||||||
|
if (dac == "vth1") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for first "
|
||||||
|
"detector threshold voltage. Overwrites even if counter disabled.");
|
||||||
|
}
|
||||||
|
if (dac == "vth2") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
|
||||||
|
"second detector threshold voltage. Overwrites even if counter "
|
||||||
|
"disabled.");
|
||||||
|
}
|
||||||
|
if (dac == "vth3") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for third "
|
||||||
|
"detector threshold voltage. Overwrites even if counter disabled.");
|
||||||
|
}
|
||||||
|
if (dac == "vcal_n") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"low voltage for analog pulsing.");
|
||||||
|
}
|
||||||
|
if (dac == "vcal_p") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"high voltage for analog pulsing.");
|
||||||
|
}
|
||||||
|
if (dac == "vcassh") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"shaper's cascode voltage.");
|
||||||
|
}
|
||||||
|
if (dac == "vcas") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"preamplifier's cascode voltage.");
|
||||||
|
}
|
||||||
|
if (dac == "vicin") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
||||||
|
"bias current for the comparator.");
|
||||||
|
}
|
||||||
|
if (dac == "vipre_out") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
|
||||||
|
"preamplifier's output transistor current.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_h_adc") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"reference voltage high of ADC.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_comp_fe") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"comparator current of analogue front end.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_comp_adc") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"comparator current of ADC.");
|
||||||
|
}
|
||||||
|
if (dac == "vcom_cds") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"common mode voltage of CDS stage.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_rstore") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard2] Dac for reference charging voltage "
|
||||||
|
"of temparory storage cell in high gain.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_opa_1st") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac for "
|
||||||
|
"opa current for driving the other DACs in chip.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_comp_fe") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"reference voltage of the comparator of analogue front end.");
|
||||||
|
}
|
||||||
|
if (dac == "vcom_adc1") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"common mode voltage of ADC DAC bank 1.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_prech") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Gotthard2][Jungfrau] "
|
||||||
|
"Dac for reference votlage for precharing the preamplifier.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_l_adc") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"reference voltage low for ADC.");
|
||||||
|
}
|
||||||
|
if (dac == "vref_cds") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"reference voltage of CDS applied to the temporary storage cell in "
|
||||||
|
"medium and low gain.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_cs") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"current injection into preamplifier.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_opa_fd") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"current for CDS opa stage.");
|
||||||
|
}
|
||||||
|
if (dac == "vcom_adc2") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
||||||
|
"common mode voltage of ADC DAC bank 2.");
|
||||||
|
}
|
||||||
|
if (dac == "vb_ds") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vb_comp") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vb_pixbuf") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vin_com") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vdd_prot") {
|
||||||
|
return std::string("[dac or mV value][(optional unit) mV] "
|
||||||
|
"\n\t[Jungfrau] Dac for ??");
|
||||||
|
}
|
||||||
|
if (dac == "vbp_colbuf") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
|
||||||
|
}
|
||||||
|
if (dac == "vb_sda") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
|
||||||
|
}
|
||||||
|
if (dac == "vcasc_sfp") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
|
||||||
|
}
|
||||||
|
if (dac == "vipre_cds") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
|
||||||
|
}
|
||||||
|
if (dac == "ibias_sfp") {
|
||||||
|
return std::string(
|
||||||
|
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
|
||||||
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
if (dac == "vtgstv") { return std::string(""); }
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
throw sls::RuntimeError("Unknown dac command");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetHelpDacWrapper(const std::string &cmd,
|
||||||
|
const std::vector<std::string> &args) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (args.size() == 0) {
|
||||||
|
os << GetHelpDac(std::to_string(0)) << '\n';
|
||||||
|
} else {
|
||||||
|
os << args[0] << ' ' << GetHelpDac(args[0]) << '\n';
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
@ -1,305 +1,13 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "sls/string_utils.h"
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
|
|
||||||
std::string GetHelpDac(std::string dac) {
|
std::string GetHelpDac(std::string dac);
|
||||||
if (sls::is_int(dac)) {
|
|
||||||
return std::string("[dac name] [dac or mV value] [(optional unit) mV] "
|
|
||||||
"\n\t[Ctb] Use dac index for dac name.");
|
|
||||||
}
|
|
||||||
if (dac == "vthreshold") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger][Mythen3] "
|
|
||||||
"Detector threshold voltage for single photon counters.\n\t[Eiger] "
|
|
||||||
"Sets vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr and vcp to the same "
|
|
||||||
"value. \n\t[Mythen3] Sets vth1, vth2 and vth3 to the same value "
|
|
||||||
"for enabled counters.");
|
|
||||||
}
|
|
||||||
if (dac == "vsvp") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? ");
|
|
||||||
}
|
|
||||||
if (dac == "vsvn") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
|
||||||
"Dac for ?? \n\t[Mythen3] voltage to define "
|
|
||||||
"feedback resistance of the first shaper");
|
|
||||||
}
|
|
||||||
if (dac == "vtrim") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ?? "
|
|
||||||
"\n\t[Mythen3] Dac for the voltage defining the trim bit size.");
|
|
||||||
}
|
|
||||||
if (dac == "vrpreamp") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
|
||||||
"Dac for ?? \n\t[Mythen3] voltage to define the "
|
|
||||||
"preamplifier feedback resistance.");
|
|
||||||
}
|
|
||||||
if (dac == "vrshaper") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] \n\t[Eiger] "
|
|
||||||
"Dac for ?? \n\t[Mythen3] voltage to define "
|
|
||||||
"feedback resistance of the first shaper");
|
|
||||||
}
|
|
||||||
if (dac == "vtgstv") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcmp_ll") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcmp_lr") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcal") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcmp_rl") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcmp_rr") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "rxb_rb") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "rxb_lb") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcp") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcn") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vishaper") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "iodelay") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Eiger] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vref_ds") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard][Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcascn_pb") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vcascp_pb") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vout_cm") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 5");
|
|
||||||
}
|
|
||||||
if (dac == "vcasc_out") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vin_cm") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard] Dac for ??\n\t[Moench] Dac for 2");
|
|
||||||
}
|
|
||||||
if (dac == "vref_comp") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard][Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "ib_test_c") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vrshaper_n") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] voltage to "
|
|
||||||
"define feedback resistance of the second shaper.");
|
|
||||||
}
|
|
||||||
if (dac == "vipre") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"preamplifier's input transistor current.\n\t[Moench] Dac for 1");
|
|
||||||
}
|
|
||||||
if (dac == "vdcsh") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"reference (DC) voltage for the shaper.");
|
|
||||||
}
|
|
||||||
if (dac == "vth1") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for first "
|
|
||||||
"detector threshold voltage. Overwrites even if counter disabled.");
|
|
||||||
}
|
|
||||||
if (dac == "vth2") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
|
|
||||||
"second detector threshold voltage. Overwrites even if counter "
|
|
||||||
"disabled.");
|
|
||||||
}
|
|
||||||
if (dac == "vth3") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for third "
|
|
||||||
"detector threshold voltage. Overwrites even if counter disabled.");
|
|
||||||
}
|
|
||||||
if (dac == "vcal_n") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"low voltage for analog pulsing.");
|
|
||||||
}
|
|
||||||
if (dac == "vcal_p") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"high voltage for analog pulsing.");
|
|
||||||
}
|
|
||||||
if (dac == "vcassh") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"shaper's cascode voltage.");
|
|
||||||
}
|
|
||||||
if (dac == "vcas") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"preamplifier's cascode voltage.");
|
|
||||||
}
|
|
||||||
if (dac == "vicin") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for the "
|
|
||||||
"bias current for the comparator.");
|
|
||||||
}
|
|
||||||
if (dac == "vipre_out") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Mythen3] Dac for "
|
|
||||||
"preamplifier's output transistor current.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_h_adc") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"reference voltage high of ADC.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_comp_fe") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"comparator current of analogue front end.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_comp_adc") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"comparator current of ADC.");
|
|
||||||
}
|
|
||||||
if (dac == "vcom_cds") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"common mode voltage of CDS stage.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_rstore") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard2] Dac for reference charging voltage "
|
|
||||||
"of temparory storage cell in high gain.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_opa_1st") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] dac dac for "
|
|
||||||
"opa current for driving the other DACs in chip.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_comp_fe") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"reference voltage of the comparator of analogue front end.");
|
|
||||||
}
|
|
||||||
if (dac == "vcom_adc1") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"common mode voltage of ADC DAC bank 1.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_prech") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Gotthard2][Jungfrau] "
|
|
||||||
"Dac for reference votlage for precharing the preamplifier.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_l_adc") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"reference voltage low for ADC.");
|
|
||||||
}
|
|
||||||
if (dac == "vref_cds") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"reference voltage of CDS applied to the temporary storage cell in "
|
|
||||||
"medium and low gain.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_cs") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"current injection into preamplifier.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_opa_fd") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"current for CDS opa stage.");
|
|
||||||
}
|
|
||||||
if (dac == "vcom_adc2") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
|
|
||||||
"common mode voltage of ADC DAC bank 2.");
|
|
||||||
}
|
|
||||||
if (dac == "vb_ds") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vb_comp") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vb_pixbuf") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vin_com") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vdd_prot") {
|
|
||||||
return std::string("[dac or mV value][(optional unit) mV] "
|
|
||||||
"\n\t[Jungfrau] Dac for ??");
|
|
||||||
}
|
|
||||||
if (dac == "vbp_colbuf") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 0");
|
|
||||||
}
|
|
||||||
if (dac == "vb_sda") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 3");
|
|
||||||
}
|
|
||||||
if (dac == "vcasc_sfp") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 4");
|
|
||||||
}
|
|
||||||
if (dac == "vipre_cds") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 6");
|
|
||||||
}
|
|
||||||
if (dac == "ibias_sfp") {
|
|
||||||
return std::string(
|
|
||||||
"[dac or mV value][(optional unit) mV] \n\t[Moench] Dac for 7");
|
|
||||||
}
|
|
||||||
|
|
||||||
// clang-format off
|
std::string GetHelpDacWrapper(const std::string &cmd,
|
||||||
if (dac == "vtgstv") { return std::string(""); }
|
const std::vector<std::string> &args);
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
throw sls::RuntimeError("Unknown dac command");
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
4592
slsDetectorSoftware/src/inferAction.cpp
Normal file
4592
slsDetectorSoftware/src/inferAction.cpp
Normal file
File diff suppressed because it is too large
Load Diff
681
slsDetectorSoftware/src/inferAction.h
Normal file
681
slsDetectorSoftware/src/inferAction.h
Normal file
@ -0,0 +1,681 @@
|
|||||||
|
#include "CmdParser.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
class InferAction {
|
||||||
|
public:
|
||||||
|
InferAction() {}
|
||||||
|
int infer(sls::CmdParser &parser, std::ostream &os = std::cout);
|
||||||
|
std::vector<std::string> args;
|
||||||
|
std::string cmd;
|
||||||
|
|
||||||
|
// generated functions
|
||||||
|
int acquire();
|
||||||
|
int activate();
|
||||||
|
int adcclk();
|
||||||
|
int adcenable();
|
||||||
|
int adcenable10g();
|
||||||
|
int adcindex();
|
||||||
|
int adcinvert();
|
||||||
|
int adclist();
|
||||||
|
int adcname();
|
||||||
|
int adcphase();
|
||||||
|
int adcpipeline();
|
||||||
|
int adcreg();
|
||||||
|
int adcvpp();
|
||||||
|
int apulse();
|
||||||
|
int asamples();
|
||||||
|
int autocompdisable();
|
||||||
|
int badchannels();
|
||||||
|
int blockingtrigger();
|
||||||
|
int burstmode();
|
||||||
|
int burstperiod();
|
||||||
|
int bursts();
|
||||||
|
int burstsl();
|
||||||
|
int bustest();
|
||||||
|
int cdsgain();
|
||||||
|
int chipversion();
|
||||||
|
int clearbit();
|
||||||
|
int clearbusy();
|
||||||
|
int clearroi();
|
||||||
|
int clientversion();
|
||||||
|
int clkdiv();
|
||||||
|
int clkfreq();
|
||||||
|
int clkphase();
|
||||||
|
int column();
|
||||||
|
int compdisabletime();
|
||||||
|
int confadc();
|
||||||
|
int config();
|
||||||
|
int counters();
|
||||||
|
int currentsource();
|
||||||
|
int dac();
|
||||||
|
int dacindex();
|
||||||
|
int daclist();
|
||||||
|
int dacname();
|
||||||
|
int dacvalues();
|
||||||
|
int datastream();
|
||||||
|
int dbitclk();
|
||||||
|
int dbitphase();
|
||||||
|
int dbitpipeline();
|
||||||
|
int defaultdac();
|
||||||
|
int defaultpattern();
|
||||||
|
int delay();
|
||||||
|
int delayl();
|
||||||
|
int detectorserverversion();
|
||||||
|
int detsize();
|
||||||
|
int diodelay();
|
||||||
|
int dpulse();
|
||||||
|
int dr();
|
||||||
|
int drlist();
|
||||||
|
int dsamples();
|
||||||
|
int execcommand();
|
||||||
|
int exptime();
|
||||||
|
int exptime1();
|
||||||
|
int exptime2();
|
||||||
|
int exptime3();
|
||||||
|
int exptimel();
|
||||||
|
int extrastoragecells();
|
||||||
|
int extsampling();
|
||||||
|
int extsamplingsrc();
|
||||||
|
int extsig();
|
||||||
|
int fformat();
|
||||||
|
int filtercells();
|
||||||
|
int filterresistor();
|
||||||
|
int findex();
|
||||||
|
int firmwaretest();
|
||||||
|
int firmwareversion();
|
||||||
|
int fliprows();
|
||||||
|
int flowcontrol10g();
|
||||||
|
int fmaster();
|
||||||
|
int fname();
|
||||||
|
int foverwrite();
|
||||||
|
int fpath();
|
||||||
|
int framecounter();
|
||||||
|
int frames();
|
||||||
|
int framesl();
|
||||||
|
int frametime();
|
||||||
|
int free();
|
||||||
|
int fwrite();
|
||||||
|
int gaincaps();
|
||||||
|
int gainmode();
|
||||||
|
int gappixels();
|
||||||
|
int gatedelay();
|
||||||
|
int gatedelay1();
|
||||||
|
int gatedelay2();
|
||||||
|
int gatedelay3();
|
||||||
|
int gates();
|
||||||
|
int getbit();
|
||||||
|
int hardwareversion();
|
||||||
|
int highvoltage();
|
||||||
|
int hostname();
|
||||||
|
int im_a();
|
||||||
|
int im_b();
|
||||||
|
int im_c();
|
||||||
|
int im_d();
|
||||||
|
int im_io();
|
||||||
|
int imagetest();
|
||||||
|
int initialchecks();
|
||||||
|
int inj_ch();
|
||||||
|
int interpolation();
|
||||||
|
int interruptsubframe();
|
||||||
|
int kernelversion();
|
||||||
|
int lastclient();
|
||||||
|
int led();
|
||||||
|
int lock();
|
||||||
|
int master();
|
||||||
|
int maxadcphaseshift();
|
||||||
|
int maxclkphaseshift();
|
||||||
|
int maxdbitphaseshift();
|
||||||
|
int measuredperiod();
|
||||||
|
int measuredsubperiod();
|
||||||
|
int moduleid();
|
||||||
|
int nextframenumber();
|
||||||
|
int nmod();
|
||||||
|
int numinterfaces();
|
||||||
|
int overflow();
|
||||||
|
int packageversion();
|
||||||
|
int parallel();
|
||||||
|
int parameters();
|
||||||
|
int partialreset();
|
||||||
|
int patfname();
|
||||||
|
int patioctrl();
|
||||||
|
int patlimits();
|
||||||
|
int patloop();
|
||||||
|
int patloop0();
|
||||||
|
int patloop1();
|
||||||
|
int patloop2();
|
||||||
|
int patmask();
|
||||||
|
int patnloop();
|
||||||
|
int patnloop0();
|
||||||
|
int patnloop1();
|
||||||
|
int patnloop2();
|
||||||
|
int patsetbit();
|
||||||
|
int pattern();
|
||||||
|
int patternstart();
|
||||||
|
int patwait();
|
||||||
|
int patwait0();
|
||||||
|
int patwait1();
|
||||||
|
int patwait2();
|
||||||
|
int patwaittime();
|
||||||
|
int patwaittime0();
|
||||||
|
int patwaittime1();
|
||||||
|
int patwaittime2();
|
||||||
|
int patword();
|
||||||
|
int pedestalmode();
|
||||||
|
int period();
|
||||||
|
int periodl();
|
||||||
|
int polarity();
|
||||||
|
int port();
|
||||||
|
int powerchip();
|
||||||
|
int powerindex();
|
||||||
|
int powerlist();
|
||||||
|
int powername();
|
||||||
|
int powervalues();
|
||||||
|
int programfpga();
|
||||||
|
int pulse();
|
||||||
|
int pulsechip();
|
||||||
|
int pulsenmove();
|
||||||
|
int pumpprobe();
|
||||||
|
int quad();
|
||||||
|
int ratecorr();
|
||||||
|
int readnrows();
|
||||||
|
int readout();
|
||||||
|
int readoutspeed();
|
||||||
|
int readoutspeedlist();
|
||||||
|
int rebootcontroller();
|
||||||
|
int reg();
|
||||||
|
int resetdacs();
|
||||||
|
int resetfpga();
|
||||||
|
int roi();
|
||||||
|
int romode();
|
||||||
|
int row();
|
||||||
|
int runclk();
|
||||||
|
int runtime();
|
||||||
|
int rx_arping();
|
||||||
|
int rx_clearroi();
|
||||||
|
int rx_dbitlist();
|
||||||
|
int rx_dbitoffset();
|
||||||
|
int rx_discardpolicy();
|
||||||
|
int rx_fifodepth();
|
||||||
|
int rx_frameindex();
|
||||||
|
int rx_framescaught();
|
||||||
|
int rx_framesperfile();
|
||||||
|
int rx_hostname();
|
||||||
|
int rx_jsonaddheader();
|
||||||
|
int rx_jsonpara();
|
||||||
|
int rx_lastclient();
|
||||||
|
int rx_lock();
|
||||||
|
int rx_missingpackets();
|
||||||
|
int rx_padding();
|
||||||
|
int rx_printconfig();
|
||||||
|
int rx_realudpsocksize();
|
||||||
|
int rx_roi();
|
||||||
|
int rx_silent();
|
||||||
|
int rx_start();
|
||||||
|
int rx_status();
|
||||||
|
int rx_stop();
|
||||||
|
int rx_tcpport();
|
||||||
|
int rx_threads();
|
||||||
|
int rx_udpsocksize();
|
||||||
|
int rx_version();
|
||||||
|
int rx_zmqfreq();
|
||||||
|
int rx_zmqhwm();
|
||||||
|
int rx_zmqip();
|
||||||
|
int rx_zmqport();
|
||||||
|
int rx_zmqstartfnum();
|
||||||
|
int rx_zmqstream();
|
||||||
|
int samples();
|
||||||
|
int savepattern();
|
||||||
|
int scan();
|
||||||
|
int scanerrmsg();
|
||||||
|
int selinterface();
|
||||||
|
int serialnumber();
|
||||||
|
int setbit();
|
||||||
|
int settings();
|
||||||
|
int settingslist();
|
||||||
|
int settingspath();
|
||||||
|
int signalindex();
|
||||||
|
int signallist();
|
||||||
|
int signalname();
|
||||||
|
int slowadc();
|
||||||
|
int slowadcindex();
|
||||||
|
int slowadclist();
|
||||||
|
int slowadcname();
|
||||||
|
int slowadcvalues();
|
||||||
|
int start();
|
||||||
|
int status();
|
||||||
|
int stop();
|
||||||
|
int stopport();
|
||||||
|
int storagecell_delay();
|
||||||
|
int storagecell_start();
|
||||||
|
int subdeadtime();
|
||||||
|
int subexptime();
|
||||||
|
int sync();
|
||||||
|
int syncclk();
|
||||||
|
int temp_10ge();
|
||||||
|
int temp_adc();
|
||||||
|
int temp_control();
|
||||||
|
int temp_dcdc();
|
||||||
|
int temp_event();
|
||||||
|
int temp_fpga();
|
||||||
|
int temp_fpgaext();
|
||||||
|
int temp_fpgafl();
|
||||||
|
int temp_fpgafr();
|
||||||
|
int temp_slowadc();
|
||||||
|
int temp_sodl();
|
||||||
|
int temp_sodr();
|
||||||
|
int temp_threshold();
|
||||||
|
int templist();
|
||||||
|
int tempvalues();
|
||||||
|
int tengiga();
|
||||||
|
int threshold();
|
||||||
|
int timing();
|
||||||
|
int timinglist();
|
||||||
|
int timingsource();
|
||||||
|
int top();
|
||||||
|
int transceiverenable();
|
||||||
|
int trigger();
|
||||||
|
int triggers();
|
||||||
|
int triggersl();
|
||||||
|
int trimbits();
|
||||||
|
int trimen();
|
||||||
|
int trimval();
|
||||||
|
int tsamples();
|
||||||
|
int txdelay();
|
||||||
|
int txdelay_frame();
|
||||||
|
int txdelay_left();
|
||||||
|
int txdelay_right();
|
||||||
|
int type();
|
||||||
|
int udp_cleardst();
|
||||||
|
int udp_dstip();
|
||||||
|
int udp_dstip2();
|
||||||
|
int udp_dstlist();
|
||||||
|
int udp_dstmac();
|
||||||
|
int udp_dstmac2();
|
||||||
|
int udp_dstport();
|
||||||
|
int udp_dstport2();
|
||||||
|
int udp_firstdst();
|
||||||
|
int udp_numdst();
|
||||||
|
int udp_reconfigure();
|
||||||
|
int udp_srcip();
|
||||||
|
int udp_srcip2();
|
||||||
|
int udp_srcmac();
|
||||||
|
int udp_srcmac2();
|
||||||
|
int udp_validate();
|
||||||
|
int update();
|
||||||
|
int updatedetectorserver();
|
||||||
|
int updatekernel();
|
||||||
|
int updatemode();
|
||||||
|
int user();
|
||||||
|
int v_a();
|
||||||
|
int v_b();
|
||||||
|
int v_c();
|
||||||
|
int v_chip();
|
||||||
|
int v_d();
|
||||||
|
int v_io();
|
||||||
|
int v_limit();
|
||||||
|
int vchip_comp_adc();
|
||||||
|
int vchip_comp_fe();
|
||||||
|
int vchip_cs();
|
||||||
|
int vchip_opa_1st();
|
||||||
|
int vchip_opa_fd();
|
||||||
|
int vchip_ref_comp_fe();
|
||||||
|
int versions();
|
||||||
|
int veto();
|
||||||
|
int vetoalg();
|
||||||
|
int vetofile();
|
||||||
|
int vetophoton();
|
||||||
|
int vetoref();
|
||||||
|
int vetostream();
|
||||||
|
int virtualFunction();
|
||||||
|
int vm_a();
|
||||||
|
int vm_b();
|
||||||
|
int vm_c();
|
||||||
|
int vm_d();
|
||||||
|
int vm_io();
|
||||||
|
int zmqhwm();
|
||||||
|
int zmqip();
|
||||||
|
int zmqport();
|
||||||
|
// int frames();
|
||||||
|
|
||||||
|
private:
|
||||||
|
using FunctionMap = std::map<std::string, int (InferAction::*)()>;
|
||||||
|
FunctionMap functions{
|
||||||
|
// generated functions
|
||||||
|
|
||||||
|
{"acquire", &InferAction::acquire},
|
||||||
|
{"activate", &InferAction::activate},
|
||||||
|
{"adcclk", &InferAction::adcclk},
|
||||||
|
{"adcenable", &InferAction::adcenable},
|
||||||
|
{"adcenable10g", &InferAction::adcenable10g},
|
||||||
|
{"adcindex", &InferAction::adcindex},
|
||||||
|
{"adcinvert", &InferAction::adcinvert},
|
||||||
|
{"adclist", &InferAction::adclist},
|
||||||
|
{"adcname", &InferAction::adcname},
|
||||||
|
{"adcphase", &InferAction::adcphase},
|
||||||
|
{"adcpipeline", &InferAction::adcpipeline},
|
||||||
|
{"adcreg", &InferAction::adcreg},
|
||||||
|
{"adcvpp", &InferAction::adcvpp},
|
||||||
|
{"apulse", &InferAction::apulse},
|
||||||
|
{"asamples", &InferAction::asamples},
|
||||||
|
{"autocompdisable", &InferAction::autocompdisable},
|
||||||
|
{"badchannels", &InferAction::badchannels},
|
||||||
|
{"blockingtrigger", &InferAction::blockingtrigger},
|
||||||
|
{"burstmode", &InferAction::burstmode},
|
||||||
|
{"burstperiod", &InferAction::burstperiod},
|
||||||
|
{"bursts", &InferAction::bursts},
|
||||||
|
{"burstsl", &InferAction::burstsl},
|
||||||
|
{"bustest", &InferAction::bustest},
|
||||||
|
{"cdsgain", &InferAction::cdsgain},
|
||||||
|
{"chipversion", &InferAction::chipversion},
|
||||||
|
{"clearbit", &InferAction::clearbit},
|
||||||
|
{"clearbusy", &InferAction::clearbusy},
|
||||||
|
{"clearroi", &InferAction::clearroi},
|
||||||
|
{"clientversion", &InferAction::clientversion},
|
||||||
|
{"clkdiv", &InferAction::clkdiv},
|
||||||
|
{"clkfreq", &InferAction::clkfreq},
|
||||||
|
{"clkphase", &InferAction::clkphase},
|
||||||
|
{"column", &InferAction::column},
|
||||||
|
{"compdisabletime", &InferAction::compdisabletime},
|
||||||
|
{"confadc", &InferAction::confadc},
|
||||||
|
{"config", &InferAction::config},
|
||||||
|
{"counters", &InferAction::counters},
|
||||||
|
{"currentsource", &InferAction::currentsource},
|
||||||
|
{"dac", &InferAction::dac},
|
||||||
|
{"dacindex", &InferAction::dacindex},
|
||||||
|
{"daclist", &InferAction::daclist},
|
||||||
|
{"dacname", &InferAction::dacname},
|
||||||
|
{"dacvalues", &InferAction::dacvalues},
|
||||||
|
{"datastream", &InferAction::datastream},
|
||||||
|
{"dbitclk", &InferAction::dbitclk},
|
||||||
|
{"dbitphase", &InferAction::dbitphase},
|
||||||
|
{"dbitpipeline", &InferAction::dbitpipeline},
|
||||||
|
{"defaultdac", &InferAction::defaultdac},
|
||||||
|
{"defaultpattern", &InferAction::defaultpattern},
|
||||||
|
{"delay", &InferAction::delay},
|
||||||
|
{"delayl", &InferAction::delayl},
|
||||||
|
{"detectorserverversion", &InferAction::detectorserverversion},
|
||||||
|
{"detsize", &InferAction::detsize},
|
||||||
|
{"diodelay", &InferAction::diodelay},
|
||||||
|
{"dpulse", &InferAction::dpulse},
|
||||||
|
{"dr", &InferAction::dr},
|
||||||
|
{"drlist", &InferAction::drlist},
|
||||||
|
{"dsamples", &InferAction::dsamples},
|
||||||
|
{"execcommand", &InferAction::execcommand},
|
||||||
|
{"exptime", &InferAction::exptime},
|
||||||
|
{"exptime1", &InferAction::exptime1},
|
||||||
|
{"exptime2", &InferAction::exptime2},
|
||||||
|
{"exptime3", &InferAction::exptime3},
|
||||||
|
{"exptimel", &InferAction::exptimel},
|
||||||
|
{"extrastoragecells", &InferAction::extrastoragecells},
|
||||||
|
{"extsampling", &InferAction::extsampling},
|
||||||
|
{"extsamplingsrc", &InferAction::extsamplingsrc},
|
||||||
|
{"extsig", &InferAction::extsig},
|
||||||
|
{"fformat", &InferAction::fformat},
|
||||||
|
{"filtercells", &InferAction::filtercells},
|
||||||
|
{"filterresistor", &InferAction::filterresistor},
|
||||||
|
{"findex", &InferAction::findex},
|
||||||
|
{"firmwaretest", &InferAction::firmwaretest},
|
||||||
|
{"firmwareversion", &InferAction::firmwareversion},
|
||||||
|
{"fliprows", &InferAction::fliprows},
|
||||||
|
{"flowcontrol10g", &InferAction::flowcontrol10g},
|
||||||
|
{"fmaster", &InferAction::fmaster},
|
||||||
|
{"fname", &InferAction::fname},
|
||||||
|
{"foverwrite", &InferAction::foverwrite},
|
||||||
|
{"fpath", &InferAction::fpath},
|
||||||
|
{"framecounter", &InferAction::framecounter},
|
||||||
|
{"frames", &InferAction::frames},
|
||||||
|
{"framesl", &InferAction::framesl},
|
||||||
|
{"frametime", &InferAction::frametime},
|
||||||
|
{"free", &InferAction::free},
|
||||||
|
{"fwrite", &InferAction::fwrite},
|
||||||
|
{"gaincaps", &InferAction::gaincaps},
|
||||||
|
{"gainmode", &InferAction::gainmode},
|
||||||
|
{"gappixels", &InferAction::gappixels},
|
||||||
|
{"gatedelay", &InferAction::gatedelay},
|
||||||
|
{"gatedelay1", &InferAction::gatedelay1},
|
||||||
|
{"gatedelay2", &InferAction::gatedelay2},
|
||||||
|
{"gatedelay3", &InferAction::gatedelay3},
|
||||||
|
{"gates", &InferAction::gates},
|
||||||
|
{"getbit", &InferAction::getbit},
|
||||||
|
{"hardwareversion", &InferAction::hardwareversion},
|
||||||
|
{"highvoltage", &InferAction::highvoltage},
|
||||||
|
{"hostname", &InferAction::hostname},
|
||||||
|
{"im_a", &InferAction::im_a},
|
||||||
|
{"im_b", &InferAction::im_b},
|
||||||
|
{"im_c", &InferAction::im_c},
|
||||||
|
{"im_d", &InferAction::im_d},
|
||||||
|
{"im_io", &InferAction::im_io},
|
||||||
|
{"imagetest", &InferAction::imagetest},
|
||||||
|
{"initialchecks", &InferAction::initialchecks},
|
||||||
|
{"inj_ch", &InferAction::inj_ch},
|
||||||
|
{"interpolation", &InferAction::interpolation},
|
||||||
|
{"interruptsubframe", &InferAction::interruptsubframe},
|
||||||
|
{"kernelversion", &InferAction::kernelversion},
|
||||||
|
{"lastclient", &InferAction::lastclient},
|
||||||
|
{"led", &InferAction::led},
|
||||||
|
{"lock", &InferAction::lock},
|
||||||
|
{"master", &InferAction::master},
|
||||||
|
{"maxadcphaseshift", &InferAction::maxadcphaseshift},
|
||||||
|
{"maxclkphaseshift", &InferAction::maxclkphaseshift},
|
||||||
|
{"maxdbitphaseshift", &InferAction::maxdbitphaseshift},
|
||||||
|
{"measuredperiod", &InferAction::measuredperiod},
|
||||||
|
{"measuredsubperiod", &InferAction::measuredsubperiod},
|
||||||
|
{"moduleid", &InferAction::moduleid},
|
||||||
|
{"nextframenumber", &InferAction::nextframenumber},
|
||||||
|
{"nmod", &InferAction::nmod},
|
||||||
|
{"numinterfaces", &InferAction::numinterfaces},
|
||||||
|
{"overflow", &InferAction::overflow},
|
||||||
|
{"packageversion", &InferAction::packageversion},
|
||||||
|
{"parallel", &InferAction::parallel},
|
||||||
|
{"parameters", &InferAction::parameters},
|
||||||
|
{"partialreset", &InferAction::partialreset},
|
||||||
|
{"patfname", &InferAction::patfname},
|
||||||
|
{"patioctrl", &InferAction::patioctrl},
|
||||||
|
{"patlimits", &InferAction::patlimits},
|
||||||
|
{"patloop", &InferAction::patloop},
|
||||||
|
{"patloop0", &InferAction::patloop0},
|
||||||
|
{"patloop1", &InferAction::patloop1},
|
||||||
|
{"patloop2", &InferAction::patloop2},
|
||||||
|
{"patmask", &InferAction::patmask},
|
||||||
|
{"patnloop", &InferAction::patnloop},
|
||||||
|
{"patnloop0", &InferAction::patnloop0},
|
||||||
|
{"patnloop1", &InferAction::patnloop1},
|
||||||
|
{"patnloop2", &InferAction::patnloop2},
|
||||||
|
{"patsetbit", &InferAction::patsetbit},
|
||||||
|
{"patternX", &InferAction::pattern},
|
||||||
|
{"patternstart", &InferAction::patternstart},
|
||||||
|
{"patwait", &InferAction::patwait},
|
||||||
|
{"patwait0", &InferAction::patwait0},
|
||||||
|
{"patwait1", &InferAction::patwait1},
|
||||||
|
{"patwait2", &InferAction::patwait2},
|
||||||
|
{"patwaittime", &InferAction::patwaittime},
|
||||||
|
{"patwaittime0", &InferAction::patwaittime0},
|
||||||
|
{"patwaittime1", &InferAction::patwaittime1},
|
||||||
|
{"patwaittime2", &InferAction::patwaittime2},
|
||||||
|
{"patword", &InferAction::patword},
|
||||||
|
{"pedestalmode", &InferAction::pedestalmode},
|
||||||
|
{"period", &InferAction::period},
|
||||||
|
{"periodl", &InferAction::periodl},
|
||||||
|
{"polarity", &InferAction::polarity},
|
||||||
|
{"port", &InferAction::port},
|
||||||
|
{"powerchip", &InferAction::powerchip},
|
||||||
|
{"powerindex", &InferAction::powerindex},
|
||||||
|
{"powerlist", &InferAction::powerlist},
|
||||||
|
{"powername", &InferAction::powername},
|
||||||
|
{"powervalues", &InferAction::powervalues},
|
||||||
|
{"programfpga", &InferAction::programfpga},
|
||||||
|
{"pulse", &InferAction::pulse},
|
||||||
|
{"pulsechip", &InferAction::pulsechip},
|
||||||
|
{"pulsenmove", &InferAction::pulsenmove},
|
||||||
|
{"pumpprobe", &InferAction::pumpprobe},
|
||||||
|
{"quad", &InferAction::quad},
|
||||||
|
{"ratecorr", &InferAction::ratecorr},
|
||||||
|
{"readnrows", &InferAction::readnrows},
|
||||||
|
{"readout", &InferAction::readout},
|
||||||
|
{"readoutspeed", &InferAction::readoutspeed},
|
||||||
|
{"readoutspeedlist", &InferAction::readoutspeedlist},
|
||||||
|
{"rebootcontroller", &InferAction::rebootcontroller},
|
||||||
|
{"reg", &InferAction::reg},
|
||||||
|
{"resetdacs", &InferAction::resetdacs},
|
||||||
|
{"resetfpga", &InferAction::resetfpga},
|
||||||
|
{"roi", &InferAction::roi},
|
||||||
|
{"romode", &InferAction::romode},
|
||||||
|
{"row", &InferAction::row},
|
||||||
|
{"runclk", &InferAction::runclk},
|
||||||
|
{"runtime", &InferAction::runtime},
|
||||||
|
{"rx_arping", &InferAction::rx_arping},
|
||||||
|
{"rx_clearroi", &InferAction::rx_clearroi},
|
||||||
|
{"rx_dbitlist", &InferAction::rx_dbitlist},
|
||||||
|
{"rx_dbitoffset", &InferAction::rx_dbitoffset},
|
||||||
|
{"rx_discardpolicy", &InferAction::rx_discardpolicy},
|
||||||
|
{"rx_fifodepth", &InferAction::rx_fifodepth},
|
||||||
|
{"rx_frameindex", &InferAction::rx_frameindex},
|
||||||
|
{"rx_framescaught", &InferAction::rx_framescaught},
|
||||||
|
{"rx_framesperfile", &InferAction::rx_framesperfile},
|
||||||
|
{"rx_hostname", &InferAction::rx_hostname},
|
||||||
|
{"rx_jsonaddheader", &InferAction::rx_jsonaddheader},
|
||||||
|
{"rx_jsonpara", &InferAction::rx_jsonpara},
|
||||||
|
{"rx_lastclient", &InferAction::rx_lastclient},
|
||||||
|
{"rx_lock", &InferAction::rx_lock},
|
||||||
|
{"rx_missingpackets", &InferAction::rx_missingpackets},
|
||||||
|
{"rx_padding", &InferAction::rx_padding},
|
||||||
|
{"rx_printconfig", &InferAction::rx_printconfig},
|
||||||
|
{"rx_realudpsocksize", &InferAction::rx_realudpsocksize},
|
||||||
|
{"rx_roi", &InferAction::rx_roi},
|
||||||
|
{"rx_silent", &InferAction::rx_silent},
|
||||||
|
{"rx_start", &InferAction::rx_start},
|
||||||
|
{"rx_status", &InferAction::rx_status},
|
||||||
|
{"rx_stop", &InferAction::rx_stop},
|
||||||
|
{"rx_tcpport", &InferAction::rx_tcpport},
|
||||||
|
{"rx_threads", &InferAction::rx_threads},
|
||||||
|
{"rx_udpsocksize", &InferAction::rx_udpsocksize},
|
||||||
|
{"rx_version", &InferAction::rx_version},
|
||||||
|
{"rx_zmqfreq", &InferAction::rx_zmqfreq},
|
||||||
|
{"rx_zmqhwm", &InferAction::rx_zmqhwm},
|
||||||
|
{"rx_zmqip", &InferAction::rx_zmqip},
|
||||||
|
{"rx_zmqport", &InferAction::rx_zmqport},
|
||||||
|
{"rx_zmqstartfnum", &InferAction::rx_zmqstartfnum},
|
||||||
|
{"rx_zmqstream", &InferAction::rx_zmqstream},
|
||||||
|
{"samples", &InferAction::samples},
|
||||||
|
{"savepattern", &InferAction::savepattern},
|
||||||
|
{"scan", &InferAction::scan},
|
||||||
|
{"scanerrmsg", &InferAction::scanerrmsg},
|
||||||
|
{"selinterface", &InferAction::selinterface},
|
||||||
|
{"serialnumber", &InferAction::serialnumber},
|
||||||
|
{"setbit", &InferAction::setbit},
|
||||||
|
{"settings", &InferAction::settings},
|
||||||
|
{"settingslist", &InferAction::settingslist},
|
||||||
|
{"settingspath", &InferAction::settingspath},
|
||||||
|
{"signalindex", &InferAction::signalindex},
|
||||||
|
{"signallist", &InferAction::signallist},
|
||||||
|
{"signalname", &InferAction::signalname},
|
||||||
|
{"slowadc", &InferAction::slowadc},
|
||||||
|
{"slowadcindex", &InferAction::slowadcindex},
|
||||||
|
{"slowadclist", &InferAction::slowadclist},
|
||||||
|
{"slowadcname", &InferAction::slowadcname},
|
||||||
|
{"slowadcvalues", &InferAction::slowadcvalues},
|
||||||
|
{"start", &InferAction::start},
|
||||||
|
{"status", &InferAction::status},
|
||||||
|
{"stop", &InferAction::stop},
|
||||||
|
{"stopport", &InferAction::stopport},
|
||||||
|
{"storagecell_delay", &InferAction::storagecell_delay},
|
||||||
|
{"storagecell_start", &InferAction::storagecell_start},
|
||||||
|
{"subdeadtime", &InferAction::subdeadtime},
|
||||||
|
{"subexptime", &InferAction::subexptime},
|
||||||
|
{"sync", &InferAction::sync},
|
||||||
|
{"syncclk", &InferAction::syncclk},
|
||||||
|
{"temp_10ge", &InferAction::temp_10ge},
|
||||||
|
{"temp_adc", &InferAction::temp_adc},
|
||||||
|
{"temp_control", &InferAction::temp_control},
|
||||||
|
{"temp_dcdc", &InferAction::temp_dcdc},
|
||||||
|
{"temp_event", &InferAction::temp_event},
|
||||||
|
{"temp_fpga", &InferAction::temp_fpga},
|
||||||
|
{"temp_fpgaext", &InferAction::temp_fpgaext},
|
||||||
|
{"temp_fpgafl", &InferAction::temp_fpgafl},
|
||||||
|
{"temp_fpgafr", &InferAction::temp_fpgafr},
|
||||||
|
{"temp_slowadc", &InferAction::temp_slowadc},
|
||||||
|
{"temp_sodl", &InferAction::temp_sodl},
|
||||||
|
{"temp_sodr", &InferAction::temp_sodr},
|
||||||
|
{"temp_threshold", &InferAction::temp_threshold},
|
||||||
|
{"templist", &InferAction::templist},
|
||||||
|
{"tempvalues", &InferAction::tempvalues},
|
||||||
|
{"tengiga", &InferAction::tengiga},
|
||||||
|
{"threshold", &InferAction::threshold},
|
||||||
|
{"thresholdnotb", &InferAction::threshold},
|
||||||
|
{"timing", &InferAction::timing},
|
||||||
|
{"timinglist", &InferAction::timinglist},
|
||||||
|
{"timingsource", &InferAction::timingsource},
|
||||||
|
{"top", &InferAction::top},
|
||||||
|
{"transceiverenable", &InferAction::transceiverenable},
|
||||||
|
{"trigger", &InferAction::trigger},
|
||||||
|
{"triggers", &InferAction::triggers},
|
||||||
|
{"triggersl", &InferAction::triggersl},
|
||||||
|
{"trimbits", &InferAction::trimbits},
|
||||||
|
{"trimen", &InferAction::trimen},
|
||||||
|
{"trimval", &InferAction::trimval},
|
||||||
|
{"tsamples", &InferAction::tsamples},
|
||||||
|
{"txdelay", &InferAction::txdelay},
|
||||||
|
{"txdelay_frame", &InferAction::txdelay_frame},
|
||||||
|
{"txdelay_left", &InferAction::txdelay_left},
|
||||||
|
{"txdelay_right", &InferAction::txdelay_right},
|
||||||
|
{"type", &InferAction::type},
|
||||||
|
{"udp_cleardst", &InferAction::udp_cleardst},
|
||||||
|
{"udp_dstip", &InferAction::udp_dstip},
|
||||||
|
{"udp_dstip2", &InferAction::udp_dstip2},
|
||||||
|
{"udp_dstlist", &InferAction::udp_dstlist},
|
||||||
|
{"udp_dstmac", &InferAction::udp_dstmac},
|
||||||
|
{"udp_dstmac2", &InferAction::udp_dstmac2},
|
||||||
|
{"udp_dstport", &InferAction::udp_dstport},
|
||||||
|
{"udp_dstport2", &InferAction::udp_dstport2},
|
||||||
|
{"udp_firstdst", &InferAction::udp_firstdst},
|
||||||
|
{"udp_numdst", &InferAction::udp_numdst},
|
||||||
|
{"udp_reconfigure", &InferAction::udp_reconfigure},
|
||||||
|
{"udp_srcip", &InferAction::udp_srcip},
|
||||||
|
{"udp_srcip2", &InferAction::udp_srcip2},
|
||||||
|
{"udp_srcmac", &InferAction::udp_srcmac},
|
||||||
|
{"udp_srcmac2", &InferAction::udp_srcmac2},
|
||||||
|
{"udp_validate", &InferAction::udp_validate},
|
||||||
|
{"update", &InferAction::update},
|
||||||
|
{"updatedetectorserver", &InferAction::updatedetectorserver},
|
||||||
|
{"updatekernel", &InferAction::updatekernel},
|
||||||
|
{"updatemode", &InferAction::updatemode},
|
||||||
|
{"user", &InferAction::user},
|
||||||
|
{"v_a", &InferAction::v_a},
|
||||||
|
{"v_b", &InferAction::v_b},
|
||||||
|
{"v_c", &InferAction::v_c},
|
||||||
|
{"v_chip", &InferAction::v_chip},
|
||||||
|
{"v_d", &InferAction::v_d},
|
||||||
|
{"v_io", &InferAction::v_io},
|
||||||
|
{"v_limit", &InferAction::v_limit},
|
||||||
|
{"vchip_comp_adc", &InferAction::vchip_comp_adc},
|
||||||
|
{"vchip_comp_fe", &InferAction::vchip_comp_fe},
|
||||||
|
{"vchip_cs", &InferAction::vchip_cs},
|
||||||
|
{"vchip_opa_1st", &InferAction::vchip_opa_1st},
|
||||||
|
{"vchip_opa_fd", &InferAction::vchip_opa_fd},
|
||||||
|
{"vchip_ref_comp_fe", &InferAction::vchip_ref_comp_fe},
|
||||||
|
{"versions", &InferAction::versions},
|
||||||
|
{"veto", &InferAction::veto},
|
||||||
|
{"vetoalg", &InferAction::vetoalg},
|
||||||
|
{"vetofile", &InferAction::vetofile},
|
||||||
|
{"vetophoton", &InferAction::vetophoton},
|
||||||
|
{"vetoref", &InferAction::vetoref},
|
||||||
|
{"vetostream", &InferAction::vetostream},
|
||||||
|
{"virtual", &InferAction::virtualFunction},
|
||||||
|
{"vm_a", &InferAction::vm_a},
|
||||||
|
{"vm_b", &InferAction::vm_b},
|
||||||
|
{"vm_c", &InferAction::vm_c},
|
||||||
|
{"vm_d", &InferAction::vm_d},
|
||||||
|
{"vm_io", &InferAction::vm_io},
|
||||||
|
{"zmqhwm", &InferAction::zmqhwm},
|
||||||
|
{"zmqip", &InferAction::zmqip},
|
||||||
|
{"zmqport", &InferAction::zmqport}
|
||||||
|
|
||||||
|
// {"frames",&InferAction::frames}
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sls
|
@ -1,24 +1,32 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
|
|
||||||
target_sources(tests PRIVATE
|
target_sources(tests PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-SharedMemory.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-SharedMemory.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-slsDetector.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-rx.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-pattern.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-rx.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-eiger.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-pattern.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-jungfrau.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-eiger.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-mythen3.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-jungfrau.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard2.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-mythen3.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-gotthard.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard2.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-chiptestboard.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-moench.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-chiptestboard.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdProxy-global.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-moench.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-global.cpp
|
||||||
|
|
||||||
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-Result.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdParser.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-CmdParser.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Module.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-Module.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-Pattern.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-Pattern.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/test-CtbConfig.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/test-CtbConfig.cpp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(tests
|
target_include_directories(tests
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -19,137 +19,143 @@ using test::PUT;
|
|||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
TEST_CASE("temp_fpgaext", "[.cmd]") {
|
TEST_CASE("CALLER::temp_fpgaext", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgaext", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_fpgaext", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgaext", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_fpgaext", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgaext "));
|
std::string s = (oss.str()).erase(0, strlen("temp_fpgaext "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_fpgaext", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_fpgaext", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_10ge", "[.cmd]") {
|
TEST_CASE("CALLER::temp_10ge", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_10ge", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_10ge", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_10ge", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_10ge", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_10ge "));
|
std::string s = (oss.str()).erase(0, strlen("temp_10ge "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_10ge", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_10ge", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_dcdc", "[.cmd]") {
|
TEST_CASE("CALLER::temp_dcdc", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_dcdc", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_dcdc", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_dcdc", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_dcdc", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_dcdc "));
|
std::string s = (oss.str()).erase(0, strlen("temp_dcdc "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_dcdc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_dcdc", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_sodl", "[.cmd]") {
|
TEST_CASE("CALLER::temp_sodl", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_sodl", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_sodl", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_sodl", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_sodl", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_sodl "));
|
std::string s = (oss.str()).erase(0, strlen("temp_sodl "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_sodl", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_sodl", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_sodr", "[.cmd]") {
|
TEST_CASE("CALLER::temp_sodr", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_sodr", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_sodr", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_sodr", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_sodr", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_sodr "));
|
std::string s = (oss.str()).erase(0, strlen("temp_sodr "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_sodr", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_sodr", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_fpgafl", "[.cmd]") {
|
TEST_CASE("CALLER::temp_fpgafl", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafl", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_fpgafl", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafl", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_fpgafl", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgafl "));
|
std::string s = (oss.str()).erase(0, strlen("temp_fpgafl "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_fpgafl", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_fpgafl", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_fpgafr", "[.cmd]") {
|
TEST_CASE("CALLER::temp_fpgafr", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafr", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("temp_fpgafr", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("temp_fpgafr", {}, 0, GET, oss));
|
REQUIRE_NOTHROW(caller.call("temp_fpgafr", {}, 0, GET, oss));
|
||||||
std::string s = (oss.str()).erase(0, strlen("temp_fpgafr "));
|
std::string s = (oss.str()).erase(0, strlen("temp_fpgafr "));
|
||||||
REQUIRE(std::stoi(s) != -1);
|
REQUIRE(std::stoi(s) != -1);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_fpgafr", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_fpgafr", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
TEST_CASE("CALLER::Setting and reading back EIGER dacs", "[.cmdcall][.dacs]") {
|
||||||
// vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
|
// vsvp, vtr, vrf, vrs, vsvn, vtgstv, vcmp_ll, vcmp_lr, vcal, vcmp_rl,
|
||||||
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
// rxb_rb, rxb_lb, vcmp_rr, vcp, vcn, vis, vthreshold
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
SECTION("vsvp") { test_dac(defs::VSVP, "vsvp", 5); }
|
SECTION("vsvp") { test_dac_caller(defs::VSVP, "vsvp", 5); }
|
||||||
SECTION("vtrim") { test_dac(defs::VTRIM, "vtrim", 1200); }
|
SECTION("vtrim") { test_dac_caller(defs::VTRIM, "vtrim", 1200); }
|
||||||
SECTION("vrpreamp") { test_dac(defs::VRPREAMP, "vrpreamp", 1500); }
|
SECTION("vrpreamp") {
|
||||||
SECTION("vrshaper") { test_dac(defs::VRSHAPER, "vrshaper", 1510); }
|
test_dac_caller(defs::VRPREAMP, "vrpreamp", 1500);
|
||||||
SECTION("vsvn") { test_dac(defs::VSVN, "vsvn", 3800); }
|
}
|
||||||
SECTION("vtgstv") { test_dac(defs::VTGSTV, "vtgstv", 2550); }
|
SECTION("vrshaper") {
|
||||||
SECTION("vcmp_ll") { test_dac(defs::VCMP_LL, "vcmp_ll", 1400); }
|
test_dac_caller(defs::VRSHAPER, "vrshaper", 1510);
|
||||||
SECTION("vcmp_lr") { test_dac(defs::VCMP_LR, "vcmp_lr", 1400); }
|
}
|
||||||
SECTION("vcal") { test_dac(defs::VCAL, "vcal", 1400); }
|
SECTION("vsvn") { test_dac_caller(defs::VSVN, "vsvn", 3800); }
|
||||||
SECTION("vcmp_rl") { test_dac(defs::VCMP_RL, "vcmp_rl", 1400); }
|
SECTION("vtgstv") { test_dac_caller(defs::VTGSTV, "vtgstv", 2550); }
|
||||||
SECTION("rxb_rb") { test_dac(defs::RXB_RB, "rxb_rb", 1400); }
|
SECTION("vcmp_ll") { test_dac_caller(defs::VCMP_LL, "vcmp_ll", 1400); }
|
||||||
SECTION("rxb_lb") { test_dac(defs::RXB_LB, "rxb_lb", 1400); }
|
SECTION("vcmp_lr") { test_dac_caller(defs::VCMP_LR, "vcmp_lr", 1400); }
|
||||||
SECTION("vcmp_rr") { test_dac(defs::VCMP_RR, "vcmp_rr", 1400); }
|
SECTION("vcal") { test_dac_caller(defs::VCAL, "vcal", 1400); }
|
||||||
SECTION("vcp") { test_dac(defs::VCP, "vcp", 1400); }
|
SECTION("vcmp_rl") { test_dac_caller(defs::VCMP_RL, "vcmp_rl", 1400); }
|
||||||
SECTION("vcn") { test_dac(defs::VCN, "vcn", 1400); }
|
SECTION("rxb_rb") { test_dac_caller(defs::RXB_RB, "rxb_rb", 1400); }
|
||||||
SECTION("vishaper") { test_dac(defs::VISHAPER, "vishaper", 1400); }
|
SECTION("rxb_lb") { test_dac_caller(defs::RXB_LB, "rxb_lb", 1400); }
|
||||||
SECTION("iodelay") { test_dac(defs::IO_DELAY, "iodelay", 1400); }
|
SECTION("vcmp_rr") { test_dac_caller(defs::VCMP_RR, "vcmp_rr", 1400); }
|
||||||
|
SECTION("vcp") { test_dac_caller(defs::VCP, "vcp", 1400); }
|
||||||
|
SECTION("vcn") { test_dac_caller(defs::VCN, "vcn", 1400); }
|
||||||
|
SECTION("vishaper") {
|
||||||
|
test_dac_caller(defs::VISHAPER, "vishaper", 1400);
|
||||||
|
}
|
||||||
|
SECTION("iodelay") { test_dac_caller(defs::IO_DELAY, "iodelay", 1400); }
|
||||||
SECTION("vthreshold") {
|
SECTION("vthreshold") {
|
||||||
// Read out individual vcmp to be able to reset after
|
// Read out individual vcmp to be able to reset after
|
||||||
// the test is done
|
// the test is done
|
||||||
@ -161,12 +167,12 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vthreshold", {"1234"}, -1, PUT, oss);
|
caller.call("dac", {"vthreshold", "1234"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vthreshold", {}, -1, GET, oss);
|
caller.call("dac", {"vthreshold"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,54 +186,54 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// gotthard
|
// gotthard
|
||||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcascn_pb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcascp_pb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vout_cm", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcasc_out", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vin_cm", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("ib_test_c", {}, -1, GET));
|
||||||
// mythen3
|
// mythen3
|
||||||
// REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper_n", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrshaper_n", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vipre", {}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vdcsh", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth1", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth2", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth3", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_n", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcal_n", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_p", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcal_p", {}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcassh", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcas", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vicin", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vipre_out", {}, -1, GET));
|
||||||
// gotthard2
|
// gotthard2
|
||||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_h_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_comp_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_rstore", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_opa_1st", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_adc1", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_l_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_cs", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_opa_fd", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_adc2", {}, -1, GET));
|
||||||
// jungfrau
|
// jungfrau
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_comp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vdd_prot", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vin_com", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_prech", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_pixbuf", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_ds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,116 +241,116 @@ TEST_CASE("Setting and reading back EIGER dacs", "[.cmd][.dacs]") {
|
|||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
TEST_CASE("txdelay_left", "[.cmd]") {
|
TEST_CASE("CALLER::txdelay_left", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getTransmissionDelayLeft();
|
auto prev_val = det.getTransmissionDelayLeft();
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("txdelay_left", {"5000"}, -1, PUT, oss1);
|
caller.call("txdelay_left", {"5000"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "txdelay_left 5000\n");
|
REQUIRE(oss1.str() == "txdelay_left 5000\n");
|
||||||
proxy.Call("txdelay_left", {}, -1, GET, oss2);
|
caller.call("txdelay_left", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "txdelay_left 5000\n");
|
REQUIRE(oss2.str() == "txdelay_left 5000\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setTransmissionDelayLeft(prev_val[i]);
|
det.setTransmissionDelayLeft(prev_val[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("txdelay_left", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("txdelay_left", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("txdelay_right", "[.cmd]") {
|
TEST_CASE("CALLER::txdelay_right", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getTransmissionDelayRight();
|
auto prev_val = det.getTransmissionDelayRight();
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("txdelay_right", {"5000"}, -1, PUT, oss1);
|
caller.call("txdelay_right", {"5000"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "txdelay_right 5000\n");
|
REQUIRE(oss1.str() == "txdelay_right 5000\n");
|
||||||
proxy.Call("txdelay_right", {}, -1, GET, oss2);
|
caller.call("txdelay_right", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "txdelay_right 5000\n");
|
REQUIRE(oss2.str() == "txdelay_right 5000\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setTransmissionDelayRight(prev_val[i]);
|
det.setTransmissionDelayRight(prev_val[i]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("txdelay_right", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("txdelay_right", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Eiger Specific */
|
/* Eiger Specific */
|
||||||
|
|
||||||
TEST_CASE("subexptime", "[.cmd]") {
|
TEST_CASE("CALLER::subexptime", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto time = det.getSubExptime();
|
auto time = det.getSubExptime();
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("subexptime", {"2.5us"}, -1, PUT, oss1);
|
caller.call("subexptime", {"2.5us"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "subexptime 2.5us\n");
|
REQUIRE(oss1.str() == "subexptime 2.5us\n");
|
||||||
proxy.Call("subexptime", {}, -1, GET, oss2);
|
caller.call("subexptime", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "subexptime 2.5us\n");
|
REQUIRE(oss2.str() == "subexptime 2.5us\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setSubExptime(time[i], {i});
|
det.setSubExptime(time[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("subexptime", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("subexptime", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("subexptime", {"2.13"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("subexptime", {"2.13"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("subdeadtime", "[.cmd]") {
|
TEST_CASE("CALLER::subdeadtime", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto time = det.getSubDeadTime();
|
auto time = det.getSubDeadTime();
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("subdeadtime", {"500us"}, -1, PUT, oss1);
|
caller.call("subdeadtime", {"500us"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "subdeadtime 500us\n");
|
REQUIRE(oss1.str() == "subdeadtime 500us\n");
|
||||||
proxy.Call("subdeadtime", {}, -1, GET, oss2);
|
caller.call("subdeadtime", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "subdeadtime 500us\n");
|
REQUIRE(oss2.str() == "subdeadtime 500us\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setSubDeadTime(time[i], {i});
|
det.setSubDeadTime(time[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("subdeadtime", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("subdeadtime", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("subdeadtime", {"2.13"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("subdeadtime", {"2.13"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("overflow", "[.cmd]") {
|
TEST_CASE("CALLER::overflow", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto previous = det.getOverFlowMode();
|
auto previous = det.getOverFlowMode();
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("overflow", {"1"}, -1, PUT, oss1);
|
caller.call("overflow", {"1"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "overflow 1\n");
|
REQUIRE(oss1.str() == "overflow 1\n");
|
||||||
proxy.Call("overflow", {}, -1, GET, oss2);
|
caller.call("overflow", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "overflow 1\n");
|
REQUIRE(oss2.str() == "overflow 1\n");
|
||||||
proxy.Call("overflow", {"0"}, -1, PUT, oss3);
|
caller.call("overflow", {"0"}, -1, PUT, oss3);
|
||||||
REQUIRE(oss3.str() == "overflow 0\n");
|
REQUIRE(oss3.str() == "overflow 0\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setOverFlowMode(previous[i], {i});
|
det.setOverFlowMode(previous[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("overflow", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("overflow", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("ratecorr", "[.cmd]") {
|
TEST_CASE("CALLER::ratecorr", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
auto prev_dr = det.getDynamicRange().tsquash("inconsistent dr to test");
|
||||||
@ -352,19 +358,19 @@ TEST_CASE("ratecorr", "[.cmd]") {
|
|||||||
det.setDynamicRange(16);
|
det.setDynamicRange(16);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("ratecorr", {"120"}, -1, PUT, oss);
|
caller.call("ratecorr", {"120"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("ratecorr", {}, -1, GET, oss);
|
caller.call("ratecorr", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
REQUIRE(oss.str() == "ratecorr 120ns\n");
|
||||||
}
|
}
|
||||||
// may fail if default settings not loaded
|
// may fail if default settings not loaded
|
||||||
// REQUIRE_NOTHROW(proxy.Call("ratecorr", {"-1"}, -1, PUT));
|
// REQUIRE_NOTHROW(caller.call("ratecorr", {"-1"}, -1, PUT));
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("ratecorr", {"0"}, -1, PUT, oss);
|
caller.call("ratecorr", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "ratecorr 0ns\n");
|
REQUIRE(oss.str() == "ratecorr 0ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -372,37 +378,37 @@ TEST_CASE("ratecorr", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
det.setDynamicRange(prev_dr);
|
det.setDynamicRange(prev_dr);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("ratecorr", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("ratecorr", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("interruptsubframe", "[.cmd]") {
|
TEST_CASE("CALLER::interruptsubframe", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getInterruptSubframe();
|
auto prev_val = det.getInterruptSubframe();
|
||||||
|
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
caller.call("interruptsubframe", {"1"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
REQUIRE(oss1.str() == "interruptsubframe 1\n");
|
||||||
proxy.Call("interruptsubframe", {}, -1, GET, oss2);
|
caller.call("interruptsubframe", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
REQUIRE(oss2.str() == "interruptsubframe 1\n");
|
||||||
proxy.Call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
caller.call("interruptsubframe", {"0"}, -1, PUT, oss3);
|
||||||
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
REQUIRE(oss3.str() == "interruptsubframe 0\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setInterruptSubframe(prev_val[i], {i});
|
det.setInterruptSubframe(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("interruptsubframe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("interruptsubframe", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("interruptsubframe", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("measuredperiod", "[.cmd]") {
|
TEST_CASE("CALLER::measuredperiod", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_frames = det.getNumberOfFrames().tsquash(
|
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||||
@ -416,7 +422,7 @@ TEST_CASE("measuredperiod", "[.cmd]") {
|
|||||||
det.startDetector();
|
det.startDetector();
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("measuredperiod", {}, -1, GET, oss);
|
caller.call("measuredperiod", {}, -1, GET, oss);
|
||||||
std::string st = oss.str();
|
std::string st = oss.str();
|
||||||
std::string s;
|
std::string s;
|
||||||
if (st.find('[') != std::string::npos) {
|
if (st.find('[') != std::string::npos) {
|
||||||
@ -433,13 +439,13 @@ TEST_CASE("measuredperiod", "[.cmd]") {
|
|||||||
det.setNumberOfFrames(prev_frames);
|
det.setNumberOfFrames(prev_frames);
|
||||||
det.setTimingMode(prev_timing);
|
det.setTimingMode(prev_timing);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("measuredperiod", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("measuredperiod", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("measuredsubperiod", "[.cmd]") {
|
TEST_CASE("CALLER::measuredsubperiod", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_frames = det.getNumberOfFrames().tsquash(
|
auto prev_frames = det.getNumberOfFrames().tsquash(
|
||||||
@ -455,7 +461,7 @@ TEST_CASE("measuredsubperiod", "[.cmd]") {
|
|||||||
det.startDetector();
|
det.startDetector();
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("measuredsubperiod", {}, -1, GET, oss);
|
caller.call("measuredsubperiod", {}, -1, GET, oss);
|
||||||
std::string st = oss.str();
|
std::string st = oss.str();
|
||||||
std::string s;
|
std::string s;
|
||||||
if (st.find('[') != std::string::npos) {
|
if (st.find('[') != std::string::npos) {
|
||||||
@ -473,29 +479,29 @@ TEST_CASE("measuredsubperiod", "[.cmd]") {
|
|||||||
det.setTimingMode(prev_timing);
|
det.setTimingMode(prev_timing);
|
||||||
det.setDynamicRange(prev_dr);
|
det.setDynamicRange(prev_dr);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("measuredsubperiod", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("measuredsubperiod", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("activate", "[.cmd]") {
|
TEST_CASE("CALLER::activate", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getActive();
|
auto prev_val = det.getActive();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("activate", {"1"}, -1, PUT, oss);
|
caller.call("activate", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "activate 1\n");
|
REQUIRE(oss.str() == "activate 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("activate", {}, -1, GET, oss);
|
caller.call("activate", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "activate 1\n");
|
REQUIRE(oss.str() == "activate 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("activate", {"0"}, -1, PUT, oss);
|
caller.call("activate", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "activate 0\n");
|
REQUIRE(oss.str() == "activate 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -503,137 +509,137 @@ TEST_CASE("activate", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("activate", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("activate", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("activate", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("activate", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("partialreset", "[.cmd]") {
|
TEST_CASE("CALLER::partialreset", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getPartialReset();
|
auto prev_val = det.getPartialReset();
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("partialreset", {"1"}, -1, PUT, oss1);
|
caller.call("partialreset", {"1"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "partialreset 1\n");
|
REQUIRE(oss1.str() == "partialreset 1\n");
|
||||||
proxy.Call("partialreset", {}, -1, GET, oss2);
|
caller.call("partialreset", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "partialreset 1\n");
|
REQUIRE(oss2.str() == "partialreset 1\n");
|
||||||
proxy.Call("partialreset", {"0"}, -1, PUT, oss3);
|
caller.call("partialreset", {"0"}, -1, PUT, oss3);
|
||||||
REQUIRE(oss3.str() == "partialreset 0\n");
|
REQUIRE(oss3.str() == "partialreset 0\n");
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setPartialReset(prev_val[i], {i});
|
det.setPartialReset(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("partialreset", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("partialreset", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("partialreset", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("partialreset", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulse", "[.cmd]") {
|
TEST_CASE("CALLER::pulse", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulse", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pulse", {"1", "1", "5"}, -1, PUT, oss);
|
caller.call("pulse", {"1", "1", "5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pulse [1, 1, 5]\n");
|
REQUIRE(oss.str() == "pulse [1, 1, 5]\n");
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pulse", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulse", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("pulse", {"1", "1", "5"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("pulse", {"1", "1", "5"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulsenmove", "[.cmd]") {
|
TEST_CASE("CALLER::pulsenmove", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulsenmove", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT, oss);
|
caller.call("pulsenmove", {"1", "1", "5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pulsenmove [1, 1, 5]\n");
|
REQUIRE(oss.str() == "pulsenmove [1, 1, 5]\n");
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulsenmove", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("pulsenmove", {"1", "1", "5"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("pulsenmove", {"1", "1", "5"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pulsechip", "[.cmd]") {
|
TEST_CASE("CALLER::pulsechip", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulsechip", {}, -1, GET));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pulsechip", {"1"}, -1, PUT, oss);
|
caller.call("pulsechip", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pulsechip 1\n");
|
REQUIRE(oss.str() == "pulsechip 1\n");
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pulsechip", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pulsechip", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("pulsechip", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("pulsechip", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("quad", "[.cmd]") {
|
TEST_CASE("CALLER::quad", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getQuad().tsquash("inconsistent quad to test");
|
auto prev_val = det.getQuad().tsquash("inconsistent quad to test");
|
||||||
// Quad only works with a single half module EIGER
|
// Quad only works with a single half module EIGER
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("quad", {}, -1, GET, oss);
|
caller.call("quad", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "quad 0\n");
|
REQUIRE(oss.str() == "quad 0\n");
|
||||||
det.setQuad(prev_val);
|
det.setQuad(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("quad", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("quad", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("datastream", "[.cmd]") {
|
TEST_CASE("CALLER::datastream", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val_left = det.getDataStream(defs::LEFT);
|
auto prev_val_left = det.getDataStream(defs::LEFT);
|
||||||
auto prev_val_right = det.getDataStream(defs::RIGHT);
|
auto prev_val_right = det.getDataStream(defs::RIGHT);
|
||||||
// no "left" or "right"
|
// no "left" or "right"
|
||||||
REQUIRE_THROWS(proxy.Call("datastream", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("datastream", {"1"}, -1, PUT));
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("datastream", {"left", "0"}, -1, PUT, oss);
|
caller.call("datastream", {"left", "0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "datastream left 0\n");
|
REQUIRE(oss.str() == "datastream [left, 0]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("datastream", {"right", "0"}, -1, PUT, oss);
|
caller.call("datastream", {"right", "0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "datastream right 0\n");
|
REQUIRE(oss.str() == "datastream [right, 0]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("datastream", {"left", "1"}, -1, PUT, oss);
|
caller.call("datastream", {"left", "1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "datastream left 1\n");
|
REQUIRE(oss.str() == "datastream [left, 1]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("datastream", {"right", "1"}, -1, PUT, oss);
|
caller.call("datastream", {"right", "1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "datastream right 1\n");
|
REQUIRE(oss.str() == "datastream [right, 1]\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setDataStream(defs::LEFT, prev_val_left[i], {i});
|
det.setDataStream(defs::LEFT, prev_val_left[i], {i});
|
||||||
det.setDataStream(defs::RIGHT, prev_val_right[i], {i});
|
det.setDataStream(defs::RIGHT, prev_val_right[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("datastream", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("datastream", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("datastream", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("datastream", {"1"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("datastream", {"left", "1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("datastream", {"left", "1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("top", "[.cmd]") {
|
TEST_CASE("CALLER::top", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER) {
|
if (det_type == defs::EIGER) {
|
||||||
auto prev_val = det.getTop();
|
auto prev_val = det.getTop();
|
||||||
@ -643,19 +649,19 @@ TEST_CASE("top", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i != numModulesTested; ++i) {
|
for (int i = 0; i != numModulesTested; ++i) {
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("top", {"1"}, i, PUT, oss1);
|
caller.call("top", {"1"}, i, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "top 1\n");
|
REQUIRE(oss1.str() == "top 1\n");
|
||||||
proxy.Call("top", {}, i, GET, oss2);
|
caller.call("top", {}, i, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "top 1\n");
|
REQUIRE(oss2.str() == "top 1\n");
|
||||||
proxy.Call("top", {"0"}, i, PUT, oss3);
|
caller.call("top", {"0"}, i, PUT, oss3);
|
||||||
REQUIRE(oss3.str() == "top 0\n");
|
REQUIRE(oss3.str() == "top 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setTop(prev_val[i], {i});
|
det.setTop(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("top", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("top", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("top", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("top", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
@ -10,12 +10,11 @@ namespace sls {
|
|||||||
|
|
||||||
using test::GET;
|
using test::GET;
|
||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
void test_valid_port_caller(const std::string &command,
|
||||||
void test_valid_port(const std::string &command,
|
const std::vector<std::string> &arguments,
|
||||||
const std::vector<std::string> &arguments, int detector_id,
|
int detector_id, int action) {
|
||||||
int action) {
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
|
|
||||||
std::vector<std::string> arg(arguments);
|
std::vector<std::string> arg(arguments);
|
||||||
if (arg.empty())
|
if (arg.empty())
|
||||||
@ -25,33 +24,34 @@ void test_valid_port(const std::string &command,
|
|||||||
for (int i = 0; i != 3; ++i) {
|
for (int i = 0; i != 3; ++i) {
|
||||||
int port_number = test_values[i];
|
int port_number = test_values[i];
|
||||||
arg[arg.size() - 1] = std::to_string(port_number);
|
arg[arg.size() - 1] = std::to_string(port_number);
|
||||||
REQUIRE_THROWS(proxy.Call(command, arg, detector_id, action));
|
REQUIRE_THROWS(caller.call(command, arg, detector_id, action));
|
||||||
/*REQUIRE_THROWS_WITH(proxy.Call(command, arguments, detector_id,
|
/*REQUIRE_THROWS_WITH(proxy.Call(command, arguments, detector_id,
|
||||||
action), "Invalid port range. Must be between 1 - 65535.");*/
|
action), "Invalid port range. Must be between 1 - 65535.");*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
void test_dac_caller(defs::dacIndex index, const std::string &dacname,
|
||||||
|
int dacvalue) {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
std::ostringstream oss_set, oss_get;
|
std::ostringstream oss_set, oss_get;
|
||||||
auto dacstr = std::to_string(dacvalue);
|
auto dacstr = std::to_string(dacvalue);
|
||||||
auto previous = det.getDAC(index, false);
|
auto previous = det.getDAC(index, false);
|
||||||
// chip test board
|
// chip test board
|
||||||
if (dacname == "dac") {
|
if (dacname == "dac") {
|
||||||
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
auto dacIndexstr = std::to_string(static_cast<int>(index));
|
||||||
proxy.Call(dacname, {dacIndexstr, dacstr}, -1, PUT, oss_set);
|
caller.call(dacname, {dacIndexstr, dacstr}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() ==
|
REQUIRE(oss_set.str() ==
|
||||||
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||||
proxy.Call(dacname, {dacIndexstr}, -1, GET, oss_get);
|
caller.call(dacname, {dacIndexstr}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() ==
|
REQUIRE(oss_get.str() ==
|
||||||
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
dacname + " " + dacIndexstr + " " + dacstr + "\n");
|
||||||
}
|
}
|
||||||
// other detectors
|
// other detectors
|
||||||
else {
|
else {
|
||||||
proxy.Call("dac", {dacname, dacstr}, -1, PUT, oss_set);
|
caller.call("dac", {dacname, dacstr}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() == "dac " + dacname + " " + dacstr + "\n");
|
REQUIRE(oss_set.str() == "dac " + dacname + " " + dacstr + "\n");
|
||||||
proxy.Call("dac", {dacname}, -1, GET, oss_get);
|
caller.call("dac", {dacname}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() == "dac " + dacname + " " + dacstr + "\n");
|
REQUIRE(oss_get.str() == "dac " + dacname + " " + dacstr + "\n");
|
||||||
}
|
}
|
||||||
// Reset all dacs to previous value
|
// Reset all dacs to previous value
|
||||||
@ -60,25 +60,25 @@ void test_dac(defs::dacIndex index, const std::string &dacname, int dacvalue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_onchip_dac(defs::dacIndex index, const std::string &dacname,
|
void test_onchip_dac_caller(defs::dacIndex index, const std::string &dacname,
|
||||||
int dacvalue) {
|
int dacvalue) {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
REQUIRE_THROWS(proxy.Call(dacname, {}, -1, GET));
|
REQUIRE_THROWS(caller.call(dacname, {}, -1, GET));
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
caller.call(dacname, {"10", "0x0"}, -1, PUT)); // chip index (-1 to 9)
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
caller.call(dacname, {"-1", "0x400"}, -1, PUT)); // max val is 0x3ff
|
||||||
|
|
||||||
int chipIndex = -1; // for now, it is -1 only
|
int chipIndex = -1; // for now, it is -1 only
|
||||||
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
auto prev_val = det.getOnChipDAC(index, chipIndex);
|
||||||
auto dacValueStr = ToStringHex(dacvalue);
|
auto dacValueStr = ToStringHex(dacvalue);
|
||||||
auto chipIndexStr = std::to_string(chipIndex);
|
auto chipIndexStr = std::to_string(chipIndex);
|
||||||
std::ostringstream oss_set, oss_get;
|
std::ostringstream oss_set, oss_get;
|
||||||
proxy.Call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
caller.call(dacname, {chipIndexStr, dacValueStr}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() ==
|
REQUIRE(oss_set.str() ==
|
||||||
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||||
proxy.Call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
caller.call(dacname, {chipIndexStr}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() ==
|
REQUIRE(oss_get.str() ==
|
||||||
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
dacname + " " + chipIndexStr + " " + dacValueStr + "\n");
|
||||||
|
|
16
slsDetectorSoftware/tests/Caller/test-Caller-global.h
Normal file
16
slsDetectorSoftware/tests/Caller/test-Caller-global.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// 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"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
void test_valid_port_caller(const std::string &command,
|
||||||
|
const std::vector<std::string> &arguments,
|
||||||
|
int detector_id, int action);
|
||||||
|
|
||||||
|
void test_dac_caller(slsDetectorDefs::dacIndex index,
|
||||||
|
const std::string &dacname, int dacvalue);
|
||||||
|
void test_onchip_dac_caller(slsDetectorDefs::dacIndex index,
|
||||||
|
const std::string &dacname, int dacvalue);
|
||||||
|
|
||||||
|
} // namespace sls
|
175
slsDetectorSoftware/tests/Caller/test-Caller-gotthard.cpp
Normal file
175
slsDetectorSoftware/tests/Caller/test-Caller-gotthard.cpp
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#include "Caller.h"
|
||||||
|
#include "catch.hpp"
|
||||||
|
#include "sls/Detector.h"
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "sls/Result.h"
|
||||||
|
#include "sls/ToString.h"
|
||||||
|
#include "sls/versionAPI.h"
|
||||||
|
#include "test-Caller-global.h"
|
||||||
|
#include "tests/globals.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
using test::GET;
|
||||||
|
using test::PUT;
|
||||||
|
|
||||||
|
/* dacs */
|
||||||
|
|
||||||
|
TEST_CASE("Caller::Setting and reading back GOTTHARD dacs",
|
||||||
|
"[.cmdcall][.dacs]") {
|
||||||
|
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp,
|
||||||
|
// ib_test_c
|
||||||
|
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::GOTTHARD) {
|
||||||
|
SECTION("vref_ds") { test_dac_caller(defs::VREF_DS, "vref_ds", 660); }
|
||||||
|
SECTION("vcascn_pb") {
|
||||||
|
test_dac_caller(defs::VCASCN_PB, "vcascn_pb", 650);
|
||||||
|
}
|
||||||
|
SECTION("vcascp_pb") {
|
||||||
|
test_dac_caller(defs::VCASCP_PB, "vcascp_pb", 1480);
|
||||||
|
}
|
||||||
|
SECTION("vout_cm") { test_dac_caller(defs::VOUT_CM, "vout_cm", 1520); }
|
||||||
|
SECTION("vcasc_out") {
|
||||||
|
test_dac_caller(defs::VCASC_OUT, "vcasc_out", 1320);
|
||||||
|
}
|
||||||
|
SECTION("vin_cm") { test_dac_caller(defs::VIN_CM, "vin_cm", 1350); }
|
||||||
|
SECTION("vref_comp") {
|
||||||
|
test_dac_caller(defs::VREF_COMP, "vref_comp", 350);
|
||||||
|
}
|
||||||
|
SECTION("ib_test_c") {
|
||||||
|
test_dac_caller(defs::IB_TESTC, "ib_test_c", 2001);
|
||||||
|
}
|
||||||
|
// eiger
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vthreshold"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vsvp"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vsvn"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vtrim"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vrpreamp"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vtgstv"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_ll"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_lr"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcal"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rl"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rr"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"rxb_rb"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"rxb_lb"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcp"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcn"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vishaper"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"iodelay"}, -1, GET));
|
||||||
|
// jungfrau
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vdd_prot"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vin_com"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_prech"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_pixbuf"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_ds"}, -1, GET));
|
||||||
|
// REQUIRE_THROWS(caller.call("dac", {"vref_ds"}, -1, GET));
|
||||||
|
// REQUIRE_THROWS(caller.call("dac", {"vref_comp"}, -1, GET));
|
||||||
|
// mythen3
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vrpreamp"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper_n"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vipre"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vishaper"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vdcsh"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vth1"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vth2"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vth3"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcal_n"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcal_p"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vtrim"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcassh"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcas"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vicin"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vipre_out"}, -1, GET));
|
||||||
|
// gotthard2
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_h_adc"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp_fe"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp_adc"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcom_cds"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_rstore"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_opa_1st"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_comp_fe"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcom_adc1"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_l_adc"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vref_cds"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_cs"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vb_opa_fd"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("dac", {"vcom_adc2"}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gotthard Specific */
|
||||||
|
|
||||||
|
TEST_CASE("Caller::roi", "[.cmdcall]") {
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::GOTTHARD) {
|
||||||
|
if (det.size() > 1) {
|
||||||
|
REQUIRE_THROWS(caller.call("roi", {"0", "255"}, -1, PUT));
|
||||||
|
REQUIRE_NOTHROW(caller.call("roi", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
auto prev_val = det.getROI();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
caller.call("roi", {"0", "255"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "roi [0, 255]\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
caller.call("roi", {"256", "511"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "roi [256, 511]\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(caller.call("roi", {"0", "256"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setROI(prev_val[i], i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(caller.call("roi", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Caller::clearroi", "[.cmdcall]") {
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
|
if (det_type == defs::GOTTHARD) {
|
||||||
|
auto prev_val = det.getROI();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
caller.call("clearroi", {}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "clearroi successful\n");
|
||||||
|
}
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setROI(prev_val[i], i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(caller.call("clearroi", {}, -1, PUT));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Caller::exptimel", "[.cmdcall]") {
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::GOTTHARD) {
|
||||||
|
REQUIRE_NOTHROW(caller.call("exptimel", {}, -1, GET));
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(caller.call("exptimel", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
#include "sls/ToString.h"
|
#include "sls/ToString.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -18,21 +18,21 @@ using test::GET;
|
|||||||
using test::PUT;
|
using test::PUT;
|
||||||
|
|
||||||
// time specific measurements for gotthard2
|
// time specific measurements for gotthard2
|
||||||
TEST_CASE("timegotthard2", "[.cmd]") {
|
TEST_CASE("Caller::timegotthard2", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
// exptime
|
// exptime
|
||||||
auto prev_val = det.getExptime();
|
auto prev_val = det.getExptime();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime", {"220ns"}, -1, PUT, oss);
|
caller.call("exptime", {"220ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime 220ns\n");
|
REQUIRE(oss.str() == "exptime 220ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime", {}, -1, GET, oss);
|
caller.call("exptime", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "exptime 221ns\n");
|
REQUIRE(oss.str() == "exptime 221ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -42,12 +42,12 @@ TEST_CASE("timegotthard2", "[.cmd]") {
|
|||||||
prev_val = det.getBurstPeriod();
|
prev_val = det.getBurstPeriod();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstperiod", {"220ns"}, -1, PUT, oss);
|
caller.call("burstperiod", {"220ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "burstperiod 220ns\n");
|
REQUIRE(oss.str() == "burstperiod 220ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstperiod", {}, -1, GET, oss);
|
caller.call("burstperiod", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "burstperiod 221ns\n");
|
REQUIRE(oss.str() == "burstperiod 221ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -57,12 +57,12 @@ TEST_CASE("timegotthard2", "[.cmd]") {
|
|||||||
prev_val = det.getDelayAfterTrigger();
|
prev_val = det.getDelayAfterTrigger();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("delay", {"220ns"}, -1, PUT, oss);
|
caller.call("delay", {"220ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "delay 220ns\n");
|
REQUIRE(oss.str() == "delay 220ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("delay", {}, -1, GET, oss);
|
caller.call("delay", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "delay 221ns\n");
|
REQUIRE(oss.str() == "delay 221ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -74,12 +74,12 @@ TEST_CASE("timegotthard2", "[.cmd]") {
|
|||||||
prev_val = det.getPeriod();
|
prev_val = det.getPeriod();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("period", {"220ns"}, -1, PUT, oss);
|
caller.call("period", {"220ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "period 220ns\n");
|
REQUIRE(oss.str() == "period 220ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("period", {}, -1, GET, oss);
|
caller.call("period", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "period 221ns\n");
|
REQUIRE(oss.str() == "period 221ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -90,12 +90,12 @@ TEST_CASE("timegotthard2", "[.cmd]") {
|
|||||||
prev_val = det.getPeriod();
|
prev_val = det.getPeriod();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("period", {"220ns"}, -1, PUT, oss);
|
caller.call("period", {"220ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "period 220ns\n");
|
REQUIRE(oss.str() == "period 220ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("period", {}, -1, GET, oss);
|
caller.call("period", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "period 221ns\n");
|
REQUIRE(oss.str() == "period 221ns\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -106,180 +106,200 @@ TEST_CASE("timegotthard2", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back GOTTHARD2 dacs", "[.cmd][.dacs]") {
|
TEST_CASE("Caller::Setting and reading back GOTTHARD2 dacs",
|
||||||
|
"[.cmdcall][.dacs]") {
|
||||||
// vref_h_adc, vb_comp_fe, vb_comp_adc, vcom_cds,
|
// vref_h_adc, vb_comp_fe, vb_comp_adc, vcom_cds,
|
||||||
// vref_restore, vb_opa_1st, vref_comp_fe, vcom_adc1,
|
// vref_restore, vb_opa_1st, vref_comp_fe, vcom_adc1,
|
||||||
// vref_prech, vref_l_adc, vref_cds, vb_cs,
|
// vref_prech, vref_l_adc, vref_cds, vb_cs,
|
||||||
// vb_opa_fd, vcom_adc2
|
// vb_opa_fd, vcom_adc2
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vref_h_adc") {
|
SECTION("vref_h_adc") {
|
||||||
test_dac(defs::VREF_H_ADC, "vref_h_adc", 2099);
|
test_dac_caller(defs::VREF_H_ADC, "vref_h_adc", 2099);
|
||||||
|
}
|
||||||
|
SECTION("vb_comp_fe") {
|
||||||
|
test_dac_caller(defs::VB_COMP_FE, "vb_comp_fe", 0);
|
||||||
}
|
}
|
||||||
SECTION("vb_comp_fe") { test_dac(defs::VB_COMP_FE, "vb_comp_fe", 0); }
|
|
||||||
SECTION("vb_comp_adc") {
|
SECTION("vb_comp_adc") {
|
||||||
test_dac(defs::VB_COMP_ADC, "vb_comp_adc", 0);
|
test_dac_caller(defs::VB_COMP_ADC, "vb_comp_adc", 0);
|
||||||
|
}
|
||||||
|
SECTION("vcom_cds") {
|
||||||
|
test_dac_caller(defs::VCOM_CDS, "vcom_cds", 1400);
|
||||||
}
|
}
|
||||||
SECTION("vcom_cds") { test_dac(defs::VCOM_CDS, "vcom_cds", 1400); }
|
|
||||||
SECTION("vref_rstore") {
|
SECTION("vref_rstore") {
|
||||||
test_dac(defs::VREF_RSTORE, "vref_rstore", 640);
|
test_dac_caller(defs::VREF_RSTORE, "vref_rstore", 640);
|
||||||
|
}
|
||||||
|
SECTION("vb_opa_1st") {
|
||||||
|
test_dac_caller(defs::VB_OPA_1ST, "vb_opa_1st", 0);
|
||||||
}
|
}
|
||||||
SECTION("vb_opa_1st") { test_dac(defs::VB_OPA_1ST, "vb_opa_1st", 0); }
|
|
||||||
SECTION("vref_comp_fe") {
|
SECTION("vref_comp_fe") {
|
||||||
test_dac(defs::VREF_COMP_FE, "vref_comp_fe", 0);
|
test_dac_caller(defs::VREF_COMP_FE, "vref_comp_fe", 0);
|
||||||
|
}
|
||||||
|
SECTION("vcom_adc1") {
|
||||||
|
test_dac_caller(defs::VCOM_ADC1, "vcom_adc1", 1400);
|
||||||
}
|
}
|
||||||
SECTION("vcom_adc1") { test_dac(defs::VCOM_ADC1, "vcom_adc1", 1400); }
|
|
||||||
SECTION("vref_prech") {
|
SECTION("vref_prech") {
|
||||||
test_dac(defs::VREF_PRECH, "vref_prech", 1720);
|
test_dac_caller(defs::VREF_PRECH, "vref_prech", 1720);
|
||||||
|
}
|
||||||
|
SECTION("vref_l_adc") {
|
||||||
|
test_dac_caller(defs::VREF_L_ADC, "vref_l_adc", 700);
|
||||||
|
}
|
||||||
|
SECTION("vref_cds") {
|
||||||
|
test_dac_caller(defs::VREF_CDS, "vref_cds", 1200);
|
||||||
|
}
|
||||||
|
SECTION("vb_cs") { test_dac_caller(defs::VB_CS, "vb_cs", 2799); }
|
||||||
|
SECTION("vb_opa_fd") {
|
||||||
|
test_dac_caller(defs::VB_OPA_FD, "vb_opa_fd", 0);
|
||||||
|
}
|
||||||
|
SECTION("vcom_adc2") {
|
||||||
|
test_dac_caller(defs::VCOM_ADC2, "vcom_adc2", 1400);
|
||||||
}
|
}
|
||||||
SECTION("vref_l_adc") { test_dac(defs::VREF_L_ADC, "vref_l_adc", 700); }
|
|
||||||
SECTION("vref_cds") { test_dac(defs::VREF_CDS, "vref_cds", 1200); }
|
|
||||||
SECTION("vb_cs") { test_dac(defs::VB_CS, "vb_cs", 2799); }
|
|
||||||
SECTION("vb_opa_fd") { test_dac(defs::VB_OPA_FD, "vb_opa_fd", 0); }
|
|
||||||
SECTION("vcom_adc2") { test_dac(defs::VCOM_ADC2, "vcom_adc2", 1400); }
|
|
||||||
// eiger
|
// eiger
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vthreshold"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vthreshold"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vsvp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvn"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vsvn"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtrim"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vtrim"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrpreamp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vrpreamp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtgstv"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vtgstv"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_ll"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_ll"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_lr"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_lr"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcal"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rl"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rl"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rr"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rr"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_rb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"rxb_rb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_lb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"rxb_lb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcn"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcn"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vishaper"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vishaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"iodelay"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"iodelay"}, -1, GET));
|
||||||
// gotthard
|
// gotthard
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_ds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_ds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcascn_pb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcascn_pb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcascp_pb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcascp_pb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vout_cm"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vout_cm"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcasc_out"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcasc_out"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vin_cm"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vin_cm"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_comp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_comp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"ib_test_c"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"ib_test_c"}, -1, GET));
|
||||||
// jungfrau
|
// jungfrau
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vdd_prot"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vdd_prot"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vin_com"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vin_com"}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vref_prech"}, -1, GET));
|
// REQUIRE_THROWS(caller.call("dac", {"vref_prech"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_pixbuf"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_pixbuf"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_ds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_ds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_ds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_ds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_comp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_comp"}, -1, GET));
|
||||||
// mythen3
|
// mythen3
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrpreamp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vrpreamp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper_n"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vrshaper_n"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vipre"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vipre"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vishaper"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vishaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vdcsh"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vdcsh"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vth1"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth2"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vth2"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth3"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vth3"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal_n"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcal_n"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal_p"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcal_p"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtrim"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vtrim"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcassh"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcassh"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcas"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcas"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vicin"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vicin"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vipre_out"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vipre_out"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* on chip dacs */
|
/* on chip dacs */
|
||||||
|
|
||||||
TEST_CASE("vchip_comp_fe", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_comp_fe", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_comp_fe") {
|
SECTION("vchip_comp_fe") {
|
||||||
test_onchip_dac(defs::VB_COMP_FE, "vchip_comp_fe", 0x137);
|
test_onchip_dac_caller(defs::VB_COMP_FE, "vchip_comp_fe", 0x137);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_comp_fe", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vchip_opa_1st", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_opa_1st", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_opa_1st") {
|
SECTION("vchip_opa_1st") {
|
||||||
test_onchip_dac(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000);
|
test_onchip_dac_caller(defs::VB_OPA_1ST, "vchip_opa_1st", 0x000);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_opa_1st", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vchip_opa_fd", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_opa_fd", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_opa_fd") {
|
SECTION("vchip_opa_fd") {
|
||||||
test_onchip_dac(defs::VB_OPA_FD, "vchip_opa_fd", 0x134);
|
test_onchip_dac_caller(defs::VB_OPA_FD, "vchip_opa_fd", 0x134);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_opa_fd", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_opa_fd", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vchip_comp_adc", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_comp_adc", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_comp_adc") {
|
SECTION("vchip_comp_adc") {
|
||||||
test_onchip_dac(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF);
|
test_onchip_dac_caller(defs::VB_COMP_ADC, "vchip_comp_adc", 0x3FF);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_comp_adc", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vchip_ref_comp_fe", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_ref_comp_fe", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_ref_comp_fe") {
|
SECTION("vchip_ref_comp_fe") {
|
||||||
test_onchip_dac(defs::VREF_COMP_FE, "vchip_ref_comp_fe", 0x100);
|
test_onchip_dac_caller(defs::VREF_COMP_FE, "vchip_ref_comp_fe",
|
||||||
|
0x100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_ref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_ref_comp_fe", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vchip_cs", "[.cmd][.onchipdacs]") {
|
TEST_CASE("Caller::vchip_cs", "[.cmdcall][.onchipdacs]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
SECTION("vchip_cs") { test_onchip_dac(defs::VB_CS, "vchip_cs", 0x0D0); }
|
SECTION("vchip_cs") {
|
||||||
|
test_onchip_dac_caller(defs::VB_CS, "vchip_cs", 0x0D0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vchip_cs", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vchip_cs", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gotthard2 Specific */
|
/* Gotthard2 Specific */
|
||||||
|
|
||||||
TEST_CASE("bursts", "[.cmd]") {
|
TEST_CASE("Caller::bursts", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_burst =
|
auto prev_burst =
|
||||||
@ -295,26 +315,26 @@ TEST_CASE("bursts", "[.cmd]") {
|
|||||||
det.setTimingMode(defs::AUTO_TIMING);
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {"3"}, -1, PUT, oss);
|
caller.call("bursts", {"3"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("bursts", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("bursts", {"0"}, -1, PUT));
|
||||||
// trigger mode: reg set to 1, but bursts must be same
|
// trigger mode: reg set to 1, but bursts must be same
|
||||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
det.setTimingMode(defs::AUTO_TIMING);
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
// continuous mode: reg set to #frames,
|
// continuous mode: reg set to #frames,
|
||||||
@ -323,19 +343,19 @@ TEST_CASE("bursts", "[.cmd]") {
|
|||||||
det.setNumberOfFrames(2);
|
det.setNumberOfFrames(2);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
det.setTimingMode(defs::TRIGGER_EXPOSURE);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
det.setBurstMode(defs::BURST_INTERNAL);
|
det.setBurstMode(defs::BURST_INTERNAL);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("bursts", {}, -1, GET, oss);
|
caller.call("bursts", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "bursts 3\n");
|
REQUIRE(oss.str() == "bursts 3\n");
|
||||||
}
|
}
|
||||||
// set to previous values
|
// set to previous values
|
||||||
@ -347,122 +367,122 @@ TEST_CASE("bursts", "[.cmd]") {
|
|||||||
det.setBurstMode(prev_burstMode[i], {i});
|
det.setBurstMode(prev_burstMode[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("bursts", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("bursts", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstperiod", "[.cmd]") {
|
TEST_CASE("Caller::burstperiod", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto previous = det.getBurstPeriod();
|
auto previous = det.getBurstPeriod();
|
||||||
|
|
||||||
std::ostringstream oss_set, oss_get;
|
std::ostringstream oss_set, oss_get;
|
||||||
proxy.Call("burstperiod", {"30ms"}, -1, PUT, oss_set);
|
caller.call("burstperiod", {"30ms"}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
|
REQUIRE(oss_set.str() == "burstperiod 30ms\n");
|
||||||
proxy.Call("burstperiod", {}, -1, GET, oss_get);
|
caller.call("burstperiod", {}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
|
REQUIRE(oss_get.str() == "burstperiod 30ms\n");
|
||||||
// Reset to previous value
|
// Reset to previous value
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setBurstPeriod(previous[i], {i});
|
det.setBurstPeriod(previous[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("burstperiod", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("burstperiod", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstsl", "[.cmd]") {
|
TEST_CASE("Caller::burstsl", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("burstsl", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("burstsl", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("burstsl", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("burstsl", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("inj_ch", "[.cmd]") {
|
TEST_CASE("Caller::inj_ch", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
caller.call("inj_ch", {"-1", "1"}, -1, PUT)); // invalid offset
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
caller.call("inj_ch", {"0", "0"}, -1, PUT)); // invalid increment
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
caller.call("inj_ch", {"0", "1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("inj_ch", {}, -1, GET, oss);
|
caller.call("inj_ch", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("inj_ch", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("inj_ch", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetophoton", "[.cmd]") {
|
TEST_CASE("Caller::vetophoton", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetophoton", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetophoton", {"-1"}, -1, GET));
|
||||||
REQUIRE_NOTHROW(
|
REQUIRE_NOTHROW(
|
||||||
proxy.Call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
caller.call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"12", "1", "39950"}, -1,
|
REQUIRE_THROWS(caller.call("vetophoton", {"12", "1", "39950"}, -1,
|
||||||
PUT)); // invalid chip index
|
PUT)); // invalid chip index
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "0"}, -1,
|
REQUIRE_THROWS(caller.call("vetophoton", {"-1", "0"}, -1,
|
||||||
PUT)); // invalid photon number
|
PUT)); // invalid photon number
|
||||||
REQUIRE_THROWS(proxy.Call("vetophoton", {"-1", "1", "39950"}, -1,
|
REQUIRE_THROWS(caller.call("vetophoton", {"-1", "1", "39950"}, -1,
|
||||||
PUT)); // invald file
|
PUT)); // invald file
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
caller.call("vetophoton", {"-1", "/tmp/bla.txt"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetoref", "[.cmd]") {
|
TEST_CASE("Caller::vetoref", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetoref", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x3ff"}, -1,
|
REQUIRE_THROWS(caller.call("vetoref", {"3", "0x3ff"}, -1,
|
||||||
PUT)); // invalid chip index
|
PUT)); // invalid chip index
|
||||||
REQUIRE_NOTHROW(proxy.Call("vetoref", {"1", "0x010"}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("vetoref", {"1", "0x010"}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetoref", {"3", "0x0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("vetoref", {"3", "0x0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetofile", "[.cmd]") {
|
TEST_CASE("Caller::vetofile", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
REQUIRE_THROWS(proxy.Call("vetofile", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetofile", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetofile", {"12", "/tmp/bla.txt"}, -1,
|
REQUIRE_THROWS(caller.call("vetofile", {"12", "/tmp/bla.txt"}, -1,
|
||||||
PUT)); // invalid chip index
|
PUT)); // invalid chip index
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetofile", {"-1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetofile", {"-1"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("burstmode", "[.cmd]") {
|
TEST_CASE("Caller::burstmode", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
@ -470,166 +490,166 @@ TEST_CASE("burstmode", "[.cmd]") {
|
|||||||
auto burststr = ToString(burst);
|
auto burststr = ToString(burst);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {"burst_internal"}, -1, PUT, oss);
|
caller.call("burstmode", {"burst_internal"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "burstmode burst_internal\n");
|
REQUIRE(oss.str() == "burstmode burst_internal\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {"cw_internal"}, -1, PUT, oss);
|
caller.call("burstmode", {"cw_internal"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("burstmode", {}, -1, GET, oss);
|
caller.call("burstmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
REQUIRE(oss.str() == "burstmode cw_internal\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setBurstMode(burst[i], {i});
|
det.setBurstMode(burst[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("burstmode", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("burstmode", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("cdsgain", "[.cmd]") {
|
TEST_CASE("Caller::cdsgain", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val = det.getCDSGain();
|
auto prev_val = det.getCDSGain();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("cdsgain", {"1"}, -1, PUT, oss);
|
caller.call("cdsgain", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "cdsgain 1\n");
|
REQUIRE(oss.str() == "cdsgain 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("cdsgain", {"0"}, -1, PUT, oss);
|
caller.call("cdsgain", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "cdsgain 0\n");
|
REQUIRE(oss.str() == "cdsgain 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("cdsgain", {}, -1, GET, oss);
|
caller.call("cdsgain", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "cdsgain 0\n");
|
REQUIRE(oss.str() == "cdsgain 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setCDSGain(prev_val[i], {i});
|
det.setCDSGain(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("cdsgain", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("cdsgain", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("timingsource", "[.cmd]") {
|
TEST_CASE("Caller::timingsource", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val = det.getTimingSource();
|
auto prev_val = det.getTimingSource();
|
||||||
/* { until its activated in fpga
|
/* { until its activated in fpga
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("timingsource", {"external"}, -1, PUT, oss);
|
caller.call("timingsource", {"external"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "timingsource external\n");
|
REQUIRE(oss.str() == "timingsource external\n");
|
||||||
}*/
|
}*/
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("timingsource", {"internal"}, -1, PUT, oss);
|
caller.call("timingsource", {"internal"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "timingsource internal\n");
|
REQUIRE(oss.str() == "timingsource internal\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("timingsource", {}, -1, GET, oss);
|
caller.call("timingsource", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "timingsource internal\n");
|
REQUIRE(oss.str() == "timingsource internal\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setTimingSource(prev_val[i], {i});
|
det.setTimingSource(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("timingsource", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("timingsource", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("veto", "[.cmd]") {
|
TEST_CASE("Caller::veto", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val = det.getVeto();
|
auto prev_val = det.getVeto();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("veto", {"1"}, -1, PUT, oss);
|
caller.call("veto", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "veto 1\n");
|
REQUIRE(oss.str() == "veto 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("veto", {"0"}, -1, PUT, oss);
|
caller.call("veto", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "veto 0\n");
|
REQUIRE(oss.str() == "veto 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("veto", {}, -1, GET, oss);
|
caller.call("veto", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "veto 0\n");
|
REQUIRE(oss.str() == "veto 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVeto(prev_val[i], {i});
|
det.setVeto(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("veto", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("veto", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetostream", "[.cmd]") {
|
TEST_CASE("Caller::vetostream", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val =
|
auto prev_val =
|
||||||
det.getVetoStream().tsquash("inconsistent veto stream to test");
|
det.getVetoStream().tsquash("inconsistent veto stream to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {"none"}, -1, PUT, oss);
|
caller.call("vetostream", {"none"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetostream none\n");
|
REQUIRE(oss.str() == "vetostream none\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
caller.call("vetostream", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetostream none\n");
|
REQUIRE(oss.str() == "vetostream none\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {"lll"}, -1, PUT, oss);
|
caller.call("vetostream", {"lll"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetostream lll\n");
|
REQUIRE(oss.str() == "vetostream lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
caller.call("vetostream", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetostream lll\n");
|
REQUIRE(oss.str() == "vetostream lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {"lll", "10gbe"}, -1, PUT, oss);
|
caller.call("vetostream", {"lll", "10gbe"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
caller.call("vetostream", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("vetostream", {"lll", "none"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("vetostream", {"lll", "none"}, -1, PUT));
|
||||||
det.setVetoStream(prev_val);
|
det.setVetoStream(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetostream", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetostream", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetostream", {"none"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("vetostream", {"none"}, -1, PUT));
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("vetostream", {"dfgd"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetostream", {"dfgd"}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("vetoalg", "[.cmd]") {
|
TEST_CASE("Caller::vetoalg", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val_lll =
|
auto prev_val_lll =
|
||||||
@ -638,37 +658,37 @@ TEST_CASE("vetoalg", "[.cmd]") {
|
|||||||
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
|
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"hits", "lll"}, -1, PUT, oss);
|
caller.call("vetoalg", {"hits", "lll"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
|
caller.call("vetoalg", {"lll"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
REQUIRE(oss.str() == "vetoalg hits lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"hits", "10gbe"}, -1, PUT, oss);
|
caller.call("vetoalg", {"hits", "10gbe"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"10gbe"}, -1, GET, oss);
|
caller.call("vetoalg", {"10gbe"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"raw", "lll"}, -1, PUT, oss);
|
caller.call("vetoalg", {"raw", "lll"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg raw lll\n");
|
REQUIRE(oss.str() == "vetoalg raw lll\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("vetoalg", {"raw", "10gbe"}, -1, PUT, oss);
|
caller.call("vetoalg", {"raw", "10gbe"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "vetoalg raw 10gbe\n");
|
REQUIRE(oss.str() == "vetoalg raw 10gbe\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
|
caller.call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"hits", "none"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("vetoalg", {"hits", "none"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVetoAlgorithm(prev_val_lll[i],
|
det.setVetoAlgorithm(prev_val_lll[i],
|
||||||
defs::streamingInterface::LOW_LATENCY_LINK,
|
defs::streamingInterface::LOW_LATENCY_LINK,
|
||||||
@ -677,15 +697,15 @@ TEST_CASE("vetoalg", "[.cmd]") {
|
|||||||
defs::streamingInterface::ETHERNET_10GB, {i});
|
defs::streamingInterface::ETHERNET_10GB, {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"lll"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetoalg", {"lll"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"none"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("vetoalg", {"none"}, -1, PUT));
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"dfgd"}, -1, GET));
|
REQUIRE_THROWS(caller.call("vetoalg", {"dfgd"}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("confadc", "[.cmd]") {
|
TEST_CASE("Caller::confadc", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD2) {
|
if (det_type == defs::GOTTHARD2) {
|
||||||
@ -703,20 +723,20 @@ TEST_CASE("confadc", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE_THROWS(proxy.Call("confadc", {"11", "2", "0x7f"}, -1,
|
REQUIRE_THROWS(caller.call("confadc", {"11", "2", "0x7f"}, -1,
|
||||||
PUT)); // invalid chip index
|
PUT)); // invalid chip index
|
||||||
REQUIRE_THROWS(proxy.Call("confadc", {"-1", "32", "0x7f"}, -1,
|
REQUIRE_THROWS(caller.call("confadc", {"-1", "32", "0x7f"}, -1,
|
||||||
PUT)); // invalid adc index
|
PUT)); // invalid adc index
|
||||||
REQUIRE_THROWS(proxy.Call("confadc", {"-1", "10", "0x80"}, -1,
|
REQUIRE_THROWS(caller.call("confadc", {"-1", "10", "0x80"}, -1,
|
||||||
PUT)); // invalid value
|
PUT)); // invalid value
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("confadc", {"-1", "-1", "0x11"}, -1, PUT, oss);
|
caller.call("confadc", {"-1", "-1", "0x11"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "confadc [-1, -1, 0x11]\n");
|
REQUIRE(oss.str() == "confadc [-1, -1, 0x11]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("confadc", {"2", "3"}, -1, GET, oss);
|
caller.call("confadc", {"2", "3"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "confadc 0x11\n");
|
REQUIRE(oss.str() == "confadc 0x11\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -728,7 +748,7 @@ TEST_CASE("confadc", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("confadc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("confadc", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -17,275 +17,282 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs]") {
|
TEST_CASE("Caller::Setting and reading back Jungfrau dacs",
|
||||||
|
"[.cmdcall][.dacs]") {
|
||||||
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
|
// vb_comp, vdd_prot, vin_com, vref_prech, vb_pixbuf, vb_ds, vref_ds,
|
||||||
// vref_comp
|
// vref_comp
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
SECTION("vb_comp") { test_dac(defs::VB_COMP, "vb_comp", 1220); }
|
SECTION("vb_comp") { test_dac_caller(defs::VB_COMP, "vb_comp", 1220); }
|
||||||
SECTION("vdd_prot") { test_dac(defs::VDD_PROT, "vdd_prot", 3000); }
|
SECTION("vdd_prot") {
|
||||||
SECTION("vin_com") { test_dac(defs::VIN_COM, "vin_com", 1053); }
|
test_dac_caller(defs::VDD_PROT, "vdd_prot", 3000);
|
||||||
SECTION("vref_prech") {
|
}
|
||||||
test_dac(defs::VREF_PRECH, "vref_prech", 1450);
|
SECTION("vin_com") { test_dac_caller(defs::VIN_COM, "vin_com", 1053); }
|
||||||
|
SECTION("vref_prech") {
|
||||||
|
test_dac_caller(defs::VREF_PRECH, "vref_prech", 1450);
|
||||||
|
}
|
||||||
|
SECTION("vb_pixbuf") {
|
||||||
|
test_dac_caller(defs::VB_PIXBUF, "vb_pixbuf", 750);
|
||||||
|
}
|
||||||
|
SECTION("vb_ds") { test_dac_caller(defs::VB_DS, "vb_ds", 1000); }
|
||||||
|
SECTION("vref_ds") { test_dac_caller(defs::VREF_DS, "vref_ds", 480); }
|
||||||
|
SECTION("vref_comp") {
|
||||||
|
test_dac_caller(defs::VREF_COMP, "vref_comp", 420);
|
||||||
}
|
}
|
||||||
SECTION("vb_pixbuf") { test_dac(defs::VB_PIXBUF, "vb_pixbuf", 750); }
|
|
||||||
SECTION("vb_ds") { test_dac(defs::VB_DS, "vb_ds", 1000); }
|
|
||||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 480); }
|
|
||||||
SECTION("vref_comp") { test_dac(defs::VREF_COMP, "vref_comp", 420); }
|
|
||||||
// eiger
|
// eiger
|
||||||
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vthreshold", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vsvp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vsvn", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vtgstv", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcmp_ll", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcmp_lr", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcal", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcmp_rl", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcmp_rr", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("rxb_rb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("rxb_lb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcn", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("iodelay", {}, -1, GET));
|
||||||
// gotthard
|
// gotthard
|
||||||
// REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcascn_pb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcascp_pb", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vout_cm", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcasc_out", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vin_cm", {}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
// REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("ib_test_c", {}, -1, GET));
|
||||||
// mythen3
|
// mythen3
|
||||||
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper_n", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vrshaper_n", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vipre", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vdcsh", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth1", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth2", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vth3", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_n", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcal_n", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_p", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcal_p", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcassh", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcas", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vicin", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vipre_out", {}, -1, GET));
|
||||||
// gotthard2
|
// gotthard2
|
||||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_h_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_comp_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_rstore", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_opa_1st", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_comp_fe", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_adc1", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_l_adc", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vref_cds", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_cs", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vb_opa_fd", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("vcom_adc2", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Network Configuration (Detector<->Receiver) */
|
/* Network Configuration (Detector<->Receiver) */
|
||||||
|
|
||||||
TEST_CASE("selinterface", "[.cmd]") {
|
TEST_CASE("Caller::selinterface", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
auto prev_val = det.getSelectedUDPInterface().tsquash(
|
auto prev_val = det.getSelectedUDPInterface().tsquash(
|
||||||
"inconsistent selected interface to test");
|
"inconsistent selected interface to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("selinterface", {"1"}, -1, PUT, oss);
|
caller.call("selinterface", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "selinterface 1\n");
|
REQUIRE(oss.str() == "selinterface 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("selinterface", {"0"}, -1, PUT, oss);
|
caller.call("selinterface", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "selinterface 0\n");
|
REQUIRE(oss.str() == "selinterface 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("selinterface", {}, -1, GET, oss);
|
caller.call("selinterface", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "selinterface 0\n");
|
REQUIRE(oss.str() == "selinterface 0\n");
|
||||||
}
|
}
|
||||||
det.selectUDPInterface(prev_val);
|
det.selectUDPInterface(prev_val);
|
||||||
REQUIRE_THROWS(proxy.Call("selinterface", {"2"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("selinterface", {"2"}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("selinterface", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("selinterface", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Jungfrau/moench Specific */
|
/* Jungfrau/moench Specific */
|
||||||
|
|
||||||
TEST_CASE("temp_threshold", "[.cmd]") {
|
TEST_CASE("Caller::temp_threshold", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
auto prev_val = det.getThresholdTemperature();
|
auto prev_val = det.getThresholdTemperature();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_threshold", {"65"}, -1, PUT, oss);
|
caller.call("temp_threshold", {"65"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "temp_threshold 65\n");
|
REQUIRE(oss.str() == "temp_threshold 65\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_threshold", {"70"}, -1, PUT, oss);
|
caller.call("temp_threshold", {"70"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "temp_threshold 70\n");
|
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_threshold", {}, -1, GET, oss);
|
caller.call("temp_threshold", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "temp_threshold 70\n");
|
REQUIRE(oss.str() == "temp_threshold 70\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setThresholdTemperature(prev_val[i], {i});
|
det.setThresholdTemperature(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_threshold", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_threshold", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("temp_threshold", {"70"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("temp_threshold", {"70"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("chipversion", "[.cmd]") {
|
TEST_CASE("Caller::chipversion", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("chipversion", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("chipversion", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("chipversion", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("chipversion", {}, -1, GET));
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("chipversion", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("chipversion", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_control", "[.cmd]") {
|
TEST_CASE("Caller::temp_control", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
auto prev_val = det.getTemperatureControl();
|
auto prev_val = det.getTemperatureControl();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_control", {"0"}, -1, PUT, oss);
|
caller.call("temp_control", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "temp_control 0\n");
|
REQUIRE(oss.str() == "temp_control 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_control", {"1"}, -1, PUT, oss);
|
caller.call("temp_control", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "temp_control 1\n");
|
REQUIRE(oss.str() == "temp_control 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_control", {}, -1, GET, oss);
|
caller.call("temp_control", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "temp_control 1\n");
|
REQUIRE(oss.str() == "temp_control 1\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setTemperatureControl(prev_val[i], {i});
|
det.setTemperatureControl(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_control", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_control", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("temp_control", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("temp_control", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("temp_event", "[.cmd]") {
|
TEST_CASE("Caller::temp_event", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_event", {"0"}, -1, PUT, oss);
|
caller.call("temp_event", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "temp_event cleared\n");
|
REQUIRE(oss.str() == "temp_event cleared\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("temp_event", {}, -1, GET, oss);
|
caller.call("temp_event", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "temp_event 0\n");
|
REQUIRE(oss.str() == "temp_event 0\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("temp_event", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("temp_event", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("temp_event", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("temp_event", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("autocompdisable", "[.cmd]") {
|
TEST_CASE("Caller::autocompdisable", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto prev_val = det.getAutoComparatorDisable();
|
auto prev_val = det.getAutoComparatorDisable();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("autocompdisable", {"0"}, -1, PUT, oss);
|
caller.call("autocompdisable", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "autocompdisable 0\n");
|
REQUIRE(oss.str() == "autocompdisable 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("autocompdisable", {"1"}, -1, PUT, oss);
|
caller.call("autocompdisable", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "autocompdisable 1\n");
|
REQUIRE(oss.str() == "autocompdisable 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("autocompdisable", {}, -1, GET, oss);
|
caller.call("autocompdisable", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "autocompdisable 1\n");
|
REQUIRE(oss.str() == "autocompdisable 1\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setAutoComparatorDisable(prev_val[i], {i});
|
det.setAutoComparatorDisable(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("autocompdisable", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("autocompdisable", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("autocompdisable", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("autocompdisable", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("compdisabletime", "[.cmd]") {
|
TEST_CASE("Caller::compdisabletime", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU &&
|
if (det_type == defs::JUNGFRAU &&
|
||||||
det.getChipVersion().squash() * 10 == 11) {
|
det.getChipVersion().squash() * 10 == 11) {
|
||||||
auto prev_val = det.getComparatorDisableTime();
|
auto prev_val = det.getComparatorDisableTime();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("compdisabletime", {"125ns"}, -1, PUT, oss);
|
caller.call("compdisabletime", {"125ns"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("compdisabletime", {}, -1, GET, oss);
|
caller.call("compdisabletime", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
REQUIRE(oss.str() == "compdisabletime 125ns\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("compdisabletime", {"0"}, -1, PUT, oss);
|
caller.call("compdisabletime", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "compdisabletime 0\n");
|
REQUIRE(oss.str() == "compdisabletime 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setComparatorDisableTime(prev_val[i], {i});
|
det.setComparatorDisableTime(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("compdisabletime", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("compdisabletime", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("compdisabletime", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("compdisabletime", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("extrastoragecells", "[.cmd]") {
|
TEST_CASE("Caller::extrastoragecells", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
@ -294,86 +301,86 @@ TEST_CASE("extrastoragecells", "[.cmd]") {
|
|||||||
"inconsistent #additional storage cells to test");
|
"inconsistent #additional storage cells to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("extrastoragecells", {"1"}, -1, PUT, oss);
|
caller.call("extrastoragecells", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "extrastoragecells 1\n");
|
REQUIRE(oss.str() == "extrastoragecells 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("extrastoragecells", {"15"}, -1, PUT, oss);
|
caller.call("extrastoragecells", {"15"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "extrastoragecells 15\n");
|
REQUIRE(oss.str() == "extrastoragecells 15\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("extrastoragecells", {"0"}, -1, PUT, oss);
|
caller.call("extrastoragecells", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("extrastoragecells", {}, -1, GET, oss);
|
caller.call("extrastoragecells", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
REQUIRE(oss.str() == "extrastoragecells 0\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"16"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("extrastoragecells", {"16"}, -1, PUT));
|
||||||
det.setNumberOfAdditionalStorageCells(prev_val);
|
det.setNumberOfAdditionalStorageCells(prev_val);
|
||||||
}
|
}
|
||||||
// chip version 1.1
|
// chip version 1.1
|
||||||
else {
|
else {
|
||||||
// cannot set number of addl. storage cells
|
// cannot set number of addl. storage cells
|
||||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("extrastoragecells", {"1"}, -1, PUT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("extrastoragecells", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("extrastoragecells", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("extrastoragecells", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("storagecell_start", "[.cmd]") {
|
TEST_CASE("Caller::storagecell_start", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto prev_val = det.getStorageCellStart();
|
auto prev_val = det.getStorageCellStart();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"1"}, -1, PUT, oss);
|
caller.call("storagecell_start", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||||
}
|
}
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
if (det.getChipVersion().squash() * 10 == 10) {
|
if (det.getChipVersion().squash() * 10 == 10) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
caller.call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 15\n");
|
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||||
}
|
}
|
||||||
// chip version 1.1
|
// chip version 1.1
|
||||||
else {
|
else {
|
||||||
// max is 3
|
// max is 3
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {"15"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("storagecell_start", {"15"}, -1, PUT));
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"3"}, -1, PUT, oss);
|
caller.call("storagecell_start", {"3"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 3\n");
|
REQUIRE(oss.str() == "storagecell_start 3\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"0"}, -1, PUT, oss);
|
caller.call("storagecell_start", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 0\n");
|
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {}, -1, GET, oss);
|
caller.call("storagecell_start", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 0\n");
|
REQUIRE(oss.str() == "storagecell_start 0\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {"16"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("storagecell_start", {"16"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setStorageCellStart(prev_val[i], {i});
|
det.setStorageCellStart(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("storagecell_start", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_start", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("storagecell_start", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("storagecell_delay", "[.cmd]") {
|
TEST_CASE("Caller::storagecell_delay", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
@ -381,21 +388,21 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
auto prev_val = det.getStorageCellDelay();
|
auto prev_val = det.getStorageCellDelay();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
caller.call("storagecell_delay", {"1.62ms"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_delay", {}, -1, GET, oss);
|
caller.call("storagecell_delay", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
REQUIRE(oss.str() == "storagecell_delay 1.62ms\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
caller.call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
caller.call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setStorageCellDelay(prev_val[i], {i});
|
det.setStorageCellDelay(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
@ -404,66 +411,66 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
else {
|
else {
|
||||||
// cannot set storage cell delay
|
// cannot set storage cell delay
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
caller.call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("storagecell_delay", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("storagecell_delay", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gainmode", "[.cmd]") {
|
TEST_CASE("Caller::gainmode", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto prev_val = det.getGainMode();
|
auto prev_val = det.getGainMode();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"forceswitchg1"}, -1, PUT, oss);
|
caller.call("gainmode", {"forceswitchg1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {}, -1, GET, oss);
|
caller.call("gainmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"dynamic"}, -1, PUT, oss);
|
caller.call("gainmode", {"dynamic"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode dynamic\n");
|
REQUIRE(oss.str() == "gainmode dynamic\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
caller.call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode forceswitchg2\n");
|
REQUIRE(oss.str() == "gainmode forceswitchg2\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"fixg1"}, -1, PUT, oss);
|
caller.call("gainmode", {"fixg1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode fixg1\n");
|
REQUIRE(oss.str() == "gainmode fixg1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"fixg2"}, -1, PUT, oss);
|
caller.call("gainmode", {"fixg2"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode fixg2\n");
|
REQUIRE(oss.str() == "gainmode fixg2\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"fixg0"}, -1, PUT, oss);
|
caller.call("gainmode", {"fixg0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode fixg0\n");
|
REQUIRE(oss.str() == "gainmode fixg0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setGainMode(prev_val[i], {i});
|
det.setGainMode(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gainmode", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gainmode", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("filtercells", "[.cmd]") {
|
TEST_CASE("Caller::filtercells", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
// chip version 1.1
|
// chip version 1.1
|
||||||
@ -471,25 +478,25 @@ TEST_CASE("filtercells", "[.cmd]") {
|
|||||||
auto prev_val = det.getNumberOfFilterCells();
|
auto prev_val = det.getNumberOfFilterCells();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("filtercells", {"1"}, -1, PUT, oss);
|
caller.call("filtercells", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "filtercells 1\n");
|
REQUIRE(oss.str() == "filtercells 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("filtercells", {"12"}, -1, PUT, oss);
|
caller.call("filtercells", {"12"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "filtercells 12\n");
|
REQUIRE(oss.str() == "filtercells 12\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("filtercells", {"0"}, -1, PUT, oss);
|
caller.call("filtercells", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "filtercells 0\n");
|
REQUIRE(oss.str() == "filtercells 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("filtercells", {}, -1, GET, oss);
|
caller.call("filtercells", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "filtercells 0\n");
|
REQUIRE(oss.str() == "filtercells 0\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("filtercells", {"13"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("filtercells", {"13"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setNumberOfFilterCells(prev_val[i], {i});
|
det.setNumberOfFilterCells(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
@ -497,18 +504,17 @@ TEST_CASE("filtercells", "[.cmd]") {
|
|||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
else {
|
else {
|
||||||
// cannot set/get filter cell
|
// cannot set/get filter cell
|
||||||
REQUIRE_THROWS(proxy.Call("filtercells", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("filtercells", {"1"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("filtercells", {}, -1, GET));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("filtercells", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("filtercells", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("filtercells", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("filtercells", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TEST_CASE("Caller::pedestalmode", "[.cmdcall]") {
|
||||||
TEST_CASE("pedestalmode", "[.cmd]") {
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
auto prev_val = det.getPedestalMode();
|
auto prev_val = det.getPedestalMode();
|
||||||
@ -519,51 +525,51 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
auto prev_timingmode =
|
auto prev_timingmode =
|
||||||
det.getTimingMode().tsquash("Inconsistent timing mode to test");
|
det.getTimingMode().tsquash("Inconsistent timing mode to test");
|
||||||
|
|
||||||
REQUIRE_NOTHROW(proxy.Call("pedestalmode", {}, 0, GET));
|
REQUIRE_NOTHROW(caller.call("pedestalmode", {}, 0, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("pedestalmode", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("pedestalmode", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"0"}, -1, GET));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"0"}, -1, GET));
|
||||||
|
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"256", "10"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"256", "10"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"-1", "10"}, 0, PUT));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"-1", "10"}, 0, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"20", "65536"}, 0, PUT));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"20", "65536"}, 0, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"20", "-1"}, 0, PUT));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"20", "-1"}, 0, PUT));
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pedestalmode", {"30", "1000"}, -1, PUT, oss);
|
caller.call("pedestalmode", {"30", "1000"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pedestalmode [30, 1000]\n");
|
REQUIRE(oss.str() == "pedestalmode [30, 1000]\n");
|
||||||
}
|
}
|
||||||
// cannot change any of these in pedestal mode
|
// cannot change any of these in pedestal mode
|
||||||
REQUIRE_THROWS_WITH(proxy.Call("frames", {"200"}, -1, PUT),
|
REQUIRE_THROWS_WITH(caller.call("frames", {"200"}, -1, PUT),
|
||||||
"Detector returned: Cannot set frames in pedestal "
|
"Detector returned: Cannot set frames in pedestal "
|
||||||
"mode. It is overwritten anyway.\n");
|
"mode. It is overwritten anyway.\n");
|
||||||
REQUIRE_THROWS_WITH(proxy.Call("triggers", {"200"}, -1, PUT),
|
REQUIRE_THROWS_WITH(caller.call("triggers", {"200"}, -1, PUT),
|
||||||
"Detector returned: Cannot set triggers in "
|
"Detector returned: Cannot set triggers in "
|
||||||
"pedestal mode. It is overwritten anyway.\n");
|
"pedestal mode. It is overwritten anyway.\n");
|
||||||
REQUIRE_THROWS_WITH(
|
REQUIRE_THROWS_WITH(
|
||||||
proxy.Call("timing", {"auto"}, -1, PUT),
|
caller.call("timing", {"auto"}, -1, PUT),
|
||||||
"Detector returned: Cannot set timing mode in pedestal mode. "
|
"Detector returned: Cannot set timing mode in pedestal mode. "
|
||||||
"Switch off pedestal mode to change timing mode.\n");
|
"Switch off pedestal mode to change timing mode.\n");
|
||||||
REQUIRE_THROWS_WITH(
|
REQUIRE_THROWS_WITH(
|
||||||
proxy.Call("scan", {"vb_comp", "500", "1500", "10"}, -1, PUT),
|
caller.call("scan", {"vb_comp", "500", "1500", "10"}, -1, PUT),
|
||||||
"Detector returned: Cannot set scan when in pedestal mode.\n");
|
"Detector returned: Cannot set scan when in pedestal mode.\n");
|
||||||
REQUIRE_THROWS_WITH(
|
REQUIRE_THROWS_WITH(
|
||||||
proxy.Call("scan", {"0"}, -1, PUT),
|
caller.call("scan", {"0"}, -1, PUT),
|
||||||
"Detector returned: Cannot set scan when in pedestal mode.\n");
|
"Detector returned: Cannot set scan when in pedestal mode.\n");
|
||||||
// should not throw to get these values though
|
// should not throw to get these values though
|
||||||
REQUIRE_NOTHROW(proxy.Call("frames", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("frames", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("triggers", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("triggers", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("timing", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("timing", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("scan", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("scan", {}, -1, GET));
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pedestalmode", {"50", "500"}, -1, PUT, oss);
|
caller.call("pedestalmode", {"50", "500"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pedestalmode [50, 500]\n");
|
REQUIRE(oss.str() == "pedestalmode [50, 500]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pedestalmode", {}, -1, GET, oss);
|
caller.call("pedestalmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "pedestalmode [enabled, 50, 500]\n");
|
REQUIRE(oss.str() == "pedestalmode [enabled, 50, 500]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
@ -575,12 +581,12 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pedestalmode", {"0"}, -1, PUT, oss);
|
caller.call("pedestalmode", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pedestalmode [0]\n");
|
REQUIRE(oss.str() == "pedestalmode [0]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pedestalmode", {}, -1, GET, oss);
|
caller.call("pedestalmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "pedestalmode [disabled]\n");
|
REQUIRE(oss.str() == "pedestalmode [disabled]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,7 +598,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
|
|
||||||
// auto mode
|
// auto mode
|
||||||
det.setTimingMode(defs::AUTO_TIMING);
|
det.setTimingMode(defs::AUTO_TIMING);
|
||||||
REQUIRE_NOTHROW(proxy.Call(
|
REQUIRE_NOTHROW(caller.call(
|
||||||
"pedestalmode",
|
"pedestalmode",
|
||||||
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
||||||
PUT));
|
PUT));
|
||||||
@ -602,7 +608,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
REQUIRE(numTriggers == 1);
|
REQUIRE(numTriggers == 1);
|
||||||
|
|
||||||
// pedestal mode off
|
// pedestal mode off
|
||||||
REQUIRE_NOTHROW(proxy.Call("pedestalmode", {"0"}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("pedestalmode", {"0"}, -1, PUT));
|
||||||
numTriggers = det.getNumberOfTriggers().squash(-1);
|
numTriggers = det.getNumberOfTriggers().squash(-1);
|
||||||
numFrames = det.getNumberOfFrames().squash(-1);
|
numFrames = det.getNumberOfFrames().squash(-1);
|
||||||
REQUIRE(numFrames == origFrames);
|
REQUIRE(numFrames == origFrames);
|
||||||
@ -612,7 +618,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
REQUIRE_NOTHROW(det.setTimingMode(defs::TRIGGER_EXPOSURE));
|
REQUIRE_NOTHROW(det.setTimingMode(defs::TRIGGER_EXPOSURE));
|
||||||
origFrames = 5;
|
origFrames = 5;
|
||||||
REQUIRE_NOTHROW(det.setNumberOfFrames(origFrames));
|
REQUIRE_NOTHROW(det.setNumberOfFrames(origFrames));
|
||||||
REQUIRE_NOTHROW(proxy.Call(
|
REQUIRE_NOTHROW(caller.call(
|
||||||
"pedestalmode",
|
"pedestalmode",
|
||||||
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
||||||
PUT));
|
PUT));
|
||||||
@ -622,7 +628,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
REQUIRE(numTriggers == 1);
|
REQUIRE(numTriggers == 1);
|
||||||
|
|
||||||
// pedestal mode off
|
// pedestal mode off
|
||||||
REQUIRE_NOTHROW(proxy.Call("pedestalmode", {"0"}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("pedestalmode", {"0"}, -1, PUT));
|
||||||
numTriggers = det.getNumberOfTriggers().squash(-1);
|
numTriggers = det.getNumberOfTriggers().squash(-1);
|
||||||
numFrames = det.getNumberOfFrames().squash(-1);
|
numFrames = det.getNumberOfFrames().squash(-1);
|
||||||
REQUIRE(numFrames == origFrames);
|
REQUIRE(numFrames == origFrames);
|
||||||
@ -633,7 +639,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
REQUIRE_NOTHROW(det.setNumberOfFrames(origFrames));
|
REQUIRE_NOTHROW(det.setNumberOfFrames(origFrames));
|
||||||
origTriggers = 10;
|
origTriggers = 10;
|
||||||
REQUIRE_NOTHROW(det.setNumberOfTriggers(origTriggers));
|
REQUIRE_NOTHROW(det.setNumberOfTriggers(origTriggers));
|
||||||
REQUIRE_NOTHROW(proxy.Call(
|
REQUIRE_NOTHROW(caller.call(
|
||||||
"pedestalmode",
|
"pedestalmode",
|
||||||
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
{std::to_string(pedestalFrames), std::to_string(pedestalLoops)}, -1,
|
||||||
PUT));
|
PUT));
|
||||||
@ -643,7 +649,7 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
REQUIRE(numTriggers == expNumFrames);
|
REQUIRE(numTriggers == expNumFrames);
|
||||||
|
|
||||||
// pedestal mode off
|
// pedestal mode off
|
||||||
REQUIRE_NOTHROW(proxy.Call("pedestalmode", {"0"}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("pedestalmode", {"0"}, -1, PUT));
|
||||||
numTriggers = det.getNumberOfTriggers().squash(-1);
|
numTriggers = det.getNumberOfTriggers().squash(-1);
|
||||||
numFrames = det.getNumberOfFrames().squash(-1);
|
numFrames = det.getNumberOfFrames().squash(-1);
|
||||||
REQUIRE(numFrames == origFrames);
|
REQUIRE(numFrames == origFrames);
|
||||||
@ -656,26 +662,26 @@ TEST_CASE("pedestalmode", "[.cmd]") {
|
|||||||
det.setPedestalMode(prev_val[i], {i});
|
det.setPedestalMode(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pedestalmode", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("pedestalmode", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("pedestalmode", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("sync", "[.cmd]") {
|
TEST_CASE("Caller::sync", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
|
||||||
auto prev_val = det.getSynchronization().tsquash(
|
auto prev_val = det.getSynchronization().tsquash(
|
||||||
"inconsistent synchronization to test");
|
"inconsistent synchronization to test");
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("sync", {"0"}, -1, PUT, oss);
|
caller.call("sync", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "sync 0\n");
|
REQUIRE(oss.str() == "sync 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("sync", {"1"}, -1, PUT, oss);
|
caller.call("sync", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "sync 1\n");
|
REQUIRE(oss.str() == "sync 1\n");
|
||||||
}
|
}
|
||||||
// setting to master or slave when synced
|
// setting to master or slave when synced
|
||||||
@ -689,10 +695,10 @@ TEST_CASE("sync", "[.cmd]") {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proxy.Call("master", {"1"}, 0, PUT);
|
caller.call("master", {"1"}, 0, PUT);
|
||||||
proxy.Call("master", {"0"}, 0, PUT);
|
caller.call("master", {"0"}, 0, PUT);
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("status", {}, -1, GET, oss);
|
caller.call("status", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() != "status running\n");
|
REQUIRE(oss.str() != "status running\n");
|
||||||
// set all to slaves, and then master
|
// set all to slaves, and then master
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -702,7 +708,7 @@ TEST_CASE("sync", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("sync", {}, -1, GET, oss);
|
caller.call("sync", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "sync 1\n");
|
REQUIRE(oss.str() == "sync 1\n");
|
||||||
}
|
}
|
||||||
// setting sync when running
|
// setting sync when running
|
||||||
@ -721,10 +727,10 @@ TEST_CASE("sync", "[.cmd]") {
|
|||||||
det.setPeriod(std::chrono::milliseconds(1000));
|
det.setPeriod(std::chrono::milliseconds(1000));
|
||||||
det.setSynchronization(1);
|
det.setSynchronization(1);
|
||||||
det.startDetector();
|
det.startDetector();
|
||||||
REQUIRE_THROWS(proxy.Call("sync", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("sync", {"0"}, -1, PUT));
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("sync", {}, -1, GET, oss);
|
caller.call("sync", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "sync 1\n");
|
REQUIRE(oss.str() == "sync 1\n");
|
||||||
}
|
}
|
||||||
det.stopDetector();
|
det.stopDetector();
|
||||||
@ -735,8 +741,8 @@ TEST_CASE("sync", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
det.setSynchronization(prev_val);
|
det.setSynchronization(prev_val);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("sync", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("sync", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("sync", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("sync", {"0"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
114
slsDetectorSoftware/tests/Caller/test-Caller-moench.cpp
Normal file
114
slsDetectorSoftware/tests/Caller/test-Caller-moench.cpp
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#include "Caller.h"
|
||||||
|
#include "catch.hpp"
|
||||||
|
#include "sls/Detector.h"
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "sls/versionAPI.h"
|
||||||
|
#include "test-Caller-global.h"
|
||||||
|
#include "tests/globals.h"
|
||||||
|
|
||||||
|
namespace sls {
|
||||||
|
|
||||||
|
using test::GET;
|
||||||
|
using test::PUT;
|
||||||
|
|
||||||
|
/* dacs */
|
||||||
|
|
||||||
|
TEST_CASE("Caller::Setting and reading back moench dacs", "[.cmdcall][.dacs]") {
|
||||||
|
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
|
||||||
|
// ibias_sfp
|
||||||
|
Detector det;
|
||||||
|
Caller caller(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::MOENCH) {
|
||||||
|
SECTION("vbp_colbuf") {
|
||||||
|
test_dac_caller(defs::VBP_COLBUF, "vbp_colbuf", 1300);
|
||||||
|
}
|
||||||
|
SECTION("vipre") { test_dac_caller(defs::VIPRE, "vipre", 1000); }
|
||||||
|
SECTION("vin_cm") { test_dac_caller(defs::VIN_CM, "vin_cm", 1400); }
|
||||||
|
SECTION("vb_sda") { test_dac_caller(defs::VB_SDA, "vb_sda", 680); }
|
||||||
|
SECTION("vcasc_sfp") {
|
||||||
|
test_dac_caller(defs::VCASC_SFP, "vcasc_sfp", 1428);
|
||||||
|
}
|
||||||
|
SECTION("vout_cm") { test_dac_caller(defs::VOUT_CM, "vout_cm", 1200); }
|
||||||
|
SECTION("vipre_cds") {
|
||||||
|
test_dac_caller(defs::VIPRE_CDS, "vipre_cds", 800);
|
||||||
|
}
|
||||||
|
SECTION("ibias_sfp") {
|
||||||
|
test_dac_caller(defs::IBIAS_SFP, "ibias_sfp", 900);
|
||||||
|
}
|
||||||
|
// eiger
|
||||||
|
REQUIRE_THROWS(caller.call("vthreshold", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vsvp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vsvn", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vtgstv", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcmp_ll", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcmp_lr", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcal", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcmp_rl", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcmp_rr", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("rxb_rb", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("rxb_lb", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcn", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("iodelay", {}, -1, GET));
|
||||||
|
// gotthard
|
||||||
|
REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcascn_pb", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcascp_pb", {}, -1, GET));
|
||||||
|
// REQUIRE_THROWS(caller.call("vout_cm", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcasc_out", {}, -1, GET));
|
||||||
|
// REQUIRE_THROWS(caller.call("vin_cm", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("ib_test_c", {}, -1, GET));
|
||||||
|
// mythen3
|
||||||
|
REQUIRE_THROWS(caller.call("vrpreamp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vrshaper", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vrshaper_n", {}, -1, GET));
|
||||||
|
// REQUIRE_THROWS(caller.call("vipre", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vishaper", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vdcsh", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vth1", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vth2", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vth3", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcal_n", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcal_p", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vtrim", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcassh", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcas", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vicin", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vipre_out", {}, -1, GET));
|
||||||
|
// gotthard2
|
||||||
|
REQUIRE_THROWS(caller.call("vref_h_adc", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_comp_fe", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_comp_adc", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcom_cds", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_rstore", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_opa_1st", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_comp_fe", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcom_adc1", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_l_adc", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_cds", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_cs", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_opa_fd", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vcom_adc2", {}, -1, GET));
|
||||||
|
// jungfrau
|
||||||
|
REQUIRE_THROWS(caller.call("vb_comp", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vdd_prot", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vin_com", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_prech", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_pixbuf", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vb_ds", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_ds", {}, -1, GET));
|
||||||
|
REQUIRE_THROWS(caller.call("vref_comp", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace sls
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
#include "sls/ToString.h"
|
#include "sls/ToString.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -19,32 +19,41 @@ using test::PUT;
|
|||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs]") {
|
TEST_CASE("Caller::Setting and reading back MYTHEN3 dacs",
|
||||||
|
"[.cmdcall][.dacs]") {
|
||||||
// vcassh, vth2, vshaper, vshaperneg, vipre_out, vth3, vth1,
|
// vcassh, vth2, vshaper, vshaperneg, vipre_out, vth3, vth1,
|
||||||
// vicin, vcas, vpreamp, vpl, vipre, viinsh, vph, vtrim, vdcsh,
|
// vicin, vcas, vpreamp, vpl, vipre, viinsh, vph, vtrim, vdcsh,
|
||||||
|
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
SECTION("vcassh") { test_dac(defs::VCASSH, "vcassh", 1200); }
|
SECTION("vcassh") { test_dac_caller(defs::VCASSH, "vcassh", 1200); }
|
||||||
SECTION("vth2") { test_dac(defs::VTH2, "vth2", 2800); }
|
SECTION("vth2") { test_dac_caller(defs::VTH2, "vth2", 2800); }
|
||||||
SECTION("vrshaper") { test_dac(defs::VRSHAPER, "vrshaper", 1280); }
|
SECTION("vrshaper") {
|
||||||
SECTION("vrshaper_n") {
|
test_dac_caller(defs::VRSHAPER, "vrshaper", 1280);
|
||||||
test_dac(defs::VRSHAPER_N, "vrshaper_n", 2800);
|
|
||||||
}
|
}
|
||||||
SECTION("vipre_out") { test_dac(defs::VIPRE_OUT, "vipre_out", 1220); }
|
SECTION("vrshaper_n") {
|
||||||
SECTION("vth3") { test_dac(defs::VTH3, "vth3", 2800); }
|
test_dac_caller(defs::VRSHAPER_N, "vrshaper_n", 2800);
|
||||||
SECTION("vth1") { test_dac(defs::VTH1, "vth1", 2880); }
|
}
|
||||||
SECTION("vicin") { test_dac(defs::VICIN, "vicin", 1708); }
|
SECTION("vipre_out") {
|
||||||
SECTION("vcas") { test_dac(defs::VCAS, "vcas", 1800); }
|
test_dac_caller(defs::VIPRE_OUT, "vipre_out", 1220);
|
||||||
SECTION("vrpreamp") { test_dac(defs::VRPREAMP, "vrpreamp", 1100); }
|
}
|
||||||
SECTION("vcal_n") { test_dac(defs::VCAL_N, "vcal_n", 1100); }
|
SECTION("vth3") { test_dac_caller(defs::VTH3, "vth3", 2800); }
|
||||||
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 2624); }
|
SECTION("vth1") { test_dac_caller(defs::VTH1, "vth1", 2880); }
|
||||||
SECTION("vishaper") { test_dac(defs::VISHAPER, "vishaper", 1708); }
|
SECTION("vicin") { test_dac_caller(defs::VICIN, "vicin", 1708); }
|
||||||
SECTION("vcal_p") { test_dac(defs::VCAL_P, "vcal_p", 1712); }
|
SECTION("vcas") { test_dac_caller(defs::VCAS, "vcas", 1800); }
|
||||||
SECTION("vtrim") { test_dac(defs::VTRIM, "vtrim", 2800); }
|
SECTION("vrpreamp") {
|
||||||
SECTION("vdcsh") { test_dac(defs::VDCSH, "vdcsh", 800); }
|
test_dac_caller(defs::VRPREAMP, "vrpreamp", 1100);
|
||||||
|
}
|
||||||
|
SECTION("vcal_n") { test_dac_caller(defs::VCAL_N, "vcal_n", 1100); }
|
||||||
|
SECTION("vipre") { test_dac_caller(defs::VIPRE, "vipre", 2624); }
|
||||||
|
SECTION("vishaper") {
|
||||||
|
test_dac_caller(defs::VISHAPER, "vishaper", 1708);
|
||||||
|
}
|
||||||
|
SECTION("vcal_p") { test_dac_caller(defs::VCAL_P, "vcal_p", 1712); }
|
||||||
|
SECTION("vtrim") { test_dac_caller(defs::VTRIM, "vtrim", 2800); }
|
||||||
|
SECTION("vdcsh") { test_dac_caller(defs::VDCSH, "vdcsh", 800); }
|
||||||
SECTION("vthreshold") {
|
SECTION("vthreshold") {
|
||||||
// Read out individual vcmp to be able to reset after
|
// Read out individual vcmp to be able to reset after
|
||||||
// the test is done
|
// the test is done
|
||||||
@ -55,67 +64,68 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dac", {"vthreshold", "1234"}, -1, PUT, oss);
|
caller.call("dac", {"vthreshold", "1234"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dac", {"vthreshold"}, -1, GET, oss);
|
caller.call("dac", {"vthreshold"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
REQUIRE(oss.str() == "dac vthreshold 1234\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// disabling counters change vth values
|
// disabling counters change vth values
|
||||||
proxy.Call("counters", {"0"}, -1, PUT);
|
caller.call("counters", {"0"}, -1, PUT);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("dac", {"vth1"}, -1, GET, oss1);
|
caller.call("dac", {"vth1"}, -1, GET, oss1);
|
||||||
REQUIRE(oss1.str() == "dac vth1 1234\n");
|
REQUIRE(oss1.str() == "dac vth1 1234\n");
|
||||||
proxy.Call("dac", {"vth2"}, -1, GET, oss2);
|
caller.call("dac", {"vth2"}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "dac vth2 2800\n");
|
REQUIRE(oss2.str() == "dac vth2 2800\n");
|
||||||
proxy.Call("dac", {"vth3"}, -1, GET, oss3);
|
caller.call("dac", {"vth3"}, -1, GET, oss3);
|
||||||
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
||||||
}
|
}
|
||||||
// vthreshold changes vth for only enabled counters
|
// vthreshold changes vth for only enabled counters
|
||||||
REQUIRE_NOTHROW(proxy.Call("dac", {"vthreshold", "2100"}, -1, PUT));
|
REQUIRE_NOTHROW(
|
||||||
|
caller.call("dac", {"vthreshold", "2100"}, -1, PUT));
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dac", {"vthreshold"}, -1, GET, oss);
|
caller.call("dac", {"vthreshold"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "dac vthreshold 2100\n");
|
REQUIRE(oss.str() == "dac vthreshold 2100\n");
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("dac", {"vth1"}, -1, GET, oss1);
|
caller.call("dac", {"vth1"}, -1, GET, oss1);
|
||||||
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
||||||
proxy.Call("dac", {"vth2"}, -1, GET, oss2);
|
caller.call("dac", {"vth2"}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "dac vth2 2800\n");
|
REQUIRE(oss2.str() == "dac vth2 2800\n");
|
||||||
proxy.Call("dac", {"vth3"}, -1, GET, oss3);
|
caller.call("dac", {"vth3"}, -1, GET, oss3);
|
||||||
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
||||||
}
|
}
|
||||||
// vth overwrite vth even if counter disabled
|
// vth overwrite vth even if counter disabled
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dac", {"vth2", "2200"}, -1, PUT);
|
caller.call("dac", {"vth2", "2200"}, -1, PUT);
|
||||||
proxy.Call("dac", {"vth2"}, -1, GET, oss);
|
caller.call("dac", {"vth2"}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "dac vth2 2200\n");
|
REQUIRE(oss.str() == "dac vth2 2200\n");
|
||||||
}
|
}
|
||||||
// counters enabled, sets remembered values
|
// counters enabled, sets remembered values
|
||||||
proxy.Call("counters", {"0", "1", "2"}, -1, PUT);
|
caller.call("counters", {"0", "1", "2"}, -1, PUT);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("dac", {"vth1"}, -1, GET, oss1);
|
caller.call("dac", {"vth1"}, -1, GET, oss1);
|
||||||
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
||||||
proxy.Call("dac", {"vth2"}, -1, GET, oss2);
|
caller.call("dac", {"vth2"}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "dac vth2 2200\n");
|
REQUIRE(oss2.str() == "dac vth2 2200\n");
|
||||||
proxy.Call("dac", {"vth3"}, -1, GET, oss3);
|
caller.call("dac", {"vth3"}, -1, GET, oss3);
|
||||||
REQUIRE(oss3.str() == "dac vth3 2100\n");
|
REQUIRE(oss3.str() == "dac vth3 2100\n");
|
||||||
}
|
}
|
||||||
// counters enabled, sets remembered values
|
// counters enabled, sets remembered values
|
||||||
proxy.Call("counters", {"0", "1"}, -1, PUT);
|
caller.call("counters", {"0", "1"}, -1, PUT);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2, oss3;
|
std::ostringstream oss1, oss2, oss3;
|
||||||
proxy.Call("dac", {"vth1"}, -1, GET, oss1);
|
caller.call("dac", {"vth1"}, -1, GET, oss1);
|
||||||
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
REQUIRE(oss1.str() == "dac vth1 2100\n");
|
||||||
proxy.Call("dac", {"vth2"}, -1, GET, oss2);
|
caller.call("dac", {"vth2"}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "dac vth2 2200\n");
|
REQUIRE(oss2.str() == "dac vth2 2200\n");
|
||||||
proxy.Call("dac", {"vth3"}, -1, GET, oss3);
|
caller.call("dac", {"vth3"}, -1, GET, oss3);
|
||||||
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
REQUIRE(oss3.str() == "dac vth3 2800\n");
|
||||||
}
|
}
|
||||||
// Reset dacs after test
|
// Reset dacs after test
|
||||||
@ -126,81 +136,81 @@ TEST_CASE("Setting and reading back MYTHEN3 dacs", "[.cmd][.dacs]") {
|
|||||||
det.setDAC(defs::VTH3, vth3[i], false, {i});
|
det.setDAC(defs::VTH3, vth3[i], false, {i});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vsvp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvn"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vsvn"}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vtrim"}, -1, GET));
|
// REQUIRE_THROWS(caller.call("dac", {"vtrim"}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vrpreamp"}, -1, GET));
|
// REQUIRE_THROWS(caller.call("dac", {"vrpreamp"}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vrshaper"}, -1, GET));
|
// REQUIRE_THROWS(caller.call("dac", {"vrshaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtgstv"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vtgstv"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_ll"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_ll"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_lr"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_lr"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcal"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rl"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rl"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rr"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcmp_rr"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_rb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"rxb_rb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_lb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"rxb_lb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcn"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcn"}, -1, GET));
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vishaper"}, -1, GET));
|
// REQUIRE_THROWS(caller.call("dac", {"vishaper"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"iodelay"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"iodelay"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_ds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_ds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcascn_pb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcascn_pb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcascp_pb"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcascp_pb"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vout_cm"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vout_cm"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcasc_out"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcasc_out"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vin_cm"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vin_cm"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_comp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_comp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"ib_test_c"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"ib_test_c"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_h_adc"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_h_adc"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_fe"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp_fe"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_adc"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp_adc"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_cds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcom_cds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_rstore"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_rstore"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_opa_1st"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_opa_1st"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_comp_fe"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_comp_fe"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_adc1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcom_adc1"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_prech"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_prech"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_l_adc"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_l_adc"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_cds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vref_cds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_cs"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_cs"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_opa_fd"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_opa_fd"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_adc2"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vcom_adc2"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_ds"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_ds"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_comp"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_pixbuf"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vb_pixbuf"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vin_com"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vin_com"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vdd_prot"}, -1, GET));
|
REQUIRE_THROWS(caller.call("dac", {"vdd_prot"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* acquisition */
|
/* acquisition */
|
||||||
|
|
||||||
TEST_CASE("readout", "[.cmd]") {
|
TEST_CASE("Caller::readout", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
// PUT only command
|
// PUT only command
|
||||||
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("readout", {}, -1, GET));
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type != defs::MYTHEN3) {
|
if (det_type != defs::MYTHEN3) {
|
||||||
REQUIRE_THROWS(proxy.Call("readout", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("readout", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("readout", {}, -1, PUT, oss);
|
caller.call("readout", {}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "readout successful\n");
|
REQUIRE(oss.str() == "readout successful\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
TEST_CASE("counters", "[.cmd]") {
|
TEST_CASE("Caller::counters", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
REQUIRE_THROWS(proxy.Call("counters", {}, -1, PUT));
|
REQUIRE_THROWS(caller.call("counters", {}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("counters", {"3"}, -1, GET));
|
REQUIRE_THROWS(caller.call("counters", {"3"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("counters", {"0", "-1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("counters", {"0", "-1"}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("counters", {"0", "1", "1"}, -1, GET));
|
REQUIRE_THROWS(caller.call("counters", {"0", "1", "1"}, -1, GET));
|
||||||
|
|
||||||
auto mask = det.getCounterMask({0}).squash(-1);
|
auto mask = det.getCounterMask({0}).squash(-1);
|
||||||
std::vector<std::string> list_str;
|
std::vector<std::string> list_str;
|
||||||
@ -210,140 +220,140 @@ TEST_CASE("counters", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::ostringstream oss_set, oss_set2, oss_set3, oss_get;
|
std::ostringstream oss_set, oss_set2, oss_set3, oss_get;
|
||||||
proxy.Call("counters", {"0", "2", "1"}, -1, PUT, oss_set);
|
caller.call("counters", {"0", "2", "1"}, -1, PUT, oss_set);
|
||||||
REQUIRE(oss_set.str() == "counters [0, 2, 1]\n");
|
REQUIRE(oss_set.str() == "counters [0, 2, 1]\n");
|
||||||
proxy.Call("counters", {"0", "2"}, -1, PUT, oss_set2);
|
caller.call("counters", {"0", "2"}, -1, PUT, oss_set2);
|
||||||
REQUIRE(oss_set2.str() == "counters [0, 2]\n");
|
REQUIRE(oss_set2.str() == "counters [0, 2]\n");
|
||||||
// put back old value
|
// put back old value
|
||||||
proxy.Call("counters", list_str, -1, PUT, oss_set3);
|
caller.call("counters", list_str, -1, PUT, oss_set3);
|
||||||
REQUIRE(oss_set3.str() == "counters " + ToString(list_str) + "\n");
|
REQUIRE(oss_set3.str() == "counters " + ToString(list_str) + "\n");
|
||||||
proxy.Call("counters", {}, -1, GET, oss_get);
|
caller.call("counters", {}, -1, GET, oss_get);
|
||||||
REQUIRE(oss_get.str() == "counters " + ToString(list_str) + "\n");
|
REQUIRE(oss_get.str() == "counters " + ToString(list_str) + "\n");
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("counters", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("counters", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gates", "[.cmd]") {
|
TEST_CASE("Caller::gates", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getNumberOfGates();
|
auto prev_val = det.getNumberOfGates();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gates", {"1000"}, -1, PUT, oss);
|
caller.call("gates", {"1000"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gates 1000\n");
|
REQUIRE(oss.str() == "gates 1000\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gates", {}, -1, GET, oss);
|
caller.call("gates", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gates 1000\n");
|
REQUIRE(oss.str() == "gates 1000\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gates", {"1"}, -1, PUT, oss);
|
caller.call("gates", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gates 1\n");
|
REQUIRE(oss.str() == "gates 1\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("gates", {"0"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("gates", {"0"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setNumberOfGates(prev_val[i], {i});
|
det.setNumberOfGates(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gates", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gates", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime1", "[.cmd]") {
|
TEST_CASE("Caller::exptime1", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getExptime(0);
|
auto prev_val = det.getExptime(0);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime1", {"1.25s"}, -1, PUT, oss);
|
caller.call("exptime1", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime1", {}, -1, GET, oss);
|
caller.call("exptime1", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
REQUIRE(oss.str() == "exptime1 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime1", {"0"}, -1, PUT, oss);
|
caller.call("exptime1", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime1 0\n");
|
REQUIRE(oss.str() == "exptime1 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setExptime(0, prev_val[i], {i});
|
det.setExptime(0, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("exptime1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("exptime1", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime2", "[.cmd]") {
|
TEST_CASE("Caller::exptime2", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getExptime(1);
|
auto prev_val = det.getExptime(1);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime2", {"1.25s"}, -1, PUT, oss);
|
caller.call("exptime2", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime2", {}, -1, GET, oss);
|
caller.call("exptime2", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
REQUIRE(oss.str() == "exptime2 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime2", {"0"}, -1, PUT, oss);
|
caller.call("exptime2", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime2 0\n");
|
REQUIRE(oss.str() == "exptime2 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setExptime(1, prev_val[i], {i});
|
det.setExptime(1, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("exptime2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("exptime2", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("exptime3", "[.cmd]") {
|
TEST_CASE("Caller::exptime3", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getExptime(2);
|
auto prev_val = det.getExptime(2);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime3", {"1.25s"}, -1, PUT, oss);
|
caller.call("exptime3", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime3", {}, -1, GET, oss);
|
caller.call("exptime3", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
REQUIRE(oss.str() == "exptime3 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("exptime3", {"0"}, -1, PUT, oss);
|
caller.call("exptime3", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "exptime3 0\n");
|
REQUIRE(oss.str() == "exptime3 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setExptime(2, prev_val[i], {i});
|
det.setExptime(2, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("exptime3", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("exptime3", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay", "[.cmd]") {
|
TEST_CASE("Caller::gatedelay", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getExptimeForAllGates().tsquash(
|
auto prev_val = det.getExptimeForAllGates().tsquash(
|
||||||
@ -353,148 +363,148 @@ TEST_CASE("gatedelay", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay", {"0.05"}, -1, PUT, oss);
|
caller.call("gatedelay", {"0.05"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay 0.05\n");
|
REQUIRE(oss.str() == "gatedelay 0.05\n");
|
||||||
}
|
}
|
||||||
if (det_type != defs::MYTHEN3) {
|
if (det_type != defs::MYTHEN3) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay", {}, -1, GET, oss);
|
caller.call("gatedelay", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay 50ms\n");
|
REQUIRE(oss.str() == "gatedelay 50ms\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay", {"1s"}, -1, PUT, oss);
|
caller.call("gatedelay", {"1s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay 1s\n");
|
REQUIRE(oss.str() == "gatedelay 1s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay", {"0"}, -1, PUT, oss);
|
caller.call("gatedelay", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay 0\n");
|
REQUIRE(oss.str() == "gatedelay 0\n");
|
||||||
}
|
}
|
||||||
det.setGateDelay(-1, prev_val[0]);
|
det.setGateDelay(-1, prev_val[0]);
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gatedelay", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gatedelay", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay1", "[.cmd]") {
|
TEST_CASE("Caller::gatedelay1", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getGateDelay(0);
|
auto prev_val = det.getGateDelay(0);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay1", {"1.25s"}, -1, PUT, oss);
|
caller.call("gatedelay1", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay1", {}, -1, GET, oss);
|
caller.call("gatedelay1", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay1 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay1", {"0"}, -1, PUT, oss);
|
caller.call("gatedelay1", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay1 0\n");
|
REQUIRE(oss.str() == "gatedelay1 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setGateDelay(0, prev_val[i], {i});
|
det.setGateDelay(0, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gatedelay1", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gatedelay1", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay2", "[.cmd]") {
|
TEST_CASE("Caller::gatedelay2", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getGateDelay(1);
|
auto prev_val = det.getGateDelay(1);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay2", {"1.25s"}, -1, PUT, oss);
|
caller.call("gatedelay2", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay2", {}, -1, GET, oss);
|
caller.call("gatedelay2", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay2 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay2", {"0"}, -1, PUT, oss);
|
caller.call("gatedelay2", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay2 0\n");
|
REQUIRE(oss.str() == "gatedelay2 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setGateDelay(1, prev_val[i], {i});
|
det.setGateDelay(1, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gatedelay2", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gatedelay2", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("gatedelay3", "[.cmd]") {
|
TEST_CASE("Caller::gatedelay3", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getGateDelay(2);
|
auto prev_val = det.getGateDelay(2);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay3", {"1.25s"}, -1, PUT, oss);
|
caller.call("gatedelay3", {"1.25s"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay3", {}, -1, GET, oss);
|
caller.call("gatedelay3", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
REQUIRE(oss.str() == "gatedelay3 1.25s\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gatedelay3", {"0"}, -1, PUT, oss);
|
caller.call("gatedelay3", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gatedelay3 0\n");
|
REQUIRE(oss.str() == "gatedelay3 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setGateDelay(2, prev_val[i], {i});
|
det.setGateDelay(2, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("gatedelay3", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("gatedelay3", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("polarity", "[.cmd]") {
|
TEST_CASE("Caller::polarity", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getPolarity();
|
auto prev_val = det.getPolarity();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("polarity", {"pos"}, -1, PUT, oss);
|
caller.call("polarity", {"pos"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "polarity pos\n");
|
REQUIRE(oss.str() == "polarity pos\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("polarity", {"neg"}, -1, PUT, oss);
|
caller.call("polarity", {"neg"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "polarity neg\n");
|
REQUIRE(oss.str() == "polarity neg\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("polarity", {}, -1, GET, oss);
|
caller.call("polarity", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "polarity neg\n");
|
REQUIRE(oss.str() == "polarity neg\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setPolarity(prev_val[i], {i});
|
det.setPolarity(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("polarity", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("polarity", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("interpolation", "[.cmd]") {
|
TEST_CASE("Caller::interpolation", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
auto prev_interpolation = det.getInterpolation();
|
auto prev_interpolation = det.getInterpolation();
|
||||||
auto prev_mask = det.getCounterMask();
|
auto prev_mask = det.getCounterMask();
|
||||||
@ -509,7 +519,7 @@ TEST_CASE("interpolation", "[.cmd]") {
|
|||||||
det.setCounterMask(fixedMask[i]);
|
det.setCounterMask(fixedMask[i]);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("interpolation", {"1"}, -1, PUT, oss);
|
caller.call("interpolation", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "interpolation 1\n");
|
REQUIRE(oss.str() == "interpolation 1\n");
|
||||||
REQUIRE(det.getCounterMask().tsquash(
|
REQUIRE(det.getCounterMask().tsquash(
|
||||||
"inconsistent counter mask") == 7);
|
"inconsistent counter mask") == 7);
|
||||||
@ -519,7 +529,7 @@ TEST_CASE("interpolation", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("interpolation", {"0"}, -1, PUT, oss);
|
caller.call("interpolation", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "interpolation 0\n");
|
REQUIRE(oss.str() == "interpolation 0\n");
|
||||||
REQUIRE(det.getCounterMask().tsquash(
|
REQUIRE(det.getCounterMask().tsquash(
|
||||||
"inconsistent counter mask") == fixedMask[i]);
|
"inconsistent counter mask") == fixedMask[i]);
|
||||||
@ -533,7 +543,7 @@ TEST_CASE("interpolation", "[.cmd]") {
|
|||||||
|
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("interpolation", {}, -1, GET, oss);
|
caller.call("interpolation", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "interpolation 0\n");
|
REQUIRE(oss.str() == "interpolation 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -542,13 +552,13 @@ TEST_CASE("interpolation", "[.cmd]") {
|
|||||||
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("interpolation", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("interpolation", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pumpprobe", "[.cmd]") {
|
TEST_CASE("Caller::pumpprobe", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getPumpProbe();
|
auto prev_val = det.getPumpProbe();
|
||||||
auto prev_interpolation = det.getInterpolation();
|
auto prev_interpolation = det.getInterpolation();
|
||||||
@ -570,7 +580,7 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
|||||||
{
|
{
|
||||||
// pump probe
|
// pump probe
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pumpprobe", {"1"}, -1, PUT, oss);
|
caller.call("pumpprobe", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pumpprobe 1\n");
|
REQUIRE(oss.str() == "pumpprobe 1\n");
|
||||||
REQUIRE(det.getDAC(defs::VTH1, 0, {0})
|
REQUIRE(det.getDAC(defs::VTH1, 0, {0})
|
||||||
.tsquash("inconsistent vth2 dac value") ==
|
.tsquash("inconsistent vth2 dac value") ==
|
||||||
@ -583,11 +593,11 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
|||||||
disabledDacValue);
|
disabledDacValue);
|
||||||
}
|
}
|
||||||
// interpolation and pump probe
|
// interpolation and pump probe
|
||||||
REQUIRE_THROWS(proxy.Call("interpolation", {"1"}, -1, PUT));
|
REQUIRE_THROWS(caller.call("interpolation", {"1"}, -1, PUT));
|
||||||
{
|
{
|
||||||
// none
|
// none
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pumpprobe", {"0"}, -1, PUT, oss);
|
caller.call("pumpprobe", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "pumpprobe 0\n");
|
REQUIRE(oss.str() == "pumpprobe 0\n");
|
||||||
REQUIRE(det.getCounterMask().tsquash(
|
REQUIRE(det.getCounterMask().tsquash(
|
||||||
"inconsistent counter mask") == fixedMask[i]);
|
"inconsistent counter mask") == fixedMask[i]);
|
||||||
@ -607,7 +617,7 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("pumpprobe", {}, -1, GET, oss);
|
caller.call("pumpprobe", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "pumpprobe 0\n");
|
REQUIRE(oss.str() == "pumpprobe 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -619,63 +629,63 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
|||||||
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pumpprobe", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pumpprobe", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("apulse", "[.cmd]") {
|
TEST_CASE("Caller::apulse", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getAnalogPulsing();
|
auto prev_val = det.getAnalogPulsing();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("apulse", {"1"}, -1, PUT, oss);
|
caller.call("apulse", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "apulse 1\n");
|
REQUIRE(oss.str() == "apulse 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("apulse", {"0"}, -1, PUT, oss);
|
caller.call("apulse", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "apulse 0\n");
|
REQUIRE(oss.str() == "apulse 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("apulse", {}, -1, GET, oss);
|
caller.call("apulse", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "apulse 0\n");
|
REQUIRE(oss.str() == "apulse 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setAnalogPulsing(prev_val[i], {i});
|
det.setAnalogPulsing(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("apulse", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("apulse", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("dpulse", "[.cmd]") {
|
TEST_CASE("Caller::dpulse", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getDigitalPulsing();
|
auto prev_val = det.getDigitalPulsing();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dpulse", {"1"}, -1, PUT, oss);
|
caller.call("dpulse", {"1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "dpulse 1\n");
|
REQUIRE(oss.str() == "dpulse 1\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dpulse", {"0"}, -1, PUT, oss);
|
caller.call("dpulse", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "dpulse 0\n");
|
REQUIRE(oss.str() == "dpulse 0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("dpulse", {}, -1, GET, oss);
|
caller.call("dpulse", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "dpulse 0\n");
|
REQUIRE(oss.str() == "dpulse 0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setDigitalPulsing(prev_val[i], {i});
|
det.setDigitalPulsing(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("dpulse", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("dpulse", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "CmdProxy.h"
|
#include "Caller.h"
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/sls_detector_defs.h"
|
#include "sls/sls_detector_defs.h"
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
#include "sls/ToString.h"
|
#include "sls/ToString.h"
|
||||||
#include "sls/versionAPI.h"
|
#include "sls/versionAPI.h"
|
||||||
#include "test-CmdProxy-global.h"
|
#include "test-Caller-global.h"
|
||||||
#include "tests/globals.h"
|
#include "tests/globals.h"
|
||||||
|
|
||||||
namespace sls {
|
namespace sls {
|
||||||
@ -19,93 +19,93 @@ using test::PUT;
|
|||||||
|
|
||||||
/* Pattern */
|
/* Pattern */
|
||||||
|
|
||||||
TEST_CASE("patfname", "[.cmd]") {
|
TEST_CASE("Caller::patfname", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
REQUIRE_THROWS(proxy.Call("patfname", {}, -1, PUT));
|
REQUIRE_THROWS(caller.call("patfname", {}, -1, PUT));
|
||||||
REQUIRE_NOTHROW(proxy.Call("patfname", {}, -1, GET));
|
REQUIRE_NOTHROW(caller.call("patfname", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patfname", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patfname", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("pattern", "[.cmd]") {
|
TEST_CASE("Caller::pattern", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
// no proper test for put
|
// no proper test for put
|
||||||
REQUIRE_THROWS(proxy.Call("pattern", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pattern", {}, -1, GET));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("pattern", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("pattern", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("savepattern", "[.cmd]") {
|
TEST_CASE("Caller::savepattern", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
|
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, GET));
|
||||||
if (det.size() == 1) {
|
if (det.size() == 1) {
|
||||||
REQUIRE_NOTHROW(
|
REQUIRE_NOTHROW(
|
||||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(
|
REQUIRE_THROWS(
|
||||||
proxy.Call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
caller.call("savepattern", {"/tmp/pattern.txt"}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("defaultpattern", "[.cmd]") {
|
TEST_CASE("Caller::defaultpattern", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("defaultpattern", {}, -1, GET));
|
||||||
REQUIRE_NOTHROW(proxy.Call("defaultpattern", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("defaultpattern", {}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("defaultpattern", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("defaultpattern", {}, -1, PUT));
|
REQUIRE_THROWS(caller.call("defaultpattern", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patioctrl", "[.cmd]") {
|
TEST_CASE("Caller::patioctrl", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getPatternIOControl();
|
auto prev_val = det.getPatternIOControl();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patioctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
|
caller.call("patioctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patioctrl 0xc15004808d0a21a4\n");
|
REQUIRE(oss.str() == "patioctrl 0xc15004808d0a21a4\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patioctrl", {"0xaadf0"}, -1, PUT, oss);
|
caller.call("patioctrl", {"0xaadf0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patioctrl", {}, -1, GET, oss);
|
caller.call("patioctrl", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
REQUIRE(oss.str() == "patioctrl 0x00000000000aadf0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setPatternIOControl(prev_val[i], {i});
|
det.setPatternIOControl(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patioctrl", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patioctrl", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patword", "[.cmd]") {
|
TEST_CASE("Caller::patword", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
@ -114,19 +114,19 @@ TEST_CASE("patword", "[.cmd]") {
|
|||||||
auto prev_val = det.getPatternWord(addr);
|
auto prev_val = det.getPatternWord(addr);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patword", {saddr, "0xc15004808d0a21a4"}, -1, PUT, oss);
|
caller.call("patword", {saddr, "0xc15004808d0a21a4"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"patword [" + saddr + ", 0xc15004808d0a21a4]\n");
|
"patword [" + saddr + ", 0xc15004808d0a21a4]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patword", {saddr, "0xaadf0"}, -1, PUT, oss);
|
caller.call("patword", {saddr, "0xaadf0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patword", {saddr}, -1, GET, oss);
|
caller.call("patword", {saddr}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
"patword [" + saddr + ", 0x00000000000aadf0]\n");
|
||||||
}
|
}
|
||||||
@ -134,25 +134,25 @@ TEST_CASE("patword", "[.cmd]") {
|
|||||||
det.setPatternWord(addr, prev_val[i], {i});
|
det.setPatternWord(addr, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patword", {"0x23"}, -1, GET));
|
REQUIRE_THROWS(caller.call("patword", {"0x23"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patlimits", "[.cmd]") {
|
TEST_CASE("Caller::patlimits", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getPatternLoopAddresses(-1);
|
auto prev_val = det.getPatternLoopAddresses(-1);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patlimits", {"0x20", "0x5c"}, -1, PUT, oss);
|
caller.call("patlimits", {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patlimits", {}, -1, GET, oss);
|
caller.call("patlimits", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == "patlimits [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -160,13 +160,13 @@ TEST_CASE("patlimits", "[.cmd]") {
|
|||||||
{i});
|
{i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patlimits", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patlimits", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patloop", "[.cmd]") {
|
TEST_CASE("Caller::patloop", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
@ -181,24 +181,24 @@ TEST_CASE("patloop", "[.cmd]") {
|
|||||||
std::string deprecatedCmd = "patloop" + sLoop;
|
std::string deprecatedCmd = "patloop" + sLoop;
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
REQUIRE(oss.str() == deprecatedCmd + " [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patloop", {sLoop, "0x20", "0x5c"}, -1, PUT, oss);
|
caller.call("patloop", {sLoop, "0x20", "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"patloop " + sLoop + " [0x0020, 0x005c]\n");
|
"patloop " + sLoop + " [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patloop", {sLoop}, -1, GET, oss);
|
caller.call("patloop", {sLoop}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
"patloop " + sLoop + " [0x0020, 0x005c]\n");
|
"patloop " + sLoop + " [0x0020, 0x005c]\n");
|
||||||
}
|
}
|
||||||
@ -208,13 +208,13 @@ TEST_CASE("patloop", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patloop", {"0"}, -1, GET));
|
REQUIRE_THROWS(caller.call("patloop", {"0"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patnloop", "[.cmd]") {
|
TEST_CASE("Caller::patnloop", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
@ -229,23 +229,23 @@ TEST_CASE("patnloop", "[.cmd]") {
|
|||||||
std::string deprecatedCmd = "patnloop" + sLoop;
|
std::string deprecatedCmd = "patnloop" + sLoop;
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 5\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patnloop", {sLoop, "5"}, -1, PUT, oss);
|
caller.call("patnloop", {sLoop, "5"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patnloop " + sLoop + " 5\n");
|
REQUIRE(oss.str() == "patnloop " + sLoop + " 5\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patnloop", {sLoop}, -1, GET, oss);
|
caller.call("patnloop", {sLoop}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patnloop " + sLoop + " 5\n");
|
REQUIRE(oss.str() == "patnloop " + sLoop + " 5\n");
|
||||||
}
|
}
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||||
@ -253,13 +253,13 @@ TEST_CASE("patnloop", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patnloop", {"0"}, -1, GET));
|
REQUIRE_THROWS(caller.call("patnloop", {"0"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwait", "[.cmd]") {
|
TEST_CASE("Caller::patwait", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
@ -274,23 +274,23 @@ TEST_CASE("patwait", "[.cmd]") {
|
|||||||
std::string deprecatedCmd = "patwait" + sLoop;
|
std::string deprecatedCmd = "patwait" + sLoop;
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 0x005c\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwait", {sLoop, "0x5c"}, -1, PUT, oss);
|
caller.call("patwait", {sLoop, "0x5c"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patwait " + sLoop + " 0x005c\n");
|
REQUIRE(oss.str() == "patwait " + sLoop + " 0x005c\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwait", {sLoop}, -1, GET, oss);
|
caller.call("patwait", {sLoop}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patwait " + sLoop + " 0x005c\n");
|
REQUIRE(oss.str() == "patwait " + sLoop + " 0x005c\n");
|
||||||
}
|
}
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||||
@ -298,13 +298,13 @@ TEST_CASE("patwait", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patwait", {"0"}, -1, GET));
|
REQUIRE_THROWS(caller.call("patwait", {"0"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patwaittime", "[.cmd]") {
|
TEST_CASE("Caller::patwaittime", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
@ -319,23 +319,23 @@ TEST_CASE("patwaittime", "[.cmd]") {
|
|||||||
std::string deprecatedCmd = "patwaittime" + sLoop;
|
std::string deprecatedCmd = "patwaittime" + sLoop;
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
caller.call(deprecatedCmd, {"8589936640"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||||
}
|
}
|
||||||
{ // depreciated
|
{ // depreciated
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call(deprecatedCmd, {}, -1, GET, oss);
|
caller.call(deprecatedCmd, {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
REQUIRE(oss.str() == deprecatedCmd + " 8589936640\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwaittime", {sLoop, "8589936640"}, -1, PUT, oss);
|
caller.call("patwaittime", {sLoop, "8589936640"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patwaittime " + sLoop + " 8589936640\n");
|
REQUIRE(oss.str() == "patwaittime " + sLoop + " 8589936640\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patwaittime", {sLoop}, -1, GET, oss);
|
caller.call("patwaittime", {sLoop}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patwaittime " + sLoop + " 8589936640\n");
|
REQUIRE(oss.str() == "patwaittime " + sLoop + " 8589936640\n");
|
||||||
}
|
}
|
||||||
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
for (int iDet = 0; iDet != det.size(); ++iDet) {
|
||||||
@ -343,69 +343,69 @@ TEST_CASE("patwaittime", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patwaittime", {"0"}, -1, GET));
|
REQUIRE_THROWS(caller.call("patwaittime", {"0"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patmask", "[.cmd]") {
|
TEST_CASE("Caller::patmask", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getPatternMask();
|
auto prev_val = det.getPatternMask();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patmask", {"0x842f020204200dc0"}, -1, PUT, oss);
|
caller.call("patmask", {"0x842f020204200dc0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patmask", {}, -1, GET, oss);
|
caller.call("patmask", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
REQUIRE(oss.str() == "patmask 0x842f020204200dc0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setPatternMask(prev_val[i], {i});
|
det.setPatternMask(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patmask", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patmask", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patsetbit", "[.cmd]") {
|
TEST_CASE("Caller::patsetbit", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3) {
|
||||||
auto prev_val = det.getPatternBitMask();
|
auto prev_val = det.getPatternBitMask();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patsetbit", {"0x842f020204200dc0"}, -1, PUT, oss);
|
caller.call("patsetbit", {"0x842f020204200dc0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("patsetbit", {}, -1, GET, oss);
|
caller.call("patsetbit", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
REQUIRE(oss.str() == "patsetbit 0x842f020204200dc0\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setPatternBitMask(prev_val[i], {i});
|
det.setPatternBitMask(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patsetbit", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patsetbit", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("patternstart", "[.cmd]") {
|
TEST_CASE("Caller::patternstart", "[.cmdcall]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
Caller caller(&det);
|
||||||
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, GET));
|
REQUIRE_THROWS(caller.call("patternstart", {}, -1, GET));
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::MYTHEN3) {
|
if (det_type == defs::MYTHEN3) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("patternstart", {}, -1, PUT));
|
REQUIRE_NOTHROW(caller.call("patternstart", {}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("patternstart", {}, -1, PUT));
|
REQUIRE_THROWS(caller.call("patternstart", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
|||||||
// 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"
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
void test_valid_port(const std::string &command,
|
|
||||||
const std::vector<std::string> &arguments, int detector_id,
|
|
||||||
int action);
|
|
||||||
|
|
||||||
void test_dac(slsDetectorDefs::dacIndex index, const std::string &dacname,
|
|
||||||
int dacvalue);
|
|
||||||
void test_onchip_dac(slsDetectorDefs::dacIndex index,
|
|
||||||
const std::string &dacname, int dacvalue);
|
|
||||||
|
|
||||||
} // namespace sls
|
|
@ -1,164 +0,0 @@
|
|||||||
// 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"
|
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "sls/Result.h"
|
|
||||||
#include "sls/ToString.h"
|
|
||||||
#include "sls/versionAPI.h"
|
|
||||||
#include "test-CmdProxy-global.h"
|
|
||||||
#include "tests/globals.h"
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
using test::GET;
|
|
||||||
using test::PUT;
|
|
||||||
|
|
||||||
/* dacs */
|
|
||||||
|
|
||||||
TEST_CASE("Setting and reading back GOTTHARD dacs", "[.cmd][.dacs]") {
|
|
||||||
// vref_ds, vcascn_pb, vcascp_pb, vout_cm, vcasc_out, vin_cm, vref_comp,
|
|
||||||
// ib_test_c
|
|
||||||
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::GOTTHARD) {
|
|
||||||
SECTION("vref_ds") { test_dac(defs::VREF_DS, "vref_ds", 660); }
|
|
||||||
SECTION("vcascn_pb") { test_dac(defs::VCASCN_PB, "vcascn_pb", 650); }
|
|
||||||
SECTION("vcascp_pb") { test_dac(defs::VCASCP_PB, "vcascp_pb", 1480); }
|
|
||||||
SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1520); }
|
|
||||||
SECTION("vcasc_out") { test_dac(defs::VCASC_OUT, "vcasc_out", 1320); }
|
|
||||||
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1350); }
|
|
||||||
SECTION("vref_comp") { test_dac(defs::VREF_COMP, "vref_comp", 350); }
|
|
||||||
SECTION("ib_test_c") { test_dac(defs::IB_TESTC, "ib_test_c", 2001); }
|
|
||||||
// eiger
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vthreshold"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvp"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vsvn"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtrim"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrpreamp"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtgstv"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_ll"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_lr"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rl"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcmp_rr"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_rb"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"rxb_lb"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcp"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcn"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vishaper"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"iodelay"}, -1, GET));
|
|
||||||
// jungfrau
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vdd_prot"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vin_com"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_prech"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_pixbuf"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_ds"}, -1, GET));
|
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vref_ds"}, -1, GET));
|
|
||||||
// REQUIRE_THROWS(proxy.Call("dac", {"vref_comp"}, -1, GET));
|
|
||||||
// mythen3
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrpreamp"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vrshaper_n"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vipre"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vishaper"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vdcsh"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth1"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth2"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vth3"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal_n"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcal_p"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vtrim"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcassh"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcas"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vicin"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vipre_out"}, -1, GET));
|
|
||||||
// gotthard2
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_h_adc"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_fe"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_adc"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_cds"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_rstore"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_opa_1st"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_comp_fe"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_adc1"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_l_adc"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vref_cds"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_cs"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vb_opa_fd"}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("dac", {"vcom_adc2"}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Gotthard Specific */
|
|
||||||
|
|
||||||
TEST_CASE("roi", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD) {
|
|
||||||
if (det.size() > 1) {
|
|
||||||
REQUIRE_THROWS(proxy.Call("roi", {"0", "255"}, -1, PUT));
|
|
||||||
REQUIRE_NOTHROW(proxy.Call("roi", {}, -1, GET));
|
|
||||||
} else {
|
|
||||||
auto prev_val = det.getROI();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("roi", {"0", "255"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "roi [0, 255]\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("roi", {"256", "511"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "roi [256, 511]\n");
|
|
||||||
}
|
|
||||||
REQUIRE_THROWS(proxy.Call("roi", {"0", "256"}, -1, PUT));
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setROI(prev_val[i], i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("roi", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("clearroi", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
|
|
||||||
if (det_type == defs::GOTTHARD) {
|
|
||||||
auto prev_val = det.getROI();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("clearroi", {}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "clearroi successful\n");
|
|
||||||
}
|
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
|
||||||
det.setROI(prev_val[i], i);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("clearroi", {}, -1, PUT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("exptimel", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::GOTTHARD) {
|
|
||||||
REQUIRE_NOTHROW(proxy.Call("exptimel", {}, -1, GET));
|
|
||||||
} else {
|
|
||||||
REQUIRE_THROWS(proxy.Call("exptimel", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sls
|
|
@ -1,109 +0,0 @@
|
|||||||
// 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"
|
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include "sls/Result.h"
|
|
||||||
#include "sls/ToString.h"
|
|
||||||
#include "sls/versionAPI.h"
|
|
||||||
#include "test-CmdProxy-global.h"
|
|
||||||
#include "tests/globals.h"
|
|
||||||
|
|
||||||
namespace sls {
|
|
||||||
|
|
||||||
using test::GET;
|
|
||||||
using test::PUT;
|
|
||||||
|
|
||||||
/* dacs */
|
|
||||||
TEST_CASE("Setting and reading back moench dacs", "[.cmd][.dacs]") {
|
|
||||||
// vbp_colbuf, vipre, vin_cm, vb_sda, vcasc_sfp, vout_cm, vipre_cds,
|
|
||||||
// ibias_sfp
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::MOENCH) {
|
|
||||||
SECTION("vbp_colbuf") {
|
|
||||||
test_dac(defs::VBP_COLBUF, "vbp_colbuf", 1300);
|
|
||||||
}
|
|
||||||
SECTION("vipre") { test_dac(defs::VIPRE, "vipre", 1000); }
|
|
||||||
SECTION("vin_cm") { test_dac(defs::VIN_CM, "vin_cm", 1400); }
|
|
||||||
SECTION("vb_sda") { test_dac(defs::VB_SDA, "vb_sda", 680); }
|
|
||||||
SECTION("vcasc_sfp") { test_dac(defs::VCASC_SFP, "vcasc_sfp", 1428); }
|
|
||||||
SECTION("vout_cm") { test_dac(defs::VOUT_CM, "vout_cm", 1200); }
|
|
||||||
SECTION("vipre_cds") { test_dac(defs::VIPRE_CDS, "vipre_cds", 800); }
|
|
||||||
SECTION("ibias_sfp") { test_dac(defs::IBIAS_SFP, "ibias_sfp", 900); }
|
|
||||||
// eiger
|
|
||||||
REQUIRE_THROWS(proxy.Call("vthreshold", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vsvp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vsvn", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vtgstv", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_ll", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_lr", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcal", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_rl", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcmp_rr", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("rxb_rb", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("rxb_lb", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcn", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("iodelay", {}, -1, GET));
|
|
||||||
// gotthard
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcascn_pb", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcascp_pb", {}, -1, GET));
|
|
||||||
// REQUIRE_THROWS(proxy.Call("vout_cm", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcasc_out", {}, -1, GET));
|
|
||||||
// REQUIRE_THROWS(proxy.Call("vin_cm", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("ib_test_c", {}, -1, GET));
|
|
||||||
// mythen3
|
|
||||||
REQUIRE_THROWS(proxy.Call("vrpreamp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vrshaper_n", {}, -1, GET));
|
|
||||||
// REQUIRE_THROWS(proxy.Call("vipre", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vishaper", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vdcsh", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vth1", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vth2", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vth3", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_n", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcal_p", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vtrim", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcassh", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcas", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vicin", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vipre_out", {}, -1, GET));
|
|
||||||
// gotthard2
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_h_adc", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_fe", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp_adc", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_cds", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_rstore", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_1st", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp_fe", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc1", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_l_adc", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_cds", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_cs", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_opa_fd", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vcom_adc2", {}, -1, GET));
|
|
||||||
// jungfrau
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_comp", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vdd_prot", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vin_com", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_prech", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_pixbuf", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vb_ds", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_ds", {}, -1, GET));
|
|
||||||
REQUIRE_THROWS(proxy.Call("vref_comp", {}, -1, GET));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace sls
|
|
@ -126,7 +126,7 @@ def loadConfig(name, rx_hostname, settingsdir):
|
|||||||
|
|
||||||
def startCmdTests(name, fp, fname):
|
def startCmdTests(name, fp, fname):
|
||||||
Log(Fore.GREEN, 'Cmd Tests for ' + name)
|
Log(Fore.GREEN, 'Cmd Tests for ' + name)
|
||||||
cmd = 'tests --abort [.cmd] -s -o ' + fname
|
cmd = 'tests --abort [.cmdcall] -s -o ' + fname
|
||||||
p = subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True)
|
p = subprocess.run(cmd.split(), stdout=fp, stderr=fp, check=True, text=True)
|
||||||
p.check_returncode()
|
p.check_returncode()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user