From b0b29912415f5647d4f98d719bae1ee6bb40b9a7 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 8 Apr 2026 16:27:51 +0200 Subject: [PATCH] cmd generation and compiles --- python/src/detector.cpp | 30 +-- .../generator/autocomplete/autocomplete.py | 6 +- .../autocomplete/bash_autocomplete.sh | 76 ++++++-- .../autocomplete/zsh_autocomplete.sh | 76 ++++++-- slsDetectorSoftware/generator/commands.yaml | 41 ++-- .../generator/extended_commands.yaml | 179 ++++++++++++++++-- slsDetectorSoftware/include/sls/Detector.h | 34 ++-- slsDetectorSoftware/include/sls/Result.h | 3 + slsDetectorSoftware/src/Caller.cpp | 103 ++++++---- slsDetectorSoftware/src/Detector.cpp | 36 ++-- slsDetectorSoftware/src/Module.cpp | 2 +- slsDetectorSoftware/src/Module.h | 2 +- slsDetectorSoftware/src/inferAction.cpp | 22 +++ 13 files changed, 447 insertions(+), 163 deletions(-) diff --git a/python/src/detector.cpp b/python/src/detector.cpp index 7bad555c0..ffacf6811 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -1529,23 +1529,31 @@ void init_det(py::module &m) { Detector::setNumberOfAnalogSamples, py::arg(), py::arg() = Positions{}); CppDetectorApi.def("getADCClock", - (Result(Detector::*)(sls::Positions) const) & + (Result(Detector::*)(sls::Positions) const) & Detector::getADCClock, py::arg() = Positions{}); CppDetectorApi.def("setADCClock", - (void (Detector::*)(int, sls::Positions)) & + (void (Detector::*)(defs::Hz, sls::Positions)) & Detector::setADCClock, py::arg(), py::arg() = Positions{}); CppDetectorApi.def("getRUNClock", - (Result(Detector::*)(sls::Positions) const) & + (Result(Detector::*)(sls::Positions) const) & Detector::getRUNClock, py::arg() = Positions{}); CppDetectorApi.def("setRUNClock", - (void (Detector::*)(int, sls::Positions)) & + (void (Detector::*)(defs::Hz, sls::Positions)) & Detector::setRUNClock, py::arg(), py::arg() = Positions{}); + CppDetectorApi.def("getDBITClock", + (Result(Detector::*)(sls::Positions) const) & + Detector::getDBITClock, + py::arg() = Positions{}); + CppDetectorApi.def("setDBITClock", + (void (Detector::*)(defs::Hz, sls::Positions)) & + Detector::setDBITClock, + py::arg(), py::arg() = Positions{}); CppDetectorApi.def("getSYNCClock", - (Result(Detector::*)(sls::Positions) const) & + (Result(Detector::*)(sls::Positions) const) & Detector::getSYNCClock, py::arg() = Positions{}); CppDetectorApi.def("getPowerList", @@ -1621,14 +1629,6 @@ void init_det(py::module &m) { (void (Detector::*)(defs::readoutMode, sls::Positions)) & Detector::setReadoutMode, py::arg(), py::arg() = Positions{}); - CppDetectorApi.def("getDBITClock", - (Result(Detector::*)(sls::Positions) const) & - Detector::getDBITClock, - py::arg() = Positions{}); - CppDetectorApi.def("setDBITClock", - (void (Detector::*)(int, sls::Positions)) & - Detector::setDBITClock, - py::arg(), py::arg() = Positions{}); CppDetectorApi.def( "getMeasuredPower", (Result(Detector::*)(defs::dacIndex, sls::Positions) const) & @@ -1880,9 +1880,9 @@ void init_det(py::module &m) { Detector::configureTransceiver, py::arg() = Positions{}); CppDetectorApi.def( - "getPatterFileName", + "getPatternFileName", (Result(Detector::*)(sls::Positions) const) & - Detector::getPatterFileName, + Detector::getPatternFileName, py::arg() = Positions{}); CppDetectorApi.def( "setPattern", diff --git a/slsDetectorSoftware/generator/autocomplete/autocomplete.py b/slsDetectorSoftware/generator/autocomplete/autocomplete.py index c34ac019f..f236bcc67 100644 --- a/slsDetectorSoftware/generator/autocomplete/autocomplete.py +++ b/slsDetectorSoftware/generator/autocomplete/autocomplete.py @@ -41,11 +41,11 @@ def get_types(arg_types): #list of options with a command line call that fetches them #TODO! Rename sls_detector_get if "defs::dacIndex" in arg_types: - return "`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return r"`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" elif "defs::detectorSettings" in arg_types: - return "`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return r"`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" elif "defs::timingMode" in arg_types: - return "`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" + return r"`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" return ret diff --git a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh index 4234674d7..571973deb 100644 --- a/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/bash_autocomplete.sh @@ -96,10 +96,18 @@ return 0 } __adcclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -524,7 +532,7 @@ __dac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="mV mv" @@ -532,7 +540,7 @@ fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -565,12 +573,12 @@ __dacname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -611,10 +619,18 @@ return 0 } __dbitclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -648,21 +664,21 @@ __defaultdac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -671,13 +687,13 @@ __defaultpattern() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -1874,12 +1890,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2099,10 +2115,18 @@ return 0 } __runclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -2387,7 +2411,7 @@ __scan() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2440,7 +2464,7 @@ __settings() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2550,12 +2574,12 @@ __slowadcname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2659,6 +2683,16 @@ return 0 } __syncclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi +if [[ ${IS_GET} -eq 0 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi return 0 } __temp_10ge() { @@ -2752,13 +2786,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2770,13 +2804,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2785,7 +2819,7 @@ __timing() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 diff --git a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh index 7b9e0fa6f..8db2abc66 100644 --- a/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh +++ b/slsDetectorSoftware/generator/autocomplete/zsh_autocomplete.sh @@ -20,10 +20,18 @@ return 0 } __adcclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -448,7 +456,7 @@ __dac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="mV mv" @@ -456,7 +464,7 @@ fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -489,12 +497,12 @@ __dacname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -535,10 +543,18 @@ return 0 } __dbitclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -572,21 +588,21 @@ __defaultdac() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -595,13 +611,13 @@ __defaultpattern() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "4" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -1798,12 +1814,12 @@ __powername() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2023,10 +2039,18 @@ return 0 } __runclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi +if [[ "${cword}" == "3" ]]; then +FCN_RETURN="Hz MHz kHz" +fi fi return 0 } @@ -2311,7 +2335,7 @@ __scan() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2364,7 +2388,7 @@ __settings() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2474,12 +2498,12 @@ __slowadcname() { FCN_RETURN="" if [[ ${IS_GET} -eq 1 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get daclist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "3" ]]; then FCN_RETURN="" @@ -2583,6 +2607,16 @@ return 0 } __syncclk() { FCN_RETURN="" +if [[ ${IS_GET} -eq 1 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi +if [[ ${IS_GET} -eq 0 ]]; then +if [[ "${cword}" == "2" ]]; then +FCN_RETURN="Hz MHz kHz" +fi +fi return 0 } __temp_10ge() { @@ -2676,13 +2710,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2694,13 +2728,13 @@ if [[ "${cword}" == "2" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "3" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi if [[ "${cword}" == "4" ]]; then FCN_RETURN="" fi if [[ "${cword}" == "5" ]]; then -FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get settingslist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 @@ -2709,7 +2743,7 @@ __timing() { FCN_RETURN="" if [[ ${IS_GET} -eq 0 ]]; then if [[ "${cword}" == "2" ]]; then -FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\1/' | sed 's/,//g'`" +FCN_RETURN="`sls_detector_get timinglist | sed -e 's/.*\[\(.*\)\].*/\\1/' | sed 's/,//g'`" fi fi return 0 diff --git a/slsDetectorSoftware/generator/commands.yaml b/slsDetectorSoftware/generator/commands.yaml index 760345916..efe173a97 100644 --- a/slsDetectorSoftware/generator/commands.yaml +++ b/slsDetectorSoftware/generator/commands.yaml @@ -37,6 +37,21 @@ FREQ_COMMAND: output: converted_freq output: [ 'args[0]', 'args[1]' ] +FREQ_GET_COMMAND: + infer_action: true + help: "" + template: true + actions: + GET: + require_det_id: true + function: '' + args: + - argc: 0 + output: [ OutString(t) ] + - argc: 1 + arg_types: [ special::freq_unit ] + output: [ "OutString(t , args[0])" ] + TIME_COMMAND: infer_action: true help: "" @@ -479,9 +494,9 @@ runclk: inherit_actions: FREQ_COMMAND actions: GET: - function: getRunClock + function: getRUNClock PUT: - function: setRunClock + function: setRUNClock dbitclk: @@ -489,9 +504,18 @@ dbitclk: inherit_actions: FREQ_COMMAND actions: GET: - function: getDBitClock + function: getDBITClock PUT: - function: setDBitClock + function: setDBITClock + +################# FREQ_GET_COMMAND ############# + +syncclk: + inherit_actions: FREQ_GET_COMMAND + help: "[n_clk] [(optional unit) Hz(default)|kHz|MHz]\n\t[Ctb] Sync clock." + actions: + GET: + function: getSYNCClock ################# TIME_COMMAND ############# @@ -2046,19 +2070,12 @@ burstsl: GET: function: getNumberOfBurstsLeft -syncclk: - inherit_actions: GET_COMMAND - help: "[n_clk in MHz]\n\t[Ctb] Sync clock in MHz." - actions: - GET: - function: getSYNCClock - patfname: inherit_actions: GET_COMMAND help: "\n\t[Ctb][Mythen3][Xilinx Ctb] Gets the pattern file name including path of the last pattern uploaded. Returns an empty if nothing was uploaded or via a server default file" actions: GET: - function: getPatterFileName + function: getPatternFileName lastclient: inherit_actions: GET_COMMAND diff --git a/slsDetectorSoftware/generator/extended_commands.yaml b/slsDetectorSoftware/generator/extended_commands.yaml index f40089fea..70fad51da 100644 --- a/slsDetectorSoftware/generator/extended_commands.yaml +++ b/slsDetectorSoftware/generator/extended_commands.yaml @@ -86,27 +86,69 @@ adcclk: - OutString(t) require_det_id: true store_result_in_t: true + - arg_types: + - special::freq_unit + argc: 1 + cast_input: [] + check_det_id: false + convert_det_id: true + function: getADCClock + input: [] + input_types: [] + output: + - OutString(t , args[0]) + require_det_id: true + store_result_in_t: true PUT: args: - arg_types: - - int + - std::string argc: 1 cast_input: - - true + - false check_det_id: false convert_det_id: true function: setADCClock input: - - args[0] + - converted_freq input_types: - - int + - defs::Hz output: - - args.front() + - args[0] + require_det_id: true + separate_freq_units: + input: args[0] + output: + - converted_freq + - unit + store_result_in_t: false + - arg_types: + - int + - special::freq_unit + argc: 2 + cast_input: + - false + check_det_id: false + convert_det_id: true + convert_to_freq: + input: + - args[0] + - args[1] + output: converted_freq + function: setADCClock + input: + - converted_freq + input_types: + - defs::Hz + output: + - args[0] + - args[1] require_det_id: true store_result_in_t: false command_name: adcclk function_alias: adcclk - help: "[n_clk in MHz]\n\t[Ctb][xilinx Ctb] ADC clock frequency in MHz." + help: "[n_clk] [(optional unit) Hz(default)|kHz|MHz]\n\t[Ctb][Xilinx Ctb] ADC clock\ + \ frequency." infer_action: true template: true adcenable: @@ -2174,27 +2216,69 @@ dbitclk: - OutString(t) require_det_id: true store_result_in_t: true + - arg_types: + - special::freq_unit + argc: 1 + cast_input: [] + check_det_id: false + convert_det_id: true + function: getDBITClock + input: [] + input_types: [] + output: + - OutString(t , args[0]) + require_det_id: true + store_result_in_t: true PUT: args: - arg_types: - - int + - std::string argc: 1 cast_input: - - true + - false check_det_id: false convert_det_id: true function: setDBITClock input: - - args[0] + - converted_freq input_types: - - int + - defs::Hz output: - - args.front() + - args[0] + require_det_id: true + separate_freq_units: + input: args[0] + output: + - converted_freq + - unit + store_result_in_t: false + - arg_types: + - int + - special::freq_unit + argc: 2 + cast_input: + - false + check_det_id: false + convert_det_id: true + convert_to_freq: + input: + - args[0] + - args[1] + output: converted_freq + function: setDBITClock + input: + - converted_freq + input_types: + - defs::Hz + output: + - args[0] + - args[1] require_det_id: true store_result_in_t: false command_name: dbitclk function_alias: dbitclk - help: "[n_clk in MHz]\n\t[Ctb][xilinx Ctb] Clock for latching the digital bits in MHz." + help: "[n_clk] [(optional unit) Hz(default)|kHz|MHz]\n\t[Ctb][Xilinx Ctb] Clock\ + \ for latching the digital bits." infer_action: true template: true dbitphase: @@ -5896,7 +5980,7 @@ patfname: cast_input: [] check_det_id: false convert_det_id: true - function: getPatterFileName + function: getPatternFileName input: [] input_types: [] output: @@ -8205,27 +8289,69 @@ runclk: - OutString(t) require_det_id: true store_result_in_t: true + - arg_types: + - special::freq_unit + argc: 1 + cast_input: [] + check_det_id: false + convert_det_id: true + function: getRUNClock + input: [] + input_types: [] + output: + - OutString(t , args[0]) + require_det_id: true + store_result_in_t: true PUT: args: - arg_types: - - int + - std::string argc: 1 cast_input: - - true + - false check_det_id: false convert_det_id: true function: setRUNClock input: - - args[0] + - converted_freq input_types: - - int + - defs::Hz output: - - args.front() + - args[0] + require_det_id: true + separate_freq_units: + input: args[0] + output: + - converted_freq + - unit + store_result_in_t: false + - arg_types: + - int + - special::freq_unit + argc: 2 + cast_input: + - false + check_det_id: false + convert_det_id: true + convert_to_freq: + input: + - args[0] + - args[1] + output: converted_freq + function: setRUNClock + input: + - converted_freq + input_types: + - defs::Hz + output: + - args[0] + - args[1] require_det_id: true store_result_in_t: false command_name: runclk function_alias: runclk - help: "[n_clk in MHz]\n\t[Ctb][xilinx Ctb] Run clock in MHz." + help: "[n_clk] [(optional unit) Hz(default)|kHz|MHz]\n\t[Ctb][Xilinx Ctb] Run clock\ + \ frequency." infer_action: true template: true runtime: @@ -10664,9 +10790,22 @@ syncclk: - OutString(t) require_det_id: true store_result_in_t: true + - arg_types: + - special::freq_unit + argc: 1 + cast_input: [] + check_det_id: false + convert_det_id: true + function: getSYNCClock + input: [] + input_types: [] + output: + - OutString(t , args[0]) + require_det_id: true + store_result_in_t: true command_name: syncclk function_alias: syncclk - help: "[n_clk in MHz]\n\t[Ctb] Sync clock in MHz." + help: "[n_clk] [(optional unit) Hz(default)|kHz|MHz]\n\t[Ctb] Sync clock." infer_action: true template: true temp_10ge: diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index 99edd3cb9..d58eb0949 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1613,20 +1613,26 @@ class Detector { /** [CTB] */ void setNumberOfAnalogSamples(int value, Positions pos = {}); - /** [CTB] in Hz, [XCTB] in Hz */ - Result getADCClock(Positions pos = {}) const; + /** [CTB][XCTB] */ + Result getADCClock(Positions pos = {}) const; - /** [CTB] in Hz, [XCTB] in Hz */ - void setADCClock(int value_in_Hz, Positions pos = {}); + /** [CTB][XCTB] */ + void setADCClock(defs::Hz val, Positions pos = {}); - /** [CTB] in Hz, [XCTB] in Hz */ - Result getRUNClock(Positions pos = {}) const; + /** [CTB][XCTB] */ + Result getRUNClock(Positions pos = {}) const; - /** [CTB] in Hz, [XCTB] in Hz */ - void setRUNClock(int value_in_Hz, Positions pos = {}); + /** [CTB][XCTB] */ + void setRUNClock(defs::Hz val, Positions pos = {}); - /** [CTB] in MHZ */ - Result getSYNCClock(Positions pos = {}) const; + /** [CTB][XCTB] */ + Result getDBITClock(Positions pos = {}) const; + + /** [CTB][XCTB] */ + void setDBITClock(defs::Hz val, Positions pos = {}); + + /** [CTB][XCTB] */ + Result getSYNCClock(Positions pos = {}) const; /** gets list of power enums */ std::vector getPowerList() const; @@ -1692,12 +1698,6 @@ class Detector { */ void setReadoutMode(defs::readoutMode value, Positions pos = {}); - /** [CTB] in Hz, [XCTB] in Hz */ - Result getDBITClock(Positions pos = {}) const; - - /** [CTB] in Hz, [XCTB] in Hz */ - void setDBITClock(int value_in_Hz, Positions pos = {}); - /** * [CTB] mV * Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */ @@ -1920,7 +1920,7 @@ class Detector { /** [CTB][Mythen3][Xilinx CTB] Gets the pattern file name including path of * the last pattern uploaded. \n Returns an empty if nothing was uploaded or * via a server default file*/ - Result getPatterFileName(Positions pos = {}) const; + Result getPatternFileName(Positions pos = {}) const; /** [CTB][Mythen3][Xilinx CTB] Loads ASCII pattern file directly to server * (instead of executing line by line)*/ diff --git a/slsDetectorSoftware/include/sls/Result.h b/slsDetectorSoftware/include/sls/Result.h index 0cb937408..5554bdaa8 100644 --- a/slsDetectorSoftware/include/sls/Result.h +++ b/slsDetectorSoftware/include/sls/Result.h @@ -38,6 +38,7 @@ template > class Result { template ::value && (std::is_same::value || + std::is_same::value || std::is_same::value)>::type> Result(const Result &from) { vec.reserve(from.size()); @@ -49,6 +50,7 @@ template > class Result { template ::value && (std::is_same::value || + std::is_same::value || std::is_same::value)>::type> Result(Result &from) { vec.reserve(from.size()); @@ -60,6 +62,7 @@ template > class Result { template ::value && (std::is_same::value || + std::is_same::value || std::is_same::value)>::type> Result(Result &&from) { vec.reserve(from.size()); diff --git a/slsDetectorSoftware/src/Caller.cpp b/slsDetectorSoftware/src/Caller.cpp index d0c18da25..6cc2024e8 100644 --- a/slsDetectorSoftware/src/Caller.cpp +++ b/slsDetectorSoftware/src/Caller.cpp @@ -72,20 +72,24 @@ std::string Caller::adcclk(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([ADC clock frequency] [(optional unit) MHz|kHz|Hz])V0G0N" + os << R"V0G0N([n_clk] [(optional unit) Hz(default)|kHz|MHz] + [Ctb][Xilinx Ctb] ADC clock frequency. )V0G0N" << std::endl; return os.str(); } // check if action and arguments are valid if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { + if (1 && args.size() != 0 && args.size() != 1) { throw RuntimeError("Wrong number of arguments for action GET"); } if (args.size() == 0) { } + if (args.size() == 1) { + } + } else if (action == slsDetectorDefs::PUT_ACTION) { @@ -97,17 +101,17 @@ std::string Caller::adcclk(int action) { try { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - StringToHz(tmp_freq, unit); + auto converted_freq = StringTo(tmp_freq, unit); } catch (...) { - throw RuntimeError("Could not convert argument to frequency"); + throw RuntimeError("Could not convert argument to defs::Hz"); } } if (args.size() == 2) { try { - StringToHz(args[0], args[1]); + StringTo(args[0], args[1]); } catch (...) { - throw RuntimeError("Could not convert arguments to frequency"); + throw RuntimeError("Could not convert arguments to defs::Hz"); } } @@ -125,20 +129,25 @@ std::string Caller::adcclk(int action) { auto t = det->getADCClock(std::vector{det_id}); os << OutString(t) << '\n'; } + + if (args.size() == 1) { + auto t = det->getADCClock(std::vector{det_id}); + os << OutString(t, args[0]) << '\n'; + } } if (action == slsDetectorDefs::PUT_ACTION) { if (args.size() == 1) { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - auto converted_freq_hz = StringToHz(tmp_freq, unit); - det->setADCClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(tmp_freq, unit); + det->setADCClock(converted_freq, std::vector{det_id}); os << args[0] << '\n'; } if (args.size() == 2) { - auto converted_freq_hz = StringToHz(args[0], args[1]); - det->setADCClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(args[0], args[1]); + det->setADCClock(converted_freq, std::vector{det_id}); os << args[0] << args[1] << '\n'; } } @@ -2727,20 +2736,24 @@ std::string Caller::dbitclk(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([dbit clock frequency] [(optional unit) MHz|kHz|Hz])V0G0N" + os << R"V0G0N([n_clk] [(optional unit) Hz(default)|kHz|MHz] + [Ctb][Xilinx Ctb] Clock for latching the digital bits. )V0G0N" << std::endl; return os.str(); } // check if action and arguments are valid if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { + if (1 && args.size() != 0 && args.size() != 1) { throw RuntimeError("Wrong number of arguments for action GET"); } if (args.size() == 0) { } + if (args.size() == 1) { + } + } else if (action == slsDetectorDefs::PUT_ACTION) { @@ -2752,17 +2765,17 @@ std::string Caller::dbitclk(int action) { try { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - StringToHz(tmp_freq, unit); + auto converted_freq = StringTo(tmp_freq, unit); } catch (...) { - throw RuntimeError("Could not convert argument to frequency"); + throw RuntimeError("Could not convert argument to defs::Hz"); } } if (args.size() == 2) { try { - StringToHz(args[0], args[1]); + StringTo(args[0], args[1]); } catch (...) { - throw RuntimeError("Could not convert arguments to frequency"); + throw RuntimeError("Could not convert arguments to defs::Hz"); } } @@ -2780,20 +2793,25 @@ std::string Caller::dbitclk(int action) { auto t = det->getDBITClock(std::vector{det_id}); os << OutString(t) << '\n'; } + + if (args.size() == 1) { + auto t = det->getDBITClock(std::vector{det_id}); + os << OutString(t, args[0]) << '\n'; + } } if (action == slsDetectorDefs::PUT_ACTION) { if (args.size() == 1) { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - auto converted_freq_hz = StringToHz(tmp_freq, unit); - det->setDBITClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(tmp_freq, unit); + det->setDBITClock(converted_freq, std::vector{det_id}); os << args[0] << '\n'; } if (args.size() == 2) { - auto converted_freq_hz = StringToHz(args[0], args[1]); - det->setDBITClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(args[0], args[1]); + det->setDBITClock(converted_freq, std::vector{det_id}); os << args[0] << args[1] << '\n'; } } @@ -7563,7 +7581,7 @@ std::string Caller::patfname(int action) { // generate code for each action if (action == slsDetectorDefs::GET_ACTION) { if (args.size() == 0) { - auto t = det->getPatterFileName(std::vector{det_id}); + auto t = det->getPatternFileName(std::vector{det_id}); os << OutString(t) << '\n'; } } @@ -10243,20 +10261,24 @@ std::string Caller::runclk(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([Run clock frequency] [(optional unit) MHz|kHz|Hz])V0G0N" + os << R"V0G0N([n_clk] [(optional unit) Hz(default)|kHz|MHz] + [Ctb][Xilinx Ctb] Run clock frequency. )V0G0N" << std::endl; return os.str(); } // check if action and arguments are valid if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { + if (1 && args.size() != 0 && args.size() != 1) { throw RuntimeError("Wrong number of arguments for action GET"); } if (args.size() == 0) { } + if (args.size() == 1) { + } + } else if (action == slsDetectorDefs::PUT_ACTION) { @@ -10268,17 +10290,17 @@ std::string Caller::runclk(int action) { try { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - StringToHz(tmp_freq, unit); + auto converted_freq = StringTo(tmp_freq, unit); } catch (...) { - throw RuntimeError("Could not convert argument to frequency"); + throw RuntimeError("Could not convert argument to defs::Hz"); } } if (args.size() == 2) { try { - StringToHz(args[0], args[1]); + StringTo(args[0], args[1]); } catch (...) { - throw RuntimeError("Could not convert arguments to frequency"); + throw RuntimeError("Could not convert arguments to defs::Hz"); } } @@ -10296,20 +10318,25 @@ std::string Caller::runclk(int action) { auto t = det->getRUNClock(std::vector{det_id}); os << OutString(t) << '\n'; } + + if (args.size() == 1) { + auto t = det->getRUNClock(std::vector{det_id}); + os << OutString(t, args[0]) << '\n'; + } } if (action == slsDetectorDefs::PUT_ACTION) { if (args.size() == 1) { std::string tmp_freq(args[0]); std::string unit = RemoveUnit(tmp_freq); - auto converted_freq_hz = StringToHz(tmp_freq, unit); - det->setRUNClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(tmp_freq, unit); + det->setRUNClock(converted_freq, std::vector{det_id}); os << args[0] << '\n'; } if (args.size() == 2) { - auto converted_freq_hz = StringToHz(args[0], args[1]); - det->setRUNClock(converted_freq_hz, std::vector{det_id}); + auto converted_freq = StringTo(args[0], args[1]); + det->setRUNClock(converted_freq, std::vector{det_id}); os << args[0] << args[1] << '\n'; } } @@ -13448,21 +13475,24 @@ std::string Caller::syncclk(int action) { std::ostringstream os; // print help if (action == slsDetectorDefs::HELP_ACTION) { - os << R"V0G0N([n_clk in MHz] - [Ctb] Sync clock in MHz. )V0G0N" + os << R"V0G0N([n_clk] [(optional unit) Hz(default)|kHz|MHz] + [Ctb] Sync clock. )V0G0N" << std::endl; return os.str(); } // check if action and arguments are valid if (action == slsDetectorDefs::GET_ACTION) { - if (1 && args.size() != 0) { + if (1 && args.size() != 0 && args.size() != 1) { throw RuntimeError("Wrong number of arguments for action GET"); } if (args.size() == 0) { } + if (args.size() == 1) { + } + } else { @@ -13477,6 +13507,11 @@ std::string Caller::syncclk(int action) { auto t = det->getSYNCClock(std::vector{det_id}); os << OutString(t) << '\n'; } + + if (args.size() == 1) { + auto t = det->getSYNCClock(std::vector{det_id}); + os << OutString(t, args[0]) << '\n'; + } } return os.str(); diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 1acafd8d3..b10c1b0d4 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -2144,25 +2144,34 @@ void Detector::setNumberOfAnalogSamples(int value, Positions pos) { pimpl->Parallel(&Module::setNumberOfAnalogSamples, pos, value); } -Result Detector::getADCClock(Positions pos) const { +Result Detector::getADCClock(Positions pos) const { return pimpl->Parallel(&Module::getClockFrequency, pos, defs::ADC_CLOCK); } -void Detector::setADCClock(int value_in_Hz, Positions pos) { +void Detector::setADCClock(defs::Hz val, Positions pos) { pimpl->Parallel(&Module::setClockFrequency, pos, defs::ADC_CLOCK, - value_in_Hz); + val.value); } -Result Detector::getRUNClock(Positions pos) const { +Result Detector::getRUNClock(Positions pos) const { return pimpl->Parallel(&Module::getClockFrequency, pos, defs::RUN_CLOCK); } -void Detector::setRUNClock(int value_in_Hz, Positions pos) { +void Detector::setRUNClock(defs::Hz val, Positions pos) { pimpl->Parallel(&Module::setClockFrequency, pos, defs::RUN_CLOCK, - value_in_Hz); + val.value); } -Result Detector::getSYNCClock(Positions pos) const { +Result Detector::getDBITClock(Positions pos) const { + return pimpl->Parallel(&Module::getClockFrequency, pos, defs::DBIT_CLOCK); +} + +void Detector::setDBITClock(defs::Hz val, Positions pos) { + pimpl->Parallel(&Module::setClockFrequency, pos, defs::DBIT_CLOCK, + val.value); +} + +Result Detector::getSYNCClock(Positions pos) const { return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK); } @@ -2277,15 +2286,6 @@ void Detector::setReadoutMode(defs::readoutMode value, Positions pos) { pimpl->Parallel(&Module::setReadoutMode, pos, value); } -Result Detector::getDBITClock(Positions pos) const { - return pimpl->Parallel(&Module::getClockFrequency, pos, defs::DBIT_CLOCK); -} - -void Detector::setDBITClock(int value_in_Hz, Positions pos) { - pimpl->Parallel(&Module::setClockFrequency, pos, defs::DBIT_CLOCK, - value_in_Hz); -} - Result Detector::getMeasuredPower(defs::dacIndex index, Positions pos) const { switch (index) { @@ -2593,8 +2593,8 @@ void Detector::configureTransceiver(Positions pos) { // Pattern -Result Detector::getPatterFileName(Positions pos) const { - return pimpl->Parallel(&Module::getPatterFileName, pos); +Result Detector::getPatternFileName(Positions pos) const { + return pimpl->Parallel(&Module::getPatternFileName, pos); } void Detector::setPattern(const std::string &fname, Positions pos) { diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 29a51f5b4..d12ee0b46 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -2625,7 +2625,7 @@ void Module::configureTransceiver() { } // Pattern -std::string Module::getPatterFileName() const { +std::string Module::getPatternFileName() const { char retval[MAX_STR_LENGTH]{}; sendToDetector(F_GET_PATTERN_FILE_NAME, nullptr, retval); return retval; diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 9f75f1765..4b52dd52f 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -528,7 +528,7 @@ class Module : public virtual slsDetectorDefs { * Pattern * * * * ************************************************/ - std::string getPatterFileName() const; + std::string getPatternFileName() const; void setPattern(const Pattern &pat, const std::string &fname); Pattern getPattern(); void loadDefaultPattern(); diff --git a/slsDetectorSoftware/src/inferAction.cpp b/slsDetectorSoftware/src/inferAction.cpp index 16ce05068..c57f3a69e 100644 --- a/slsDetectorSoftware/src/inferAction.cpp +++ b/slsDetectorSoftware/src/inferAction.cpp @@ -63,6 +63,12 @@ int InferAction::adcclk() { } if (args.size() == 1) { + throw RuntimeError( + "sls_detector is disabled for command: adcclk with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); + } + + if (args.size() == 2) { return slsDetectorDefs::PUT_ACTION; } @@ -711,6 +717,12 @@ int InferAction::dbitclk() { } if (args.size() == 1) { + throw RuntimeError( + "sls_detector is disabled for command: dbitclk with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); + } + + if (args.size() == 2) { return slsDetectorDefs::PUT_ACTION; } @@ -2573,6 +2585,12 @@ int InferAction::runclk() { } if (args.size() == 1) { + throw RuntimeError( + "sls_detector is disabled for command: runclk with number of " + "arguments 1. Use sls_detector_get or sls_detector_put"); + } + + if (args.size() == 2) { return slsDetectorDefs::PUT_ACTION; } @@ -3455,6 +3473,10 @@ int InferAction::syncclk() { return slsDetectorDefs::GET_ACTION; } + if (args.size() == 1) { + return slsDetectorDefs::GET_ACTION; + } + else { throw RuntimeError("Could not infer action: Wrong number of arguments");