Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cs/ds/alarm-handler
  • francesco.tripaldi/alarm-handler
2 results
Show changes
Showing
with 2767 additions and 67 deletions
/* /*
* event_table.h * event_table.h
* *
* $Author: graziano $
*
* $Revision: 1.2 $
*
* $Log: event_table.h,v $
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale * copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park * Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY * 34012 Basovizza, Trieste ITALY
...@@ -20,7 +13,7 @@ ...@@ -20,7 +13,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <atomic> #include <atomic>
#include <tango.h> #include <tango/tango.h>
using namespace std; using namespace std;
...@@ -65,7 +58,7 @@ class event { ...@@ -65,7 +58,7 @@ class event {
string attname; string attname;
value_t value; /* event value */ value_t value; /* event value */
string value_string; //added for DevString attributes string value_string; //added for DevString attributes
int quality; int quality{Tango::ATTR_INVALID};
string ex_reason; string ex_reason;
string ex_desc; string ex_desc;
string ex_origin; string ex_origin;
...@@ -73,7 +66,8 @@ class event { ...@@ -73,7 +66,8 @@ class event {
int type, /* attribute data type */ int type, /* attribute data type */
read_size, /* attribute size of read part */ read_size, /* attribute size of read part */
counter, /* molteplicita' */ counter, /* molteplicita' */
err_counter; /* molteplicita' errore */ err_counter; /* molteplicita' errore */
long dim_x, dim_y;
alarm_list m_alarm; alarm_list m_alarm;
bool valid; //TODO: old bool valid; //TODO: old
bool first;//TODO: new bool first;//TODO: new
...@@ -123,6 +117,8 @@ typedef struct basic_event_info_s { ...@@ -123,6 +117,8 @@ typedef struct basic_event_info_s {
string ex_origin; string ex_origin;
int type; int type;
int read_size; int read_size;
long dim_x;
long dim_y;
Tango::TimeVal ts; Tango::TimeVal ts;
string msg; string msg;
} bei_t; } bei_t;
...@@ -161,8 +157,8 @@ class event_table : public Tango::TangoMonitor, public Tango::LogAdapter { ...@@ -161,8 +157,8 @@ class event_table : public Tango::TangoMonitor, public Tango::LogAdapter {
#if 0 #if 0
void init_proxy(void) throw(vector<string> &); void init_proxy(void) throw(vector<string> &);
void free_proxy(void); void free_proxy(void);
void subscribe(EventCallBack& ecb) throw(vector<string> &);//throw(string&); void subscribe(EventCallBack& ecb);
void unsubscribe(void) throw(string&); void unsubscribe(void);
#endif #endif
/** /**
* Add a new signal. * Add a new signal.
...@@ -209,7 +205,7 @@ class EventCallBack : public Tango::CallBack, public Tango::LogAdapter ...@@ -209,7 +205,7 @@ class EventCallBack : public Tango::CallBack, public Tango::LogAdapter
~EventCallBack(void); ~EventCallBack(void);
void push_event(Tango::EventData* ev); void push_event(Tango::EventData* ev);
//void init(event_list* e); //void init(event_list* e);
void extract_values(Tango::DeviceAttribute *attr_value, vector<double> &val, string &val_string, int &type, int &read_size); void extract_values(Tango::DeviceAttribute *attr_value, vector<double> &val, string &val_string, int &type, int &read_size, long &dim_x, long &dim_y);
private: private:
//event_list* e_ptr; //event_list* e_ptr;
Tango::DeviceImpl *mydev; Tango::DeviceImpl *mydev;
......
/* /*
* formula_grammar.h * formula_grammar.h
* *
* $Author: graziano $
*
* $Revision: 1.5 $
*
* $Log: formula_grammar.h,v $
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale * copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park * Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY * 34012 Basovizza, Trieste ITALY
...@@ -132,6 +125,8 @@ struct formula_grammar : public grammar<formula_grammar> ...@@ -132,6 +125,8 @@ struct formula_grammar : public grammar<formula_grammar>
static const int val_qualityID = 23; static const int val_qualityID = 23;
static const int val_alarm_enum_stID = 24; static const int val_alarm_enum_stID = 24;
static const int propertyID = 25; static const int propertyID = 25;
static const int index_rangeID = 26;
static const int index_listID = 27;
symbols<unsigned int> tango_states; symbols<unsigned int> tango_states;
...@@ -198,7 +193,7 @@ struct formula_grammar : public grammar<formula_grammar> ...@@ -198,7 +193,7 @@ struct formula_grammar : public grammar<formula_grammar>
= (alnum_p | '.' | '_' | '-' | '+') //any alpha numeric char plus '.', '_', '-' = (alnum_p | '.' | '_' | '-' | '+') //any alpha numeric char plus '.', '_', '-'
; ;
symbol_attr symbol_attr
= (alnum_p | '_' | '.') //any alpha numeric char plus '_', '.' for attribute names = (alnum_p | '_' | '.') - str_p(".normal") - str_p(".alarm") - str_p(".quality") //any alpha numeric char plus '_', '.' for attribute names
; ;
//------------------------------ALARM NAME-------------------------------------- //------------------------------ALARM NAME--------------------------------------
name name
...@@ -214,9 +209,18 @@ struct formula_grammar : public grammar<formula_grammar> ...@@ -214,9 +209,18 @@ struct formula_grammar : public grammar<formula_grammar>
] ]
] ]
// = repeat_p(3)[(+symbol) >> ch_p('/')] >> (+symbol) // = repeat_p(3)[(+symbol) >> ch_p('/')] >> (+symbol)
; ;
index_range
=
( uint_p >> !(discard_node_d[ch_p('-')] >> uint_p)) // n or n-m
;
index_list
= (index_range >> *(discard_node_d[ch_p(',')] >> index_range)) // n-m,k,s-t,..
;
index index
= inner_node_d[ch_p('[') >> uint_p >> ch_p(']')] = discard_node_d[ch_p('[')] >>
(str_p("-1") | index_list) >>
discard_node_d[ch_p(']')]
; ;
property property
= str_p(".quality") = str_p(".quality")
...@@ -270,8 +274,8 @@ struct formula_grammar : public grammar<formula_grammar> ...@@ -270,8 +274,8 @@ struct formula_grammar : public grammar<formula_grammar>
event_ event_
= name = name
>> !( (index) >> ( *(index)//0 or more indexex
| (property) >> !(property) //followed by 0 or 1 property
) )
; ;
...@@ -406,6 +410,8 @@ struct formula_grammar : public grammar<formula_grammar> ...@@ -406,6 +410,8 @@ struct formula_grammar : public grammar<formula_grammar>
rule<ScannerT, parser_context<>, parser_tag<expr_atomID> > expr_atom; rule<ScannerT, parser_context<>, parser_tag<expr_atomID> > expr_atom;
rule<ScannerT, parser_context<>, parser_tag<funcID> > function; rule<ScannerT, parser_context<>, parser_tag<funcID> > function;
rule<ScannerT, parser_context<>, parser_tag<nameID> > name; rule<ScannerT, parser_context<>, parser_tag<nameID> > name;
rule<ScannerT, parser_context<>, parser_tag<index_rangeID> > index_range;
rule<ScannerT, parser_context<>, parser_tag<index_listID> > index_list;
rule<ScannerT, parser_context<>, parser_tag<indexID> > index; rule<ScannerT, parser_context<>, parser_tag<indexID> > index;
rule<ScannerT, parser_context<>, parser_tag<val_stringID> > val_string; rule<ScannerT, parser_context<>, parser_tag<val_stringID> > val_string;
rule<ScannerT, parser_context<>, parser_tag<func_dualID> > function_dual; rule<ScannerT, parser_context<>, parser_tag<func_dualID> > function_dual;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
// This file is generated by POGO // This file is generated by POGO
// (Program Obviously used to Generate tango Object) // (Program Obviously used to Generate tango Object)
//============================================================================= //=============================================================================
#include <tango.h> #include <tango/tango.h>
// Check if crash reporting is used. // Check if crash reporting is used.
#if defined(ENABLE_CRASH_REPORT) #if defined(ENABLE_CRASH_REPORT)
...@@ -43,8 +43,15 @@ ...@@ -43,8 +43,15 @@
DECLARE_CRASH_HANDLER; DECLARE_CRASH_HANDLER;
#ifndef TANGO_LOG
#define TANGO_LOG cout
#endif
int main(int argc,char *argv[]) int main(int argc,char *argv[])
{ {
using std::endl;
using std::bad_alloc;
INSTALL_CRASH_HANDLER INSTALL_CRASH_HANDLER
try try
{ {
...@@ -59,20 +66,20 @@ int main(int argc,char *argv[]) ...@@ -59,20 +66,20 @@ int main(int argc,char *argv[])
// Run the endless loop // Run the endless loop
//---------------------------------------- //----------------------------------------
cout << "Ready to accept request" << endl; TANGO_LOG << "Ready to accept request" << endl;
tg->server_run(); tg->server_run();
} }
catch (bad_alloc &) catch (bad_alloc &)
{ {
cout << "Can't allocate memory to store device object !!!" << endl; TANGO_LOG << "Can't allocate memory to store device object !!!" << endl;
cout << "Exiting" << endl; TANGO_LOG << "Exiting" << endl;
} }
catch (CORBA::Exception &e) catch (CORBA::Exception &e)
{ {
Tango::Except::print_exception(e); Tango::Except::print_exception(e);
cout << "Received a CORBA_Exception" << endl; TANGO_LOG << "Received a CORBA_Exception" << endl;
cout << "Exiting" << endl; TANGO_LOG << "Exiting" << endl;
} }
Tango::Util::instance()->server_cleanup(); Tango::Util::instance()->server_cleanup();
return(0); return(0);
......
/* /*
* update-thread.cpp * update-thread.cpp
*
* $Author: claudio $
*
* $Revision: 1.2 $
*
* $Log: update-thread.cpp,v $
* Revision 1.2 2013-03-06 10:38:43 claudio
* commented out debug print statements
*
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
*/ */
#include "update-thread.h" #include "update-thread.h"
...@@ -28,7 +10,7 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.2 $"; ...@@ -28,7 +10,7 @@ static const char __FILE__rev[] = __FILE__ " $Revision: 1.2 $";
*/ */
update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p),Tango::LogAdapter(p) update_thread::update_thread(AlarmHandler_ns::AlarmHandler *p) : p_Alarm(p),Tango::LogAdapter(p)
{ {
//cout << __FILE__rev << endl; //TANGO_LOG << __FILE__rev << endl;
} }
/* /*
......
/* /*
* alarm-thread.h * update-thread.h
*
* $Author: graziano $
*
* $Revision: 1.1 $
*
* $Log: update-thread.h,v $
* Revision 1.1 2008-11-10 10:54:09 graziano
* thread for update of alarms with time threshold > 0
*
*
*
*
* copyleft: Sincrotrone Trieste S.C.p.A. di interesse nazionale
* Strada Statale 14 - km 163,5 in AREA Science Park
* 34012 Basovizza, Trieste ITALY
*/ */
#ifndef UPDATE_THREAD_H #ifndef UPDATE_THREAD_H
#define UPDATE_THREAD_H #define UPDATE_THREAD_H
#include <omnithread.h> #include <omnithread.h>
#include <tango.h> #include <tango/tango.h>
#include <AlarmHandler.h> #include <AlarmHandler.h>
class update_thread : public omni_thread, public Tango::TangoMonitor, public Tango::LogAdapter { class update_thread : public omni_thread, public Tango::TangoMonitor, public Tango::LogAdapter {
......
cmake_minimum_required(VERSION 3.2)
project(test NONE)
include(ExternalProject)
ExternalProject_Add(testdevice
SOURCE_DIR ${CMAKE_SOURCE_DIR}/test/testdevice
# PREFIX ${CMAKE_BINARY_DIR}
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}"
# INSTALL_DIR ${CMAKE_BINARY_DIR}
# BINARY_DIR ${CMAKE_BINARY_DIR}
# STEP_TARGETS build
# EXCLUDE_FROM_ALL TRUE
)
ExternalProject_Get_property(testdevice SOURCE_DIR)
message("Source dir of testdevice = ${SOURCE_DIR}")
ExternalProject_Get_property(testdevice INSTALL_DIR)
message("Install dir of testdevice = ${INSTALL_DIR}")
ExternalProject_Get_property(testdevice BINARY_DIR)
message("Binary dir of testdevice = ${BINARY_DIR}")
ExternalProject_Get_property(testdevice CMAKE_ARGS)
message("CMqke args for testdevice = ${CMAKE_ARGS}")
#ExternalProject_Get_property(testdevice PREFIX)
#message("Prefix dir of testdevice = ${PREFIX}")
{
"_version": 1,
"_source": "ConfigInjectorDiag.xls",
"_title": "hdbpp mysql innodb test",
"_date": "2020-07-07 14:45:04",
"servers": {
"alarm-handler-srv/01": {
"AlarmHandler": {
"alarm/handler/01": {
"properties": {
},
"attribute_properties": {
}
}
}
},
"testdevice-srv/01": {
"TestDevice": {
"alarm/test/01": {
"properties": {
"Attr_config": [
"condition:bool:0:0.0"
]
},
"attribute_properties": {
}
}
}
}
},
"classes": {
"AlarmHandler": {
"properties": {
"GroupNames": ["gr_none","gr_test"],
"StatisticsTimeWindow": ["60"],
"SubscribeRetryPeriod": ["30"]
}
},
"TestDevice": {
"properties": {
}
}
}
}
#!/usr/bin/python
#
import sys,re
#import PyTango
from PyTango import *
import time
import string
if __name__ == "__main__":
Device = False
Conf = False
File = False
conflist = []
#PrepareState = False
for arg in sys.argv:
word = '([a-z0-9._\-\*]*)'
wordpath = '([a-z0-9._\-\*/]*)'
m = re.compile("--device=" + word + "/{0,1}" + word + "/{0,1}" + word).match(arg.lower())
if m is not None:
#print m.groups()
domain = m.groups()[0]
family = m.groups()[1]
member = m.groups()[2]
if domain == '':
domain = '*'
if family == '':
family = '*'
if member == '':
member = '*'
Device = True
#formula = '([a-z0-9._,\*,\-,\|,\/,\",\s,\t]*)'
formula = '(.*)'
m = re.compile("--conf=" + formula).match(arg)
if m is not None:
#print m.groups()
alarm_rule = m.groups()[0]
Conf = True
#m = re.compile("--prepare_state").match(arg.lower())
#if m is not None:
# PrepareState = True
m = re.compile("--file=" + wordpath).match(arg)
if m is not None:
#print m.groups()
file_name = m.groups()[0]
File = True
tagchars = '([a-zA-Z0-9._-]*)'
tag=''
if Device:
if Conf or File:
dev_name = domain + '/' + family + '/' + member
try:
dev = DeviceProxy(dev_name)
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print ('ERROR connecting proxy(',dev_name,'): ',e[0].desc)
sys.exit(-1)
if Conf:
m = re.compile("tag=" + tagchars + ";(.*)").match(alarm_rule)
if m is not None:
try:
tag = m.groups()[0]
conflist = dev.command_inout('SearchAlarm',tag)
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print (' ---> ERROR: ', e[0].desc)
sys.exit(1)
for co in conflist:
if co == alarm_rule:
print ('Found matching alarm: ', co)
sys.exit(0)
print ('Not found conf for alarm ', tag)
sys.exit(1)
elif File:
for line in open(file_name):
line = line[0:-1]
m = re.compile("tag=" + tagchars + ";(.*)").match(line)
conf_found = False
if m is not None:
try:
tag = m.groups()[0]
conflist = dev.command_inout('SearchAlarm',tag)
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print (' ---> ERROR: ', e[0].desc)
sys.exit(1)
for co in conflist:
if co == alarm_rule:
conf_found = True
if not conf_found:
print ('Not found conf for alarm ', tag)
sys.exit(1)
sys.exit(0)
if len(sys.argv) < 3:
print ('Usage:', sys.argv[0], ' --device=alarm_device --conf=alarm_rule | --file=filename')
print ()
print ('Examples:')
print ('\tcheck one alarm_rule in alarm/handler/01:', sys.argv[0], '--device=alarm/handler/01 --conf=\"tag=test0;formula=(alarm/test/01/condition == 1);on_delay=0;off_delay=0;priority=high;shlvd_time=0;group=gr_test;message=Test alarm;url=;on_command=;off_command=;enabled=1\"')
print ('\tcheck alarm rules from filename in alarm/handler/01:', sys.argv[0], '--device=alarm/handler/01 --file=alarms.txt')
sys.exit(-1)
# EOF
#!/usr/bin/python
#
import sys,re
#import PyTango
from PyTango import *
import time
import string
if __name__ == "__main__":
Device = False
Conf = False
File = False
#PrepareState = False
for arg in sys.argv:
word = '([a-z0-9._\-\*]*)'
wordpath = '([a-z0-9._\-\*/]*)'
m = re.compile("--device=" + word + "/{0,1}" + word + "/{0,1}" + word).match(arg.lower())
if m is not None:
domain = m.groups()[0]
family = m.groups()[1]
member = m.groups()[2]
if domain == '':
domain = '*'
if family == '':
family = '*'
if member == '':
member = '*'
Device = True
#formula = '([a-z0-9._,\*,\-,\|,\/,\",\s,\t]*)'
formula = '(.*)'
m = re.compile("--conf=" + formula).match(arg)
if m is not None:
alarm_rule = m.groups()[0]
Conf = True
#m = re.compile("--prepare_state").match(arg.lower())
#if m is not None:
# PrepareState = True
m = re.compile("--file=" + wordpath).match(arg)
if m is not None:
file_name = m.groups()[0]
File = True
if Device:
if Conf or File:
dev_name = domain + '/' + family + '/' + member
try:
dev = DeviceProxy(dev_name)
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print ('ERROR connecting proxy(',dev_name,'): ',e[0].desc)
sys.exit(-1)
if Conf:
print ('Loading: ', alarm_rule)
try:
dev.command_inout('Load',alarm_rule)
print ('.............OK!')
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print ('...........ERROR!')
print (' ---> ERROR: ', e[0].desc)
continue
sys.exit(0)
elif File:
for line in open(file_name):
line = line[0:-1]
try:
dev.command_inout('Load',line)
time.sleep(0.1)
except (DevFailed,ConnectionFailed,EventSystemFailed) as e:
print (' ---> ERROR: ', e[0].desc)
time.sleep(2)
sys.exit(1)
sys.exit(0)
#dev = DeviceProxy("alarm/alarm/1")
#dev.command_inout('Load', sys.argv[1])
if len(sys.argv) < 3:
print ('Usage:', sys.argv[0], ' --device=alarm_device --conf=alarm_rule | --file=filename')
print ()
print ('Examples:')
print ('\tload one alarm_rule in alarm/handler/01:', sys.argv[0], '--device=alarm/handler/01 --conf=\"tag=test0;formula=(alarm/test/01/condition == 1);on_delay=0;off_delay=0;priority=high;shlvd_time=0;group=gr_test;message=Test alarm;url=;on_command=;off_command=;enabled=1\"')
print ('\tload alarm rules from filename in alarm/handler/01:', sys.argv[0], '--device=alarm/handler/01 --file=alarms.txt')
sys.exit(-1)
# EOF
# Functions and Pre-build -----------------------------------
# Stop messy in source builds
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_DISABLE_SOURCE_CHANGES OFF)
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
message( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt." )
endif()
# Start Build Config -----------------------------------
cmake_minimum_required(VERSION 3.8)
set(CMAKE_SKIP_RPATH true)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Output name for the final binary
set(DEV_NAME "testdevice-srv")
# Versioning
set(VERSION_MAJOR "1")
set(VERSION_MINOR "0")
set(VERSION_PATCH "0")
set(VERSION_METADATA "")
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
# Add any include paths from the command line
list(APPEND INCLUDE_PATHS ${CMAKE_INCLUDE_PATH})
list(APPEND INCLUDE_PATHS ${CMAKE_SOURCE_DIR})
list(APPEND LIBRARY_PATHS ${CMAKE_LIBRARY_PATH})
# Start the project
project(testdevice VERSION ${VERSION_STRING} LANGUAGES CXX)
# Build options
# arch install definitions
include(GNUInstallDirs)
message(STATUS "Searching for libraries...")
# Variable to contain a list of all the libs we depend on
set(AH_LIBRARIES)
# allow pkg-config to search the CMAKE_PREFIX_PATH
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON)
list(APPEND CMAKE_PREFIX_PATH "/usr")
# Find Dependencies -----------------------------------
# Find tango if it has not already been found. Returns an interface library
# called TangoInterfaceLibrary
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(Tango)
# Source -----------------------------------
add_subdirectory(src)
# Build Targets -----------------------------------
# Executable --------
add_executable(testdevice ${SRC_FILES})
target_link_libraries(testdevice
PRIVATE
TangoInterfaceLibrary
)
target_include_directories(testdevice
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
${INCLUDE_PATHS}
"${PROJECT_BINARY_DIR}"
)
if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
set_target_properties(testdevice
PROPERTIES
OUTPUT_NAME ${DEV_NAME}
LINK_FLAGS "-Wl,--no-undefined"
CXX_STANDARD 17)
else()
set_target_properties(testdevice
PROPERTIES
OUTPUT_NAME ${DEV_NAME}
LINK_FLAGS ""
CXX_STANDARD 17)
endif()
target_compile_options(testdevice
PRIVATE "$<$<CONFIG:DEBUG>:-g>")
# Install Config -----------------------------------
install(
TARGETS testdevice
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
message(STATUS "Configured testdevice project")
This diff is collapsed.
GCCMAJOR := $(shell ${CXX} -dumpversion | cut -d"." -f1)
GCCMINOR := $(shell ${CXX} -dumpversion | cut -d"." -f2)
MACHINE := $(shell ${CXX} -dumpmachine)
TANGO_DIR := /usr/local/tango-9.3.4
OMNIORB_DIR := /usr/local/omniorb-4.2.3
ZMQ_DIR := /usr/local/zeromq-4.0.8
RUNTIME_DIR := /runtime
TANGO_INC := ${TANGO_DIR}/include/tango
LOG4TANGO_INC := ${TANGO_DIR}/include
OMNIORB_INC := ${OMNIORB_DIR}/include
ZMQ_INC := ${ZMQ_DIR}/include
RUNTIME_INC := ${RUNTIME_DIR}/include
TANGO_LIB = ${TANGO_DIR}/lib
OMNIORB_LIB = ${OMNIORB_DIR}/lib
ZMQ_LIB = ${ZMQ_DIR}/lib
RUNTIME_LIB = ${RUNTIME_DIR}/lib
ifeq ($(SDKTARGETSYSROOT),)
ifeq ($(GCCMAJOR),4)
ifeq ($(shell test $(GCCMINOR) -lt 4; echo $$?),0)
CXXFLAGS += -std=gnu++98
else
CXXFLAGS += -std=c++0x
endif
else
CXXFLAGS += -std=c++11
endif
INC_DIR = -I${TANGO_INC} -I${LOG4TANGO_INC} -I${OMNIORB_INC} -I${ZMQ_INC} -I${RUNTIME_INC}
LIB_DIR = -L${TANGO_LIB} -L${OMNIORB_LIB} -L${ZMQ_LIB} -L${RUNTIME_LIB} -L/usr/local/lib
else
CXXFLAGS += -std=gnu++11
INC_DIR = -I${SDKTARGETSYSROOT}/usr/include/tango
endif
#-----------------------------------------
# Default make entry
#-----------------------------------------
default: release
release debug: bin/$(NAME_SRV)
all: default
#-----------------------------------------
# Set CXXFLAGS and LDFLAGS
#-----------------------------------------
CXXFLAGS += -D__linux__ -D__OSVERSION__=2 -Wall -pedantic \
-Wno-non-virtual-dtor -Wno-long-long -DOMNI_UNLOADABLE_STUBS \
$(INC_DIR) -Isrc
ifeq ($(GCCMAJOR),4)
CXXFLAGS += -Wextra
endif
ifeq ($(GCCMAJOR),5)
CXXFLAGS += -Wextra
endif
LDFLAGS += $(LIB_DIR) -ltango -lomniORB4 -lomniDynamic4 \
-lCOS4 -lomnithread -lzmq
#-----------------------------------------
# Set dependencies
#-----------------------------------------
SRC_FILES += $(wildcard src/*.cpp)
OBJ_FILES += $(addprefix obj/,$(notdir $(SRC_FILES:.cpp=.o)))
obj/%.o: $(SRC_FILES:%.cpp)
$(CXX) $(CXXFLAGS) -c -o $@ $<
.nse_depinfo: $(SRC_FILES)
@$(CXX) $(CXXFLAGS) -M -MM $^ | sed 's/\(.*\)\.o/obj\/\1.o/g' > $@
-include .nse_depinfo
#-----------------------------------------
# Main make entries
#-----------------------------------------
bin/$(NAME_SRV): bin obj $(OBJ_FILES)
$(CXX) $(CXXFLAGS) $(OBJ_FILES) -o bin/$(NAME_SRV) $(LDFLAGS)
clean:
@rm -fr obj/ bin/ core* .nse_depinfo src/*~
bin obj:
@ test -d $@ || mkdir $@
#-----------------------------------------
# Target specific options
#-----------------------------------------
release: CXXFLAGS += -O2 -DNDEBUG
release: LDFLAGS += -s
debug: CXXFLAGS += -ggdb3
.PHONY: clean
NAME_SRV = testdevice-srv
CXXFLAGS =
LDFLAGS =
include ./Make-9.3.4.in
# Project Name
testdevice
## Description
Tango device server for storing and distributing a number of variables as device attributes.
## Installation
See your institue guidelines for deploying and configuring a Tango device server.
## Usage
The server is dynamically configured by means of dedicated Methods. The configuration and values are stored in the Tango Database and restored at server restart.
A typical usage is to store and distribute the results of measurments or simulations to a number of differet clients.
## History
## Credits
Elettra-Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
## License
GPL 3
This diff is collapsed.
if(NOT TARGET TangoInterfaceLibrary)
# Ensure pkg-config is installed
find_package(PkgConfig REQUIRED)
# Now search for the tango.pc file, this is a required dependency
message(STATUS "Search for TANGO package config...")
pkg_search_module(TANGO REQUIRED tango>=9.2.5)
message(STATUS "Found tango version ${TANGO_VERSION} at ${TANGO_PREFIX}")
include(FindLibraries)
find_libraries(LIBRARIES ${TANGO_LIBRARIES} SEARCH_PATHS ${TANGO_LIBRARY_DIRS})
# Create an interface library to represent the tango linkage
add_library(TangoInterfaceLibrary INTERFACE)
set_target_properties(TangoInterfaceLibrary
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${TANGO_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${FOUND_LIBRARIES}"
INTERFACE_COMPILE_OPTIONS "${TANGO_CFLAGS}")
message(STATUS "Configured Tango Interface for TANGO version ${TANGO_VERSION}")
endif(NOT TARGET TangoInterfaceLibrary)
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.