51 #include "ChimeraTK/ControlSystemAdapter/ApplicationBase.h"
53 #include "open62541/plugin/log_stdout.h"
59 boost::shared_ptr<ChimeraTK::ControlSystemPVManager>
csManager;
60 boost::shared_ptr<ChimeraTK::DevicePVManager>
devManager;
65 static void SigHandler_Int(
int ) {
66 UA_LOG_INFO(
csaOPCUA->
getLogger(), UA_LOGCATEGORY_USERLAND,
"Received SIGINT... terminating");
72 ChimeraTK::ApplicationBase::getInstance().shutdown();
73 std::cout <<
"OPC UA adapter termianted." << std::endl;
77 signal(SIGINT, SigHandler_Int);
78 signal(SIGTERM, SigHandler_Int);
83 sigemptyset(&intmask);
84 sigaddset(&intmask, SIGINT);
85 sigprocmask(SIG_BLOCK, &intmask,
nullptr);
87 std::pair<boost::shared_ptr<ChimeraTK::ControlSystemPVManager>, boost::shared_ptr<ChimeraTK::DevicePVManager>>
88 pvManagers = ChimeraTK::createPVManager();
94 ChimeraTK::ApplicationBase::getInstance().setPVManager(
devManager);
95 ChimeraTK::ApplicationBase::getInstance().initialise();
97 string pathToConfig = ChimeraTK::ApplicationBase::getInstance().getName() +
"_mapping.xml";
100 UA_LOG_INFO(
csaOPCUA->
getLogger(), UA_LOGCATEGORY_USERLAND,
"Optimize unmapped variables in the application base");
103 UA_LOG_INFO(
csaOPCUA->
getLogger(), UA_LOGCATEGORY_USERLAND,
"Run the application instance");
104 ChimeraTK::ApplicationBase::getInstance().run();
106 UA_LOG_INFO(
csaOPCUA->
getLogger(), UA_LOGCATEGORY_USERLAND,
"Start the OPC UA Adapter");
110 sigprocmask(SIG_UNBLOCK, &intmask,
nullptr);
115 std::cout <<
"Application termianted." << std::endl;