diff options
author | Stefan Laner <laner@itestra.de> | 2013-11-27 11:01:23 +0100 |
---|---|---|
committer | Philip Rauwolf <rauwolf@itestra.de> | 2013-11-27 18:11:55 +0100 |
commit | e0af53f2058965dd83a3585b9000f947d9f36cd7 (patch) | |
tree | e7065d89d2c045863af25ebd0a5271ae2c980d83 | |
parent | 8c6ed83e31ac977224da0fd0763c173e16b5f858 (diff) | |
download | genivi-common-api-dbus-runtime-e0af53f2058965dd83a3585b9000f947d9f36cd7.tar.gz |
Merged fix for inherited interfaces and version attribute. Regenerated
code.
Change-Id: I555557d42f1849d6ac517b24b88c974f3d1536ae
77 files changed, 1454 insertions, 1676 deletions
@@ -54,3 +54,4 @@ /DBusClientIdTest /DBusSelectiveBroadcastTest /DBusManagedTest +/DBusPolymorphicTest diff --git a/DBusPolymorphicTest b/DBusPolymorphicTest deleted file mode 100755 index 4b4da2a..0000000 --- a/DBusPolymorphicTest +++ /dev/null @@ -1,228 +0,0 @@ -#! /bin/bash - -# DBusPolymorphicTest - temporary wrapper script for .libs/DBusPolymorphicTest -# Generated by libtool (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1 -# -# The DBusPolymorphicTest program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/laner/git/ascgit017.CommonAPI-D-Bus; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games; export PATH; g++ -pthread -O0 -g -ggdb3 -std=c++0x -o \$progdir/\$file src/test/commonapi/tests/DBusPolymorphicTest-DerivedTypeCollection.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceStubDefault.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceDBusProxy.o src/test/commonapi/tests/DBusPolymorphicTest-TestInterfaceDBusStubAdapter.o src/test/fake/legacy/service/DBusPolymorphicTest-LegacyInterfaceDBusProxy.o src/test/DBusPolymorphicTest-DBusPolymorphicTest.o -pthread /home/laner/git/ascgit017.CommonAPI/.libs/libCommonAPI.so -L/usr/local/lib /usr/local/lib/libdbus-1.so -lpthread -lrt ./.libs/libCommonAPI-DBus.so /home/laner/gtest-1.6.0/lib/.libs/libgtest.so -pthread -Wl,-rpath -Wl,/home/laner/git/ascgit017.CommonAPI/.libs -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/home/laner/git/ascgit017.CommonAPI-D-Bus/.libs -Wl,-rpath -Wl,/home/laner/gtest-1.6.0/lib/.libs -Wl,-rpath -Wl,/usr/local/lib)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4.2' - notinst_deplibs=' /home/laner/git/ascgit017.CommonAPI/libCommonAPI.la libCommonAPI-DBus.la /home/laner/gtest-1.6.0/lib/libgtest.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ./libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: libtool wrapper (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu1" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "DBusPolymorphicTest:DBusPolymorphicTest:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case " $* " in - *\ --lt-*) - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done ;; - esac - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'DBusPolymorphicTest' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/src/CommonAPI/DBus/DBusStubAdapterHelper.h b/src/CommonAPI/DBus/DBusStubAdapterHelper.h index aa7f2db..7030637 100644 --- a/src/CommonAPI/DBus/DBusStubAdapterHelper.h +++ b/src/CommonAPI/DBus/DBusStubAdapterHelper.h @@ -75,10 +75,6 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter { stub_.reset(); } - inline void setRemoteEventHandler(RemoteEventHandlerType* remoteEventHandler) { - remoteEventHandler_ = remoteEventHandler; - } - inline RemoteEventHandlerType* getRemoteEventHandler() { return remoteEventHandler_; } diff --git a/src/test/DBusPolymorphicTest.cpp b/src/test/DBusPolymorphicTest.cpp index 62d6115..79a1bb6 100644 --- a/src/test/DBusPolymorphicTest.cpp +++ b/src/test/DBusPolymorphicTest.cpp @@ -239,7 +239,7 @@ TEST_F(PolymorphicTest, SendStructWithPolymorphicMember) { ASSERT_EQ(testStub->numberOfContainedElements_, 1); ASSERT_TRUE(testStub->firstElementIsExtended_); } -/* + TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) { CommonAPI::CallStatus stat; commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap inputStruct; @@ -249,7 +249,7 @@ TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) { ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS); } -*/ + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); diff --git a/src/test/DBusProxyTest.cpp b/src/test/DBusProxyTest.cpp index a966fe2..0a27459 100644 --- a/src/test/DBusProxyTest.cpp +++ b/src/test/DBusProxyTest.cpp @@ -60,6 +60,9 @@ protected: void SetUp() { + isTestStubAdapterRegistered_ = false; + isExtendedStubAdapterRegistered_ = false; + runtime_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusRuntime>(CommonAPI::Runtime::load()); serviceFactory_ = std::dynamic_pointer_cast<CommonAPI::DBus::DBusFactory>(runtime_->createFactory()); @@ -81,13 +84,19 @@ protected: std::shared_ptr<CommonAPI::DBus::DBusFactory> serviceFactory_; virtual void TearDown() { - usleep(30000); + if(isTestStubAdapterRegistered_) { + deregisterTestStub(); + } + if(isExtendedStubAdapterRegistered_) { + deregisterExtendedStub(); + } + usleep(300000); } void registerTestStub() { stubDefault_ = std::make_shared<commonapi::tests::TestInterfaceStubDefault>(); - const bool isStubAdapterRegistered = runtime_->getServicePublisher()->registerService<commonapi::tests::TestInterfaceStub>(stubDefault_, commonApiAddress, serviceFactory_); - ASSERT_TRUE(isStubAdapterRegistered); + isTestStubAdapterRegistered_ = runtime_->getServicePublisher()->registerService<commonapi::tests::TestInterfaceStub>(stubDefault_, commonApiAddress, serviceFactory_); + ASSERT_TRUE(isTestStubAdapterRegistered_); usleep(500000); } @@ -95,8 +104,8 @@ protected: void registerExtendedStub() { stubExtended_ = std::make_shared<commonapi::tests::ExtendedInterfaceStubDefault>(); - const bool isStubAdapterRegistered = runtime_->getServicePublisher()->registerService<commonapi::tests::ExtendedInterfaceStub>(stubExtended_, commonApiAddressExtended, serviceFactory_); - ASSERT_TRUE(isStubAdapterRegistered); + isExtendedStubAdapterRegistered_ = runtime_->getServicePublisher()->registerService<commonapi::tests::ExtendedInterfaceStub>(stubExtended_, commonApiAddressExtended, serviceFactory_); + ASSERT_TRUE(isExtendedStubAdapterRegistered_); usleep(500000); } @@ -106,6 +115,7 @@ protected: commonApiAddress); ASSERT_TRUE(isStubAdapterUnregistered); stubDefault_.reset(); + isTestStubAdapterRegistered_ = false; } void deregisterExtendedStub() { @@ -113,6 +123,7 @@ protected: commonApiAddressExtended); ASSERT_TRUE(isStubAdapterUnregistered); stubExtended_.reset(); + isExtendedStubAdapterRegistered_ = false; } void proxyRegisterForAvailabilityStatus() { @@ -125,19 +136,23 @@ protected: } void proxyDeregisterForAvailabilityStatus() { - proxy_->getProxyStatusEvent().unsubscribe(proxyStatusSubscription_); + proxy_->getProxyStatusEvent().unsubscribe(proxyStatusSubscription_); } bool proxyWaitForAvailabilityStatus(const CommonAPI::AvailabilityStatus& availabilityStatus) const { for (int i = 0; i < 10; i++) { - if (proxyAvailabilityStatus_ == availabilityStatus) + if (proxyAvailabilityStatus_ == availabilityStatus) { return true; + } usleep(200000); } return false; } + bool isExtendedStubAdapterRegistered_; + bool isTestStubAdapterRegistered_; + std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_; std::shared_ptr<commonapi::tests::TestInterfaceDBusProxy> proxy_; CommonAPI::AvailabilityStatus proxyAvailabilityStatus_; @@ -250,7 +265,7 @@ TEST_F(ProxyTest, isServiceInstanceAlive) { EXPECT_TRUE(isInstanceAlive); - deregisterTestStub(); + //deregisterTestStub(); } TEST_F(ProxyTest, IsAvailableBlocking) { @@ -263,7 +278,7 @@ TEST_F(ProxyTest, IsAvailableBlocking) { EXPECT_TRUE(proxy_->isAvailableBlocking()); - deregisterTestStub(); + //deregisterTestStub(); } TEST_F(ProxyTest, HasNecessaryAttributesAndEvents) { @@ -302,10 +317,8 @@ TEST_F(ProxyTest, CallMethodFromExtendedInterface) { auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended); // give the proxy time to become available - for(int i=0; i<20; i++) { - if(!extendedProxy->isAvailable()) { - usleep(100000); - } + for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 500; ++i) { + usleep(2 * 1000); } ASSERT_TRUE(extendedProxy->isAvailable()); @@ -318,11 +331,11 @@ TEST_F(ProxyTest, CallMethodFromExtendedInterface) { ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); wasCalled = true; }); - usleep(200000); + usleep(500000); ASSERT_TRUE(wasCalled); - deregisterExtendedStub(); - usleep(500000); + //deregisterExtendedStub(); + //usleep(500000); } TEST_F(ProxyTest, CallMethodFromParentInterface) { @@ -330,7 +343,9 @@ TEST_F(ProxyTest, CallMethodFromParentInterface) { auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::ExtendedInterfaceProxy>(commonApiAddressExtended); - usleep(800000); // give the proxy time to become available + for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 500; ++i) { + usleep(2 * 1000); + } ASSERT_TRUE(extendedProxy->isAvailable()); bool wasCalled = false; @@ -339,11 +354,39 @@ TEST_F(ProxyTest, CallMethodFromParentInterface) { ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); wasCalled = true; }); - usleep(50000); + for (uint32_t i = 0; !wasCalled && i < 500; ++i) { + usleep(2 * 1000); + } ASSERT_TRUE(wasCalled); +} - deregisterExtendedStub(); - usleep(500000); +TEST_F(ProxyTest, ProxyCanFetchVersionAttributeFromInheritedInterfaceStub) { + registerExtendedStub(); + + auto extendedProxy = serviceFactory_->buildProxy<commonapi::tests::TestInterfaceProxy>(commonApiAddressExtended); + + for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 500; ++i) { + usleep(2 * 1000); + } + ASSERT_TRUE(extendedProxy->isAvailable()); + + + CommonAPI::InterfaceVersionAttribute& versionAttribute = extendedProxy->getInterfaceVersionAttribute(); + + CommonAPI::Version version; + CommonAPI::CallStatus status; + bool wasCalled = false; + + std::future<CommonAPI::CallStatus> futureVersion = versionAttribute.getValueAsync([&](const CommonAPI::CallStatus& callStatus, CommonAPI::Version version) { + ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS); + ASSERT_TRUE(version.Major > 0 || version.Minor > 0); + wasCalled = true; + }); + + futureVersion.wait(); +// usleep(100000); + + ASSERT_TRUE(wasCalled); } int main(int argc, char** argv) { diff --git a/src/test/commonapi/tests/DerivedTypeCollection.cpp b/src/test/commonapi/tests/DerivedTypeCollection.cpp index ff24fa3..1e80e6e 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.cpp +++ b/src/test/commonapi/tests/DerivedTypeCollection.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -169,6 +169,7 @@ void TestExtendedPolymorphicStruct::writeToOutputStream(CommonAPI::OutputStream& outputStream << additionalValue; } + StructWithPolymorphicMember::StructWithPolymorphicMember(const uint32_t& numberValueValue, const std::shared_ptr<TestPolymorphicStruct>& polymorphicMemberValue): numberValue(numberValueValue), polymorphicMember(polymorphicMemberValue) @@ -196,8 +197,7 @@ void StructWithPolymorphicMember::writeToOutputStream(CommonAPI::OutputStream& o outputStream << polymorphicMember; } -StructWithEnumKeyMap::StructWithEnumKeyMap(const uint32_t& numberValueValue, const TestEnumMap& testMapValue): - numberValue(numberValueValue), +StructWithEnumKeyMap::StructWithEnumKeyMap(const TestEnumMap& testMapValue): testMap(testMapValue) { } @@ -208,18 +208,15 @@ bool operator==(const StructWithEnumKeyMap& lhs, const StructWithEnumKeyMap& rhs return true; return - lhs.numberValue == rhs.numberValue && lhs.testMap == rhs.testMap ; } void StructWithEnumKeyMap::readFromInputStream(CommonAPI::InputStream& inputStream) { - inputStream >> numberValue; inputStream >> testMap; } void StructWithEnumKeyMap::writeToOutputStream(CommonAPI::OutputStream& outputStream) const { - outputStream << numberValue; outputStream << testMap; } diff --git a/src/test/commonapi/tests/DerivedTypeCollection.h b/src/test/commonapi/tests/DerivedTypeCollection.h index 6f8d196..25d17ee 100644 --- a/src/test/commonapi/tests/DerivedTypeCollection.h +++ b/src/test/commonapi/tests/DerivedTypeCollection.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -207,18 +207,16 @@ namespace DerivedTypeCollection { } }; struct StructWithEnumKeyMap: CommonAPI::SerializableStruct { - uint32_t numberValue; TestEnumMap testMap; StructWithEnumKeyMap() = default; - StructWithEnumKeyMap(const uint32_t& numberValue, const TestEnumMap& testMap); + StructWithEnumKeyMap(const TestEnumMap& testMap); virtual void readFromInputStream(CommonAPI::InputStream& inputStream); virtual void writeToOutputStream(CommonAPI::OutputStream& outputStream) const; static inline void writeToTypeOutputStream(CommonAPI::TypeOutputStream& typeOutputStream) { - typeOutputStream.writeUInt32Type(); typeOutputStream.beginWriteMapType(); typeOutputStream.writeInt32Type(); typeOutputStream.writeStringType(); diff --git a/src/test/commonapi/tests/ExtendedInterface.h b/src/test/commonapi/tests/ExtendedInterface.h index 0febbfd..be064ba 100644 --- a/src/test/commonapi/tests/ExtendedInterface.h +++ b/src/test/commonapi/tests/ExtendedInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -53,7 +53,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp index 7daf324..18691c8 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -53,7 +53,7 @@ void ExtendedInterfaceDBusProxy::TestIntMethodExtended(const uint32_t& inInt, Co *this, "TestIntMethodExtended", "u", - inInt, + inInt, callStatus ); } diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h index aa6329c..4349339 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,10 +11,8 @@ #define COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_H_ #include <commonapi/tests/ExtendedInterfaceProxyBase.h> - #include <commonapi/tests/TestInterfaceDBusProxy.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class ExtendedInterfaceDBusProxy: virtual public ExtendedInterfaceProxyBase, vir virtual void TestIntMethodExtended(const uint32_t& inInt, CommonAPI::CallStatus& callStatus); virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp index 6a3cb8c..83b7042 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp @@ -1,104 +1,122 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "ExtendedInterfaceDBusStubAdapter.h" - #include <commonapi/tests/ExtendedInterface.h> - - namespace commonapi { - namespace tests { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), - &createExtendedInterfaceDBusStubAdapter); - } - - - - ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - ExtendedInterfaceDBusStubAdapterHelper::deinit(); - ExtendedInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) + - "<method name=\"TestIntMethodExtended\">\n" - "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - ExtendedInterfaceStub, - std::tuple<uint32_t>, - std::tuple<> - > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); - - - - const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - ExtendedInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub), - false), - TestInterfaceDBusStubAdapterInternal( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - stub), - stubDispatcherTable_({ - { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } - }) { - - auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); - stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); - } - - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "ExtendedInterfaceDBusStubAdapter.h" +#include <commonapi/tests/ExtendedInterface.h> + +namespace commonapi { +namespace tests { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<ExtendedInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerExtendedInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(ExtendedInterface::getInterfaceId(), + &createExtendedInterfaceDBusStubAdapter); +} + + + +ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + ExtendedInterfaceDBusStubAdapterHelper::deinit(); + ExtendedInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void ExtendedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + std::string(TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) + + "<method name=\"TestIntMethodExtended\">\n" + "<arg name=\"inInt\" type=\"u\" direction=\"in\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + ExtendedInterfaceStub, + CommonAPI::Version + > getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + ExtendedInterfaceStub, + std::tuple<uint32_t>, + std::tuple<> + > testIntMethodExtendedStubDispatcher(&ExtendedInterfaceStub::TestIntMethodExtended, ""); + + + +const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + ExtendedInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<ExtendedInterfaceStub>(stub), + false), + TestInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub), + stubDispatcherTable_({ + { { "TestIntMethodExtended", "u" }, &commonapi::tests::testIntMethodExtendedStubDispatcher } + }) { + + auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable(); + stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end()); + + auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" }); + if(interfaceVersionGetter != stubDispatcherTable_.end()) { + interfaceVersionGetter->second = &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher; + } else { + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getExtendedInterfaceInterfaceVersionStubDispatcher }); + } +} + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h index a708e03..4765d81 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/ExtendedInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,7 +11,6 @@ #define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_H_ #include <commonapi/tests/ExtendedInterfaceStub.h> - #include <commonapi/tests/TestInterfaceDBusStubAdapter.h> #if !defined (COMMONAPI_INTERNAL_COMPILATION) @@ -44,12 +43,12 @@ class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdap ~ExtendedInterfaceDBusStubAdapterInternal(); - + const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + virtual const std::string getAddress() const { return DBusStubAdapter::getAddress(); } @@ -70,7 +69,6 @@ class ExtendedInterfaceDBusStubAdapterInternal: public ExtendedInterfaceStubAdap return DBusStubAdapter::init(instance); } - virtual void deinit() { return DBusStubAdapter::deinit(); } diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxy.h b/src/test/commonapi/tests/ExtendedInterfaceProxy.h index d2c79a5..161eee4 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceProxy.h +++ b/src/test/commonapi/tests/ExtendedInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -31,9 +31,9 @@ class ExtendedInterfaceProxy: virtual public ExtendedInterface, virtual public E public: ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~ExtendedInterfaceProxy(); - + typedef ExtendedInterface InterfaceType; - + inline static const char* getInterfaceId() { return(ExtendedInterface::getInterfaceId()); } @@ -60,7 +60,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t& inInt, TestIntMethodExtendedAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -173,7 +173,6 @@ CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtension return delegate_->getInterfaceVersionAttribute(); } - } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h index 0cf2e50..a309fb7 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h +++ b/src/test/commonapi/tests/ExtendedInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -11,7 +11,6 @@ #define COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_H_ #include "ExtendedInterface.h" - #include "TestInterfaceProxyBase.h" diff --git a/src/test/commonapi/tests/ExtendedInterfaceStub.h b/src/test/commonapi/tests/ExtendedInterfaceStub.h index a4f96ea..5d2e791 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStub.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,10 +38,9 @@ namespace tests { class ExtendedInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public ExtendedInterface { public: - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -78,16 +77,15 @@ class ExtendedInterfaceStubRemoteEvent { class ExtendedInterfaceStub : public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>, public virtual TestInterfaceStub { public: virtual ~ExtendedInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method TestIntMethodExtended. virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt) = 0; - - + using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace tests diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp index 4c5a179..9561418 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,12 @@ namespace commonapi { namespace tests { ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(ExtendedInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h index 5a0124e..38699b5 100644 --- a/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h +++ b/src/test/commonapi/tests/ExtendedInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> clientId, uint32_t inInt); virtual void TestIntMethodExtended(uint32_t inInt); - + protected: private: @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace tests diff --git a/src/test/commonapi/tests/PredefinedTypeCollection.h b/src/test/commonapi/tests/PredefinedTypeCollection.h index 4e991f2..bc26018 100644 --- a/src/test/commonapi/tests/PredefinedTypeCollection.h +++ b/src/test/commonapi/tests/PredefinedTypeCollection.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * diff --git a/src/test/commonapi/tests/TestInterface.h b/src/test/commonapi/tests/TestInterface.h index 289ec84..6603d3a 100644 --- a/src/test/commonapi/tests/TestInterface.h +++ b/src/test/commonapi/tests/TestInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -52,7 +52,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp index 95169d9..ef1ca6f 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -87,7 +87,7 @@ void TestInterfaceDBusProxy::testVoidPredefinedTypeMethod(const uint32_t& uint32 *this, "testVoidPredefinedTypeMethod", "us", - uint32Value, stringValue, + uint32Value, stringValue, callStatus ); } @@ -106,7 +106,7 @@ void TestInterfaceDBusProxy::testPredefinedTypeMethod(const uint32_t& uint32InVa *this, "testPredefinedTypeMethod", "us", - uint32InValue, stringInValue, + uint32InValue, stringInValue, callStatus , uint32OutValue, stringOutValue); } @@ -125,7 +125,7 @@ void TestInterfaceDBusProxy::testVoidDerivedTypeMethod(const DerivedTypeCollecti *this, "testVoidDerivedTypeMethod", "ia{ua(sq)}", - testEnumExtended2Value, testMapValue, + testEnumExtended2Value, testMapValue, callStatus ); } @@ -144,7 +144,7 @@ void TestInterfaceDBusProxy::testDerivedTypeMethod(const DerivedTypeCollection:: *this, "testDerivedTypeMethod", "ia{ua(sq)}", - testEnumExtended2InValue, testMapInValue, + testEnumExtended2InValue, testMapInValue, callStatus , testEnumExtended2OutValue, testMapOutValue); } @@ -163,7 +163,7 @@ void TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethod(const std::vecto *this, "TestArrayOfPolymorphicStructMethod", "a(uv)", - inArray, + inArray, callStatus ); } @@ -182,7 +182,7 @@ void TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethod(const DerivedTypeC *this, "TestMapOfPolymorphicStructMethod", "a{y(uv)}", - inMap, + inMap, callStatus ); } @@ -201,7 +201,7 @@ void TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethod(const Derived *this, "TestStructWithPolymorphicMemberMethod", "(u(uv))", - inStruct, + inStruct, callStatus ); } @@ -219,8 +219,8 @@ void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const DerivedTypeCol CommonAPI::DBus::DBusSerializableArguments<> >::callMethodWithReply( *this, "TestStructWithEnumKeyMapMember", - "(ua{is})", - inStruct, + "(a{is})", + inStruct, callStatus ); } @@ -229,7 +229,7 @@ std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKey CommonAPI::DBus::DBusSerializableArguments<> >::callMethodAsync( *this, "TestStructWithEnumKeyMapMember", - "(ua{is})", + "(a{is})", inStruct, std::move(callback)); } diff --git a/src/test/commonapi/tests/TestInterfaceDBusProxy.h b/src/test/commonapi/tests/TestInterfaceDBusProxy.h index 01bb38a..0f3b72c 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/TestInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/TestInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -70,7 +68,7 @@ class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual pub virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const DerivedTypeCollection::StructWithPolymorphicMember& inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback callback); virtual void TestStructWithEnumKeyMapMember(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, CommonAPI::CallStatus& callStatus); virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; @@ -82,7 +80,7 @@ class TestInterfaceDBusProxy: virtual public TestInterfaceProxyBase, virtual pub CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent> testPredefinedTypeBroadcast_; CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_; CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent> testBroadcastWithOutArgsSelective_; - + }; diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp index 230dfc3..f371d5a 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.cpp @@ -1,6 +1,5 @@ -<<<<<<< Upstream, based on origin/master /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -10,66 +9,39 @@ */ #include "TestInterfaceDBusStubAdapter.h" #include <commonapi/tests/TestInterface.h> -======= - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "TestInterfaceDBusStubAdapter.h" - #include <commonapi/tests/TestInterface.h> ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - namespace commonapi { - namespace tests { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - -<<<<<<< Upstream, based on origin/master + +namespace commonapi { +namespace tests { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<TestInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), &createTestInterfaceDBusStubAdapter); } -TestInterfaceDBusStubAdapter::TestInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), - false) { - subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); - subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); -} -TestInterfaceDBusStubAdapter::~TestInterfaceDBusStubAdapter() { + +TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { deactivateManagedInstances(); - deinit(); - stub_.reset(); + TestInterfaceDBusStubAdapterHelper::deinit(); + TestInterfaceDBusStubAdapterHelper::stub_.reset(); } -void TestInterfaceDBusStubAdapter::deactivateManagedInstances() { +void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { } -const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = +const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = "<method name=\"getInterfaceVersion\">\n" "<arg name=\"value\" type=\"uu\" direction=\"out\" />" "</method>\n" @@ -147,157 +119,59 @@ const char* TestInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() c "<method name=\"TestStructWithEnumKeyMapMember\">\n" "<arg name=\"inStruct\" type=\"(a{is})\" direction=\"in\" />\n" "</method>\n" - + ; - return introspectionData; + return introspectionData.c_str(); } -======= - __attribute__((constructor)) void registerTestInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(TestInterface::getInterfaceId(), - &createTestInterfaceDBusStubAdapter); - } ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - CommonAPI::Version - > getInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); - - - TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - TestInterfaceDBusStubAdapterHelper::deinit(); - TestInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"getTestPredefinedTypeAttributeAttribute\">\n" - "<arg name=\"value\" type=\"u\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestPredefinedTypeAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"u\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestPredefinedTypeAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"u\" />\n" - "</signal>\n" - "<method name=\"getTestDerivedStructAttributeAttribute\">\n" - "<arg name=\"value\" type=\"(sqi)\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestDerivedStructAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"(sqi)\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"(sqi)\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestDerivedStructAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"(sqi)\" />\n" - "</signal>\n" - "<method name=\"getTestDerivedArrayAttributeAttribute\">\n" - "<arg name=\"value\" type=\"at\" direction=\"out\" />" - "</method>\n" - "<method name=\"setTestDerivedArrayAttributeAttribute\">\n" - "<arg name=\"requestedValue\" type=\"at\" direction=\"in\" />\n" - "<arg name=\"setValue\" type=\"at\" direction=\"out\" />\n" - "</method>\n" - "<signal name=\"onTestDerivedArrayAttributeAttributeChanged\">\n" - "<arg name=\"changedValue\" type=\"at\" />\n" - "</signal>\n" - "<signal name=\"TestPredefinedTypeBroadcast\">\n" - "<arg name=\"uint32Value\" type=\"u\" />\n" - "<arg name=\"stringValue\" type=\"s\" />\n" - "</signal>\n" - "<signal name=\"TestSelectiveBroadcast\">\n" - "</signal>\n" - "<signal name=\"TestBroadcastWithOutArgs\">\n" - "<arg name=\"uint32Value\" type=\"u\" />\n" - "<arg name=\"stringValue\" type=\"s\" />\n" - "</signal>\n" - "<method name=\"testEmptyMethod\">\n" - "</method>\n" - "<method name=\"testVoidPredefinedTypeMethod\">\n" - "<arg name=\"uint32Value\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"stringValue\" type=\"s\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"testPredefinedTypeMethod\">\n" - "<arg name=\"uint32InValue\" type=\"u\" direction=\"in\" />\n" - "<arg name=\"stringInValue\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"uint32OutValue\" type=\"u\" direction=\"out\" />\n" - "<arg name=\"stringOutValue\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - "<method name=\"testVoidDerivedTypeMethod\">\n" - "<arg name=\"testEnumExtended2Value\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"testMapValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"testDerivedTypeMethod\">\n" - "<arg name=\"testEnumExtended2InValue\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"testMapInValue\" type=\"a{ua(sq)}\" direction=\"in\" />\n" - "<arg name=\"testEnumExtended2OutValue\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"testMapOutValue\" type=\"a{ua(sq)}\" direction=\"out\" />\n" - "</method>\n" - "<method name=\"TestArrayOfPolymorphicStructMethod\">\n" - "<arg name=\"inArray\" type=\"a(uv)\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestMapOfPolymorphicStructMethod\">\n" - "<arg name=\"inMap\" type=\"a{y(uv)}\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestStructWithPolymorphicMemberMethod\">\n" - "<arg name=\"inStruct\" type=\"(u(uv))\" direction=\"in\" />\n" - "</method>\n" - "<method name=\"TestStructWithEnumKeyMapMember\">\n" - "<arg name=\"inStruct\" type=\"(ua{is})\" direction=\"in\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - uint32_t - > setTestPredefinedTypeAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, - "u"); - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestStructExtended - > setTestDerivedStructAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, - "(sqi)"); - - static CommonAPI::DBus::DBusGetAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); - static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< - TestInterfaceStub, - DerivedTypeCollection::TestArrayUInt64 - > setTestDerivedArrayAttributeAttributeStubDispatcher( - &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, - &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, - &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, - "at"); - - -<<<<<<< Upstream, based on origin/master + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + CommonAPI::Version + > getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > getTestPredefinedTypeAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, "u"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + uint32_t + > setTestPredefinedTypeAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged, + "u"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > getTestDerivedStructAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedStructAttributeAttribute, "(sqi)"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestStructExtended + > setTestDerivedStructAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged, + "(sqi)"); + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > getTestDerivedArrayAttributeAttributeStubDispatcher(&TestInterfaceStub::getTestDerivedArrayAttributeAttribute, "at"); +static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher< + TestInterfaceStub, + DerivedTypeCollection::TestArrayUInt64 + > setTestDerivedArrayAttributeAttributeStubDispatcher( + &TestInterfaceStub::getTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute, + &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged, + &TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged, + "at"); + + static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< TestInterfaceStub, std::tuple<>, @@ -343,231 +217,211 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, std::tuple<> > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); -======= - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<>, - std::tuple<> - > testEmptyMethodStubDispatcher(&TestInterfaceStub::testEmptyMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<uint32_t, std::string>, - std::tuple<> - > testVoidPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidPredefinedTypeMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<uint32_t, std::string>, - std::tuple<uint32_t, std::string> - > testPredefinedTypeMethodStubDispatcher(&TestInterfaceStub::testPredefinedTypeMethod, "us"); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, - std::tuple<> - > testVoidDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testVoidDerivedTypeMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap>, - std::tuple<DerivedTypeCollection::TestEnumExtended2, DerivedTypeCollection::TestMap> - > testDerivedTypeMethodStubDispatcher(&TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}"); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<std::vector<std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>>>, - std::tuple<> - > testArrayOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestArrayOfPolymorphicStructMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::MapIntToPolymorphic>, - std::tuple<> - > testMapOfPolymorphicStructMethodStubDispatcher(&TestInterfaceStub::TestMapOfPolymorphicStructMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::StructWithPolymorphicMember>, - std::tuple<> - > testStructWithPolymorphicMemberMethodStubDispatcher(&TestInterfaceStub::TestStructWithPolymorphicMemberMethod, ""); - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - TestInterfaceStub, - std::tuple<DerivedTypeCollection::StructWithEnumKeyMap>, - std::tuple<> - > testStructWithEnumKeyMapMemberStubDispatcher(&TestInterfaceStub::TestStructWithEnumKeyMapMember, ""); ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> - ::sendSignal( - *this, - "onTestPredefinedTypeAttributeAttributeChanged", - "u", - value - ); - } - void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> - ::sendSignal( - *this, - "onTestDerivedStructAttributeAttributeChanged", - "(sqi)", - value - ); - } - void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> - ::sendSignal( - *this, - "onTestDerivedArrayAttributeAttributeChanged", - "at", - value - ); - } - - void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - *this, - "TestPredefinedTypeBroadcast", - "us", - uint32Value, stringValue - ); - } - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); - - - void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestSelectiveBroadcast", - "" - ); - } - } - - void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { - fireTestSelectiveBroadcastSelective(*clientIdIterator); - } - } - } - - void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestSelectiveBroadcastSelective_->insert(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } - } - - - void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestSelectiveBroadcastSelective_->erase(clientId); - stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); - } - - std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { - return subscribersForTestSelectiveBroadcastSelective_; - } - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<bool> - > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); - - static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< - TestInterfaceStub, - TestInterfaceStubAdapter, - std::tuple<>, - std::tuple<> - > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); - - - void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { - std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); - - if(dbusClientId) - { - CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> - ::sendSignal( - dbusClientId->getDBusId(), - *this, - "TestBroadcastWithOutArgs", - "us", - uint32Value, stringValue - ); - } - } - - void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { - std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; - actualReceiverList = receivers; - - if(receivers == NULL) - actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; - - for (auto clientIdIterator = actualReceiverList->cbegin(); - clientIdIterator != actualReceiverList->cend(); - clientIdIterator++) { - if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { - fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); - } - } - } - - void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { - bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); - if (ok) { - subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); - success = true; - } else { - success = false; - } - } - - - void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { - subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); - stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); - } - - std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { - return subscribersForTestBroadcastWithOutArgsSelective_; - } - - -<<<<<<< Upstream, based on origin/master -const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const TestInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { - { { "getInterfaceVersion", "" }, &commonapi::tests::getInterfaceVersionStubDispatcher }, + +void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t>> + ::sendSignal( + *this, + "onTestPredefinedTypeAttributeAttributeChanged", + "u", + value + ); +} +void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const DerivedTypeCollection::TestStructExtended& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestStructExtended>> + ::sendSignal( + *this, + "onTestDerivedStructAttributeAttributeChanged", + "(sqi)", + value + ); +} +void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const DerivedTypeCollection::TestArrayUInt64& value) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<DerivedTypeCollection::TestArrayUInt64>> + ::sendSignal( + *this, + "onTestDerivedArrayAttributeAttributeChanged", + "at", + value + ); +} + +void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + *this, + "TestPredefinedTypeBroadcast", + "us", + uint32Value, stringValue + ); +} +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b"); + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, ""); + + +void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestSelectiveBroadcast", + "" + ); + } +} + +void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestSelectiveBroadcastSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) { + fireTestSelectiveBroadcastSelective(*clientIdIterator); + } + } +} + +void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestSelectiveBroadcastSelective_->insert(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } +} + + +void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestSelectiveBroadcastSelective_->erase(clientId); + stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); +} + +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() { + return subscribersForTestSelectiveBroadcastSelective_; +} + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<bool> + > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b"); + +static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher< + TestInterfaceStub, + TestInterfaceStubAdapter, + std::tuple<>, + std::tuple<> + > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, ""); + + +void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, const uint32_t& uint32Value, const std::string& stringValue) { + std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClientId = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(clientId); + + if(dbusClientId) + { + CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<uint32_t, std::string>> + ::sendSignal( + dbusClientId->getDBusId(), + *this, + "TestBroadcastWithOutArgs", + "us", + uint32Value, stringValue + ); + } +} + +void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t& uint32Value, const std::string& stringValue, const std::shared_ptr<CommonAPI::ClientIdList> receivers) { + std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList; + actualReceiverList = receivers; + + if(receivers == NULL) + actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_; + + for (auto clientIdIterator = actualReceiverList->cbegin(); + clientIdIterator != actualReceiverList->cend(); + clientIdIterator++) { + if(receivers == NULL || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) { + fireTestBroadcastWithOutArgsSelective(*clientIdIterator, uint32Value, stringValue); + } + } +} + +void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) { + bool ok = stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId); + if (ok) { + subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED); + success = true; + } else { + success = false; + } +} + + +void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) { + subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId); + stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED); +} + +std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() { + return subscribersForTestBroadcastWithOutArgsSelective_; +} + + +const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + TestInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<TestInterfaceStub>(stub), + false), + stubDispatcherTable_({ { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher } , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher }, { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher } @@ -589,62 +443,12 @@ const TestInterfaceDBusStubAdapter::StubDispatcherTable& TestInterfaceDBusStubAd { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } - }; - return stubDispatcherTable; + }) { + subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::getTestInterfaceInterfaceVersionStubDispatcher }); } -======= - const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - TestInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<TestInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::getTestPredefinedTypeAttributeAttributeStubDispatcher } - , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::setTestPredefinedTypeAttributeAttributeStubDispatcher }, - { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::getTestDerivedStructAttributeAttributeStubDispatcher } - , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::setTestDerivedStructAttributeAttributeStubDispatcher }, - { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::getTestDerivedArrayAttributeAttributeStubDispatcher } - , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::setTestDerivedArrayAttributeAttributeStubDispatcher } - , - { { "testEmptyMethod", "" }, &commonapi::tests::testEmptyMethodStubDispatcher }, - { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::testVoidPredefinedTypeMethodStubDispatcher }, - { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::testPredefinedTypeMethodStubDispatcher }, - { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testVoidDerivedTypeMethodStubDispatcher }, - { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::testDerivedTypeMethodStubDispatcher }, - { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::testArrayOfPolymorphicStructMethodStubDispatcher }, - { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::testMapOfPolymorphicStructMethodStubDispatcher }, - { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::testStructWithPolymorphicMemberMethodStubDispatcher }, - { { "TestStructWithEnumKeyMapMember", "(ua{is})" }, &commonapi::tests::testStructWithEnumKeyMapMemberStubDispatcher } - , - { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher }, - { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }, - { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher } - }) { - subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>(); - subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>(); ->>>>>>> 555557d Fix for inherited interfaces and tests for that including generated code - - } - - } // namespace tests - } // namespace commonapi + +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h index 4dc2a81..3c549ad 100644 --- a/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/TestInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/TestInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -57,12 +56,12 @@ class TestInterfaceDBusStubAdapterInternal: public TestInterfaceStubAdapter, pub void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success); void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId); std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective(); - + const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/TestInterfaceProxy.h b/src/test/commonapi/tests/TestInterfaceProxy.h index 35cc04f..8499e8e 100644 --- a/src/test/commonapi/tests/TestInterfaceProxy.h +++ b/src/test/commonapi/tests/TestInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -31,9 +31,9 @@ class TestInterfaceProxy: virtual public TestInterface, virtual public TestInter public: TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~TestInterfaceProxy(); - + typedef TestInterface InterfaceType; - + /** * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute. @@ -254,7 +254,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const DerivedTypeCollection::StructWithEnumKeyMap& inStruct, TestStructWithEnumKeyMapMemberAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -497,7 +497,6 @@ CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions... return delegate_->getInterfaceVersionAttribute(); } - } // namespace tests } // namespace commonapi diff --git a/src/test/commonapi/tests/TestInterfaceProxyBase.h b/src/test/commonapi/tests/TestInterfaceProxyBase.h index 139d9d5..32ff725 100644 --- a/src/test/commonapi/tests/TestInterfaceProxyBase.h +++ b/src/test/commonapi/tests/TestInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "TestInterface.h" - #include <commonapi/tests/DerivedTypeCollection.h> #include <commonapi/tests/PredefinedTypeCollection.h> diff --git a/src/test/commonapi/tests/TestInterfaceStub.h b/src/test/commonapi/tests/TestInterfaceStub.h index 301102e..735d60b 100644 --- a/src/test/commonapi/tests/TestInterfaceStub.h +++ b/src/test/commonapi/tests/TestInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -74,10 +74,9 @@ class TestInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public Te virtual void subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0; virtual void unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0; - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -130,12 +129,9 @@ class TestInterfaceStubRemoteEvent { */ class TestInterfaceStub : public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent> { public: - TestInterfaceStub(): interfaceVersion_(TestInterface::getInterfaceVersion()) { } virtual ~TestInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { - return interfaceVersion_; - } /// Provides getter access to the attribute TestPredefinedTypeAttribute virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// Provides getter access to the attribute TestDerivedStructAttribute @@ -187,14 +183,10 @@ public: virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event) = 0; /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - - private: - const CommonAPI::Version interfaceVersion_; - + using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace tests diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp index e0c2e05..a206cec 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,12 @@ namespace commonapi { namespace tests { TestInterfaceStubDefault::TestInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(TestInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/TestInterfaceStubDefault.h b/src/test/commonapi/tests/TestInterfaceStubDefault.h index e119a59..0b1953e 100644 --- a/src/test/commonapi/tests/TestInterfaceStubDefault.h +++ b/src/test/commonapi/tests/TestInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -33,6 +33,8 @@ public: TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(); virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> clientId); virtual void setTestPredefinedTypeAttributeAttribute(uint32_t value); @@ -87,7 +89,7 @@ public: virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, const CommonAPI::SelectiveBroadcastSubscriptionEvent event); /// Hook method for reacting accepting or denying new subscriptions virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> clientId); - + protected: virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t value); @@ -126,6 +128,8 @@ private: uint32_t testPredefinedTypeAttributeAttributeValue_; DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_; DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_; + + CommonAPI::Version interfaceVersion_; }; } // namespace tests diff --git a/src/test/commonapi/tests/managed/BranchInterface.h b/src/test/commonapi/tests/managed/BranchInterface.h index 385c656..30749ef 100644 --- a/src/test/commonapi/tests/managed/BranchInterface.h +++ b/src/test/commonapi/tests/managed/BranchInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -77,7 +77,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testBranchMethodError template<> diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp index 8c557c5..98a3664 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -47,7 +47,7 @@ void BranchInterfaceDBusProxy::testBranchMethod(const int32_t& inInt, const std: *this, "testBranchMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h index 89d520e..23e17a2 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/BranchInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class BranchInterfaceDBusProxy: virtual public BranchInterfaceProxyBase, virtual virtual void testBranchMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp index d4c0a62..3c14d6b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp @@ -1,99 +1,114 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "BranchInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/BranchInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), - &createBranchInterfaceDBusStubAdapter); - } - - - - BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - BranchInterfaceDBusStubAdapterHelper::deinit(); - BranchInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testBranchMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - BranchInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> - > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); - - - - const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - BranchInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<BranchInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "BranchInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/BranchInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<BranchInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerBranchInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(BranchInterface::getInterfaceId(), + &createBranchInterfaceDBusStubAdapter); +} + + + +BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + BranchInterfaceDBusStubAdapterHelper::deinit(); + BranchInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void BranchInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testBranchMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + BranchInterfaceStub, + CommonAPI::Version + > getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + BranchInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string> + > testBranchMethodStubDispatcher(&BranchInterfaceStub::testBranchMethod, "iis"); + + + +const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + BranchInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<BranchInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testBranchMethod", "is" }, &commonapi::tests::managed::testBranchMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getBranchInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h index 21e46a2..a7dde87 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/BranchInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,12 +43,12 @@ class BranchInterfaceDBusStubAdapterInternal: public BranchInterfaceStubAdapter, ~BranchInterfaceDBusStubAdapterInternal(); - + const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h index 6517b8d..828c95a 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,9 +30,9 @@ class BranchInterfaceProxy: virtual public BranchInterface, virtual public Branc public: BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~BranchInterfaceProxy(); - + typedef BranchInterface InterfaceType; - + @@ -57,7 +57,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t& inInt, const std::string& inString, TestBranchMethodAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -169,7 +169,6 @@ CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions. return delegate_->getInterfaceVersionAttribute(); } - } // namespace managed } // namespace tests diff --git a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h index d5a61c1..cbfcf74 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -14,7 +14,6 @@ - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStub.h b/src/test/commonapi/tests/managed/BranchInterfaceStub.h index 160312a..c129327 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStub.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,10 +38,9 @@ namespace managed { class BranchInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public BranchInterface { public: - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -78,16 +77,15 @@ class BranchInterfaceStubRemoteEvent { class BranchInterfaceStub : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent> { public: virtual ~BranchInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testBranchMethod. virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - - + using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp index 039c64c..65a807b 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -14,7 +14,12 @@ namespace tests { namespace managed { BranchInterfaceStubDefault::BranchInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(BranchInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h index 90b0787..c191a83 100644 --- a/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/BranchInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); virtual void testBranchMethod(int32_t inInt, std::string inString, BranchInterface::testBranchMethodError& methodError, int32_t& outInt, std::string& outString); - + protected: private: @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterface.h b/src/test/commonapi/tests/managed/LeafInterface.h index d3a05cd..45bf376 100644 --- a/src/test/commonapi/tests/managed/LeafInterface.h +++ b/src/test/commonapi/tests/managed/LeafInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -77,7 +77,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testLeafMethodError template<> diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp index 5c163da..da6cef5 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -47,7 +47,7 @@ void LeafInterfaceDBusProxy::testLeafMethod(const int32_t& inInt, const std::str *this, "testLeafMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h index 17fde80..e257805 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/LeafInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -45,13 +43,13 @@ class LeafInterfaceDBusProxy: virtual public LeafInterfaceProxyBase, virtual pub virtual void testLeafMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t& inInt, const std::string& inString, TestLeafMethodAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp index 787d4ec..21441a3 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp @@ -1,99 +1,114 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "LeafInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/LeafInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), - &createLeafInterfaceDBusStubAdapter); - } - - - - LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - LeafInterfaceDBusStubAdapterHelper::deinit(); - LeafInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - } - - const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testLeafMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - LeafInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> - > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); - - - - const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - false), - LeafInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<LeafInterfaceStub>(stub), - false), - stubDispatcherTable_({ - { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "LeafInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/LeafInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<LeafInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerLeafInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(LeafInterface::getInterfaceId(), + &createLeafInterfaceDBusStubAdapter); +} + + + +LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + LeafInterfaceDBusStubAdapterHelper::deinit(); + LeafInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void LeafInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { +} + +const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testLeafMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + LeafInterfaceStub, + CommonAPI::Version + > getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + LeafInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string> + > testLeafMethodStubDispatcher(&LeafInterfaceStub::testLeafMethod, "iis"); + + + +const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LeafInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<LeafInterfaceStub>(stub), + false), + stubDispatcherTable_({ + { { "testLeafMethod", "is" }, &commonapi::tests::managed::testLeafMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getLeafInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h index f60c9b5..f0ecb1f 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/LeafInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,12 +43,12 @@ class LeafInterfaceDBusStubAdapterInternal: public LeafInterfaceStubAdapter, pub ~LeafInterfaceDBusStubAdapterInternal(); - + const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStub.h b/src/test/commonapi/tests/managed/LeafInterfaceStub.h index 95ef485..921e78f 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStub.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStub.h @@ -78,16 +78,15 @@ class LeafInterfaceStubRemoteEvent { class LeafInterfaceStub : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent> { public: virtual ~LeafInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testLeafMethod. virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp index f653e18..fe18ffc 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.cpp @@ -14,7 +14,12 @@ namespace tests { namespace managed { LeafInterfaceStubDefault::LeafInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(LeafInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h index e9227b8..a13cada 100644 --- a/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/LeafInterfaceStubDefault.h @@ -33,6 +33,8 @@ public: LeafInterfaceStubDefault(); LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter>& stubAdapter); + + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, LeafInterface::testLeafMethodError& methodError, int32_t& outInt, std::string& outString); @@ -54,6 +56,8 @@ private: RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterface.h b/src/test/commonapi/tests/managed/RootInterface.h index 7894869..7cd0288 100644 --- a/src/test/commonapi/tests/managed/RootInterface.h +++ b/src/test/commonapi/tests/managed/RootInterface.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -78,7 +78,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types //Hash for testRootMethodError template<> diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp index b7eb845..c9b14e1 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -49,7 +49,7 @@ void RootInterfaceDBusProxy::testRootMethod(const int32_t& inInt, const std::str *this, "testRootMethod", "is", - inInt, inString, + inInt, inString, callStatus, methodError , outInt, outString); diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h index 07f5798..a59ab2e 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/RootInterfaceProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -46,7 +44,7 @@ class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual pub virtual void testRootMethod(const int32_t& inInt, const std::string& inString, CommonAPI::CallStatus& callStatus, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); @@ -54,7 +52,7 @@ class RootInterfaceDBusProxy: virtual public RootInterfaceProxyBase, virtual pub private: - + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_; }; diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp index 66a9965..0ae8c1f 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp @@ -1,215 +1,230 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "RootInterfaceDBusStubAdapter.h" - #include <commonapi/tests/managed/RootInterface.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), - &createRootInterfaceDBusStubAdapter); - } - - - - RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { - deactivateManagedInstances(); - RootInterfaceDBusStubAdapterHelper::deinit(); - RootInterfaceDBusStubAdapterHelper::stub_.reset(); - } - - void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } - for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); - iter != registeredBranchInterfaceInstances.end(); ++iter) { - deregisterManagedStubBranchInterface(*iter); - } - } - - const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - "<method name=\"testRootMethod\">\n" - "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" - "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" - "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" - "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" - "</method>\n" - - ; - return introspectionData.c_str(); - } - - - static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< - RootInterfaceStub, - std::tuple<int32_t, std::string>, - std::tuple<RootInterface::testRootMethodError, int32_t, std::string> - > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); - - - - const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; - } - - bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { - if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", - instance, "commonapi.tests.managed.BranchInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredBranchInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; - if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredBranchInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() { - return registeredBranchInterfaceInstances; - } - - RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - true), - RootInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<RootInterfaceStub>(stub), - true), - stubDispatcherTable_({ - { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "RootInterfaceDBusStubAdapter.h" +#include <commonapi/tests/managed/RootInterface.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<RootInterfaceDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerRootInterfaceDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(RootInterface::getInterfaceId(), + &createRootInterfaceDBusStubAdapter); +} + + + +RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() { + deactivateManagedInstances(); + RootInterfaceDBusStubAdapterHelper::deinit(); + RootInterfaceDBusStubAdapterHelper::stub_.reset(); +} + +void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } + for(std::set<std::string>::iterator iter = registeredBranchInterfaceInstances.begin(); + iter != registeredBranchInterfaceInstances.end(); ++iter) { + deregisterManagedStubBranchInterface(*iter); + } +} + +const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + "<method name=\"testRootMethod\">\n" + "<arg name=\"inInt\" type=\"i\" direction=\"in\" />\n" + "<arg name=\"inString\" type=\"s\" direction=\"in\" />\n" + "<arg name=\"methodError\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outInt\" type=\"i\" direction=\"out\" />\n" + "<arg name=\"outString\" type=\"s\" direction=\"out\" />\n" + "</method>\n" + + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + RootInterfaceStub, + CommonAPI::Version + > getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu"); + + +static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< + RootInterfaceStub, + std::tuple<int32_t, std::string>, + std::tuple<RootInterface::testRootMethodError, int32_t, std::string> + > testRootMethodStubDispatcher(&RootInterfaceStub::testRootMethod, "iis"); + + + +const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> stub, const std::string& instance) { + if (registeredBranchInterfaceInstances.find(instance) == registeredBranchInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.BranchInterface", + instance, "commonapi.tests.managed.BranchInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredBranchInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.BranchInterface:" + instance; + if (registeredBranchInterfaceInstances.find(instance) != registeredBranchInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredBranchInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() { + return registeredBranchInterfaceInstances; +} + +RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + RootInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<RootInterfaceStub>(stub), + true), + stubDispatcherTable_({ + { { "testRootMethod", "is" }, &commonapi::tests::managed::testRootMethodStubDispatcher } + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getRootInterfaceInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h index 01ef3a4..c46abfa 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/RootInterfaceDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/RootInterfaceStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,7 +43,7 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub ~RootInterfaceDBusStubAdapterInternal(); - + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); @@ -53,9 +52,9 @@ class RootInterfaceDBusStubAdapterInternal: public RootInterfaceStubAdapter, pub std::set<std::string>& getBranchInterfaceInstances(); const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxy.h b/src/test/commonapi/tests/managed/RootInterfaceProxy.h index 672c0d5..076fec7 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxy.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,9 +30,9 @@ class RootInterfaceProxy: virtual public RootInterface, virtual public RootInter public: RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~RootInterfaceProxy(); - + typedef RootInterface InterfaceType; - + @@ -57,7 +57,7 @@ public: * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t& inInt, const std::string& inString, TestRootMethodAsyncCallback callback); - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface(); @@ -171,7 +171,6 @@ CommonAPI::InterfaceVersionAttribute& RootInterfaceProxy<_AttributeExtensions... return delegate_->getInterfaceVersionAttribute(); } - template <typename ... _AttributeExtensions> CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { return delegate_->getProxyManagerLeafInterface(); diff --git a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h index 550093f..167adc7 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h +++ b/src/test/commonapi/tests/managed/RootInterfaceProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "RootInterface.h" - #include <commonapi/tests/managed/BranchInterfaceStub.h> #include <commonapi/tests/managed/LeafInterfaceStub.h> diff --git a/src/test/commonapi/tests/managed/RootInterfaceStub.h b/src/test/commonapi/tests/managed/RootInterfaceStub.h index 0dbd088..3e28cc1 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStub.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -40,16 +40,15 @@ namespace managed { class RootInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public RootInterface { public: - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; virtual bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubBranchInterface(const std::string&) = 0; virtual std::set<std::string>& getBranchInterfaceInstances() = 0; - + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -86,22 +85,21 @@ class RootInterfaceStubRemoteEvent { class RootInterfaceStub : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent> { public: virtual ~RootInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method testRootMethod. virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString) = 0; - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; virtual bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubBranchInterface(const std::string&) = 0; virtual std::set<std::string>& getBranchInterfaceInstances() = 0; - using CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp index cf09dc0..4eb108a 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -15,7 +15,12 @@ namespace managed { RootInterfaceStubDefault::RootInterfaceStubDefault(): autoInstanceCounter_(0), - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(RootInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& RootInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h index 1379a82..9249fc4 100644 --- a/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h +++ b/src/test/commonapi/tests/managed/RootInterfaceStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,12 +34,14 @@ public: RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); virtual void testRootMethod(int32_t inInt, std::string inString, RootInterface::testRootMethodError& methodError, int32_t& outInt, std::string& outString); - + bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>); bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); @@ -63,6 +65,8 @@ private: RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRoot.h b/src/test/commonapi/tests/managed/SecondRoot.h index 4104797..2aef3a6 100644 --- a/src/test/commonapi/tests/managed/SecondRoot.h +++ b/src/test/commonapi/tests/managed/SecondRoot.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -55,7 +55,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp index f43fde1..39bd825 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * diff --git a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h index 81f752e..cd75f59 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,8 +12,6 @@ #include <commonapi/tests/managed/SecondRootProxyBase.h> - - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,14 +42,14 @@ class SecondRootDBusProxy: virtual public SecondRootProxyBase, virtual public Co - + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_; }; diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp index fffe746..a6c7c6d 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp @@ -1,145 +1,160 @@ - /* - * This file was generated by the CommonAPI Generators. - * Used org.genivi.commonapi.core 2.1.4.qualifier. - * Used org.franca.core 0.8.10.201309262002. - * - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - * If a copy of the MPL was not distributed with this file, You can obtain one at - * http://mozilla.org/MPL/2.0/. - */ - #include "SecondRootDBusStubAdapter.h" - #include <commonapi/tests/managed/SecondRoot.h> - - namespace commonapi { - namespace tests { - namespace managed { - - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& interfaceName, - const std::string& busName, - const std::string& objectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, - const std::shared_ptr<CommonAPI::StubBase>& stubBase) { - return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); - } - - __attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { - CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), - &createSecondRootDBusStubAdapter); - } - - - - SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { - deactivateManagedInstances(); - SecondRootDBusStubAdapterHelper::deinit(); - SecondRootDBusStubAdapterHelper::stub_.reset(); - } - - void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { - for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); - iter != registeredLeafInterfaceInstances.end(); ++iter) { - deregisterManagedStubLeafInterface(*iter); - } - } - - const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { - static const std::string introspectionData = - - "" - ; - return introspectionData.c_str(); - } - - - - - - const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() { - return stubDispatcherTable_; - } - - - bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { - if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - - std::string interfaceName; - std::string connectionName; - std::string objectPath; - - CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( - commonApiAddress, - interfaceName, - connectionName, - objectPath); - - if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { - auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", - instance, "commonapi.tests.managed.LeafInterface", "local"); - - bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); - if (success) { - bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - if (isServiceExportSuccessful) { - registeredLeafInterfaceInstances.insert(instance); - return true; - } else { - const bool isManagedDeregistrationSuccessful = - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( - commonApiAddress); - } - } - } - } - return false; - } - - bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { - std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; - if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { - std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = - CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); - if (dbusStubAdapter != nullptr) { - dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); - CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); - registeredLeafInterfaceInstances.erase(instance); - return true; - } - } - return false; - } - - std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() { - return registeredLeafInterfaceInstances; - } - - SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - CommonAPI::DBus::DBusStubAdapter( - factory, - commonApiAddress, - dbusInterfaceName, - dbusBusName, - dbusObjectPath, - dbusConnection, - true), - SecondRootDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<SecondRootStub>(stub), - true), - stubDispatcherTable_({ - }) { - - } - - } // namespace managed - } // namespace tests - } // namespace commonapi +/* +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. +* Used org.franca.core 0.8.10.201309262002. +* +* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +* If a copy of the MPL was not distributed with this file, You can obtain one at +* http://mozilla.org/MPL/2.0/. +*/ +#include "SecondRootDBusStubAdapter.h" +#include <commonapi/tests/managed/SecondRoot.h> + +namespace commonapi { +namespace tests { +namespace managed { + +std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& interfaceName, + const std::string& busName, + const std::string& objectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusProxyConnection, + const std::shared_ptr<CommonAPI::StubBase>& stubBase) { + return std::make_shared<SecondRootDBusStubAdapter>(factory, commonApiAddress, interfaceName, busName, objectPath, dbusProxyConnection, stubBase); +} + +__attribute__((constructor)) void registerSecondRootDBusStubAdapter(void) { + CommonAPI::DBus::DBusFactory::registerAdapterFactoryMethod(SecondRoot::getInterfaceId(), + &createSecondRootDBusStubAdapter); +} + + + +SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() { + deactivateManagedInstances(); + SecondRootDBusStubAdapterHelper::deinit(); + SecondRootDBusStubAdapterHelper::stub_.reset(); +} + +void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() { + for(std::set<std::string>::iterator iter = registeredLeafInterfaceInstances.begin(); + iter != registeredLeafInterfaceInstances.end(); ++iter) { + deregisterManagedStubLeafInterface(*iter); + } +} + +const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" + + "" + ; + return introspectionData.c_str(); +} + +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + SecondRootStub, + CommonAPI::Version + > getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu"); + + + + + +const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> stub, const std::string& instance) { + if (registeredLeafInterfaceInstances.find(instance) == registeredLeafInterfaceInstances.end()) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + + std::string interfaceName; + std::string connectionName; + std::string objectPath; + + CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress( + commonApiAddress, + interfaceName, + connectionName, + objectPath); + + if (objectPath.compare(0, dbusObjectPath_.length(), dbusObjectPath_) == 0) { + auto dbusStubAdapter = factory_->createDBusStubAdapter(stub, "commonapi.tests.managed.LeafInterface", + instance, "commonapi.tests.managed.LeafInterface", "local"); + + bool success = CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter); + if (success) { + bool isServiceExportSuccessful = dbusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + if (isServiceExportSuccessful) { + registeredLeafInterfaceInstances.insert(instance); + return true; + } else { + const bool isManagedDeregistrationSuccessful = + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService( + commonApiAddress); + } + } + } + } + return false; +} + +bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string& instance) { + std::string commonApiAddress = "local:commonapi.tests.managed.LeafInterface:" + instance; + if (registeredLeafInterfaceInstances.find(instance) != registeredLeafInterfaceInstances.end()) { + std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter = + CommonAPI::DBus::DBusServicePublisher::getInstance()->getRegisteredService(commonApiAddress); + if (dbusStubAdapter != nullptr) { + dbusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(dbusObjectPath_, dbusStubAdapter); + CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(commonApiAddress); + registeredLeafInterfaceInstances.erase(instance); + return true; + } + } + return false; +} + +std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() { + return registeredLeafInterfaceInstances; +} + +SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + true), + SecondRootDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<SecondRootStub>(stub), + true), + stubDispatcherTable_({ + }) { + + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::getSecondRootInterfaceVersionStubDispatcher }); +} + +} // namespace managed +} // namespace tests +} // namespace commonapi diff --git a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h index fc646db..ba5f2ac 100644 --- a/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h +++ b/src/test/commonapi/tests/managed/SecondRootDBusStubAdapter.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -12,7 +12,6 @@ #include <commonapi/tests/managed/SecondRootStub.h> - #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -44,15 +43,15 @@ class SecondRootDBusStubAdapterInternal: public SecondRootStubAdapter, public Se ~SecondRootDBusStubAdapterInternal(); - + bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); std::set<std::string>& getLeafInterfaceInstances(); const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); - + void deactivateManagedInstances(); - + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; diff --git a/src/test/commonapi/tests/managed/SecondRootProxy.h b/src/test/commonapi/tests/managed/SecondRootProxy.h index fa0cb20..1efb856 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxy.h +++ b/src/test/commonapi/tests/managed/SecondRootProxy.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -30,13 +30,13 @@ class SecondRootProxy: virtual public SecondRoot, virtual public SecondRootProxy public: SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~SecondRootProxy(); - + typedef SecondRoot InterfaceType; - - + + virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface(); /** @@ -140,7 +140,6 @@ CommonAPI::InterfaceVersionAttribute& SecondRootProxy<_AttributeExtensions...>:: return delegate_->getInterfaceVersionAttribute(); } - template <typename ... _AttributeExtensions> CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() { return delegate_->getProxyManagerLeafInterface(); diff --git a/src/test/commonapi/tests/managed/SecondRootProxyBase.h b/src/test/commonapi/tests/managed/SecondRootProxyBase.h index 8006139..68cd1fa 100644 --- a/src/test/commonapi/tests/managed/SecondRootProxyBase.h +++ b/src/test/commonapi/tests/managed/SecondRootProxyBase.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -13,7 +13,6 @@ #include "SecondRoot.h" - #include <commonapi/tests/managed/LeafInterfaceStub.h> #if !defined (COMMONAPI_INTERNAL_COMPILATION) diff --git a/src/test/commonapi/tests/managed/SecondRootStub.h b/src/test/commonapi/tests/managed/SecondRootStub.h index 98a73cb..5b1d449 100644 --- a/src/test/commonapi/tests/managed/SecondRootStub.h +++ b/src/test/commonapi/tests/managed/SecondRootStub.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -38,13 +38,12 @@ namespace managed { class SecondRootStubAdapter: virtual public CommonAPI::StubAdapter, public SecondRoot { public: - + virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; - + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -81,17 +80,16 @@ class SecondRootStubRemoteEvent { class SecondRootStub : public virtual CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent> { public: virtual ~SecondRootStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; + - virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 0; virtual bool deregisterManagedStubLeafInterface(const std::string&) = 0; virtual std::set<std::string>& getLeafInterfaceInstances() = 0; - using CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::initStubAdapter; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::StubAdapterType StubAdapterType; typedef CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; - }; } // namespace managed diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp index 51feea1..bda4c2e 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.cpp @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -15,7 +15,12 @@ namespace managed { SecondRootStubDefault::SecondRootStubDefault(): autoInstanceCounter_(0), - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(SecondRoot::getInterfaceVersion()) { +} + +const CommonAPI::Version& SecondRootStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter) { diff --git a/src/test/commonapi/tests/managed/SecondRootStubDefault.h b/src/test/commonapi/tests/managed/SecondRootStubDefault.h index daaca19..55cdd3d 100644 --- a/src/test/commonapi/tests/managed/SecondRootStubDefault.h +++ b/src/test/commonapi/tests/managed/SecondRootStubDefault.h @@ -1,5 +1,5 @@ /* -* This file was generated by the CommonAPI Generators. +* This file was generated by the CommonAPI Generators. * Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * @@ -34,9 +34,11 @@ public: SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + + - bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>); bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&); bool deregisterManagedStubLeafInterface(const std::string&); @@ -56,6 +58,8 @@ private: RemoteEventHandler remoteEventHandler_; uint32_t autoInstanceCounter_; + + CommonAPI::Version interfaceVersion_; }; } // namespace managed diff --git a/src/test/fake/legacy/service/LegacyInterface.h b/src/test/fake/legacy/service/LegacyInterface.h index eab3aed..7350d2c 100644 --- a/src/test/fake/legacy/service/LegacyInterface.h +++ b/src/test/fake/legacy/service/LegacyInterface.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -53,7 +54,7 @@ namespace CommonAPI { namespace std { //hashes for types - + //hashes for error types } diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp index ed0eda0..3d4dad8 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp +++ b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.cpp @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -47,7 +47,7 @@ void LegacyInterfaceDBusProxy::TestMethod(const int32_t& input, CommonAPI::CallS *this, "TestMethod", "i", - input, + input, callStatus , val1, val2); } diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h index 7baf090..9d1c2d9 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h +++ b/src/test/fake/legacy/service/LegacyInterfaceDBusProxy.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -47,13 +47,13 @@ class LegacyInterfaceDBusProxy: virtual public LegacyInterfaceProxyBase, virtual virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback callback); virtual void finish(CommonAPI::CallStatus& callStatus); virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback callback); - + virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const; private: - + }; diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp b/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp index f1cffc8..06599ef 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp +++ b/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -30,30 +30,22 @@ __attribute__((constructor)) void registerLegacyInterfaceDBusStubAdapter(void) { &createLegacyInterfaceDBusStubAdapter); } -LegacyInterfaceDBusStubAdapter::LegacyInterfaceDBusStubAdapter( - const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, - const std::string& commonApiAddress, - const std::string& dbusInterfaceName, - const std::string& dbusBusName, - const std::string& dbusObjectPath, - const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, - const std::shared_ptr<CommonAPI::StubBase>& stub): - LegacyInterfaceDBusStubAdapterHelper(factory, commonApiAddress, dbusInterfaceName, dbusBusName, dbusObjectPath, - dbusConnection, std::dynamic_pointer_cast<LegacyInterfaceStub>(stub), - false) { -} -LegacyInterfaceDBusStubAdapter::~LegacyInterfaceDBusStubAdapter() { + +LegacyInterfaceDBusStubAdapterInternal::~LegacyInterfaceDBusStubAdapterInternal() { deactivateManagedInstances(); - deinit(); - stub_.reset(); + LegacyInterfaceDBusStubAdapterHelper::deinit(); + LegacyInterfaceDBusStubAdapterHelper::stub_.reset(); } -void LegacyInterfaceDBusStubAdapter::deactivateManagedInstances() { +void LegacyInterfaceDBusStubAdapterInternal::deactivateManagedInstances() { } -const char* LegacyInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() const { - static const char* introspectionData = +const char* LegacyInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const { + static const std::string introspectionData = + "<method name=\"getInterfaceVersion\">\n" + "<arg name=\"value\" type=\"uu\" direction=\"out\" />" + "</method>\n" "<method name=\"TestMethod\">\n" "<arg name=\"input\" type=\"i\" direction=\"in\" />\n" "<arg name=\"val1\" type=\"i\" direction=\"out\" />\n" @@ -65,11 +57,15 @@ const char* LegacyInterfaceDBusStubAdapter::getMethodsDBusIntrospectionXmlData() "</method>\n" "<method name=\"finish\">\n" "</method>\n" - + ; - return introspectionData; + return introspectionData.c_str(); } +static CommonAPI::DBus::DBusGetAttributeStubDispatcher< + LegacyInterfaceStub, + CommonAPI::Version + > getLegacyInterfaceInterfaceVersionStubDispatcher(&LegacyInterfaceStub::getInterfaceVersion, "uu"); static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< @@ -90,15 +86,44 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher< -const LegacyInterfaceDBusStubAdapter::StubDispatcherTable& LegacyInterfaceDBusStubAdapter::getStubDispatcherTable() { - static const LegacyInterfaceDBusStubAdapter::StubDispatcherTable stubDispatcherTable = { +const LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable& LegacyInterfaceDBusStubAdapterInternal::getStubDispatcherTable() { + return stubDispatcherTable_; +} + + +LegacyInterfaceDBusStubAdapterInternal::LegacyInterfaceDBusStubAdapterInternal( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub): + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LegacyInterfaceDBusStubAdapterHelper( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + std::dynamic_pointer_cast<LegacyInterfaceStub>(stub), + false), + stubDispatcherTable_({ { { "TestMethod", "i" }, &fake::legacy::service::testMethodStubDispatcher }, { { "OtherTestMethod", "" }, &fake::legacy::service::otherTestMethodStubDispatcher }, { { "finish", "" }, &fake::legacy::service::finishStubDispatcher } - }; - return stubDispatcherTable; -} + }) { + stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::getLegacyInterfaceInterfaceVersionStubDispatcher }); +} } // namespace service } // namespace legacy diff --git a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h b/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h index 0337006..e5c5894 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h +++ b/src/test/fake/legacy/service/LegacyInterfaceDBusStubAdapter.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -29,9 +29,9 @@ namespace service { typedef CommonAPI::DBus::DBusStubAdapterHelper<LegacyInterfaceStub> LegacyInterfaceDBusStubAdapterHelper; -class LegacyInterfaceDBusStubAdapter: public LegacyInterfaceStubAdapter, public LegacyInterfaceDBusStubAdapterHelper { +class LegacyInterfaceDBusStubAdapterInternal: public LegacyInterfaceStubAdapter, public LegacyInterfaceDBusStubAdapterHelper { public: - LegacyInterfaceDBusStubAdapter( + LegacyInterfaceDBusStubAdapterInternal( const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, const std::string& commonApiAddress, const std::string& dbusInterfaceName, @@ -40,19 +40,49 @@ class LegacyInterfaceDBusStubAdapter: public LegacyInterfaceStubAdapter, public const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, const std::shared_ptr<CommonAPI::StubBase>& stub); - ~LegacyInterfaceDBusStubAdapter(); + ~LegacyInterfaceDBusStubAdapterInternal(); - - const StubDispatcherTable& getStubDispatcherTable(); - + + const LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable(); + void deactivateManagedInstances(); + protected: virtual const char* getMethodsDBusIntrospectionXmlData() const; private: + LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_; +}; + +class LegacyInterfaceDBusStubAdapter: public LegacyInterfaceDBusStubAdapterInternal, public std::enable_shared_from_this<LegacyInterfaceDBusStubAdapter> { +public: + LegacyInterfaceDBusStubAdapter( + const std::shared_ptr<CommonAPI::DBus::DBusFactory>& factory, + const std::string& commonApiAddress, + const std::string& dbusInterfaceName, + const std::string& dbusBusName, + const std::string& dbusObjectPath, + const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection, + const std::shared_ptr<CommonAPI::StubBase>& stub) : + CommonAPI::DBus::DBusStubAdapter( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + false), + LegacyInterfaceDBusStubAdapterInternal( + factory, + commonApiAddress, + dbusInterfaceName, + dbusBusName, + dbusObjectPath, + dbusConnection, + stub) { } }; } // namespace service diff --git a/src/test/fake/legacy/service/LegacyInterfaceProxy.h b/src/test/fake/legacy/service/LegacyInterfaceProxy.h index f5c108c..5c6ae9d 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceProxy.h +++ b/src/test/fake/legacy/service/LegacyInterfaceProxy.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -12,6 +12,7 @@ #include "LegacyInterfaceProxyBase.h" + #if !defined (COMMONAPI_INTERNAL_COMPILATION) #define COMMONAPI_INTERNAL_COMPILATION #endif @@ -24,12 +25,14 @@ namespace legacy { namespace service { template <typename ... _AttributeExtensions> -class LegacyInterfaceProxy: virtual public LegacyInterface, virtual public LegacyInterfaceProxyBase, public _AttributeExtensions... { - public: +class LegacyInterfaceProxy: virtual public LegacyInterface, virtual public LegacyInterfaceProxyBase +, public _AttributeExtensions... { +public: LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate); ~LegacyInterfaceProxy(); - typedef typename fake::legacy::service::LegacyInterface InterfaceType; + typedef LegacyInterface InterfaceType; + @@ -93,7 +96,7 @@ class LegacyInterfaceProxy: virtual public LegacyInterface, virtual public Legac * It will provide the same value for CallStatus as will be handed to the callback. */ virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback callback); - + /** * Returns the CommonAPI address of the remote partner this proxy communicates with. @@ -223,7 +226,6 @@ CommonAPI::InterfaceVersionAttribute& LegacyInterfaceProxy<_AttributeExtensions. return delegate_->getInterfaceVersionAttribute(); } - } // namespace service } // namespace legacy diff --git a/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h b/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h index dbb4baa..41399bf 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h +++ b/src/test/fake/legacy/service/LegacyInterfaceProxyBase.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -18,6 +18,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Proxy.h> #include <functional> diff --git a/src/test/fake/legacy/service/LegacyInterfaceStub.h b/src/test/fake/legacy/service/LegacyInterfaceStub.h index c32c66e..6fbb0fd 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceStub.h +++ b/src/test/fake/legacy/service/LegacyInterfaceStub.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -19,6 +19,7 @@ #define COMMONAPI_INTERNAL_COMPILATION #endif +#include <vector> #include <CommonAPI/Stub.h> @@ -37,10 +38,9 @@ namespace service { class LegacyInterfaceStubAdapter: virtual public CommonAPI::StubAdapter, public LegacyInterface { public: - - + + virtual void deactivateManagedInstances() = 0; - protected: /** * Defines properties for storing the ClientIds of clients / proxies that have @@ -74,9 +74,10 @@ class LegacyInterfaceStubRemoteEvent { * This class and the one above are the ones an application developer needs to have * a look at if he wants to implement a service. */ -class LegacyInterfaceStub : public CommonAPI::Stub<LegacyInterfaceStubAdapter , LegacyInterfaceStubRemoteEvent> { - public: +class LegacyInterfaceStub : public virtual CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent> { +public: virtual ~LegacyInterfaceStub() { } + virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0; /// This is the method that will be called on remote calls on the method TestMethod. @@ -85,7 +86,10 @@ class LegacyInterfaceStub : public CommonAPI::Stub<LegacyInterfaceStubAdapter , virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, std::string& greeting, int32_t& identifier) = 0; /// This is the method that will be called on remote calls on the method finish. virtual void finish(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0; - + + using CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::initStubAdapter; + typedef CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType; + typedef CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType; }; } // namespace service diff --git a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp b/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp index db345e7..4fb1de8 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp +++ b/src/test/fake/legacy/service/LegacyInterfaceStubDefault.cpp @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -14,11 +14,16 @@ namespace legacy { namespace service { LegacyInterfaceStubDefault::LegacyInterfaceStubDefault(): - remoteEventHandler_(this) { + remoteEventHandler_(this), + interfaceVersion_(LegacyInterface::getInterfaceVersion()) { +} + +const CommonAPI::Version& LegacyInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) { + return interfaceVersion_; } LegacyInterfaceStubRemoteEvent* LegacyInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter>& stubAdapter) { - stubAdapter_ = stubAdapter; + CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::stubAdapter_ = stubAdapter; return &remoteEventHandler_; } diff --git a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h b/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h index 854aab5..6f50b07 100644 --- a/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h +++ b/src/test/fake/legacy/service/LegacyInterfaceStubDefault.h @@ -1,6 +1,6 @@ /* -* This file was generated by the CommonAPI Generators. -* Used org.genivi.commonapi.core 2.1.3.qualifier. +* This file was generated by the CommonAPI Generators. +* Used org.genivi.commonapi.core 2.1.4.qualifier. * Used org.franca.core 0.8.10.201309262002. * * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. @@ -10,6 +10,7 @@ #ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_H_ #define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_H_ + #include <fake/legacy/service/LegacyInterfaceStub.h> #include <sstream> @@ -27,12 +28,14 @@ namespace service { * that would be defined for this service, and/or if you do not need any non-default * behaviour. */ -class LegacyInterfaceStubDefault : public LegacyInterfaceStub { - public: +class LegacyInterfaceStubDefault : public virtual LegacyInterfaceStub { +public: LegacyInterfaceStubDefault(); LegacyInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter>& stubAdapter); + const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId); + virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> clientId, int32_t input, int32_t& val1, int32_t& val2); virtual void TestMethod(int32_t input, int32_t& val1, int32_t& val2); @@ -44,11 +47,10 @@ class LegacyInterfaceStubDefault : public LegacyInterfaceStub { virtual void finish(); - - protected: - std::shared_ptr<LegacyInterfaceStubAdapter> stubAdapter_; - private: + +protected: +private: class RemoteEventHandler: public LegacyInterfaceStubRemoteEvent { public: RemoteEventHandler(LegacyInterfaceStubDefault* defaultStub); @@ -60,6 +62,8 @@ class LegacyInterfaceStubDefault : public LegacyInterfaceStub { RemoteEventHandler remoteEventHandler_; + + CommonAPI::Version interfaceVersion_; }; } // namespace service diff --git a/src/test/test-interface-proxy.fidl b/src/test/test-interface-proxy.fidl index e2bd0e0..a80261a 100644 --- a/src/test/test-interface-proxy.fidl +++ b/src/test/test-interface-proxy.fidl @@ -94,3 +94,12 @@ interface TestInterface { } } +interface ExtendedInterface extends TestInterface { + version { major 1 minor 0 } + + method TestIntMethodExtended { + in { + UInt32 inInt + } + } +}
\ No newline at end of file |