diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b0303b2fa28e026536cea80698da90aef55a68a..b23f7642349300242c7c65968c14bebc4e4e2d58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,8 @@ if(TESTING_IS_ENABLED) file(GLOB XML_FILES variable ${CMAKE_SOURCE_DIR}/tests/variableTreeXml/*.xml) file(COPY ${XML_FILES} DESTINATION ${PROJECT_BINARY_DIR}/variableTreeXml) - file(COPY ${CMAKE_SOURCE_DIR}/tests/EqFctTest.xml DESTINATION ${PROJECT_BINARY_DIR}) + file(GLOB TEST_XML_FILES variable ${CMAKE_SOURCE_DIR}/tests/variableTreeXml/*.xml) + file(COPY ${TEST_XML_FILES} DESTINATION ${PROJECT_BINARY_DIR}) #The make coverage command is only available in debug mode IF(CMAKE_BUILD_TYPE STREQUAL "Debug") diff --git a/src/eq_create.cc b/src/eq_create.cc index 05ca55e499ecb1d69d844b769011bcda9427a762..1829f2a42016a19616bfa346dc38fec3f3b70bff 100644 --- a/src/eq_create.cc +++ b/src/eq_create.cc @@ -1,8 +1,12 @@ #include <ChimeraTK/ControlSystemAdapter/ApplicationBase.h> #include "DoocsAdapter.h" +#include "VariableMapper.h" +#include "getAllVariableNames.h" +#include <sys/stat.h> char const *object_name; +static char const * DOOCS_VARIABLE_CONFIG_FILE = "DoocsVariableConfig.xml"; static ChimeraTK::DoocsAdapter doocsAdapter; @@ -16,6 +20,21 @@ void eq_init_prolog() { ChimeraTK::ApplicationBase::getInstance().setPVManager(doocsAdapter.getDevicePVManager()); ChimeraTK::ApplicationBase::getInstance().initialise(); + // the variable manager can only be filled after we have the CS manager + auto pvNames = ChimeraTK::getAllVariableNames( doocsAdapter.getControlSystemPVManager() ); + + struct stat buffer; + if (stat (DOOCS_VARIABLE_CONFIG_FILE, &buffer) == 0){ + ChimeraTK::VariableMapper::getInstance().prepareOutput(DOOCS_VARIABLE_CONFIG_FILE, pvNames); + }else{ + std::cerr << "WARNIUNG: No XML file for the Doocs variable config found. Trying direct import." << std::endl; + ChimeraTK::VariableMapper::getInstance().directImport(pvNames); + } + std::cout << "here is the mappging:" << std::endl; + for (auto &tmp : ChimeraTK::VariableMapper::getInstance().getAllProperties() ){ + std::cout << tmp.first << " -> " << tmp.second.location << " / " << tmp.second.name << std::endl; + } + // activate the advanced archiver to have histories set_arch_mode(1); } diff --git a/tests/DoocsVariableConfig.xml b/tests/DoocsVariableConfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..5f0e33f3521ad0df2709bbdacb6eac11d5622089 --- /dev/null +++ b/tests/DoocsVariableConfig.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<device_server xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter"> + <location name="MY_RENAMED_INTEGER_LOCATION"> + <import>/INT</import> + </location> + <import>/</import> +</device_server> diff --git a/tests/referenceTestDoocsServer/referenceTestDoocsServer.conf b/tests/referenceTestDoocsServer/referenceTestDoocsServer.conf index b18b3a6fec0b1da12dadca4af2b6973e05f3547d..a66080abdf1819101045068f56c961e4ea4e5654 100644 --- a/tests/referenceTestDoocsServer/referenceTestDoocsServer.conf +++ b/tests/referenceTestDoocsServer/referenceTestDoocsServer.conf @@ -15,10 +15,10 @@ SVR.NAME: "REFERENCE_TEST._SVR" SVR.RATE: 1 0 0 0 SVR.BPN: 6000 } -eq_fct_name: "INT" +eq_fct_name: "MY_RENAMED_INTEGER_LOCATION" eq_fct_type: 10 { -NAME: "INT" +NAME: "MY_RENAMED_INTEGER_LOCATION" } eq_fct_name: "SHORT" eq_fct_type: 10