From 7cb6f301cf65ab82b134f1fb9633cc1ac414efa5 Mon Sep 17 00:00:00 2001 From: "Danilo C. Zanella" Date: Fri, 12 Feb 2021 20:02:03 +0000 Subject: [PATCH 1/3] Added support to build in Debian 10. For some reason ACS fails during startup when Notify_Service_stacksize.patch is applied. --- ExtProd/INSTALL/buildTAO | 6 ++++-- ExtProd/INSTALL/standardUtilities | 6 +++--- LGPL/acsBUILD/config/.acs/.bash_profile.acs | 11 ++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ExtProd/INSTALL/buildTAO b/ExtProd/INSTALL/buildTAO index 4c136870..d6dce7e5 100755 --- a/ExtProd/INSTALL/buildTAO +++ b/ExtProd/INSTALL/buildTAO @@ -118,8 +118,10 @@ patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/AVtimeout.patch #patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/TAO_IFR_Service_preloaded_CORBA_module.patch echo "- TAO_IFR_Inheritance_problems_workaround.patch" patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/TAO_IFR_Inheritance_problems_workaround.patch -echo "- Notify_Service stack size" -patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/Notify_Service_stacksize.patch +if [ "$DISTRO" != "DEBIAN"]; then + echo "- Notify_Service stack size" + patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/Notify_Service_stacksize.patch +fi echo "- ICT-94" patch -p1 < $CURR_DIR/../PRODUCTS/ACE+TAO_PATCHES/ict94.patch echo "- ICT-12886: Removed check of negative elapsed time." diff --git a/ExtProd/INSTALL/standardUtilities b/ExtProd/INSTALL/standardUtilities index 52f2f872..e3ad45b7 100755 --- a/ExtProd/INSTALL/standardUtilities +++ b/ExtProd/INSTALL/standardUtilities @@ -31,7 +31,7 @@ # For example: # RedHat : /etc/redhat-release # Fedora : /etc/redhat-release -# Debian : /etc/debian-version +# Debian : /etc/debian_version # # ENVIRONMENT # @@ -119,7 +119,7 @@ os_discovery () # Linux # RedHat : /etc/redhat-release # Fedora : /etc/redhat-release - # Debian : /etc/debian-version + # Debian : /etc/debian_version # Slackware : /etc/slackware-version # # RHEL @@ -170,7 +170,7 @@ check_linux () OS='LINUX' # Standard release files for different distributions RH=/etc/redhat-release - DB=/etc/debian-version + DB=/etc/debian_version SL=/etc/slackware-version SU=/etc/SuSE-release GT=/etc/gentoo-release diff --git a/LGPL/acsBUILD/config/.acs/.bash_profile.acs b/LGPL/acsBUILD/config/.acs/.bash_profile.acs index 6086a9f7..0ee6249d 100644 --- a/LGPL/acsBUILD/config/.acs/.bash_profile.acs +++ b/LGPL/acsBUILD/config/.acs/.bash_profile.acs @@ -173,7 +173,7 @@ os_discovery () # Linux # RedHat : /etc/redhat-release # Fedora : /etc/redhat-release - # Debian : /etc/debian-version + # Debian : /etc/debian_version # Slackware : /etc/slackware-version # # RHEL @@ -224,7 +224,7 @@ check_linux () OS='LINUX' # Standard release files for different distributions RH=/etc/redhat-release - DB=/etc/debian-version + DB=/etc/debian_version SL=/etc/slackware-version SU=/etc/SuSE-release GT=/etc/gentoo-release @@ -573,7 +573,12 @@ then then JAVA_HOME=/Java else - JAVA_HOME=/usr/java/default + if [ "$DISTRO" = "DEBIAN" ] + then + JAVA_HOME=/usr/lib/jvm/default-java + else + JAVA_HOME=/usr/java/default + fi fi fi -- 2.20.1 From ce56f97d935aadff06bfb774a9389981a66c1664 Mon Sep 17 00:00:00 2001 From: "Danilo C. Zanella" Date: Thu, 18 Feb 2021 08:01:33 +0000 Subject: [PATCH 2/3] Added OpenDDS module. To use xml parser qos configration, it was needed to recompile ACE to include XML_Utils library and Schema compiler (XSC), both using xercesc3. --- LGPL/Kit/acs/include/acsMakefile | 3 +- LGPL/Kit/acs/include/acsMakefileCore.mk | 6 +- .../Kit/acs/include/acsMakefileDefinitions.mk | 41 +-- LGPL/Tools/OpenDDS/src/Makefile | 313 ++++++++++++++++++ LGPL/acsBUILD/config/.acs/.bash_profile.acs | 12 + 5 files changed, 352 insertions(+), 23 deletions(-) create mode 100644 LGPL/Tools/OpenDDS/src/Makefile diff --git a/LGPL/Kit/acs/include/acsMakefile b/LGPL/Kit/acs/include/acsMakefile index b2819409..f4597507 100644 --- a/LGPL/Kit/acs/include/acsMakefile +++ b/LGPL/Kit/acs/include/acsMakefile @@ -1138,7 +1138,8 @@ endif endif ifdef USE_OPENDDS TAO_MK_IDL_PATH := $(TAO_MK_IDL_PATH) -I$(DDS_ROOT) - TAO_IDLFLAGS += -Gdcps + TAO_IDLFLAGS += -aw -Gxhst + DDS_IDLFLAGS += $(TAO_MK_IDL_PATH) -aw USER_INC += -I$(DDS_ROOT) USER_LIB += -L$(DDS_ROOT)/lib endif diff --git a/LGPL/Kit/acs/include/acsMakefileCore.mk b/LGPL/Kit/acs/include/acsMakefileCore.mk index fe3b95a5..134848a9 100644 --- a/LGPL/Kit/acs/include/acsMakefileCore.mk +++ b/LGPL/Kit/acs/include/acsMakefileCore.mk @@ -356,7 +356,7 @@ $(foreach dds,$(DDS_FILES),\ $(eval $(call acsMakeLibraryDependencies,,$(dds)Stubs,$(dds)S $(dds)C,,,$($(dds)Stubs_LIBS))) \ $(if $(wildcard ../idl/$(dds).midl),\ $(eval $(dds)_typesList = $(call typesFromDDS,../idl/$(dds).midl)),\ - $(if $(wildcard ../idl/$1.idl),\ + $(if $(wildcard ../idl/$(dds).idl),\ $(eval $(dds)_typesList = $(call typesFromDDS,../idl/$(dds).idl)),\ $(error "NO IDL nor mIDL FILE found for $(dds)") \ ) ) \ @@ -364,8 +364,8 @@ $(foreach dds,$(DDS_FILES),\ ) ) $(foreach dds,$(DDS_FILES),\ - $(foreach type,$($(dds)_typesList),\ - $(eval $(call acsMakeLibraryDependencies,,$(type)TypeSupportStubs,$(type)TypeSupportS $(type)TypeSupportImpl $(type)TypeSupportC,,,$(dds)Stubs) ) ) ) + $(eval $(call acsMakeLibraryDependencies,,$(dds)TypeSupportStubs,$(dds)TypeSupportS $(dds)TypeSupportImpl $(dds)TypeSupportC,,,$(dds)Stubs) ) \ +) $(foreach dds,$(DDS_FILES),\ $(if $(wildcard ../idl/$(dds).midl),\ diff --git a/LGPL/Kit/acs/include/acsMakefileDefinitions.mk b/LGPL/Kit/acs/include/acsMakefileDefinitions.mk index 82615ac8..423b8f09 100644 --- a/LGPL/Kit/acs/include/acsMakefileDefinitions.mk +++ b/LGPL/Kit/acs/include/acsMakefileDefinitions.mk @@ -268,7 +268,7 @@ $1_IDL_Java: $(CURDIR)/../lib/$1.jar; $(CURDIR)/../lib/$1.jar: TMPSRC=../object/$1/src -$(CURDIR)/../lib/$1.jar: $(CURDIR)/../idl/$1.idl $($1_IDLprereq) $(subst ../idl/,,$(subst .pidl,.jar,$(subst .idl,.jar,$(foreach idl,$($1_IDLprereq),$(if $(and $(wildcard ../idl/$(idl)),$(filter $(addsuffix .%, $(addprefix ../idl/,$(IDL_LIST) $(ACSERRDEF))),$(idl))),$(CURDIR)/../lib/$(idl), )) ))) $(if $(filter $1,$(ACSERRDEF)),../idl/$1.xml,) +$(CURDIR)/../lib/$1.jar: $(CURDIR)/../idl/$1.idl $($1_IDLprereq) $(subst ../idl/,,$(subst .pidl,.jar,$(subst .idl,.jar,$(foreach idl,$($1_IDLprereq),$(if $(wildcard ../idl/$(idl)),$(CURDIR)/../lib/$(idl), )) ))) $(if $(filter $1,$(ACSERRDEF)),../idl/$1.xml,) - @echo "== (preprocessing) $1" $(AT) JacPrep $$< " -I$(JACORB_HOME)/idl/jacorb -I$(JACORB_HOME)/idl/omg $(MK_IDL_PATH) " > /tmp/$(UNIQUE_NUMBER).$1.idl - @echo "== IDL Compiling for JacORB (Java): $1 " @@ -819,7 +819,7 @@ $(if $(or $3,$6), \ $(eval MESSAGE += please remove iostream), \ $(if $(findstring Cygwin, $(platform)), \ $(eval $2_lList += -l$(lib) $(eval $2_dList += $(call deps,$(lib)))), \ - $(if $(filter $(lib), $(LIBRARY_LIST) $(addsuffix Stubs,$(IDL_LIST) $(ACSERRDEF)) $(ACSERRDEF)), $(eval $2_lList += $(if $5,$(CURDIR)/../lib/lib$(lib).a,$(if $(MAKE_NOSTATIC),,$(CURDIR)/../lib/lib$(lib).a) $(CURDIR)/../lib/lib$(lib).so)), + $(if $(filter $(lib), $(LIBRARY_LIST) $(addsuffix Stubs,$(IDL_LIST) $(ACSERRDEF)) $(ACSERRDEF) $(addsuffix TypeSupportStubs,$(DDS_FILES))), $(eval $2_lList += $(if $5,$(CURDIR)/../lib/lib$(lib).a,$(if $(MAKE_NOSTATIC),,$(CURDIR)/../lib/lib$(lib).a) $(CURDIR)/../lib/lib$(lib).so)), $(eval $2_lList += -l$(lib))) ) \ ) \ @@ -1187,48 +1187,51 @@ define acsMakeDDSDependencies #USER_IDL := -I$(DDS_ROOT) $(USER_IDL) -$1_targetList = $(foreach type,$($1_typesList),../object/$(type)TypeSupport.idl ../object/$(type)TypeSupportImpl.cpp ../object/$(type)TypeSupportImpl.h) +$1_targetList = ../object/$1TypeSupport.idl ../object/$1TypeSupportImpl.cpp ../object/$1TypeSupportImpl.h -$1_libList = $(foreach type,$($1_typesList),do_lib_$(type)TypeSupportStubs) +$1_libList = do_lib_$1TypeSupportStubs do_dds_$1:$$($1_libList) $$($1_targetList): ../idl/$1.idl $(AT)$(ECHO) "== Generating DDS support for IDL-specified types ($$<)" - $(AT)(cd ../object && cp ../idl/$1.idl . && $(DDS_ROOT)/bin/dcps_ts.pl $1.idl && $(RM) $1.idl) + $(AT)(cd ../object && cp ../idl/$1.idl . && $(DDS_ROOT)/bin/opendds_idl $(DDS_IDLFLAGS) $1.idl && $(RM) $1.idl) # double loop over exensions and types # -$(foreach type,$($1_typesList), \ - $(foreach ext,$(IDL_EXTENSIONS),../object/$(type)TypeSupport$(ext)): ../object/$1S.cpp ../object/$(type)TypeSupport.idl Makefile - $(AT)@echo "== IDL Compiling for DDS TAO (C++): $(type)TypeSupport" - $(AT) $(TAO_IDL) $(MK_IDL_PATH) $(TAO_MK_IDL_PATH) -o ../object $(TAO_IDLFLAGS) ../object/$(type)TypeSupport.idl -) +$(foreach ext,$(IDL_EXTENSIONS),../object/$1TypeSupport$(ext)): ../object/$1C.cpp ../object/$1S.cpp ../object/$1TypeSupport.idl Makefile + $(AT)@echo "== IDL Compiling for DDS TAO (C++): $1TypeSupport" + $(AT) $(TAO_IDL) $(MK_IDL_PATH) $(TAO_MK_IDL_PATH) -o ../object $(TAO_IDLFLAGS) ../object/$1TypeSupport.idl # # CLEAN # .PHONY : clean_$1 -clean_dds_$1: $(foreach type,$($1_typesList),clean_lib_$(type)TypeSupportStubs) clean_lib_$1Stubs - $(AT)$(RM) $(foreach ext, $(IDL_EXTENSIONS),../object/$1$(ext)) $(foreach type,$($1_typesList), $(foreach ext,$(IDL_EXTENSIONS),../object/$(type)TypeSupport$(ext))) $$($1_targetList) +clean_dds_$1: clean_lib_$1TypeSupportStubs clean_lib_$1Stubs + $(AT)$(RM) $(foreach ext, $(IDL_EXTENSIONS),../object/$1$(ext)) $(foreach ext,$(IDL_EXTENSIONS),../object/$1TypeSupport$(ext)) $$($1_targetList) # # INSTALL # .PHONY : install_dds_$1 # check for the header files, MZA -install_dds_$1: $(foreach type,$($1_typesList),install_lib_$(type)TypeSupportStubs) $(foreach type,$($1_typesList),$(foreach ext,$(filter %.h,$(IDL_EXTENSIONS)),$(INCLUDE)/$(type)TypeSupport$(ext)) ) ; +install_dds_$1: install_lib_$1TypeSupportStubs $(foreach ext,$(filter %.h %.inl,$(IDL_EXTENSIONS)),$(INCLUDE)/$1TypeSupport$(ext)) \ + $(INCLUDE)/$1TypeSupportImpl.h $(PRJTOP)/idl/$1TypeSupport.idl ; + +# $(AT)cp $(foreach ext,$(filter %.h %.inl,$(IDL_EXTENSIONS)),../object/$1TypeSupport$(ext)) $(INCLUDE) -# $(AT)cp $(foreach type,$($1_typesList),$(foreach ext,$(filter %.h,$(IDL_EXTENSIONS)),../object/$(type)TypeSupport$(ext)) ) $(INCLUDE) +$(foreach ext,$(filter %.h %.inl,$(IDL_EXTENSIONS)),\ + $(eval $(INCLUDE)/$1TypeSupport$(ext): ../object/$1TypeSupport$(ext) + $(AT)cp ../object/$1TypeSupport$(ext) $(INCLUDE)/$1TypeSupport$(ext) ) \ +) -$(foreach type,$($1_typesList),\ - $(foreach ext,$(filter %.h,$(IDL_EXTENSIONS)),\ - $(eval $(INCLUDE)/$(type)TypeSupport$(ext): ../object/$(type)TypeSupport$(ext) - $(AT)cp ../object/$(type)TypeSupport$(ext) $(INCLUDE)/$(type)TypeSupport$(ext) ) \ -) ) +$(INCLUDE)/$1TypeSupportImpl.h: + $(AT)cp ../object/$1TypeSupportImpl.h $(INCLUDE)/$1TypeSupportImpl.h +$(PRJTOP)/idl/$1TypeSupport.idl: + $(AT)cp ../object/$1TypeSupport.idl $(PRJTOP)/idl/$1TypeSupport.idl endef diff --git a/LGPL/Tools/OpenDDS/src/Makefile b/LGPL/Tools/OpenDDS/src/Makefile new file mode 100644 index 00000000..e3211205 --- /dev/null +++ b/LGPL/Tools/OpenDDS/src/Makefile @@ -0,0 +1,313 @@ + +#******************************************************************************* +# PPPPPPPP +# +# "@(#) $Id$" +# +# Makefile of ........ +# +# who when what +# -------- -------- ---------------------------------------------- +# almamgr 16/02/21 created +# + +# ALMA - Atacama Large Millimeter Array +# Copyright (c) ESO - European Southern Observatory, 2014 +# (in the framework of the ALMA collaboration). +# All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#******************************************************************************* + +#******************************************************************************* +# This Makefile follows ALMA/ACS Standards (see Makefile(5) for more). +#******************************************************************************* +# REMARKS +# None +#------------------------------------------------------------------------ + +# +# user definable C-compilation flags +#USER_CFLAGS = + +# +# additional include and library search paths +#USER_INC = +#USER_LIB = + +# +# MODULE CODE DESCRIPTION: +# ------------------------ +# As a general rule: public file are "cleaned" and "installed" +# local (_L) are not "installed". + +# +# C programs (public and local) +# ----------------------------- +EXECUTABLES = +EXECUTABLES_L = + +# +# +xxxxx_OBJECTS = +xxxxx_LDFLAGS = +xxxxx_LIBS = + +# +# special compilation flags for single c sources +#yyyyy_CFLAGS = + +# +# Includes (.h) files (public only) +# --------------------------------- +INCLUDES = + +# +# Libraries (public and local) +# ---------------------------- +LIBRARIES = +LIBRARIES_L = + +# +# +lllll_OBJECTS = + +# +# Scripts (public and local) +# ---------------------------- +SCRIPTS = +SCRIPTS_L = + +# +# TCL scripts (public and local) +# ------------------------------ +TCL_SCRIPTS = +TCL_SCRIPTS_L = + +# +# Python stuff (public and local) +# ---------------------------- +PY_SCRIPTS = +PY_SCRIPTS_L = + +PY_MODULES = +PY_MODULES_L = + +PY_PACKAGES = +PY_PACKAGES_L = +pppppp_MODULES = + +# +# +tttttt_OBJECTS = +tttttt_TCLSH = +tttttt_LIBS = + +# +# TCL libraries (public and local) +# ------------------------------ +TCL_LIBRARIES = +TCL_LIBRARIES_L = + +# +# +tttlll_OBJECTS = + +# +# Configuration Database Files +# ---------------------------- +CDB_SCHEMAS = + +# +# IDL Files and flags +# +IDL_FILES = +TAO_IDLFLAGS = +USER_IDL = +# +# Jarfiles and their directories +# +JARFILES= +jjj_DIRS= +jjj_EXTRAS= +# For expressing dependencies between jarfiles (parallel builds) +jjj_JLIBS= +# +# java sources in Jarfile on/off +DEBUG= +# +# ACS XmlIdl generation on/off +# +XML_IDL= +# +# Java Component Helper Classes generation on/off +# +COMPONENT_HELPERS= +# +# Java Entity Classes generation on/off +# +XSDBIND= +# +# Schema Config files for the above +# +XSDBIND_INCLUDE= +# man pages to be done +# -------------------- +MANSECTIONS = +MAN1 = +MAN3 = +MAN5 = +MAN7 = +MAN8 = + +# +# local man pages +# --------------- +MANl = + +# +# ASCII file to be converted into Framemaker-MIF +# -------------------- +ASCII_TO_MIF = + +# +# other files to be installed +#---------------------------- +INSTALL_FILES = + +# +# list of all possible C-sources (used to create automatic dependencies) +# ------------------------------ +CSOURCENAMES = \ + $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ + $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ + $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) + +# +#>>>>> END OF standard rules + +# +# INCLUDE STANDARDS +# ----------------- + +MAKEDIRTMP := $(shell searchFile include/acsMakefile) +ifneq ($(MAKEDIRTMP),\#error\#) + MAKEDIR := $(MAKEDIRTMP)/include + include $(MAKEDIR)/acsMakefile +endif + +# +# TARGETS +# ------- +all: do_all + @echo " . . . 'all' done" + +clean : clean_all + @echo " . . . clean done" + +clean_dist : clean_all clean_dist_all + @echo " . . . clean_dist done" + +man : do_man + @echo " . . . man page(s) done" + +install : install_all + @echo " . . . installation done" + +DEFAULT_FEATURE_FILE := $(ACE_ROOT)/bin/MakeProjectCreator/config/default.features + +OS := $(shell uname) +ifeq ($(OS),Linux) + OS_TYPE := linux +endif +NUMPROC := $(shell nproc) + +OPENDDS_URL := https://github.com/objectcomputing/OpenDDS.git +OPENDDS_INSTDIR := $(ALMASW_INSTDIR)/OpenDDS +OPENDDS_VERSION := 3.13.2 + +build_opendds: ace_xml_utils_build $(OPENDDS_INSTDIR) + @echo "Cloning build tree to $(OPENDDS_INSTDIR)/build/$(OS_TYPE)..." + @cd $(OPENDDS_INSTDIR); \ + $(ACE_ROOT)/MPC/clone_build_tree.pl -f $(OS_TYPE) + @echo "Configuring OpenDDS..." + @cd $(OPENDDS_INSTDIR)/build/$(OS_TYPE); \ + XSC_ROOT=$(ACE_ROOT)/XSC \ + PATH=$(XSC_ROOT)/bin:$(PATH) \ + LD_LIBRARY_PATH=$(XSC_ROOT)/lib:$(LD_LIBRARY_PATH) \ + ./configure --xerces3=$(ACSROOT) --boost=$(ALMASW_INSTDIR)/boost --verbose + @echo "Configuration done!" + @echo "Building OpenDDS" + $(MAKE) -C $(OPENDDS_INSTDIR)/build/$(OS_TYPE) -j$(NUMPROC) + @echo "Compilation done!" + @echo "Creating link to $(ALMASW_INSTDIR)/DDS" + @ln -s $(OPENDDS_INSTDIR)/build/$(OS_TYPE) $(ALMASW_INSTDIR)/DDS + + +$(OPENDDS_INSTDIR): + @echo "Clonning OpenDDS from $(OPENDDS_URL)" + @git clone -b DDS-$(OPENDDS_VERSION) $(OPENDDS_URL) $(ALMASW_INSTDIR)/OpenDDS + +clean_opendds_build: +ifneq ($(wildcard $(OPENDDS_INSTDIR)/build/.),) + @echo "Removing OpenDDS build directory" + @rm -r $(OPENDDS_INSTDIR)/build +endif + +clean_opendds: +ifneq ($(wildcard $(OPENDDS_INSTDIR)/.),) + @echo "Removing OpenDDS directory and link" + rm -rf $(OPENDDS_INSTDIR) + rm $(ALMASW_INSTDIR)/DDS +endif + +ace_xml_utils_build: build_xsc $(DEFAULT_FEATURE_FILE) +ifneq ($(wildcard $(ACSROOT)/include/xercesc/.),) + @echo "Rebuilding ACE" + @cd $(ACE_ROOT); \ + XSC_ROOT=$(ACE_ROOT)/XSC \ + MPC_ROOT=$(ACE_ROOT)/MPC bin/mwc.pl -type gnuace ace/ace.mwc + XERCESCROOT=$(ACSROOT) \ + BOOST_ROOT=$(ALMASW_INSTDIR)/boost \ + XSC_ROOT=$(ACE_ROOT)/XSC \ + $(MAKE) -C $(ACE_ROOT)/ace +else + @echo "xerces-c not found in directory $(ACSROOT)/include/xercesc." +endif + +$(DEFAUL_FEATURE_FILE): linux/default.features +ifeq ($(OS), Linux) + @echo "Copying default.features to ACE" + @cp $< $@ +endif + + +build_xsc: $(ACE_ROOT)/../../XSC + @echo "Building XSC..." + @cd $(ACE_ROOT)/XSC; \ + XSC_ROOT=$(ACE_ROOT)/XSC \ + MPC_ROOT=$(ACE_ROOT)/MPC ../bin/mwc.pl -type make XSC.mwc + XERCESCROOT=$(ACSROOT) BOOST_ROOT=$(ALMASW_INSTDIR)/boost $(MAKE) -C $(ACE_ROOT)/XSC -j$(NUMPROC) + +$(ACE_ROOT)/../../XSC: + @echo "Clonning XSC from DOC Group (https://github.com/DOCGroup)" + @git clone --depth 1 https://github.com/DOCGroup/XSC.git $(ACE_ROOT)/../../XSC + @cd $(ACE_ROOT)/../../; MPC_ROOT=$(ACE_ROOT)/MPC; \ + $(ACE_ROOT)/MPC/clone_build_tree.pl + + + + +#___oOo___ diff --git a/LGPL/acsBUILD/config/.acs/.bash_profile.acs b/LGPL/acsBUILD/config/.acs/.bash_profile.acs index 0ee6249d..62eaf576 100644 --- a/LGPL/acsBUILD/config/.acs/.bash_profile.acs +++ b/LGPL/acsBUILD/config/.acs/.bash_profile.acs @@ -510,6 +510,8 @@ then elif [ "$OSYSTEM" = "Linux" ] then ACE_ROOT=$ACE_ROOT_DIR/linux + # Added support for XSC + XSC_ROOT=$ACE_ROOT/XSC DDS_ROOT=$DDS_ROOT_DIR/linux if [ X"$ACS_STARTUP_TIMEOUT_MULTIPLIER" = X ] then @@ -688,6 +690,11 @@ then IDL_PATH="-I$VLTROOT/idl "$IDL_PATH fi +if [ X"$DDS_ROOT" != X ] +then + IDL_PATH="-I$DDS_ROOT "$IDL_PATH +fi + if [ X"$ACSROOT" != X ] && [ X"$VLTROOT" != X"$ACSROOT" ] then IDL_PATH="-I$ACSROOT/idl "$IDL_PATH @@ -970,6 +977,11 @@ then LD_LIBRARY_PATH=$ACE_ROOT/lib:$ALMASW_INSTDIR/boost/lib:$LD_LIBRARY_PATH + if [ X"$XSC_ROOT" != X ] + then + LD_LIBRARY_PATH=$XSC_ROOT/lib:$LD_LIBRARY_PATH + fi + if [ X"$DDS_ROOT" != X ] then LD_LIBRARY_PATH=$DDS_ROOT/lib:$LD_LIBRARY_PATH -- 2.20.1 From 2237d964cd303446e9289ff8879da0806e30546f Mon Sep 17 00:00:00 2001 From: "Danilo C. Zanella" Date: Mon, 15 Mar 2021 15:33:28 +0000 Subject: [PATCH 3/3] Module acsncdds using OpenDDS with RTPS. --- .../acsncdds/config/CDB/schemas/Channels.xsd | 95 ------ .../config/CDB/schemas/EventChannel.xsd | 304 ------------------ LGPL/CommonSoftware/acsncdds/doc/README | 236 ++++++++++++++ .../acsncdds/idl/NCBenchmark.midl | 10 +- .../acsncdds/idl/SimpleExample.midl | 3 + .../acsncdds/include/DDSHelper.h | 98 ++++-- .../acsncdds/include/DDSNCBenchmarkImpl.h | 3 + .../acsncdds/include/DDSPublisher.h | 33 +- .../acsncdds/include/DDSSubscriber.h | 139 ++++---- .../acsncdds/include/DataReaderListener.h | 22 +- .../acsncdds/include/acsddsncCDBProperties.h | 20 +- .../include/acsddsncDataReaderListener.h | 1 - .../acsncdds/src/DDSHelperImpl.cpp | 281 ++++++++++------ .../acsncdds/src/DDSPublisherImpl.cpp | 207 ++++++------ .../acsncdds/src/DDSSubscriberImpl.cpp | 125 +++++-- .../acsncdds/src/DataReaderListenerImpl.cpp | 7 - LGPL/CommonSoftware/acsncdds/src/Makefile | 4 +- .../src/acsddsncCDBPropertiesImpl.cpp | 293 ++++++----------- .../acsncdds/src/startDCPSInfoRepo | 4 +- .../acsncdds/test/DDSNCBenchmarkImpl.cpp | 11 +- LGPL/CommonSoftware/acsncdds/test/Makefile | 25 +- LGPL/CommonSoftware/acsncdds/test/TATEpilogue | 2 +- LGPL/CommonSoftware/acsncdds/test/TATPrologue | 4 +- .../acsncdds/test/ddsPublisher.cpp | 13 +- .../acsncdds/test/ddsSlowSubscriber.cpp | 6 +- .../acsncdds/test/ddsSubscriber.cpp | 8 +- .../acsncdds/test/simpleExampleDDSClient.cpp | 6 +- .../acsncdds/test/simpleExampleDDSImpl.cpp | 4 +- .../acsncdds/test/testCDBProps.cpp | 75 ++--- 29 files changed, 973 insertions(+), 1066 deletions(-) delete mode 100644 LGPL/CommonSoftware/acsncdds/config/CDB/schemas/Channels.xsd delete mode 100644 LGPL/CommonSoftware/acsncdds/config/CDB/schemas/EventChannel.xsd create mode 100644 LGPL/CommonSoftware/acsncdds/doc/README diff --git a/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/Channels.xsd b/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/Channels.xsd deleted file mode 100644 index 59e1f253..00000000 --- a/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/Channels.xsd +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - Schema describing an individual domain mapping to a particular event service. - - - - - - Name of the domain. - - - - - - - Name of the notification service, as registered into a naming service. - - - - - - - - This is a sequence of domain mappings. - - - - - - - - - - Schema describing an individual channel mapping to a particular event service. - - - - - - Name of the channels, wildchars are allowed. - - - - - - - Name of the notification service, as registered into a naming service. - - - - - - - - This is a sequence of domain mappings. - - - - - - - - - This is an element defining domain and channel mapping to particular event service. - - - - - - - - - Name of the default notification service, used if not mapping criteria matches. - - - - - - - - This is an element defining notification channels. - - - - - - - - - - diff --git a/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/EventChannel.xsd b/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/EventChannel.xsd deleted file mode 100644 index fc957abf..00000000 --- a/LGPL/CommonSoftware/acsncdds/config/CDB/schemas/EventChannel.xsd +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - Schema describing an individual event sent by some supplier on the channel. Does not contain much - at the moment. - - - - - - - Defines the maximum amount of time a consumer is given to handle the given - event type. If the consumer fails to process the event within MaxProcessTime, - a warning log is sent at run-time indicating that it took too long to process the event - which can jeopardize the stability of the Notification Service process if it occurs - too often. MaxProcessTime is in floating point second units of time. - - - - - - - - - - - - - Schema which describes an ACS event channel. At the moment, the only info included here are some - Quality of Service and Administrative properties that are applicable to the type of notification channels ACS utilizes. - All of the inline schema documentation found here is also available in the ACS notification channel tutorial or - directly from OMG - http://www.omg.org/technology/documents/formal/notification_service.htm - - - - - - - Defines special properties of events. The "Name" attribute of each Event should be unique. - - - - - - - - - - - - - Giving this attribute a true value results in INFO logs for every sending and receiving of an event. - This produces a huge number of log messages, and is only useful for debugging, but never in operations. - @TODO: rename to something like "IsTraceEventsEnabled" because the historic - coupling of tracing events with software integrations can be misleading. - - - - - - - The maximum number of events that will be queued by the - channel before the channel begins discarding events (according to the Discard - Policy QoS parameter) or rejecting new events (depending on the setting of the - RejectNewEvents admin property) upon receipt of each new event. - - - - - - - - - - - - The maximum number of consumers that can be connected to the - channel at any given time. - - - - - - - - - - - - The maximum number of suppliers that can be connected to the - channel at any given time. - - - - - - - - - - - - This value associated with this property is of type Boolean, where TRUE and - FALSE have the following meanings: - * TRUE: Attempts to push new events to the channel by push-style suppliers will result - in the IMPL_LIMIT system exception being raised. - * FALSE: When the total number of undelivered events within the channel is equal to - MaxQueueLength, attempts to push new events to the channel by a push-style supplier will - result in one of the currently queued undelivered events being discarded by the - channel to make room for the new event. The discarded event will be chosen based - on the setting of the DiscardPolicy QoS property. - - - - - - - This QoS property enables a user of the Notification Service to specify in what order - the channel or a proxy supplier should begin discarding events in the case of an - internal buffer overflow. This property applies on a per-channel basis only if it is set on - a channel that has the RejectNewEvents admin property set to FALSE. If set on such a - channel, the chosen discard policy will be applied whenever a supplier attempts to - send a new event to the channel, and the total number of events already queued within - the channel is equal to the MaxQueueLength administrative property. If set on a per- - ConsumerAdmin basis, the chosen discard policy will be applied whenever the number - of events queued on behalf of one of the consumers connected to one of the proxy - suppliers created by the ConsumerAdmin exceeds the MaxEventsPerConsumer - setting for that consumer. If set on a per-proxy supplier basis, the chosen discard policy - will be applied whenever the number of events queued on behalf of the consumer - connected to the proxy supplier exceeds the MaxEventsPerConsumer setting for - that proxy supplier. Note that in these latter two cases, an event will only be - discarded with respect to its scheduled delivery to the consumer(s) on whose behalf - the policy is being applied. In other words, if the event targeted for discarding is - scheduled for delivery to any consumer(s) on whose behalf the discard policy was not - invoked, the event remains queued for those consumers. - Constant values to represent the following settings are defined: - * AnyOrder - Any event may be discarded on overflow. This is the default setting for this - property. - * FifoOrder - The first event received will be the first discarded. - * LifoOrder - The last event received will be the first discarded. - * PriorityOrder - Events should be discarded in priority order, such that lower priority - events will be discarded before higher priority events. - * DeadlineOrder - Events should be discarded in the order of shortest expiry deadline - first. - - Note that this property has no meaning if set on a per-message basis. - - - - - - - - - - - - - - - - The value portion of this attribute has two well-defined settings: - BestEffort (0) and Persistent (1). If set to 0, event can be - treated as non-persistent and lost upon failure of the channel. At least - one attempt must be made to transmit the event to each registered - consumer, but in the case of a failure to send to any consumer, no - further action need be taken. If set to 1, channel should make the - event persistent, and attempt to retransmit upon channel recovery - from failure. This setting only has meaning when - ConnectionReliability is also set to 1, in which the combination - essentially means guaranteed delivery. - - - - - - - - - - - - - Connection reliability takes on the same enumerated values as EventReliability. - This property defines whether the connection to the Notification Service between - consumers and suppliers is persistent. - - - - - - - - - - - - - The event service does not define the order in which events are delivered to a - consumer. One way to be explicit is to allow delivery to be based on the priority of an - event. Priority is represented as a short value, where -32,767 is the lowest priority and - 32,767 the highest. The default priority for all events is 0. By default, the notification - channel will attempt to deliver messages to consumers in priority order. - - - - - - - - - - - - - Timeout, a TimeBase::TimeT encoded value, states a relative expiry time (e.g., 10 - minutes from now), after which the event can be discarded. It is possible for a - consumer to override the value associated with this property through the use of - mapping filters. Note that the time value - associated with the Timeout QoS property is viewed as relative to the time when the - channel (i.e., the receiving proxy consumer) first received the event. - - - - - - - - - - - - This QoS property sets the policy used by a given proxy to order the events it has - buffered for delivery (either to another proxy or a consumer). Constant values to - represent the following settings are defined: - * AnyOrder - Any ordering policy is permitted. - * FifoOrder - Events should be delivered in the order of their arrival. - * PriorityOrder - Events should be buffered in priority order, such that higher priority - events will be delivered before lower priority events. - * DeadlineOrder - Events should be buffered in the order of shortest expiry deadline - first, such that events that are destined to timeout soonest should be delivered first. - - Note that this property has no meaning if set on a per-message basis. - - - - - - - - - - - - - - - QoS property is defined which has an associated boolean value, indicating - whether or not the setting of StartTime on a per-message basis is supported. - - - - - - - QoS property is defined that has an associated boolean value, indicating whether - or not the setting of StopTime on a per-message basis is supported. - - - - - - - An administrative property can be set on the channel to bound the maximum number of - events a given channel is allowed to queue at any given point in time. Note, however, - that a single badly behaved consumer could result in the channel holding the maximum - number of events it is allowed to queue for an extended period of time, preventing - further event communication through the channel. Thus, the - MaximumEventsPerConsumer property helps to avoid this situation by bounding the - maximum number of events the channel will queue on behalf of a given consumer. If - set only on a per-channel basis, the value of this property applies to all consumers - connected to the channel. If set on a per-ConsumerAdmin basis, this property applies - to all consumers connected to proxy suppliers created by that ConsumerAdmin. If set - on a per-proxy supplier basis, this property applies to the consumer connected to the - given proxy supplier. Note that setting this property on a SupplierAdmin or proxy - consumer has no meaning. Also note that the default setting of this property is 0, - meaning that the proxy imposes no limits on the maximum number of events that may - be queued for its consumer. - - - - - - - - - - - diff --git a/LGPL/CommonSoftware/acsncdds/doc/README b/LGPL/CommonSoftware/acsncdds/doc/README new file mode 100644 index 00000000..760baaea --- /dev/null +++ b/LGPL/CommonSoftware/acsncdds/doc/README @@ -0,0 +1,236 @@ +*/ Introduction to acsncdds/OpenDDS +* +* author Danilo C. Zanella +* Date: 05/Fev/2021 +* +*/ + + +DCPS : Data Centric Public and Subscribe +RTPS: + +1.0) Objective: + This module are helpers classes to create communications channels in ACS using OpenDDS middleware. + It creates a pair publisher and subscriber with a data type. + +2.0) Introdution: + + OpenDDS uses the IDL interfaces defined by the DDS specification to initialize and control service + usage. Data transmission is accomplished via an OpenDDS-specific transport framework that allows the + service to be used with a variety of transport protocols. This is referred to as pluggable transports + and makes the extensibility of OpenDDS an important part of its architecture. + + + ┌───────────────────────────────┐ ┌───────────────────────────────┐ + │ │ │ │ + │ Application A │ │ Application B │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ ┌───────────────────────┐ │ │ ┌───────────────────────┐ │ + │ │ DCPS Publisher │ │ │ │ DCPS Subscriber │ │ + │ │ │ │ │ │ │ │ + │ └───────┐ │ │ │ └───────┐ │ │ + │ │ │ │ │ │ │ │ + │ ┌─────┐ │ │ │ │ ┌─────┐ │ │ │ + │ │ QoS │ │ │ │ │ │ QoS │ │ │ │ + │ └─────┘ └───────────────┘ │ │ └─────┘ └───────────────┘ │ + │ │ │ │ + │ ┌───────────┐ ┌─────────┐ │ │ ┌───────────┐ ┌─────────┐ │ + │ │ Transport │ │Discovery│ │ │ │ Transport │ │Discovery│ │ + │ └───┬───────┘ └─────┬───┘ │ │ └───┬───────┘ └─────┬───┘ │ + │ │ │ │ │ │ │ │ + │ └───────┬───────┘ │ │ └───────┬───────┘ │ + │ │ │ │ │ │ + └───────────────┼───────────────┘ └───────────────┼───────────────┘ + │ │ + ▼ ▼ + └────────────────────────────────────┘ + Network + + Diagram of Extensible Transport Framework + + Pluggable Transport can be: TCP, UDP, Multicast, Shared-Memory, RTPS-UDP + + Pluggable Discovery can be: Centralized Repository (InfoRepo) or Peer-to-Peer (RTPS) + +3.0) Differences between DCPS InfoRepo and RTPS + + The next image show two OpenDDS application using a centralized DCPS InfoRepo. + The Publisher advertise the Central InfoRepo that will be publish a specific topic + during the discovery process. The Subscriber informs to Central InfoRepo that is + able to receive that topic. Finally, using the transport layer the publisher submit + data. + + ┌───────────────────────────────┐ ┌───────────────────────────────┐ + │ │ │ │ + │ Application A │ │ Application B │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ ┌───────────────────────┐ │ │ ┌───────────────────────┐ │ + │ │ DCPS Publisher │ │ │ │ DCPS Subscriber │ │ + │ │ │ │ │ │ │ │ + │ └───────┐ │ │ │ └───────┐ │ │ + │ │ │ │ │ │ │ │ + │ ┌─────┐ │ │ │ │ ┌─────┐ │ │ │ + │ │ QoS │ │ │ │ │ │ QoS │ │ │ │ + │ └─────┘ └───────────────┘ │ │ └─────┘ └───────────────┘ │ + │ │ │ │ + │ ┌─────────┐ ┌───────────┐ │ │ ┌───────────┐ ┌─────────┐ │ + │ │Discovery│ │ Transport │ │ │ │ Transport │ │Discovery│ │ + │ └────┬────┘ └─────┬─────┘ │ │ └───────────┘ └────┬────┘ │ + │ │ │ │ │ ▲ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + └────────┼────────────┼─────────┘ └──────────┼───────────┼────────┘ + │ │ 3. Publish │ │ 2. Discover + 1. Advertise│ └─────────────────────────┘ │ Topic + Topic │ │ + │ ┌───────────────┐ │ + └────────────────►│ DCPS InfoRepo │◄───────────────┘ + └───────────────┘ + + As each participating process activates the DDSI-RTPS discovery mechanisms in OpenDDS + for their data readers and writers, network endpoints are created with either default + or configured network ports such that DDS participants can begin advertising the availability + of their data readers and data writers. After a period of time, those seeking one another + based on criteria will find each other and establish a connection based on the configured + pluggable transport as discussed in Extensible Transport Framework (ETF). + + + ┌───────────────────────────────┐ ┌───────────────────────────────┐ + │ │ │ │ + │ Application A │ │ Application B │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ ┌───────────────────────┐ │ │ ┌───────────────────────┐ │ + │ │ DCPS Publisher │ │ │ │ DCPS Subscriber │ │ + │ │ │ │ │ │ │ │ + │ └───────┐ │ │ │ └───────┐ │ │ + │ │ │ │ │ │ │ │ + │ ┌─────┐ │ │ │ │ ┌─────┐ │ │ │ + │ │ QoS │ │ │ │ │ │ QoS │ │ │ │ + │ └─────┘ └───────────────┘ │ │ └─────┘ └───────────────┘ │ + │ │ │ │ + │ ┌─────────┐ ┌───────────┐ │ │ ┌───────────┐ ┌─────────┐ │ + │ │Discovery│ │ Transport │ │ │ │ Transport │ │Discovery│ │ + │ └────┬────┘ └─────┬─────┘ │ │ └───────────┘ └────┬────┘ │ + │ │ │ │ │ ▲ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + └────────┼────────────┼─────────┘ └──────────┼───────────┼────────┘ + │ │ 3. Publish │ │ 2. Discover + 1. Advertise│ └─────────────────────────┘ │ Topic + Topic │ │ + │ │ + └──────────────────────────────────────────────────┘ + RTPS + + + The RTPS protocol is designed to be able to run over multicast and connectionless best-effort + transports such as UDP/IP. The main features of the RTPS protocol include: + - Performance and quality-of-service properties to enable best-effort and reliable publish-subscribe + communications for real-time applications over standard IP networks. + - Fault tolerance to allow the creation of networks without single points of failure. + - Extensibility to allow the protocol to be extended and enhanced with new services without breaking + backwards compatibility and interoperability. + - Plug-and-play connectivity so that new applications and services are automatically discovered and + applications can join and leave the network at any time without the need for reconfiguration. + - Configurability to allow balancing the requirements for reliability and timeliness for each datadelivery. + - Modularity to allow simple devices to implement a subset of the protocol and still participate in the network. + - Scalability to enable systems to potentially scale to very large networks. + - Type-safety to prevent application programming errors from compromising the operation of remote nodes + + Domain + + The domain is the fundamental partitioning unit within DCPS. Each of the other entities belongs to a domain and + can only interact with other entities in that same domain. Application code is free to interact with multiple + domains but must do so via separate entities that belong to the different domains. + + DomainParticipant + + A domain participant is the entry-point for an application to interact within a particular domain. The domain + participant is a factory for many of the objects involved in writing or reading data. + + Topic + + The topic is the fundamental means of interaction between publishing and subscribing applications. Each topic + has a unique name within the domain and a specific data type that it publishes. Each topic data type can specify + zero or more fields that make up its key. When publishing data, the publishing process always specifies the topic. + Subscribers request data via the topic. In DCPS terminology you publish individual data samples for different + instances on a topic. Each instance is associated with a unique value for the key. A publishing process publishes + multiple data samples on the same instance by using the same key value for each sample. + + DataWriter + + The data writer is used by the publishing application code to pass values to the DDS. Each data writer is bound + to a particular topic. The application uses the data writer’s type-specific interface to publish samples on that + topic. The data writer is responsible for marshaling the data and passing it to the publisher for transmission. + + Publisher + + The publisher is responsible for taking the published data and disseminating it to all relevant subscribers in + the domain. The exact mechanism employed is left to the service implementation. + + Subscriber + + The subscriber receives the data from the publisher and passes it to any relevant data readers that are connected + to it. + + DataReader + + The data reader takes data from the subscriber, demarshals it into the appropriate type for that topic, and delivers + the sample to the application. Each data reader is bound to a particular topic. The application uses the data reader’s + type-specific interfaces to receive the samples. + + The following pictures shows this structure. + +-----------------------------------------------------------------------------------------------+ + | | + | DOMAIN | + | | + | | + | +-------------------------------------+ | + | | | | + | +--------------+ +-----------+--+ +--------------+ | | + | +---------+ DataWriter B | | DataWriter A | | DataWriter A +-----+ | | + | | +-----------+--+ +-+------------+ +-+------------+ | | | + | | | | | | | | + | | v v v | | | + | | +-------------+ +-------------+ | | | + | | | Publisher 1 | | Publisher 2 | | | | + | | +----------+--+ ++------------+ | | | + | | | | | | | + | v v v v v | + | +----------+ +--------------------------+ +----------+ | + | | | | | | | | + | | Topic B | | Data Transmission | | Topic A | | + | | | | | | | | + | +----------+ +--------------------------+ +----------+ | + | ^ ^ ^ ^ ^ | + | | | | | | | + | | | +-----------+--+ +-+------------+ | | + | | | | Subscriber 1 | | Subscriber 2 | | | + | | | +--------------+ +--------------+ | | + | | | ^ ^ ^ | | + | | | | | | | | + | | | +-----------+--+ +-----------+-+ +-+----------+ | | + | | +--------+ DataReader B | |DataReader B | |DataReader A+---------+ | + | | +--------------+ +-+-----------+ +------------+ | + | | ^ | | | | | + | +---------------------------------------+ | + | | + +-----------------------------------------------------------------------------------------------+ + + + Futher information consult: + http://download.objectcomputing.com/OpenDDS/OpenDDS-latest.pdf + +4.0) Limitations: + Current implementation of this module has the following known limitations: + - Use the RTPS discovery + - It can handle only one topic/type by communication channel + + + diff --git a/LGPL/CommonSoftware/acsncdds/idl/NCBenchmark.midl b/LGPL/CommonSoftware/acsncdds/idl/NCBenchmark.midl index 040e88ae..c1603fb4 100644 --- a/LGPL/CommonSoftware/acsncdds/idl/NCBenchmark.midl +++ b/LGPL/CommonSoftware/acsncdds/idl/NCBenchmark.midl @@ -5,18 +5,20 @@ #pragma prefix "alma" +#pragma DCPS_DATA_TYPE "NC_BENCHMARK::Message" +#pragma DCPS_DATA_KEY "NC_BENCHMARK::Message seqnum" module NC_BENCHMARK{ const short MAX_MSG_LENGTH = 16384; - const string CHANNEL_NAME = "simple_example"; - -#pragma DCPS_DATA_TYPE "NC_BENCHMARK::Message" + const string CHANNEL_NAME = "DDSEvent"; + const long DOMAIN_ID = 411; + typedef sequence dataT; struct Message{ long seqnum; unsigned long long time; - sequence data; + dataT data; }; diff --git a/LGPL/CommonSoftware/acsncdds/idl/SimpleExample.midl b/LGPL/CommonSoftware/acsncdds/idl/SimpleExample.midl index 21dd11c3..6c8960d6 100644 --- a/LGPL/CommonSoftware/acsncdds/idl/SimpleExample.midl +++ b/LGPL/CommonSoftware/acsncdds/idl/SimpleExample.midl @@ -6,10 +6,13 @@ #pragma prefix "alma" module DDS_SIMPLE_EXAMPLE{ + const string DOMAIN_ID = "411"; const string CHANNEL_NAME = "simple_example"; const string CHANNEL_NAME_2 = "another_example"; #pragma DCPS_DATA_TYPE "DDS_SIMPLE_EXAMPLE::simpleMessage" +#pragma DCPS_DATA_KEY "DDS_SIMPLE_EXAMPLE::simpleMessage seqnum" + struct simpleMessage{ unsigned long seqnum; }; diff --git a/LGPL/CommonSoftware/acsncdds/include/DDSHelper.h b/LGPL/CommonSoftware/acsncdds/include/DDSHelper.h index 4bf61831..0b15cf17 100644 --- a/LGPL/CommonSoftware/acsncdds/include/DDSHelper.h +++ b/LGPL/CommonSoftware/acsncdds/include/DDSHelper.h @@ -7,7 +7,15 @@ #include #include -const unsigned int DOMAIN_ID=411; +// For transport handle instances and configuration +#include + +// Forward declaration +namespace ddsnc { + class CDBProperties; +} + +using namespace std; namespace ddsnc{ @@ -17,6 +25,7 @@ namespace ddsnc{ * class, it must be inherited. * * @author Jorge Avarias + * @author Danilo C. Zanella * @see DDSPublisher * @see DDSSubscriber */ @@ -24,40 +33,54 @@ namespace ddsnc{ class DDSHelper{ private: void setTopicName(const char* topicName); - void init(const char* channelName, const char* DCPSInfoRepoLoc); + void initRTPS(); /*int argc; const ACE_TCHAR* argv[];*/ + + static int instances_; + + // Transport configuration for RTPS + // Store transport config + OpenDDS::DCPS::TransportConfig_rch m_config; + // Store transport instance + OpenDDS::DCPS::TransportInst_rch m_inst; + + // Domain Participant Section + DDS::DomainId_t m_domainId; + DDS::DomainParticipantFactory_ptr dpf; + DDS::DomainParticipantQos dpQos; + protected: - DDS::DomainParticipantFactory_ptr dpf; + CDBProperties * m_cdbprops_p; + string m_channelName; + string m_qosProfileName; + string m_topicName; + string m_partitionName; + + // Topic Section + DDS::Topic_var topic; + DDS::TopicQos topicQos; + DDS::DomainParticipant_var participant; - DDS::Topic_var topic; - char* partitionName; - char* topicName; - bool initialized; /**< a flag that shows the initialization status + static bool initialized; /**< a flag that shows the initialization status of the class*/ - /** - * Constructor for DDSHelper, this constructor will be set the - * location of DCPSInfoRepo to corbaloc:iiop:127.0.0.1:3999/DCPSInfoRepo - * - * @param channelName the name of the channel that will be mapped to a - * partition. - * - */ - DDSHelper(CORBA::String_var channelName); - /** * Constructor for DDSHelper * * @param channelName the name of the channel that will be mapped to a * partition. + * + * @param qosProfileName the name of the profile used to set qos + * + * @param id DDS domain id value value between 0~231, following OpenDDS + * documentation * - * @param DCPSInfoRepoLoc address of the DCPSInfoRepo. The address - * must be a format supported by TAO */ - DDSHelper(const char* channelName, const char* DCPSInfoRepoLoc); - + DDSHelper(const char * channelName, const char * qosProfileName, DDS::DomainId_t id); + virtual ~DDSHelper(); + /** * Destructor for DDSHelper before free the varibales it call to * disconnect method, if disconnect method was called, the @@ -65,7 +88,6 @@ namespace ddsnc{ * * @see disconnect() */ - virtual ~DDSHelper(); int createParticipant(); /** @@ -78,13 +100,25 @@ namespace ddsnc{ * @param typeName the type to be registered in the topic, the topic * must be in CORBA type name format */ - void initializeTopic(const char* topicName, CORBA::String_var typeName); + void initializeTopic(const char* topicName, const char * typeName); - void initializeTopic(CORBA::String_var typeName); + void initializeTopic(const char * typeName); + /** + * Set partition name based on the channel name + * + * @param partitionName the name of the partition + */ void setPartitionName(const char* partitionName); - + public: + + DDS::DomainId_t getDomainID(); + + /** + * Get topic name from the registered topic + */ + const char * getTopicName(); /** * Disconnect method will destroy all the DDS entities initilizated, * it will @@ -96,10 +130,18 @@ namespace ddsnc{ * @see ~DDSHelper() */ void disconnect(); - DDS::TopicQos topicQos; - static void cleanUp(); - CORBA::String_var getChannelName(); + /** + * CleanUp method will release the transport implementation and configuration + * and shutdown the Service Participant + * + */ + void cleanUp(); + + /** + * Get name of the channel + */ + const char * getChannelName(); }; } diff --git a/LGPL/CommonSoftware/acsncdds/include/DDSNCBenchmarkImpl.h b/LGPL/CommonSoftware/acsncdds/include/DDSNCBenchmarkImpl.h index 0315e6e6..74491386 100644 --- a/LGPL/CommonSoftware/acsncdds/include/DDSNCBenchmarkImpl.h +++ b/LGPL/CommonSoftware/acsncdds/include/DDSNCBenchmarkImpl.h @@ -23,6 +23,9 @@ class DDSNCBenchmarkSupplierImpl : virtual void cleanUp(); virtual ~DDSNCBenchmarkSupplierImpl(); + private: + ddsnc::DDSPublisher *pub_p; + }; #endif diff --git a/LGPL/CommonSoftware/acsncdds/include/DDSPublisher.h b/LGPL/CommonSoftware/acsncdds/include/DDSPublisher.h index a08751e5..c38d488f 100644 --- a/LGPL/CommonSoftware/acsncdds/include/DDSPublisher.h +++ b/LGPL/CommonSoftware/acsncdds/include/DDSPublisher.h @@ -16,14 +16,13 @@ namespace ddsnc{ * * @see DDSHelper * @author Jorge Avarias - */ -// template + * @author Danilo C. Zanella + */ class DDSPublisher : public ::ddsnc::DDSHelper{ private: DDS::Publisher_var pub; - OpenDDS::DCPS::PublisherImpl *pub_impl; DDS::DataWriter_var dw; -// DWVAR dataWriter; + DDS::TypeSupport_var ts_; DDS::InstanceHandle_t handler; /** @@ -53,18 +52,10 @@ namespace ddsnc{ protected: DDS::PublisherQos pubQos; + DDS::DataWriterQos dwQos; public: - DDS::DataWriterQos dwQos; /**< Data Writer Qos, can be modified according - OpenDDS API, the Qos properties will be - applied when is called publishData for - first time and they cannot be changed after - that. - @see initializeDataWriter() - @see publishData(D data) - */ - /** * Constructor for DDSPublisher class, initializes the common * objects required by a DDS Publisher. @@ -72,8 +63,8 @@ namespace ddsnc{ * @see DDSHelper * @see initialize() */ - DDSPublisher(const char *channelName): - ::ddsnc::DDSHelper(channelName) + DDSPublisher(const char *channelName, const char * profileName, DDS::DomainId_t id): + ::ddsnc::DDSHelper(channelName, profileName,id) { initialize(); } @@ -94,13 +85,15 @@ namespace ddsnc{ * @tparam TSV TypeSupport_var class * @tparam TSI TypeSupportImpl class */ - template + template void publishData(D data) { if(initialized==false){ /*Initialize Type Support*/ - TSV ts; - ts = new TSI(); + ts_ = new TSI(); + TSV ts = TS::_narrow(ts_.in()); + //TSV ts; + //ts = new TSI(); if(DDS::RETCODE_OK != ts->register_type(participant.in(),"")) std::cerr << "register_type failed" << std::endl; /*Initialize the Topic*/ @@ -111,7 +104,7 @@ namespace ddsnc{ initialized=true; } DWVAR dataWriter = DW::_narrow(dw.in()); - handler = dataWriter->_cxx_register(data); + handler = dataWriter->register_instance(data); dataWriter->write(data,handler); } @@ -126,7 +119,7 @@ namespace ddsnc{ #define PUBLISH_DATA(publisher_p, idlStruct, message) \ { \ publisher_p->publishData (message); \ } #endif diff --git a/LGPL/CommonSoftware/acsncdds/include/DDSSubscriber.h b/LGPL/CommonSoftware/acsncdds/include/DDSSubscriber.h index c56215e5..04de42b5 100644 --- a/LGPL/CommonSoftware/acsncdds/include/DDSSubscriber.h +++ b/LGPL/CommonSoftware/acsncdds/include/DDSSubscriber.h @@ -4,6 +4,7 @@ #include #include #include +#include namespace ddsnc{ @@ -12,52 +13,47 @@ namespace ddsnc{ * * @see DDSHelper * @author Jorge Avarias - */ + * @author Danilo C. Zanella + */ class DDSSubscriber : public ddsnc::DDSHelper{ private: DDS::Subscriber_var sub; - OpenDDS::DCPS::SubscriberImpl *sub_impl; - DDS::DataReaderListener_var *listener; + DDS::DataReaderListener_var listener; + DDS::DataReader_var dr; + DDS::TypeSupport_var ts_; /** * Creates the subscriber with default QoS or QoS with a partition * * @see initialize(); */ - int createSubscriber(); + void createSubscriber(); + + /** + * Initialize the DataReader with Qos. This method leaves the Subscriber + * initializated when is executed. + * + * @see drQos + */ + void initializeDataReader(); protected: DDS::SubscriberQos subQos; public: - DDS::DataReaderQos drQos; /**< Data Writer Qos, can be modified according - OpenDDS API, the Qos properties will be - applied when is called consumerReady for - first time and they cannot be changed after - that. - - @see consumerReady() - @see initialize() - */ + DDS::DataReaderQos drQos; /** * Constructor of the class. * * @see DDSHelper */ - DDSSubscriber(CORBA::String_var channel_name); + DDSSubscriber(CORBA::String_var channel_name, CORBA::String_var qosProfile, DDS::DomainId_t id); ~DDSSubscriber() { - delete listener; } - /** - * Initialize the DataReader with Qos. This method leaves the Subscriber - * initializated when is executed. - * - * @see drQos - */ void consumerReady(); /** @@ -80,20 +76,26 @@ namespace ddsnc{ void addSubscription( void (*templateFunction)(D, void *), void *handlerParam=0) { - std::cerr << "DDSSubscriber::addSubscription" << std::endl; - - listener = new DDS::DataReaderListener_var - (new ddsnc::ACSDDSNCDataReaderListener - (templateFunction, handlerParam)); - - /*ddsnc::ACSDDSNCDataReaderListener* listener_servant= - dynamic_cast*> - (listener.in()); - - if(CORBA::is_nil (listener.in())){ - std::cerr << "listener is nil" << std::endl; - } - */ + ACS_TRACE(__PRETTY_FUNCTION__); + + LOG_TO_DEVELOPER(LM_INFO, "Add subscription"); + + listener = new ddsnc::ACSDDSNCDataReaderListener + (templateFunction, handlerParam); + + // Check if subscriber was created + if(CORBA::is_nil(listener.in())) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Listener is nil."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); + } + } @@ -112,46 +114,47 @@ namespace ddsnc{ * type defined. * * - * @tparam D struct + * @tparam TS TypeSupport class * @tparam TSV TypeSupport_var class * @tparam TSI TypeSupportImpl class */ - template + template void initialize() { - std::cerr<< "DDSSubscriber::initialize()" << std::endl; + ACS_TRACE(__PRETTY_FUNCTION__); + + LOG_TO_DEVELOPER(LM_INFO, "Initializing..."); + + // Create participant createParticipant(); - if (CORBA::is_nil (participant.in())) - std::cerr << "Participant is nil" << std::endl; - - if(partitionName!=NULL){ - participant->get_default_subscriber_qos(subQos); - subQos.partition.name.length(1); - subQos.partition.name[0]=CORBA::string_dup(partitionName); - } - - createSubscriber(); - - /*Initialize Type Support*/ - TSV ts; - ts = new TSI(); - if (DDS::RETCODE_OK != ts->register_type(participant.in(),"")){ - std::cerr << "register_type failed" << std::endl; + + // Create Subscriber + createSubscriber(); + + /* Initialize Type Support*/ + ts_ = new TSI(); + TSV ts = TS::_narrow(ts_.in()); + if (DDS::RETCODE_OK != ts->register_type(participant.in(),"")) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::stringstream msg; + msg << "Registering type <" + << ts->get_type_name() + << "> failed"; + ex.setErrorDesc(msg.str().c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } - /*Initialize the Topic*/ + /* Initialize the Topic*/ initializeTopic(ts->get_type_name()); - if(CORBA::is_nil(topic.in())) - std::cerr<< "Topic is nil" << std::endl; - - sub->get_default_datareader_qos (drQos); - - drQos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; - drQos.reliability.max_blocking_time.sec = 1; - drQos.history.kind = ::DDS::KEEP_LAST_HISTORY_QOS; - // drQos.history.depth = 100; - drQos.history.depth = 1; + /* Initialize the Data Reader*/ + initializeDataReader(); + } }; } @@ -166,10 +169,10 @@ namespace ddsnc{ * @see initialize() * @see addSubscription() */ -#define ACS_NEW_DDS_SUBSCRIBER(subscriber_p, idlStruct, channelName, handlerFunc, handlerParam) \ +#define ACS_NEW_DDS_SUBSCRIBER(subscriber_p, idlStruct, id, channelName, qosProfileName, handlerFunc, handlerParam) \ { \ - subscriber_p= new ddsnc::DDSSubscriber(channelName); \ - subscriber_p->initialize(); \ + subscriber_p= new ddsnc::DDSSubscriber(channelName, qosProfileName, id); \ + subscriber_p->initialize(); \ subscriber_p->addSubscription(handlerFunc, handlerParam); \ } diff --git a/LGPL/CommonSoftware/acsncdds/include/DataReaderListener.h b/LGPL/CommonSoftware/acsncdds/include/DataReaderListener.h index 56219eb4..a4668725 100644 --- a/LGPL/CommonSoftware/acsncdds/include/DataReaderListener.h +++ b/LGPL/CommonSoftware/acsncdds/include/DataReaderListener.h @@ -3,6 +3,7 @@ #include #include +#include #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once @@ -31,41 +32,34 @@ public: void on_requested_deadline_missed ( DDS::DataReader_ptr reader, - const DDS::RequestedDeadlineMissedStatus & status) - throw (CORBA::SystemException); + const DDS::RequestedDeadlineMissedStatus & status); void on_requested_incompatible_qos ( DDS::DataReader_ptr reader, - const DDS::RequestedIncompatibleQosStatus & status) - throw (CORBA::SystemException); + const DDS::RequestedIncompatibleQosStatus & status); void on_liveliness_changed ( DDS::DataReader_ptr reader, - const DDS::LivelinessChangedStatus & status) - throw (CORBA::SystemException); + const DDS::LivelinessChangedStatus & status); void on_subscription_matched ( DDS::DataReader_ptr reader, const DDS::SubscriptionMatchedStatus & status - ) - throw (CORBA::SystemException); + ); void on_sample_rejected( DDS::DataReader_ptr reader, const DDS::SampleRejectedStatus& status - ) - throw (CORBA::SystemException); + ); virtual void on_data_available( DDS::DataReader_ptr reader - ) - throw (CORBA::SystemException); + ); void on_sample_lost( DDS::DataReader_ptr reader, const DDS::SampleLostStatus& status - ) - throw (CORBA::SystemException); + ); long num_reads() const { return num_reads_; diff --git a/LGPL/CommonSoftware/acsncdds/include/acsddsncCDBProperties.h b/LGPL/CommonSoftware/acsncdds/include/acsddsncCDBProperties.h index d18b994b..95af586c 100644 --- a/LGPL/CommonSoftware/acsncdds/include/acsddsncCDBProperties.h +++ b/LGPL/CommonSoftware/acsncdds/include/acsddsncCDBProperties.h @@ -34,30 +34,30 @@ #error This is a C++ include file and cannot be used from plain C #endif - #include #include #include #include #include #include +#include namespace ddsnc { - class CDBProperties { + class CDBProperties : public OpenDDS::DCPS::QOS_XML_MemBuf_Handler + { - public: + public: + CDBProperties(); - static CDB::DAL_ptr - getCDB(); + ~CDBProperties(); - static bool - cdbChannelConfigExists(CORBA::String_var channelName); + static CDB::DAL_ptr + getCDB(); - static DDS::QosPolicyCountSeq - getCDBQoSProps(CORBA::String_var channelName); + void parseConfig(CORBA::String_var channelName); - }; + }; }; diff --git a/LGPL/CommonSoftware/acsncdds/include/acsddsncDataReaderListener.h b/LGPL/CommonSoftware/acsncdds/include/acsddsncDataReaderListener.h index 91e34494..0a92e54d 100644 --- a/LGPL/CommonSoftware/acsncdds/include/acsddsncDataReaderListener.h +++ b/LGPL/CommonSoftware/acsncdds/include/acsddsncDataReaderListener.h @@ -45,7 +45,6 @@ class ACSDDSNCDataReaderListener : } void on_data_available(DDS::DataReader_ptr reader) - throw (CORBA::SystemException) { num_reads_ ++; try { diff --git a/LGPL/CommonSoftware/acsncdds/src/DDSHelperImpl.cpp b/LGPL/CommonSoftware/acsncdds/src/DDSHelperImpl.cpp index cd7dce09..cf3408a5 100644 --- a/LGPL/CommonSoftware/acsncdds/src/DDSHelperImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/src/DDSHelperImpl.cpp @@ -5,169 +5,254 @@ #include #include +#include +#include +#include +#include + +#include +#include + + using namespace ddsnc; static bool factories_init = false; -static CORBA::String_var channel_name; +bool DDSHelper::initialized = false; +int DDSHelper::instances_ = 0; -DDSHelper::DDSHelper(CORBA::String_var channelName) +DDSHelper::DDSHelper(const char * channelName, const char * qosProfileName, DDS::DomainId_t id) : + m_domainId(id), + m_cdbprops_p(new CDBProperties()), + m_channelName(channelName), + m_qosProfileName(qosProfileName) { - channel_name = channelName; - ACE_CString managerName; - try - { - managerName = maci::MACIHelper::getManagerHostname(1,NULL); - } - catch(CORBA::TRANSIENT &ex) - { - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::DDSHelper", (LM_ERROR, - "Manager ref null.")); - exit(1); - } - ACE_CString tmpRoute = "corbaloc:iiop:"; - tmpRoute += managerName; - tmpRoute +=":3999/DCPSInfoRepo"; - char* route = tmpRoute.rep(); - - init(channelName, route); + ACS_TRACE(__PRETTY_FUNCTION__); + + // Parse CDB configuration by respective channel name + m_cdbprops_p->parseConfig(channelName); + + initRTPS(); } -DDSHelper::DDSHelper(const char* channelName, const char *DCPSInfoRepoLoc) +void DDSHelper::initRTPS() { - init(channelName, DCPSInfoRepoLoc); -} + // Create a static initializer: IMPORTANT + OpenDDS::RTPS::RtpsDiscovery::StaticInitializer initialize_rtps; + TheServiceParticipant->set_default_discovery(OpenDDS::DCPS::Discovery::DEFAULT_RTPS); -void DDSHelper::init(const char* channelName, const char* DCPSInfoRepoLoc) -{ - int argc; - char* argv[7]; - argc=7; - - argv[0] = strdup("Participant"); - argv[1] = strdup("-DCPSInforepo"); - argv[2] = strdup(DCPSInfoRepoLoc); - //DCPS Debug Level - argv[3] = strdup("-DCPSDebugLevel"); - argv[4] = strdup("0"); - //Transport Debug Level - argv[5] = strdup("-DCPSTransportDebugLevel"); - argv[6] = strdup("0"); - - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::init", (LM_INFO, - "Registering TransportImpl.")); - -/* Fedora 8 systems have a problem with next line of code. If the component is - * referenced by a simple client the DDS Notiification Channel works only once - * time, the second time the maciContainer will exit with a Segmentation Fault - * generated by ACE library. The error cannot be replicated if it used - * object explorer. Maybe this error can affect to all RedHat OSs similar to - * Fedora 8 (SL 5.2). The line below works great under Ubuntu 8.04 - */ -// ACE_Service_Config::process_directive( -// "static DCPS_SimpleTcpLoader \"-type SimpleTcp\""); + // Initialize DomainParticipantFactory - factories_init = true; + dpf = TheParticipantFactory; + + // Create config + // They need to be different inside of each process + std::stringstream ss; + ss << "Config" << instances_; + const std::string transportConfigName = ss.str(); + ss.str(""); + ss << "Inst" << instances_; + const std::string transportInstanceName = ss.str(); + + m_config = TheTransportRegistry->get_config(transportConfigName); - dpf=TheParticipantFactoryWithArgs(argc, (ACE_TCHAR**)argv); + if (m_config.is_nil()) + { + m_config = TheTransportRegistry->create_config(transportConfigName); + } - initialized=false; - setPartitionName(channelName); - -// ::std::string channelStr(channelName); -// int pos=channelStr.find_last_of("_"); -// if(pos<0){ -// -// setTopicName(channelName); -// return; -// } -// setTopicName(channelStr.substr(++pos).c_str()); -// std::cerr << "Trying to set topic name: " << topicName <instances_.empty()) + { + m_inst = TheTransportRegistry->get_inst(transportInstanceName); + if (m_inst.is_nil()) + { + LOG_TO_DEVELOPER(LM_INFO, "No transport instance in config! Creating it..."); + m_inst = TheTransportRegistry->create_inst(transportInstanceName, "rtps_udp"); + // For Debug + //inst->dump(); + } + m_config->instances_.push_back(m_inst); + } + TheTransportRegistry->global_config(m_config); + + TheServiceParticipant->set_repo_domain(m_domainId, OpenDDS::DCPS::Discovery::RepoKey(OpenDDS::DCPS::Discovery::DEFAULT_RTPS),true); + + TheServiceParticipant->get_default_discovery(); + + TheServiceParticipant->set_default_discovery(OpenDDS::DCPS::Discovery::RepoKey(OpenDDS::DCPS::Discovery::DEFAULT_RTPS)); + + factories_init = true; + initialized=false; + instances_++; + setPartitionName(m_channelName.c_str()); } -int DDSHelper::createParticipant(){ - ACS_TRACE("DDSHelper::createParticipant"); - participant = dpf->create_participant(DOMAIN_ID, - PARTICIPANT_QOS_DEFAULT, - DDS::DomainParticipantListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); +int DDSHelper::createParticipant() +{ + ACS_TRACE(__PRETTY_FUNCTION__); + + { + stringstream msg; + msg << "Creating domain participant, using domain ID: " + << m_domainId; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + // Check if there is a domain participant qos in CDB + DDS::ReturnCode_t retcode; + dpf->get_default_participant_qos(dpQos); + retcode = m_cdbprops_p->get_participant_qos(dpQos, + ACE_TEXT_CHAR_TO_TCHAR(m_qosProfileName.c_str())); + + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Participant QoS not found for profile <" + << m_qosProfileName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + participant = dpf->create_participant(m_domainId, + dpQos, + DDS::DomainParticipantListener::_nil(), + OpenDDS::DCPS::DEFAULT_STATUS_MASK); if (CORBA::is_nil(participant.in())){ - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::createParticipant", (LM_ERROR, - "Create Participant Failed.")); - return 1; + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, __LINE__, + __PRETTY_FUNCTION__); + std::string msg = "Failed to create a participant."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::createParticipant", (LM_INFO, - "Created the participant.")); + LOG_TO_DEVELOPER(LM_INFO, "Created the participant."); return 0; } +DDS::DomainId_t DDSHelper::getDomainID() +{ + ACS_TRACE(__PRETTY_FUNCTION__); + + return m_domainId; +} + void DDSHelper::setTopicName(const char* topicName) { - this->topicName=strdup(topicName); + ACS_TRACE(__PRETTY_FUNCTION__); + + m_topicName = topicName; } -void DDSHelper::initializeTopic(const char* topicName, CORBA::String_var typeName) +const char * DDSHelper::getTopicName() { - const char *typeNameChar = typeName; - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::initializeTopic", (LM_INFO, - "Initializing topic: '%s' with type: '%s'",this->topicName,typeNameChar)); + ACS_TRACE(__PRETTY_FUNCTION__); + + return m_topicName.c_str(); +} + +void DDSHelper::initializeTopic(const char* topicName, const char * typeName) +{ + ACS_TRACE(__PRETTY_FUNCTION__); + + stringstream msg; + msg << "Initializing topic: <" + << topicName + << "> with type: <" + << typeName + << "> in profile <" + << m_qosProfileName + << ">"; + LOG_TO_DEVELOPER(LM_INFO,msg.str()); + + // Check if there is a topic in CDB + // It not implements topic name in method get_topic_qos + DDS::ReturnCode_t retcode; participant->get_default_topic_qos(topicQos); - topic=participant->create_topic(topicName, typeName.in(), + retcode = m_cdbprops_p->get_topic_qos(topicQos, + ACE_TEXT_CHAR_TO_TCHAR(m_qosProfileName.c_str()), + 0); + + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Topic QoS not found for profile <" + << m_qosProfileName << "> and topic <" + << topicName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + // Create topic + topic=participant->create_topic(topicName, typeName, topicQos, DDS::TopicListener::_nil(), OpenDDS::DCPS::DEFAULT_STATUS_MASK); - + + // Check if topic was created if (CORBA::is_nil(topic.in())){ - ACS_STATIC_LOG(LM_FULL_INFO, "DDSHelper::initializeTopic", (LM_INFO, - "create_topic failed")); + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Failed to create a topic."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } + setTopicName(topicName); } -void DDSHelper::initializeTopic(CORBA::String_var typeName) +void DDSHelper::initializeTopic(const char * typeName) { std::string topicStr (typeName); int f = topicStr.find_first_of(":"); - int l = topicStr.find_last_of(":"); - topicName = strdup(topicStr.substr(f+1, (l-1)-f).c_str()); - initializeTopic(topicName, typeName); + string topicName = topicStr.substr(f+2, topicStr.length()-f-2).c_str(); + initializeTopic(topicName.c_str(), typeName); } void DDSHelper::setPartitionName(const char* partitionName){ - this->partitionName=strdup(partitionName); + m_partitionName = partitionName; } void DDSHelper::disconnect() { - ACS_TRACE("DDSHelper::disconnect"); + ACS_TRACE(__PRETTY_FUNCTION__); if(initialized==true){ + TheTransportRegistry->remove_inst(m_config->instances_.back()); + TheTransportRegistry->remove_config(m_config); participant->delete_contained_entities(); dpf->delete_participant(participant.in()); + //TheTransportRegistry->remove_inst(config->instances_.back()); initialized=false; } } DDSHelper::~DDSHelper() { - ACS_TRACE("DDSHelper::~DDSHelper"); + ACS_TRACE(__PRETTY_FUNCTION__); disconnect(); - free(partitionName); - free(topicName); + delete m_cdbprops_p; + //free(partitionName); + //free(topicName); } void DDSHelper::cleanUp() { - ACS_TRACE("DDSHelper::cleanUp"); + ACS_TRACE(__PRETTY_FUNCTION__); + + LOG_TO_DEVELOPER(LM_INFO, "Release TransportRegistry and and shutdown TheServiceParticipant"); + if (factories_init){ + TheTransportRegistry->release(); TheServiceParticipant->shutdown(); + //ACE_Thread_Manager::instance()->wait(); + //ACE::fini(); } } -CORBA::String_var DDSHelper::getChannelName() +const char * DDSHelper::getChannelName() { -return channel_name; + return m_channelName.c_str(); } diff --git a/LGPL/CommonSoftware/acsncdds/src/DDSPublisherImpl.cpp b/LGPL/CommonSoftware/acsncdds/src/DDSPublisherImpl.cpp index c9b4aaa3..af2f427f 100644 --- a/LGPL/CommonSoftware/acsncdds/src/DDSPublisherImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/src/DDSPublisherImpl.cpp @@ -1,121 +1,144 @@ #include #include "DDSPublisher.h" +#include using namespace ddsnc; void DDSPublisher::initialize() { - ACS_TRACE("DDSPublisher::initialize"); + ACS_TRACE(__PRETTY_FUNCTION__); + + // Create participant createParticipant(); if (CORBA::is_nil (participant.in())) - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::initialize", (LM_ERROR, - "Participant is nil")); - if(partitionName!=NULL){ - participant->get_default_publisher_qos(pubQos); - pubQos.partition.name.length(1); - pubQos.partition.name[0]=CORBA::string_dup(partitionName); - } - createPublisher(); + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Participant is nil."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); + } + // Check if there is publisher QoS in CDB + DDS::ReturnCode_t retcode; + participant->get_default_publisher_qos(pubQos); + retcode = m_cdbprops_p->get_publisher_qos(pubQos,m_qosProfileName.c_str()); + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Publisher QoS not found for profile <" + << m_qosProfileName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } - pub->get_default_datawriter_qos (dwQos); - dwQos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS; - dwQos.reliability.max_blocking_time.sec = 1; - - // CDB QoS - DDS::QosPolicyCountSeq tmp = CDBProperties::getCDBQoSProps(DDSHelper::getChannelName()); - - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::initialize", (LM_INFO, - "setting the QoS")); - for(int i=0;i<(int)tmp.length();i++) - { - if( tmp[i].policy_id == 12 ) - { - //Destination_order - if(tmp[i].count == 0) - dwQos.destination_order.kind = ::DDS::BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS; - else if(tmp[i].count == 1) - dwQos.destination_order.kind = ::DDS::BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS; - } - else if(tmp[i].policy_id == 13) - { - //History (MaxQueueLength) - dwQos.history.kind = ::DDS::KEEP_LAST_HISTORY_QOS; - dwQos.history.depth = tmp[i].count; - } - else if(tmp[i].policy_id == 20) - { - //Transport_Priority - dwQos.transport_priority.value = (CORBA::Long)tmp[i].count; - } - else if(tmp[i].policy_id == 30) - { - //Lifespan (Timeout) - // 0 is infinity....I think. - if(tmp[i].count == 0) - { - DDS::Duration_t d = { DDS::DURATION_INFINITE_SEC , DDS::DURATION_INFINITE_NSEC }; - dwQos.lifespan.duration = d; - } - else - { - DDS::Duration_t d = { (CORBA::Long)tmp[i].count , (CORBA::ULong)tmp[i].count }; - dwQos.lifespan.duration = d; - } - - } - else - { - //This shouldn't happen - } - } - + // Create publisher + createPublisher(); - dwQos.durability.kind = ::DDS::TRANSIENT_LOCAL_DURABILITY_QOS; - dwQos.durability_service.service_cleanup_delay.sec = 10; } void DDSPublisher::initializeDataWriter() { + ACS_TRACE(__PRETTY_FUNCTION__); + + LOG_TO_DEVELOPER(LM_INFO, "Initializing datawriter"); + + OpenDDS::DCPS::PublisherImpl * pubImpl= dynamic_cast(pub.in()); + if(pubImpl == 0) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Failed to obtain publisher servant."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); + } + + // get_datawriter qos + // It not implements topic name + DDS::ReturnCode_t retcode; + pubImpl->get_default_datawriter_qos(dwQos); + retcode = m_cdbprops_p->get_datawriter_qos(dwQos, + m_qosProfileName.c_str(), + 0); + + // Check if there is a datawriter qos in CDB + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Datawriter QoS not found for profile <" + << m_qosProfileName << "> and topic <" + << m_topicName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + pubImpl->get_default_datawriter_qos(dwQos); + // Create datawriter dw = pub->create_datawriter(topic.in(), - dwQos, DDS::DataWriterListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); + dwQos, + DDS::DataWriterListener::_nil(), + OpenDDS::DCPS::DEFAULT_STATUS_MASK); + + + // Check if datawriter was created if(CORBA::is_nil(dw.in())){ - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::initializeDataWriter", (LM_ERROR, - "Create datawriter failed")); + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Create datawriter failed."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } } int DDSPublisher::createPublisher() { - ACS_TRACE("DDSPublisher::createPublisher"); - if(partitionName==NULL){ - pub = participant->create_publisher(PUBLISHER_QOS_DEFAULT, - DDS::PublisherListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::createPublisher", (LM_INFO, - "Creating Publisher with default QoS")); - } + ACS_TRACE(__PRETTY_FUNCTION__); - else{ - pub = participant->create_publisher(pubQos, - DDS::PublisherListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::createPublisher", (LM_INFO, - "Creating Publisher with partition %s ",partitionName)); - } + stringstream msg; + msg << "Creating Publisher with partition: " + << m_partitionName; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + + // get_publisher + // It not implements topic name + DDS::ReturnCode_t retcode; + participant->get_default_publisher_qos(pubQos); + retcode = m_cdbprops_p->get_publisher_qos(pubQos, + m_qosProfileName.c_str()); - if(CORBA::is_nil(pub.in())){ - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::createPublisher", (LM_ERROR, - "Create Publisher failed")); - return 1; - } + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Publisher QoS not found for profile <" + << m_qosProfileName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + participant->get_default_publisher_qos(pubQos); + // Create publisher + pub = participant->create_publisher(pubQos, + DDS::PublisherListener::_nil(), + OpenDDS::DCPS::DEFAULT_STATUS_MASK); - pub_impl= dynamic_cast(pub.in()); - if(pub_impl == NULL){ - ACS_STATIC_LOG(LM_FULL_INFO, "DDSPublisher::createPublisher", (LM_ERROR, - "Failed to obtain publisher servant")); - return 1; + // Check if publisher was created + if(CORBA::is_nil(pub.in())) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Create publisher failed."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } + return 0; } diff --git a/LGPL/CommonSoftware/acsncdds/src/DDSSubscriberImpl.cpp b/LGPL/CommonSoftware/acsncdds/src/DDSSubscriberImpl.cpp index c2782756..8de4f7d1 100644 --- a/LGPL/CommonSoftware/acsncdds/src/DDSSubscriberImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/src/DDSSubscriberImpl.cpp @@ -1,45 +1,112 @@ #include +#include #include +#include using namespace ddsnc; -DDSSubscriber::DDSSubscriber(CORBA::String_var channel_name): - DDSHelper(channel_name) +DDSSubscriber::DDSSubscriber(CORBA::String_var channel_name, CORBA::String_var qosProfile, DDS::DomainId_t id): + DDSHelper(channel_name, qosProfile, id) { } -int DDSSubscriber::createSubscriber() +void DDSSubscriber::createSubscriber() { - ACS_TRACE("DDSSubscriber::createSubscriber"); - if(partitionName==NULL){ - sub=participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, - DDS::SubscriberListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); - ACS_STATIC_LOG(LM_FULL_INFO, "DDSSubscriber::createSubscriber", (LM_INFO, - "Creating Subscriber with default Qos")); - } + ACS_TRACE(__PRETTY_FUNCTION__); - else{ - sub = participant->create_subscriber(subQos, - DDS::SubscriberListener::_nil(), - OpenDDS::DCPS::DEFAULT_STATUS_MASK); - ACS_STATIC_LOG(LM_FULL_INFO, "DDSSubscriber::createSubscriber", (LM_INFO, - "Creating Subscriber with partition: '%s'",partitionName)); - } + stringstream msg; + msg << "Creating Subscriber with partition: " + << m_partitionName; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + + // Check if there is subscriber QoS in CDB + DDS::ReturnCode_t retcode; + participant->get_default_subscriber_qos(subQos); + retcode = m_cdbprops_p->get_subscriber_qos(subQos,m_qosProfileName.c_str()); + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Subscriber QoS not found for profile <" + << m_qosProfileName << "> and topic. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + participant->get_default_subscriber_qos(subQos); - if ((CORBA::is_nil (sub.in ()))) { - ACS_STATIC_LOG(LM_FULL_INFO, "DDSSubscriber::createSubscriber", (LM_ERROR, - "create_subscriber failed")); - return 1; + // Create subscriber + sub = participant->create_subscriber(subQos, + DDS::SubscriberListener::_nil(), + OpenDDS::DCPS::DEFAULT_STATUS_MASK); + + // Check if subscriber was created + if(CORBA::is_nil(sub.in())) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Create subscriber failed."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } - sub_impl=dynamic_cast(sub.in()); - if (0 == sub_impl) { - ACS_STATIC_LOG(LM_FULL_INFO, "DDSSubscriber::createSubscriber", (LM_ERROR, - "Failed to obtain publisher servant")); - return 1; +} + +void DDSSubscriber::initializeDataReader() +{ + ACS_TRACE(__PRETTY_FUNCTION__); + + LOG_TO_DEVELOPER(LM_INFO, ("Initializing datareader")); + + OpenDDS::DCPS::SubscriberImpl * subImpl = dynamic_cast(sub.in()); + if (subImpl == 0) + { + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Failed to obtain subscriber servant."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); + } + + // Check if there is a datareader qos in CDB + // It not implement opinc name in qos get method + DDS::ReturnCode_t retcode; + subImpl->get_default_datareader_qos(drQos); + retcode = m_cdbprops_p->get_datareader_qos(drQos, + m_qosProfileName.c_str(), + 0); + if (retcode != DDS::RETCODE_OK) + { + stringstream msg; + msg << "Datareader QoS not found for profile <" + << m_qosProfileName << "> and topic <" + << m_topicName << ">. Using default QoS."; + LOG_TO_DEVELOPER(LM_INFO, msg.str()); + } + + subImpl->get_default_datareader_qos(drQos); + // Create datareader + dr = sub->create_datareader(topic.in(), + drQos, + DDS::DataReaderListener::_nil(), + OpenDDS::DCPS::DEFAULT_STATUS_MASK); + + + // Check if datawriter was created + if(CORBA::is_nil(dr.in())){ + ACSErrTypeCommon::GenericErrorExImpl ex(__FILE__, + __LINE__, + __PRETTY_FUNCTION__ + ); + std::string msg = "Create datareader failed."; + ex.setErrorDesc(msg.c_str()); + ex.log(); + throw ex.getGenericErrorEx(); } - return 0; } void DDSSubscriber::consumerReady() @@ -47,7 +114,7 @@ void DDSSubscriber::consumerReady() ACS_TRACE("DDSSubscriber::consumerReady"); DDS::DataReader_var dr = sub->create_datareader(topic.in(), - drQos, listener->in(), OpenDDS::DCPS::DEFAULT_STATUS_MASK); + drQos, listener.in(), OpenDDS::DCPS::DEFAULT_STATUS_MASK); if(CORBA::is_nil(dr.in())){ ACS_STATIC_LOG(LM_FULL_INFO, "DDSSubscriber::consumerReady", (LM_ERROR, "create_datareader failed")); diff --git a/LGPL/CommonSoftware/acsncdds/src/DataReaderListenerImpl.cpp b/LGPL/CommonSoftware/acsncdds/src/DataReaderListenerImpl.cpp index 2f8eeb7c..28c6e59d 100644 --- a/LGPL/CommonSoftware/acsncdds/src/DataReaderListenerImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/src/DataReaderListenerImpl.cpp @@ -18,7 +18,6 @@ DataReaderListenerImpl::~DataReaderListenerImpl () void DataReaderListenerImpl::on_requested_deadline_missed ( DDS::DataReader_ptr, const DDS::RequestedDeadlineMissedStatus &) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_requested_deadline_missed"); } @@ -26,7 +25,6 @@ void DataReaderListenerImpl::on_requested_deadline_missed ( void DataReaderListenerImpl::on_requested_incompatible_qos ( DDS::DataReader_ptr, const DDS::RequestedIncompatibleQosStatus &) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_requested_incompatible_qos"); @@ -35,7 +33,6 @@ void DataReaderListenerImpl::on_requested_incompatible_qos ( void DataReaderListenerImpl::on_liveliness_changed ( DDS::DataReader_ptr, const DDS::LivelinessChangedStatus &) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_liveliness_changed"); } @@ -43,7 +40,6 @@ void DataReaderListenerImpl::on_liveliness_changed ( void DataReaderListenerImpl::on_subscription_matched ( DDS::DataReader_ptr, const DDS::SubscriptionMatchedStatus &) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_subscription_matched"); } @@ -51,7 +47,6 @@ void DataReaderListenerImpl::on_subscription_matched ( void DataReaderListenerImpl::on_sample_rejected( DDS::DataReader_ptr, const DDS::SampleRejectedStatus&) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_sample_rejected"); } @@ -59,14 +54,12 @@ void DataReaderListenerImpl::on_sample_rejected( void DataReaderListenerImpl::on_sample_lost( DDS::DataReader_ptr, const DDS::SampleLostStatus&) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_sample_lost"); } void DataReaderListenerImpl::on_data_available( DDS::DataReader_ptr reader) - throw (CORBA::SystemException) { ACS_TRACE("DataReaderListenerImpl::on_data_available"); } diff --git a/LGPL/CommonSoftware/acsncdds/src/Makefile b/LGPL/CommonSoftware/acsncdds/src/Makefile index 5612dcf2..9df7319b 100644 --- a/LGPL/CommonSoftware/acsncdds/src/Makefile +++ b/LGPL/CommonSoftware/acsncdds/src/Makefile @@ -18,7 +18,7 @@ # # user definable C-compilation flags -# USER_CFLAGS = +USER_CFLAGS = -g # # additional include and library search paths @@ -52,7 +52,7 @@ LIBRARIES_L = # # Library that provides all the core functionality of DDS Notification Channel in ACS acsddsnc_OBJECTS = DDSHelperImpl DDSPublisherImpl DDSSubscriberImpl DataReaderListenerImpl acsddsncCDBPropertiesImpl -acsddsnc_LIBS = OpenDDS_Dcps maci +acsddsnc_LIBS = OpenDDS_Dcps OpenDDS_Rtps_Udp OpenDDS_QOS_XML_XSC_Handler maci xerces-c # # Scripts (public and local) diff --git a/LGPL/CommonSoftware/acsncdds/src/acsddsncCDBPropertiesImpl.cpp b/LGPL/CommonSoftware/acsncdds/src/acsddsncCDBPropertiesImpl.cpp index 61eedabe..ddc109ec 100644 --- a/LGPL/CommonSoftware/acsncdds/src/acsddsncCDBPropertiesImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/src/acsddsncCDBPropertiesImpl.cpp @@ -26,211 +26,114 @@ #include "acsddsncCDBProperties.h" #include #include -#include +#include +#include "dds/DCPS/QOS_XML_Handler/XML_File_Intf.h" +#include -static char *rcsId="@(#) $Id: acsddsncCDBPropertiesImpl.cpp,v 1.5 2010/06/15 09:23:02 hsommer Exp $"; +static const char *rcsId="@(#) $Id: acsddsncCDBPropertiesImpl.cpp,v 1.5 2010/06/15 09:23:02 hsommer Exp $"; static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId); namespace ddsnc { - //------------------------------------------------------ - CDB::DAL_ptr + + +CDBProperties::CDBProperties() : OpenDDS::DCPS::QOS_XML_MemBuf_Handler() + { + + } + + CDBProperties::~CDBProperties() + { + + } + //------------------------------------------------------ + CDB::DAL_ptr CDBProperties::getCDB() { - ACE_CString nameService; - ACE_CString managerName; - - managerName = maci::MACIHelper::getManagerHostname(1,NULL); - //get NameService Reference - nameService += acscommon::NAMING_SERVICE_NAME; - nameService +="=corbaloc::"; - nameService += managerName; - nameService += ":"; - nameService += ACSPorts::getNamingServicePort().c_str(); - nameService += "/"; - nameService += acscommon::NAMING_SERVICE_NAME; - - // ORB - int argc = 5; - const char* orbArgs[] = { "", - "-ORBInitRef", - nameService.c_str(), - "-ORBDottedDecimalAddresses", - "1"}; - - CORBA::ORB_var m_orb; - m_orb = CORBA::ORB_init(argc, const_cast(orbArgs), ""); - - ACE_CString cdbLoc; - cdbLoc += "corbaloc::"; - cdbLoc += managerName; - cdbLoc += ":"; - cdbLoc += ACSPorts::getCDBPort().c_str(); - cdbLoc += "/CDB"; - - CDB::DAL_var dalObj = CDB::DAL::_nil(); - CORBA::Object_var obj = m_orb->string_to_object(cdbLoc.rep()); - - if (!CORBA::is_nil(obj.in())) - { - dalObj = CDB::DAL::_narrow(obj.in()); - if (CORBA::is_nil(dalObj.in())) - { - ACS_STATIC_LOG(LM_FULL_INFO, " CDBProperties::getCDB", (LM_ERROR, - "Failed to narrow CDB.")); - } - } - - return dalObj._retn(); + ACE_CString nameService; + ACE_CString managerName; + + managerName = maci::MACIHelper::getManagerHostname(1,NULL); + //get NameService Reference + nameService += acscommon::NAMING_SERVICE_NAME; + nameService +="=corbaloc::"; + nameService += managerName; + nameService += ":"; + nameService += ACSPorts::getNamingServicePort().c_str(); + nameService += "/"; + nameService += acscommon::NAMING_SERVICE_NAME; + + // ORB + int argc = 5; + const char* orbArgs[] = { "", + "-ORBInitRef", + nameService.c_str(), + "-ORBDottedDecimalAddresses", + "1"}; + + CORBA::ORB_var m_orb; + m_orb = CORBA::ORB_init(argc, const_cast(orbArgs), ""); + + ACE_CString cdbLoc; + cdbLoc += "corbaloc::"; + cdbLoc += managerName; + cdbLoc += ":"; + cdbLoc += ACSPorts::getCDBPort().c_str(); + cdbLoc += "/CDB"; + + CDB::DAL_var dalObj = CDB::DAL::_nil(); + CORBA::Object_var obj = m_orb->string_to_object(cdbLoc.rep()); + + if (!CORBA::is_nil(obj.in())) + { + dalObj = CDB::DAL::_narrow(obj.in()); + if (CORBA::is_nil(dalObj.in())) + { + ACS_STATIC_LOG(LM_FULL_INFO, " CDBProperties::getCDB", (LM_ERROR, + "Failed to narrow CDB.")); + } + } + + return dalObj._retn(); } - //------------------------------------------------------ - bool - CDBProperties::cdbChannelConfigExists(CORBA::String_var channelName) + + void CDBProperties::parseConfig(CORBA::String_var channelName) + { + + //Complete name of the channel within the CDB + std::string tmpChannelName(channelName); + std::string cdbChannelName = "MACI/Channels/" + tmpChannelName; + + std::stringstream msg; + msg << "Accessing configuration from channel name: " + << cdbChannelName; + STATIC_LOG_TO_DEVELOPER( LM_DEBUG, (msg.str())); + + CDB::DAL_var cdbRef = getCDB(); + if (CORBA::is_nil(cdbRef.in())) { - //complete name of the channel within the CDB - std::string tmpChannelName(channelName._retn()); - std::string cdbChannelName = "MACI/Channels/" + tmpChannelName; - - //delegate obtaining a reference to the CDB - CDB::DAL_var cdbRef = getCDB(); - - - //sanity check - if(cdbRef.in()==0) - { - ACS_STATIC_LOG(LM_FULL_INFO, "CDBProperties::cdbChannelConfigExists", (LM_ERROR, - "CDB ref null.")); - return false; - } - - //try reading the entry from the CDB - try - { - char *joe = 0; - joe = cdbRef->get_DAO(cdbChannelName.c_str()); - - //if the pointer is not null - if (joe!=0) - { - //it's probably OK - return true; - } - else + STATIC_LOG_TO_DEVELOPER( LM_INFO, "Cannot access CDB. It will use default qos"); + return; + } + + std::string xmlNode; + xmlNode += cdbRef->get_DAO(cdbChannelName.c_str()); + + // Add default paths to search XML schemas + add_search_path("DDS_ROOT","/docs/schema/"); + add_search_path("PWD","/../config/CDB/schemas/"); + add_search_path("ACSROOT","/config/CDB/schemas/"); + add_search_path("INTROOT","/config/CDB/schemas/"); + + // Parse the XML content from channel + STATIC_LOG_TO_DEVELOPER( LM_INFO, ("Parsing qos configuration from CDB")); + DDS::ReturnCode_t retcode; + retcode = init(ACE_TEXT_CHAR_TO_TCHAR(xmlNode.c_str())); + if ( retcode != DDS::RETCODE_OK) { - //something went wrong! - return false; + STATIC_LOG_TO_DEVELOPER( LM_INFO, ("Error Parsing configuration")); } - } - //DAL throws exceptions if the entry being searched for does not - //exist - catch(...) - { - ACS_STATIC_LOG(LM_FULL_INFO, "CDBProperties::cdbChannelConfigExists", (LM_INFO, - "No CDB entry found for '%s' channel. OK.", - cdbChannelName.c_str())); - return false; - } - } - //------------------------------------------------------ - DDS::QosPolicyCountSeq - CDBProperties::getCDBQoSProps(CORBA::String_var channelName) - { - DDS::QosPolicyCountSeq retVal; - retVal.length(0); - - //sanity check - if (cdbChannelConfigExists(channelName)==false) - { - return retVal; - } - //CDB - //complete name of the channel within the CDB - std::string tmpChannelName(channelName._retn()); - std::string cdbChannelName = "MACI/Channels/" + tmpChannelName; - CDB::DAL_var cdbRef = getCDB(); - CDB::DAO_var tempDAO = cdbRef->get_DAO_Servant(cdbChannelName.c_str()); - - //property - const char *name_p; - //temporary counter - unsigned int i = 0U; - - - //Transport Priority///////////////////////////////////////////////////// - { - //name_p = DDS::TRANSPORTPRIORITY_QOS_POLICY_NAME; - name_p = "Priority"; - //allocate one extra element - i++; - retVal.length(i); - retVal[i-1].policy_id = DDS::TRANSPORTPRIORITY_QOS_POLICY_ID; - retVal[i-1].count <<= static_cast(tempDAO->get_long(name_p)); - } - //Timeout////////////////////////////////////////////////////// - { - //name_p = CosNotification::Timeout; - name_p = "Timeout"; - //This is a simpleTCP ! - //allocate one extra element - i++; - retVal.length(i); - retVal[i-1].policy_id = 30; - retVal[i-1].count <<= static_cast(tempDAO->get_long(name_p)); - } - - //OrderPolicy/////////////////////////////////////////////// - { - name_p = "OrderPolicy"; - //allocate one extra element - i++; - retVal.length(i); - retVal[i-1].policy_id = DDS::DESTINATIONORDER_QOS_POLICY_ID; - std::string tStringOP = tempDAO->get_string(name_p); - if(tStringOP=="AnyOrder") - { - retVal[i-1].count <<= 0; - } - else if(tStringOP=="FifoOrder") - { - retVal[i-1].count <<= 0; - } - else if(tStringOP=="PriorityOrder") - { - retVal[i-1].count <<= 1; - } - else if(tStringOP=="DeadlineOrder") - { - retVal[i-1].count <<= 1; - } - else - { - //DWF-throw exception - } - } - //MaxQueueLength - TAO 1.1 had a queque of ~5 events. TAO 1.3 allows an - // infinite amount of events to be stored. 20 seems like - // a reasonable default. - { - name_p = "MaxQueueLength"; - //allocate one extra element - i++; - retVal.length(i); - retVal[i-1].policy_id = DDS::HISTORY_QOS_POLICY_ID; - retVal[i-1].count <<= tempDAO->get_long(name_p); - // 0 is not valid, the integer must be > 1 - if( retVal[i-1].count == 0) - retVal[i-1].count += 2; - if( retVal[i-1].count == 1) - retVal[i-1].count += 1; - } - - //for debugging purposes only - std::string debugMessage = "Length=" + retVal.length(); - STATIC_LOG(Logging::BaseLog::LM_DEBUG, - "ddsnc::CDBProperties::getCDBQoSProps", - debugMessage); - - return retVal; - } + } + } diff --git a/LGPL/CommonSoftware/acsncdds/src/startDCPSInfoRepo b/LGPL/CommonSoftware/acsncdds/src/startDCPSInfoRepo index 098316dd..9f90a1da 100755 --- a/LGPL/CommonSoftware/acsncdds/src/startDCPSInfoRepo +++ b/LGPL/CommonSoftware/acsncdds/src/startDCPSInfoRepo @@ -10,11 +10,9 @@ fi CONFIG_DIR="$TMP_DIR/conf" IORS_DIR="$TMP_DIR/iors" -PROTO_CONFIG_FILE="$CONFIG_DIR/DCPS_tcp.conf" DOMAIN_IDS_FILE="$CONFIG_DIR/DCPS_domainIds" IOR_FILE="$IORS_DIR/DCPSInfoRepositoryIOR" -echo "static DCPS_SimpleTcpLoader \"-type SimpleTcp\"" > $PROTO_CONFIG_FILE echo -e "410\n411\n412\n413\n414\n415\n416\n417\n418\n419" > $DOMAIN_IDS_FILE -$DDS_ROOT/bin/DCPSInfoRepo -ORBEndpoint iiop://:3999 -ORBSvcConf $PROTO_CONFIG_FILE -o $IOR_FILE -d $DOMAIN_IDS_FILE +$DDS_ROOT/bin/DCPSInfoRepo -ORBDebugLevel 10 -ORBLogFile $ACS_TMP/DCPSInfoRepo.log -ORBEndpoint iiop://:3999 -o $IOR_FILE -d $DOMAIN_IDS_FILE diff --git a/LGPL/CommonSoftware/acsncdds/test/DDSNCBenchmarkImpl.cpp b/LGPL/CommonSoftware/acsncdds/test/DDSNCBenchmarkImpl.cpp index 4ed0888c..a02e4154 100644 --- a/LGPL/CommonSoftware/acsncdds/test/DDSNCBenchmarkImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/DDSNCBenchmarkImpl.cpp @@ -3,7 +3,7 @@ #include #include #include "DDSNCBenchmarkImpl.h" -#include "MessageTypeSupportImpl.h" +#include "NCBenchmarkTypeSupportImpl.h" DDSNCBenchmarkSupplierImpl::DDSNCBenchmarkSupplierImpl(const ACE_CString &name, maci::ContainerServices *containerServices) : @@ -18,8 +18,8 @@ void DDSNCBenchmarkSupplierImpl::runTest(::CORBA::ULong freq, ACS_TRACE("DDSNCBenchmarkSupplierImpl::runTest"); // ACS_NEW_DDS_PUBLISHER(pub_p, NC_BENCHMARK::Message, // NC_BENCHMARK::CHANNEL_NAME); - ddsnc::DDSPublisher *pub_p = - new ddsnc::DDSPublisher(NC_BENCHMARK::CHANNEL_NAME); +// + pub_p = new ddsnc::DDSPublisher(NC_BENCHMARK::CHANNEL_NAME, "profileTest", NC_BENCHMARK::DOMAIN_ID); struct timeval time; NC_BENCHMARK::Message m; @@ -36,18 +36,19 @@ void DDSNCBenchmarkSupplierImpl::runTest(::CORBA::ULong freq, sleep(5); pub_p->disconnect(); - delete pub_p; +// delete pub_p; } DDSNCBenchmarkSupplierImpl::~DDSNCBenchmarkSupplierImpl() { + delete pub_p; } void DDSNCBenchmarkSupplierImpl::cleanUp() { - ddsnc::DDSHelper::cleanUp(); +// ddsnc::DDSHelper::cleanUp(); } diff --git a/LGPL/CommonSoftware/acsncdds/test/Makefile b/LGPL/CommonSoftware/acsncdds/test/Makefile index 22d5b675..167b28e8 100644 --- a/LGPL/CommonSoftware/acsncdds/test/Makefile +++ b/LGPL/CommonSoftware/acsncdds/test/Makefile @@ -34,7 +34,7 @@ # # user definable C-compilation flags -# USER_CFLAGS = + USER_CFLAGS = -g # # additional include and library search paths @@ -62,8 +62,7 @@ USER_LIB = -lACE \ -lloki \ -lACSErrTypeCommon \ -lacsnc \ - -lOpenDDS_Dcps \ - -lSimpleTcp + -lOpenDDS_Dcps # # MODULE CODE DESCRIPTION: @@ -74,12 +73,12 @@ USER_LIB = -lACE \ # # C programs (public and local) # ----------------------------- -EXECUTABLES_L = simpleExampleNCClient simpleExampleDDSClient ncConsumer ddsSubscriber ncSlowConsumer ddsSlowSubscriber +EXECUTABLES_L = simpleExampleNCClient simpleExampleDDSClient ncConsumer ddsPublisher ddsSubscriber ncSlowConsumer ddsSlowSubscriber simpleExampleDDSClient_OBJECTS = simpleExampleDDSClient simpleExampleDDSClient_LDFLAGS = simpleExampleDDSClient_LIBS = acsddsnc maciClient \ - SimpleExampleStubs simpleMessageTypeSupportStubs \ + SimpleExampleStubs SimpleExampleTypeSupportStubs \ acsddsncTypeSupport simpleExampleNCClient_OBJECTS = simpleExampleNCClient @@ -90,9 +89,13 @@ ncConsumer_OBJECTS = ncConsumer ncConsumer_LDFLAGS = ncConsumer_LIBS = acsnc maciClient NCBenchmarkStubs +ddsPublisher_OBJECTS = ddsPublisher +ddsPublisher_LDFLAGS = +ddsPublisher_LIBS = acsddsnc NCBenchmarkStubs NCBenchmarkTypeSupportStubs acsddsncTypeSupport + ddsSubscriber_OBJECTS = ddsSubscriber ddsSubscriber_LDFLAGS = -ddsSubscriber_LIBS = acsddsnc NCBenchmarkStubs MessageTypeSupportStubs acsddsncTypeSupport +ddsSubscriber_LIBS = acsddsnc NCBenchmarkStubs NCBenchmarkTypeSupportStubs acsddsncTypeSupport ncSlowConsumer_OBJECTS = ncSlowConsumer ncSlowConsumer_LDFLAGS = @@ -100,7 +103,7 @@ ncSlowConsumer_LIBS = acsnc maciClient NCBenchmarkStubs ddsSlowSubscriber_OBJECTS = ddsSlowSubscriber ddsSlowSubscriber_LDFLAGS = -ddsSlowSubscriber_LIBS = acsddsnc NCBenchmarkStubs MessageTypeSupportStubs acsddsncTypeSupport +ddsSlowSubscriber_LIBS = acsddsnc NCBenchmarkStubs NCBenchmarkTypeSupportStubs acsddsncTypeSupport # # Includes (.h) files (public only) @@ -117,7 +120,7 @@ LIBRARIES_L = # # simpleExampleDDSImpl_OBJECTS = simpleExampleDDSImpl -simpleExampleDDSImpl_LIBS = SimpleExampleStubs simpleMessageTypeSupportStubs acsddsncTypeSupport acsddsnc +simpleExampleDDSImpl_LIBS = SimpleExampleStubs SimpleExampleTypeSupportStubs acsddsncTypeSupport acsddsnc # simpleExampleNCImpl_OBJECTS = simpleExampleNCImpl @@ -126,17 +129,17 @@ simpleExampleNCImpl_LIBS = SimpleExampleStubs acsnc # # NCBenchmarkImpl_OBJECTS = NCBenchmarkImpl -NCBenchmarkImpl_LIBS = NCBenchmarkStubs MessageTypeSupportStubs acsnc +NCBenchmarkImpl_LIBS = NCBenchmarkStubs NCBenchmarkTypeSupportStubs acsnc DDSNCBenchmarkImpl_OBJECTS = DDSNCBenchmarkImpl -DDSNCBenchmarkImpl_LIBS = NCBenchmarkStubs MessageTypeSupportStubs acsddsncTypeSupport acsddsnc +DDSNCBenchmarkImpl_LIBS = NCBenchmarkStubs NCBenchmarkTypeSupportStubs acsddsncTypeSupport acsddsnc testCDBProps_OBJECTS = testCDBProps testCDBProps_LIBS = acsddsnc acscomponent CDBPropsStubs # # -acsddsncTypeSupport_OBJECTS = $(DDS_TYPE_FILES) +#acsddsncTypeSupport_OBJECTS = $(DDS_TYPE_FILES) acsddsncTypeSupport_LIBS = NCBenchmarkStubs SimpleExampleStubs # diff --git a/LGPL/CommonSoftware/acsncdds/test/TATEpilogue b/LGPL/CommonSoftware/acsncdds/test/TATEpilogue index 2e5341de..6692cd64 100644 --- a/LGPL/CommonSoftware/acsncdds/test/TATEpilogue +++ b/LGPL/CommonSoftware/acsncdds/test/TATEpilogue @@ -5,7 +5,7 @@ acsStopContainer Container & # Killing the DCPSInfoRepo -kill -9 $(ps aux | grep /DCPSInfoRepo | head -1| awk '{print $2}') & +#kill -9 $(ps aux | grep /DCPSInfoRepo | head -1| awk '{print $2}') & acsutilTATEpilogue diff --git a/LGPL/CommonSoftware/acsncdds/test/TATPrologue b/LGPL/CommonSoftware/acsncdds/test/TATPrologue index 8d248fd2..0b5236ab 100644 --- a/LGPL/CommonSoftware/acsncdds/test/TATPrologue +++ b/LGPL/CommonSoftware/acsncdds/test/TATPrologue @@ -22,7 +22,7 @@ acsutilTATPrologue ### export DDS_TYPE=OPEN_DDS ### export ACS_CDB=$PWD -startDCPSInfoRepo &> $ACS_TMP/InfoRepo.log & -sleep 2 +#startDCPSInfoRepo &> $ACS_TMP/InfoRepo.log & +#sleep 2 acsStartContainer -cpp Container &> $ACS_TMP/container.log & sleep 5 diff --git a/LGPL/CommonSoftware/acsncdds/test/ddsPublisher.cpp b/LGPL/CommonSoftware/acsncdds/test/ddsPublisher.cpp index 545a1115..d46ae8da 100644 --- a/LGPL/CommonSoftware/acsncdds/test/ddsPublisher.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/ddsPublisher.cpp @@ -1,24 +1,19 @@ #include #include -#include "MessageTypeSupportImpl.h" +#include "NCBenchmarkTypeSupportImpl.h" int main(int argc, char **argv) { - ddsnc::DDSPublisher *pub = 0; - pub = new ddsnc::DDSPublisher - (NC_BENCHMARK::CHANNEL_NAME); + ddsnc::DDSPublisher * pub = new ddsnc::DDSPublisher(NC_BENCHMARK::CHANNEL_NAME, "profileTest",NC_BENCHMARK::DOMAIN_ID); struct timeval time; NC_BENCHMARK::Message m; - for(int i=0;i<100;i++){ + for(int i=0;i<10;i++){ m.seqnum=i; gettimeofday(&time,NULL); m.time= (long long)time.tv_sec*1000000L + time.tv_usec; - pub->publishData(m); + PUBLISH_DATA(pub, NC_BENCHMARK::Message,m); sleep(1); } diff --git a/LGPL/CommonSoftware/acsncdds/test/ddsSlowSubscriber.cpp b/LGPL/CommonSoftware/acsncdds/test/ddsSlowSubscriber.cpp index 7b7458f3..ceceaf0b 100644 --- a/LGPL/CommonSoftware/acsncdds/test/ddsSlowSubscriber.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/ddsSlowSubscriber.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include void handlerFunction(NC_BENCHMARK::Message m, void *other) { @@ -21,8 +21,8 @@ int main(int argc, char**argv) ddsnc::DDSSubscriber *sub_p; - ACS_NEW_DDS_SUBSCRIBER(sub_p, NC_BENCHMARK::Message, - NC_BENCHMARK::CHANNEL_NAME, &handlerFunction, (void *)0); + ACS_NEW_DDS_SUBSCRIBER(sub_p, NC_BENCHMARK::Message,NC_BENCHMARK::DOMAIN_ID, + NC_BENCHMARK::CHANNEL_NAME, "profileTest", &handlerFunction, (void *)0); sub_p->consumerReady(); sleep(200); diff --git a/LGPL/CommonSoftware/acsncdds/test/ddsSubscriber.cpp b/LGPL/CommonSoftware/acsncdds/test/ddsSubscriber.cpp index 68334b99..4093f84c 100644 --- a/LGPL/CommonSoftware/acsncdds/test/ddsSubscriber.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/ddsSubscriber.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include void handlerFunction(NC_BENCHMARK::Message m, void *other) { @@ -20,11 +20,11 @@ int main(int argc, char**argv) ddsnc::DDSSubscriber *sub_p; - ACS_NEW_DDS_SUBSCRIBER(sub_p, NC_BENCHMARK::Message, - NC_BENCHMARK::CHANNEL_NAME, &handlerFunction, (void *)0); + ACS_NEW_DDS_SUBSCRIBER(sub_p, NC_BENCHMARK::Message, DDS::DomainId_t(NC_BENCHMARK::DOMAIN_ID), + NC_BENCHMARK::CHANNEL_NAME, "profileTest", &handlerFunction, (void *)0); sub_p->consumerReady(); - sleep(200); + sleep(30); sub_p->disconnect(); sub_p->cleanUp(); diff --git a/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSClient.cpp b/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSClient.cpp index 898d451e..41c07d52 100644 --- a/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSClient.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSClient.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "simpleMessageTypeSupportImpl.h" +#include int testNum=0; @@ -22,8 +22,8 @@ int main(int argc, char**argv) ddsnc::DDSSubscriber *sub_p=0; - ACS_NEW_DDS_SUBSCRIBER(sub_p, DDS_SIMPLE_EXAMPLE::simpleMessage, - DDS_SIMPLE_EXAMPLE::CHANNEL_NAME, &handlerFunction, (void *)0); + ACS_NEW_DDS_SUBSCRIBER(sub_p, DDS_SIMPLE_EXAMPLE::simpleMessage, DDS_SIMPLE_EXAMPLE::DOMAIN_ID, + DDS_SIMPLE_EXAMPLE::CHANNEL_NAME,"profileTest", &handlerFunction, (void *)0); sub_p->consumerReady(); diff --git a/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSImpl.cpp b/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSImpl.cpp index 8359a8c4..6174086c 100644 --- a/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSImpl.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/simpleExampleDDSImpl.cpp @@ -3,7 +3,7 @@ #include #include #include "simpleExampleDDS.h" -#include "simpleMessageTypeSupportImpl.h" +#include "SimpleExampleTypeSupportImpl.h" SimpleExampleDDSImpl::SimpleExampleDDSImpl(const ACE_CString &name, maci::ContainerServices *containerServices) : @@ -21,7 +21,7 @@ void SimpleExampleDDSImpl::sendMessage() throw (::CORBA::SystemException) // ACS_NEW_DDS_PUBLISHER(pub_p, DDS_SIMPLE_EXAMPLE::simpleMessage, // DDS_SIMPLE_EXAMPLE::CHANNEL_NAME); ddsnc::DDSPublisher *pub_p = - new ddsnc::DDSPublisher(DDS_SIMPLE_EXAMPLE::CHANNEL_NAME); + new ddsnc::DDSPublisher(DDS_SIMPLE_EXAMPLE::CHANNEL_NAME, "profileTest", DDS_SIMPLE_EXAMPLE::DOMAIN_ID); DDS_SIMPLE_EXAMPLE::simpleMessage m; m.seqnum=actual; //m.seqnum=1; diff --git a/LGPL/CommonSoftware/acsncdds/test/testCDBProps.cpp b/LGPL/CommonSoftware/acsncdds/test/testCDBProps.cpp index 3037ef39..9d62456c 100644 --- a/LGPL/CommonSoftware/acsncdds/test/testCDBProps.cpp +++ b/LGPL/CommonSoftware/acsncdds/test/testCDBProps.cpp @@ -43,62 +43,25 @@ CDBPropsCompImpl::runTest() "CDBPropsCompImpl::runTest", "Starting the tests")); - CORBA::Long result = 0; - CORBA::String_var channel = "blar"; - CORBA::String_var notChannel = "NotInCDB"; - - //getCDB - CDB::DAL_var cdb = ddsnc::CDBProperties::getCDB(); - - if (CORBA::is_nil(cdb.in())) - return -1; - //----------------------------------------------- - //cdbChannelConfigExists - bool value; - value = ddsnc::CDBProperties::cdbChannelConfigExists(channel); - if(value) - result += 1; - - value = ddsnc::CDBProperties::cdbChannelConfigExists(notChannel); - if(!value) - result += 1; - //----------------------------------------------- - - // QoS Props - //first try on one that exists in the CDB - DDS::QosPolicyCountSeq tmp; - tmp = ddsnc::CDBProperties::getCDBQoSProps(channel); - ACS_STATIC_SHORT_LOG((LM_INFO, - "CDBPropsCompImpl::runTest", - "getCDBQoSProps with an existent channel")); - unsigned int j=0; - for (unsigned int i=0; i 0) - j += 1; - } - if(j == tmp.length()) - { - result += 1; - } - //next try on one that is not in the CDB - tmp = ddsnc::CDBProperties::getCDBQoSProps(notChannel); - ACS_STATIC_SHORT_LOG((LM_INFO, - "CDBPropsCompImpl::runTest", - "getCDBQoSProps with an nonexistent channel")); - j=0; - for (unsigned int i=0; i 0) - j += 1; - } - if(j == 0) - { - result += 1; - } - //----------------------------------------------- - // fix - return result; + + CORBA::String_var ddsChannelName; + ddsChannelName = CORBA::string_dup("DDSEvent"); + ddsnc::CDBProperties cdbProps; + + + cdbProps.parseConfig(ddsChannelName); + + DDS::DataReaderQos drQos; + + if (cdbProps.get_datareader_qos(drQos,"profileTest","topicTest") == DDS::RETCODE_OK) + { + if( drQos.durability.kind == DDS::VOLATILE_DURABILITY_QOS) + std::cout << "durability.kind =" << "VOLATILE_DURABILITY_QOS" << std::endl; + + } + + + } CDBPropsCompImpl::~CDBPropsCompImpl() -- 2.20.1