Skip to content
Snippets Groups Projects
Commit 63e580e1 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

doc: modernise example(s)

parent ffa2299a
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 358 deletions
../COPYING.LESSER
\ No newline at end of file
../This_project_uses_the_project-template.txt
\ No newline at end of file
../cmake/
\ No newline at end of file
# Conf file created at 17:08.38 13. Jun. 2016
# eq_fct_type's are defined in eq_fct_code.h
eq_conf:
oper_uid: -1
oper_gid: 422
xpert_uid: 0
xpert_gid: 0
ring_buffer: 10000
memory_buffer: 500
eq_fct_name: "NODENAME._SVR"
eq_fct_type: 1
{
SVR.NAME: "NODENAME._SVR"
STS: 0x1c
STS.ERROR: 0
STS.NEWERROR: 1
STS.ERRORMASK: 1
STS.ONLINE: 1
ERROR.STR: 0 0 0 1078761493 ""
SYS_MASK: 1
FCT_CODE: 1
FCT_PANEL: ""
X_POS: 0
Z_POS: 0
Z_POS.STRING: ""
DEVICE.INFO: 235672 0 0 0 "Device OK"
MESSAGE: ""
LAST_UPDATE: 1112798768 350 0 0
LAST_USR1: 0 0 0 0
SVR.ALIAS: 0
SVR.ARCFLUSH: 0
SVR.ARCFLUSH_B: 0
SVR.UPDATE: 1465830518
SVR.RATE: 1 0 0 0
SVR.RESIZE: 200
SVR.FILE: "demoApp.conf"
SVR.DESC: ""
SVR.PROGRAMMER: "mhier"
SVR.XMLFILE: ""
SVR.ERRORLOG: "/doocs/nodename/server/InstaCoSADevExample_server/InstaCoSADevExample_server.log"
SVR.STORE.RATE: 10
SVR.STORE.AUTO: 4
SVR.HOST_NAME: "mskpcx19821"
SVR.PROCESSNAME: "demoApp"
SVR.RPC_NUMBER: 610498009
SVR.STARTTIME: 1465830430
SVR.LIBINFO: "18.10.6"
SVR.LIBDATE: "Jun 2 13:38"
SVR.WDADDR: ""
SVR.CONTR: 0x0
SVR.MUST_RUN: 0
SVR.STOP_SVR: 0
SVR.START_CMD: ""
SVR.RPC_CALL_TIME.COMMENT: "Time per Call"
SVR.RPC_CALL_TIME.EGU: 1 1 100000 0 "rate"
SVR.RPC_CALL_TIME.XEGU: 0 0 100 0 "ms"
SVR.UPDATE_TIME.COMMENT: "Time per Update"
SVR.UPDATE_TIME.EGU: 1 1 100000 0 "rate"
SVR.UPDATE_TIME.XEGU: 0 0 100 0 "ms"
SVR.USR1_TIME.COMMENT: "run time of SIGUSR1"
SVR.USR1_TIME.EGU: 1 1 1e+06 1427728880 "counts"
SVR.USR1_TIME.XEGU: 0 0 100 1427728880 "ms"
SVR.USR1_PERIOD.COMMENT: "time between SIGUSR1"
SVR.USR1_PERIOD.EGU: 1 1 1e+06 1427728880 "counts"
SVR.USR1_PERIOD.XEGU: 0 0 500 1427728880 "ms"
SVR.ARCH_GET_TIME.COMMENT: "time per archiver get"
SVR.ARCH_GET_TIME.EGU: 1 1 1e+06 1459338630 "counts"
SVR.ARCH_GET_TIME.XEGU: 0 0 100 1459338630 "ms"
SVR.LAFL: 0
SVR.ERROR_COUNT: 0
DEVICE.ONLINE: 1
DEVICE.OFFLINE: 0
SVR.DEVMAX: 0
SVR.TINERUN: 0
SVR.TINEVERS: "4.05.0009"
SVR.TINEPREF: ""
SVR.TINESUFF: ""
SVR.TINE_DBG: 0
SVR.TINE_LOG: 0
SVR.TINE_FEC: 0 0 0 0 ""
SVR.TINE_PORT: 0
SVR.TINE_MTU: 1472
SVR.TINE_CTSZ: 32
SVR.TINE_MCTTL: 16
SVR.TINE_BLIM: 1000
SVR.TINE_CDLY: 20
SVR.TINE_GROUP: 0
SVR.FACILITY: "TEST.DOOCS"
SVR.DEVICE: "InstaCoSADevExample"
T_ZERO: 700
SVR.BPN: 0
SVR.SPR: 0
}
eq_fct_name: "Bakery"
eq_fct_type: 10
{
NAME: "Bakery"
STS: 0xc
STS.ERROR: 0
STS.NEWERROR: 1
STS.ERRORMASK: 0
STS.ONLINE: 1
ERROR.STR: 0 0 0 1112798768 "ok"
SYS_MASK: 222
FCT_CODE: 10
FCT_PANEL: ""
X_POS: 0
Z_POS: 0
Z_POS.STRING: ""
DEVICE.INFO: 0 0 0 0 "HALLO"
MESSAGE: ""
LAST_UPDATE: 1465830518 750 0 0
LAST_USR1: 0 0 0 0
readback: 20
setpoint: 10
}
oven (sharedMemoryDummy?map=oven.map)
<?xml version="1.0" encoding="UTF-8"?>
<device_server xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter">
<location name="Bakery">
<import>/</import>
</location>
</device_server>
# name nr of elements address size bar width fracbits signed R/W
heater.temperatureReadback 1 0 4 0 32 16 0 RO
heater.heatingCurrent 1 4 4 0 32 16 0 RW
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <ChimeraTK/ApplicationCore/ApplicationCore.h>
#include <ChimeraTK/ApplicationCore/EnableXMLGenerator.h>
#include <ChimeraTK/ApplicationCore/PeriodicTrigger.h>
namespace ctk = ChimeraTK;
struct ExampleApp : public ctk::Application {
ExampleApp() : Application("exampleApp3") { debugMakeConnections(); }
~ExampleApp() { shutdown(); }
ctk::SetDMapFilePath dmapPath{"example2.dmap"};
ctk::PeriodicTrigger timer{this, "Timer", "Periodic timer for the controller", 1000};
// ctk::DeviceModule dev{this, "oven"};
ctk::DeviceModule dev{this, "oven", "/Timer/tick"};
// ctk::ControlSystemModule cs;
// void defineConnections();
};
static ExampleApp theExampleApp;
// void ExampleApp::defineConnections() {
// ChimeraTK::setDMapFilePath("example2.dmap");
// dev.connectTo(cs, timer.tick);
// }
project(TemplateServer)
cmake_minimum_required(VERSION 3.5.1)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Use the project template to get the settings required for an application core project
set(${PROJECT_NAME}_MAJOR_VERSION 01)
set(${PROJECT_NAME}_MINOR_VERSION 00)
set(${PROJECT_NAME}_PATCH_VERSION 00)
include(cmake/set_version_numbers.cmake)
include(cmake/set_default_build_to_release.cmake)
# configure version.h
configure_file(include/version.h.in ${PROJECT_BINARY_DIR}/version/version.h)
include_directories(${PROJECT_BINARY_DIR}/version)
# Add the dependencies. We need ApplicationCore and a control system adapter implementation.
#
# /!\ if you need the DeviceAccess-DoocsBackend, you have to add the dependency _after_
# /!\ selecting the control system adapter, otherwise your server will not work.
#
# Define dependences
include(cmake/add_dependency.cmake)
add_dependency(ChimeraTK-ApplicationCore 03.00 REQUIRED)
# Select the control system adapter
include(cmake/set_control_system_adapter.cmake)
# Define compiler and linker flags - extend compiler flags with flags from dependencies
include(cmake/set_default_flags.cmake)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ChimeraTK-ApplicationCore_CXX_FLAGS}")
set(CMAKE_LINK_FLAGS "-Wl,--no-as-needed ${Adapter_LINK_FLAGS} ${ChimeraTK-ApplicationCore_LINK_FLAGS}")
############################################################################################################
# server library config
############################################################################################################
# set include directories for library
include_directories(${CMAKE_SOURCE_DIR}/include)
file(GLOB library_headers "${CMAKE_SOURCE_DIR}/include/*.h")
set(${PROJECT_NAME}_INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include/)
# create lists with source files for library
aux_source_directory(${CMAKE_SOURCE_DIR}/src library_sources)
# server library (to avoid compiling everyting multiple times)
add_library(${PROJECT_NAME}lib SHARED ${library_sources} ${library_headers} ${PROJECT_BINARY_DIR}/version/version.h)
set_target_properties(${PROJECT_NAME}lib PROPERTIES VERSION ${${PROJECT_NAME}_FULL_LIBRARY_VERSION}
SOVERSION ${${PROJECT_NAME}_SOVERSION})
target_link_libraries(${PROJECT_NAME}lib ${ChimeraTK-ApplicationCore_LIBRARIES} ${ADAPTER_LIBRARIES})
############################################################################################################
# server executable config
############################################################################################################
# The server executable. It depends on application core and the control system adapter implementation.
add_executable(${PROJECT_NAME} src_server/ApplicationInstance.cc)
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "${CMAKE_LINK_FLAGS}")
target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}lib ${ChimeraTK-ApplicationCore_LIBRARIES} ${Adapter_LIBRARIES} )
# We compile the same sources with the GENERATE_XML flag to get an xml generator.
# This one does not depent on a control system adapter implementation.
add_executable(${PROJECT_NAME}-xmlGenerator src_xmlGenerator/XmlGenerator.cc)
set_target_properties( ${PROJECT_NAME}-xmlGenerator PROPERTIES COMPILE_FLAGS "-DGENERATE_XML")
set_target_properties(${PROJECT_NAME}-xmlGenerator PROPERTIES LINK_FLAGS "${ChimeraTK-ApplicationCore_LINK_FLAGS}")
target_link_libraries(${PROJECT_NAME}-xmlGenerator ${PROJECT_NAME}lib ${ChimeraTK-ApplicationCore_LIBRARIES})
############################################################################################################
# server tests config
############################################################################################################
enable_testing()
find_package(Boost COMPONENTS thread system unit_test_framework REQUIRED)
# Create the executables for automated unit testing (new modular tests).
# add one test executable per source file
aux_source_directory(${CMAKE_SOURCE_DIR}/tests/executables_src testExecutables)
foreach( testExecutableSrcFile ${testExecutables})
#NAME_WE means the base name without path and (longest) extension
get_filename_component(excutableName ${testExecutableSrcFile} NAME_WE)
add_executable(${excutableName} ${testExecutableSrcFile})
target_link_libraries(${excutableName} ${PROJECT_NAME}lib)
set_target_properties(${excutableName} PROPERTIES LINK_FLAGS "${CMAKE_LINK_FLAGS}")
add_test(${excutableName} ${excutableName})
endforeach( testExecutableSrcFile )
# Copy the (test) config files to the build directory
file( COPY ${CMAKE_SOURCE_DIR}/config/ DESTINATION ${PROJECT_BINARY_DIR})
############################################################################################################
# server installation config
############################################################################################################
# Installation:
# FIXME: For doocs we need a special treatment when installing to /export/doocs/server (don't install to bin subdirectory, but a directory named like the server). This should go to the project template.
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/export/doocs/server")
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}-xmlGenerator RUNTIME DESTINATION ${PROJECT_NAME})
else()
install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}-xmlGenerator RUNTIME DESTINATION bin)
endif()
# Do not install the config. It is only a test config.
# The real config will come from a config generator and usually depends on the instance.
../COPYING
\ No newline at end of file
../COPYING.LESSER
\ No newline at end of file
../This_project_uses_the_project-template.txt
\ No newline at end of file
../cmake
\ No newline at end of file
<configuration>
<variable name="config_var1" type="int32" value="42"/>
<module name="Configuration">
<variable name="config_var1" type="int32" value="3"/>
<variable name="config_var2" type="int32" value="7"/>
</module>
</configuration>
<?xml version="1.0" encoding="UTF-8"?>
<device_server xmlns="https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter">
<location name="TEMPLATE_LOCATION">
<!-- Simply import all variables provided by the application
Adapt to your needs!
-->
<import>/</import>
</location>
</device_server>
eq_conf:
oper_uid: -1
oper_gid: 405
xpert_uid: 1000
xpert_gid: 1000
ring_buffer: 10000
memory_buffer: 500
eq_fct_name: "TEMPLATE_SERVER._SVR"
eq_fct_type: 1
{
SVR.RPC_NUMBER: 610498009
SVR.NAME: "TEMPLATE_SERVER._SVR"
SVR.BPN: 6000
}
eq_fct_name: "TEMPLATE_LOCATION"
eq_fct_type: 10
{
NAME: "TEMPLATE_LOCATION"
}
DummyDevice (sharedMemoryDummy:?map=dummydevice.map)
MappedDummyDevice (logicalNameMap?map=name_mapping.xlmap&target=DummyDevice)
#name n_words address n_bytes BAR n_bits n_fractionalBits signed
WORD_1 1 0 4 0 32 0 0 RW
MODULE_1.AREA 2 4 8 0 32 0 0 RW
<logicalNameMap>
<redirectedRegister name="SingleWord">
<targetDevice><par>target</par></targetDevice>
<targetRegister>WORD_1</targetRegister>
</redirectedRegister>
<module name="Module1">
<redirectedRegister name="Channel0">
<targetDevice><par>target</par></targetDevice>
<targetRegister>MODULE_1.AREA</targetRegister>
<targetStartIndex>0</targetStartIndex>
<numberOfElements>1</numberOfElements>
</redirectedRegister>
<redirectedRegister name="Channel1">
<targetDevice><par>target</par></targetDevice>
<targetRegister>MODULE_1.AREA</targetRegister>
<targetStartIndex>1</targetStartIndex>
<numberOfElements>1</numberOfElements>
</redirectedRegister>
</module>
</logicalNameMap>
// SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
// SPDX-License-Identifier: LGPL-3.0-or-later
#pragma once
#include <ChimeraTK/ApplicationCore/ApplicationCore.h>
#include <ChimeraTK/ApplicationCore/ConfigReader.h>
// TODO Note to optionally use to trigger
//#include <ChimeraTK/ApplicationCore/PeriodicTrigger.h>
#include "TemplateModule.h"
namespace ctk = ChimeraTK;
/**
* Server - An ApplicationCore template server
*
* The Application object for this server. It provides
* dummy Device- and ApplicationModules and a ConfigReader.
*
* All modules are simply connected to the ControlSystem.
* No triggering is implemented, as this is specific to the application
* (either provided by a Device or a ChimeraTK::PeriodicTrigger).
*/
struct Server : public ctk::Application {
Server(std::string appName = "TemplateServer");
~Server() override;
ctk::SetDMapFilePath dmapPath;
ctk::ConfigReader config;
ctk::DeviceModule device;
TemplateModule templateModule;
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment