summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürgen Gehring <Juergen.Gehring@bmw.de>2016-10-11 03:30:13 -0700
committerJürgen Gehring <Juergen.Gehring@bmw.de>2016-10-11 03:30:13 -0700
commitbdf7ab8cf3243619f0b8bc526f07e5b03624b94c (patch)
tree6ed18368c5fc5c70f3ad27525ab2515ee0817f37
parent3348a422ffc756b63de5890356383858a898e8b1 (diff)
downloadgenivi-common-api-dbus-runtime-bdf7ab8cf3243619f0b8bc526f07e5b03624b94c.tar.gz
CommonAPI-D-Bus 3.1.83.1.8
-rw-r--r--CMakeLists.txt62
-rw-r--r--CommonAPI-DBus.pc.in2
-rw-r--r--README2
-rw-r--r--include/CommonAPI/DBus/DBusAttribute.hpp13
-rw-r--r--include/CommonAPI/DBus/DBusClientId.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusConfig.hpp3
-rw-r--r--include/CommonAPI/DBus/DBusConnection.hpp67
-rw-r--r--include/CommonAPI/DBus/DBusDaemonProxy.hpp81
-rw-r--r--include/CommonAPI/DBus/DBusFactory.hpp19
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp50
-rw-r--r--include/CommonAPI/DBus/DBusInputStream.hpp110
-rw-r--r--include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp16
-rwxr-xr-xinclude/CommonAPI/DBus/DBusMainLoop.hpp8
-rw-r--r--include/CommonAPI/DBus/DBusMainLoopContext.hpp93
-rw-r--r--include/CommonAPI/DBus/DBusMessage.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusObjectManager.hpp3
-rw-r--r--include/CommonAPI/DBus/DBusObjectManagerStub.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusOutputStream.hpp15
-rw-r--r--include/CommonAPI/DBus/DBusProxy.hpp35
-rw-r--r--include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp31
-rw-r--r--include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp34
-rw-r--r--include/CommonAPI/DBus/DBusProxyBase.hpp7
-rw-r--r--include/CommonAPI/DBus/DBusProxyConnection.hpp27
-rw-r--r--include/CommonAPI/DBus/DBusProxyHelper.hpp103
-rw-r--r--include/CommonAPI/DBus/DBusProxyManager.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusSelectiveEvent.hpp25
-rw-r--r--include/CommonAPI/DBus/DBusServiceRegistry.hpp3
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapter.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapterHelper.hpp41
-rw-r--r--include/murmurhash/MurmurHash3.h8
-rw-r--r--src/CommonAPI/DBus/DBusConnection.cpp618
-rw-r--r--src/CommonAPI/DBus/DBusDaemonProxy.cpp63
-rw-r--r--src/CommonAPI/DBus/DBusError.cpp1
-rw-r--r--src/CommonAPI/DBus/DBusFactory.cpp121
-rw-r--r--src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp35
-rw-r--r--src/CommonAPI/DBus/DBusFunctionalHash.cpp21
-rw-r--r--src/CommonAPI/DBus/DBusInputStream.cpp16
-rwxr-xr-xsrc/CommonAPI/DBus/DBusMainLoop.cpp179
-rw-r--r--src/CommonAPI/DBus/DBusMainLoopContext.cpp321
-rw-r--r--src/CommonAPI/DBus/DBusMessage.cpp73
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.cpp143
-rw-r--r--src/CommonAPI/DBus/DBusObjectManagerStub.cpp151
-rw-r--r--src/CommonAPI/DBus/DBusOutputStream.cpp36
-rw-r--r--src/CommonAPI/DBus/DBusProxy.cpp306
-rw-r--r--src/CommonAPI/DBus/DBusProxyManager.cpp5
-rw-r--r--src/CommonAPI/DBus/DBusServiceRegistry.cpp222
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.cpp3
-rw-r--r--src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch8
-rw-r--r--src/pugixml/pugixml.cpp8
-rw-r--r--src/test/CMakeLists.txt213
-rw-r--r--src/test/DBusAddressTranslatorTest.cpp589
-rw-r--r--src/test/DBusBroadcastTest.cpp653
-rw-r--r--src/test/DBusCommunicationTest.cpp566
-rw-r--r--src/test/DBusConnectionTest.cpp44
-rw-r--r--src/test/DBusDaemonProxyTest.cpp26
-rw-r--r--src/test/DBusFactoryTest.cpp144
-rw-r--r--src/test/DBusFreedesktopPropertiesTest.cpp227
-rw-r--r--src/test/DBusInputStreamTest.cpp803
-rw-r--r--src/test/DBusLoadTest.cpp298
-rw-r--r--src/test/DBusMainLoopIntegrationTest.cpp536
-rw-r--r--src/test/DBusManagedTest.cpp1595
-rw-r--r--src/test/DBusMultipleConnectionTest.cpp149
-rw-r--r--src/test/DBusOutputStreamTest.cpp855
-rw-r--r--src/test/DBusPolymorphicTest.cpp254
-rw-r--r--src/test/DBusProxyTest.cpp515
-rw-r--r--src/test/DBusRuntimeTest.cpp91
-rw-r--r--src/test/DBusTestUtils.hpp92
-rw-r--r--src/test/DemoMainLoop.hpp382
-rw-r--r--src/test/README.txt10
-rw-r--r--src/test/fakeLegacyService.fdepl16
-rw-r--r--src/test/fakeLegacyService.fidl33
-rw-r--r--src/test/fakeLegacyService/fake.legacy.service.xml259
-rw-r--r--src/test/fakeLegacyService/fakeLegacyService.py83
-rw-r--r--src/test/fakeLegacyService/sendToFakeLegacyService.py37
-rw-r--r--src/test/leaf.fidl28
-rw-r--r--src/test/root.fidl56
-rw-r--r--src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp35
-rw-r--r--src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp524
-rw-r--r--src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp66
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp58
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp161
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp54
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp112
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp50
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp71
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp58
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp173
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp51
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp116
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp100
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp82
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp56
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp254
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp59
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp135
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp244
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp111
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp56
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManager.hpp57
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxy.hpp131
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp50
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStub.hpp111
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.cpp83
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp73
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp527
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp102
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp216
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp331
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp126
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp96
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp158
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp55
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp110
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp55
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp71
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp96
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp158
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp55
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp110
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp55
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp71
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp97
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp168
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp60
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp124
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.cpp134
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp80
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp59
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp133
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp52
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp113
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.cpp85
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp75
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp58
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp60
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxy.hpp134
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp50
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp110
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.cpp46
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.hpp72
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp215
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp61
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp116
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp65
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp73
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp20
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp102
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.cpp20
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.hpp58
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp28
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp43
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.cpp83
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp63
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp339
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp274
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp28
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp43
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp51
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp65
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp232
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp172
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp28
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp62
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp70
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp220
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp141
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp28
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.cpp426
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp94
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp531
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp253
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.cpp28
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp43
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.cpp50
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp63
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp149
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp108
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp105
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp64
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp109
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp114
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp105
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp64
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp109
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp114
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.cpp113
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp69
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp229
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp123
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp52
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp65
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp151
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp110
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.cpp166
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp68
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp139
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp132
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.cpp30
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp45
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.cpp55
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.hpp63
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.cpp157
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.hpp159
-rw-r--r--src/test/test-derived-types.fidl86
-rw-r--r--src/test/test-freedesktop-interface.fdepl16
-rw-r--r--src/test/test-freedesktop-interface.fidl23
-rw-r--r--src/test/test-interface-proxy.fidl111
-rw-r--r--src/test/test-predefined-types.fidl24
221 files changed, 2444 insertions, 24423 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2750c4e..4cb6030 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,7 @@ PROJECT(libcommonapi-dbus)
# version of CommonAPI-DBus
SET( LIBCOMMONAPI_DBUS_MAJOR_VERSION 3 )
SET( LIBCOMMONAPI_DBUS_MINOR_VERSION 1 )
-SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 5 )
+SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 8 )
message(STATUS "Project name: ${PROJECT_NAME}")
@@ -45,6 +45,18 @@ message(STATUS "USE_INSTALLED_COMMONAPI is set to value: ${USE_INSTALLED_COMMONA
OPTION(USE_INSTALLED_DBUS "Set to OFF to use the local (build tree) version of DBUS" ON)
message(STATUS "USE_INSTALLED_DBUS is set to value: ${USE_INSTALLED_DBUS}")
+OPTION(USE_FILE "Set to OFF to disable file logging" OFF )
+message(STATUS "USE_FILE is set to value: ${USE_FILE}")
+
+OPTION(USE_CONSOLE "Set to OFF to disable console logging" OFF )
+message(STATUS "USE_CONSOLE is set to value: ${USE_CONSOLE}")
+
+SET(DEFAULT_SEND_TIMEOUT "5000" CACHE STRING "default send timeout")
+message(STATUS "DEFAULT_SEND_TIMEOUT is set to value: ${DEFAULT_SEND_TIMEOUT} ms")
+
+SET(DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT "10000" CACHE STRING "dbus daemon proxy default send timeout")
+message(STATUS "DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT is set to value: ${DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT} ms")
+
SET(RPM_PACKAGE_VERSION "r0" CACHE STRING "rpm packet version") # used in e.g. commonapi-dbus.spec.in
if(NOT CMAKE_BUILD_TYPE)
@@ -59,6 +71,7 @@ SET(BUILD_SERVER_COMMONAPI_INSTALL_PATH "na" CACHE STRING "CommonAPI install pat
# Offer the user the choice of overriding the installation directories
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
+set (INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
set(INSTALL_INCLUDE_DIR include/CommonAPI-${COMMONAPI_API_HEADER_VERSION} CACHE PATH "Installation directory for header files")
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR cmake)
@@ -84,6 +97,16 @@ message(STATUS "MAX_LOG_LEVEL is set to value: ${MAX_LOG_LEVEL}")
SET( LICENSE "MPLv2" )
#########################################################
+IF(USE_FILE)
+ add_definitions(-DUSE_FILE)
+ENDIF(USE_FILE)
+IF(USE_CONSOLE)
+ add_definitions(-DUSE_CONSOLE)
+ENDIF(USE_CONSOLE)
+
+add_definitions(-DDEFAULT_SEND_TIMEOUT=${DEFAULT_SEND_TIMEOUT})
+add_definitions(-DDBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT=${DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT})
+
add_definitions( -DCOMMONAPI_DBUS_VERSION_MAJOR=${LIBCOMMONAPI_DBUS_MAJOR_VERSION} )
add_definitions( -DCOMMONAPI_DBUS_VERSION_MINOR=${LIBCOMMONAPI_DBUS_MINOR_VERSION} )
@@ -100,9 +123,9 @@ message(STATUS "CMAKE_FIND_ROOT_PATH: ${CMAKE_FIND_ROOT_PATH}")
FIND_PACKAGE(PkgConfig)
FIND_PACKAGE(Threads REQUIRED)
if ("${USE_INSTALLED_COMMONAPI}" STREQUAL "ON")
- FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI 3.1.8 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
- FIND_PACKAGE(CommonAPI 3.1.5 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI 3.1.8 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()
message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
@@ -116,12 +139,18 @@ if (MSVC)
if (DBus_DIR)
if (DBus_BUILD_DIR)
set(DBus_INCLUDE_DIRS "${DBus_DIR};${DBus_BUILD_DIR};")
- else ()
- message (FATAL_ERROR "DBus_BUILD_DIR not set! Cannot continue.")
- endif ()
- else()
- message (FATAL_ERROR "DBus_DIR not set! Cannot continue.")
- endif ()
+ set(DBus_LIBRARY_RELEASE "${DBus_BUILD_DIR}/bin/Release/dbus-1.lib")
+ set(DBus_LIBRARY_DEBUG "${DBus_BUILD_DIR}/bin/Debug/dbus-1d.lib")
+ endif()
+ endif()
+
+ if (NOT DBus_LIBRARIES)
+ include(SelectLibraryConfigurations)
+ select_library_configurations(DBus)
+ endif()
+ if (NOT DBus_INCLUDE_DIRS OR NOT DBus_LIBRARIES)
+ message(SEND_ERROR "Set DBus_INCLUDE_DIRS and DBus_LIBRARIES to your D-Bus installation (e.g. cmake -DDBus_INCLUDE_DIRS=C:\\D-Bus\\include -DDBus_LIBRARIES=C:\\DBus\\lib\\dbus-1.lib")
+ endif()
else()
pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
endif()
@@ -149,6 +178,7 @@ include_directories(
)
if ("${USE_INSTALLED_DBUS}" STREQUAL "OFF")
+ set (DBus_LIBRARIES dbus-1)
link_directories(
${DBus_INCLUDE_DIRS}/dbus/.libs
)
@@ -164,16 +194,15 @@ file(GLOB PUGIXML_SRCS "src/pugixml/*.cpp")
file(GLOB MMHASH_SRCS "src/murmurhash/*.cpp")
# CommonAPI-DBus library
-add_library(CommonAPI-DBus ${CAPIDB_SRCS} ${PUGIXML_SRCS} ${MMHASH_SRCS})
+add_library(CommonAPI-DBus SHARED ${CAPIDB_SRCS} ${PUGIXML_SRCS} ${MMHASH_SRCS})
-if(MSVC)
-#workaround since pkg-config on windows doesn't work easily and windows needs ws2_32 for the mainloop
-target_link_libraries(CommonAPI-DBus CommonAPI ws2_32 debug ${DBus_BUILD_DIR}/bin/Debug/dbus-1d.lib optimized ${DBus_BUILD_DIR}/bin/Release/dbus-1.lib)
-else()
-target_link_libraries(CommonAPI-DBus CommonAPI dbus-1)
+target_link_libraries(CommonAPI-DBus CommonAPI ${DBus_LIBRARIES})
+
+if (MSVC)
+ target_link_libraries(CommonAPI-DBus ws2_32 Rpcrt4)
endif()
-set_target_properties(CommonAPI-DBus PROPERTIES VERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}.${LIBCOMMONAPI_DBUS_PATCH_VERSION} SOVERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION} LINKER_LANGUAGE C)
+set_target_properties(CommonAPI-DBus PROPERTIES VERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}.${LIBCOMMONAPI_DBUS_PATCH_VERSION} SOVERSION ${LIBCOMMONAPI_DBUS_MAJOR_VERSION}.${LIBCOMMONAPI_DBUS_MINOR_VERSION}.${LIBCOMMONAPI_DBUS_PATCH_VERSION} LINKER_LANGUAGE C)
##############################################################################
@@ -191,6 +220,7 @@ set_target_properties (CommonAPI-DBus PROPERTIES PUBLIC_HEADER "${CommonAPI-DBus
# install CommonAPI-DBus library including headers
install(TARGETS CommonAPI-DBus
EXPORT CommonAPI-DBusTargets
+ RUNTIME DESTINATION ${INSTALL_BIN_DIR}
LIBRARY DESTINATION ${INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${INSTALL_LIB_DIR}
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}/CommonAPI/DBus"
diff --git a/CommonAPI-DBus.pc.in b/CommonAPI-DBus.pc.in
index e93ebee..9ca7b26 100644
--- a/CommonAPI-DBus.pc.in
+++ b/CommonAPI-DBus.pc.in
@@ -7,5 +7,7 @@ Name: @PROJECT@
Description: GENIVI Common API D-Bus C++ Library
Version: @COMPONENT_VERSION@
Libs: -L${libdir} -lCommonAPI-DBus
+Requires: CommonAPI
+Requires.private: dbus-1
Cflags: -I${includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@
diff --git a/README b/README
index 44c0097..595fa3e 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
-This is CommonAPI-DBus 3.1.5
+This is CommonAPI-DBus 3.1.8
Please refer to INSTALL for further information. \ No newline at end of file
diff --git a/include/CommonAPI/DBus/DBusAttribute.hpp b/include/CommonAPI/DBus/DBusAttribute.hpp
index ba3ca77..2fd5bd3 100644
--- a/include/CommonAPI/DBus/DBusAttribute.hpp
+++ b/include/CommonAPI/DBus/DBusAttribute.hpp
@@ -10,7 +10,6 @@
#ifndef COMMONAPI_DBUS_DBUS_ATTRIBUTE_HPP_
#define COMMONAPI_DBUS_DBUS_ATTRIBUTE_HPP_
-#include <cassert>
#include <cstdint>
#include <tuple>
@@ -35,7 +34,9 @@ public:
getMethodName_(getMethodName),
setMethodSignature_(setMethodSignature),
depl_(_depl) {
- assert(getMethodName);
+ if (NULL == getMethodName) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + ": getMethodName is NULL");
+ }
}
void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
@@ -84,8 +85,12 @@ public:
: DBusReadonlyAttribute<AttributeType_, AttributeDepl_>(_proxy, _setMethodSignature, _getMethodName, _depl),
setMethodName_(_setMethodName),
setMethodSignature_(_setMethodSignature) {
- assert(_setMethodName);
- assert(_setMethodSignature);
+ if (NULL == _setMethodName) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + ": _setMethodName is NULL");
+ }
+ if (NULL == _setMethodSignature) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + ": _setMethodSignature is NULL");
+ }
}
void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
diff --git a/include/CommonAPI/DBus/DBusClientId.hpp b/include/CommonAPI/DBus/DBusClientId.hpp
index 02e369f..982b4dd 100644
--- a/include/CommonAPI/DBus/DBusClientId.hpp
+++ b/include/CommonAPI/DBus/DBusClientId.hpp
@@ -24,7 +24,7 @@ class DBusMessage;
* This class represents the DBus specific implementation of CommonAPI::ClientId.
* It internally uses a string to identify clients. This string is the unique sender id used by dbus.
*/
-class DBusClientId
+class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusClientId
: public CommonAPI::ClientId {
friend struct std::hash<DBusClientId>;
diff --git a/include/CommonAPI/DBus/DBusConfig.hpp b/include/CommonAPI/DBus/DBusConfig.hpp
index dae6b7a..cb07461 100644
--- a/include/CommonAPI/DBus/DBusConfig.hpp
+++ b/include/CommonAPI/DBus/DBusConfig.hpp
@@ -15,8 +15,7 @@
namespace CommonAPI {
namespace DBus {
-static const Timeout_t DEFAULT_SEND_TIMEOUT_MS = 5000;
-static CommonAPI::CallInfo defaultCallInfo(DEFAULT_SEND_TIMEOUT_MS);
+static CommonAPI::CallInfo defaultCallInfo(CommonAPI::DEFAULT_SEND_TIMEOUT_MS);
} // namespace DBus
} // namespace CommonAPI
diff --git a/include/CommonAPI/DBus/DBusConnection.hpp b/include/CommonAPI/DBus/DBusConnection.hpp
index f2fd516..f79dc27 100644
--- a/include/CommonAPI/DBus/DBusConnection.hpp
+++ b/include/CommonAPI/DBus/DBusConnection.hpp
@@ -45,12 +45,14 @@ friend class DBusConnection;
};
struct WatchContext {
- WatchContext(std::weak_ptr<MainLoopContext> mainLoopContext, DispatchSource* dispatchSource) :
- mainLoopContext_(mainLoopContext), dispatchSource_(dispatchSource) {
+ WatchContext(std::weak_ptr<MainLoopContext> mainLoopContext, DispatchSource* dispatchSource,
+ std::weak_ptr<DBusConnection> dbusConnection) :
+ mainLoopContext_(mainLoopContext), dispatchSource_(dispatchSource), dbusConnection_(dbusConnection) {
}
std::weak_ptr<MainLoopContext> mainLoopContext_;
DispatchSource* dispatchSource_;
+ std::weak_ptr<DBusConnection> dbusConnection_;
};
class DBusConnection
@@ -107,13 +109,13 @@ public:
DBusSignalHandler* dbusSignalHandler,
const bool justAddFilter = false);
- COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
- const std::string& objectPath,
- const std::string& interfaceName,
- const std::string& interfaceMemberName,
- const std::string& interfaceMemberSignature,
- DBusSignalHandler* dbusSignalHandler,
- DBusProxy* callingProxy);
+ COMMONAPI_EXPORT void subscribeForSelectiveBroadcast(const std::string& objectPath,
+ const std::string& interfaceName,
+ const std::string& interfaceMemberName,
+ const std::string& interfaceMemberSignature,
+ DBusSignalHandler* dbusSignalHandler,
+ DBusProxy* callingProxy,
+ uint32_t tag);
COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
DBusProxyConnection::DBusSignalHandlerToken subscription,
@@ -136,11 +138,21 @@ public:
COMMONAPI_EXPORT bool isDispatchReady();
COMMONAPI_EXPORT bool singleDispatch();
+ COMMONAPI_EXPORT void dispatchDBusMessageReply(const DBusMessage& _reply,
+ DBusMessageReplyAsyncHandler* _dbusMessageReplyAsyncHandler);
COMMONAPI_EXPORT virtual bool hasDispatchThread();
COMMONAPI_EXPORT virtual const ConnectionId_t& getConnectionId() const;
+ COMMONAPI_EXPORT void incrementConnection();
+ COMMONAPI_EXPORT void decrementConnection();
+
+ COMMONAPI_EXPORT bool setDispatching(bool isDispatching);
+
+ COMMONAPI_EXPORT void pushDBusMessageReply(const DBusMessage& _reply,
+ std::unique_ptr<DBusMessageReplyAsyncHandler> _dbusMessageReplyAsyncHandler);
+
#ifdef COMMONAPI_DBUS_TEST
inline std::weak_ptr<DBusMainloop> getLoop() { return loop_; }
#endif
@@ -149,21 +161,29 @@ public:
typedef std::pair<uint32_t, std::string> DBusSignalMatchRuleMapping;
typedef std::unordered_map<DBusSignalMatchRuleTuple, DBusSignalMatchRuleMapping> DBusSignalMatchRulesMap;
private:
+
+ struct PendingCallNotificationData {
+ PendingCallNotificationData(const DBusConnection* _dbusConnection,
+ DBusMessageReplyAsyncHandler* _replyAsyncHandler) :
+ dbusConnection_(_dbusConnection),
+ replyAsyncHandler_(_replyAsyncHandler) { }
+
+ const DBusConnection* dbusConnection_;
+ DBusMessageReplyAsyncHandler* replyAsyncHandler_;
+ };
+
COMMONAPI_EXPORT void dispatch();
COMMONAPI_EXPORT void suspendDispatching() const;
COMMONAPI_EXPORT void resumeDispatching() const;
std::thread* dispatchThread_;
- bool stopDispatching_;
std::weak_ptr<MainLoopContext> mainLoopContext_;
+ DBusMessageWatch* msgWatch_;
+ DBusMessageDispatchSource* msgDispatchSource_;
DispatchSource* dispatchSource_;
WatchContext* watchContext_;
- mutable std::recursive_mutex sendLock_;
- mutable bool pauseDispatching_;
- mutable std::mutex dispatchSuspendLock_;
-
COMMONAPI_EXPORT void addLibdbusSignalMatchRule(const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
@@ -179,9 +199,11 @@ public:
COMMONAPI_EXPORT void initLibdbusObjectPathHandlerAfterConnect();
::DBusHandlerResult onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage);
- COMMONAPI_EXPORT static DBusMessage convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall,
- CallStatus& _callStatus);
+ COMMONAPI_EXPORT static DBusMessage convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall);
COMMONAPI_EXPORT static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void* userData);
+ void onLibdbusPendingCall(::DBusPendingCall* _libdbusPendingCall,
+ const DBusMessage& _reply,
+ DBusMessageReplyAsyncHandler* _dbusMessageReplyAsyncHandler) const;
COMMONAPI_EXPORT static void onLibdbusDataCleanup(void* userData);
COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
@@ -205,7 +227,8 @@ public:
COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const;
COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable();
- COMMONAPI_EXPORT bool sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName);
+ COMMONAPI_EXPORT void sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName,
+ DBusSignalHandler* dbusSignalHandler, uint32_t tag);
::DBusConnection* connection_;
mutable std::mutex connectionGuard_;
@@ -284,6 +307,16 @@ public:
mutable std::set<DBusMessageReplyAsyncHandler*> timeoutInfiniteAsyncHandlers_;
mutable std::mutex timeoutInfiniteAsyncHandlersMutex_;
+ uint32_t activeConnections_;
+ mutable std::mutex activeConnectionsMutex_;
+
+ bool isDisconnecting_;
+ bool isDispatching_;
+ bool isWaitingOnFinishedDispatching_;
+
+ std::set<std::thread::id> dispatchThreads_;
+ std::mutex dispatchMutex_;
+ std::condition_variable dispatchCondition_;
};
diff --git a/include/CommonAPI/DBus/DBusDaemonProxy.hpp b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
index 69541b6..0652654 100644
--- a/include/CommonAPI/DBus/DBusDaemonProxy.hpp
+++ b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
@@ -34,8 +34,14 @@ class StaticInterfaceVersionAttribute: public InterfaceVersionAttribute {
Version version_;
};
+#ifndef DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT
+#define DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT 10000
+#endif
+
+static const CommonAPI::CallInfo daemonProxyInfo(DBUS_DAEMON_PROXY_DEFAULT_SEND_TIMEOUT);
-class DBusDaemonProxy : public DBusProxyBase {
+class DBusDaemonProxy : public DBusProxyBase,
+ public std::enable_shared_from_this<DBusDaemonProxy> {
public:
typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
@@ -53,6 +59,10 @@ class DBusDaemonProxy : public DBusProxyBase {
COMMONAPI_EXPORT virtual bool isAvailable() const;
COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+ COMMONAPI_EXPORT virtual std::future<AvailabilityStatus> isAvailableAsync(
+ isAvailableAsyncCallback _callback,
+ const CallInfo *_info) const;
+
COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
@@ -64,14 +74,54 @@ class DBusDaemonProxy : public DBusProxyBase {
COMMONAPI_EXPORT NameOwnerChangedEvent& getNameOwnerChangedEvent();
COMMONAPI_EXPORT void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;
- COMMONAPI_EXPORT std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;
+
+ template <typename DelegateObjectType>
+ COMMONAPI_EXPORT std::future<CallStatus> listNamesAsync(typename DBusProxyAsyncCallbackHandler<DelegateObjectType,
+ std::vector<std::string>>::Delegate& delegate) const {
+ DBusMessage dbusMessage = createMethodCall("ListNames", "");
+ return getDBusConnection()->sendDBusMessageWithReplyAsync(
+ dbusMessage,
+ DBusProxyAsyncCallbackHandler<DelegateObjectType, std::vector<std::string>>::create(delegate, std::tuple<std::vector<std::string>>()),
+ &daemonProxyInfo);
+ }
COMMONAPI_EXPORT void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;
- COMMONAPI_EXPORT std::future<CallStatus> nameHasOwnerAsync(const std::string& busName,
- NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const;
+ template <typename DelegateObjectType>
+ COMMONAPI_EXPORT std::future<CallStatus> nameHasOwnerAsync(const std::string& busName,
+ typename DBusProxyAsyncCallbackHandler<DelegateObjectType,
+ bool>::Delegate& delegate) const {
+ DBusMessage dbusMessage = createMethodCall("NameHasOwner", "s");
+
+ DBusOutputStream outputStream(dbusMessage);
+ const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
+ if (!success) {
+ std::promise<CallStatus> promise;
+ promise.set_value(CallStatus::OUT_OF_MEMORY);
+ return promise.get_future();
+ }
+ outputStream.flush();
+
+ return getDBusConnection()->sendDBusMessageWithReplyAsync(
+ dbusMessage,
+ DBusProxyAsyncCallbackHandler<DelegateObjectType, bool>::create(delegate, std::tuple<bool>()),
+ &daemonProxyInfo);
+ }
+
+ template <typename DelegateObjectType>
COMMONAPI_EXPORT std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName,
- GetManagedObjectsAsyncCallback) const;
+ typename DBusProxyAsyncCallbackHandler<DelegateObjectType,
+ DBusObjectToInterfaceDict>::Delegate& delegate) const {
+ static DBusAddress address(forDBusServiceName, "/", "org.freedesktop.DBus.ObjectManager");
+ auto dbusMethodCallMessage = DBusMessage::createMethodCall(address, "GetManagedObjects", "");
+
+ return getDBusConnection()->sendDBusMessageWithReplyAsync(
+ dbusMethodCallMessage,
+ DBusProxyAsyncCallbackHandler<DelegateObjectType, DBusObjectToInterfaceDict>::create(
+ delegate, std::tuple<DBusObjectToInterfaceDict>()
+ ),
+ &daemonProxyInfo);
+ }
/**
* Get the unique connection/bus name of the primary owner of the name given
@@ -81,7 +131,26 @@ class DBusDaemonProxy : public DBusProxyBase {
*
* @return CallStatus::REMOTE_ERROR if the name is unknown, otherwise CallStatus::SUCCESS and the uniq name of the owner
*/
- std::future<CallStatus> getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const;
+ template <typename DelegateObjectType>
+ std::future<CallStatus> getNameOwnerAsync(const std::string& busName,
+ typename DBusProxyAsyncCallbackHandler<DelegateObjectType,
+ std::string>::Delegate& delegate) const {
+ DBusMessage dbusMessage = createMethodCall("GetNameOwner", "s");
+
+ DBusOutputStream outputStream(dbusMessage);
+ const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
+ if (!success) {
+ std::promise<CallStatus> promise;
+ promise.set_value(CallStatus::OUT_OF_MEMORY);
+ return promise.get_future();
+ }
+ outputStream.flush();
+
+ return getDBusConnection()->sendDBusMessageWithReplyAsync(
+ dbusMessage,
+ DBusProxyAsyncCallbackHandler<DelegateObjectType, std::string>::create(delegate, std::tuple<std::string>()),
+ &daemonProxyInfo);
+ }
private:
DBusEvent<NameOwnerChangedEvent, std::string, std::string, std::string> nameOwnerChangedEvent_;
diff --git a/include/CommonAPI/DBus/DBusFactory.hpp b/include/CommonAPI/DBus/DBusFactory.hpp
index fda0129..6ce0c7e 100644
--- a/include/CommonAPI/DBus/DBusFactory.hpp
+++ b/include/CommonAPI/DBus/DBusFactory.hpp
@@ -10,6 +10,7 @@
#ifndef COMMONAPI_DBUS_FACTORY_HPP_
#define COMMONAPI_DBUS_FACTORY_HPP_
+#include <list>
#include <map>
#include <CommonAPI/Export.hpp>
@@ -24,6 +25,8 @@ class DBusProxy;
class DBusProxyConnection;
class DBusStubAdapter;
+typedef void (*InterfaceInitFunction)(void);
+
typedef std::shared_ptr<DBusProxy>
(*ProxyCreateFunction)(const DBusAddress &_address,
const std::shared_ptr<DBusProxyConnection> &_connection);
@@ -40,6 +43,8 @@ public:
COMMONAPI_EXPORT Factory();
COMMONAPI_EXPORT virtual ~Factory();
+ COMMONAPI_EXPORT void init();
+
COMMONAPI_EXPORT void registerProxyCreateMethod(const std::string &_address,
ProxyCreateFunction _function);
@@ -84,6 +89,13 @@ public:
COMMONAPI_EXPORT bool registerManagedService(const std::shared_ptr<DBusStubAdapter> &_adapter);
COMMONAPI_EXPORT bool unregisterManagedService(const std::string &_address);
+ COMMONAPI_EXPORT void incrementConnection(std::shared_ptr<DBusProxyConnection>);
+ COMMONAPI_EXPORT void decrementConnection(std::shared_ptr<DBusProxyConnection>);
+ COMMONAPI_EXPORT void releaseConnection(const ConnectionId_t&, MainLoopContext*);
+
+ // Initialization
+ COMMONAPI_EXPORT void registerInterface(InterfaceInitFunction _function);
+
private:
COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(const ConnectionId_t &);
COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(std::shared_ptr<MainLoopContext>);
@@ -97,7 +109,10 @@ private:
private:
static std::shared_ptr<Factory> theFactory;
+ std::mutex connectionsMutex_;
std::map<ConnectionId_t, std::shared_ptr<DBusConnection>> connections_;
+
+ std::mutex contextConnectionsMutex_;
std::map<MainLoopContext *, std::shared_ptr<DBusConnection>> contextConnections_;
std::map<std::string, ProxyCreateFunction> proxyCreateFunctions_;
@@ -105,7 +120,9 @@ private:
ServicesMap services_;
- DBusType_t dBusBusType_;
+ std::list<InterfaceInitFunction> initializers_;
+ std::mutex initializerMutex_;
+ bool isInitialized_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
index 1c01da9..bc31a89 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
@@ -47,7 +47,7 @@ private:
std::weak_ptr<DBusProxyConnection> connection_;
std::shared_ptr<DBusStubAdapter> adapter_;
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusInterfacesMap;
+ typedef std::unordered_map<std::string, std::vector<std::shared_ptr<DBusStubAdapter>>> DBusInterfacesMap;
DBusInterfacesMap managedInterfaces_;
std::mutex dbusInterfacesLock_;
diff --git a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
index 4593400..ec55f4e 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
@@ -13,6 +13,16 @@
#include <CommonAPI/Struct.hpp>
#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
+# if _MSC_VER >= 1300
+/*
+* Diamond inheritance is used for the DBusSetAttributeStubDispatcher base class.
+* The Microsoft compiler put warning (C4250) using a desired c++ feature: "Delegating to a sister class"
+* A powerful technique that arises from using virtual inheritance is to delegate a method from a class in another class
+* by using a common abstract base class. This is also called cross delegation.
+*/
+# pragma warning( disable : 4250 )
+# endif
+
namespace CommonAPI {
namespace DBus {
@@ -139,46 +149,26 @@ struct DBusStubFreedesktopPropertiesSignalHelper;
template<typename DataType_, typename DeplType_>
struct DBusStubFreedesktopPropertiesSignalHelper {
- template <typename ValueType_>
- struct DBusPropertiesEntry
- : public CommonAPI::Struct<std::string, CommonAPI::Variant<ValueType_>> {
-
- DBusPropertiesEntry() = default;
- DBusPropertiesEntry(const std::string &_propertyName,
- const ValueType_ &_propertyValue) {
- std::get<0>(this->values_) = _propertyName;
- std::get<1>(this->values_) = _propertyValue;
- };
-
- const std::string &getPropertyName() const { return std::get<0>(this->values_); }
- void setPropertyName(const std::string &_value) { std::get<0>(this->values_) = _value; }
-
- const ValueType_ getPropertyValue() const { return std::get<1>(this->values_); }
- void setPropertyValue(const ValueType_ &_value) { std::get<1>(this->values_) = _value; }
- };
-
- typedef std::vector<DBusPropertiesEntry<DataType_>> PropertiesArray;
- typedef CommonAPI::Deployment<CommonAPI::EmptyDeployment, VariantDeployment<DeplType_>> PropertyDeployment;
- typedef CommonAPI::ArrayDeployment<PropertyDeployment> PropertiesDeployment;
- typedef CommonAPI::Deployable<PropertiesArray, PropertiesDeployment> DeployedPropertiesArray;
+ typedef std::unordered_map<std::string, Variant<DataType_>> PropertyMap;
+ typedef MapDeployment<EmptyDeployment, VariantDeployment<DeplType_>> PropertyMapDeployment;
+ typedef Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap;
template <typename StubClass_>
static bool sendPropertiesChangedSignal(const StubClass_ &_stub, const std::string &_propertyName, const DataType_ &_inArg, DeplType_ *_depl) {
const std::vector<std::string> invalidatedProperties;
- PropertiesArray changedProperties;
- DBusPropertiesEntry<DataType_> entry(_propertyName, _inArg);
- changedProperties.push_back(entry);
- VariantDeployment<DeplType_> actualDepl(true, _depl);
- PropertyDeployment propertyDeployment(nullptr, &actualDepl);
- PropertiesDeployment changedPropertiesDeployment(&propertyDeployment);
+ // fill out property map
+ PropertyMap changedProperties;
+ changedProperties[_propertyName] = _inArg;
- DeployedPropertiesArray deployedChangedProperties(changedProperties, &changedPropertiesDeployment);
+ VariantDeployment<DeplType_> actualDepl(true, _depl);
+ PropertyMapDeployment changedPropertiesDeployment(nullptr, &actualDepl);
+ DeployedPropertyMap deployedChangedProperties(changedProperties, &changedPropertiesDeployment);
return DBusStubSignalHelper<
DBusSerializableArguments<
const std::string,
- DeployedPropertiesArray,
+ DeployedPropertyMap,
std::vector<std::string>
>
>::sendSignal(
diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp
index 9a3f74d..ec6c7d0 100644
--- a/include/CommonAPI/DBus/DBusInputStream.hpp
+++ b/include/CommonAPI/DBus/DBusInputStream.hpp
@@ -14,11 +14,11 @@
#include <iomanip>
#include <sstream>
-#include <cassert>
#include <cstdint>
#include <stack>
#include <string>
#include <vector>
+#include <cstring>
#include <CommonAPI/Export.hpp>
#include <CommonAPI/InputStream.hpp>
@@ -73,7 +73,7 @@ public:
COMMONAPI_EXPORT InputStream &readValue(Version &_value, const EmptyDeployment *_depl);
COMMONAPI_EXPORT void beginReadMapOfSerializableStructs() {
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
pushSize(itsSize);
align(8); /* correct alignment for first DICT_ENTRY */
@@ -90,10 +90,12 @@ public:
}
COMMONAPI_EXPORT InputStream &skipMap() {
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
align(8); /* skip padding (if any) */
- assert(itsSize <= (sizes_.top() + positions_.top() - current_));
+ if (itsSize > (sizes_.top() + positions_.top() - current_)) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + ": size ", itsSize, " exceeds remaining ", (sizes_.top() + positions_.top() - current_));
+ }
_readRaw(itsSize);
return (*this);
}
@@ -103,6 +105,10 @@ public:
Base_ tmpValue;
readValue(tmpValue, _depl);
_value = tmpValue;
+
+ if(!_value.validate()) {
+ setError();
+ }
return (*this);
}
@@ -118,7 +124,7 @@ public:
template<class Deployment_, class PolymorphicStruct_>
COMMONAPI_EXPORT InputStream &readValue(std::shared_ptr<PolymorphicStruct_> &_value,
const Deployment_ *_depl) {
- uint32_t serial;
+ uint32_t serial(0);
align(8);
_readValue(serial);
skipSignature();
@@ -135,8 +141,13 @@ public:
COMMONAPI_EXPORT InputStream &readValue(Variant<Types_...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
(void)_depl;
if(_value.hasValue()) {
- DeleteVisitor<_value.maxSize> visitor(_value.valueStorage_);
- ApplyVoidVisitor<DeleteVisitor<_value.maxSize>,
+#if _MSC_VER < 1900
+ const auto maxSize = Variant<Types_...>::maxSize;
+#else
+ constexpr auto maxSize = Variant<Types_...>::maxSize;
+#endif
+ DeleteVisitor<maxSize> visitor(_value.valueStorage_);
+ ApplyVoidVisitor<DeleteVisitor<maxSize>,
Variant<Types_...>, Types_... >::visit(visitor, _value);
}
@@ -154,8 +165,13 @@ public:
template<typename Deployment_, typename... Types_>
COMMONAPI_EXPORT InputStream &readValue(Variant<Types_...> &_value, const Deployment_ *_depl) {
if(_value.hasValue()) {
- DeleteVisitor<_value.maxSize> visitor(_value.valueStorage_);
- ApplyVoidVisitor<DeleteVisitor<_value.maxSize>,
+#if _MSC_VER < 1900
+ const auto maxSize = Variant<Types_...>::maxSize;
+#else
+ constexpr auto maxSize = Variant<Types_...>::maxSize;
+#endif
+ DeleteVisitor<maxSize> visitor(_value.valueStorage_);
+ ApplyVoidVisitor<DeleteVisitor<maxSize>,
Variant<Types_...>, Types_... >::visit(visitor, _value);
}
@@ -163,20 +179,32 @@ public:
// Read signature
uint8_t signatureLength;
readValue(signatureLength, static_cast<EmptyDeployment *>(nullptr));
- std::string signature(_readRaw(signatureLength+1), signatureLength);
-
- // Determine index (value type) from signature
- TypeCompareVisitor<Types_...> visitor(signature);
- bool success = ApplyTypeCompareVisitor<
- TypeCompareVisitor<Types_...>,
- Variant<Types_...>,
- Deployment_,
- Types_...
- >::visit(visitor, _value, _depl, _value.valueType_);
- if (!success) {
- _value.valueType_ = 0; // Invalid index
- setError();
+ char * raw = _readRaw(signatureLength+1);
+ if (hasError()) {
return (*this);
+ } else {
+ std::string signature(raw, signatureLength);
+
+ // Determine index (value type) from signature
+ TypeCompareVisitor<Types_...> visitor(signature);
+ bool success = ApplyTypeCompareVisitor<
+ TypeCompareVisitor<Types_...>,
+ Variant<Types_...>,
+ Deployment_,
+ Types_...
+ >::visit(visitor, _value, _depl, _value.valueType_);
+ /*
+ * It is possible that this ApplyTypeCompareVisitor fails on purpose,
+ * if the data type of the variant does not match the data type in the stream.
+ * This can happen for instance with the Freedesktop messages that return
+ * data in variants, but we don't have any idea _which variant_ until we've
+ * tried to stream the value in the ApplyTypeComputerVisitor.
+ */
+ if (!success) {
+ _value.valueType_ = 0; // Invalid index signifying 'no value'
+ setError();
+ return (*this);
+ }
}
} else {
align(8);
@@ -196,7 +224,7 @@ public:
COMMONAPI_EXPORT InputStream &readValue(std::vector<ElementType_> &_value, const EmptyDeployment *_depl) {
(void)_depl;
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
pushSize(itsSize);
@@ -222,9 +250,27 @@ public:
return (*this);
}
+ COMMONAPI_EXPORT InputStream &readValue(std::vector<uint8_t> &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
+
+ uint32_t itsSize(0);
+ _readValue(itsSize);
+
+ alignVector<uint8_t>();
+
+ uint8_t *data = reinterpret_cast<uint8_t *>(_readRaw(itsSize));
+ if (!hasError()) {
+ _value.resize(itsSize);
+ std::memcpy(_value.data(), data, itsSize);
+ }
+
+ return (*this);
+ }
+
+
template<class Deployment_, typename ElementType_>
COMMONAPI_EXPORT InputStream &readValue(std::vector<ElementType_> &_value, const Deployment_ *_depl) {
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
pushSize(itsSize);
@@ -256,7 +302,7 @@ public:
typedef typename std::unordered_map<KeyType_, ValueType_, HasherType_>::value_type MapElement;
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
pushSize(itsSize);
@@ -291,7 +337,7 @@ public:
typedef typename std::unordered_map<KeyType_, ValueType_, HasherType_>::value_type MapElement;
- uint32_t itsSize;
+ uint32_t itsSize(0);
_readValue(itsSize);
pushSize(itsSize);
@@ -395,7 +441,10 @@ public:
if (sizeof(_value) > 1)
align(sizeof(Type_));
- _value = *(reinterpret_cast<Type_ *>(_readRaw(sizeof(Type_))));
+ char * raw = _readRaw(sizeof(Type_));
+ if (!hasError()) {
+ _value = *(reinterpret_cast<Type_ *>(raw));
+ }
return (*this);
}
@@ -403,7 +452,10 @@ public:
COMMONAPI_EXPORT DBusInputStream &_readValue(float &_value) {
align(sizeof(double));
- _value = (float) (*(reinterpret_cast<double*>(_readRaw(sizeof(double)))));
+ char * raw = _readRaw(sizeof(double));
+ if (!hasError()) {
+ _value = (float) (*(reinterpret_cast<double*>(raw)));
+ }
return (*this);
}
@@ -415,7 +467,7 @@ private:
COMMONAPI_EXPORT size_t popSize();
inline void skipSignature() {
- uint8_t length;
+ uint8_t length(0);
_readValue(length);
_readRaw(length + 1);
}
diff --git a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
index 6c6c9e1..ec2d70f 100644
--- a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
+++ b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
@@ -80,14 +80,18 @@ class DBusInstanceAvailabilityStatusChangedEvent:
DBusInterfacesAndPropertiesDict dbusInterfacesAndPropertiesDict;
dbusInputStream >> dbusObjectPath;
- assert(!dbusInputStream.hasError());
+ if (dbusInputStream.hasError()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " failed to read object path");
+ }
dbusInputStream.beginReadMapOfSerializableStructs();
while (!dbusInputStream.readMapCompleted()) {
dbusInputStream.align(8);
dbusInputStream >> dbusInterfaceName;
dbusInputStream.skipMap();
- assert(!dbusInputStream.hasError());
+ if (dbusInputStream.hasError()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " failed to read interface name");
+ }
if(dbusInterfaceName == observedInterfaceName_) {
notifyInterfaceStatusChanged(dbusObjectPath, dbusInterfaceName, AvailabilityStatus::AVAILABLE);
}
@@ -101,10 +105,14 @@ class DBusInstanceAvailabilityStatusChangedEvent:
std::vector<std::string> dbusInterfaceNames;
dbusInputStream >> dbusObjectPath;
- assert(!dbusInputStream.hasError());
+ if (dbusInputStream.hasError()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " failed to read object path");
+ }
dbusInputStream >> dbusInterfaceNames;
- assert(!dbusInputStream.hasError());
+ if (dbusInputStream.hasError()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " failed to read interface names");
+ }
for (const auto& dbusInterfaceName : dbusInterfaceNames) {
if(dbusInterfaceName == observedInterfaceName_) {
diff --git a/include/CommonAPI/DBus/DBusMainLoop.hpp b/include/CommonAPI/DBus/DBusMainLoop.hpp
index 2fff847..b09a8f1 100755
--- a/include/CommonAPI/DBus/DBusMainLoop.hpp
+++ b/include/CommonAPI/DBus/DBusMainLoop.hpp
@@ -75,6 +75,8 @@ class DBusMainLoop {
COMMONAPI_EXPORT void wakeup();
COMMONAPI_EXPORT void wakeupAck();
+ COMMONAPI_EXPORT void cleanup();
+
COMMONAPI_EXPORT void registerFileDescriptor(const DBusMainLoopPollFd& fileDescriptor);
COMMONAPI_EXPORT void unregisterFileDescriptor(const DBusMainLoopPollFd& fileDescriptor);
@@ -158,9 +160,9 @@ class DBusMainLoop {
std::mutex watchesMutex_;
std::mutex timeoutsMutex_;
- std::set<DispatchSourceToDispatchStruct*> sourcesToDispatch_;
- std::set<WatchToDispatchStruct*> watchesToDispatch_;
- std::set<TimeoutToDispatchStruct*> timeoutsToDispatch_;
+ std::set<std::pair<DispatchPriority, DispatchSourceToDispatchStruct*>> sourcesToDispatch_;
+ std::set<std::pair<DispatchPriority, WatchToDispatchStruct*>> watchesToDispatch_;
+ std::set<std::pair<DispatchPriority, TimeoutToDispatchStruct*>> timeoutsToDispatch_;
DispatchSourceListenerSubscription dispatchSourceListenerSubscription_;
WatchListenerSubscription watchListenerSubscription_;
diff --git a/include/CommonAPI/DBus/DBusMainLoopContext.hpp b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
index 8cf9cf2..c048c90 100644
--- a/include/CommonAPI/DBus/DBusMainLoopContext.hpp
+++ b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
@@ -12,11 +12,14 @@
#include <list>
#include <memory>
+#include <queue>
#include <dbus/dbus.h>
#include <CommonAPI/MainLoopContext.hpp>
+#include <CommonAPI/DBus/DBusProxyConnection.hpp>
+
namespace CommonAPI {
namespace DBus {
@@ -35,9 +38,26 @@ class DBusDispatchSource: public DispatchSource {
DBusConnection* dbusConnection_;
};
+class DBusMessageWatch;
+class DBusMessageDispatchSource: public DispatchSource {
+ public:
+ DBusMessageDispatchSource(DBusMessageWatch* watch);
+ virtual ~DBusMessageDispatchSource();
+
+ bool prepare(int64_t& timeout);
+ bool check();
+ bool dispatch();
+
+ private:
+ DBusMessageWatch* watch_;
+
+ std::mutex watchMutex_;
+};
+
class DBusWatch: public Watch {
public:
- DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>& mainLoopContext);
+ DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>& mainLoopContext,
+ std::weak_ptr<DBusConnection>& dbusConnection);
bool isReadyToBeWatched();
void startWatching();
@@ -61,10 +81,81 @@ class DBusWatch: public Watch {
std::vector<DispatchSource*> dependentDispatchSources_;
std::weak_ptr<MainLoopContext> mainLoopContext_;
+ std::weak_ptr<DBusConnection> dbusConnection_;
+
+#ifdef WIN32
+ HANDLE wsaEvent_;
+#endif
+};
+
+class DBusMessageWatch : public Watch {
+public:
+
+ struct MsgQueueEntry {
+ MsgQueueEntry(DBusMessage _message) :
+ message_(_message) { }
+ DBusMessage message_;
+
+ virtual void process(std::shared_ptr<DBusConnection> _connection) = 0;
+ virtual void clear();
+ };
+
+ struct MsgReplyQueueEntry : MsgQueueEntry {
+ MsgReplyQueueEntry(DBusProxyConnection::DBusMessageReplyAsyncHandler* _replyAsyncHandler,
+ DBusMessage _reply) :
+ MsgQueueEntry(_reply),
+ replyAsyncHandler_(_replyAsyncHandler) { }
+
+ DBusProxyConnection::DBusMessageReplyAsyncHandler* replyAsyncHandler_;
+
+ void process(std::shared_ptr<DBusConnection> _connection);
+ void clear();
+ };
+
+ DBusMessageWatch(std::shared_ptr<DBusConnection> _connection);
+ virtual ~DBusMessageWatch();
+
+ void dispatch(unsigned int eventFlags);
+
+ const pollfd& getAssociatedFileDescriptor();
#ifdef WIN32
+ const HANDLE& getAssociatedEvent();
+#endif
+
+ const std::vector<DispatchSource*>& getDependentDispatchSources();
+
+ void addDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource);
+
+ void removeDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource);
+
+ void pushMsgQueue(std::shared_ptr<MsgQueueEntry> _queueEntry);
+
+ void popMsgQueue();
+
+ std::shared_ptr<MsgQueueEntry> frontMsgQueue();
+
+ bool emptyMsgQueue();
+
+ void processMsgQueueEntry(std::shared_ptr<MsgQueueEntry> _queueEntry);
+
+private:
+ int pipeFileDescriptors_[2];
+
+ pollfd pollFileDescriptor_;
+ std::vector<CommonAPI::DispatchSource*> dependentDispatchSources_;
+ std::queue<std::shared_ptr<MsgQueueEntry>> msgQueue_;
+
+ std::mutex msgQueueMutex_;
+
+ std::weak_ptr<DBusConnection> connection_;
+
+ const int pipeValue_;
+#ifdef WIN32
HANDLE wsaEvent_;
+ OVERLAPPED ov;
#endif
+
};
diff --git a/include/CommonAPI/DBus/DBusMessage.hpp b/include/CommonAPI/DBus/DBusMessage.hpp
index 0519e9d..b005904 100644
--- a/include/CommonAPI/DBus/DBusMessage.hpp
+++ b/include/CommonAPI/DBus/DBusMessage.hpp
@@ -93,6 +93,8 @@ public:
bool setBodyLength(const int bodyLength);
bool setDestination(const char* destination);
+ void setSerial(const unsigned int serial) const;
+
private:
::DBusMessage *message_;
diff --git a/include/CommonAPI/DBus/DBusObjectManager.hpp b/include/CommonAPI/DBus/DBusObjectManager.hpp
index e2ec2c5..2d36aaf 100644
--- a/include/CommonAPI/DBus/DBusObjectManager.hpp
+++ b/include/CommonAPI/DBus/DBusObjectManager.hpp
@@ -50,8 +50,9 @@ class DBusObjectManager {
COMMONAPI_EXPORT bool onFreedesktopPropertiesDBusMessage(const DBusMessage& callMessage);
- typedef std::unordered_map<DBusInterfaceHandlerPath, std::shared_ptr<DBusInterfaceHandler>> DBusRegisteredObjectsTable;
+ typedef std::unordered_map<DBusInterfaceHandlerPath, std::vector<std::shared_ptr<DBusInterfaceHandler>>> DBusRegisteredObjectsTable;
DBusRegisteredObjectsTable dbusRegisteredObjectsTable_;
+ COMMONAPI_EXPORT bool addToRegisteredObjectsTable(DBusInterfaceHandlerPath ifpath, std::shared_ptr<DBusInterfaceHandler> handler);
std::shared_ptr<DBusObjectManagerStub> rootDBusObjectManagerStub_;
diff --git a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
index 6d88951..de8495d 100644
--- a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
+++ b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
@@ -112,7 +112,7 @@ public:
std::string dbusObjectPath_;
std::weak_ptr<DBusProxyConnection> dbusConnection_;
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> DBusInterfacesMap;
+ typedef std::unordered_map<std::string, std::vector<std::shared_ptr<DBusStubAdapter>>> DBusInterfacesMap;
typedef std::unordered_map<std::string, DBusInterfacesMap> DBusObjectPathsMap;
DBusObjectPathsMap registeredDBusObjectPathsMap_;
diff --git a/include/CommonAPI/DBus/DBusOutputStream.hpp b/include/CommonAPI/DBus/DBusOutputStream.hpp
index b99c9c8..6814430 100644
--- a/include/CommonAPI/DBus/DBusOutputStream.hpp
+++ b/include/CommonAPI/DBus/DBusOutputStream.hpp
@@ -10,7 +10,6 @@
#ifndef COMMONAPI_DBUS_DBUSOUTPUTSTREAM_HPP_
#define COMMONAPI_DBUS_DBUSOUTPUTSTREAM_HPP_
-#include <cassert>
#include <cstring>
#include <memory>
#include <stack>
@@ -231,6 +230,14 @@ public:
return (*this);
}
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<uint8_t> &_value,
+ const EmptyDeployment *_depl) {
+ (void)_depl;
+ align(sizeof(uint32_t));
+ writeByteBuffer(_value.data(), static_cast<uint32_t>(_value.size()));
+ return (*this);
+ }
+
template<class Deployment_, typename ElementType_>
COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<ElementType_> &_value,
const Deployment_ *_depl) {
@@ -405,13 +412,17 @@ private:
template<typename Type_>
COMMONAPI_EXPORT void _writeValueAt(size_t _position, const Type_ &_value) {
- assert(_position + sizeof(Type_) <= payload_.size());
+ if ((_position + sizeof(Type_)) > payload_.size()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + ": payload size ", payload_.size(), " too small ", (_position + sizeof(Type_)));
+ }
_writeRawAt(reinterpret_cast<const char *>(&_value),
sizeof(Type_), _position);
}
COMMONAPI_EXPORT DBusOutputStream &writeString(const char *_data, const uint32_t &_length);
+ COMMONAPI_EXPORT DBusOutputStream &writeByteBuffer(const uint8_t *_date, const uint32_t &_length);
+
/**
* Takes sizeInByte characters, starting from the character which val points to, and stores them for later writing.
* When calling flush(), all values that were written to this stream are copied into the payload of the #DBusMessage.
diff --git a/include/CommonAPI/DBus/DBusProxy.hpp b/include/CommonAPI/DBus/DBusProxy.hpp
index 04f2ca9..c8a57bc 100644
--- a/include/CommonAPI/DBus/DBusProxy.hpp
+++ b/include/CommonAPI/DBus/DBusProxy.hpp
@@ -36,8 +36,9 @@ class DBusProxyStatusEvent
};
-class DBusProxy
- : public DBusProxyBase {
+class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusProxy
+ : public DBusProxyBase,
+ public std::enable_shared_from_this<DBusProxy> {
public:
COMMONAPI_EXPORT DBusProxy(const DBusAddress &_address,
const std::shared_ptr<DBusProxyConnection> &_connection);
@@ -48,14 +49,20 @@ public:
COMMONAPI_EXPORT virtual bool isAvailable() const;
COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+ COMMONAPI_EXPORT virtual std::future<AvailabilityStatus> isAvailableAsync(
+ isAvailableAsyncCallback _callback,
+ const CallInfo *_info) const;
- COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcastOnConnection(
- bool& subscriptionAccepted,
+ COMMONAPI_EXPORT void subscribeForSelectiveBroadcastOnConnection(
const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& interfaceMemberSignature,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ uint32_t tag);
+
+ COMMONAPI_EXPORT void insertSelectiveSubscription(const std::string& interfaceMemberName,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler, uint32_t tag);
COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
DBusProxyConnection::DBusSignalHandlerToken subscription,
const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
@@ -119,10 +126,11 @@ private:
const uint32_t tag);
COMMONAPI_EXPORT void addSignalMemberHandlerToQueue(SignalMemberHandlerTuple& _signalMemberHandler);
+ COMMONAPI_EXPORT void availabilityTimeoutThreadHandler() const;
+
DBusProxyStatusEvent dbusProxyStatusEvent_;
DBusServiceRegistry::DBusServiceSubscription dbusServiceRegistrySubscription_;
AvailabilityStatus availabilityStatus_;
- mutable std::mutex availabilityStatusMutex_;
DBusReadonlyAttribute<InterfaceVersionAttribute> interfaceVersionAttribute_;
@@ -132,11 +140,22 @@ private:
mutable std::condition_variable availabilityCondition_;
std::list<SignalMemberHandlerTuple> signalMemberHandlerQueue_;
- CallInfo signalMemberHandlerInfo_;
mutable std::mutex signalMemberHandlerQueueMutex_;
- std::map<std::string, DBusProxyConnection::DBusSignalHandler*> selectiveBroadcastHandlers;
+ std::map<std::string, std::pair<DBusProxyConnection::DBusSignalHandler*, uint32_t>> selectiveBroadcastHandlers;
mutable std::mutex selectiveBroadcastHandlersMutex_;
+
+ mutable std::shared_ptr<std::thread> availabilityTimeoutThread_;
+ mutable std::mutex availabilityTimeoutThreadMutex_;
+ mutable std::mutex timeoutsMutex_;
+ mutable std::condition_variable availabilityTimeoutCondition_;
+
+ typedef std::tuple<
+ std::chrono::time_point<std::chrono::high_resolution_clock>,
+ isAvailableAsyncCallback,
+ std::promise<AvailabilityStatus>
+ > AvailabilityTimeout_t;
+ mutable std::list<AvailabilityTimeout_t> timeouts_;
};
diff --git a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
index 0a0ee56..c36ccb1 100644
--- a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
+++ b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
@@ -22,21 +22,31 @@
namespace CommonAPI {
namespace DBus {
-template<typename ... ArgTypes_>
+template<typename DelegateObjectType_, typename ... ArgTypes_>
class DBusProxyAsyncCallbackHandler:
public DBusProxyConnection::DBusMessageReplyAsyncHandler {
public:
- typedef std::function<void(CallStatus, ArgTypes_...)> FunctionType;
+
+ struct Delegate {
+ typedef std::function<void(CallStatus, ArgTypes_...)> FunctionType;
+
+ Delegate(std::shared_ptr<DelegateObjectType_> object, FunctionType function) :
+ function_(std::move(function)) {
+ object_ = object;
+ }
+ std::weak_ptr<DelegateObjectType_> object_;
+ FunctionType function_;
+ };
static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType&& callback, std::tuple<ArgTypes_...> args) {
+ Delegate& delegate, std::tuple<ArgTypes_...> args) {
return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
- new DBusProxyAsyncCallbackHandler(std::move(callback), args));
+ new DBusProxyAsyncCallbackHandler<DelegateObjectType_, ArgTypes_...>(std::move(delegate), args));
}
DBusProxyAsyncCallbackHandler() = delete;
- DBusProxyAsyncCallbackHandler(FunctionType&& callback, std::tuple<ArgTypes_...> args)
- : callback_(std::move(callback)),
+ DBusProxyAsyncCallbackHandler(Delegate&& delegate, std::tuple<ArgTypes_...> args)
+ : delegate_(std::move(delegate)),
args_(args),
executionStarted_(false),
executionFinished_(false),
@@ -67,7 +77,7 @@ class DBusProxyAsyncCallbackHandler:
virtual void setExecutionFinished() {
executionFinished_ = true;
// free assigned std::function<> immediately
- callback_ = [](CallStatus, ArgTypes_...) {};
+ delegate_.function_ = [](CallStatus, ArgTypes_...) {};
}
virtual bool getExecutionFinished() {
@@ -124,12 +134,15 @@ class DBusProxyAsyncCallbackHandler:
}
}
- callback_(callStatus, std::move(std::get<ArgIndices_>(argTuple))...);
+ //check if object is expired
+ if(!delegate_.object_.expired())
+ delegate_.function_(callStatus, std::move(std::get<ArgIndices_>(argTuple))...);
+
return callStatus;
}
std::promise<CallStatus> promise_;
- FunctionType callback_;
+ Delegate delegate_;
std::tuple<ArgTypes_...> args_;
bool executionStarted_;
bool executionFinished_;
diff --git a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
index f6d7791..11cb354 100644
--- a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
+++ b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
@@ -21,22 +21,33 @@
namespace CommonAPI {
namespace DBus {
+template <typename DelegateObjectType_>
class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBusMessageReplyAsyncHandler {
public:
- typedef std::function<void(CallStatus, DBusMessage, DBusProxyConnection::DBusSignalHandler*, int)> FunctionType;
+
+ struct Delegate {
+ typedef std::function<void(CallStatus, DBusMessage, DBusProxyConnection::DBusSignalHandler*, uint32_t)> FunctionType;
+
+ Delegate(std::shared_ptr<DelegateObjectType_> object, FunctionType function) :
+ function_(std::move(function)) {
+ object_ = object;
+ }
+ std::weak_ptr<DelegateObjectType_> object_;
+ FunctionType function_;
+ };
static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType& callback, DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const int tag) {
+ Delegate& delegate, DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ const uint32_t tag) {
return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
- new DBusProxyAsyncSignalMemberCallbackHandler(std::move(callback), dbusSignalHandler, tag));
+ new DBusProxyAsyncSignalMemberCallbackHandler<DelegateObjectType_>(std::move(delegate), dbusSignalHandler, tag));
}
DBusProxyAsyncSignalMemberCallbackHandler() = delete;
- DBusProxyAsyncSignalMemberCallbackHandler(FunctionType&& callback,
+ DBusProxyAsyncSignalMemberCallbackHandler(Delegate&& delegate,
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const int tag):
- callback_(std::move(callback)), dbusSignalHandler_(dbusSignalHandler), tag_(tag),
+ const uint32_t tag):
+ delegate_(std::move(delegate)), dbusSignalHandler_(dbusSignalHandler), tag_(tag),
executionStarted_(false), executionFinished_(false),
timeoutOccurred_(false), hasToBeDeleted_(false) {
}
@@ -94,14 +105,17 @@ class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBu
inline CallStatus handleDBusMessageReply(const CallStatus dbusMessageCallStatus, const DBusMessage& dbusMessage) const {
CallStatus callStatus = dbusMessageCallStatus;
- callback_(callStatus, dbusMessage, dbusSignalHandler_, tag_);
+ //check if object is expired
+ if(!delegate_.object_.expired())
+ delegate_.function_(callStatus, dbusMessage, dbusSignalHandler_, tag_);
+
return callStatus;
}
std::promise<CallStatus> promise_;
- const FunctionType callback_;
+ const Delegate delegate_;
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler_;
- const int tag_;
+ const uint32_t tag_;
bool executionStarted_;
bool executionFinished_;
bool timeoutOccurred_;
diff --git a/include/CommonAPI/DBus/DBusProxyBase.hpp b/include/CommonAPI/DBus/DBusProxyBase.hpp
index 4657bbf..2193ca7 100644
--- a/include/CommonAPI/DBus/DBusProxyBase.hpp
+++ b/include/CommonAPI/DBus/DBusProxyBase.hpp
@@ -26,7 +26,7 @@ namespace DBus {
class DBusAddress;
-class DBusProxyBase
+class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusProxyBase
: public virtual CommonAPI::Proxy {
public:
COMMONAPI_EXPORT DBusProxyBase(const DBusAddress &_address,
@@ -39,6 +39,11 @@ public:
COMMONAPI_EXPORT DBusMessage createMethodCall(const std::string &_method,
const std::string &_signature = "") const;
+ typedef std::function<void(const AvailabilityStatus, const Timeout_t remaining)> isAvailableAsyncCallback;
+ COMMONAPI_EXPORT virtual std::future<AvailabilityStatus> isAvailableAsync(
+ isAvailableAsyncCallback _callback,
+ const CallInfo *_info) const = 0;
+
COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
const std::string &objectPath,
const std::string &interfaceName,
diff --git a/include/CommonAPI/DBus/DBusProxyConnection.hpp b/include/CommonAPI/DBus/DBusProxyConnection.hpp
index bec052b..8f7a1c8 100644
--- a/include/CommonAPI/DBus/DBusProxyConnection.hpp
+++ b/include/CommonAPI/DBus/DBusProxyConnection.hpp
@@ -57,19 +57,22 @@ class DBusProxyConnection {
virtual void unlock() = 0;
};
+ class DBusSignalHandler;
+
+ // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature
+ typedef std::tuple<std::string, std::string, std::string, std::string> DBusSignalHandlerPath;
+ typedef std::unordered_map<DBusSignalHandlerPath, std::pair<std::shared_ptr<std::recursive_mutex>, std::set<DBusSignalHandler* >>> DBusSignalHandlerTable;
+ typedef DBusSignalHandlerPath DBusSignalHandlerToken;
+
class DBusSignalHandler {
public:
virtual ~DBusSignalHandler() {}
virtual void onSignalDBusMessage(const DBusMessage&) = 0;
virtual void onInitialValueSignalDBusMessage(const DBusMessage&, const uint32_t) {};
- virtual void onError(const CommonAPI::CallStatus status) { (void) status; };
+ virtual void onSpecificError(const CommonAPI::CallStatus, const uint32_t ) {};
+ virtual void setSubscriptionToken(const DBusSignalHandlerToken, const uint32_t) {};
};
- // objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature
- typedef std::tuple<std::string, std::string, std::string, std::string> DBusSignalHandlerPath;
- typedef std::unordered_map<DBusSignalHandlerPath, std::pair<std::shared_ptr<std::recursive_mutex>, std::set<DBusSignalHandler* >>> DBusSignalHandlerTable;
- typedef DBusSignalHandlerPath DBusSignalHandlerToken;
-
typedef Event<AvailabilityStatus> ConnectionStatusEvent;
virtual ~DBusProxyConnection() {}
@@ -98,13 +101,13 @@ class DBusProxyConnection {
DBusSignalHandler* dbusSignalHandler,
const bool justAddFilter = false) = 0;
- virtual DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
- const std::string& objectPath,
+ virtual void subscribeForSelectiveBroadcast(const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& interfaceMemberSignature,
DBusSignalHandler* dbusSignalHandler,
- DBusProxy* callingProxy) = 0;
+ DBusProxy* callingProxy,
+ uint32_t tag) = 0;
virtual void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
DBusProxyConnection::DBusSignalHandlerToken subscription,
@@ -134,7 +137,11 @@ class DBusProxyConnection {
virtual bool hasDispatchThread() = 0;
- virtual bool sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName) = 0;
+ virtual void sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName,
+ DBusSignalHandler* dbusSignalHandler, uint32_t tag) = 0;
+
+ virtual void pushDBusMessageReply(const DBusMessage& reply,
+ std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler) = 0;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusProxyHelper.hpp b/include/CommonAPI/DBus/DBusProxyHelper.hpp
index ef468ee..cb5b942 100644
--- a/include/CommonAPI/DBus/DBusProxyHelper.hpp
+++ b/include/CommonAPI/DBus/DBusProxyHelper.hpp
@@ -172,13 +172,13 @@ struct DBusProxyHelper<In_<DBusInputStream, DBusOutputStream, InArgs_...>,
}
}
- template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
+ template <typename DBusProxy_ = DBusProxy, typename DelegateFunction_>
static std::future<CallStatus> callMethodAsync(
- const DBusProxy_ &_proxy,
+ DBusProxy_ &_proxy,
DBusMessage &_message,
const CommonAPI::CallInfo *_info,
const InArgs_&... _in,
- AsyncCallback_ _callback,
+ DelegateFunction_ _function,
std::tuple<OutArgs_...> _out) {
if (sizeof...(InArgs_) > 0) {
DBusOutputStream output(_message);
@@ -193,51 +193,75 @@ struct DBusProxyHelper<In_<DBusInputStream, DBusOutputStream, InArgs_...>,
output.flush();
}
- return _proxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
- _message,
- DBusProxyAsyncCallbackHandler<
- OutArgs_...
- >::create(std::move(_callback), _out),
- _info);
+ typename DBusProxyAsyncCallbackHandler<
+ DBusProxy, OutArgs_...
+ >::Delegate delegate(_proxy.shared_from_this(), _function);
+ auto dbusMessageReplyAsyncHandler = DBusProxyAsyncCallbackHandler<
+ DBusProxy, OutArgs_...
+ >::create(delegate, _out).release();
+
+ if(_proxy.isAvailable()) {
+ return _proxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
+ _message,
+ std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(dbusMessageReplyAsyncHandler),
+ _info);
+ } else {
+ //async isAvailable call with timeout
+ _proxy.isAvailableAsync([&_proxy, _message, _info,
+ _out, dbusMessageReplyAsyncHandler, _function](
+ const AvailabilityStatus _status,
+ const Timeout_t remaining) {
+ if(_status == AvailabilityStatus::AVAILABLE) {
+ //create new call info with remaining timeout. Minimal timeout is 100 ms.
+ Timeout_t newTimeout = remaining;
+ if(remaining < 100)
+ newTimeout = 100;
+ CallInfo newInfo(newTimeout);
+ _proxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
+ _message,
+ std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(dbusMessageReplyAsyncHandler),
+ &newInfo);
+ } else {
+ //create error message and push it directly to the connection
+ unsigned int dummySerial = 999;
+ _message.setSerial(dummySerial); //set dummy serial
+ DBusMessage errorMessage = _message.createMethodError(DBUS_ERROR_UNKNOWN_METHOD);
+ _proxy.getDBusConnection()->pushDBusMessageReply(errorMessage,
+ std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(dbusMessageReplyAsyncHandler));
+ }
+ }, _info);
+ return dbusMessageReplyAsyncHandler->getFuture();
+ }
}
- template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
+ template <typename DBusProxy_ = DBusProxy, typename DelegateFunction_>
static std::future<CallStatus> callMethodAsync(
- const DBusProxy_ &_proxy,
+ DBusProxy_ &_proxy,
const DBusAddress &_address,
const std::string &_method,
const std::string &_signature,
const CommonAPI::CallInfo *_info,
const InArgs_&... _in,
- AsyncCallback_ _callback,
+ DelegateFunction_ _function,
std::tuple<OutArgs_...> _out) {
#ifndef WIN32
static std::mutex callMethodAsync_mutex_;
#endif
std::lock_guard<std::mutex> lock(callMethodAsync_mutex_);
- if (_proxy.isAvailable()) {
- DBusMessage message = DBusMessage::createMethodCall(_address, _method, _signature);
- return callMethodAsync(_proxy, message, _info, _in..., _callback, _out);
- } else {
- CallStatus status = CallStatus::NOT_AVAILABLE;
- callCallbackOnNotAvailable(_callback, typename make_sequence<sizeof...(OutArgs_)>::type(), _out);
-
- std::promise<CallStatus> promise;
- promise.set_value(status);
- return promise.get_future();
- }
+ DBusMessage message = DBusMessage::createMethodCall(_address, _method, _signature);
+ return callMethodAsync(_proxy, message, _info, _in..., _function, _out);
}
- template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
+ template <typename DBusProxy_ = DBusProxy, typename DelegateFunction_>
static std::future<CallStatus> callMethodAsync(
- const DBusProxy_ &_proxy,
+ DBusProxy_ &_proxy,
const std::string &_interface,
const std::string &_method,
const std::string &_signature,
const CommonAPI::CallInfo *_info,
const InArgs_&... _in,
- AsyncCallback_ _callback,
+ DelegateFunction_ _function,
std::tuple<OutArgs_...> _out) {
DBusAddress itsAddress(_proxy.getDBusAddress());
itsAddress.setInterface(_interface);
@@ -245,43 +269,34 @@ struct DBusProxyHelper<In_<DBusInputStream, DBusOutputStream, InArgs_...>,
_proxy, itsAddress,
_method, _signature,
_info,
- _in..., _callback, _out);
+ _in..., _function,
+ _out);
}
- template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
+ template <typename DBusProxy_ = DBusProxy, typename DelegateFunction_>
static std::future<CallStatus> callMethodAsync(
- const DBusProxy_ &_proxy,
+ DBusProxy_ &_proxy,
const std::string &_method,
const std::string &_signature,
const CommonAPI::CallInfo *_info,
const InArgs_&... _in,
- AsyncCallback_ _callback,
+ DelegateFunction_ _function,
std::tuple<OutArgs_...> _out) {
#ifndef WIN32
static std::mutex callMethodAsync_mutex_;
#endif
std::lock_guard<std::mutex> lock(callMethodAsync_mutex_);
- if (_proxy.isAvailable()) {
- DBusMessage message = _proxy.createMethodCall(_method, _signature);
- return callMethodAsync(_proxy, message, _info, _in..., _callback, _out);
- } else {
- callCallbackOnNotAvailable(
- _callback, typename make_sequence<sizeof...(OutArgs_)>::type(), _out);
-
- CallStatus status = CallStatus::NOT_AVAILABLE;
- std::promise<CallStatus> promise;
- promise.set_value(status);
- return promise.get_future();
- }
+ DBusMessage message = _proxy.createMethodCall(_method, _signature);
+ return callMethodAsync(_proxy, message, _info, _in..., _function, _out);
}
template <int... ArgIndices_>
static void callCallbackOnNotAvailable(std::function<void(CallStatus, OutArgs_&...)> _callback,
index_sequence<ArgIndices_...>, std::tuple<OutArgs_...> _out) {
const CallStatus status(CallStatus::NOT_AVAILABLE);
- _callback(status, std::get<ArgIndices_>(_out)...);
- (void)_out;
+ _callback(status, std::get<ArgIndices_>(_out)...);
+ (void)_out;
}
};
diff --git a/include/CommonAPI/DBus/DBusProxyManager.hpp b/include/CommonAPI/DBus/DBusProxyManager.hpp
index 9540ead..ff28a26 100644
--- a/include/CommonAPI/DBus/DBusProxyManager.hpp
+++ b/include/CommonAPI/DBus/DBusProxyManager.hpp
@@ -26,7 +26,7 @@
namespace CommonAPI {
namespace DBus {
-class DBusProxyManager: public ProxyManager {
+class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusProxyManager: public ProxyManager {
public:
COMMONAPI_EXPORT DBusProxyManager(DBusProxy &_proxy,
const std::string &_interfaceName);
diff --git a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
index 961063a..627a17b 100644
--- a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
+++ b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
@@ -36,21 +36,24 @@ public:
virtual ~DBusSelectiveEvent() {}
- virtual void onError(const CommonAPI::CallStatus status) {
- this->notifyError(status);
+ virtual void onSpecificError(const CommonAPI::CallStatus status, uint32_t tag) {
+ this->notifySpecificError(tag, status);
+ }
+
+ virtual void setSubscriptionToken(const DBusProxyConnection::DBusSignalHandlerToken _subscriptionToken, uint32_t tag) {
+ this->subscription_ = _subscriptionToken;
+ static_cast<DBusProxy&>(this->proxy_).insertSelectiveSubscription(this->name_, this, tag);
}
protected:
void onFirstListenerAdded(const Listener &) {
- bool success;
- this->subscription_
- = static_cast<DBusProxy&>(this->proxy_).subscribeForSelectiveBroadcastOnConnection(
- success, this->path_, this->interface_, this->name_, this->signature_, this);
-
- if (success == false) {
- // Call error listener with an error code
- this->notifyError(CommonAPI::CallStatus::SUBSCRIPTION_REFUSED);
- }
+
+ }
+
+ void onListenerAdded(const Listener &_listener, const uint32_t subscription) {
+ (void) _listener;
+ static_cast<DBusProxy&>(this->proxy_).subscribeForSelectiveBroadcastOnConnection(
+ this->path_, this->interface_, this->name_, this->signature_, this, subscription);
}
void onLastListenerRemoved(const Listener &) {
diff --git a/include/CommonAPI/DBus/DBusServiceRegistry.hpp b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
index 584c47a..17e7139 100644
--- a/include/CommonAPI/DBus/DBusServiceRegistry.hpp
+++ b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
@@ -68,6 +68,7 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
typedef DBusManagedInterfaceListenerList::iterator DBusManagedInterfaceSubscription;
static std::shared_ptr<DBusServiceRegistry> get(std::shared_ptr<DBusProxyConnection> _connection);
+ static void remove(std::shared_ptr<DBusProxyConnection> _connection);
DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection);
@@ -158,6 +159,7 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
: referenceCount(other.referenceCount),
state(other.state),
promiseOnResolve(std::move(other.promiseOnResolve)),
+ futureOnResolve(std::move(other.futureOnResolve)),
serviceName(std::move(other.serviceName)),
dbusInterfaceNamesCache(std::move(other.dbusInterfaceNamesCache)){
}
@@ -167,6 +169,7 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
size_t referenceCount;
DBusRecordState state;
std::promise<DBusRecordState> promiseOnResolve;
+ std::shared_future<DBusRecordState> futureOnResolve;
std::string serviceName;
std::unordered_set<std::string> dbusInterfaceNamesCache;
diff --git a/include/CommonAPI/DBus/DBusStubAdapter.hpp b/include/CommonAPI/DBus/DBusStubAdapter.hpp
index b2bea37..710277b 100644
--- a/include/CommonAPI/DBus/DBusStubAdapter.hpp
+++ b/include/CommonAPI/DBus/DBusStubAdapter.hpp
@@ -22,7 +22,7 @@ namespace DBus {
class DBusProxyConnection;
-class DBusStubAdapter
+class COMMONAPI_EXPORT_CLASS_EXPLICIT DBusStubAdapter
: virtual public CommonAPI::StubAdapter,
public DBusInterfaceHandler {
public:
diff --git a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
index 0084360..42d7301 100644
--- a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
+++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
@@ -108,8 +108,12 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
const char* interfaceMemberName = dbusMessage.getMember();
const char* interfaceMemberSignature = dbusMessage.getSignature();
- assert(interfaceMemberName);
- assert(interfaceMemberSignature);
+ if (NULL == interfaceMemberName) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " member empty");
+ }
+ if (NULL == interfaceMemberSignature) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " signature empty");
+ }
DBusInterfaceMemberPath dbusInterfaceMemberPath(interfaceMemberName, interfaceMemberSignature);
auto findIterator = getStubDispatcherTable().find(dbusInterfaceMemberPath);
@@ -160,8 +164,12 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
}
StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
- assert(getterDispatcher != NULL); // all attributes have at least a getter
- return (getterDispatcher->dispatchDBusMessage(_message, stub_, *this));
+ if (NULL == getterDispatcher) { // all attributes have at least a getter
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "getterDispatcher == NULL");
+ return false;
+ } else {
+ return (getterDispatcher->dispatchDBusMessage(_message, stub_, *this));
+ }
}
bool handleFreedesktopSet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
@@ -206,10 +214,14 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
//To prevent the destruction of the stub whilst still handling a message
if (stub_) {
StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
- assert(getterDispatcher != NULL); // all attributes have at least a getter
- dbusOutputStream.align(8);
- dbusOutputStream << attributeDispatcherIterator->first;
- getterDispatcher->appendGetAllReply(dbusMessage, stub_, *this, dbusOutputStream);
+ if (NULL == getterDispatcher) { // all attributes have at least a getter
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "getterDispatcher == NULL");
+ break;
+ } else {
+ dbusOutputStream.align(8);
+ dbusOutputStream << attributeDispatcherIterator->first;
+ getterDispatcher->appendGetAllReply(dbusMessage, stub_, *this, dbusOutputStream);
+ }
}
}
@@ -463,9 +475,14 @@ private:
}
output.flush();
}
- bool isSuccessful = connection_->sendDBusMessage(reply->second);
- pending_.erase(_call);
- return isSuccessful;
+ if (std::shared_ptr<DBusProxyConnection> connection = connection_.lock()) {
+ bool isSuccessful = connection->sendDBusMessage(reply->second);
+ pending_.erase(_call);
+ return isSuccessful;
+ }
+ else {
+ return false;
+ }
}
return false;
}
@@ -479,7 +496,7 @@ private:
std::map<CommonAPI::CallId_t, DBusMessage> pending_;
std::mutex mutex_; // protects pending_
- std::shared_ptr<DBusProxyConnection> connection_;
+ std::weak_ptr<DBusProxyConnection> connection_;
};
template< class, class, class, class >
diff --git a/include/murmurhash/MurmurHash3.h b/include/murmurhash/MurmurHash3.h
index 54e9d3f..a7e45a7 100644
--- a/include/murmurhash/MurmurHash3.h
+++ b/include/murmurhash/MurmurHash3.h
@@ -8,9 +8,9 @@
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
-// Microsoft Visual Studio
+// Microsoft Visual Studio before VS2010
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef unsigned char uint8_t;
typedef unsigned long uint32_t;
@@ -18,11 +18,11 @@ typedef unsigned __int64 uint64_t;
// Other compilers
-#else // defined(_MSC_VER)
+#else // defined(_MSC_VER) && (_MSC_VER < 1600)
#include <stdint.h>
-#endif // !defined(_MSC_VER)
+#endif // defined(_MSC_VER) && (_MSC_VER < 1600)
//-----------------------------------------------------------------------------
diff --git a/src/CommonAPI/DBus/DBusConnection.cpp b/src/CommonAPI/DBus/DBusConnection.cpp
index 47751cc..6071830 100644
--- a/src/CommonAPI/DBus/DBusConnection.cpp
+++ b/src/CommonAPI/DBus/DBusConnection.cpp
@@ -4,7 +4,6 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <algorithm>
-#include <cassert>
#include <chrono>
#include <future>
#include <sstream>
@@ -44,11 +43,6 @@ const DBusObjectPathVTable* DBusConnection::getDBusObjectPathVTable() {
return &libdbusObjectPathVTable;
}
-//std::bind used to start the dispatch thread holds one reference, and the selfReference
-//created within the thread is the second. If only those two remain, no one but the
-//dispatch thread references the connection, which therefore can be finished.
-const int32_t ownUseCount = 2;
-
void DBusConnection::dispatch() {
loop_->run();
}
@@ -56,10 +50,8 @@ void DBusConnection::dispatch() {
DBusConnection::DBusConnection(DBusType_t busType,
const ConnectionId_t& _connectionId) :
dispatchThread_(NULL),
- stopDispatching_(false),
dispatchSource_(),
watchContext_(NULL),
- pauseDispatching_(false),
connection_(NULL),
busType_(busType),
dbusConnectionStatusEvent_(this),
@@ -68,7 +60,11 @@ DBusConnection::DBusConnection(DBusType_t busType,
connectionNameCount_(),
enforcerThread_(NULL),
enforcerThreadCancelled_(false),
- connectionId_(_connectionId) {
+ connectionId_(_connectionId),
+ activeConnections_(0),
+ isDisconnecting_(false),
+ isDispatching_(false),
+ isWaitingOnFinishedDispatching_(false) {
dbus_threads_init_default();
}
@@ -76,10 +72,8 @@ DBusConnection::DBusConnection(DBusType_t busType,
DBusConnection::DBusConnection(::DBusConnection *_connection,
const ConnectionId_t& _connectionId) :
dispatchThread_(NULL),
- stopDispatching_(false),
dispatchSource_(),
watchContext_(NULL),
- pauseDispatching_(false),
connection_(_connection),
busType_(DBusType_t::WRAPPED),
dbusConnectionStatusEvent_(this),
@@ -88,7 +82,11 @@ DBusConnection::DBusConnection(::DBusConnection *_connection,
connectionNameCount_(),
enforcerThread_(NULL),
enforcerThreadCancelled_(false),
- connectionId_(_connectionId) {
+ connectionId_(_connectionId),
+ activeConnections_(0),
+ isDisconnecting_(false),
+ isDispatching_(false),
+ isWaitingOnFinishedDispatching_(false){
dbus_threads_init_default();
}
@@ -108,14 +106,17 @@ DBusConnection::~DBusConnection() {
dbus_connection_set_timeout_functions(connection_, NULL, NULL, NULL, NULL, NULL);
}
+ lockedContext->deregisterWatch(msgWatch_);
+ lockedContext->deregisterDispatchSource(msgDispatchSource_);
lockedContext->deregisterDispatchSource(dispatchSource_);
delete watchContext_;
- delete dispatchSource_;
}
// ensure, the registry survives until disconnecting is done...
//std::shared_ptr<DBusServiceRegistry> itsRegistry = DBusServiceRegistry::get(shared_from_this());
- disconnect();
+
+ // Disconnecting not possible because of circular dependency, the destructor will be called AFTER disconnect anyway.
+ //disconnect();
//Assert that the enforcerThread_ is in a position to finish itself correctly even after destruction
//of the DBusConnection. Also assert all resources are cleaned up.
@@ -174,8 +175,14 @@ bool DBusConnection::attachMainLoopContext(std::weak_ptr<MainLoopContext> mainLo
mainLoopContext_ = mainLoopContext;
if (auto lockedContext = mainLoopContext_.lock()) {
+ msgWatch_ = new DBusMessageWatch(shared_from_this());
+ msgDispatchSource_ = new DBusMessageDispatchSource(msgWatch_);
+
+ lockedContext->registerDispatchSource(msgDispatchSource_);
+ lockedContext->registerWatch(msgWatch_);
+
dispatchSource_ = new DBusDispatchSource(this);
- watchContext_ = new WatchContext(mainLoopContext_, dispatchSource_);
+ watchContext_ = new WatchContext(mainLoopContext_, dispatchSource_, shared_from_this());
lockedContext->registerDispatchSource(dispatchSource_);
dbus_connection_set_wakeup_main_function(
@@ -216,31 +223,39 @@ bool DBusConnection::attachMainLoopContext(std::weak_ptr<MainLoopContext> mainLo
void DBusConnection::onWakeupMainContext(void* data) {
std::weak_ptr<MainLoopContext>* mainloop = static_cast<std::weak_ptr<MainLoopContext>*>(data);
- assert(mainloop);
- if(auto lockedContext = mainloop->lock()) {
+ if (!mainloop) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "mainloop == nullptr");
+ } else if(auto lockedContext = mainloop->lock()) {
lockedContext->wakeup();
}
}
dbus_bool_t DBusConnection::onAddWatch(::DBusWatch* libdbusWatch, void* data) {
WatchContext* watchContext = static_cast<WatchContext*>(data);
- assert(watchContext);
-
- DBusWatch* dbusWatch = new DBusWatch(libdbusWatch, watchContext->mainLoopContext_);
- dbusWatch->addDependentDispatchSource(watchContext->dispatchSource_);
- dbus_watch_set_data(libdbusWatch, dbusWatch, NULL);
+ if (NULL == watchContext) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "watchContext == NULL");
+ return FALSE;
+ } else {
+ DBusWatch* dbusWatch = new DBusWatch(libdbusWatch, watchContext->mainLoopContext_, watchContext->dbusConnection_);
+ dbusWatch->addDependentDispatchSource(watchContext->dispatchSource_);
+ dbus_watch_set_data(libdbusWatch, dbusWatch, NULL);
- if (dbusWatch->isReadyToBeWatched()) {
- dbusWatch->startWatching();
+ if (dbusWatch->isReadyToBeWatched()) {
+ dbusWatch->startWatching();
+ } else {
+ delete dbusWatch;
+ dbus_watch_set_data(libdbusWatch, NULL, NULL);
+ }
}
return TRUE;
}
void DBusConnection::onRemoveWatch(::DBusWatch* libdbusWatch, void* data) {
- assert(static_cast<WatchContext*>(data));
- (void)data;
+ if (NULL == static_cast<WatchContext*>(data)) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "data (WatchContext) == NULL");
+ }
DBusWatch* dbusWatch = static_cast<DBusWatch*>(dbus_watch_get_data(libdbusWatch));
if (dbusWatch != NULL) {
@@ -254,12 +269,16 @@ void DBusConnection::onRemoveWatch(::DBusWatch* libdbusWatch, void* data) {
void DBusConnection::onToggleWatch(::DBusWatch* libdbusWatch, void* data) {
WatchContext* watchContext = static_cast<WatchContext*>(data);
- assert(watchContext);
+
+ if (NULL == watchContext) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "watchContext == NULL");
+ return;
+ }
DBusWatch* dbusWatch = static_cast<DBusWatch*>(dbus_watch_get_data(libdbusWatch));
if (dbusWatch == NULL) {
- DBusWatch* dbusWatch = new DBusWatch(libdbusWatch, watchContext->mainLoopContext_);
+ DBusWatch* dbusWatch = new DBusWatch(libdbusWatch, watchContext->mainLoopContext_, watchContext->dbusConnection_);
dbusWatch->addDependentDispatchSource(watchContext->dispatchSource_);
dbus_watch_set_data(libdbusWatch, dbusWatch, NULL);
@@ -270,6 +289,8 @@ void DBusConnection::onToggleWatch(::DBusWatch* libdbusWatch, void* data) {
if (!dbusWatch->isReadyToBeWatched()) {
dbusWatch->stopWatching();
dbus_watch_set_data(libdbusWatch, NULL, NULL);
+ } else {
+ dbusWatch->startWatching();
}
}
}
@@ -277,21 +298,28 @@ void DBusConnection::onToggleWatch(::DBusWatch* libdbusWatch, void* data) {
dbus_bool_t DBusConnection::onAddTimeout(::DBusTimeout* libdbusTimeout, void* data) {
std::weak_ptr<MainLoopContext>* mainloop = static_cast<std::weak_ptr<MainLoopContext>*>(data);
- assert(mainloop);
+ if (NULL == mainloop) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "mainloop == NULL");
+ return FALSE;
+ }
DBusTimeout* dbusTimeout = new DBusTimeout(libdbusTimeout, *mainloop);
dbus_timeout_set_data(libdbusTimeout, dbusTimeout, NULL);
if (dbusTimeout->isReadyToBeMonitored()) {
dbusTimeout->startMonitoring();
+ } else {
+ delete dbusTimeout;
+ dbus_timeout_set_data(libdbusTimeout, NULL, NULL);
}
return TRUE;
}
void DBusConnection::onRemoveTimeout(::DBusTimeout* libdbusTimeout, void* data) {
- assert(static_cast<std::weak_ptr<MainLoopContext>*>(data));
- (void)data;
+ if (NULL == static_cast<std::weak_ptr<MainLoopContext>*>(data)) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "MainLoopContext == NULL");
+ }
DBusTimeout* dbusTimeout = static_cast<DBusTimeout*>(dbus_timeout_get_data(libdbusTimeout));
if (dbusTimeout) {
@@ -302,8 +330,9 @@ void DBusConnection::onRemoveTimeout(::DBusTimeout* libdbusTimeout, void* data)
}
void DBusConnection::onToggleTimeout(::DBusTimeout* dbustimeout, void* data) {
- assert(static_cast<std::weak_ptr<MainLoopContext>*>(data));
- (void)data;
+ if (NULL == static_cast<std::weak_ptr<MainLoopContext>*>(data)) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "MainLoopContext == NULL");
+ }
DBusTimeout* timeout = static_cast<DBusTimeout*>(dbus_timeout_get_data(dbustimeout));
if (timeout->isReadyToBeMonitored()) {
@@ -319,7 +348,11 @@ bool DBusConnection::connect(bool startDispatchThread) {
}
bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
- assert(!dbusError);
+ if (dbusError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "dbusError set");
+ return false;
+ }
+
if (isConnected()) {
return true;
}
@@ -340,7 +373,11 @@ bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
return false;
}
- assert(connection_);
+ if (NULL == connection_) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "connection_ == NULL");
+ return false;
+ }
+
dbus_connection_set_exit_on_disconnect(connection_, false);
initLibdbusObjectPathHandlerAfterConnect();
@@ -352,7 +389,7 @@ bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
dbusConnectionStatusEvent_.notifyListeners(AvailabilityStatus::AVAILABLE);
- stopDispatching_ = !startDispatchThread;
+ isDisconnecting_ = false;
if (startDispatchThread) {
std::shared_ptr<MainLoopContext> itsContext = std::make_shared<MainLoopContext>();
loop_ = std::make_shared<DBusMainLoop>(itsContext);
@@ -365,6 +402,10 @@ bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
void DBusConnection::disconnect() {
std::lock_guard<std::mutex> dbusConnectionLock(connectionGuard_);
+
+ std::unique_lock<std::mutex> dispatchLock(dispatchMutex_);
+ isDisconnecting_ = true;
+
if (isConnected()) {
dbusConnectionStatusEvent_.notifyListeners(AvailabilityStatus::NOT_AVAILABLE);
@@ -375,7 +416,16 @@ void DBusConnection::disconnect() {
connectionNameCount_.clear();
- stopDispatching_ = true;
+ //wait until dispatching is finished
+ auto it = dispatchThreads_.find(std::this_thread::get_id());
+ if(it == dispatchThreads_.end()) { //wait only if disconnect is NOT triggered by main loop
+ while(isDispatching_) {
+ isWaitingOnFinishedDispatching_ = true;
+ dispatchCondition_.wait(dispatchLock);
+ isWaitingOnFinishedDispatching_ = false;
+ }
+ }
+ dispatchLock.unlock();
dbus_connection_close(connection_);
@@ -394,7 +444,8 @@ void DBusConnection::disconnect() {
enforcerThreadCancelled_ = true;
enforceTimeoutCondition_.notify_one();
- if (enforcerThread_->joinable()) {
+ if (enforcerThread_->joinable() &&
+ std::this_thread::get_id() != enforcerThread_->get_id()) {
enforcerThread_->join();
}
enforcerThreadCancelled_ = false;
@@ -406,6 +457,10 @@ void DBusConnection::disconnect() {
dbus_connection_unref(connection_);
connection_ = nullptr;
}
+
+ if (std::shared_ptr<CommonAPI::MainLoopContext> mainLoopContext = mainLoopContext_.lock()) {
+ Factory::get()->releaseConnection(connectionId_, mainLoopContext.get());
+ }
}
bool DBusConnection::isConnected() const {
@@ -488,60 +543,87 @@ bool DBusConnection::releaseServiceName(const std::string& serviceName) const {
}
bool DBusConnection::sendDBusMessage(const DBusMessage &_message) const {
- assert(_message);
- assert(isConnected());
+ if (!_message) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "message == NULL");
+ return false;
+ }
+ if (!isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "not connected");
+ return false;
+ }
dbus_uint32_t dbusSerial;
- bool result = 0 != dbus_connection_send(connection_, _message.message_, &dbusSerial);
+ const bool result = (0 != dbus_connection_send(connection_, _message.message_, &dbusSerial));
return result;
}
-DBusMessage DBusConnection::convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall,
- CallStatus& _callStatus) {
- assert(_libdbusPendingCall);
+DBusMessage DBusConnection::convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall) {
+ if (NULL == _libdbusPendingCall) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "_libdbusPendingCall == NULL");
+ return DBusMessage();
+ }
::DBusMessage* libdbusMessage = dbus_pending_call_steal_reply(_libdbusPendingCall);
const bool increaseLibdbusMessageReferenceCount = false;
DBusMessage dbusMessage(libdbusMessage, increaseLibdbusMessageReferenceCount);
- _callStatus = CallStatus::SUCCESS;
-
- if (!dbusMessage.isMethodReturnType()) {
- _callStatus = CallStatus::REMOTE_ERROR;
- }
return dbusMessage;
}
-void DBusConnection::onLibdbusPendingCallNotifyThunk(::DBusPendingCall* _libdbusPendingCall, void *_userData) {
- assert(_userData);
- assert(_libdbusPendingCall);
+void DBusConnection::onLibdbusPendingCall(::DBusPendingCall* _libdbusPendingCall,
+ const DBusMessage& _reply,
+ DBusMessageReplyAsyncHandler* _dbusMessageReplyAsyncHandler) const {
- auto dbusMessageReplyAsyncHandler = reinterpret_cast<DBusMessageReplyAsyncHandler*>(_userData);
+ CallStatus callStatus = CallStatus::SUCCESS;
+ if (_reply.isErrorType() || !_reply.isMethodReturnType()) {
+ if(strcmp(_reply.getError(), DBUS_ERROR_UNKNOWN_METHOD) == 0) {
+ callStatus = CallStatus::NOT_AVAILABLE;
+ } else {
+ callStatus = CallStatus::REMOTE_ERROR;
+ }
+ }
- dbusMessageReplyAsyncHandler->lock();
- bool processAsyncHandler = !dbusMessageReplyAsyncHandler->getTimeoutOccurred();
- dbusMessageReplyAsyncHandler->setExecutionStarted();
- dbusMessageReplyAsyncHandler->unlock();
+ _dbusMessageReplyAsyncHandler->lock();
+ bool processAsyncHandler = !_dbusMessageReplyAsyncHandler->getTimeoutOccurred();
+ _dbusMessageReplyAsyncHandler->setExecutionStarted();
+ _dbusMessageReplyAsyncHandler->unlock();
- if (processAsyncHandler) {
- DBusMessage dbusMessage;
- CallStatus callStatus;
- dbusMessage = DBusConnection::convertToDBusMessage(_libdbusPendingCall, callStatus);
+ if (processAsyncHandler)
+ _dbusMessageReplyAsyncHandler->onDBusMessageReply(callStatus, _reply);
- dbusMessageReplyAsyncHandler->onDBusMessageReply(callStatus, dbusMessage);
- }
+ _dbusMessageReplyAsyncHandler->lock();
- dbusMessageReplyAsyncHandler->lock();
// libdbus calls the cleanup method below
- dbus_pending_call_unref(_libdbusPendingCall);
+ if(_libdbusPendingCall)
+ dbus_pending_call_unref(_libdbusPendingCall);
- dbusMessageReplyAsyncHandler->setExecutionFinished();
- if (dbusMessageReplyAsyncHandler->hasToBeDeleted()) {
- dbusMessageReplyAsyncHandler->unlock();
- delete dbusMessageReplyAsyncHandler;
+ _dbusMessageReplyAsyncHandler->setExecutionFinished();
+ if (_dbusMessageReplyAsyncHandler->hasToBeDeleted()) {
+ _dbusMessageReplyAsyncHandler->unlock();
+ delete _dbusMessageReplyAsyncHandler;
+ } else {
+ _dbusMessageReplyAsyncHandler->unlock();
+ }
+}
+
+void DBusConnection::onLibdbusPendingCallNotifyThunk(::DBusPendingCall* _libdbusPendingCall, void *_userData) {
+ if (NULL == _libdbusPendingCall) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "_libdbusPendingCall == NULL");
return;
}
- dbusMessageReplyAsyncHandler->unlock();
+ if (NULL == _userData) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "_userData == NULL");
+ return;
+ }
+
+ auto pendingCallNotificationData = reinterpret_cast<PendingCallNotificationData*>(_userData);
+ auto dbusMessageReplyAsyncHandler = pendingCallNotificationData->replyAsyncHandler_;
+ auto dbusConnection = pendingCallNotificationData->dbusConnection_;
+ delete pendingCallNotificationData;
+
+ DBusMessage dbusMessage = DBusConnection::convertToDBusMessage(_libdbusPendingCall);
+
+ dbusConnection->onLibdbusPendingCall(_libdbusPendingCall, dbusMessage, dbusMessageReplyAsyncHandler);
}
void DBusConnection::onLibdbusDataCleanup(void *_data) {
@@ -608,15 +690,19 @@ void DBusConnection::enforceAsynchronousTimeouts() const {
// => add asyncHandler to mainloopTimeouts list
DBusMessage& dbusMessageCall = std::get<2>(it->second);
- assert(mainLoopContext_.lock());
- {
- std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
- mainloopTimeouts_.push_back(std::make_tuple(asyncHandler,
- dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT),
- CallStatus::REMOTE_ERROR,
- nullptr));
+ auto lockedContext = mainLoopContext_.lock();
+ if (!lockedContext) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "lockedContext == nullptr");
+ } else {
+ {
+ std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
+ mainloopTimeouts_.push_back(std::make_tuple(asyncHandler,
+ dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT),
+ CallStatus::REMOTE_ERROR,
+ nullptr));
+ }
+ lockedContext->wakeup();
}
- mainLoopContext_.lock()->wakeup();
it = timeoutMap_.erase(it);
//This unref MIGHT cause the destruction of the last callback object that references the DBusConnection.
@@ -687,21 +773,34 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
const CommonAPI::CallInfo *_info) const {
- assert(dbusMessage);
- assert(isConnected());
+ if (!dbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "message == NULL");
+ return std::future<CallStatus>();
+ }
+ if (!isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "not connected");
+ return std::future<CallStatus>();
+ }
DBusPendingCall* libdbusPendingCall;
dbus_bool_t libdbusSuccess;
DBusMessageReplyAsyncHandler* replyAsyncHandler = dbusMessageReplyAsyncHandler.release();
- std::future<CallStatus> callStatusFuture = replyAsyncHandler->getFuture();
+ std::future<CallStatus> callStatusFuture;
+ try {
+ callStatusFuture = replyAsyncHandler->getFuture();
+ } catch (std::exception& e) {
+ (void)e;
+ }
+
+ PendingCallNotificationData* userData = new PendingCallNotificationData(this, replyAsyncHandler);
libdbusSuccess = dbus_connection_send_with_reply_set_notify(connection_,
dbusMessage.message_,
&libdbusPendingCall,
onLibdbusPendingCallNotifyThunk,
- replyAsyncHandler,
+ userData,
onLibdbusDataCleanup,
_info->timeout_);
@@ -743,7 +842,13 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
};
enforceTimeoutMutex_.lock();
- timeoutMap_.insert( { libdbusPendingCall, toInsert } );
+ auto ret = timeoutMap_.insert( { libdbusPendingCall, toInsert } );
+ if (ret.second == false) {
+ // key has been reused
+ // update the map value with the new info
+ timeoutMap_.erase(ret.first);
+ timeoutMap_.insert( { libdbusPendingCall, toInsert } );
+ }
enforceTimeoutMutex_.unlock();
enforcerThreadMutex_.lock();
@@ -761,9 +866,14 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
DBusError& dbusError,
const CommonAPI::CallInfo *_info) const {
- assert(dbusMessage);
- assert(!dbusError);
- assert(isConnected());
+ if (!dbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "message == NULL");
+ return DBusMessage();
+ }
+ if (!isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "not connected");
+ return DBusMessage();
+ }
::DBusMessage* libdbusMessageReply = dbus_connection_send_with_reply_and_block(connection_,
dbusMessage.message_,
@@ -775,6 +885,7 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
}
if (dbusError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "dbusError set");
return DBusMessage();
}
@@ -782,6 +893,13 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
return DBusMessage(libdbusMessageReply, increaseLibdbusMessageReferenceCount);
}
+void DBusConnection::dispatchDBusMessageReply(const DBusMessage& _reply,
+ DBusMessageReplyAsyncHandler* _dbusMessageReplyAsyncHandler) {
+ if(setDispatching(true)) {
+ onLibdbusPendingCall(NULL, _reply, _dbusMessageReplyAsyncHandler);
+ setDispatching(false);
+ }
+}
bool DBusConnection::singleDispatch() {
{
@@ -795,14 +913,25 @@ bool DBusConnection::singleDispatch() {
}
mainloopTimeouts_.clear();
}
-
- return (dbus_connection_dispatch(connection_) == DBUS_DISPATCH_DATA_REMAINS);
+ if(setDispatching(true)) {
+ bool dispatchStatus(connection_ && dbus_connection_dispatch(connection_) == DBUS_DISPATCH_DATA_REMAINS);
+ setDispatching(false);
+ return dispatchStatus;
+ } else {
+ return false;
+ }
}
bool DBusConnection::isDispatchReady() {
std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
- return (dbus_connection_get_dispatch_status(connection_) == DBUS_DISPATCH_DATA_REMAINS ||
+
+ if(setDispatching(true)) {
+ bool dispatchStatus((connection_ && dbus_connection_get_dispatch_status(connection_) == DBUS_DISPATCH_DATA_REMAINS) ||
!mainloopTimeouts_.empty());
+ setDispatching(false);
+ return dispatchStatus;
+ }
+ return false;
}
bool DBusConnection::hasDispatchThread() {
@@ -813,48 +942,95 @@ const ConnectionId_t& DBusConnection::getConnectionId() const {
return connectionId_;
}
-bool DBusConnection::sendPendingSelectiveSubscription(DBusProxy* proxy, std::string methodName) {
- bool subscriptionAccepted;
- CommonAPI::CallStatus callStatus;
- DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<bool>>::callMethodWithReply(
- *proxy, methodName.c_str(), "", &CommonAPI::DBus::defaultCallInfo, callStatus, subscriptionAccepted);
+void DBusConnection::incrementConnection() {
+ std::lock_guard < std::mutex > lock(activeConnectionsMutex_);
+ activeConnections_++;
+}
+
+void DBusConnection::decrementConnection() {
+ std::lock_guard < std::mutex > lock(activeConnectionsMutex_);
+ activeConnections_--;
+
+ if (activeConnections_ <= 0) {
+ disconnect();
+ }
+}
+
+bool DBusConnection::setDispatching(bool _isDispatching) {
+ std::lock_guard<std::mutex> dispatchLock(dispatchMutex_);
+
+ if(isDispatching_ == _isDispatching)
+ return true;
- return subscriptionAccepted;
+ dispatchThreads_.insert(std::this_thread::get_id());
+ if(isDisconnecting_) { // we want to disconnect and only accept unsetting the dispatch flag
+ if(!_isDispatching) {
+ isDispatching_ = _isDispatching;
+ if(isWaitingOnFinishedDispatching_)
+ dispatchCondition_.notify_one();
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ isDispatching_ = _isDispatching;
+ return true;
+ }
+}
+
+void DBusConnection::sendPendingSelectiveSubscription(DBusProxy* callingProxy, std::string methodName,
+ DBusSignalHandler* dbusSignalHandler, uint32_t tag) {
+ bool outarg;
+ DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<bool>>::callMethodAsync(
+ *callingProxy, methodName.c_str(), "",
+ &CommonAPI::DBus::defaultCallInfo,
+ [this, dbusSignalHandler, callingProxy, tag]
+ (const CommonAPI::CallStatus& callStatus, const bool& accepted) {
+
+ if (callStatus == CommonAPI::CallStatus::SUCCESS && accepted) {
+ dbusSignalHandler->onSpecificError(CommonAPI::CallStatus::SUCCESS, tag);
+ } else {
+ dbusSignalHandler->onSpecificError(CommonAPI::CallStatus::SUBSCRIPTION_REFUSED, tag);
+ }
+ }, std::make_tuple(outarg));
}
-DBusProxyConnection::DBusSignalHandlerToken DBusConnection::subscribeForSelectiveBroadcast(
- bool& subscriptionAccepted,
+void DBusConnection::subscribeForSelectiveBroadcast(
const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& interfaceMemberSignature,
DBusSignalHandler* dbusSignalHandler,
- DBusProxy* callingProxy) {
+ DBusProxy* callingProxy,
+ uint32_t tag) {
std::string methodName = "subscribeFor" + interfaceMemberName + "Selective";
- subscriptionAccepted = false;
-
- CommonAPI::CallStatus callStatus;
+ bool outarg;
DBusProxyHelper<CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<bool>>::callMethodWithReply(
- *callingProxy, methodName.c_str(), "", &CommonAPI::DBus::defaultCallInfo, callStatus, subscriptionAccepted);
-
- DBusProxyConnection::DBusSignalHandlerToken subscriptionToken;
- if ((callStatus == CommonAPI::CallStatus::SUCCESS && subscriptionAccepted) || !callingProxy->isAvailable()) {
- subscriptionToken = addSignalMemberHandler(
- objectPath,
- interfaceName,
- interfaceMemberName,
- interfaceMemberSignature,
- dbusSignalHandler,
- true
- );
- subscriptionAccepted = true;
- }
-
- return (subscriptionToken);
+ CommonAPI::DBus::DBusSerializableArguments<bool>>::callMethodAsync(
+ *callingProxy, methodName.c_str(), "",
+ &CommonAPI::DBus::defaultCallInfo,
+ [this, objectPath, interfaceName, interfaceMemberName, interfaceMemberSignature, dbusSignalHandler, callingProxy, tag]
+ (const CommonAPI::CallStatus& callStatus, const bool& accepted) {
+ if ((callStatus == CommonAPI::CallStatus::SUCCESS && accepted) || !callingProxy->isAvailable()) {
+ DBusProxyConnection::DBusSignalHandlerToken token = addSignalMemberHandler(
+ objectPath,
+ interfaceName,
+ interfaceMemberName,
+ interfaceMemberSignature,
+ dbusSignalHandler,
+ true
+ );
+ dbusSignalHandler->setSubscriptionToken(token, tag);
+ }
+ if (accepted) {
+ dbusSignalHandler->onSpecificError(CommonAPI::CallStatus::SUCCESS, tag);
+ } else {
+ dbusSignalHandler->onSpecificError(CommonAPI::CallStatus::SUBSCRIPTION_REFUSED, tag);
+ }
+ }, std::make_tuple(outarg));
}
void DBusConnection::unsubscribeFromSelectiveBroadcast(const std::string& eventName,
@@ -955,8 +1131,9 @@ bool DBusConnection::addObjectManagerSignalMemberHandler(const std::string& dbus
if (!isInsertSuccessful) {
if (isConnected()) {
const bool isRemoveSignalMatchRuleSuccessful = removeObjectManagerSignalMatchRule(dbusBusName);
- assert(isRemoveSignalMatchRuleSuccessful);
- (void)isRemoveSignalMatchRuleSuccessful;
+ if (!isRemoveSignalMatchRuleSuccessful) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " removeObjectManagerSignalMatchRule", dbusBusName, " failed");
+ }
}
return false;
}
@@ -973,7 +1150,10 @@ bool DBusConnection::addObjectManagerSignalMemberHandler(const std::string& dbus
bool DBusConnection::removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
DBusSignalHandler* dbusSignalHandler) {
- assert(!dbusBusName.empty());
+ if (dbusBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty dbusBusName");
+ return false;
+ }
std::lock_guard<std::mutex> dbusSignalLock(dbusObjectManagerSignalGuard_);
@@ -996,8 +1176,11 @@ bool DBusConnection::removeObjectManagerSignalMemberHandler(const std::string& d
size_t& dbusSignalMatchRuleReferenceCount = dbusSignalMatchRuleIterator->second;
- assert(dbusSignalMatchRuleReferenceCount > 0);
- dbusSignalMatchRuleReferenceCount--;
+ if (0 == dbusSignalMatchRuleReferenceCount) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "ref count == 0");
+ } else {
+ dbusSignalMatchRuleReferenceCount--;
+ }
const bool isLastDBusSignalMatchRuleReference = (dbusSignalMatchRuleReferenceCount == 0);
if (isLastDBusSignalMatchRuleReference) {
@@ -1083,8 +1266,14 @@ bool DBusConnection::removeLibdbusSignalMatchRule(const std::string& dbusMatchRu
}
void DBusConnection::registerObjectPath(const std::string& objectPath) {
- assert(!objectPath.empty());
- assert(objectPath[0] == '/');
+ if (objectPath.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty objectPath");
+ return;
+ }
+ if ('/' != objectPath[0]) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid objectPath ", objectPath);
+ return;
+ }
auto handlerIterator = libdbusRegisteredObjectPaths_.find(objectPath);
const bool foundRegisteredObjectPathHandler = handlerIterator != libdbusRegisteredObjectPaths_.end();
@@ -1104,22 +1293,33 @@ void DBusConnection::registerObjectPath(const std::string& objectPath) {
getDBusObjectPathVTable(),
this,
&dbusError.libdbusError_);
- assert(libdbusSuccess);
- assert(!dbusError);
- (void)libdbusSuccess;
- (void)dbusError;
+
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_connection_try_register_object_path failed for ", objectPath);
+ }
+ if (dbusError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " name: ", dbusError.getName(), " message: ", dbusError.getMessage());
+ }
}
}
void DBusConnection::unregisterObjectPath(const std::string& objectPath) {
- assert(!objectPath.empty());
- assert(objectPath[0] == '/');
+ if (objectPath.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty objectPath");
+ return;
+ }
+ if ('/' != objectPath[0]) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid objectPath ", objectPath);
+ return;
+ }
auto handlerIterator = libdbusRegisteredObjectPaths_.find(objectPath);
const bool foundRegisteredObjectPathHandler = handlerIterator != libdbusRegisteredObjectPaths_.end();
- assert(foundRegisteredObjectPathHandler);
- (void)foundRegisteredObjectPathHandler;
+ if (!foundRegisteredObjectPathHandler) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no handler found for ", objectPath);
+ return;
+ }
uint32_t& referenceCount = handlerIterator->second;
if (referenceCount > 1) {
@@ -1130,10 +1330,11 @@ void DBusConnection::unregisterObjectPath(const std::string& objectPath) {
libdbusRegisteredObjectPaths_.erase(handlerIterator);
if (isConnected()) {
- dbus_bool_t libdbusSuccess
+ const dbus_bool_t libdbusSuccess
= dbus_connection_unregister_object_path(connection_, objectPath.c_str());
- assert(libdbusSuccess);
- (void)libdbusSuccess;
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_connection_unregister_object_path failed for ", objectPath);
+ }
}
}
@@ -1166,8 +1367,10 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
auto success = dbusSignalMatchRulesMap_.insert(
DBusSignalMatchRulesMap::value_type(dbusSignalMatchRuleTuple,
DBusSignalMatchRuleMapping(1, matchRuleString)));
- assert(success.second);
- (void)success;
+ if (!success.second) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "dbusSignalMatchRulesMap_.insert failed ", matchRuleString);
+ return;
+ }
if (isConnected()) {
bool libdbusSuccess = true;
@@ -1180,7 +1383,9 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
&onLibdbusSignalFilterThunk,
this,
NULL);
- assert(libdbusSuccess);
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_connection_add_filter() failed");
+ }
}
if (!justAddFilter)
@@ -1188,8 +1393,10 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
// finally add the match rule
DBusError dbusError;
dbus_bus_add_match(connection_, matchRuleString.c_str(), &dbusError.libdbusError_);
- assert(!dbusError);
- (void)dbusError;
+
+ if (dbusError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " name: ", dbusError.getName(), " message: ", dbusError.getMessage());
+ }
}
if (libdbusSuccess) {
@@ -1206,8 +1413,10 @@ void DBusConnection::removeLibdbusSignalMatchRule(const std::string& objectPath,
auto matchRuleIterator = dbusSignalMatchRulesMap_.find(dbusSignalMatchRuleTuple);
const bool matchRuleFound = matchRuleIterator != dbusSignalMatchRulesMap_.end();
- assert(matchRuleFound);
- (void)matchRuleFound;
+ if (!matchRuleFound) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no match rule found for path: ", objectPath,
+ "interface: ", interfaceName, " member: ", interfaceMemberName);
+ }
uint32_t& matchRuleReferenceCount = matchRuleIterator->second.first;
if (matchRuleReferenceCount > 1) {
@@ -1218,15 +1427,19 @@ void DBusConnection::removeLibdbusSignalMatchRule(const std::string& objectPath,
if (isConnected()) {
const std::string& matchRuleString = matchRuleIterator->second.second;
const bool libdbusSuccess = removeLibdbusSignalMatchRule(matchRuleString);
- assert(libdbusSuccess);
- (void)libdbusSuccess;
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " removeLibdbusSignalMatchRule failed ", matchRuleString);
+ }
}
dbusSignalMatchRulesMap_.erase(matchRuleIterator);
}
void DBusConnection::initLibdbusObjectPathHandlerAfterConnect() {
- assert(isConnected());
+ if (!isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "not connected");
+ return;
+ }
// nothing to do if there aren't any registered object path handlers
if (libdbusRegisteredObjectPaths_.empty()) {
@@ -1248,37 +1461,46 @@ void DBusConnection::initLibdbusObjectPathHandlerAfterConnect() {
getDBusObjectPathVTable(),
this,
&dbusError.libdbusError_);
- assert(libdbusSuccess);
- (void)libdbusSuccess;
-
- assert(!dbusError);
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_connection_try_register_object_path(", objectPath , ") failed ");
+ }
+ if (dbusError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " name: ", dbusError.getName(), " message: ", dbusError.getMessage());
+ }
}
}
void DBusConnection::initLibdbusSignalFilterAfterConnect() {
- assert(isConnected());
+ if (!isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "not connected");
+ return;
+ }
// proxy/stub match rules
for (const auto& dbusSignalMatchRuleIterator : dbusSignalMatchRulesMap_) {
const auto& dbusSignalMatchRuleMapping = dbusSignalMatchRuleIterator.second;
const std::string& dbusMatchRuleString = dbusSignalMatchRuleMapping.second;
const bool libdbusSuccess = addLibdbusSignalMatchRule(dbusMatchRuleString);
- assert(libdbusSuccess);
- (void)libdbusSuccess;
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " addLibdbusSignalMatchRule(", dbusMatchRuleString , ") failed ");
+ }
}
// object manager match rules (see DBusServiceRegistry)
for (const auto& dbusObjectManagerSignalMatchRuleIterator : dbusObjectManagerSignalMatchRulesMap_) {
const std::string& dbusBusName = dbusObjectManagerSignalMatchRuleIterator.first;
const bool libdbusSuccess = addObjectManagerSignalMatchRule(dbusBusName);
- assert(libdbusSuccess);
- (void)libdbusSuccess;
+ if (!libdbusSuccess) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " addObjectManagerSignalMatchRule(", dbusBusName , ") failed ");
+ }
}
}
::DBusHandlerResult DBusConnection::onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage) {
- assert(libdbusMessage);
- (void)libdbusMessage;
+ if (NULL == libdbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " libdbusMessage == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
// handle only method call messages
if (dbus_message_get_type(libdbusMessage) != DBUS_MESSAGE_TYPE_METHOD_CALL) {
@@ -1299,7 +1521,6 @@ void notifyDBusSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
return;
}
- signalEntry->second.first->lock();
auto handlerEntry = signalEntry->second.second.begin();
while (handlerEntry != signalEntry->second.second.end()) {
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler = *handlerEntry;
@@ -1307,7 +1528,6 @@ void notifyDBusSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable,
handlerEntry++;
}
dbusHandlerResult = DBUS_HANDLER_RESULT_HANDLED;
- signalEntry->second.first->unlock();
}
template<typename DBusSignalHandlersTable>
@@ -1329,7 +1549,10 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
}
::DBusHandlerResult DBusConnection::onLibdbusSignalFilter(::DBusMessage* libdbusMessage) {
- assert(libdbusMessage);
+ if (NULL == libdbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " libdbusMessage == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
auto selfReference = this->shared_from_this();
@@ -1343,10 +1566,10 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
const char* interfaceMemberName = dbus_message_get_member(libdbusMessage);
const char* interfaceMemberSignature = dbus_message_get_signature(libdbusMessage);
- assert(objectPath);
- assert(interfaceName);
- assert(interfaceMemberName);
- assert(interfaceMemberSignature);
+ if (NULL == objectPath || NULL == interfaceName || NULL == interfaceMemberName || NULL == interfaceMemberSignature ) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid message");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
DBusMessage dbusMessage(libdbusMessage);
::DBusHandlerResult dbusHandlerResult = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1357,14 +1580,23 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
interfaceName,
interfaceMemberName,
interfaceMemberSignature));
+
+ if(signalEntry != dbusSignalHandlerTable_.end())
+ signalEntry->second.first->lock();
signalGuard_.unlock();
notifyDBusSignalHandlers(dbusSignalHandlerTable_,
signalEntry, dbusMessage, dbusHandlerResult);
+ if(signalEntry != dbusSignalHandlerTable_.end())
+ signalEntry->second.first->unlock();
+
if (dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager")) {
const char* dbusSenderName = dbusMessage.getSender();
- assert(dbusSenderName);
+ if (NULL == dbusSenderName) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusSenderName == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
dbusObjectManagerSignalGuard_.lock();
auto dbusObjectManagerSignalHandlerIteratorPair = dbusObjectManagerSignalHandlerTable_.equal_range(dbusSenderName);
@@ -1381,26 +1613,50 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
::DBusHandlerResult DBusConnection::onLibdbusSignalFilterThunk(::DBusConnection *_dbusConnection,
::DBusMessage* libdbusMessage,
void* userData) {
- assert(_dbusConnection);
- assert(libdbusMessage);
- assert(userData);
- (void)_dbusConnection;
+ if (NULL == _dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _dbusConnection == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ if (NULL == libdbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " libdbusMessage == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ if (NULL == userData) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " userData == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
- assert(dbusConnection->connection_ == _dbusConnection);
+ if (dbusConnection->connection_ != _dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " wrong connection!?");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
return dbusConnection->onLibdbusSignalFilter(libdbusMessage);
}
::DBusHandlerResult DBusConnection::onLibdbusObjectPathMessageThunk(::DBusConnection *_dbusConnection,
::DBusMessage* libdbusMessage,
void* userData) {
- assert(_dbusConnection);
- assert(libdbusMessage);
- assert(userData);
- (void)_dbusConnection;
+ if (NULL == _dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _dbusConnection == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ if (NULL == libdbusMessage) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " libdbusMessage == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+ if (NULL == userData) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " userData == NULL");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
- assert(dbusConnection->connection_ == _dbusConnection);
+ if (dbusConnection->connection_ != _dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " wrong connection!?");
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
return dbusConnection->onLibdbusObjectPathMessage(libdbusMessage);
}
@@ -1412,5 +1668,15 @@ std::shared_ptr<DBusConnection> DBusConnection::wrap(::DBusConnection *_connecti
return std::make_shared<DBusConnection>(_connection, _connectionId);
}
+void DBusConnection::pushDBusMessageReply(const DBusMessage& _reply,
+ std::unique_ptr<DBusMessageReplyAsyncHandler> _dbusMessageReplyAsyncHandler) {
+ // push message to the message queue
+ DBusMessageReplyAsyncHandler* replyAsyncHandler = _dbusMessageReplyAsyncHandler.release();
+ replyAsyncHandler->setHasToBeDeleted();
+ std::shared_ptr<DBusMessageWatch::MsgReplyQueueEntry> msgReplyQueueEntry = std::make_shared<DBusMessageWatch::MsgReplyQueueEntry>(
+ replyAsyncHandler, _reply);
+ msgWatch_->pushMsgQueue(msgReplyQueueEntry);
+}
+
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusDaemonProxy.cpp b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
index ee434b1..58ee08f 100644
--- a/src/CommonAPI/DBus/DBusDaemonProxy.cpp
+++ b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
@@ -39,7 +39,6 @@ static const char *DAEMON_DBUS_INTERFACE = DBusDaemonProxy::getInterfaceId();
static const char *DAEMON_DBUS_OBJECT_PATH = "/org/freedesktop/DBus";
static const char *DAEMON_DBUS_BUS = "org.freedesktop.DBus";
static DBusAddress dbusProxyAddress(DAEMON_DBUS_INTERFACE, DAEMON_DBUS_OBJECT_PATH, DAEMON_DBUS_BUS);
-static CommonAPI::CallInfo daemonProxyInfo(30000);
DBusDaemonProxy::DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection):
DBusProxyBase(dbusProxyAddress, dbusConnection),
@@ -60,6 +59,12 @@ bool DBusDaemonProxy::isAvailableBlocking() const {
return isAvailable();
}
+std::future<AvailabilityStatus> DBusDaemonProxy::isAvailableAsync(
+ isAvailableAsyncCallback _callback,
+ const CallInfo *_info) const {
+ return isAvailableAsync(_callback, _info);
+}
+
ProxyStatusEvent& DBusDaemonProxy::getProxyStatusEvent() {
return getDBusConnection()->getConnectionStatusEvent();
}
@@ -94,14 +99,6 @@ void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<s
callStatus = CallStatus::SUCCESS;
}
-std::future<CallStatus> DBusDaemonProxy::listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const {
- DBusMessage dbusMessage = createMethodCall("ListNames", "");
- return getDBusConnection()->sendDBusMessageWithReplyAsync(
- dbusMessage,
- DBusProxyAsyncCallbackHandler<std::vector<std::string>>::create(listNamesAsyncCallback, std::tuple<std::vector<std::string>>()),
- &daemonProxyInfo);
-}
-
void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const {
DBusMessage dbusMethodCall = createMethodCall("NameHasOwner", "s");
@@ -132,54 +129,6 @@ void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallSt
callStatus = CallStatus::SUCCESS;
}
-std::future<CallStatus> DBusDaemonProxy::nameHasOwnerAsync(const std::string& busName, NameHasOwnerAsyncCallback nameHasOwnerAsyncCallback) const {
- DBusMessage dbusMessage = createMethodCall("NameHasOwner", "s");
-
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
- if (!success) {
- std::promise<CallStatus> promise;
- promise.set_value(CallStatus::OUT_OF_MEMORY);
- return promise.get_future();
- }
- outputStream.flush();
-
- return getDBusConnection()->sendDBusMessageWithReplyAsync(
- dbusMessage,
- DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback, std::tuple<bool>()),
- &daemonProxyInfo);
-}
-
-std::future<CallStatus> DBusDaemonProxy::getManagedObjectsAsync(const std::string& forDBusServiceName, GetManagedObjectsAsyncCallback callback) const {
- static DBusAddress address(forDBusServiceName, "/", "org.freedesktop.DBus.ObjectManager");
- auto dbusMethodCallMessage = DBusMessage::createMethodCall(address, "GetManagedObjects", "");
-
- return getDBusConnection()->sendDBusMessageWithReplyAsync(
- dbusMethodCallMessage,
- DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(
- callback, std::tuple<DBusObjectToInterfaceDict>()
- ),
- &daemonProxyInfo);
-}
-
-std::future<CallStatus> DBusDaemonProxy::getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const {
- DBusMessage dbusMessage = createMethodCall("GetNameOwner", "s");
-
- DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<std::string>::serialize(outputStream, busName);
- if (!success) {
- std::promise<CallStatus> promise;
- promise.set_value(CallStatus::OUT_OF_MEMORY);
- return promise.get_future();
- }
- outputStream.flush();
-
- return getDBusConnection()->sendDBusMessageWithReplyAsync(
- dbusMessage,
- DBusProxyAsyncCallbackHandler<std::string>::create(getNameOwnerAsyncCallback, std::tuple<std::string>()),
- &daemonProxyInfo);
-}
-
const char* DBusDaemonProxy::getInterfaceId() {
static const char interfaceId[] = "org.freedesktop.DBus";
return interfaceId;
diff --git a/src/CommonAPI/DBus/DBusError.cpp b/src/CommonAPI/DBus/DBusError.cpp
index b5f5d5c..884f23b 100644
--- a/src/CommonAPI/DBus/DBusError.cpp
+++ b/src/CommonAPI/DBus/DBusError.cpp
@@ -3,7 +3,6 @@
// 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 <cassert>
#include <cstring>
#include <CommonAPI/DBus/DBusError.hpp>
diff --git a/src/CommonAPI/DBus/DBusFactory.cpp b/src/CommonAPI/DBus/DBusFactory.cpp
index 40da41f..d7fa84c 100644
--- a/src/CommonAPI/DBus/DBusFactory.cpp
+++ b/src/CommonAPI/DBus/DBusFactory.cpp
@@ -27,13 +27,37 @@ Factory::get() {
return theFactory;
}
-Factory::Factory() {
+Factory::Factory() : isInitialized_(false) {
}
Factory::~Factory() {
}
void
+Factory::init() {
+#ifndef WIN32
+ std::lock_guard<std::mutex> itsLock(initializerMutex_);
+#endif
+ if (!isInitialized_) {
+ for (auto i : initializers_) i();
+ initializers_.clear(); // Not needed anymore
+ isInitialized_ = true;
+ }
+}
+
+void
+Factory::registerInterface(InterfaceInitFunction _function) {
+ std::lock_guard<std::mutex> itsLock(initializerMutex_);
+ if (isInitialized_) {
+ // We are already running --> initialize the interface library!
+ _function();
+ } else {
+ // We are not initialized --> save the initializer
+ initializers_.push_back(_function);
+ }
+}
+
+void
Factory::registerProxyCreateMethod(
const std::string &_interface, ProxyCreateFunction _function) {
proxyCreateFunctions_[_interface] = _function;
@@ -222,13 +246,14 @@ Factory::unregisterStubAdapter(std::shared_ptr<DBusStubAdapter> _adapter) {
std::shared_ptr<DBusConnection>
Factory::getConnection(const ConnectionId_t &_connectionId) {
+ std::lock_guard<std::mutex> itsGuard(connectionsMutex_);
auto itsConnectionIterator = connections_.find(_connectionId);
if (itsConnectionIterator != connections_.end()) {
return itsConnectionIterator->second;
}
// No connection found, lets create and initialize one
- DBusType_t dbusType = DBusAddressTranslator::get()->getDBusBusType(_connectionId);
+ const DBusType_t dbusType = DBusAddressTranslator::get()->getDBusBusType(_connectionId);
std::shared_ptr<DBusConnection> itsConnection
= std::make_shared<DBusConnection>(dbusType, _connectionId);
connections_.insert({ _connectionId, itsConnection });
@@ -242,14 +267,16 @@ Factory::getConnection(std::shared_ptr<MainLoopContext> _context) {
if (!_context)
return getConnection(DEFAULT_CONNECTION_ID);
+ std::lock_guard<std::mutex> itsGuard(contextConnectionsMutex_);
auto itsConnectionIterator = contextConnections_.find(_context.get());
if (itsConnectionIterator != contextConnections_.end()) {
return itsConnectionIterator->second;
}
// No connection found, lets create and initialize one
+ const DBusType_t dbusType = DBusAddressTranslator::get()->getDBusBusType(_context->getName());
std::shared_ptr<DBusConnection> itsConnection
- = std::make_shared<DBusConnection>(DBusType_t::SESSION, _context->getName());
+ = std::make_shared<DBusConnection>(dbusType, _context->getName());
contextConnections_.insert({ _context.get(), itsConnection } );
itsConnection->connect(false);
@@ -310,9 +337,9 @@ Factory::registerManagedService(const std::shared_ptr<DBusStubAdapter> &_stubAda
const bool isAcquired = connection->requestServiceNameAndBlock(serviceName);
if (!isAcquired) {
const bool isDeregistered = objectManager->unregisterDBusStubAdapter(_stubAdapter);
- assert(isDeregistered);
- (void)isDeregistered;
-
+ if (!isDeregistered) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " couldn't deregister ", serviceName);
+ }
services_.erase(insertResult.first);
}
@@ -348,5 +375,87 @@ Factory::unregisterManagedService(const ServicesMap::iterator &iterator) {
return isUnregistered;
}
+void Factory::incrementConnection(std::shared_ptr<DBusProxyConnection> _connection) {
+ std::shared_ptr<DBusConnection> connection;
+ {
+ std::lock_guard<std::mutex> itsConnectionGuard(connectionsMutex_);
+ for (auto itsConnectionIterator = connections_.begin(); itsConnectionIterator != connections_.end(); itsConnectionIterator++) {
+ if (itsConnectionIterator->second == _connection) {
+ connection = itsConnectionIterator->second;
+ break;
+ }
+ }
+ }
+
+ if(connection)
+ connection->incrementConnection();
+
+ std::shared_ptr<DBusConnection> contextConnection;
+ {
+ std::lock_guard<std::mutex> itsContextConnectionGuard(contextConnectionsMutex_);
+ for (auto itsConnectionIterator = contextConnections_.begin(); itsConnectionIterator != contextConnections_.end(); itsConnectionIterator++) {
+ if (itsConnectionIterator->second == _connection) {
+ contextConnection = itsConnectionIterator->second;
+ break;
+ }
+ }
+ }
+
+ if(contextConnection)
+ contextConnection->incrementConnection();
+}
+
+void Factory::decrementConnection(std::shared_ptr<DBusProxyConnection> _connection) {
+ std::shared_ptr<DBusConnection> connection;
+ {
+ std::lock_guard<std::mutex> itsConnectionGuard(connectionsMutex_);
+ for (auto itsConnectionIterator = connections_.begin(); itsConnectionIterator != connections_.end(); itsConnectionIterator++) {
+ if (itsConnectionIterator->second == _connection) {
+ connection = itsConnectionIterator->second;
+ break;
+ }
+ }
+ }
+
+ if(connection)
+ connection->decrementConnection();
+
+ std::shared_ptr<DBusConnection> contextConnection;
+ {
+ std::lock_guard<std::mutex> itsContextConnectionGuard(contextConnectionsMutex_);
+ for (auto itsConnectionIterator = contextConnections_.begin(); itsConnectionIterator != contextConnections_.end(); itsConnectionIterator++) {
+ if (itsConnectionIterator->second == _connection) {
+ contextConnection = itsConnectionIterator->second;
+ break;
+ }
+ }
+ }
+
+ if(contextConnection)
+ contextConnection->decrementConnection();
+}
+
+void Factory::releaseConnection(const ConnectionId_t& _connectionId, MainLoopContext* _mainloopContext) {
+ {
+ std::lock_guard<std::mutex> itsConnectionGuard(connectionsMutex_);
+ auto connection = connections_.find(_connectionId);
+
+ if (connection != connections_.end()) {
+ DBusServiceRegistry::remove(connection->second);
+ connections_.erase(_connectionId);
+ }
+ }
+
+ {
+ std::lock_guard<std::mutex> itsContextConnectionGuard(contextConnectionsMutex_);
+ auto connectionContext = contextConnections_.find(_mainloopContext);
+
+ if (connectionContext != contextConnections_.end()) {
+ DBusServiceRegistry::remove(connectionContext->second);
+ contextConnections_.erase(_mainloopContext);
+ }
+ }
+}
+
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
index 75fc0b5..f41b77e 100644
--- a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
+++ b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
@@ -3,8 +3,8 @@
// 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 <cassert>
#include <vector>
+#include <algorithm>
#include <CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp>
#include <CommonAPI/DBus/DBusStubAdapter.hpp>
@@ -21,14 +21,30 @@ DBusFreedesktopPropertiesStub::DBusFreedesktopPropertiesStub(
: path_(_path),
connection_(_connection),
adapter_(_adapter) {
- assert(!path_.empty());
- assert(path_[0] == '/');
- assert(_connection);
+ if (path_.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty _path");
+ }
+ if ('/' != path_[0]) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid _path ", _path);
+ }
+ if (!_connection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid _connection");
+ }
dbusInterfacesLock_.lock();
- if(managedInterfaces_.find(_interface) == managedInterfaces_.end()) {
- managedInterfaces_.insert({ _interface, _adapter });
+
+ const auto& it = managedInterfaces_.find(_interface);
+ if (it != managedInterfaces_.end()) {
+ auto& adapters = it->second;
+ if (find(adapters.begin(), adapters.end(), _adapter) == adapters.end()) {
+ adapters.push_back(_adapter);
+ it->second = adapters;
+ }
}
+ else {
+ managedInterfaces_.insert({ _interface, std::vector<std::shared_ptr<DBusStubAdapter>> ({_adapter}) });
+ }
+
dbusInterfacesLock_.unlock();
}
@@ -86,7 +102,12 @@ DBusFreedesktopPropertiesStub::onInterfaceDBusMessage(const DBusMessage &_messag
return false;
}
- return it->second->onInterfaceDBusFreedesktopPropertiesMessage(_message);
+ for (auto& adapter : it->second) {
+ adapter->onInterfaceDBusFreedesktopPropertiesMessage(_message);
+ }
+
+ // errors are ignored.
+ return true;
}
bool DBusFreedesktopPropertiesStub::hasFreedesktopProperties() {
diff --git a/src/CommonAPI/DBus/DBusFunctionalHash.cpp b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
index 00b5da6..e82d578 100644
--- a/src/CommonAPI/DBus/DBusFunctionalHash.cpp
+++ b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
@@ -3,11 +3,11 @@
// 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 <cassert>
#include <cstring>
#include <murmurhash/MurmurHash3.h>
+#include <CommonAPI/Logger.hpp>
#include <CommonAPI/DBus/DBusFunctionalHash.hpp>
/*
@@ -15,18 +15,29 @@
*/
#define SMHASHER_SEED_VALUE 0xc70f6907UL
+using namespace CommonAPI;
+
namespace std {
size_t hash<pair<const char*, const char*> >::operator()(const pair<const char*, const char*>& t) const {
const char* a = t.first;
const char* b = t.second;
- assert(a);
- assert(b);
+ if (NULL == a) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " t.first is NULL");
+ }
+ if (NULL == b) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " t.second is NULL");
+ }
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a, static_cast<int>(strlen(a)), seed, &seed);
- MurmurHash3_x86_32(b, static_cast<int>(strlen(b)), seed, &seed);
+
+ if (NULL != a) {
+ MurmurHash3_x86_32(a, static_cast<int>(strlen(a)), seed, &seed);
+ }
+ if (NULL != b) {
+ MurmurHash3_x86_32(b, static_cast<int>(strlen(b)), seed, &seed);
+ }
return static_cast<size_t>(seed);
}
diff --git a/src/CommonAPI/DBus/DBusInputStream.cpp b/src/CommonAPI/DBus/DBusInputStream.cpp
index ae2201a..0c838a0 100644
--- a/src/CommonAPI/DBus/DBusInputStream.cpp
+++ b/src/CommonAPI/DBus/DBusInputStream.cpp
@@ -13,7 +13,7 @@ namespace DBus {
DBusInputStream::DBusInputStream(const CommonAPI::DBus::DBusMessage &_message)
: begin_(_message.getBodyData()),
current_(0),
- size_(_message.getBodyLength()),
+ size_((size_t)(_message.getBodyLength())),
exception_(nullptr),
message_(_message) {
}
@@ -38,7 +38,10 @@ void DBusInputStream::align(const size_t _boundary) {
}
char *DBusInputStream::_readRaw(const size_t _size) {
- assert(current_ + _size <= size_);
+ if ((current_ + _size) > size_) {
+ setError();
+ return NULL;
+ }
char *data = (char *) (begin_ + current_);
current_ += _size;
@@ -130,14 +133,15 @@ InputStream<DBusInputStream> &DBusInputStream::readValue(double &_value, const E
InputStream<DBusInputStream> &DBusInputStream::readValue(std::string &_value, const EmptyDeployment *_depl) {
(void)_depl;
- uint32_t length;
+ uint32_t length(0);
_readValue(length);
// length field does not include terminating 0-byte, therefore length of data to read is +1
char *data = _readRaw(length + 1);
-
- // The string contained in a DBus-message is required to be 0-terminated, therefore the following line works
- _value = data;
+ if (!hasError()) {
+ // The string contained in a DBus-message is required to be 0-terminated, therefore the following line works
+ _value = data;
+ }
return (*this);
}
diff --git a/src/CommonAPI/DBus/DBusMainLoop.cpp b/src/CommonAPI/DBus/DBusMainLoop.cpp
index a46072f..b9daea3 100755
--- a/src/CommonAPI/DBus/DBusMainLoop.cpp
+++ b/src/CommonAPI/DBus/DBusMainLoop.cpp
@@ -203,6 +203,8 @@ DBusMainLoop::~DBusMainLoop() {
#else
close(wakeFd_.fd);
#endif
+
+ cleanup();
}
void DBusMainLoop::run(const int64_t& timeoutInterval) {
@@ -228,9 +230,9 @@ void DBusMainLoop::doSingleIteration(const int64_t& timeout) {
if (!(dispatchSourceIterator->second)->isExecuted_) {
(dispatchSourceIterator->second)->mutex_->unlock();
bool contained = false;
- for (std::set<DispatchSourceToDispatchStruct*>::iterator dispatchSourceIteratorInner = sourcesToDispatch_.begin();
+ for (std::set<std::pair<DispatchPriority, DispatchSourceToDispatchStruct*>>::iterator dispatchSourceIteratorInner = sourcesToDispatch_.begin();
dispatchSourceIteratorInner != sourcesToDispatch_.end(); dispatchSourceIteratorInner++) {
- if ((*dispatchSourceIteratorInner)->dispatchSource_ == (dispatchSourceIterator->second)->dispatchSource_) {
+ if (std::get<1>(*dispatchSourceIteratorInner)->dispatchSource_ == (dispatchSourceIterator->second)->dispatchSource_) {
contained = true;
break;
}
@@ -268,9 +270,9 @@ void DBusMainLoop::doSingleIteration(const int64_t& timeout) {
if (!(timeoutIterator->second)->isExecuted_) {
(timeoutIterator->second)->mutex_->unlock();
bool contained = false;
- for (std::set<TimeoutToDispatchStruct*>::iterator timeoutIteratorInner = timeoutsToDispatch_.begin();
+ for (std::set<std::pair<DispatchPriority, TimeoutToDispatchStruct*>>::iterator timeoutIteratorInner = timeoutsToDispatch_.begin();
timeoutIteratorInner != timeoutsToDispatch_.end(); timeoutIteratorInner++) {
- if ((*timeoutIteratorInner)->timeout_ == (timeoutIterator->second)->timeout_) {
+ if (std::get<1>(*timeoutIteratorInner)->timeout_ == (timeoutIterator->second)->timeout_) {
contained = true;
break;
}
@@ -310,7 +312,7 @@ void DBusMainLoop::doSingleIteration(const int64_t& timeout) {
bool contained = false;
for (auto watchesIteratorInner = watchesToDispatch_.begin();
watchesIteratorInner != watchesToDispatch_.end(); watchesIteratorInner++) {
- if ((*watchesIteratorInner)->watch_ == (watchesIterator->second)->watch_) {
+ if (std::get<1>(*watchesIteratorInner)->watch_ == (watchesIterator->second)->watch_) {
contained = true;
break;
}
@@ -350,20 +352,22 @@ void DBusMainLoop::doSingleIteration(const int64_t& timeout) {
bool DBusMainLoop::prepare(const int64_t& timeout) {
currentMinimalTimeoutInterval_ = timeout;
- {
- std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
- for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
- dispatchSourceIterator != registeredDispatchSources_.end();
- dispatchSourceIterator++) {
+ dispatchSourcesMutex_.lock();
+ for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
+ dispatchSourceIterator != registeredDispatchSources_.end();
+ dispatchSourceIterator++) {
- int64_t dispatchTimeout = TIMEOUT_INFINITE;
- if ((dispatchSourceIterator->second)->dispatchSource_->prepare(dispatchTimeout)) {
- sourcesToDispatch_.insert(dispatchSourceIterator->second);
- } else if (dispatchTimeout < currentMinimalTimeoutInterval_) {
- currentMinimalTimeoutInterval_ = dispatchTimeout;
- }
+ int64_t dispatchTimeout = TIMEOUT_INFINITE;
+ dispatchSourcesMutex_.unlock();
+ if (!(dispatchSourceIterator->second->deleteObject_) &&
+ (dispatchSourceIterator->second)->dispatchSource_->prepare(dispatchTimeout)) {
+ sourcesToDispatch_.insert(*dispatchSourceIterator);
+ } else if (dispatchTimeout > 0 && dispatchTimeout < currentMinimalTimeoutInterval_) {
+ currentMinimalTimeoutInterval_ = dispatchTimeout;
}
+ dispatchSourcesMutex_.lock();
}
+ dispatchSourcesMutex_.unlock();
int64_t currentContextTime = getCurrentTimeInMs();
@@ -386,7 +390,7 @@ bool DBusMainLoop::prepare(const int64_t& timeout) {
// set information that timeout is elapsed
(timeoutPriorityRange->second)->timeoutElapsed_ = true;
- timeoutsToDispatch_.insert(timeoutPriorityRange->second);
+ timeoutsToDispatch_.insert(*timeoutPriorityRange);
currentMinimalTimeoutInterval_ = TIMEOUT_NONE;
} else if (intervalToReady < currentMinimalTimeoutInterval_) {
currentMinimalTimeoutInterval_ = intervalToReady;
@@ -401,16 +405,18 @@ bool DBusMainLoop::prepare(const int64_t& timeout) {
void DBusMainLoop::poll() {
int managedFileDescriptorOffset = 0;
-
- for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
- (*fileDescriptor).revents = 0;
+ {
+ std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
+ for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
+ (*fileDescriptor).revents = 0;
+ }
}
-#ifdef WIN32
- size_t numReadyFileDescriptors = WSAPoll(&managedFileDescriptors_[0], managedFileDescriptors_.size(), -1);
+#ifdef WIN32
+ int numReadyFileDescriptors = WSAPoll(&managedFileDescriptors_[0], managedFileDescriptors_.size(), int(currentMinimalTimeoutInterval_));
#else
- size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]),
- managedFileDescriptors_.size(), -1);
+ int numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]),
+ managedFileDescriptors_.size(), int(currentMinimalTimeoutInterval_));
#endif
if (!numReadyFileDescriptors) {
int64_t currentContextTime = getCurrentTimeInMs();
@@ -435,7 +441,7 @@ void DBusMainLoop::poll() {
// set information that timeout is elapsed
(timeoutPriorityRange->second)->timeoutElapsed_ = true;
- timeoutsToDispatch_.insert(timeoutPriorityRange->second);
+ timeoutsToDispatch_.insert(*timeoutPriorityRange);
}
}
}
@@ -450,7 +456,7 @@ void DBusMainLoop::poll() {
}
bool DBusMainLoop::check() {
-//The first file descriptor always is the loop's wakeup-descriptor (but not for windows anymore). All others need to be linked to a watch.
+ //The first file descriptor always is the loop's wakeup-descriptor (but not for windows anymore). All others need to be linked to a watch.
int managedFileDescriptorOffset = 1;
{
std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
@@ -461,7 +467,7 @@ bool DBusMainLoop::check() {
for (auto registeredWatchIterator = registeredWatches_.begin();
registeredWatchIterator != registeredWatches_.end();
registeredWatchIterator++) {
-
+
(registeredWatchIterator->second)->mutex_->lock();
bool deleteObject = (registeredWatchIterator->second)->deleteObject_;
(registeredWatchIterator->second)->mutex_->unlock();
@@ -469,23 +475,26 @@ bool DBusMainLoop::check() {
if (!deleteObject) {
if ((registeredWatchIterator->second)->fd_ == fileDescriptor->fd
&& fileDescriptor->revents) {
- watchesToDispatch_.insert(registeredWatchIterator->second);
+ watchesToDispatch_.insert(*registeredWatchIterator);
}
}
}
}
}
}
- {
- std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
- for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
- dispatchSourceIterator != registeredDispatchSources_.end();
- ++dispatchSourceIterator) {
- if ((dispatchSourceIterator->second)->dispatchSource_->check()) {
- sourcesToDispatch_.insert(dispatchSourceIterator->second);
- }
+
+ dispatchSourcesMutex_.lock();
+ for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
+ dispatchSourceIterator != registeredDispatchSources_.end();
+ ++dispatchSourceIterator) {
+ dispatchSourcesMutex_.unlock();
+ if (!dispatchSourceIterator->second->deleteObject_&&
+ dispatchSourceIterator->second->dispatchSource_->check()) {
+ sourcesToDispatch_.insert(*dispatchSourceIterator);
}
+ dispatchSourcesMutex_.lock();
}
+ dispatchSourcesMutex_.unlock();
return (!timeoutsToDispatch_.empty() ||
!watchesToDispatch_.empty() ||
@@ -497,15 +506,16 @@ void DBusMainLoop::dispatch() {
{
for (auto timeoutIterator = timeoutsToDispatch_.begin();
timeoutIterator != timeoutsToDispatch_.end(); timeoutIterator++) {
- (*timeoutIterator)->mutex_->lock();
- if (!(*timeoutIterator)->deleteObject_) {
- (*timeoutIterator)->isExecuted_ = true;
- (*timeoutIterator)->mutex_->unlock();
- (*timeoutIterator)->timeout_->dispatch();
- (*timeoutIterator)->mutex_->lock();
- (*timeoutIterator)->isExecuted_ = false;
+ auto timeoutToDispatchStruct = std::get<1>(*timeoutIterator);
+ timeoutToDispatchStruct->mutex_->lock();
+ if (!timeoutToDispatchStruct->deleteObject_) {
+ timeoutToDispatchStruct->isExecuted_ = true;
+ timeoutToDispatchStruct->mutex_->unlock();
+ timeoutToDispatchStruct->timeout_->dispatch();
+ timeoutToDispatchStruct->mutex_->lock();
+ timeoutToDispatchStruct->isExecuted_ = false;
}
- (*timeoutIterator)->mutex_->unlock();
+ timeoutToDispatchStruct->mutex_->unlock();
}
timeoutsToDispatch_.clear();
@@ -515,17 +525,18 @@ void DBusMainLoop::dispatch() {
{
for (auto watchIterator = watchesToDispatch_.begin();
watchIterator != watchesToDispatch_.end(); watchIterator++) {
- (*watchIterator)->mutex_->lock();
- if (!(*watchIterator)->deleteObject_) {
- (*watchIterator)->isExecuted_ = true;
- (*watchIterator)->mutex_->unlock();
- Watch* watch = (*watchIterator)->watch_;
- const unsigned int flags = watch->getAssociatedFileDescriptor().events;
+ auto watchToDispatchStruct = std::get<1>(*watchIterator);
+ watchToDispatchStruct->mutex_->lock();
+ if (!watchToDispatchStruct->deleteObject_) {
+ watchToDispatchStruct->isExecuted_ = true;
+ watchToDispatchStruct->mutex_->unlock();
+ Watch* watch = watchToDispatchStruct->watch_;
+ const unsigned int flags = (unsigned int)(watch->getAssociatedFileDescriptor().events);
watch->dispatch(flags);
- (*watchIterator)->mutex_->lock();
- (*watchIterator)->isExecuted_ = false;
+ watchToDispatchStruct->mutex_->lock();
+ watchToDispatchStruct->isExecuted_ = false;
}
- (*watchIterator)->mutex_->unlock();
+ watchToDispatchStruct->mutex_->unlock();
}
watchesToDispatch_.clear();
}
@@ -536,15 +547,17 @@ void DBusMainLoop::dispatch() {
for (auto dispatchSourceIterator = sourcesToDispatch_.begin();
dispatchSourceIterator != sourcesToDispatch_.end() && !isBroken_;
dispatchSourceIterator++) {
- (*dispatchSourceIterator)->mutex_->lock();
- if (!(*dispatchSourceIterator)->deleteObject_) {
- (*dispatchSourceIterator)->isExecuted_ = true;
- (*dispatchSourceIterator)->mutex_->unlock();
- while ((*dispatchSourceIterator)->dispatchSource_->dispatch());
- (*dispatchSourceIterator)->mutex_->lock();
- (*dispatchSourceIterator)->isExecuted_ = false;
+ auto dispatchSourceToDispatchStruct = std::get<1>(*dispatchSourceIterator);
+ dispatchSourceToDispatchStruct->mutex_->lock();
+ if (!dispatchSourceToDispatchStruct->deleteObject_) {
+ dispatchSourceToDispatchStruct->isExecuted_ = true;
+ dispatchSourceToDispatchStruct->mutex_->unlock();
+ while(!dispatchSourceToDispatchStruct->deleteObject_ &&
+ dispatchSourceToDispatchStruct->dispatchSource_->dispatch());
+ dispatchSourceToDispatchStruct->mutex_->lock();
+ dispatchSourceToDispatchStruct->isExecuted_ = false;
}
- (*dispatchSourceIterator)->mutex_->unlock();
+ dispatchSourceToDispatchStruct->mutex_->unlock();
}
{
sourcesToDispatch_.clear();
@@ -597,6 +610,50 @@ void DBusMainLoop::wakeupAck() {
#endif
}
+void DBusMainLoop::cleanup() {
+ {
+ std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
+ for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
+ dispatchSourceIterator != registeredDispatchSources_.end();) {
+
+ delete (dispatchSourceIterator->second)->dispatchSource_;
+ (dispatchSourceIterator->second)->dispatchSource_ = NULL;
+ delete (dispatchSourceIterator->second)->mutex_;
+ (dispatchSourceIterator->second)->mutex_ = NULL;
+ delete dispatchSourceIterator->second;
+ dispatchSourceIterator = registeredDispatchSources_.erase(dispatchSourceIterator);
+ }
+ }
+
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ for (auto timeoutIterator = registeredTimeouts_.begin();
+ timeoutIterator != registeredTimeouts_.end();) {
+
+ delete (timeoutIterator->second)->timeout_;
+ (timeoutIterator->second)->timeout_ = NULL;
+ delete (timeoutIterator->second)->mutex_;
+ (timeoutIterator->second)->mutex_ = NULL;
+ delete timeoutIterator->second;
+ timeoutIterator = registeredTimeouts_.erase(timeoutIterator);
+ }
+ }
+
+ {
+ std::lock_guard<std::mutex> itsLock(watchesMutex_);
+ for (auto watchesIterator = registeredWatches_.begin();
+ watchesIterator != registeredWatches_.end();) {
+
+ delete (watchesIterator->second)->watch_;
+ (watchesIterator->second)->watch_ = NULL;
+ delete (watchesIterator->second)->mutex_;
+ (watchesIterator->second)->mutex_ = NULL;
+ delete watchesIterator->second;
+ watchesIterator = registeredWatches_.erase(watchesIterator);
+ }
+ }
+}
+
void DBusMainLoop::registerFileDescriptor(
const DBusMainLoopPollFd& fileDescriptor) {
std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
diff --git a/src/CommonAPI/DBus/DBusMainLoopContext.cpp b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
index 1c795ad..5c8afa5 100644
--- a/src/CommonAPI/DBus/DBusMainLoopContext.cpp
+++ b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
@@ -7,8 +7,12 @@
#include <WinSock2.h>
#else
#include <poll.h>
+#include <unistd.h>
#endif
+#include <fcntl.h>
+#include <cstdio>
+
#include <chrono>
#include <CommonAPI/DBus/DBusMainLoopContext.hpp>
@@ -25,7 +29,7 @@ DBusDispatchSource::~DBusDispatchSource() {
}
bool DBusDispatchSource::prepare(int64_t &_timeout) {
- (void)_timeout;
+ _timeout = -1;
return dbusConnection_->isDispatchReady();
}
@@ -37,11 +41,46 @@ bool DBusDispatchSource::dispatch() {
return dbusConnection_->singleDispatch();
}
+DBusMessageDispatchSource::DBusMessageDispatchSource(DBusMessageWatch* watch) :
+ watch_(watch) {
+ watch_->addDependentDispatchSource(this);
+}
+
+DBusMessageDispatchSource::~DBusMessageDispatchSource() {
+ std::unique_lock<std::mutex> itsLock(watchMutex_);
+ watch_->removeDependentDispatchSource(this);
+}
+
+bool DBusMessageDispatchSource::prepare(int64_t& timeout) {
+ std::unique_lock<std::mutex> itsLock(watchMutex_);
+ timeout = -1;
+ return !watch_->emptyMsgQueue();
+}
+
+bool DBusMessageDispatchSource::check() {
+ std::unique_lock<std::mutex> itsLock(watchMutex_);
+ return !watch_->emptyMsgQueue();
+}
+
+bool DBusMessageDispatchSource::dispatch() {
+ std::unique_lock<std::mutex> itsLock(watchMutex_);
+ if (!watch_->emptyMsgQueue()) {
+ auto queueEntry = watch_->frontMsgQueue();
+ watch_->popMsgQueue();
+ watch_->processMsgQueueEntry(queueEntry);
+ }
-DBusWatch::DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>& mainLoopContext):
+ return !watch_->emptyMsgQueue();
+}
+
+DBusWatch::DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>& mainLoopContext,
+ std::weak_ptr<DBusConnection>& dbusConnection):
libdbusWatch_(libdbusWatch),
- mainLoopContext_(mainLoopContext) {
- assert(libdbusWatch_);
+ mainLoopContext_(mainLoopContext),
+ dbusConnection_(dbusConnection) {
+ if (NULL == libdbusWatch_) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " libdbusWatch_ == NULL");
+ }
}
bool DBusWatch::isReadyToBeWatched() {
@@ -52,11 +91,8 @@ void DBusWatch::startWatching() {
if(!dbus_watch_get_enabled(libdbusWatch_)) stopWatching();
unsigned int channelFlags_ = dbus_watch_get_flags(libdbusWatch_);
-#ifdef WIN32
short int pollFlags = 0;
-#else
- short int pollFlags = POLLERR | POLLHUP;
-#endif
+
if(channelFlags_ & DBUS_WATCH_READABLE) {
pollFlags |= POLLIN;
}
@@ -76,8 +112,11 @@ void DBusWatch::startWatching() {
pollFileDescriptor_.revents = 0;
auto lockedContext = mainLoopContext_.lock();
- assert(lockedContext);
- lockedContext->registerWatch(this);
+ if (NULL == lockedContext) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " lockedContext == NULL");
+ } else {
+ lockedContext->registerWatch(this);
+ }
}
void DBusWatch::stopWatching() {
@@ -120,10 +159,15 @@ void DBusWatch::dispatch(unsigned int eventFlags) {
((eventFlags & POLLERR) >> 1) |
((eventFlags & POLLHUP) >> 1);
#endif
- dbus_bool_t response = dbus_watch_handle(libdbusWatch_, dbusWatchFlags);
-
- if (!response) {
- printf("dbus_watch_handle returned FALSE!");
+ std::shared_ptr<DBusConnection> itsConnection = dbusConnection_.lock();
+ if(itsConnection) {
+ if(itsConnection->setDispatching(true)) {
+ dbus_bool_t response = dbus_watch_handle(libdbusWatch_, dbusWatchFlags);
+ if (!response) {
+ printf("dbus_watch_handle returned FALSE!");
+ }
+ itsConnection->setDispatching(false);
+ }
}
}
@@ -135,6 +179,244 @@ void DBusWatch::addDependentDispatchSource(DispatchSource* dispatchSource) {
dependentDispatchSources_.push_back(dispatchSource);
}
+void DBusMessageWatch::MsgReplyQueueEntry::process(std::shared_ptr<DBusConnection> _connection) {
+ _connection->dispatchDBusMessageReply(message_, replyAsyncHandler_);
+}
+
+void DBusMessageWatch::MsgReplyQueueEntry::clear() {
+ delete replyAsyncHandler_;
+}
+
+void DBusMessageWatch::MsgQueueEntry::clear() {
+
+}
+
+DBusMessageWatch::DBusMessageWatch(std::shared_ptr<DBusConnection> _connection) : pipeValue_(4) {
+#ifdef WIN32
+ std::string pipeName = "\\\\.\\pipe\\CommonAPI-DBus-";
+
+ UUID uuid;
+ CHAR* uuidString = NULL;
+ UuidCreate(&uuid);
+ UuidToString(&uuid, (RPC_CSTR*)&uuidString);
+ pipeName += uuidString;
+ RpcStringFree((RPC_CSTR*)&uuidString);
+
+ HANDLE hPipe = ::CreateNamedPipe(
+ pipeName.c_str(),
+ PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
+ PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE,
+ 1,
+ 4096,
+ 4096,
+ 100,
+ nullptr);
+
+ if (hPipe == INVALID_HANDLE_VALUE) {
+ if (GetLastError() != ERROR_PIPE_BUSY)
+ {
+ printf("Could not open pipe %d\n", GetLastError());
+ }
+
+ // All pipe instances are busy, so wait for sometime.
+ else if (!WaitNamedPipe(pipeName.c_str(), NMPWAIT_USE_DEFAULT_WAIT))
+ {
+ printf("Could not open pipe: wait timed out.\n");
+ }
+ }
+
+ HANDLE hPipe2 = CreateFile(
+ pipeName.c_str(), // pipe name
+ GENERIC_READ | // read and write access
+ GENERIC_WRITE,
+ 0, // no sharing
+ NULL, // default security attributes
+ OPEN_EXISTING, // opens existing pipe
+ 0, // default attributes
+ NULL); // no template file
+
+ if (hPipe2 == INVALID_HANDLE_VALUE) {
+ if (GetLastError() != ERROR_PIPE_BUSY)
+ {
+ printf("Could not open pipe2 %d\n", GetLastError());
+ }
+
+ // All pipe instances are busy, so wait for sometime.
+ else if (!WaitNamedPipe(pipeName.c_str(), NMPWAIT_USE_DEFAULT_WAIT))
+ {
+ printf("Could not open pipe2: wait timed out.\n");
+ }
+ }
+
+ pipeFileDescriptors_[0] = (int)hPipe;
+ pipeFileDescriptors_[1] = (int)hPipe2;
+
+ wsaEvent_ = ::CreateEventW(nullptr, TRUE, FALSE, nullptr);
+
+ if (wsaEvent_ == WSA_INVALID_EVENT) {
+ printf("Invalid Event Created!\n");
+ }
+
+ ov = { 0 };
+ ov.hEvent = wsaEvent_;
+
+ BOOL retVal = ::ConnectNamedPipe(hPipe, &ov);
+
+ if (retVal == 0) {
+ int error = GetLastError();
+
+ if (error != 535) {
+ printf("ERROR: ConnectNamedPipe failed with (%d)\n", error);
+ }
+ }
+#else
+ if(pipe2(pipeFileDescriptors_, O_NONBLOCK) == -1) {
+ std::perror(__func__);
+ }
+#endif
+ pollFileDescriptor_.fd = pipeFileDescriptors_[0];
+ pollFileDescriptor_.events = POLLIN;
+
+ connection_ = _connection;
+}
+
+DBusMessageWatch::~DBusMessageWatch() {
+#ifdef WIN32
+ BOOL retVal = DisconnectNamedPipe((HANDLE)pipeFileDescriptors_[0]);
+
+ if (!retVal) {
+ printf(TEXT("DisconnectNamedPipe failed. GLE=%d\n"), GetLastError());
+ }
+
+ retVal = CloseHandle((HANDLE)pipeFileDescriptors_[0]);
+
+ if (!retVal) {
+ printf(TEXT("CloseHandle failed. GLE=%d\n"), GetLastError());
+ }
+
+ retVal = CloseHandle((HANDLE)pipeFileDescriptors_[1]);
+
+ if (!retVal) {
+ printf(TEXT("CloseHandle2 failed. GLE=%d\n"), GetLastError());
+ }
+#else
+ close(pipeFileDescriptors_[0]);
+ close(pipeFileDescriptors_[1]);
+#endif
+
+ std::unique_lock<std::mutex> itsLock(msgQueueMutex_);
+ while(!msgQueue_.empty()) {
+ auto queueEntry = msgQueue_.front();
+ msgQueue_.pop();
+ queueEntry->clear();
+ }
+}
+
+void DBusMessageWatch::dispatch(unsigned int) {
+}
+
+const pollfd& DBusMessageWatch::getAssociatedFileDescriptor() {
+ return pollFileDescriptor_;
+}
+
+#ifdef WIN32
+const HANDLE& DBusMessageWatch::getAssociatedEvent() {
+ return wsaEvent_;
+}
+#endif
+
+const std::vector<DispatchSource*>& DBusMessageWatch::getDependentDispatchSources() {
+ return dependentDispatchSources_;
+}
+
+void DBusMessageWatch::addDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource) {
+ dependentDispatchSources_.push_back(_dispatchSource);
+}
+
+void DBusMessageWatch::removeDependentDispatchSource(CommonAPI::DispatchSource* _dispatchSource) {
+ std::vector<CommonAPI::DispatchSource*>::iterator it;
+
+ for (it = dependentDispatchSources_.begin(); it != dependentDispatchSources_.end(); it++) {
+ if ( (*it) == _dispatchSource ) {
+ dependentDispatchSources_.erase(it);
+ break;
+ }
+ }
+}
+
+void DBusMessageWatch::pushMsgQueue(std::shared_ptr<MsgQueueEntry> _queueEntry) {
+ std::unique_lock<std::mutex> itsLock(msgQueueMutex_);
+ msgQueue_.push(_queueEntry);
+
+#ifdef WIN32
+ char writeValue[sizeof(pipeValue_)];
+ *reinterpret_cast<int*>(writeValue) = pipeValue_;
+ DWORD cbWritten;
+
+ int fSuccess = WriteFile(
+ (HANDLE)pipeFileDescriptors_[1], // pipe handle
+ writeValue, // message
+ sizeof(pipeValue_), // message length
+ &cbWritten, // bytes written
+ &ov); // overlapped
+
+ if (!fSuccess)
+ {
+ printf(TEXT("WriteFile to pipe failed. GLE=%d\n"), GetLastError());
+ }
+#else
+ if(write(pipeFileDescriptors_[1], &pipeValue_, sizeof(pipeValue_)) == -1) {
+ std::perror(__func__);
+ }
+#endif
+}
+
+void DBusMessageWatch::popMsgQueue() {
+ std::unique_lock<std::mutex> itsLock(msgQueueMutex_);
+
+#ifdef WIN32
+ char readValue[sizeof(pipeValue_)];
+ DWORD cbRead;
+
+ int fSuccess = ReadFile(
+ (HANDLE)pipeFileDescriptors_[0], // pipe handle
+ readValue, // buffer to receive reply
+ sizeof(pipeValue_), // size of buffer
+ &cbRead, // number of bytes read
+ &ov); // overlapped
+
+ if (!fSuccess)
+ {
+ printf(TEXT("ReadFile to pipe failed. GLE=%d\n"), GetLastError());
+ }
+#else
+ int readValue = 0;
+ if(read(pipeFileDescriptors_[0], &readValue, sizeof(readValue)) == -1) {
+ std::perror(__func__);
+ }
+#endif
+
+ msgQueue_.pop();
+}
+
+std::shared_ptr<DBusMessageWatch::MsgQueueEntry> DBusMessageWatch::frontMsgQueue() {
+ std::unique_lock<std::mutex> itsLock(msgQueueMutex_);
+
+ return msgQueue_.front();
+}
+
+bool DBusMessageWatch::emptyMsgQueue() {
+ std::unique_lock<std::mutex> itsLock(msgQueueMutex_);
+
+ return msgQueue_.empty();
+}
+
+void DBusMessageWatch::processMsgQueueEntry(std::shared_ptr<DBusMessageWatch::MsgQueueEntry> _queueEntry) {
+ std::shared_ptr<DBusConnection> itsConnection = connection_.lock();
+ if(itsConnection) {
+ _queueEntry->process(itsConnection);
+ }
+}
DBusTimeout::DBusTimeout(::DBusTimeout* libdbusTimeout, std::weak_ptr<MainLoopContext>& mainLoopContext) :
dueTimeInMs_(TIMEOUT_INFINITE),
@@ -148,9 +430,12 @@ bool DBusTimeout::isReadyToBeMonitored() {
void DBusTimeout::startMonitoring() {
auto lockedContext = mainLoopContext_.lock();
- assert(lockedContext);
- recalculateDueTime();
- lockedContext->registerTimeoutSource(this);
+ if (NULL == lockedContext) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " lockedContext == NULL");
+ } else {
+ recalculateDueTime();
+ lockedContext->registerTimeoutSource(this);
+ }
}
void DBusTimeout::stopMonitoring() {
@@ -177,7 +462,7 @@ int64_t DBusTimeout::getReadyTime() const {
void DBusTimeout::recalculateDueTime() {
if(dbus_timeout_get_enabled(libdbusTimeout_)) {
- unsigned int intervalInMs = dbus_timeout_get_interval(libdbusTimeout_);
+ int intervalInMs = dbus_timeout_get_interval(libdbusTimeout_);
dueTimeInMs_ = getCurrentTimeInMs() + intervalInMs;
} else {
dueTimeInMs_ = TIMEOUT_INFINITE;
diff --git a/src/CommonAPI/DBus/DBusMessage.cpp b/src/CommonAPI/DBus/DBusMessage.cpp
index 5a6a549..09199dc 100644
--- a/src/CommonAPI/DBus/DBusMessage.cpp
+++ b/src/CommonAPI/DBus/DBusMessage.cpp
@@ -3,9 +3,9 @@
// 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 <cassert>
#include <cstring>
+#include <CommonAPI/Logger.hpp>
#include <CommonAPI/DBus/DBusAddress.hpp>
#include <CommonAPI/DBus/DBusMessage.hpp>
@@ -21,8 +21,10 @@ DBusMessage::DBusMessage(::DBusMessage *_message) {
}
DBusMessage::DBusMessage(::DBusMessage *_message, bool reference) {
- assert(_message);
- message_ = (reference ? dbus_message_ref(message_) : _message);
+ if (NULL == _message) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " NULL _message");
+ }
+ message_ = (_message != nullptr ? (reference ? dbus_message_ref(message_) : _message) : nullptr);
}
DBusMessage::DBusMessage(const DBusMessage &_source) {
@@ -88,7 +90,9 @@ DBusMessage::createMethodCall(
::DBusMessage *methodCall = dbus_message_new_method_call(
service.c_str(), path.c_str(),
interface.c_str(), _method.c_str());
- assert(methodCall);
+ if (NULL == methodCall) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_message_new_method_call() returned NULL");
+ }
if ("" != _signature)
dbus_message_set_signature(methodCall, _signature.c_str());
@@ -99,7 +103,9 @@ DBusMessage::createMethodCall(
DBusMessage
DBusMessage::createMethodReturn(const std::string &_signature) const {
::DBusMessage *methodReturn = dbus_message_new_method_return(message_);
- assert(methodReturn);
+ if (NULL == methodReturn) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_message_new_method_return() returned NULL");
+ }
if ("" != _signature)
dbus_message_set_signature(methodReturn, _signature.c_str());
@@ -113,7 +119,9 @@ DBusMessage::createMethodError(
::DBusMessage *methodError
= dbus_message_new_error(message_, _code.c_str(), _info.c_str());
- assert(methodError);
+ if (NULL == methodError) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_message_new_error() returned NULL");
+ }
return DBusMessage(methodError, false);
}
@@ -125,7 +133,9 @@ DBusMessage::createSignal(
::DBusMessage *messageSignal
= dbus_message_new_signal(_path.c_str(), _interface.c_str(), _signal.c_str());
- assert(messageSignal);
+ if (NULL == messageSignal) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbus_message_new_signal() returned NULL");
+ }
if ("" != _signature)
dbus_message_set_signature(messageSignal, _signature.c_str());
@@ -160,7 +170,9 @@ DBusMessage::getSignature() const {
const char *
DBusMessage::getError() const {
- assert(isErrorType());
+ if (!isErrorType()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " !isErrorType");
+ }
return dbus_message_get_error_name(message_);
}
@@ -176,38 +188,53 @@ uint32_t DBusMessage::getSerial() const {
bool
DBusMessage::hasObjectPath(const char *_path) const {
const char *path = getObjectPath();
+ if (NULL == _path) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _path == NULL");
+ }
+ if (NULL == path) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " path == NULL");
+ }
- assert(_path);
- assert(path);
-
- return (!strcmp(path, _path));
+ return (((NULL != path) && (NULL != _path))? !strcmp(path, _path) : false);
}
bool DBusMessage::hasInterfaceName(const char *_interface) const {
const char *interface = getInterface();
- assert(_interface);
- assert(interface);
+ if (NULL == _interface) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _interface == NULL");
+ }
+ if (NULL == interface) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " interface == NULL");
+ }
- return (!strcmp(interface, _interface));
+ return (((NULL != interface) && (NULL != _interface))? !strcmp(interface, _interface) : false);
}
bool DBusMessage::hasMemberName(const char *_member) const {
const char *member = getMember();
- assert(_member);
- assert(member);
+ if (NULL == _member) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _member == NULL");
+ }
+ if (NULL == member) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " member == NULL");
+ }
- return (!strcmp(member, _member));
+ return (((NULL != member) && (NULL != _member))? !strcmp(member, _member) : false);
}
bool DBusMessage::hasSignature(const char *_signature) const {
const char *signature = getSignature();
- assert(_signature);
- assert(signature);
+ if (NULL == _signature) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " _signature == NULL");
+ }
+ if (NULL == signature) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " signature == NULL");
+ }
- return (!strcmp(signature, _signature));
+ return (((NULL != signature) && (NULL != _signature))? !strcmp(signature, _signature) : false);
}
DBusMessage::Type DBusMessage::getType() const {
@@ -235,6 +262,10 @@ bool DBusMessage::setDestination(const char *_destination)
return 0 != dbus_message_set_destination(message_, _destination);
}
+void DBusMessage::setSerial(const unsigned int _serial) const {
+ dbus_message_set_serial(message_, _serial);
+}
+
bool DBusMessage::hasObjectPath(const std::string &_path) const {
return hasObjectPath(_path.c_str());
}
diff --git a/src/CommonAPI/DBus/DBusObjectManager.cpp b/src/CommonAPI/DBus/DBusObjectManager.cpp
index 3d10c6d..c9484fd 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManager.cpp
@@ -3,9 +3,9 @@
// 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 <cassert>
#include <sstream>
#include <unordered_set>
+#include <algorithm>
#include <dbus/dbus-protocol.h>
@@ -24,16 +24,15 @@ namespace DBus {
DBusObjectManager::DBusObjectManager(const std::shared_ptr<DBusProxyConnection>& dbusConnection):
rootDBusObjectManagerStub_(new DBusObjectManagerStub("/", dbusConnection)),
dbusConnection_(dbusConnection){
-
if (!dbusConnection->isObjectPathMessageHandlerSet()) {
dbusConnection->setObjectPathMessageHandler(
std::bind(&DBusObjectManager::handleMessage, this, std::placeholders::_1));
}
dbusConnection->registerObjectPath("/");
- dbusRegisteredObjectsTable_.insert({
+ addToRegisteredObjectsTable(
DBusInterfaceHandlerPath("/", DBusObjectManagerStub::getInterfaceName()),
- rootDBusObjectManagerStub_ });
+ rootDBusObjectManagerStub_ );
}
DBusObjectManager::~DBusObjectManager() {
@@ -76,7 +75,9 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
dbusStubAdapter->getDBusConnection()
);
auto insertResult = managerStubs_.insert( {dbusStubAdapterObjectPath, {newManagerStub, 1} });
- assert(insertResult.second);
+ if (!insertResult.second) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " insertResult.second == nullptr");
+ }
managerStubIterator = insertResult.first;
} else {
uint32_t& countReferencesToManagerStub = std::get<1>(managerStubIterator->second);
@@ -84,15 +85,21 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
}
std::shared_ptr<DBusObjectManagerStub> dbusObjectManagerStub = std::get<0>(managerStubIterator->second);
- assert(dbusObjectManagerStub);
- isRegistrationSuccessful = addDBusInterfaceHandler(
- { dbusStubAdapterObjectPath, dbusObjectManagerStub->getInterfaceName() }, dbusObjectManagerStub);
+ if (!dbusObjectManagerStub) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusObjectManagerStub == nullptr");
+ isRegistrationSuccessful = false;
+ } else {
+ isRegistrationSuccessful = addDBusInterfaceHandler(
+ { dbusStubAdapterObjectPath, dbusObjectManagerStub->getInterfaceName() }, dbusObjectManagerStub);
+ }
if (!isRegistrationSuccessful) {
const bool isDBusStubAdapterRemoved = removeDBusInterfaceHandler(dbusStubAdapterHandlerPath, dbusStubAdapter);
- assert(isDBusStubAdapterRemoved);
- (void)isDBusStubAdapterRemoved;
+ if (!isDBusStubAdapterRemoved) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " removeDBusInterfaceHandler failed path: ",
+ dbusStubAdapterObjectPath, " interface: ", dbusStubAdapterInterfaceName);
+ }
}
}
@@ -119,20 +126,32 @@ bool DBusObjectManager::unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapte
if (isDeregistrationSuccessful && dbusStubAdapter->isManaging()) {
auto managerStubIterator = managerStubs_.find(dbusStubAdapterObjectPath);
- assert(managerStubIterator != managerStubs_.end());
-
- std::shared_ptr<DBusObjectManagerStub> dbusObjectManagerStub = std::get<0>(managerStubIterator->second);
- assert(dbusObjectManagerStub);
-
- uint32_t& countReferencesToManagerStub = std::get<1>(managerStubIterator->second);
- assert(countReferencesToManagerStub > 0);
- --countReferencesToManagerStub;
+ if (managerStubs_.end() == managerStubIterator) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unknown DBusStubAdapter ", dbusStubAdapterObjectPath);
+ isDeregistrationSuccessful = false;
+ } else {
+ std::shared_ptr<DBusObjectManagerStub> dbusObjectManagerStub = std::get<0>(managerStubIterator->second);
+ if (!dbusObjectManagerStub) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusObjectManagerStub == nullptr ", dbusStubAdapterObjectPath);
+ isDeregistrationSuccessful = false;
+ } else {
+ uint32_t& countReferencesToManagerStub = std::get<1>(managerStubIterator->second);
+ if (0 == countReferencesToManagerStub) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " reference count == 0");
+ isDeregistrationSuccessful = false;
+ } else {
+ --countReferencesToManagerStub;
+ }
- if (countReferencesToManagerStub == 0) {
- isDeregistrationSuccessful = removeDBusInterfaceHandler(
- { dbusStubAdapterObjectPath, dbusObjectManagerStub->getInterfaceName() }, dbusObjectManagerStub);
- managerStubs_.erase(managerStubIterator);
- assert(isDeregistrationSuccessful);
+ if (countReferencesToManagerStub == 0) {
+ isDeregistrationSuccessful = removeDBusInterfaceHandler(
+ { dbusStubAdapterObjectPath, dbusObjectManagerStub->getInterfaceName() }, dbusObjectManagerStub);
+ managerStubs_.erase(managerStubIterator);
+ if (!isDeregistrationSuccessful) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unregister failed ", dbusStubAdapterObjectPath, " interface: ", dbusObjectManagerStub->getInterfaceName());
+ }
+ }
+ }
}
}
@@ -152,9 +171,9 @@ bool DBusObjectManager::unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapte
bool DBusObjectManager::exportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
auto foundManagerStubIterator = managerStubs_.find(parentObjectPath);
- assert(foundManagerStubIterator != managerStubs_.end());
-
- if (std::get<0>(foundManagerStubIterator->second)->exportManagedDBusStubAdapter(dbusStubAdapter)) {
+ if (managerStubs_.end() == foundManagerStubIterator) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no manager stub found for ", parentObjectPath);
+ } else if (std::get<0>(foundManagerStubIterator->second)->exportManagedDBusStubAdapter(dbusStubAdapter)) {
// TODO Check if other handling is necessary?
return true;
}
@@ -180,8 +199,12 @@ bool DBusObjectManager::handleMessage(const DBusMessage& dbusMessage) {
const char* objectPath = dbusMessage.getObjectPath();
const char* interfaceName = dbusMessage.getInterface();
- assert(objectPath);
- assert(interfaceName);
+ if (NULL == objectPath) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " objectPath == NULL");
+ }
+ if (NULL == interfaceName) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " interfaceName == NULL");
+ }
DBusInterfaceHandlerPath handlerPath(objectPath, interfaceName);
@@ -191,8 +214,10 @@ bool DBusObjectManager::handleMessage(const DBusMessage& dbusMessage) {
bool dbusMessageHandled = false;
if (foundDBusInterfaceHandler) {
- std::shared_ptr<DBusInterfaceHandler> dbusStubAdapterBase = handlerIterator->second;
+ std::shared_ptr<DBusInterfaceHandler> dbusStubAdapterBase = handlerIterator->second.front();
+ objectPathLock_.unlock();
dbusMessageHandled = dbusStubAdapterBase->onInterfaceDBusMessage(dbusMessage);
+ return dbusMessageHandled;
} else if (dbusMessage.hasInterfaceName("org.freedesktop.DBus.Introspectable")) {
dbusMessageHandled = onIntrospectableInterfaceDBusMessage(dbusMessage);
}
@@ -207,18 +232,20 @@ bool DBusObjectManager::addDBusInterfaceHandler(const DBusInterfaceHandlerPath&
const bool isDBusInterfaceHandlerAlreadyAdded = (dbusRegisteredObjectsTableIter != dbusRegisteredObjectsTable_.end());
if (isDBusInterfaceHandlerAlreadyAdded) {
- //If another ObjectManager or a freedesktop properties stub is to be registered,
- //you can go on and just use the first one.
- if (dbusInterfaceHandlerPath.second == "org.freedesktop.DBus.ObjectManager" ||
- dbusInterfaceHandlerPath.second == "org.freedesktop.DBus.Properties") {
- return true;
+
+ auto handler = find(dbusRegisteredObjectsTableIter->second.begin(), dbusRegisteredObjectsTableIter->second.end(), dbusInterfaceHandler);
+ if (handler != dbusRegisteredObjectsTableIter->second.end()) {
+ //If another ObjectManager or a freedesktop properties stub is to be registered,
+ //you can go on and just use the first one.
+ if (dbusInterfaceHandlerPath.second == "org.freedesktop.DBus.ObjectManager" ||
+ dbusInterfaceHandlerPath.second == "org.freedesktop.DBus.Properties") {
+ return true;
+ }
+ return false;
}
- return false;
}
- auto insertResult = dbusRegisteredObjectsTable_.insert({ dbusInterfaceHandlerPath, dbusInterfaceHandler });
- const bool insertSuccess = insertResult.second;
-
+ auto insertSuccess = addToRegisteredObjectsTable(dbusInterfaceHandlerPath, dbusInterfaceHandler);
return insertSuccess;
}
@@ -228,10 +255,15 @@ bool DBusObjectManager::removeDBusInterfaceHandler(const DBusInterfaceHandlerPat
const bool isDBusInterfaceHandlerAdded = (dbusRegisteredObjectsTableIter != dbusRegisteredObjectsTable_.end());
if (isDBusInterfaceHandlerAdded) {
- auto registeredDBusStubAdapter = dbusRegisteredObjectsTableIter->second;
- assert(registeredDBusStubAdapter == dbusInterfaceHandler);
- (void)dbusInterfaceHandler;
- dbusRegisteredObjectsTable_.erase(dbusRegisteredObjectsTableIter);
+ auto registeredDBusStubAdapter = find(dbusRegisteredObjectsTableIter->second.begin(), dbusRegisteredObjectsTableIter->second.end(), dbusInterfaceHandler);
+ if (dbusRegisteredObjectsTableIter->second.end() == registeredDBusStubAdapter) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no stub adapter registered for ", dbusInterfaceHandlerPath.first, " ", dbusInterfaceHandlerPath.second);
+ } else {
+ dbusRegisteredObjectsTableIter->second.erase(registeredDBusStubAdapter);
+ if (dbusRegisteredObjectsTableIter->second.empty()) {
+ dbusRegisteredObjectsTable_.erase(dbusRegisteredObjectsTableIter);
+ }
+ }
}
return isDBusInterfaceHandlerAdded;
@@ -261,7 +293,7 @@ bool DBusObjectManager::onIntrospectableInterfaceDBusMessage(const DBusMessage&
const DBusInterfaceHandlerPath& handlerPath = registeredObjectsIterator.first;
const std::string& dbusObjectPath = handlerPath.first;
const std::string& dbusInterfaceName = handlerPath.second;
- std::shared_ptr<DBusInterfaceHandler> dbusStubAdapterBase = registeredObjectsIterator.second;
+ std::shared_ptr<DBusInterfaceHandler> dbusStubAdapterBase = registeredObjectsIterator.second.front();
std::vector<std::string> elems = CommonAPI::split(dbusObjectPath, '/');
if (dbusMessage.hasObjectPath(dbusObjectPath)) {
@@ -329,5 +361,30 @@ std::shared_ptr<DBusObjectManagerStub> DBusObjectManager::getRootDBusObjectManag
return rootDBusObjectManagerStub_;
}
+bool DBusObjectManager::addToRegisteredObjectsTable(DBusInterfaceHandlerPath ifpath, std::shared_ptr<DBusInterfaceHandler> handler) {
+ auto handlerRecord = dbusRegisteredObjectsTable_.find(ifpath);
+ if (handlerRecord == dbusRegisteredObjectsTable_.end()) {
+ // not found, create and add entry
+ dbusRegisteredObjectsTable_.insert({
+ ifpath,
+ std::vector<std::shared_ptr<DBusInterfaceHandler>>({handler})
+ });
+ }
+ else {
+ // found. search through vector to find the handler
+ std::vector<std::shared_ptr<DBusInterfaceHandler>> handlerList = handlerRecord->second;
+ auto adapter = find(handlerList.begin(), handlerList.end(), handler);
+ if (adapter != handlerList.end()) {
+ // found; don't add
+ return false;
+ }
+ else {
+ handlerList.push_back(handler);
+ handlerRecord->second = handlerList;
+ }
+ }
+ return true;
+}
+
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
index 7516994..20bbf1d 100644
--- a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
@@ -3,9 +3,8 @@
// 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 <cassert>
#include <vector>
-
+#include <algorithm>
#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
#include <CommonAPI/DBus/DBusOutputStream.hpp>
#include <CommonAPI/DBus/DBusStubAdapter.hpp>
@@ -18,9 +17,15 @@ DBusObjectManagerStub::DBusObjectManagerStub(const std::string& dbusObjectPath,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) :
dbusObjectPath_(dbusObjectPath),
dbusConnection_(dbusConnection) {
- assert(!dbusObjectPath.empty());
- assert(dbusObjectPath[0] == '/');
- assert(dbusConnection);
+ if (dbusObjectPath.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty _path");
+ }
+ if ('/' != dbusObjectPath[0]) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid _path ", dbusObjectPath);
+ }
+ if (!dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid _connection");
+ }
}
DBusObjectManagerStub::~DBusObjectManagerStub() {
@@ -29,21 +34,33 @@ DBusObjectManagerStub::~DBusObjectManagerStub() {
for (auto& dbusInterfaceIterator : registeredDBusInterfacesMap) {
auto managedDBusStubAdapter = dbusInterfaceIterator.second;
- auto managedDBusStubAdapterServiceAddress = managedDBusStubAdapter->getDBusAddress();
#ifdef COMMONAPI_TODO
- const bool isServiceUnregistered = DBusServicePublisher::getInstance()->unregisterManagedService(
- managedDBusStubAdapterServiceAddress);
- assert(isServiceUnregistered);
+ for (auto& adapterIterator : dbusInterfaceIterator.second) {
+ auto managedDBusStubAdapterServiceAddress = adapterIterator->getDBusAddress();
+
+ const bool isServiceUnregistered = DBusServicePublisher::getInstance()->unregisterManagedService(
+ managedDBusStubAdapterServiceAddress);
+ if (!isServiceUnregistered) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " service still registered ", managedDBusStubAdapterServiceAddress.getService());
+ }
#endif
}
}
}
bool DBusObjectManagerStub::exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> managedDBusStubAdapter) {
- assert(managedDBusStubAdapter);
+ if (!managedDBusStubAdapter) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "managedDBusStubAdapter == nullptr");
+ return false;
+ }
- std::lock_guard<std::mutex> dbusObjectManagerStubLock(dbusObjectManagerStubLock_);
+ // if already registered, return true.
+ const bool alreadyExported = isDBusStubAdapterExported(managedDBusStubAdapter);
+ if (alreadyExported) {
+ return true;
+ }
+ std::lock_guard<std::mutex> dbusObjectManagerStubLock(dbusObjectManagerStubLock_);
const bool isRegistrationSuccessful = registerDBusStubAdapter(managedDBusStubAdapter);
if (!isRegistrationSuccessful) {
return false;
@@ -63,7 +80,10 @@ bool DBusObjectManagerStub::exportManagedDBusStubAdapter(std::shared_ptr<DBusStu
}
bool DBusObjectManagerStub::unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> managedDBusStubAdapter) {
- assert(managedDBusStubAdapter);
+ if (!managedDBusStubAdapter) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "managedDBusStubAdapter == nullptr");
+ return false;
+ }
std::lock_guard<std::mutex> dbusObjectManagerStubLock(dbusObjectManagerStubLock_);
@@ -86,7 +106,10 @@ bool DBusObjectManagerStub::unexportManagedDBusStubAdapter(std::shared_ptr<DBusS
}
bool DBusObjectManagerStub::isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
- assert(dbusStubAdapter);
+ if (!dbusStubAdapter) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), "dbusStubAdapter == nullptr");
+ return false;
+ }
const auto& dbusObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
const auto& dbusInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
@@ -103,13 +126,15 @@ bool DBusObjectManagerStub::isDBusStubAdapterExported(std::shared_ptr<DBusStubAd
auto& registeredDBusInterfacesMap = registeredDBusObjectPathIterator->second;
const auto& registeredDBusInterfaceIterator = registeredDBusInterfacesMap.find(dbusInterfaceName);
const bool isRegisteredDBusInterfaceName = (registeredDBusInterfaceIterator != registeredDBusInterfacesMap.end());
-
- if (isRegisteredDBusInterfaceName) {
- auto registeredDBusStubAdapter = registeredDBusInterfaceIterator->second;
- assert(registeredDBusStubAdapter == dbusStubAdapter);
+ if (!isRegisteredDBusInterfaceName) {
+ return false;
}
- return isRegisteredDBusInterfaceName;
+ const auto& registeredDBusStubAdapterList = registeredDBusInterfaceIterator->second;
+ auto registeredDBusStubAdapter = find(registeredDBusStubAdapterList.begin(), registeredDBusStubAdapterList.end(), dbusStubAdapter);
+
+ return registeredDBusStubAdapter != registeredDBusStubAdapterList.end();
+
}
bool DBusObjectManagerStub::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
@@ -125,12 +150,27 @@ bool DBusObjectManagerStub::registerDBusStubAdapter(std::shared_ptr<DBusStubAdap
const bool isDBusInterfaceAlreadyRegistered = (registeredDBusInterfaceIterator != registeredDBusInterfacesMap.end());
if (!isDBusInterfaceAlreadyRegistered) {
- const auto& insertResult = registeredDBusInterfacesMap.insert({ dbusInterfaceName, dbusStubAdapter });
+ const auto& insertResult = registeredDBusInterfacesMap.insert(
+ { dbusInterfaceName,
+ std::vector<std::shared_ptr<DBusStubAdapter>>({dbusStubAdapter})});
isRegisterationSuccessful = insertResult.second;
}
+ else {
+ // add to existing interface
+ auto adapterList = registeredDBusInterfaceIterator->second;
+ if (find(adapterList.begin(), adapterList.end(), dbusStubAdapter) == adapterList.end()) {
+ adapterList.push_back(dbusStubAdapter);
+ registeredDBusInterfaceIterator->second = adapterList;
+ isRegisterationSuccessful = true;
+ }
+ else {
+ // already registered
+ isRegisterationSuccessful = false;
+ }
+ }
} else {
const auto& insertResult = registeredDBusObjectPathsMap_.insert({
- dbusObjectPath, DBusInterfacesMap({{ dbusInterfaceName, dbusStubAdapter }})
+ dbusObjectPath, DBusInterfacesMap({{ dbusInterfaceName, std::vector<std::shared_ptr<DBusStubAdapter>>({dbusStubAdapter}) }})
});
isRegisterationSuccessful = insertResult.second;
}
@@ -156,23 +196,37 @@ bool DBusObjectManagerStub::unregisterDBusStubAdapter(std::shared_ptr<DBusStubAd
return false;
}
- auto registeredDBusStubAdapter = registeredDBusInterfaceIterator->second;
- assert(registeredDBusStubAdapter == dbusStubAdapter);
-
- registeredDBusInterfacesMap.erase(registeredDBusInterfaceIterator);
+ auto& registeredAdapterList = registeredDBusInterfaceIterator->second;
+ auto adapter = find (registeredAdapterList.begin(), registeredAdapterList.end(), dbusStubAdapter);
- if (registeredDBusInterfacesMap.empty()) {
- registeredDBusObjectPathsMap_.erase(registeredDBusObjectPathIterator);
+ if (registeredAdapterList.end() == adapter) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " stub adapter not registered ", dbusObjectPath, " interface: ", dbusInterfaceName);
+ return false;
}
+ registeredAdapterList.erase(adapter);
+
+ if (registeredAdapterList.empty()) {
+ registeredDBusInterfacesMap.erase(registeredDBusInterfaceIterator);
+
+ if (registeredDBusInterfacesMap.empty()) {
+ registeredDBusObjectPathsMap_.erase(registeredDBusObjectPathIterator);
+ }
+ }
return true;
}
bool DBusObjectManagerStub::emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const {
- assert(dbusConnection);
- assert(dbusConnection->isConnected());
+ if (!dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusConnection == nullptr");
+ return false;
+ }
+ if (!dbusConnection->isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " not connected");
+ return false;
+ }
const auto& dbusStubObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
const auto& dbusStubInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
@@ -200,8 +254,14 @@ bool DBusObjectManagerStub::emitInterfacesAddedSignal(std::shared_ptr<DBusStubAd
bool DBusObjectManagerStub::emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const {
- assert(dbusConnection);
- assert(dbusConnection->isConnected());
+ if (!dbusConnection) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusConnection == nullptr");
+ return false;
+ }
+ if (!dbusConnection->isConnected()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " not connected");
+ return false;
+ }
const auto& dbusStubObjectPath = dbusStubAdapter->getDBusAddress().getObjectPath();
const auto& dbusStubInterfaceName = dbusStubAdapter->getDBusAddress().getInterface();
@@ -254,23 +314,30 @@ bool DBusObjectManagerStub::onInterfaceDBusMessage(const DBusMessage& dbusMessag
const auto& registeredDBusInterfacesMap = registeredDBusObjectPathIterator.second;
DBusInterfacesAndPropertiesDict dbusInterfacesAndPropertiesDict;
- assert(registeredDBusObjectPath.length() > 0);
- assert(registeredDBusInterfacesMap.size() > 0);
-
- for (const auto& registeredDBusInterfaceIterator : registeredDBusInterfacesMap) {
- const std::string& registeredDBusInterfaceName = registeredDBusInterfaceIterator.first;
- const auto& registeredDBusStubAdapter = registeredDBusInterfaceIterator.second;
+ if (0 == registeredDBusObjectPath.length()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty object path");
+ } else {
+ if (0 == registeredDBusInterfacesMap.size()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty interfaces map for ", registeredDBusObjectPath);
+ }
- assert(registeredDBusInterfaceName.length() > 0);
+ for (const auto& registeredDBusInterfaceIterator : registeredDBusInterfacesMap) {
+ const std::string& registeredDBusInterfaceName = registeredDBusInterfaceIterator.first;
+ const auto& registeredDBusStubAdapter = registeredDBusInterfaceIterator.second.begin();
- dbusInterfacesAndPropertiesDict.insert({ registeredDBusInterfaceName, DBusPropertiesChangedDict() });
+ if (0 == registeredDBusInterfaceName.length()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty interface name for ", registeredDBusObjectPath);
+ } else {
+ dbusInterfacesAndPropertiesDict.insert({ registeredDBusInterfaceName, DBusPropertiesChangedDict() });
+ }
- if (registeredDBusStubAdapter->isManaging()) {
- dbusInterfacesAndPropertiesDict.insert({ getInterfaceName(), DBusPropertiesChangedDict() });
+ if ((*registeredDBusStubAdapter)->isManaging()) {
+ dbusInterfacesAndPropertiesDict.insert({ getInterfaceName(), DBusPropertiesChangedDict() });
+ }
}
- }
- dbusObjectPathAndInterfacesDict.insert({ registeredDBusObjectPath, std::move(dbusInterfacesAndPropertiesDict) });
+ dbusObjectPathAndInterfacesDict.insert({ registeredDBusObjectPath, std::move(dbusInterfacesAndPropertiesDict) });
+ }
}
DBusMessage dbusMessageReply = dbusMessage.createMethodReturn("a{oa{sa{sv}}}");
diff --git a/src/CommonAPI/DBus/DBusOutputStream.cpp b/src/CommonAPI/DBus/DBusOutputStream.cpp
index 728c017..6fd5d0a 100644
--- a/src/CommonAPI/DBus/DBusOutputStream.cpp
+++ b/src/CommonAPI/DBus/DBusOutputStream.cpp
@@ -63,17 +63,32 @@ void DBusOutputStream::setError() {
* @param numOfBytes The number of bytes that should be reserved for writing.
*/
void DBusOutputStream::reserveMemory(size_t numOfBytes) {
- assert(numOfBytes > 0);
+ if (0 == numOfBytes) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " reserving 0 bytes");
+ }
payload_.reserve(numOfBytes);
}
DBusOutputStream& DBusOutputStream::writeString(const char *_value, const uint32_t &_length) {
- assert(_value != NULL);
- assert(_value[_length] == '\0');
-
- _writeValue(_length);
- _writeRaw(_value, _length + 1);
+ if (NULL == _value) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " _value == NULL");
+ } else if (_value[_length] != '\0') {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " _value is not zero-terminated")
+ } else {
+ _writeValue(_length);
+ _writeRaw(_value, _length + 1);
+ }
+ return (*this);
+}
+DBusOutputStream& DBusOutputStream::writeByteBuffer(const uint8_t *_value,
+ const uint32_t &_length) {
+ if (NULL == _value) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__) + " _value == NULL");
+ } else {
+ _writeValue(_length);
+ _writeRaw(reinterpret_cast<const char*>(_value), _length);
+ }
return (*this);
}
@@ -81,8 +96,9 @@ DBusOutputStream& DBusOutputStream::writeString(const char *_value, const uint32
static const char eightByteZeroString[] = "\0\0\0\0\0\0\0";
void DBusOutputStream::align(const size_t _boundary) {
- assert(_boundary > 0 && _boundary <= 8 &&
- (_boundary % 2 == 0 || _boundary == 1));
+ if ( _boundary == 0 || _boundary > 8 || ( 0 != _boundary % 2 && 1 != _boundary) ) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid boundary ", _boundary);
+ }
size_t mask = _boundary - 1;
size_t necessary = ((mask - (payload_.size() & mask)) + 1) & mask;
@@ -100,7 +116,9 @@ void DBusOutputStream::_writeRawAt(const char *_data, const size_t _size, size_t
void DBusOutputStream::writeSignature(const std::string& signature) {
const auto& signatureLength = signature.length();
- assert(signatureLength > 0 && signatureLength < 256);
+ if (0 == signatureLength || 255 < signatureLength) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " invalid signatureLength ", signatureLength);
+ }
const uint8_t wireLength = (uint8_t) signatureLength;
(*this) << wireLength;
diff --git a/src/CommonAPI/DBus/DBusProxy.cpp b/src/CommonAPI/DBus/DBusProxy.cpp
index e92d90c..95c3d59 100644
--- a/src/CommonAPI/DBus/DBusProxy.cpp
+++ b/src/CommonAPI/DBus/DBusProxy.cpp
@@ -3,7 +3,6 @@
// 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 <cassert>
#include <sstream>
#include <CommonAPI/Utils.hpp>
@@ -25,15 +24,153 @@ void DBusProxyStatusEvent::onListenerAdded(const Listener &_listener, const Subs
_listener(AvailabilityStatus::AVAILABLE);
}
+void DBusProxy::availabilityTimeoutThreadHandler() const {
+ std::unique_lock<std::mutex> threadLock(availabilityTimeoutThreadMutex_);
+
+ bool cancel = false;
+ bool firstIteration = true;
+
+ // the callbacks that have to be done are stored with
+ // their required data in a list of tuples.
+ typedef std::tuple<
+ isAvailableAsyncCallback,
+ std::promise<AvailabilityStatus>,
+ AvailabilityStatus,
+ std::chrono::time_point<std::chrono::high_resolution_clock>
+ > CallbackData_t;
+ std::list<CallbackData_t> callbacks;
+
+ while(!cancel) {
+
+ //get min timeout
+ timeoutsMutex_.lock();
+
+ int timeout = std::numeric_limits<int>::max();
+ std::chrono::time_point<std::chrono::high_resolution_clock> minTimeout;
+ if (timeouts_.size() > 0) {
+ auto minTimeoutElement = std::min_element(timeouts_.begin(), timeouts_.end(),
+ [] (const AvailabilityTimeout_t& lhs, const AvailabilityTimeout_t& rhs) {
+ return std::get<0>(lhs) < std::get<0>(rhs);
+ });
+ minTimeout = std::get<0>(*minTimeoutElement);
+ std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
+ timeout = (int)std::chrono::duration_cast<std::chrono::milliseconds>(minTimeout - now).count();
+ }
+ timeoutsMutex_.unlock();
+
+ //wait for timeout or notification
+ if (!firstIteration && std::cv_status::timeout ==
+ availabilityTimeoutCondition_.wait_for(threadLock, std::chrono::milliseconds(timeout))) {
+ timeoutsMutex_.lock();
+
+ //iterate through timeouts
+ auto it = timeouts_.begin();
+ while (it != timeouts_.end()) {
+ std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
+
+ isAvailableAsyncCallback callback = std::get<1>(*it);
+
+ if (now > std::get<0>(*it)) {
+ //timeout
+ availabilityMutex_.lock();
+ if(isAvailable())
+ callbacks.push_back(std::make_tuple(callback, std::move(std::get<2>(*it)),
+ AvailabilityStatus::AVAILABLE,
+ std::chrono::time_point<std::chrono::high_resolution_clock>()));
+ else
+ callbacks.push_back(std::make_tuple(callback, std::move(std::get<2>(*it)),
+ AvailabilityStatus::NOT_AVAILABLE,
+ std::chrono::time_point<std::chrono::high_resolution_clock>()));
+ it = timeouts_.erase(it);
+ availabilityMutex_.unlock();
+ } else {
+ //timeout not expired
+ availabilityMutex_.lock();
+ if(isAvailable()) {
+ callbacks.push_back(std::make_tuple(callback, std::move(std::get<2>(*it)),
+ AvailabilityStatus::AVAILABLE,
+ minTimeout));
+ it = timeouts_.erase(it);
+ } else {
+ ++it;
+ }
+ availabilityMutex_.unlock();
+ }
+ }
+
+ timeoutsMutex_.unlock();
+ } else {
+
+ if(firstIteration) {
+ firstIteration = false;
+ continue;
+ }
+
+ //timeout not expired
+ timeoutsMutex_.lock();
+ auto it = timeouts_.begin();
+ while (it != timeouts_.end()) {
+ isAvailableAsyncCallback callback = std::get<1>(*it);
+
+ availabilityMutex_.lock();
+ if(isAvailable()) {
+ callbacks.push_back(std::make_tuple(callback, std::move(std::get<2>(*it)),
+ AvailabilityStatus::AVAILABLE,
+ minTimeout));
+ it = timeouts_.erase(it);
+ } else {
+ ++it;
+ }
+ availabilityMutex_.unlock();
+ }
+
+ timeoutsMutex_.unlock();
+ }
+
+ //do callbacks
+ isAvailableAsyncCallback callback;
+ AvailabilityStatus avStatus;
+ int remainingTimeout;
+ std::chrono::high_resolution_clock::time_point now;
+
+ auto it = callbacks.begin();
+ while(it != callbacks.end()) {
+ callback = std::get<0>(*it);
+ avStatus = std::get<2>(*it);
+
+ // compute remaining timeout
+ now = std::chrono::high_resolution_clock::now();
+ remainingTimeout = (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::get<3>(*it) - now).count();
+ if(remainingTimeout < 0)
+ remainingTimeout = 0;
+
+ threadLock.unlock();
+
+ std::get<1>(*it).set_value(avStatus);
+ callback(avStatus, remainingTimeout);
+
+ threadLock.lock();
+
+ it = callbacks.erase(it);
+ }
+
+ //cancel thread
+ timeoutsMutex_.lock();
+ if(timeouts_.size() == 0 && callbacks.size() == 0)
+ cancel = true;
+ timeoutsMutex_.unlock();
+ }
+}
+
DBusProxy::DBusProxy(const DBusAddress &_dbusAddress,
const std::shared_ptr<DBusProxyConnection> &_connection):
DBusProxyBase(_dbusAddress, _connection),
dbusProxyStatusEvent_(this),
availabilityStatus_(AvailabilityStatus::UNKNOWN),
interfaceVersionAttribute_(*this, "uu", "getInterfaceVersion"),
- dbusServiceRegistry_(DBusServiceRegistry::get(_connection)),
- signalMemberHandlerInfo_(3000)
+ dbusServiceRegistry_(DBusServiceRegistry::get(_connection))
{
+ Factory::get()->incrementConnection(connection_);
}
void DBusProxy::init() {
@@ -43,9 +180,14 @@ void DBusProxy::init() {
}
DBusProxy::~DBusProxy() {
+ if(availabilityTimeoutThread_) {
+ if(availabilityTimeoutThread_->joinable())
+ availabilityTimeoutThread_->join();
+ }
dbusServiceRegistry_->unsubscribeAvailabilityListener(
getAddress().getAddress(),
dbusServiceRegistrySubscription_);
+ Factory::get()->decrementConnection(connection_);
}
bool DBusProxy::isAvailable() const {
@@ -66,6 +208,56 @@ bool DBusProxy::isAvailableBlocking() const {
return true;
}
+std::future<AvailabilityStatus> DBusProxy::isAvailableAsync(
+ isAvailableAsyncCallback _callback,
+ const CommonAPI::CallInfo *_info) const {
+
+ std::promise<AvailabilityStatus> promise;
+ std::future<AvailabilityStatus> future = promise.get_future();
+
+ //set timeout point
+ auto timeoutPoint = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(_info->timeout_);
+
+ timeoutsMutex_.lock();
+ if(timeouts_.size() == 0) {
+ //no timeouts
+
+ bool isAvailabilityTimeoutThread = false;
+
+ //join running availability thread
+ if(availabilityTimeoutThread_) {
+
+ //check if current thread is availability timeout thread
+ isAvailabilityTimeoutThread = (std::this_thread::get_id() ==
+ availabilityTimeoutThread_.get()->get_id());
+
+ if(availabilityTimeoutThread_->joinable() && !isAvailabilityTimeoutThread) {
+ timeoutsMutex_.unlock();
+ availabilityTimeoutThread_->join();
+ timeoutsMutex_.lock();
+ }
+ }
+ //add new timeout
+ timeouts_.push_back(std::make_tuple(timeoutPoint, _callback, std::move(promise)));
+
+ //start availability thread
+ if(!isAvailabilityTimeoutThread)
+ availabilityTimeoutThread_ = std::make_shared<std::thread>(
+ std::bind(&DBusProxy::availabilityTimeoutThreadHandler, this));
+ } else {
+ //add timeout
+ timeouts_.push_back(std::make_tuple(timeoutPoint, _callback, std::move(promise)));
+ }
+ timeoutsMutex_.unlock();
+
+ availabilityTimeoutThreadMutex_.lock();
+ //notify availability thread that new timeout was added
+ availabilityTimeoutCondition_.notify_all();
+ availabilityTimeoutThreadMutex_.unlock();
+
+ return future;
+}
+
ProxyStatusEvent& DBusProxy::getProxyStatusEvent() {
return dbusProxyStatusEvent_;
}
@@ -87,15 +279,23 @@ void DBusProxy::signalInitialValueCallback(const CallStatus _status,
const DBusMessage &_message,
DBusProxyConnection::DBusSignalHandler *_handler,
const uint32_t _tag) {
- (void)_status;
- _handler->onInitialValueSignalDBusMessage(_message, _tag);
+ if (_status != CallStatus::SUCCESS) {
+ COMMONAPI_ERROR("Error when receiving initial value of an attribute");
+ } else {
+ _handler->onInitialValueSignalDBusMessage(_message, _tag);
+ }
}
void DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus) {
if (availabilityStatus != availabilityStatus_) {
- availabilityStatusMutex_.lock();
+ availabilityMutex_.lock();
availabilityStatus_ = availabilityStatus;
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
+
+ availabilityTimeoutThreadMutex_.lock();
+ //notify availability thread that proxy status has changed
+ availabilityTimeoutCondition_.notify_all();
+ availabilityTimeoutThreadMutex_.unlock();
dbusProxyStatusEvent_.notifyListeners(availabilityStatus);
@@ -118,27 +318,26 @@ void DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabili
DBusMessage message = createMethodCall(std::get<4>(*signalMemberHandlerIterator), "");
- DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate::FunctionType myFunc = std::bind(
&DBusProxy::signalMemberCallback,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3,
std::placeholders::_4);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate delegate(shared_from_this(), myFunc);
connection_->sendDBusMessageWithReplyAsync(
message,
- DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, std::get<5>(*signalMemberHandlerIterator), 0),
- &signalMemberHandlerInfo_);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::create(delegate, std::get<5>(*signalMemberHandlerIterator), 0),
+ &defaultCallInfo);
}
}
{
std::lock_guard < std::mutex > queueLock(selectiveBroadcastHandlersMutex_);
for (auto selectiveBroadcasts : selectiveBroadcastHandlers) {
std::string methodName = "subscribeFor" + selectiveBroadcasts.first + "Selective";
- bool subscriptionAccepted = connection_->sendPendingSelectiveSubscription(this, methodName);
- if (!subscriptionAccepted) {
- selectiveBroadcasts.second->onError(CommonAPI::CallStatus::SUBSCRIPTION_REFUSED);
- }
+ connection_->sendPendingSelectiveSubscription(this, methodName, selectiveBroadcasts.second.first,
+ selectiveBroadcasts.second.second);
}
}
} else {
@@ -160,38 +359,33 @@ void DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabili
}
}
}
- availabilityStatusMutex_.lock();
+ availabilityMutex_.lock();
availabilityCondition_.notify_one();
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
}
-DBusProxyConnection::DBusSignalHandlerToken DBusProxy::subscribeForSelectiveBroadcastOnConnection(
- bool& subscriptionAccepted,
+void DBusProxy::insertSelectiveSubscription(const std::string& interfaceMemberName,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler, uint32_t tag) {
+ std::lock_guard < std::mutex > queueLock(selectiveBroadcastHandlersMutex_);
+ selectiveBroadcastHandlers[interfaceMemberName] = std::make_pair(dbusSignalHandler, tag);
+}
+
+void DBusProxy::subscribeForSelectiveBroadcastOnConnection(
const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& interfaceMemberSignature,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler) {
-
- DBusProxyConnection::DBusSignalHandlerToken token =
- getDBusConnection()->subscribeForSelectiveBroadcast(
- subscriptionAccepted,
- objectPath,
- interfaceName,
- interfaceMemberName,
- interfaceMemberSignature,
- dbusSignalHandler,
- this);
-
- if (!isAvailable()) {
- subscriptionAccepted = true;
- }
- if (subscriptionAccepted) {
- std::lock_guard < std::mutex > queueLock(selectiveBroadcastHandlersMutex_);
- selectiveBroadcastHandlers[interfaceMemberName] = dbusSignalHandler;
- }
-
- return token;
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ uint32_t tag) {
+
+ getDBusConnection()->subscribeForSelectiveBroadcast(
+ objectPath,
+ interfaceName,
+ interfaceMemberName,
+ interfaceMemberSignature,
+ dbusSignalHandler,
+ this,
+ tag);
}
void DBusProxy::unsubscribeFromSelectiveBroadcast(const std::string& eventName,
@@ -204,7 +398,7 @@ void DBusProxy::unsubscribeFromSelectiveBroadcast(const std::string& eventName,
std::string interfaceMemberName = std::get<2>(subscription);
auto its_handler = selectiveBroadcastHandlers.find(interfaceMemberName);
if (its_handler != selectiveBroadcastHandlers.end()) {
- selectiveBroadcastHandlers.erase(its_handler);
+ selectiveBroadcastHandlers.erase(interfaceMemberName);
}
}
@@ -251,9 +445,9 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxy::addSignalMemberHandler(
justAddFilter,
false);
- availabilityStatusMutex_.lock();
+ availabilityMutex_.lock();
if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
signalHandlerToken = connection_->addSignalMemberHandler(
objectPath,
interfaceName,
@@ -263,7 +457,7 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxy::addSignalMemberHandler(
justAddFilter);
std::get<7>(signalMemberHandler) = true;
} else {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
}
addSignalMemberHandlerToQueue(signalMemberHandler);
} else {
@@ -333,24 +527,25 @@ void DBusProxy::getCurrentValueForSignalListener(
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const uint32_t subscription) {
- availabilityStatusMutex_.lock();
+ availabilityMutex_.lock();
if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
DBusMessage message = createMethodCall(getMethodName, "");
- DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3,
std::placeholders::_4);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate delegate(shared_from_this(), myFunc);
connection_->sendDBusMessageWithReplyAsync(
message,
- DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, dbusSignalHandler, subscription),
- &signalMemberHandlerInfo_);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::create(delegate, dbusSignalHandler, subscription),
+ &defaultCallInfo);
} else {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
}
}
@@ -360,9 +555,9 @@ void DBusProxy::freeDesktopGetCurrentValueForSignalListener(
const std::string &interfaceName,
const std::string &propertyName) {
- availabilityStatusMutex_.lock();
+ availabilityMutex_.lock();
if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
DBusAddress itsAddress(getDBusAddress());
itsAddress.setInterface("org.freedesktop.DBus.Properties");
@@ -372,20 +567,21 @@ void DBusProxy::freeDesktopGetCurrentValueForSignalListener(
::serialize(output, interfaceName, propertyName);
if (success) {
output.flush();
- DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
this,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3,
std::placeholders::_4);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::Delegate delegate(shared_from_this(), myFunc);
connection_->sendDBusMessageWithReplyAsync(
_message,
- DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, dbusSignalHandler, subscription),
- &signalMemberHandlerInfo_);
+ DBusProxyAsyncSignalMemberCallbackHandler<DBusProxy>::create(delegate, dbusSignalHandler, subscription),
+ &defaultCallInfo);
}
} else {
- availabilityStatusMutex_.unlock();
+ availabilityMutex_.unlock();
}
}
diff --git a/src/CommonAPI/DBus/DBusProxyManager.cpp b/src/CommonAPI/DBus/DBusProxyManager.cpp
index 8ea30e3..e36f6e1 100644
--- a/src/CommonAPI/DBus/DBusProxyManager.cpp
+++ b/src/CommonAPI/DBus/DBusProxyManager.cpp
@@ -54,6 +54,7 @@ void
DBusProxyManager::getAvailableInstances(
CommonAPI::CallStatus &_status,
std::vector<std::string> &_availableInstances) {
+ _availableInstances.clear();
DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dict;
DBusProxyHelper<
@@ -161,6 +162,10 @@ DBusProxyManager::translateCommonApiAddresses(
CommonAPI::Address itsAddress;
DBusAddress itsDBusAddress;
+ // get service information from proxy
+ const std::string &_service = proxy_.getDBusAddress().getService();
+ itsDBusAddress.setService(_service);
+
for (const auto &objectPathIter : _dict) {
itsDBusAddress.setObjectPath(objectPathIter.first);
diff --git a/src/CommonAPI/DBus/DBusServiceRegistry.cpp b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
index 0ee7705..65290fc 100644
--- a/src/CommonAPI/DBus/DBusServiceRegistry.cpp
+++ b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
@@ -37,6 +37,12 @@ DBusServiceRegistry::get(std::shared_ptr<DBusProxyConnection> _connection) {
return registry;
}
+void
+DBusServiceRegistry::remove(std::shared_ptr<DBusProxyConnection> _connection) {
+ std::lock_guard<std::mutex> itsGuard(registriesMutex_);
+ registries_.erase(_connection);
+}
+
DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection) :
dbusDaemonProxy_(std::make_shared<CommonAPI::DBus::DBusDaemonProxy>(dbusProxyConnection)),
initialized_(false),
@@ -70,8 +76,9 @@ DBusServiceRegistry::~DBusServiceRegistry() {
const bool isSubscriptionCancelled = dbusProxyConnection->removeObjectManagerSignalMemberHandler(
dbusServiceUniqueName,
this);
- assert(isSubscriptionCancelled);
- (void)isSubscriptionCancelled;
+ if (!isSubscriptionCancelled) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), ": still subscribed too ", std::string(dbusServiceUniqueName));
+ }
}
}
@@ -105,12 +112,13 @@ DBusServiceRegistry::subscribeAvailabilityListener(
COMMONAPI_ERROR(
"You must not build proxies in callbacks of ProxyStatusEvent.",
" Please refer to the documentation for suggestions how to avoid this.");
- assert(false);
}
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
auto& dbusServiceListenersRecord = dbusServiceListenersMap[dbusAddress.getService()];
- assert(dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::AVAILABLE);
+ if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::AVAILABLE) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " uniqueBusName ", dbusServiceListenersRecord.uniqueBusName, " already AVAILABLE");
+ }
auto& dbusInterfaceNameListenersMap = dbusServiceListenersRecord.dbusObjectPathListenersMap[dbusAddress.getObjectPath()];
auto& dbusInterfaceNameListenersRecord = dbusInterfaceNameListenersMap[dbusAddress.getInterface()];
@@ -166,6 +174,8 @@ DBusServiceRegistry::subscribeAvailabilityListener(
dbusInterfaceNameListenersRecord.listenerList.push_front(std::move(serviceListener));
+ dbusServicesMutex_.unlock();
+
return dbusInterfaceNameListenersRecord.listenerList.begin();
}
@@ -175,11 +185,12 @@ DBusServiceRegistry::unsubscribeAvailabilityListener(
DBusAddress dbusAddress;
translator_->translate(_address, dbusAddress);
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
auto dbusServiceListenersIterator = dbusServiceListenersMap.find(dbusAddress.getService());
const bool isDBusServiceListenersRecordFound = (dbusServiceListenersIterator != dbusServiceListenersMap.end());
if (!isDBusServiceListenersRecordFound) {
+ dbusServicesMutex_.unlock();
return; // already unsubscribed
}
@@ -190,6 +201,7 @@ DBusServiceRegistry::unsubscribeAvailabilityListener(
(dbusObjectPathListenersIterator != dbusServiceListenersRecord.dbusObjectPathListenersMap.end());
if (!isDBusObjectPathListenersRecordFound) {
+ dbusServicesMutex_.unlock();
return; // already unsubscribed
}
@@ -199,6 +211,7 @@ DBusServiceRegistry::unsubscribeAvailabilityListener(
(dbusInterfaceNameListenersIterator != dbusInterfaceNameListenersMap.end());
if (!isDBusInterfaceNameListenersRecordFound) {
+ dbusServicesMutex_.unlock();
return; // already unsubscribed
}
@@ -213,6 +226,8 @@ DBusServiceRegistry::unsubscribeAvailabilityListener(
dbusServiceListenersRecord.dbusObjectPathListenersMap.erase(dbusObjectPathListenersIterator);
}
}
+
+ dbusServicesMutex_.unlock();
}
// d-feet mode until service is found
@@ -283,7 +298,10 @@ bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfac
dbusServicesMutex_.unlock();
- assert(dbusUniqueNameRecord != NULL);
+ if (NULL == dbusUniqueNameRecord) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no unique name record found for IF: ", dbusInterfaceName,
+ " service: ", dbusServiceName, "object path: ", dbusObjectPath);
+ }
auto& dbusObjectPathsCache = dbusUniqueNameRecord->dbusObjectPathsCache;
auto dbusObjectPathCacheIterator = dbusObjectPathsCache.find(dbusObjectPath);
@@ -319,14 +337,17 @@ bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfac
dbusObjectPathCache = &(dbusObjectPathCacheIterator->second);
- std::future<DBusRecordState> futureObjectPathResolved = dbusObjectPathCache->promiseOnResolve.get_future();
+ newDbusObjectPathCache.futureOnResolve = dbusObjectPathCache->promiseOnResolve.get_future();
dbusServicesMutex_.unlock();
introspectDBusObjectPath(uniqueName, dbusObjectPath);
- futureObjectPathResolved.wait_for(timeout);
+ newDbusObjectPathCache.futureOnResolve.wait_for(timeout);
}
- assert(dbusObjectPathCache != NULL);
+ if (NULL == dbusObjectPathCache) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no object path cache entry found for IF: ", dbusInterfaceName,
+ " service: ", dbusServiceName, "object path: ", dbusObjectPath);
+ }
dbusServicesMutex_.lock();
if(dbusObjectPathCache->state != DBusRecordState::RESOLVED) {
@@ -471,9 +492,15 @@ void DBusServiceRegistry::getAvailableServiceInstancesAsync(CommonAPI::Factory::
void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
const std::string& dbusServiceUniqueName = _dbusMessage.getSender();
- assert(_dbusMessage.isSignalType());
- assert(_dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager"));
- assert(_dbusMessage.hasMemberName("InterfacesAdded") || _dbusMessage.hasMemberName("InterfacesRemoved"));
+ if (!_dbusMessage.isSignalType()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " signal message expected, got ", _dbusMessage.getMember(), " type: ", int(_dbusMessage.getType()));
+ }
+ if (!_dbusMessage.hasInterfaceName("org.freedesktop.DBus.ObjectManager")) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unexpected interface ", _dbusMessage.getInterface());
+ }
+ if (!_dbusMessage.hasMemberName("InterfacesAdded") && !_dbusMessage.hasMemberName("InterfacesAdded")) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unexpected member ", _dbusMessage.getMember());
+ }
DBusInputStream dbusInputStream(_dbusMessage);
std::string dbusObjectPath;
@@ -491,7 +518,9 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
dbusInputStream.align(8);
dbusInputStream >> dbusInterfaceName;
dbusInputStream.skipMap();
- assert(!dbusInputStream.hasError());
+ if (dbusInputStream.hasError()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " input stream error");
+ }
dbusInterfaceNames.insert(dbusInterfaceName);
}
dbusInputStream.endReadMapOfSerializableStructs();
@@ -515,7 +544,7 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
return;
}
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
auto dbusServiceUniqueNameIterator = dbusUniqueNamesMap_.find(dbusServiceUniqueName);
const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
@@ -523,6 +552,7 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
if (!isDBusServiceUniqueNameFound) {
// LB TODO: unsubscribe here!
// Needs to be reworked in order to store the subscription identifier!
+ dbusServicesMutex_.unlock();
return;
}
@@ -530,12 +560,15 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
DBusObjectPathCache *dbusObjectPathRecord;
auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
- if(dbusObjectPathCacheIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end())
+ if(dbusObjectPathCacheIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end()) {
dbusObjectPathRecord = &(dbusObjectPathCacheIterator->second);
- else
+ } else {
+ dbusServicesMutex_.unlock();
return;
+ }
if (dbusObjectPathRecord->state != DBusRecordState::RESOLVED) {
+ dbusServicesMutex_.unlock();
return;
}
@@ -548,6 +581,8 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
}
notifyDBusServiceListeners(dbusUniqueNameRecord, dbusObjectPath, dbusInterfaceNames, dbusInterfaceNameState);
+
+ dbusServicesMutex_.unlock();
}
void DBusServiceRegistry::setDBusServicePredefined(const std::string& _serviceName) {
@@ -556,22 +591,30 @@ void DBusServiceRegistry::setDBusServicePredefined(const std::string& _serviceNa
void DBusServiceRegistry::resolveDBusServiceName(const std::string& dbusServiceName,
DBusServiceListenersRecord& dbusServiceListenersRecord) {
- assert(dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::RESOLVED);
- assert(dbusServiceListenersRecord.uniqueBusName.empty());
+ if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::RESOLVED) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " already resolved ", dbusServiceName);
+ }
+ if (!dbusServiceListenersRecord.uniqueBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unique name not empty ", dbusServiceListenersRecord.uniqueBusName);
+ }
mutexServiceResolveCount.lock();
servicesToResolve++;
mutexServiceResolveCount.unlock();
if (dbusDaemonProxy_->isAvailable()) {
- dbusDaemonProxy_->getNameOwnerAsync(
- dbusServiceName,
- std::bind(
- &DBusServiceRegistry::onGetNameOwnerCallback,
- this->shared_from_this(),
- std::placeholders::_1,
- std::placeholders::_2,
- dbusServiceName));
+
+ auto func = std::bind(
+ &DBusServiceRegistry::onGetNameOwnerCallback,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2,
+ dbusServiceName);
+
+ DBusProxyAsyncCallbackHandler<DBusServiceRegistry,
+ std::string>::Delegate delegate(shared_from_this(), func);
+
+ dbusDaemonProxy_->getNameOwnerAsync<DBusServiceRegistry>(dbusServiceName, delegate);
dbusServiceListenersRecord.uniqueBusNameState = DBusRecordState::RESOLVING;
}
@@ -580,7 +623,7 @@ void DBusServiceRegistry::resolveDBusServiceName(const std::string& dbusServiceN
void DBusServiceRegistry::onGetNameOwnerCallback(const CallStatus& status,
std::string dbusServiceUniqueName,
const std::string& dbusServiceName) {
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
auto dbusServiceListenerIterator = dbusServiceListenersMap.find(dbusServiceName);
const bool isDBusServiceListenerRecordFound = (dbusServiceListenerIterator != dbusServiceListenersMap.end());
@@ -609,16 +652,25 @@ void DBusServiceRegistry::onGetNameOwnerCallback(const CallStatus& status,
servicesToResolve--;
mutexServiceResolveCount.unlock();
monitorResolveAllServices_.notify_all();
+
+ dbusServicesMutex_.unlock();
}
DBusServiceRegistry::DBusRecordState
DBusServiceRegistry::resolveDBusInterfaceNameState(
const DBusAddress &_dbusAddress, DBusServiceListenersRecord &dbusServiceListenersRecord) {
- assert(dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::RESOLVED);
- assert(!dbusServiceListenersRecord.uniqueBusName.empty());
+
+ if (dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::RESOLVED) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unresolved ", dbusServiceListenersRecord.uniqueBusName);
+ }
+ if (dbusServiceListenersRecord.uniqueBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unique bus name is empty");
+ }
auto& dbusServiceUniqueNameRecord = dbusUniqueNamesMap_[dbusServiceListenersRecord.uniqueBusName];
- assert(!dbusServiceUniqueNameRecord.ownedBusNames.empty());
+ if (dbusServiceListenersRecord.uniqueBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty ownedBusNames");
+ }
auto& dbusObjectPathRecord = getDBusObjectPathCacheReference(
_dbusAddress.getObjectPath(),
@@ -661,8 +713,9 @@ DBusServiceRegistry::getDBusObjectPathCacheReference(
const bool isSubscriptionSuccessful = dbusProxyConnection->addObjectManagerSignalMemberHandler(
dbusServiceUniqueName,
this);
- assert(isSubscriptionSuccessful);
- (void)isSubscriptionSuccessful;
+ if (!isSubscriptionSuccessful) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " cannot subscribe too ", dbusServiceUniqueName);
+ }
}
if (dbusObjectPathCacheIterator->second.state == DBusRecordState::UNKNOWN
@@ -683,19 +736,28 @@ void DBusServiceRegistry::releaseDBusObjectPathCacheReference(const std::string&
return;
}
- assert(!dbusServiceListenersRecord.uniqueBusName.empty());
+ if (dbusServiceListenersRecord.uniqueBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unique bus name is empty");
+ }
auto& dbusUniqueNameRecord = dbusUniqueNamesMap_[dbusServiceListenersRecord.uniqueBusName];
- assert(!dbusUniqueNameRecord.ownedBusNames.empty());
- assert(!dbusUniqueNameRecord.dbusObjectPathsCache.empty());
+ if (dbusServiceListenersRecord.uniqueBusName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty ownedBusNames");
+ }
+ if (dbusUniqueNameRecord.dbusObjectPathsCache.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " empty dbusObjectPathsCache");
+ }
auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
const bool isDBusObjectPathCacheFound = (dbusObjectPathCacheIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end());
- assert(isDBusObjectPathCacheFound);
- (void)isDBusObjectPathCacheFound;
+ if (!isDBusObjectPathCacheFound) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " no object path cache entry found for ", dbusObjectPath);
+ }
auto& dbusObjectPathCache = dbusObjectPathCacheIterator->second;
- assert(dbusObjectPathCache.referenceCount > 0);
+ if (0 == dbusObjectPathCache.referenceCount) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " reference count is 0");
+ }
dbusObjectPathCache.referenceCount--;
@@ -704,12 +766,15 @@ void DBusServiceRegistry::releaseDBusObjectPathCacheReference(const std::string&
const bool isLastDBusObjectPathCache = dbusUniqueNameRecord.dbusObjectPathsCache.empty();
if (isLastDBusObjectPathCache) {
+ dbusServicesMutex_.unlock();
auto dbusProxyConnection = dbusDaemonProxy_->getDBusConnection();
const bool isSubscriptionCancelled = dbusProxyConnection->removeObjectManagerSignalMemberHandler(
dbusServiceListenersRecord.uniqueBusName,
this);
- assert(isSubscriptionCancelled);
- (void)isSubscriptionCancelled;
+ if (!isSubscriptionCancelled) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), ": still subscribed too ", dbusServiceListenersRecord.uniqueBusName);
+ }
+ dbusServicesMutex_.lock();
}
}
}
@@ -732,7 +797,9 @@ bool DBusServiceRegistry::getManagedObjects(const std::string& dbusServiceUnique
bool isSendingInProgress = false;
auto dbusConnection = dbusDaemonProxy_->getDBusConnection();
- assert(!dbusServiceUniqueName.empty());
+ if (dbusServiceUniqueName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusServiceUniqueName empty");
+ }
if(dbusConnection->isConnected()) {
@@ -754,11 +821,17 @@ bool DBusServiceRegistry::getManagedObjects(const std::string& dbusServiceUnique
dbusServiceUniqueName,
dbusObjectPath);
+ DBusProxyAsyncCallbackHandler<
+ DBusServiceRegistry,
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
+ >::Delegate delegate(shared_from_this(), getManagedObjectsCallback);
+
dbusConnection->sendDBusMessageWithReplyAsync(
dbusMessageCall,
DBusProxyAsyncCallbackHandler<
+ DBusServiceRegistry,
DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
- >::create(getManagedObjectsCallback, std::tuple<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict>()),
+ >::create(delegate, std::tuple<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict>()),
&serviceRegistryInfo);
isSendingInProgress = true;
@@ -852,12 +925,13 @@ void DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther(const CallSt
// No further managed objects
}
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
auto dbusServiceUniqueNameIterator = dbusUniqueNamesMap_.find(dbusServiceUniqueName);
const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
if (!isDBusServiceUniqueNameFound) {
+ dbusServicesMutex_.unlock();
return;
}
@@ -866,13 +940,16 @@ void DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther(const CallSt
const bool isDBusObjectPathFound = (dbusObjectPathIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end());
if (!isDBusObjectPathFound) {
+ dbusServicesMutex_.unlock();
return;
}
DBusObjectPathCache& dbusObjectPathRecord = dbusObjectPathIterator->second;
dbusObjectPathRecord.state = DBusRecordState::RESOLVED;
- dbusObjectPathRecord.promiseOnResolve.set_value(dbusObjectPathRecord.state);
+ if(dbusObjectPathRecord.futureOnResolve.valid()) {
+ dbusObjectPathRecord.promiseOnResolve.set_value(dbusObjectPathRecord.state);
+ }
mutexObjectPathsResolveCount.lock();
objectPathsToResolve--;
mutexObjectPathsResolveCount.unlock();
@@ -885,6 +962,8 @@ void DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther(const CallSt
dbusObjectPath,
dbusObjectPathRecord.dbusInterfaceNamesCache,
DBusRecordState::RESOLVED);
+
+ dbusServicesMutex_.unlock();
}
void DBusServiceRegistry::processManagedObject(const std::string& dbusObjectPath,
@@ -905,7 +984,9 @@ bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServic
bool isResolvingInProgress = false;
auto dbusConnection = dbusDaemonProxy_->getDBusConnection();
- assert(!dbusServiceUniqueName.empty());
+ if (dbusServiceUniqueName.empty()) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " dbusServiceUniqueName empty");
+ }
if (dbusConnection->isConnected()) {
mutexObjectPathsResolveCount.lock();
@@ -924,11 +1005,17 @@ bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServic
dbusServiceUniqueName,
dbusObjectPath);
+ DBusProxyAsyncCallbackHandler<
+ DBusServiceRegistry,
+ std::string
+ >::Delegate delegate(shared_from_this(), instrospectAsyncCallback);
+
dbusConnection->sendDBusMessageWithReplyAsync(
dbusMessageCall,
DBusProxyAsyncCallbackHandler<
+ DBusServiceRegistry,
std::string
- >::create(instrospectAsyncCallback, std::tuple<std::string>()),
+ >::create(delegate, std::tuple<std::string>()),
&serviceRegistryInfo);
isResolvingInProgress = true;
@@ -956,7 +1043,7 @@ void DBusServiceRegistry::onIntrospectCallback(const CallStatus& callStatus,
parseIntrospectionData(xmlData, dbusObjectPath, dbusServiceUniqueName);
}
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
// Error CallStatus will result in empty parsedDBusInterfaceNameSet (and not available notification)
@@ -964,6 +1051,7 @@ void DBusServiceRegistry::onIntrospectCallback(const CallStatus& callStatus,
const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
if (!isDBusServiceUniqueNameFound) {
+ dbusServicesMutex_.unlock();
return;
}
@@ -972,6 +1060,7 @@ void DBusServiceRegistry::onIntrospectCallback(const CallStatus& callStatus,
const bool isDBusObjectPathFound = (dbusObjectPathIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end());
if (!isDBusObjectPathFound) {
+ dbusServicesMutex_.unlock();
return;
}
@@ -991,6 +1080,8 @@ void DBusServiceRegistry::onIntrospectCallback(const CallStatus& callStatus,
dbusObjectPath,
dbusObjectPathRecord.dbusInterfaceNamesCache,
DBusRecordState::RESOLVED);
+
+ dbusServicesMutex_.unlock();
}
void DBusServiceRegistry::parseIntrospectionNode(const pugi::xml_node& node, const std::string& rootObjectPath, const std::string& fullObjectPath, const std::string& dbusServiceUniqueName) {
@@ -1069,9 +1160,11 @@ void DBusServiceRegistry::parseIntrospectionData(const std::string& xmlData,
void DBusServiceRegistry::onDBusDaemonProxyStatusEvent(const AvailabilityStatus& availabilityStatus) {
- assert(availabilityStatus != AvailabilityStatus::UNKNOWN);
+ if (availabilityStatus == AvailabilityStatus::UNKNOWN) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unexpected availability status ", int(availabilityStatus));
+ }
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
for (auto& dbusServiceListenersIterator : dbusServiceListenersMap) {
const auto& dbusServiceName = dbusServiceListenersIterator.first;
@@ -1083,6 +1176,8 @@ void DBusServiceRegistry::onDBusDaemonProxyStatusEvent(const AvailabilityStatus&
onDBusServiceNotAvailable(dbusServiceListenersRecord, dbusServiceName);
}
}
+
+ dbusServicesMutex_.unlock();
}
void DBusServiceRegistry::checkDBusServiceWasAvailable(const std::string& dbusServiceName,
@@ -1105,7 +1200,7 @@ void DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent(const std::stri
const bool isDBusServiceNameLost = newOwner.empty();
const std::string& dbusServiceUniqueName = (isDBusServiceNameLost ? oldOwner : newOwner);
- std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+ dbusServicesMutex_.lock();
if (isDBusServiceNameLost) {
checkDBusServiceWasAvailable(affectedName, dbusServiceUniqueName);
@@ -1113,6 +1208,8 @@ void DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent(const std::stri
onDBusServiceAvailable(affectedName, dbusServiceUniqueName);
}
+ dbusServicesMutex_.unlock();
+
return;
}
@@ -1175,7 +1272,7 @@ void DBusServiceRegistry::onDBusServiceAvailable(const std::string& dbusServiceN
}
void DBusServiceRegistry::onDBusServiceNotAvailable(DBusServiceListenersRecord& dbusServiceListenersRecord, const std::string &_serviceName) {
- const std::unordered_set<std::string> dbusInterfaceNamesCache;
+ const std::unordered_set<std::string> dbusInterfaceNamesCache {};
const DBusUniqueNamesMapIterator dbusUniqueNameRecordIterator = dbusUniqueNamesMap_.find(dbusServiceListenersRecord.uniqueBusName);
@@ -1268,9 +1365,9 @@ void DBusServiceRegistry::notifyDBusObjectPathChanged(DBusInterfaceNameListeners
const DBusRecordState& dbusInterfaceNamesState) {
const bool isDBusInterfaceNameAvailable = (dbusInterfaceNamesState == DBusRecordState::AVAILABLE);
- assert(
- dbusInterfaceNamesState == DBusRecordState::AVAILABLE
- || dbusInterfaceNamesState == DBusRecordState::NOT_AVAILABLE);
+ if ((dbusInterfaceNamesState != DBusRecordState::AVAILABLE) && (dbusInterfaceNamesState != DBusRecordState::NOT_AVAILABLE)) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), " unexpected state ", int(dbusInterfaceNamesState));
+ }
for (const auto& dbusInterfaceName : dbusInterfaceNames) {
auto dbusInterfaceNameListenersIterator = dbusInterfaceNameListenersMap.find(dbusInterfaceName);
@@ -1305,12 +1402,6 @@ void DBusServiceRegistry::notifyDBusInterfaceNameListeners(DBusInterfaceNameList
}
void DBusServiceRegistry::removeUniqueName(const DBusUniqueNamesMapIterator& dbusUniqueNamesIterator, const std::string &_serviceName) {
- const bool isSubscriptionCancelled = dbusDaemonProxy_->getDBusConnection()->removeObjectManagerSignalMemberHandler(
- dbusUniqueNamesIterator->first,
- this);
- assert(isSubscriptionCancelled);
- (void)isSubscriptionCancelled;
-
if ("" != _serviceName) {
auto findServiceName = dbusUniqueNamesIterator->second.ownedBusNames.find(_serviceName);
if (findServiceName != dbusUniqueNamesIterator->second.ownedBusNames.end())
@@ -1320,7 +1411,16 @@ void DBusServiceRegistry::removeUniqueName(const DBusUniqueNamesMapIterator& dbu
}
if (dbusUniqueNamesIterator->second.ownedBusNames.size() == 0) {
+ std::string dbusUniqueName = dbusUniqueNamesIterator->first;
dbusUniqueNamesMap_.erase(dbusUniqueNamesIterator);
+ dbusServicesMutex_.unlock();
+ const bool isSubscriptionCancelled = dbusDaemonProxy_->getDBusConnection()->removeObjectManagerSignalMemberHandler(
+ dbusUniqueName,
+ this);
+ if (!isSubscriptionCancelled) {
+ COMMONAPI_ERROR(std::string(__FUNCTION__), ": still subscribed too ", dbusUniqueName);
+ }
+ dbusServicesMutex_.lock();
} else {
//delete object path cache entry of service
auto& dbusObjectPathsCache = dbusUniqueNamesIterator->second.dbusObjectPathsCache;
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.cpp b/src/CommonAPI/DBus/DBusStubAdapter.cpp
index 6a3a8cf..422a419 100644
--- a/src/CommonAPI/DBus/DBusStubAdapter.cpp
+++ b/src/CommonAPI/DBus/DBusStubAdapter.cpp
@@ -5,6 +5,7 @@
#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
#include <CommonAPI/DBus/DBusStubAdapter.hpp>
+#include <CommonAPI/DBus/DBusFactory.hpp>
namespace CommonAPI {
namespace DBus {
@@ -15,10 +16,12 @@ DBusStubAdapter::DBusStubAdapter(const DBusAddress &_dbusAddress,
: dbusAddress_(_dbusAddress),
connection_(_connection),
isManaging_(_isManaging) {
+ Factory::get()->incrementConnection(connection_);
}
DBusStubAdapter::~DBusStubAdapter() {
deinit();
+ Factory::get()->decrementConnection(connection_);
}
void DBusStubAdapter::init(std::shared_ptr<DBusStubAdapter> _instance) {
diff --git a/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
index 78b073c..e0c2c6f 100644
--- a/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
+++ b/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
@@ -201,7 +201,7 @@ index 86fb8c3..bfa2a39 100644
#define _dbus_string_set_byte(s, i, b) ((((unsigned char*)(((DBusString*)(s))->dummy1))[(i)]) = (unsigned char) (b))
#define _dbus_string_get_byte(s, i) (((const unsigned char*)(((DBusString*)(s))->dummy1))[(i)])
#define _dbus_string_get_const_data(s) ((const char*)(((DBusString*)(s))->dummy1))
-@@ -131,6 +132,10 @@ void _dbus_string_copy_to_buffer_with_nul (const DBusString *str,
+@@ -151,6 +152,10 @@ DBUS_PRIVATE_EXPORT
int _dbus_string_get_length (const DBusString *str);
#endif /* !_dbus_string_get_length */
@@ -209,9 +209,9 @@ index 86fb8c3..bfa2a39 100644
+int _dbus_string_get_allocated (const DBusString *str);
+#endif /* !_dbus_string_get_allocated */
+
- dbus_bool_t _dbus_string_lengthen (DBusString *str,
- int additional_length);
- void _dbus_string_shorten (DBusString *str,
+ /**
+ * Get the string's length as an unsigned integer, for comparison with
+ * size_t and similar unsigned types that does not trigger compiler
--
1.9.1
diff --git a/src/pugixml/pugixml.cpp b/src/pugixml/pugixml.cpp
index e5b5e22..9778df1 100644
--- a/src/pugixml/pugixml.cpp
+++ b/src/pugixml/pugixml.cpp
@@ -7583,7 +7583,7 @@ PUGI__NS_BEGIN
if (expr->rettype() == xpath_type_number)
{
- if (expr->eval_number(c, stack) == i)
+ if (expr->eval_number(c, stack) == (double)i)
*last++ = *it;
}
else if (expr->eval_boolean(c, stack))
@@ -8445,7 +8445,7 @@ PUGI__NS_BEGIN
double first = round_nearest(_right->eval_number(c, stack));
if (is_nan(first)) return xpath_string(); // NaN
- else if (first >= s_length + 1) return xpath_string();
+ else if (first >= (double)(s_length + 1)) return xpath_string();
size_t pos = first < 1 ? 1 : static_cast<size_t>(first);
assert(1 <= pos && pos <= s_length + 1);
@@ -8468,12 +8468,12 @@ PUGI__NS_BEGIN
double last = first + round_nearest(_right->_next->eval_number(c, stack));
if (is_nan(first) || is_nan(last)) return xpath_string();
- else if (first >= s_length + 1) return xpath_string();
+ else if (first >= (double)(s_length + 1)) return xpath_string();
else if (first >= last) return xpath_string();
else if (last < 1) return xpath_string();
size_t pos = first < 1 ? 1 : static_cast<size_t>(first);
- size_t end = last >= s_length + 1 ? s_length + 1 : static_cast<size_t>(last);
+ size_t end = last >= (double)(s_length + 1) ? s_length + 1 : static_cast<size_t>(last);
assert(1 <= pos && pos <= end && end <= s_length + 1);
const char_t* rbegin = s.c_str() + (pos - 1);
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index 55289b3..be5aa1e 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -76,40 +76,9 @@ set(TEST_LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed Common
set(TEST_LINK_LIBRARIES_WITHOUT_COMMONAPI_DBUS CommonAPI gtest ${PTHREAD_LIBRARY})
##############################################################################
-# DBusManagedTest
-##############################################################################
-
-add_executable(DBusManagedTest DBusManagedTest.cpp
- ${ManagedDBusSources})
-target_link_libraries(DBusManagedTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusMainLoopIntegrationTest
-##############################################################################
-
-add_executable(DBusMainLoopIntegrationTest DBusMainLoopIntegrationTest.cpp
- ${TestInterfaceDBusSources})
-if (MSVC)
-target_link_libraries(DBusMainLoopIntegrationTest ${TEST_LINK_LIBRARIES} ws2_32)
-else()
-target_link_libraries(DBusMainLoopIntegrationTest ${TEST_LINK_LIBRARIES} ${GLIB_LDFLAGS})
-endif()
-
-##############################################################################
-# DBusAddressTranslatorTest
-##############################################################################
-
-
-add_executable(DBusAddressTranslatorTest DBusAddressTranslatorTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusAddressTranslatorTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusConnectionTest
##############################################################################
-
add_executable(DBusConnectionTest DBusConnectionTest.cpp)
target_link_libraries(DBusConnectionTest ${TEST_LINK_LIBRARIES})
@@ -123,15 +92,6 @@ add_executable(DBusVariantOutputStreamTest DBusVariantOutputStreamTest.cpp)
target_link_libraries(DBusVariantOutputStreamTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusCommunicationTest
-##############################################################################
-
-add_executable(DBusCommunicationTest DBusCommunicationTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusCommunicationTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusDaemonProxyTest
##############################################################################
@@ -141,63 +101,6 @@ add_executable(DBusDaemonProxyTest DBusDaemonProxyTest.cpp)
target_link_libraries(DBusDaemonProxyTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusInputStreamTest
-##############################################################################
-
-add_executable(DBusInputStreamTest DBusInputStreamTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusInputStreamTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusOutputStreamTest
-##############################################################################
-
-
-add_executable(DBusOutputStreamTest DBusOutputStreamTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusOutputStreamTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusFactoryTest
-##############################################################################
-
-add_executable(DBusFactoryTest DBusFactoryTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusFactoryTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusMultipleConnectionTest
-##############################################################################
-
-add_executable(DBusMultipleConnectionTest DBusMultipleConnectionTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusMultipleConnectionTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusProxyTest
-##############################################################################
-
-add_executable(DBusProxyTest DBusProxyTest.cpp
- ${TestInterfaceDBusSources}
- ${ExtendedInterfaceDBusSources})
-
-target_link_libraries(DBusProxyTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusFreedesktopPropertiesTest
-##############################################################################
-
-add_executable(DBusFreedesktopPropertiesTest DBusFreedesktopPropertiesTest.cpp
- ${TestInterfaceSources}
- ${FreedesktopPropertiesDBusSources})
-
-target_link_libraries(DBusFreedesktopPropertiesTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusVariantTest
##############################################################################
@@ -206,14 +109,6 @@ add_executable(DBusVariantTest DBusVariantTest.cpp)
target_link_libraries(DBusVariantTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusRuntimeTest
-##############################################################################
-
-add_executable(DBusRuntimeTest DBusRuntimeTest.cpp)
-
-target_link_libraries(DBusRuntimeTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusClientIdTest
##############################################################################
@@ -222,140 +117,32 @@ add_executable(DBusClientIdTest DBusClientIdTest.cpp)
target_link_libraries(DBusClientIdTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusBroadcastTest
-##############################################################################
-
-add_executable(DBusBroadcastTest ${TestInterfaceDBusSources}
- ${TestInterfaceManagerDBusSources}
- DBusBroadcastTest.cpp)
-
-target_link_libraries(DBusBroadcastTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusPolymorphicTest
-##############################################################################
-
-
-add_executable(DBusPolymorphicTest ${TestInterfaceDBusSources}
- DBusPolymorphicTest.cpp)
-
-target_link_libraries(DBusPolymorphicTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
-# DBusLoadTest
-##############################################################################
-
-add_executable(DBusLoadTest DBusLoadTest.cpp
- ${TestInterfaceDBusSources})
-
-target_link_libraries(DBusLoadTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# Add for every test a dependency to gtest
##############################################################################
-add_dependencies(DBusManagedTest gtest)
-add_dependencies(DBusMainLoopIntegrationTest gtest)
-add_dependencies(DBusAddressTranslatorTest gtest)
add_dependencies(DBusConnectionTest gtest)
add_dependencies(DBusVariantOutputStreamTest gtest)
-add_dependencies(DBusCommunicationTest gtest)
add_dependencies(DBusDaemonProxyTest gtest)
-add_dependencies(DBusInputStreamTest gtest)
-add_dependencies(DBusOutputStreamTest gtest)
-add_dependencies(DBusFactoryTest gtest)
-add_dependencies(DBusMultipleConnectionTest gtest)
-add_dependencies(DBusProxyTest gtest)
-add_dependencies(DBusFreedesktopPropertiesTest gtest)
add_dependencies(DBusVariantTest gtest)
-add_dependencies(DBusRuntimeTest gtest)
add_dependencies(DBusClientIdTest gtest)
-add_dependencies(DBusBroadcastTest gtest)
-add_dependencies(DBusPolymorphicTest gtest)
-add_dependencies(DBusLoadTest gtest)
##############################################################################
# Add tests to the target build_tests
##############################################################################
-add_dependencies(build_tests DBusManagedTest)
-add_dependencies(build_tests DBusMainLoopIntegrationTest)
-add_dependencies(build_tests DBusAddressTranslatorTest)
add_dependencies(build_tests DBusConnectionTest)
add_dependencies(build_tests DBusVariantOutputStreamTest)
-add_dependencies(build_tests DBusCommunicationTest)
add_dependencies(build_tests DBusDaemonProxyTest)
-add_dependencies(build_tests DBusInputStreamTest)
-add_dependencies(build_tests DBusOutputStreamTest)
-add_dependencies(build_tests DBusFactoryTest)
-add_dependencies(build_tests DBusMultipleConnectionTest)
-add_dependencies(build_tests DBusProxyTest)
-add_dependencies(build_tests DBusFreedesktopPropertiesTest)
add_dependencies(build_tests DBusVariantTest)
-add_dependencies(build_tests DBusRuntimeTest)
add_dependencies(build_tests DBusClientIdTest)
-add_dependencies(build_tests DBusBroadcastTest)
-add_dependencies(build_tests DBusPolymorphicTest)
-add_dependencies(build_tests DBusLoadTest)
##############################################################################
# Add tests
##############################################################################
-add_test(NAME DBusManagedTest COMMAND DBusManagedTest)
-add_test(NAME DBusMainLoopIntegrationTest COMMAND DBusMainLoopIntegrationTest)
-add_test(NAME DBusAddressTranslatorTest WORKING_DIRECTORY ${libcommonapi-dbus_SOURCE_DIR} COMMAND DBusAddressTranslatorTest)
add_test(NAME DBusConnectionTest COMMAND DBusConnectionTest)
add_test(NAME DBusVariantOutputStreamTest COMMAND DBusVariantOutputStreamTest)
-add_test(NAME DBusCommunicationTest COMMAND DBusCommunicationTest)
add_test(NAME DBusDaemonProxyTest COMMAND DBusDaemonProxyTest)
-add_test(NAME DBusInputStreamTest COMMAND DBusInputStreamTest)
-add_test(NAME DBusOutputStreamTest COMMAND DBusOutputStreamTest)
-add_test(NAME DBusFactoryTest COMMAND DBusFactoryTest)
-add_test(NAME DBusMultipleConnectionTest COMMAND DBusMultipleConnectionTest)
-add_test(NAME DBusProxyTest COMMAND DBusProxyTest)
-add_test(NAME DBusFreedesktopPropertiesTest COMMAND DBusFreedesktopPropertiesTest)
add_test(NAME DBusVariantTest COMMAND DBusVariantTest)
-add_test(NAME DBusRuntimeTest COMMAND DBusRuntimeTest)
add_test(NAME DBusClientIdTest COMMAND DBusClientIdTest)
-add_test(NAME DBusBroadcastTest COMMAND DBusBroadcastTest)
-add_test(NAME DBusPolymorphicTest COMMAND DBusPolymorphicTest)
-add_test(NAME DBusLoadTest COMMAND DBusLoadTest)
-
-#DBusManagedTest_SOURCES = \
-# src/test/DBusManagedTest.cpp \
-# ${ManagedDBusSources}
-#DBusManagedTest_CPPFLAGS = ${AM_CPPFLAGS} ${GTEST_CPPFLAGS} ${GLIB_CFLAGS}
-#DBusManagedTest_CXXFLAGS = ${GTEST_CXXFLAGS} ${GLIB_CFLAGS}
-#DBusManagedTest_LDADD = ${LDADD_FOR_GTEST} ${GLIB_LIBS}
-
-#AM_CPPFLAGS = \
-# -include $(top_builddir)/build-aux/config.h \
-# -I$(top_srcdir)/src \
-# -I$(top_srcdir)/src/test \
-# ${COMMONAPI_CFLAGS} \
-# ${DBUS_CFLAGS} \
-# -DCOMMONAPI_INTERNAL_COMPILATION \
-# -DCOMMONAPI_DBUS_VERSION_MAJOR=${LIBCOMMONAPI_DBUS_CURRENT} \
-# -DCOMMONAPI_DBUS_VERSION_MINOR=${LIBCOMMONAPI_DBUS_REVISION}
-
-#COMMONAPI_CFLAGS = -I/usr/local/include/CommonAPI-2.1
-#COMMONAPI_LIBS = -L/usr/local/lib -lCommonAPI
-#DBUS_CFLAGS = -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus-1.0/include
-#DBUS_LIBS = -L/usr/local/lib -ldbus-1 -lpthread -lrt
-
-#GTEST_CPPFLAGS: -I/home/genius/googletest/gtest-1.7.0/include -I/home/genius/googletest/gtest-1.7.0/include
-
-#GLIB_CFLAGS='-I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include '
-
-
-
-#GTEST_CXXFLAGS: -pthread
-
-#LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS = ${GTEST_LIBS} ${LDADD}
-#LDADD_FOR_GTEST = libCommonAPI-DBus.la ${LDADD_FOR_GTEST_WITHOUT_LIBCOMMON_API_DBUS}
-#GTEST_LIBS: /home/genius/googletest/gtest-1.7.0/lib/libgtest.la -pthread
-
-
-#GLIB_LIBS='-lglib-2.0 '
diff --git a/src/test/DBusAddressTranslatorTest.cpp b/src/test/DBusAddressTranslatorTest.cpp
deleted file mode 100644
index d7fc3ee..0000000
--- a/src/test/DBusAddressTranslatorTest.cpp
+++ /dev/null
@@ -1,589 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-#include <fstream>
-#include <thread>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#define VERSION v1_0
-
-#include <CommonAPI/Types.hpp>
-#include <CommonAPI/Utils.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusUtils.hpp>
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-
-#include <v1/fake/legacy/service/LegacyInterfaceProxy.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxy.hpp>
-
-static const std::string domain = "local";
-
-static const std::string fileString =
-""
-"[not#a$valid/address]\n"
-"[]\n"
-" 98t3hpgjvqpvnü0 t4b+qßk4 kv+üg4krgv+ß4krgv+ßkr\n"
-"[too.short:address]\n"
-"[incomplete:address:]\n"
-"[:address:incomplete]\n"
-"[]đwqervqerverver\n"
-"[too:long:address:here]\n"
-"jfgv2nqp3 riqpnvi39r[]"
-"\n"
-"[local:no.nothing.service:no.nothing.instance]\n"
-"\n"
-"[local:service:instance]\n"
-"service=connection.name\n"
-"path=/path/to/object\n"
-"interface=service.name\n"
-"\n"
-"[local:no.interface.service:no.interface.instance]\n"
-"service=no.interface.connection\n"
-"path=/no/interface/path\n"
-"\n"
-"[local:no.connection.service:no.connection.instance]\n"
-"path=/no/connection/path\n"
-"interface=no.connection.interface\n"
-"\n"
-"[local:no.object.service:no.object.instance]\n"
-"service=no.object.connection\n"
-"interface=no.object.interface\n"
-"\n"
-"[local:only.interface.service:only.interface.instance]\n"
-"interface=only.interface.interface\n"
-"\n"
-"[local:only.connection.service:only.connection.instance]\n"
-"service=only.connection.connection\n"
-"\n"
-"[local:only.object.service:only.object.instance]\n"
-"path=/only/object/path\n"
-"\n"
-"[local:fake.legacy.service.LegacyInterface:fake.legacy.service]\n"
-"service=fake.legacy.service.connection\n"
-"path=/some/legacy/path/6259504\n"
-"interface=fake.legacy.service.LegacyInterface\n"
-// all tests run within the same binary under windows, meaning the config file will only be read once. That's why we already have to add the factory configuration used by DBusFactoryTest and the predifined instances for DBusServiceRegistryTest here.
-#ifdef WIN32
-"[local:Interface1:predefined.Instance1]\n"
-"service=DBusServiceRegistryTest.Predefined.Service\n"
-"path=/tests/predefined/Object1\n"
-"interface=tests.Interface1\n"
-"[local:Interface1:predefined.Instance2]\n"
-"service=DBusServiceRegistryTest.Predefined.Service\n"
-"path=/tests/predefined/Object2\n"
-"interface=tests.Interface1\n"
-"[local:Interface2:predefined.Instance]\n"
-"service=DBusServiceRegistryTest.Predefined.Service\n"
-"path=/tests/predefined/Object1\n"
-"interface=tests.Interface2\n"
-"[factory$session]\n"
-"dbus_bustype=session\n"
-"[factory$system]\n"
-"dbus_bustype=system\n"
-#endif
-;
-
-static const std::vector<std::string> commonApiAddresses = {
- "local:no.nothing.service:no.nothing.instance",
- "local:service:instance",
- "local:no.interface.service:no.interface.instance",
- "local:no.connection.service:no.connection.instance",
- "local:no.object.service:no.object.instance",
- "local:only.interface.service:only.interface.instance",
- "local:only.connection.service:only.connection.instance",
- "local:only.object.service:only.object.instance",
- "local:fake.legacy.service.LegacyInterface:fake.legacy.service",
- "local:fake.legacy.service.LegacyInterfaceNoObjectManager:fake.legacy.service"
-};
-
-typedef std::vector<CommonAPI::DBus::DBusAddress>::value_type vt;
-static const std::vector<CommonAPI::DBus::DBusAddress> dbusAddresses = {
- vt("no.nothing.service_no.nothing.instance", "/no/nothing/instance", "no.nothing.service"),
- vt("service.name_connection.name", "/path/to/object", "service.name"),
- vt("no.interface.service_no.interface.instance", "/no/interface/instance", "no.interface.service"),
- vt("no.connection.service_no.connection.instance", "/no/connection/instance", "no.connection.service"),
- vt("no.object.service_no.object.instance", "/no/object/instance", "no.object.service"),
- vt("only.interface.service_only.interface.instance", "/only/interface/instance", "only.interface.service"),
- vt("only.connection.service_only.connection.instance", "/only/connection/instance", "only.connection.service"),
- vt("only.object.service_only.object.instance", "/only/object/instance", "only.object.service"),
- vt("fake.legacy.service.connection", "/some/legacy/path/6259504", "fake.legacy.service.LegacyInterface"),
- vt("fake.legacy.service.connection", "/some/legacy/path/6259504", "fake.legacy.service.LegacyInterfaceNoObjectManager")
-};
-
-class AddressTranslatorTest: public ::testing::Test {
-
-protected:
- void SetUp() {
- }
-
- virtual void TearDown() {
- usleep(30000);
- }
- std::string configFileName_;
-};
-
-TEST_F(AddressTranslatorTest, InstanceCanBeRetrieved) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> dbusAddressTranslator = CommonAPI::DBus::DBusAddressTranslator::get();
- ASSERT_TRUE((bool) dbusAddressTranslator);
-}
-
-TEST_F(AddressTranslatorTest, ParsesDBusAddresses) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- for(unsigned int i = 0; i < commonApiAddresses.size(); i++) {
- std::string interfaceName, connectionName, objectPath;
- CommonAPI::DBus::DBusAddress dbusAddress;
- translator->translate(commonApiAddresses[i], dbusAddress);
- std::cout << dbusAddress.getService() << " " << dbusAddress.getObjectPath() << " " << dbusAddress.getInterface() << std::endl;
- ASSERT_EQ(dbusAddresses[i].getService(), dbusAddress.getService());
- ASSERT_EQ(dbusAddresses[i].getObjectPath(), dbusAddress.getObjectPath());
- ASSERT_EQ(dbusAddresses[i].getInterface(), dbusAddress.getInterface());
- }
-}
-
-TEST_F(AddressTranslatorTest, ParsesCommonAPIAddresses) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- for(unsigned int i = 0; i < commonApiAddresses.size(); i++) {
- CommonAPI::Address commonApiAddress;
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddresses[i].getService(), dbusAddresses[i].getObjectPath(), dbusAddresses[i].getInterface()), commonApiAddress);
- std::cout << dbusAddresses[i].getService() << " " << dbusAddresses[i].getObjectPath() << " " << dbusAddresses[i].getInterface() << std::endl;
- std::cout << commonApiAddress.getDomain() << " " << commonApiAddress.getInterface() << " " << commonApiAddress.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddresses[i], commonApiAddress.getAddress());
- }
-}
-
-TEST_F(AddressTranslatorTest, InsertAddressPossible) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- std::string commonApiAddressRef = "local:my.service:my.instance";
-
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service_my.new.instance", "/my/new/instance", "my.new.service");
- CommonAPI::DBus::DBusAddress dbusAddressSecondInsertRef("my.new.second.service_my.new.second.instance", "/my/new/second/instance", "my.new.second.service");
- std::string commonApiSecondInsertAddressRef = "local:my.new.second.service:my.new.second.instance";
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- // insert new address
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
-
- //check inserted address
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- // try overwriting address
- translator->insert(commonApiAddressRef,
- dbusAddressSecondInsertRef.getService(),
- dbusAddressSecondInsertRef.getObjectPath(),
- dbusAddressSecondInsertRef.getInterface());
-
- //check overwritten not possible
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressSecondInsertRef.getService(), dbusAddressSecondInsertRef.getObjectPath(), dbusAddressSecondInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressSecondInsertRef.getService() << " " << dbusAddressSecondInsertRef.getObjectPath() << " " << dbusAddressSecondInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiSecondInsertAddressRef, commonApiAddressResult.getAddress());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-}
-
-TEST_F(AddressTranslatorTest, InsertUniqueBusNameTranslate) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- translator->insert("local:my.Interface:busname.legacy.service_1_133",
- ":1.133", /* unique bus name */
- "/org/busname/legacy/service",
- "busname.legacy.service");
-
- CommonAPI::DBus::DBusAddress dbusAddress;
-
- translator->translate("local:my.Interface:busname.legacy.service_1_133", dbusAddress);
-
- ASSERT_EQ(":1.133", dbusAddress.getService());
- ASSERT_EQ("busname.legacy.service", dbusAddress.getInterface());
- ASSERT_EQ("/org/busname/legacy/service", dbusAddress.getObjectPath());
-}
-
-TEST_F(AddressTranslatorTest, InsertAddressNotPossibleConflictTranslate) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- CommonAPI::DBus::DBusAddress dbusAddressRef("my.service.translate_my.instance.translate", "/my/instance/translate", "my.service.translate");
- std::string commonApiAddressRef = "local:my.service.translate:my.instance.translate";
-
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service.translate_my.new.instance.translate", "/my/new/instance/translate", "my.new.service.translate");
- std::string commonApiAddressInsertRef = "local:my.new.service.translate:my.new.instance.translate";
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- // insertion via translate
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressRef.getInterface(), dbusAddressResult.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressRef.getService(), dbusAddressRef.getObjectPath(), dbusAddressRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressRef.getService() << " " << dbusAddressRef.getObjectPath() << " " << dbusAddressRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- // try to overwrite address
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
-
- //check that inserting was not possible
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressRef.getInterface(), dbusAddressResult.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressInsertRef, commonApiAddressResult.getAddress());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressRef.getService(), dbusAddressRef.getObjectPath(), dbusAddressRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressRef.getService() << " " << dbusAddressRef.getObjectPath() << " " << dbusAddressRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
-}
-
-TEST_F(AddressTranslatorTest, InsertAddressNotPossibleConflictConfigFile) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.new.service.config_my.new.instance.config", "/my/new/instance/config", "my.new.service.config");
- std::string commonApiAddressInsertRef = "local:my.new.service.config:my.new.instance.config";
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- // try to overwrite address
- translator->insert(commonApiAddresses[1],
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
-
- //check that inserting was not possible
- translator->translate(commonApiAddresses[1], dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddresses[1].getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddresses[1].getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddresses[1].getInterface(), dbusAddressResult.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressInsertRef, commonApiAddressResult.getAddress());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddresses[1].getService(), dbusAddresses[1].getObjectPath(), dbusAddresses[1].getInterface()), commonApiAddressResult);
- std::cout << dbusAddresses[1].getService() << " " << dbusAddresses[1].getObjectPath() << " " << dbusAddresses[1].getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddresses[1], commonApiAddressResult.getAddress());
-}
-
-TEST_F(AddressTranslatorTest, UniqueAddressHandlingTranslateWorks) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- std::string commonApiAddressRef = "local:my.unique.translate.interface:my.unique.translate.instance";
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef(":1.6", "/my/unique/translate/instance", "my.unique.translate.interface");
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-}
-
-TEST_F(AddressTranslatorTest, UniqueAddressHandlingInsertWorks) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- std::string commonApiAddressRef = "local:my.unique.insert.other.interface:my.unique.insert.other.instance";
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef(":1.6", "/my/unique/insert/instance", "my.unique.insert.interface");
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-}
-
-TEST_F(AddressTranslatorTest, CheckWellKnownNameTranslateWorks) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- std::string commonApiAddressRef = "local:my.well.translate.interface:my.well.translate.instance";
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.well.known.name", "/my/well/translate/instance", "my.well.translate.interface");
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-}
-
-TEST_F(AddressTranslatorTest, CheckWellKnownNameInsertWorks) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
-
- std::string commonApiAddressRef = "local:my.well.insert.other.interface:my.well.insert.other.instance";
- CommonAPI::DBus::DBusAddress dbusAddressInsertRef("my.well.known.name", "/my/well/insert/instance", "my.well.insert.interface");
-
- CommonAPI::DBus::DBusAddress dbusAddressResult;
- CommonAPI::Address commonApiAddressResult;
-
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
-
- translator->translate(CommonAPI::DBus::DBusAddress(dbusAddressInsertRef.getService(), dbusAddressInsertRef.getObjectPath(), dbusAddressInsertRef.getInterface()), commonApiAddressResult);
- std::cout << dbusAddressInsertRef.getService() << " " << dbusAddressInsertRef.getObjectPath() << " " << dbusAddressInsertRef.getInterface() << std::endl;
- std::cout << commonApiAddressResult.getDomain() << " " << commonApiAddressResult.getInterface() << " " << commonApiAddressResult.getInstance() << std::endl;
- ASSERT_EQ(commonApiAddressRef, commonApiAddressResult.getAddress());
-
- translator->translate(commonApiAddressRef, dbusAddressResult);
- std::cout << dbusAddressResult.getService() << " " << dbusAddressResult.getObjectPath() << " " << dbusAddressResult.getInterface() << std::endl;
- ASSERT_EQ(dbusAddressInsertRef.getService(), dbusAddressResult.getService());
- ASSERT_EQ(dbusAddressInsertRef.getObjectPath(), dbusAddressResult.getObjectPath());
- ASSERT_EQ(dbusAddressInsertRef.getInterface(), dbusAddressResult.getInterface());
-}
-
-TEST_F(AddressTranslatorTest, ServicesUsingPredefinedAddressesCanCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- CommonAPI::Address commonApiAddress(commonApiAddresses[0]);
- auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(commonApiAddress.getDomain(), commonApiAddress.getInstance());
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- bool serviceNameAcquired = runtime->registerService(commonApiAddress.getDomain(), commonApiAddress.getInstance(), stub, "connection");
- for(unsigned int i = 0; !serviceNameAcquired && i < 100; i++) {
- serviceNameAcquired = runtime->registerService(commonApiAddress.getDomain(), commonApiAddress.getInstance(), stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceNameAcquired);
-
- for(unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Hai :)";
- CommonAPI::CallStatus stat;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-
- runtime->unregisterService(commonApiAddress.getDomain(), stub->getStubAdapter()->getInterface(), commonApiAddress.getInstance());
-}
-
-#ifndef WIN32
-
-const std::string domainOfFakeLegacyService = "local";
-const std::string interfaceOfFakeLegacyService = "fake.legacy.service.LegacyInterface";
-const std::string instanceOfFakeLegacyService = "fake.legacy.service";
-
-const std::string domainOfFakeLegacyServiceNoObjectManager = "local";
-const std::string interfaceOfFakeLegacyServiceNoObjectManager = "fake.legacy.service.LegacyInterfaceNoObjectManager";
-const std::string instanceOfFakeLegacyServiceNoObjectManager = "fake.legacy.service";
-
-TEST_F(AddressTranslatorTest, CreatedProxyHasCorrectCommonApiAddress) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto proxyForFakeLegacyService = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceProxy>(domainOfFakeLegacyService, instanceOfFakeLegacyService);
- ASSERT_TRUE((bool)proxyForFakeLegacyService);
-
- const CommonAPI::Address & address = proxyForFakeLegacyService->getAddress();
- ASSERT_EQ(domainOfFakeLegacyService, address.getDomain());
- ASSERT_EQ(interfaceOfFakeLegacyService, address.getInterface());
- ASSERT_EQ(instanceOfFakeLegacyService, address.getInstance());
-}
-
-void callPythonService(std::string _pythonFileNameAndCommand) {
- const char *pathToFolderForFakeLegacyService =
- getenv("TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER");
-
- ASSERT_NE(pathToFolderForFakeLegacyService, nullptr) << "Environment variable "
- "TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER "
- "is not set!";
-
- std::stringstream stream;
- stream << "python " << pathToFolderForFakeLegacyService << "/" << _pythonFileNameAndCommand;
-
- int resultCode = system(stream.str().c_str());
- EXPECT_EQ(0, resultCode);
-}
-
-void fakeLegacyServiceThread() {
- callPythonService("fakeLegacyService.py withObjectManager");
-}
-
-void fakeLegacyServiceThreadNoObjectMananger() {
- callPythonService("fakeLegacyService.py noObjectManager");
-}
-
-TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
- std::thread fakeServiceThread = std::thread(fakeLegacyServiceThread);
- usleep(500000);
-
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto proxyForFakeLegacyService = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceProxy>(domainOfFakeLegacyService, instanceOfFakeLegacyService);
- ASSERT_TRUE((bool)proxyForFakeLegacyService);
-
- const CommonAPI::Address & address = proxyForFakeLegacyService->getAddress();
- ASSERT_EQ(domainOfFakeLegacyService, address.getDomain());
- ASSERT_EQ(interfaceOfFakeLegacyService, address.getInterface());
- ASSERT_EQ(instanceOfFakeLegacyService, address.getInstance());
-
- proxyForFakeLegacyService->isAvailableBlocking();
-
- CommonAPI::CallStatus status;
-
- const int32_t input = 42;
- int32_t output1, output2;
- proxyForFakeLegacyService->TestMethod(input, status, output1, output2);
- EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- if(CommonAPI::CallStatus::SUCCESS == status) {
- EXPECT_EQ(input -5, output1);
- EXPECT_EQ(input +5, output2);
- }
-
- std::string greeting;
- int32_t identifier;
- proxyForFakeLegacyService->OtherTestMethod(status, greeting, identifier);
- EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- if(CommonAPI::CallStatus::SUCCESS == status) {
- EXPECT_EQ(std::string("Hello"), greeting);
- EXPECT_EQ(42, identifier);
- }
-
- //end the fake legacy service via dbus
- callPythonService("sendToFakeLegacyService.py finish " + interfaceOfFakeLegacyService);
-
- fakeServiceThread.join();
-}
-
-TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressedNoObjectManager) {
- std::thread fakeServiceThreadNoObjectManager = std::thread(fakeLegacyServiceThreadNoObjectMananger);
- usleep(500000);
-
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto proxyForFakeLegacyServiceNoObjectManager = runtime->buildProxy<VERSION::fake::legacy::service::LegacyInterfaceNoObjectManagerProxy>(domainOfFakeLegacyServiceNoObjectManager, instanceOfFakeLegacyServiceNoObjectManager);
- ASSERT_TRUE((bool)proxyForFakeLegacyServiceNoObjectManager);
-
- const CommonAPI::Address & address = proxyForFakeLegacyServiceNoObjectManager->getAddress();
- ASSERT_EQ(domainOfFakeLegacyServiceNoObjectManager, address.getDomain());
- ASSERT_EQ(interfaceOfFakeLegacyServiceNoObjectManager, address.getInterface());
- ASSERT_EQ(instanceOfFakeLegacyServiceNoObjectManager, address.getInstance());
-
- proxyForFakeLegacyServiceNoObjectManager->isAvailableBlocking();
-
- CommonAPI::CallStatus status;
-
- const int32_t input = 42;
- int32_t output1, output2;
- proxyForFakeLegacyServiceNoObjectManager->TestMethod(input, status, output1, output2);
- EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- if(CommonAPI::CallStatus::SUCCESS == status) {
- EXPECT_EQ(input -5, output1);
- EXPECT_EQ(input +5, output2);
- }
-
- std::string greeting;
- int32_t identifier;
- proxyForFakeLegacyServiceNoObjectManager->OtherTestMethod(status, greeting, identifier);
- EXPECT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- if(CommonAPI::CallStatus::SUCCESS == status) {
- EXPECT_EQ(std::string("Hello"), greeting);
- EXPECT_EQ(42, identifier);
- }
-
- //end the fake legacy service via dbus
- callPythonService("sendToFakeLegacyService.py finish " + interfaceOfFakeLegacyServiceNoObjectManager);
-
- fakeServiceThreadNoObjectManager.join();
-}
-#endif // !WIN32
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusBroadcastTest.cpp b/src/test/DBusBroadcastTest.cpp
deleted file mode 100644
index b34ffd0..0000000
--- a/src/test/DBusBroadcastTest.cpp
+++ /dev/null
@@ -1,653 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceManagerProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-#define VERSION v1_0
-
-class SelectiveBroadcastSender: public VERSION::commonapi::tests::TestInterfaceStubDefault {
-public:
-
- SelectiveBroadcastSender():
- acceptSubs(true),
- sentBroadcasts(0) {
-
- }
-
- virtual ~SelectiveBroadcastSender() {
-
- }
-
- void startSending() {
- sentBroadcasts = 0;
- selectiveBroadcastSender = std::thread(&SelectiveBroadcastSender::send, this);
- selectiveBroadcastSender.detach();
- }
-
- void send() {
- sentBroadcasts++;
- fireTestSelectiveBroadcastSelective();
- }
-
- void onTestSelectiveBroadcastSelectiveSubscriptionChanged(
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- const CommonAPI::SelectiveBroadcastSubscriptionEvent event) {
-
- if (event == CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED)
- lastSubscribedClient = clientId;
- }
-
- bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(
- const std::shared_ptr<CommonAPI::ClientId> clientId) {
- (void)clientId;
- return acceptSubs;
- }
-
- void sendToLastSubscribedClient()
- {
- sentBroadcasts++;
- std::shared_ptr<CommonAPI::ClientIdList> receivers = std::make_shared<CommonAPI::ClientIdList>();
- receivers->insert(lastSubscribedClient);
-
- fireTestSelectiveBroadcastSelective(receivers);
- }
-
-
- int getNumberOfSubscribedClients() {
- return static_cast<int>(getSubscribersForTestSelectiveBroadcastSelective()->size());
-
- }
-
- bool acceptSubs;
-
-private:
- std::thread selectiveBroadcastSender;
- int sentBroadcasts;
-
- std::shared_ptr<CommonAPI::ClientId> lastSubscribedClient;
-};
-
-class DBusBroadcastTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime_);
-
- serviceAddressObject_ = CommonAPI::Address(serviceAddress_);
-
- selectiveBroadcastArrivedAtProxyFromSameConnection1 = 0;
- selectiveBroadcastArrivedAtProxyFromSameConnection2 = 0;
- selectiveBroadcastArrivedAtProxyFromOtherConnection = 0;
- }
-
- virtual void TearDown() {
- runtime_->unregisterService(serviceAddressObject_.getDomain(), serviceAddressInterface_, serviceAddressObject_.getInstance());
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- static const std::string serviceAddress_;
- static const std::string managerServiceAddress_;
- CommonAPI::Address serviceAddressObject_;
- std::string serviceAddressInterface_;
- static const CommonAPI::ConnectionId_t connectionIdService_;
- static const CommonAPI::ConnectionId_t connectionIdClient1_;
- static const CommonAPI::ConnectionId_t connectionIdClient2_;
- static const CommonAPI::ConnectionId_t connectionIdClient3;
-
- int selectiveBroadcastArrivedAtProxyFromSameConnection1;
- int selectiveBroadcastArrivedAtProxyFromSameConnection2;
- int selectiveBroadcastArrivedAtProxyFromOtherConnection;
-
-public:
- void selectiveBroadcastCallbackForProxyFromSameConnection1() {
- selectiveBroadcastArrivedAtProxyFromSameConnection1++;
- }
-
- void selectiveBroadcastCallbackForProxyFromSameConnection2() {
- selectiveBroadcastArrivedAtProxyFromSameConnection2++;
- }
-
- void selectiveBroadcastCallbackForProxyFromOtherConnection() {
- selectiveBroadcastArrivedAtProxyFromOtherConnection++;
- }
-};
-
-const std::string DBusBroadcastTest::serviceAddress_ = "local:CommonAPI.DBus.tests.TestInterface:CommonAPI.DBus.tests.TestInterfaceManager.TestService";
-const std::string DBusBroadcastTest::managerServiceAddress_ = "local:CommonAPI.DBus.tests.TestInterfaceManager:CommonAPI.DBus.tests.TestInterfaceManager";
-const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionIdService_ = "service";
-const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionIdClient1_ = "client1";
-const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionIdClient2_ = "client2";
-const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionIdClient3 = "client3";
-
-TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
-
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- bool callbackArrived = false;
-
- broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)intParam;
- (void)stringParam;
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
-
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- bool callbackArrived = false;
-
- auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, 1);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent.unsubscribe(broadcastSubscription);
-
- callbackArrived = false;
-
- auto broadcastSubscription2 = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, 2);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent.unsubscribe(broadcastSubscription2);
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInALoop) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- for(unsigned int i=0; i<10; i++) {
- bool callbackArrived = false;
-
- auto broadcastSubscription = broadcastEvent.subscribe([&,i](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, i);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(i, "xyz");
-
- for(unsigned int j=0; j<100 && !callbackArrived; j++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent.unsubscribe(broadcastSubscription);
- }
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWithOtherProxy) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- bool callbackArrived = false;
-
- auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, 1);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent.unsubscribe(broadcastSubscription);
-
- auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- callbackArrived = false;
-
- auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, 2);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent.unsubscribe(broadcastSubscription2);
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhileOtherProxyIsStillSubscribed) {
- // register service
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- // build 2 proxies
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxy->getTestPredefinedTypeBroadcastEvent();
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent2 =
- proxy2->getTestPredefinedTypeBroadcastEvent();
-
- bool callback1Arrived = false;
- bool callback2Arrived = false;
-
- // subscribe for each proxy's broadcast event
- auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)intParam;
- (void)stringParam;
- callback1Arrived = true;
- });
-
- auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)intParam;
- (void)stringParam;
- callback2Arrived = true;
- });
-
- // fire broadcast and wait for results
- stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
-
- for(unsigned int i=0; i<100 && !(callback1Arrived && callback2Arrived); i++) {
- usleep(10000);
- }
-
- const bool callbackOnBothSubscriptionsArrived = callback1Arrived && callback2Arrived;
-
- EXPECT_TRUE(callbackOnBothSubscriptionsArrived);
-
- // unsubscribe from one proxy's broadcast
- broadcastEvent.unsubscribe(broadcastSubscription);
-
- // fire broadcast again
- callback1Arrived = false;
- callback2Arrived = false;
-
- stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
-
- for(unsigned int i=0; i<100; i++) {
- usleep(10000);
- }
-
- const bool onlyCallback2Arrived = !callback1Arrived && callback2Arrived;
-
- EXPECT_TRUE(onlyCallback2Arrived);
-
- // subscribe first proxy again
- broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)intParam;
- (void)stringParam;
- callback1Arrived = true;
- });
-
- // fire broadcast another time
- callback1Arrived = false;
- callback2Arrived = false;
-
- stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
-
- for(unsigned int i=0; i<100 && !(callback1Arrived && callback2Arrived); i++) {
- usleep(10000);
- }
-
- const bool callbackOnBothSubscriptionsArrivedAgain = callback1Arrived && callback2Arrived;
-
- EXPECT_TRUE(callbackOnBothSubscriptionsArrivedAgain);
-
- broadcastEvent.unsubscribe(broadcastSubscription);
- broadcastEvent2.unsubscribe(broadcastSubscription2);
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanSubscribeForSelectiveBroadcast)
-{
- auto proxyFromSameConnection = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), connectionIdClient1_);
- ASSERT_TRUE((bool)proxyFromSameConnection);
- auto proxyFromSameConnection2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), connectionIdClient1_);
- ASSERT_TRUE((bool)proxyFromSameConnection2);
- auto proxyFromOtherConnection = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), connectionIdClient2_);
- ASSERT_TRUE((bool)proxyFromOtherConnection);
-
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for (unsigned int i = 0; !proxyFromSameConnection->isAvailable() && i < 200; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxyFromSameConnection->isAvailable());
-
- auto subscriptionResult1 = proxyFromSameConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameConnection1, this));
-
- usleep(20000);
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
-
- stub->send();
-
- usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 0);
-
-
- auto subscriptionResult2 = proxyFromSameConnection2->getTestSelectiveBroadcastSelectiveEvent().subscribe(std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameConnection2, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1); // should still be one because they using the same connection
-
- stub->send();
- usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 2);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 1);
-
- proxyFromOtherConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherConnection, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 2); // should still be two because proxyFromSameConnection1_ is still subscribed
-
- proxyFromSameConnection2->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult2);
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 2); // should still be two because proxyFromSameConnection1_ is still subscribed
-
- stub->send();
- usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 3);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherConnection, 1);
-
- // now only the last subscribed client (which is the one from the other connection) should receive the signal
- stub->sendToLastSubscribedClient();
- usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 3);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherConnection, 2);
-
- proxyFromSameConnection->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult1);
- EXPECT_EQ(stub->getNumberOfSubscribedClients(), 1);
-}
-
-TEST_F(DBusBroadcastTest, ProxysCanBeRejectedForSelectiveBroadcast) {
- auto proxyFromSameConnection1 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), connectionIdClient1_);
- ASSERT_TRUE((bool)proxyFromSameConnection1);
- auto proxyFromOtherConnection = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), connectionIdClient2_);
- ASSERT_TRUE((bool)proxyFromOtherConnection);
-
-
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for (unsigned int i = 0; !proxyFromSameConnection1->isAvailable() && i < 200; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxyFromSameConnection1->isAvailable());
-
- //bool subbed = false;
-
- proxyFromSameConnection1->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameConnection1, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
- //ASSERT_TRUE(subbed);
-
- stub->acceptSubs = false;
-
- proxyFromOtherConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherConnection, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
- //ASSERT_FALSE(subbed);
-
- stub->send();
-
- usleep(20000);
- ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 1);
- ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromOtherConnection, 0);
-}
-
-TEST_F(DBusBroadcastTest, ProxyCanBeDeletedAndBuildFromNewInManagedContext) {
- int intParamValue = 0;
- bool callbackArrived = false;
- bool proxyDeleted = false;
-
- CommonAPI::Address managerServiceAddressObject = CommonAPI::Address(managerServiceAddress_);
-
- //build proxy of test interface manager
- auto managerProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceManagerProxy>(managerServiceAddressObject.getDomain(), managerServiceAddressObject.getInstance(), connectionIdClient1_);
- ASSERT_TRUE((bool)managerProxy);
-
- //build stub of test interface manager
- auto managerStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceManagerStubDefault>();
- const std::string managerServiceInterface = managerStub->getStubAdapter()->getInterface();
-
- //register test interface manager
- bool managerServiceRegistered = runtime_->registerService(managerServiceAddressObject.getDomain(), managerServiceAddressObject.getInstance(), managerStub, connectionIdService_);
- for (unsigned int i = 0; !managerServiceRegistered && i < 100; ++i) {
- managerServiceRegistered = runtime_->registerService(managerServiceAddressObject.getDomain(), managerServiceAddressObject.getInstance(), managerStub, connectionIdService_);
- usleep(10000);
- }
- ASSERT_TRUE(managerServiceRegistered);
-
- for (unsigned int i = 0; !managerProxy->isAvailable() && i < 200; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(managerProxy->isAvailable());
-
- //stub and proxy of test interface
- auto stubTestInterface = std::make_shared<SelectiveBroadcastSender>();
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxyTestInterface;
-
- //subscribe for instance availability changed event
- CommonAPI::ProxyManager& testInterfaceProxyManager = managerProxy->getProxyManagerTestInterface();
- testInterfaceProxyManager.getInstanceAvailabilityStatusChangedEvent().subscribe
- ([&](const std::string instanceName, CommonAPI::AvailabilityStatus availabilityStatus) {
- (void)instanceName;
-
- if(availabilityStatus == CommonAPI::AvailabilityStatus::AVAILABLE) {
- //Create proxy for managed test interface
- proxyTestInterface = testInterfaceProxyManager.buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getInstance(), connectionIdClient3);
- ASSERT_TRUE((bool)proxyTestInterface);
-
- for (unsigned int i = 0; !proxyTestInterface->isAvailable() && i < 200; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxyTestInterface->isAvailable());
-
- VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
- proxyTestInterface->getTestPredefinedTypeBroadcastEvent();
-
- //subscribe for broadcast event
- broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- (void)stringParam;
- EXPECT_EQ(intParam, intParamValue);
- callbackArrived = true;
- });
-
- stubTestInterface->fireTestPredefinedTypeBroadcastEvent(intParamValue, "xyz");
-
- } else if(availabilityStatus == CommonAPI::AvailabilityStatus::NOT_AVAILABLE) {
- //delete proxy
- proxyTestInterface = nullptr;
- proxyDeleted = true;
- }
- });
-
- //register managed test interface
- intParamValue++;
- bool managedServiceRegistered = managerStub->registerManagedStubTestInterface(stubTestInterface, serviceAddressObject_.getInstance());
- ASSERT_TRUE(managedServiceRegistered);
-
- for(unsigned int i=0; i<200 && !callbackArrived; i++) {
- usleep(10000);
- }
- ASSERT_TRUE(callbackArrived);
-
- //deregister managed test interface
- managerStub->deregisterManagedStubTestInterface(serviceAddressObject_.getInstance());
-
- for(unsigned int i=0; i<200 && !proxyDeleted; i++) {
- usleep(10000);
- }
- ASSERT_TRUE(proxyDeleted);
-
- //register managed test interface again
- intParamValue++;
- callbackArrived = false;
-
- managedServiceRegistered = managerStub->registerManagedStubTestInterface(stubTestInterface, serviceAddressObject_.getInstance());
- ASSERT_TRUE(managedServiceRegistered);
-
- for(unsigned int i=0; i<200 && !callbackArrived; i++) {
- usleep(10000);
- }
- ASSERT_TRUE(callbackArrived);
-
- managerStub->deregisterManagedStubTestInterface(serviceAddressObject_.getInstance());
- runtime_->unregisterService(managerServiceAddressObject.getDomain(), managerServiceInterface, managerServiceAddressObject.getInstance());
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusCommunicationTest.cpp b/src/test/DBusCommunicationTest.cpp
deleted file mode 100644
index 2cbe440..0000000
--- a/src/test/DBusCommunicationTest.cpp
+++ /dev/null
@@ -1,566 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-
-#include <dbus/dbus.h>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-#define VERSION v1_0
-
-class DBusCommunicationTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime_);
- }
-
- virtual void TearDown() {
- runtime_->unregisterService(domain_, interface_, serviceAddress_);
- runtime_->unregisterService(domain_, interface_, serviceAddress2_);
- runtime_->unregisterService(domain_, interface_, serviceAddress3_);
- runtime_->unregisterService(domain_, interface_, serviceAddress4_);
- runtime_->unregisterService(domain_, interface_, serviceAddress5_);
- usleep(30000);
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- std::string interface_;
-
- static const std::string domain_;
- static const std::string serviceAddress_;
- static const std::string serviceAddress2_;
- static const std::string serviceAddress3_;
- static const std::string serviceAddress4_;
- static const std::string nonstandardAddress_;
- static const std::string serviceAddress5_;
-};
-
-const std::string DBusCommunicationTest::domain_ = "local";
-const std::string DBusCommunicationTest::serviceAddress_ = "CommonAPI.DBus.tests.DBusProxyTestService";
-const std::string DBusCommunicationTest::serviceAddress2_ = "CommonAPI.DBus.tests.DBusProxyTestService2";
-const std::string DBusCommunicationTest::serviceAddress3_ = "CommonAPI.DBus.tests.DBusProxyTestService3";
-const std::string DBusCommunicationTest::serviceAddress4_ = "CommonAPI.DBus.tests.DBusProxyTestService4";
-const std::string DBusCommunicationTest::nonstandardAddress_ = "non.standard.participand.ID";
-const std::string DBusCommunicationTest::serviceAddress5_ = "CommonAPI.DBus.tests.DBusProxyTestService5";
-
-
-TEST_F(DBusCommunicationTest, RemoteMethodCallSucceeds) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for(unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Ciao ;)";
- CommonAPI::CallStatus stat;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
-
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-}
-
-TEST_F(DBusCommunicationTest, AccessStubAdapterAfterInitialised) {
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
-
- unsigned int in = 5;
- stub->setTestPredefinedTypeAttributeAttribute(in);
-
- for (unsigned int i = 0; !serviceRegistered && i < 100; i++) {
- if (!serviceRegistered) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- }
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
- ASSERT_EQ(in, stub->getTestPredefinedTypeAttributeAttribute());
-}
-
-TEST_F(DBusCommunicationTest, AccessStubAdapterBeforeInitialised) {
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- unsigned int in = 5;
- stub->setTestPredefinedTypeAttributeAttribute(in);
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
-
- for (unsigned int i = 0; !serviceRegistered && i < 100; i++) {
- if (!serviceRegistered) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- }
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-}
-
-TEST_F(DBusCommunicationTest, SameStubCanBeRegisteredSeveralTimes) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress_);
- auto defaultTestProxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress2_);
- auto defaultTestProxy3 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress3_);
- ASSERT_TRUE((bool)defaultTestProxy);
- ASSERT_TRUE((bool)defaultTestProxy2);
- ASSERT_TRUE((bool)defaultTestProxy3);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- bool serviceRegistered2 = runtime_->registerService(domain_, serviceAddress2_, stub, "connection");
- bool serviceRegistered3 = runtime_->registerService(domain_, serviceAddress3_, stub, "connection");
- for (unsigned int i = 0; (!serviceRegistered || !serviceRegistered2 || !serviceRegistered3) && i < 100; ++i) {
- if (!serviceRegistered) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- }
- if (!serviceRegistered2) {
- serviceRegistered2 = runtime_->registerService(domain_, serviceAddress2_, stub, "connection");
- }
- if (!serviceRegistered3) {
- serviceRegistered3 = runtime_->registerService(domain_, serviceAddress3_, stub, "connection");
- }
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
- ASSERT_TRUE(serviceRegistered2);
- ASSERT_TRUE(serviceRegistered3);
-
- for(unsigned int i = 0; (!defaultTestProxy->isAvailable() || !defaultTestProxy2->isAvailable() || !defaultTestProxy3->isAvailable()) && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
- ASSERT_TRUE(defaultTestProxy2->isAvailable());
- ASSERT_TRUE(defaultTestProxy3->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Ciao ;)";
- CommonAPI::CallStatus stat, stat2, stat3;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- defaultTestProxy2->testVoidPredefinedTypeMethod(v1, v2, stat2);
- defaultTestProxy3->testVoidPredefinedTypeMethod(v1, v2, stat3);
-
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(stat2, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(stat3, CommonAPI::CallStatus::SUCCESS);
-}
-
-
-TEST_F(DBusCommunicationTest, RemoteMethodCallWithNonstandardAddressSucceeds) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, nonstandardAddress_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
- for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for(unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Hai :)";
- CommonAPI::CallStatus stat;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
-
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-}
-
-
-TEST_F(DBusCommunicationTest, MixedSyncAndAsyncCallsSucceed) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress5_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
- for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for (unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Hai :)";
- CommonAPI::CallStatus stat;
- unsigned int responseCounter = 0;
- for (unsigned int i = 0; i < 10; i++) {
- defaultTestProxy->testVoidPredefinedTypeMethodAsync(v1, v2, [&responseCounter](const CommonAPI::CallStatus& status) {
- if(status == CommonAPI::CallStatus::SUCCESS) {
- responseCounter++;
- }
- }
- );
-
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- }
-
- for (unsigned int i = 0; i < 500 && responseCounter < 10; i++) {
- usleep(1000);
- }
- EXPECT_EQ(10, responseCounter);
-}
-
-
-TEST_F(DBusCommunicationTest, RemoteMethodCallHeavyLoad) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress4_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- for (unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- uint32_t v1 = 5;
- std::string v2 = "Ciao ;)";
- CommonAPI::CallStatus stat;
-
- for (uint32_t i = 0; i < 1000; i++) {
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- }
-}
-
-TEST_F(DBusCommunicationTest, ProxyCanFetchVersionAttributeFromStub) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress4_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
-
- ASSERT_TRUE(serviceRegistered);
-
- for (unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(defaultTestProxy->isAvailable());
-
- CommonAPI::InterfaceVersionAttribute& versionAttribute = defaultTestProxy->getInterfaceVersionAttribute();
-
- CommonAPI::Version version;
- CommonAPI::CallStatus status;
- versionAttribute.getValue(status, version);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- ASSERT_TRUE(version.Major > 0 || version.Minor > 0);
-}
-
-
-//XXX This test case requires CommonAPI::DBus::DBusConnection::suspendDispatching and ...::resumeDispatching to be public!
-
-//static const std::string commonApiAddress = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
-//static const std::string interfaceName = "CommonAPI.DBus.tests.DBusProxyTestInterface";
-//static const std::string busName = "CommonAPI.DBus.tests.DBusProxyTestService";
-//static const std::string objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService";
-
-//TEST_F(DBusCommunicationTest, AsyncCallsAreQueuedCorrectly) {
-// auto proxyDBusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
-// ASSERT_TRUE(proxyDBusConnection->connect());
-//
-// auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-//
-// bool serviceRegistered = stubFactory_->registerService(stub, serviceAddress_);
-// for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
-// serviceRegistered = stubFactory_->registerService(stub, serviceAddress_);
-// usleep(10000);
-// }
-// ASSERT_TRUE(serviceRegistered);
-//
-// auto defaultTestProxy = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
-// commonApiAddress,
-// interfaceName,
-// busName,
-// objectPath,
-// proxyDBusConnection);
-//
-// for(unsigned int i = 0; !defaultTestProxy->isAvailable() && i < 100; ++i) {
-// usleep(10000);
-// }
-// ASSERT_TRUE(defaultTestProxy->isAvailable());
-//
-// auto val1 = ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_OK;
-// ::commonapi::tests::DerivedTypeCollection::TestMap val2;
-// CommonAPI::CallStatus status;
-// unsigned int numCalled = 0;
-// const unsigned int maxNumCalled = 1000;
-// for(unsigned int i = 0; i < maxNumCalled/2; ++i) {
-// defaultTestProxy->testVoidDerivedTypeMethodAsync(val1, val2,
-// [&] (CommonAPI::CallStatus stat) {
-// if(stat == CommonAPI::CallStatus::SUCCESS) {
-// numCalled++;
-// }
-// }
-// );
-// }
-//
-// proxyDBusConnection->suspendDispatching();
-//
-// for(unsigned int i = maxNumCalled/2; i < maxNumCalled; ++i) {
-// defaultTestProxy->testVoidDerivedTypeMethodAsync(val1, val2,
-// [&] (CommonAPI::CallStatus stat) {
-// if(stat == CommonAPI::CallStatus::SUCCESS) {
-// numCalled++;
-// }
-// }
-// );
-// }
-// sleep(2);
-//
-// proxyDBusConnection->resumeDispatching();
-//
-// sleep(2);
-//
-// ASSERT_EQ(maxNumCalled, numCalled);
-//
-// numCalled = 0;
-//
-// defaultTestProxy->getTestPredefinedTypeBroadcastEvent().subscribe(
-// [&] (uint32_t, std::string) {
-// numCalled++;
-// }
-// );
-//
-// proxyDBusConnection->suspendDispatching();
-//
-// for(unsigned int i = 0; i < maxNumCalled; ++i) {
-// stub->fireTestPredefinedTypeBroadcastEvent(0, "Nonething");
-// }
-//
-// sleep(2);
-// proxyDBusConnection->resumeDispatching();
-// sleep(2);
-//
-// ASSERT_EQ(maxNumCalled, numCalled);
-//}
-
-
-
-class DBusLowLevelCommunicationTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime_);
- }
-
- virtual void TearDown() {
- usleep(30000);
- }
-
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createDBusStubAdapter(std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection,
- const std::string& commonApiAddress) {
- CommonAPI::DBus::DBusAddress dbusAddress;
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(commonApiAddress, dbusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> dbusStubAdapter;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- dbusStubAdapter = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusStubAdapter>(dbusAddress, dbusConnection, stub);
- dbusStubAdapter->init(dbusStubAdapter);
-
- std::shared_ptr<CommonAPI::DBus::DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub();
-
- rootDBusObjectManagerStub->exportManagedDBusStubAdapter(dbusStubAdapter);
-
- const auto dbusObjectManager = dbusConnection->getDBusObjectManager();
- dbusObjectManager->registerDBusStubAdapter(dbusStubAdapter);
-
- return dbusStubAdapter;
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::Factory> proxyFactory_;
-
- static const std::string domain_;
- static const std::string lowLevelAddress_;
- static const std::string lowLevelAddressInstance_;
- static const std::string lowLevelConnectionName_;
-};
-
-const std::string DBusLowLevelCommunicationTest::domain_ = "local";
-const std::string DBusLowLevelCommunicationTest::lowLevelAddress_ = "local:commonapi.tests.TestInterface:CommonAPI.DBus.tests.DBusProxyLowLevelService";
-const std::string DBusLowLevelCommunicationTest::lowLevelAddressInstance_ = "CommonAPI.DBus.tests.DBusProxyLowLevelService";
-const std::string DBusLowLevelCommunicationTest::lowLevelConnectionName_ = "commonapi.tests.TestInterface_CommonAPI.DBus.tests.DBusProxyLowLevelService";
-
-namespace DBusCommunicationTestNamespace {
-::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
- ::DBusMessage* libdbusMessage,
- void* userData) {
- (void)libdbusConnection;
- (void)libdbusMessage;
- (void)userData;
- return ::DBusHandlerResult::DBUS_HANDLER_RESULT_HANDLED;
-}
-
-DBusObjectPathVTable libdbusObjectPathVTable = {
- NULL,
- &onLibdbusObjectPathMessageThunk,
- NULL, NULL, NULL, NULL
-};
-}
-
-TEST_F(DBusLowLevelCommunicationTest, AgressiveNameClaimingOfServicesIsHandledCorrectly) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, lowLevelAddressInstance_);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- uint32_t counter = 0;
- CommonAPI::AvailabilityStatus status;
-
- CommonAPI::ProxyStatusEvent& proxyStatusEvent = defaultTestProxy->getProxyStatusEvent();
- proxyStatusEvent.subscribe([&counter, &status](const CommonAPI::AvailabilityStatus& stat) {
- ++counter;
- status = stat;
- });
-
- usleep(1000000);
-
- EXPECT_EQ(1, counter);
- EXPECT_EQ(CommonAPI::AvailabilityStatus::NOT_AVAILABLE, status);
-
- //Set up low level connections
- ::DBusConnection* libdbusConnection1 = dbus_bus_get_private(DBUS_BUS_SESSION, NULL);
- ::DBusConnection* libdbusConnection2 = dbus_bus_get_private(DBUS_BUS_SESSION, NULL);
-
- ASSERT_TRUE(libdbusConnection1);
- ASSERT_TRUE(libdbusConnection2);
-
- dbus_connection_set_exit_on_disconnect(libdbusConnection1, false);
- dbus_connection_set_exit_on_disconnect(libdbusConnection2, false);
-
- bool endDispatch = false;
- std::promise<bool> ended;
- std::future<bool> hasEnded = ended.get_future();
-
- std::thread([&]() {
- dbus_bool_t libdbusSuccess = true;
- while (!endDispatch && libdbusSuccess) {
- libdbusSuccess = dbus_connection_read_write_dispatch(libdbusConnection1, 10);
- libdbusSuccess &= dbus_connection_read_write_dispatch(libdbusConnection2, 10);
- }
- ended.set_value(true);
- }).detach();
-
- //Test first connect
- std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection1 = std::make_shared<CommonAPI::DBus::DBusConnection>(libdbusConnection1, "connection1");
- ASSERT_TRUE(dbusConnection1->isConnected());
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> adapter1 = createDBusStubAdapter(dbusConnection1, lowLevelAddress_);
-
- int libdbusStatus = dbus_bus_request_name(libdbusConnection1,
- lowLevelConnectionName_.c_str(),
- DBUS_NAME_FLAG_ALLOW_REPLACEMENT | DBUS_NAME_FLAG_REPLACE_EXISTING,
- NULL);
-
- dbus_connection_try_register_object_path(libdbusConnection1,
- "/",
- &DBusCommunicationTestNamespace::libdbusObjectPathVTable,
- NULL,
- NULL);
-
- usleep(1000000);
-
- EXPECT_EQ(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER, libdbusStatus);
- EXPECT_EQ(2, counter);
- EXPECT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, status);
-
- //Test second connect
- std::shared_ptr<CommonAPI::DBus::DBusConnection> dbusConnection2 = std::make_shared<CommonAPI::DBus::DBusConnection>(libdbusConnection2, "connection2");
- ASSERT_TRUE(dbusConnection2->isConnected());
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> adapter2 = createDBusStubAdapter(dbusConnection2, lowLevelAddress_);
-
- libdbusStatus = dbus_bus_request_name(libdbusConnection2,
- lowLevelConnectionName_.c_str(),
- DBUS_NAME_FLAG_ALLOW_REPLACEMENT | DBUS_NAME_FLAG_REPLACE_EXISTING,
- NULL);
-
- dbus_connection_try_register_object_path(libdbusConnection2,
- "/",
- &DBusCommunicationTestNamespace::libdbusObjectPathVTable,
- NULL,
- NULL);
-
- usleep(1000000);
-
- EXPECT_EQ(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER, libdbusStatus);
-
- //4 Because a short phase of non-availability will be inbetween
- EXPECT_EQ(4, counter);
- EXPECT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, status);
-
- //Close connections
- endDispatch = true;
- ASSERT_TRUE(hasEnded.get());
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusConnectionTest.cpp b/src/test/DBusConnectionTest.cpp
index 8651535..c943e5f 100644
--- a/src/test/DBusConnectionTest.cpp
+++ b/src/test/DBusConnectionTest.cpp
@@ -29,7 +29,6 @@ class LibdbusTest: public ::testing::Test {
class DBusConnectionTest: public ::testing::Test {
protected:
virtual void SetUp() {
-
dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "connection1");
}
@@ -127,14 +126,18 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
CommonAPI::DBus::DBusOutputStream dbusOutputStream(dbusMessageCall);
+ auto func = [&clientReplyHandlerDBusMessageCount](CommonAPI::CallStatus status) {
+ ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
+ ++clientReplyHandlerDBusMessageCount;
+ };
+
+ CommonAPI::DBus::DBusProxyAsyncCallbackHandler<CommonAPI::DBus::DBusConnection>::Delegate
+ delegate(dbusConnection_->shared_from_this(), func);
+
dbusConnection_->sendDBusMessageWithReplyAsync(
dbusMessageCall,
- CommonAPI::DBus::DBusProxyAsyncCallbackHandler<>::create(
- [&clientReplyHandlerDBusMessageCount](CommonAPI::CallStatus status) {
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
- ++clientReplyHandlerDBusMessageCount;
- }, std::tuple<>()),
- &CommonAPI::DBus::defaultCallInfo);
+ CommonAPI::DBus::DBusProxyAsyncCallbackHandler<CommonAPI::DBus::DBusConnection>::create(delegate, std::tuple<>()),
+ &CommonAPI::DBus::defaultCallInfo);
for (int i = 0; i < 100; i++) {
usleep(10);
@@ -218,25 +221,33 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
interfaceHandlerDBusConnection->disconnect();
}*/
+std::mutex dispatchMutex;
+std::condition_variable dispatchCondition;
+bool dispatchReady = false;
void dispatch(::DBusConnection* libdbusConnection) {
dbus_bool_t success = TRUE;
+ std::unique_lock<std::mutex> lock(dispatchMutex);
+ dispatchReady = true;
+ dispatchCondition.wait(lock);
while (success) {
success = dbus_connection_read_write_dispatch(libdbusConnection, 1);
}
}
-std::promise<bool> promise;
-std::future<bool> future = promise.get_future();
+bool suicide = false;
void notifyThunk(DBusPendingCall*, void* data) {
::DBusConnection* libdbusConnection = reinterpret_cast<DBusConnection*>(data);
dbus_connection_close(libdbusConnection);
dbus_connection_unref(libdbusConnection);
- promise.set_value(true);
+ suicide = true;
}
TEST_F(DBusConnectionTest, LibdbusConnectionsMayCommitSuicide) {
+ dispatchReady = false;
+ suicide = false;
+
const ::DBusBusType libdbusType = ::DBusBusType::DBUS_BUS_SESSION;
::DBusError libdbusError;
dbus_error_init(&libdbusError);
@@ -247,6 +258,15 @@ TEST_F(DBusConnectionTest, LibdbusConnectionsMayCommitSuicide) {
auto dispatchThread = std::thread(&dispatch, libdbusConnection);
+ {
+ std::unique_lock<std::mutex> dispatchLock(dispatchMutex);
+ while(!dispatchReady) {
+ dispatchLock.unlock();
+ usleep(100000 * 5);
+ dispatchLock.lock();
+ }
+ }
+
::DBusMessage* libdbusMessageCall = dbus_message_new_method_call(
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
@@ -269,8 +289,10 @@ TEST_F(DBusConnectionTest, LibdbusConnectionsMayCommitSuicide) {
libdbusConnection,
NULL);
- ASSERT_EQ(true, future.get());
+ dispatchCondition.notify_one();
+
dispatchThread.join();
+ ASSERT_TRUE(suicide);
}
#ifndef __NO_MAIN__
diff --git a/src/test/DBusDaemonProxyTest.cpp b/src/test/DBusDaemonProxyTest.cpp
index f05a022..cc17126 100644
--- a/src/test/DBusDaemonProxyTest.cpp
+++ b/src/test/DBusDaemonProxyTest.cpp
@@ -10,6 +10,7 @@
#include <CommonAPI/DBus/DBusConnection.hpp>
#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
#include <CommonAPI/DBus/DBusUtils.hpp>
+#include <CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp>
#include <gtest/gtest.h>
@@ -51,10 +52,14 @@ TEST_F(DBusDaemonProxyTest, ListNamesAsync) {
std::promise<std::tuple<CommonAPI::CallStatus, std::vector<std::string>>>promise;
auto future = promise.get_future();
- auto callStatusFuture = dbusDaemonProxy_->listNamesAsync(
- [&](const CommonAPI::CallStatus& callStatus, std::vector<std::string> busNames) {
- promise.set_value(std::tuple<CommonAPI::CallStatus, std::vector<std::string>>(callStatus, std::move(busNames)));
- });
+ auto func = [&](const CommonAPI::CallStatus& callStatus, std::vector<std::string> busNames) {
+ promise.set_value(std::tuple<CommonAPI::CallStatus, std::vector<std::string>>(callStatus, std::move(busNames)));
+ };
+
+ CommonAPI::DBus::DBusProxyAsyncCallbackHandler<CommonAPI::DBus::DBusDaemonProxy, std::vector<std::string>>::Delegate
+ delegate(dbusDaemonProxy_->shared_from_this(), func);
+
+ auto callStatusFuture = dbusDaemonProxy_->listNamesAsync<CommonAPI::DBus::DBusDaemonProxy>(delegate);
auto status = future.wait_for(std::chrono::milliseconds(500));
bool waitResult = CommonAPI::DBus::checkReady(status);
@@ -92,11 +97,16 @@ TEST_F(DBusDaemonProxyTest, NameHasOwnerAsync) {
std::promise<std::tuple<CommonAPI::CallStatus, bool>> promise;
auto future = promise.get_future();
- auto callStatusFuture = dbusDaemonProxy_->nameHasOwnerAsync(
+ auto func = [&](const CommonAPI::CallStatus& callStatus, bool nameHasOwner) {
+ promise.set_value(std::tuple<CommonAPI::CallStatus, bool>(callStatus, std::move(nameHasOwner)));
+ };
+
+ CommonAPI::DBus::DBusProxyAsyncCallbackHandler<CommonAPI::DBus::DBusDaemonProxy, bool>::Delegate
+ delegate(dbusDaemonProxy_->shared_from_this(), func);
+
+ auto callStatusFuture = dbusDaemonProxy_->nameHasOwnerAsync<CommonAPI::DBus::DBusDaemonProxy>(
"org.freedesktop.DBus",
- [&](const CommonAPI::CallStatus& callStatus, bool nameHasOwner) {
- promise.set_value(std::tuple<CommonAPI::CallStatus, bool>(callStatus, std::move(nameHasOwner)));
- });
+ delegate);
auto status = future.wait_for(std::chrono::milliseconds(100));
const bool waitResult = CommonAPI::DBus::checkReady(status);
diff --git a/src/test/DBusFactoryTest.cpp b/src/test/DBusFactoryTest.cpp
deleted file mode 100644
index cd6a718..0000000
--- a/src/test/DBusFactoryTest.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <fstream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#define COMMONAPI_INTERNAL_COMPILATION
-
-#include <CommonAPI/Utils.hpp>
-
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusUtils.hpp>
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-#define VERSION v1_0
-
-static const char DBUS_CONFIG_SUFFIX[] = "_dbus.conf";
-
-static const std::string fileString =
-""
-"[factory$session]\n"
-"dbus_bustype=session\n"
-"[factory$system]\n"
-"dbus_bustype=system\n"
-"";
-
-class DBusProxyFactoryTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime_);
-
-#ifdef WIN32
- configFileName_ = _pgmptr;
-#else
- char cCurrentPath[FILENAME_MAX];
- if(getcwd(cCurrentPath, sizeof(cCurrentPath)) == NULL) {
- std::perror("DBusProxyFactoryTest::SetUp");
- }
- configFileName_ = cCurrentPath;
-#endif
-
- configFileName_ += DBUS_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << fileString;
- configFile.close();
- }
-
- virtual void TearDown() {
- usleep(30000);
- std::remove(configFileName_.c_str());
- }
-
- std::string configFileName_;
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-};
-
-
-
-namespace myExtensions {
-
-template<typename _AttributeType>
-class AttributeTestExtension: public CommonAPI::AttributeExtension<_AttributeType> {
- typedef CommonAPI::AttributeExtension<_AttributeType> __baseClass_t;
-
-public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- AttributeTestExtension(_AttributeType& baseAttribute) :
- CommonAPI::AttributeExtension<_AttributeType>(baseAttribute) {}
-
- ~AttributeTestExtension() {}
-
- bool testExtensionMethod() const {
- return true;
- }
-};
-
-} // namespace myExtensions
-
-//####################################################################################################################
-
-TEST_F(DBusProxyFactoryTest, DBusFactoryCanBeCreated) {
-}
-
-TEST_F(DBusProxyFactoryTest, CreatesDefaultTestProxy) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>("local", "commonapi.tests.TestInterface");
- ASSERT_TRUE((bool)defaultTestProxy);
-}
-
-TEST_F(DBusProxyFactoryTest, CreatesDefaultExtendedTestProxy) {
- auto defaultTestProxy = runtime_->buildProxyWithDefaultAttributeExtension<VERSION::commonapi::tests::TestInterfaceProxy, myExtensions::AttributeTestExtension>("local", "commonapi.tests.TestInterface");
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto attributeExtension = defaultTestProxy->getTestDerivedArrayAttributeAttributeExtension();
- ASSERT_TRUE(attributeExtension.testExtensionMethod());
-}
-
-TEST_F(DBusProxyFactoryTest, CreatesIndividuallyExtendedTestProxy) {
- auto specificAttributeExtendedTestProxy = runtime_->buildProxy<
- VERSION::commonapi::tests::TestInterfaceProxy,
- VERSION::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<myExtensions::AttributeTestExtension> >
- ("local", "commonapi.tests.TestInterface");
-
- ASSERT_TRUE((bool)specificAttributeExtendedTestProxy);
-
- auto attributeExtension = specificAttributeExtendedTestProxy->getTestDerivedArrayAttributeAttributeExtension();
- ASSERT_TRUE(attributeExtension.testExtensionMethod());
-}
-
-TEST_F(DBusProxyFactoryTest, CreateNamedFactory) {
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusFreedesktopPropertiesTest.cpp b/src/test/DBusFreedesktopPropertiesTest.cpp
deleted file mode 100644
index be6706e..0000000
--- a/src/test/DBusFreedesktopPropertiesTest.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp>
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp>
-
-#define VERSION v1_0
-
-static const std::string domain = "local";
-static const std::string commonApiAddress = "commonapi.tests.TestFreedesktopInterface";
-static const std::string commonApiDerivedAddress = "commonapi.tests.TestFreedesktopDerivedInterface";
-
-class FreedesktopPropertiesTest: public ::testing::Test {
-protected:
- void SetUp() {
- runtime = CommonAPI::Runtime::get();
-
- proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopInterfaceProxy>(domain, commonApiAddress, "client");
-
- registerTestStub();
-
- for (unsigned int i = 0; !proxy_->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxy_->isAvailable());
- }
-
- virtual void TearDown() {
- deregisterTestStub();
- usleep(30000);
- }
-
- void registerTestStub() {
- testStub_ = std::make_shared<VERSION::commonapi::tests::TestFreedesktopInterfaceStubDefault>();
- const bool isServiceRegistered = runtime->registerService(domain, commonApiAddress, testStub_, "connection");
-
- ASSERT_TRUE(isServiceRegistered);
- }
-
-
- void deregisterTestStub() {
- const bool isStubAdapterUnregistered = runtime->unregisterService(domain, testStub_->getStubAdapter()->getInterface(), commonApiAddress);
- ASSERT_TRUE(isStubAdapterUnregistered);
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime;
- std::shared_ptr<VERSION::commonapi::tests::TestFreedesktopInterfaceProxy<>> proxy_;
- std::shared_ptr<VERSION::commonapi::tests::TestFreedesktopInterfaceStubDefault> testStub_;
-};
-
-TEST_F(FreedesktopPropertiesTest, GetBasicTypeAttribute) {
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
-
- auto& testAttribute = proxy_->getTestPredefinedTypeAttributeAttribute();
-
- testAttribute.getValue(callStatus, value);
-
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-}
-
-TEST_F(FreedesktopPropertiesTest, GetAndSetBasicTypeAttribute) {
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
-
- auto& testAttribute = proxy_->getTestPredefinedTypeAttributeAttribute();
-
- testAttribute.getValue(callStatus, value);
-
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- uint32_t newValue = 7;
-
- testAttribute.setValue(newValue, callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-
- value = 0;
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- testAttribute.getValue(callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-}
-
-TEST_F(FreedesktopPropertiesTest, CanSendAndReceiveNotificationForSingleProperty) {
- auto& testAttribute = proxy_->getTestPredefinedTypeAttributeAttribute();
-
- bool callbackArrived = false;
- bool initialCall = true;
-
- std::function<void(const uint32_t)> listener([&](const uint32_t value) {
- // the first call is for the initial value. Ignore it.
- if (initialCall) {
- initialCall = false;
- } else {
- ASSERT_EQ(8, value);
- callbackArrived = true;
- }
- });
-
- usleep(200000);
-
- testAttribute.getChangedEvent().subscribe(listener);
-
- CommonAPI::CallStatus callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- uint32_t value;
- uint32_t newValue = 8;
-
- testAttribute.setValue(newValue, callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 8);
-
-
- uint8_t waitCounter = 0;
- while(!callbackArrived && waitCounter < 10) {
- usleep(50000);
- waitCounter++;
- }
-
- ASSERT_TRUE(callbackArrived);
-}
-
-class FreedesktopPropertiesOnInheritedInterfacesTest: public ::testing::Test {
-protected:
- void SetUp() {
- runtime = CommonAPI::Runtime::get();
-
- proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceProxy>(domain, commonApiDerivedAddress, "client");
-
- registerTestStub();
-
- for (unsigned int i = 0; !proxy_->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxy_->isAvailable());
- }
-
- virtual void TearDown() {
- deregisterTestStub();
- usleep(30000);
- }
-
- void registerTestStub() {
- testStub_ = std::make_shared<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault>();
- const bool isServiceRegistered = runtime->registerService(domain, commonApiDerivedAddress, testStub_, "connection");
-
- ASSERT_TRUE(isServiceRegistered);
- }
-
- void deregisterTestStub() {
- const bool isStubAdapterUnregistered = runtime->unregisterService(domain, testStub_->CommonAPI::Stub<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubAdapter, VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubRemoteEvent>::getStubAdapter()->VERSION::commonapi::tests::TestFreedesktopDerivedInterface::getInterface(), commonApiDerivedAddress);
- ASSERT_TRUE(isStubAdapterUnregistered);
- }
-
-
- std::shared_ptr<CommonAPI::Runtime> runtime;
- std::shared_ptr<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceProxy<>> proxy_;
- std::shared_ptr<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault> testStub_;
-};
-
-TEST_F(FreedesktopPropertiesOnInheritedInterfacesTest, CanGetAndSetRemoteAttributeFromDerivedInterface) {
- auto& testAttribute = proxy_->getTestAttributedFromDerivedInterfaceAttribute();
-
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
- testAttribute.getValue(callStatus, value);
-
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- uint32_t newValue = 7;
-
- testAttribute.setValue(newValue, callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-
- value = 0;
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- testAttribute.getValue(callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-}
-
-TEST_F(FreedesktopPropertiesOnInheritedInterfacesTest, CanGetAndSetRemoteAttributeFromParentInterface) {
- auto& testAttribute = proxy_->getTestPredefinedTypeAttributeAttribute();
-
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
- testAttribute.getValue(callStatus, value);
-
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- uint32_t newValue = 7;
-
- testAttribute.setValue(newValue, callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-
- value = 0;
- callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
- testAttribute.getValue(callStatus, value);
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusInputStreamTest.cpp b/src/test/DBusInputStreamTest.cpp
deleted file mode 100644
index ee3b7a0..0000000
--- a/src/test/DBusInputStreamTest.cpp
+++ /dev/null
@@ -1,803 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusInputStream.hpp>
-#include <CommonAPI/DBus/DBusOutputStream.hpp>
-
-#include "DBusTestUtils.hpp"
-
-#include <unordered_map>
-
-#include <gtest/gtest.h>
-
-#include <dbus/dbus.h>
-
-#include <chrono>
-#include <cstdint>
-#include <vector>
-
-
-
-class InputStreamTest: public ::testing::Test {
- protected:
- DBusMessage* libdbusMessage;
- DBusMessageIter libdbusMessageWriteIter;
- size_t numOfElements;
-
- void SetUp() {
- numOfElements = 2;
- libdbusMessage = dbus_message_new_method_call("no.bus.here", "/no/object/here", NULL, "noMethodHere");
- ASSERT_TRUE(libdbusMessage != NULL);
- dbus_message_iter_init_append(libdbusMessage, &libdbusMessageWriteIter);
- }
-
- void TearDown() {
- dbus_message_unref(libdbusMessage);
- }
-};
-
-TEST_F(InputStreamTest, CanBeConstructed) {
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-}
-
-TEST_F(InputStreamTest, ReadsEmptyMessages) {
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(0, scopedMessage.getBodyLength());
-}
-
-TEST_F(InputStreamTest, ReadsBytes) {
- uint8_t val = 0xff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_BYTE, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- uint8_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsBools) {
- dbus_bool_t f = FALSE;
- dbus_bool_t t = TRUE;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_BOOLEAN, &t);
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_BOOLEAN, &f);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*4, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- bool readVal;
- inStream >> readVal;
- EXPECT_EQ(t, readVal);
- inStream >> readVal;
- EXPECT_EQ(f, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsUint16) {
-
- uint16_t val = 0xffff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_UINT16, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*2, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- uint16_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsInt16) {
-
- int16_t val = 0x7fff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_INT16, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*2, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- int16_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsUint32) {
-
- uint32_t val = 0xffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_UINT32, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*4, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- uint32_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsInt32) {
-
- int32_t val = 0x7fffffff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_INT32, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*4, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- int32_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsUint64) {
-
- uint64_t val = 0xffffffffffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_UINT64, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*8, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- uint64_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsInt64) {
-
- int64_t val = 0x7fffffffffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_INT64, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*8, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- int64_t readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsDoubles) {
-
- double val = 13.37;
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_DOUBLE, &val);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*8, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- double readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-TEST_F(InputStreamTest, ReadsStrings) {
- std::string val = "hai";
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- const char* valPtr = val.c_str();
- dbus_message_iter_append_basic(&libdbusMessageWriteIter, DBUS_TYPE_STRING, &valPtr);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(numOfElements*4 + numOfElements*4, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- std::string readVal;
- inStream >> readVal;
- EXPECT_EQ(val, readVal);
- }
-}
-
-namespace bmw {
-namespace test {
- struct TestSerializableStruct : CommonAPI::Struct<uint32_t, int16_t, bool, std::string, double> {
- virtual uint32_t getA() { return std::get<0>(values_); }
- virtual int16_t getB() { return std::get<1>(values_); }
- virtual bool getC() { return std::get<2>(values_); }
- virtual std::string getD() { return std::get<3>(values_); }
- virtual double getE() { return std::get<4>(values_); }
-
- virtual void* getAderef() { return &std::get<0>(values_); }
- virtual void* getBderef() { return &std::get<1>(values_); }
- virtual void* getCderef() { return &std::get<2>(values_); }
- virtual void* getDderef() { return &std::get<3>(values_); }
- virtual void* getEderef() { return &std::get<4>(values_); }
-
- virtual void setA(uint32_t a) { std::get<0>(values_) = a; }
- virtual void setB(int16_t b) { std::get<1>(values_) = b; }
- virtual void setC(bool c) { std::get<2>(values_) = c; }
- virtual void setD(std::string d) { std::get<3>(values_) = d; }
- virtual void setE(double e) { std::get<4>(values_) = e; }
-
- virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputStream) {
- inputStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_) >> std::get<4>(values_);
- }
-
- virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputStream) const {
- outputStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_) << std::get<4>(values_);
- }
-
- static void writeToTypeOutputStream(CommonAPI::TypeOutputStream<CommonAPI::DBus::DBusTypeOutputStream>& typeOutputStream) {
- (void)typeOutputStream;
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- }
-};
-
-bool operator==(const TestSerializableStruct& lhs, const TestSerializableStruct& rhs) {
- if (&lhs == &rhs)
- return true;
-
- return (std::get<0>(lhs.values_) == std::get<0>(rhs.values_))
- && (std::get<1>(lhs.values_) == std::get<1>(rhs.values_))
- && (std::get<2>(lhs.values_) == std::get<2>(rhs.values_))
- && (std::get<3>(lhs.values_) == std::get<3>(rhs.values_))
- && (std::get<4>(lhs.values_) == std::get<4>(rhs.values_));
-}
-
-} //namespace test
-} //namespace bmw
-
-TEST_F(InputStreamTest, ReadsStructs) {
-
- bmw::test::TestSerializableStruct testStruct;
- testStruct.setA(15);
- testStruct.setB(-32);
- testStruct.setC(FALSE);
- testStruct.setD("Hello all");
- testStruct.setE(3.414);
-
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_UINT32, testStruct.getAderef());
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_INT16, testStruct.getBderef());
- dbus_bool_t dbusBool = static_cast<dbus_bool_t>(testStruct.getC());
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BOOLEAN, &dbusBool);
- const char* dPtr = std::get<3>(testStruct.values_).c_str();
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_STRING, &dPtr);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- //40(byte length of struct) = 4(uint32_t) + 2(int16_t) + 2(padding) + 4(bool) + 4(strlength)
- // + 9(string) + 1(terminating '\0' of string) + 6(padding) + 8 (double)
- EXPECT_EQ(40, scopedMessage.getBodyLength());
-
- bmw::test::TestSerializableStruct verifyStruct;
- inStream >> verifyStruct;
- EXPECT_EQ(testStruct.getA(), verifyStruct.getA());
- EXPECT_EQ(testStruct.getB(), verifyStruct.getB());
- EXPECT_EQ(testStruct.getC(), verifyStruct.getC());
- EXPECT_EQ(testStruct.getD(), verifyStruct.getD());
- EXPECT_EQ(testStruct.getE(), verifyStruct.getE());
-}
-
-TEST_F(InputStreamTest, ReadsArrays) {
-
- std::vector<int32_t> testVector;
- int32_t val1 = 0xffffffff;
- int32_t val2 = 0x7fffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- testVector.push_back(val1);
- testVector.push_back(val2);
- }
-
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_ARRAY, "i", &subIter);
- for (unsigned int i = 0; i < numOfElements; i++) {
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_INT32, &testVector[i]);
- }
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- EXPECT_EQ(scopedMessage.getBodyLength(), numOfElements*4 + 4);
- std::vector<int32_t> verifyVector;
- inStream >> verifyVector;
- int32_t res1;
- int32_t res2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- res1 = verifyVector[i];
- EXPECT_EQ(val1, res1);
- res2 = verifyVector[i + 1];
- EXPECT_EQ(val2, res2);
- }
-}
-
-TEST_F(InputStreamTest, ReadsArraysInArrays) {
- size_t numOfElements = 2;
- DBusMessage* dbusMessage = dbus_message_new_method_call("no.bus.here", "/no/object/here", NULL, "noMethodHere");
- ASSERT_TRUE(dbusMessage != NULL);
-
- DBusMessageIter writeIter;
- dbus_message_iter_init_append(dbusMessage, &writeIter);
-
- std::vector<std::vector<int32_t>> testVector;
- int32_t val1 = 0xffffffff;
- int32_t val2 = 0x7fffffff;
- for (unsigned int i = 0; i < numOfElements; i++) {
- std::vector<int32_t> inner;
- for (unsigned int j = 0; j < numOfElements; j += 2) {
- inner.push_back(val1);
- inner.push_back(val2);
- }
- testVector.push_back(inner);
- }
-
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&writeIter, DBUS_TYPE_ARRAY, "ai", &subIter);
- for (unsigned int i = 0; i < numOfElements; i++) {
- DBusMessageIter subsubIter;
- dbus_message_iter_open_container(&subIter, DBUS_TYPE_ARRAY, "i", &subsubIter);
- for (unsigned int j = 0; j < numOfElements; j++) {
- dbus_message_iter_append_basic(&subsubIter, DBUS_TYPE_INT32, &(testVector[i][j]));
- }
- dbus_message_iter_close_container(&subIter, &subsubIter);
- }
- dbus_message_iter_close_container(&writeIter, &subIter);
-
- CommonAPI::DBus::DBusMessage scopedMessage(dbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- // 5*5*int32_t + 5*lengthField_inner(int32_t) + lengthField_outer(int32_t)
- EXPECT_EQ(numOfElements*numOfElements*4 + numOfElements*4 + 4, scopedMessage.getBodyLength());
- std::vector<std::vector<int32_t>> verifyVector;
- inStream >> verifyVector;
-
- int32_t res1;
- int32_t res2;
- for (unsigned int i = 0; i < numOfElements; i++) {
- std::vector<int32_t> innerVerify = verifyVector[i];
- for (unsigned int j = 0; j < numOfElements; j += 2) {
- res1 = innerVerify[j];
- EXPECT_EQ(val1, res1);
- res2 = innerVerify[j + 1];
- EXPECT_EQ(val2, res2);
- }
- }
-}
-
-TEST_F(InputStreamTest, ReadsInt32Variants) {
- typedef CommonAPI::Variant<int32_t, double, std::string> TestedVariantType;
-
- int32_t fromInt = 5;
- int8_t variantTypeIndex = 3;
-
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BYTE, &variantTypeIndex);
- DBusMessageIter subSubIter;
- dbus_message_iter_open_container(&subIter, DBUS_TYPE_VARIANT, "i", &subSubIter);
- dbus_message_iter_append_basic(&subSubIter, DBUS_TYPE_INT32, &fromInt);
- dbus_message_iter_close_container(&subIter, &subSubIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- TestedVariantType referenceVariant(fromInt);
-
- EXPECT_EQ(numOfElements*4 + numOfElements*4, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- TestedVariantType readVariant;
- inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
-
- int32_t actualResult;
- EXPECT_NO_THROW(actualResult = readVariant.get<int32_t>());
-
- bool varEq = (referenceVariant == readVariant);
- EXPECT_TRUE(varEq);
- EXPECT_EQ(fromInt, actualResult);
- }
-}
-
-TEST_F(InputStreamTest, ReadsStringVariants) {
- typedef CommonAPI::Variant<int32_t, double, std::string> TestedVariantType;
-
- std::string fromString = "Hello World with CommonAPI Variants!";
- int8_t variantTypeIndex = 1;
-
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BYTE, &variantTypeIndex);
- DBusMessageIter subSubIter;
- dbus_message_iter_open_container(&subIter, DBUS_TYPE_VARIANT, "s", &subSubIter);
- const char* fromStringPtr = fromString.c_str();
- dbus_message_iter_append_basic(&subSubIter, DBUS_TYPE_STRING, &fromStringPtr);
- dbus_message_iter_close_container(&subIter, &subSubIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- TestedVariantType referenceVariant(fromString);
-
- //Variant: type-index(1) + signature(2) + padding(1) + stringLength(4) + string(37) = 45
- // +struct-padding inbetween (alignment 8)
- EXPECT_EQ(numOfElements * (1+3+4+fromString.length()+1) + (numOfElements - 1) * (8-((fromString.length()+1)%8)) , scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- TestedVariantType readVariant;
- inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
-
- std::string actualResult = readVariant.get<std::string>();
-
- bool variantsAreEqual = (referenceVariant == readVariant);
- EXPECT_TRUE(variantsAreEqual);
- EXPECT_EQ(fromString, actualResult);
- }
-}
-
-
-TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStrings) {
- typedef CommonAPI::Variant<int32_t, double, std::vector<std::string>> TestedVariantType;
-
- std::string testString1 = "Hello World with CommonAPI Variants!";
- std::string testString2 = "What a beautiful world if there are working Arrays within Variants!!";
- int8_t variantTypeIndex = 1;
-
- std::vector<std::string> testInnerVector;
-
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- testInnerVector.push_back(testString1);
- testInnerVector.push_back(testString2);
- }
-
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- DBusMessageIter subIter;
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BYTE, &variantTypeIndex);
- DBusMessageIter subSubIter;
- dbus_message_iter_open_container(&subIter, DBUS_TYPE_VARIANT, "as", &subSubIter);
-
- DBusMessageIter innerArrayIter;
- dbus_message_iter_open_container(&subSubIter, DBUS_TYPE_ARRAY, "s", &innerArrayIter);
- for (unsigned int i = 0; i < numOfElements; i++) {
- const char* testPtr = testInnerVector[i].c_str();
- dbus_message_iter_append_basic(&innerArrayIter, DBUS_TYPE_STRING, &testPtr);
- }
- dbus_message_iter_close_container(&subSubIter, &innerArrayIter);
-
- dbus_message_iter_close_container(&subIter, &subSubIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
- }
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- TestedVariantType referenceVariant(testInnerVector);
-
- //Variant: structAlign + type-index(1) + variantSignature(4) + padding(3) + arrayLength(4) + stringLength(4) +
- // string(37) + padding(3) + stringLength(4) + string(69) = 129
- EXPECT_EQ(129 + 7 + 129, scopedMessage.getBodyLength());
- for (unsigned int i = 0; i < numOfElements; i += 1) {
- TestedVariantType readVariant;
- inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
-
- std::vector<std::string> actualResult = readVariant.get<std::vector<std::string>>();
-
- bool variantsAreEqual = (referenceVariant == readVariant);
- EXPECT_TRUE(variantsAreEqual);
- EXPECT_EQ(testInnerVector, actualResult);
- }
-
-}
-
-
-TEST_F(InputStreamTest, ReadsVariantsWithVariants) {
- typedef CommonAPI::Variant<int8_t, uint64_t, CommonAPI::ByteBuffer> InnerVariantType;
-
- typedef CommonAPI::Variant<int32_t,
- double,
- std::string,
- InnerVariantType>
- TestedVariantType;
-
- int8_t outerVariantTypeIndex = 1;
- int8_t innerVariant1TypeIndex = 1;
- int8_t innerVariant2TypeIndex = 3;
-
- const uint32_t byteBufferElementCount = static_cast<uint32_t>(numOfElements*10);
-
- CommonAPI::ByteBuffer innerVariant1Value;
- for (unsigned int i = 0; i < byteBufferElementCount; ++i) {
- innerVariant1Value.push_back((char) (i+40));
- }
-
- int8_t innerVariant2Value = -55;
-
-
- DBusMessageIter outerVariantStructIter;
- DBusMessageIter outerVariantActualIter;
- DBusMessageIter innerVariantStructIter;
- DBusMessageIter innerVariantActualIterator;
- DBusMessageIter innerArrayIter;
-
-
- //begin 1. outer variant
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &outerVariantStructIter);
- dbus_message_iter_append_basic(&outerVariantStructIter, DBUS_TYPE_BYTE, &outerVariantTypeIndex);
- dbus_message_iter_open_container(&outerVariantStructIter, DBUS_TYPE_VARIANT, "(yv)", &outerVariantActualIter);
-
- //begin inner variant
- dbus_message_iter_open_container(&outerVariantActualIter, DBUS_TYPE_STRUCT, NULL, &innerVariantStructIter);
- dbus_message_iter_append_basic(&innerVariantStructIter, DBUS_TYPE_BYTE, &innerVariant1TypeIndex);
- dbus_message_iter_open_container(&innerVariantStructIter, DBUS_TYPE_VARIANT, "ay", &innerVariantActualIterator);
-
- //begin inner variant content
- dbus_message_iter_open_container(&innerVariantActualIterator, DBUS_TYPE_ARRAY, "y", &innerArrayIter);
- for (unsigned int i = 0; i < byteBufferElementCount; i++) {
- dbus_message_iter_append_basic(&innerArrayIter, DBUS_TYPE_BYTE, &innerVariant1Value[i]);
- }
- dbus_message_iter_close_container(&innerVariantActualIterator, &innerArrayIter);
- //end inner variant content
-
- dbus_message_iter_close_container(&innerVariantStructIter, &innerVariantActualIterator);
- dbus_message_iter_close_container(&outerVariantActualIter, &innerVariantStructIter);
- //end inner variant
-
- dbus_message_iter_close_container(&outerVariantStructIter, &outerVariantActualIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &outerVariantStructIter);
- //end 1. outer variant
-
-
- //begin 2. outer variant
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &outerVariantStructIter);
- dbus_message_iter_append_basic(&outerVariantStructIter, DBUS_TYPE_BYTE, &outerVariantTypeIndex);
- dbus_message_iter_open_container(&outerVariantStructIter, DBUS_TYPE_VARIANT, "(yv)", &outerVariantActualIter);
-
- //begin inner variant
- dbus_message_iter_open_container(&outerVariantActualIter, DBUS_TYPE_STRUCT, NULL, &innerVariantStructIter);
- dbus_message_iter_append_basic(&innerVariantStructIter, DBUS_TYPE_BYTE, &innerVariant2TypeIndex);
- dbus_message_iter_open_container(&innerVariantStructIter, DBUS_TYPE_VARIANT, "y", &innerVariantActualIterator);
-
- //begin inner variant content
- dbus_message_iter_append_basic(&innerVariantActualIterator, DBUS_TYPE_BYTE, &innerVariant2Value);
- //end inner variant content
-
- dbus_message_iter_close_container(&innerVariantStructIter, &innerVariantActualIterator);
- dbus_message_iter_close_container(&outerVariantActualIter, &innerVariantStructIter);
- //end inner variant
-
- dbus_message_iter_close_container(&outerVariantStructIter, &outerVariantActualIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &outerVariantStructIter);
- //end 2. outer variant
-
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- InnerVariantType referenceInnerVariant1(innerVariant1Value);
- InnerVariantType referenceInnerVariant2(innerVariant2Value);
-
- TestedVariantType referenceVariant1(referenceInnerVariant1);
- TestedVariantType referenceVariant2(referenceInnerVariant2);
-
- //Variant1: type-index(1) + varSigLen(1) + varSig(2) + struct-padding(4) + inner-type-index(1) + varLen(1) + varSig(3) +
- // padding(3) + byteBufferLength(4) + byteBuffer(20) = 40
- //Variant2: type-index(1) + varSigLen(1) + varSig(2) + struct-padding(4) + inner-type-index(1) + varLen(1) + varSig(2) +
- // byte(1) = 13
- // = 53
- EXPECT_EQ(53, scopedMessage.getBodyLength());
-
- TestedVariantType readVariant1;
- TestedVariantType readVariant2;
- inStream.readValue(readVariant1, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>>*>(nullptr));
- inStream.readValue(readVariant2, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>>*>(nullptr));
- EXPECT_EQ(referenceVariant1, readVariant1);
- EXPECT_EQ(referenceVariant2, readVariant2);
-
- InnerVariantType readInnerVariant1 = readVariant1.get<InnerVariantType>();
- InnerVariantType readInnerVariant2 = readVariant2.get<InnerVariantType>();
- EXPECT_EQ(referenceInnerVariant1, readInnerVariant1);
- EXPECT_EQ(referenceInnerVariant2, readInnerVariant2);
-
- CommonAPI::ByteBuffer readInnerValue1 = readInnerVariant1.get<CommonAPI::ByteBuffer>();
- int8_t readInnerValue2 = readInnerVariant2.get<int8_t>();
- EXPECT_EQ(innerVariant1Value, readInnerValue1);
- EXPECT_EQ(innerVariant2Value, readInnerValue2);
-}
-
-
-TEST_F(InputStreamTest, ReadsVariantsWithStructs) {
- typedef CommonAPI::Variant<int32_t,
- double,
- std::string,
- bmw::test::TestSerializableStruct>
- TestedVariantType;
-
- int8_t variantTypeIndex = 1;
-
- bmw::test::TestSerializableStruct testStruct;
- testStruct.setA(15);
- testStruct.setB(-32);
- testStruct.setC(false);
- testStruct.setD("Hello all!");
- testStruct.setE(3.414);
-
-
- DBusMessageIter variantStructIter;
- DBusMessageIter variantActualIter;
- DBusMessageIter innerStructIter;
-
- //begin variant
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &variantStructIter);
- dbus_message_iter_append_basic(&variantStructIter, DBUS_TYPE_BYTE, &variantTypeIndex);
- dbus_message_iter_open_container(&variantStructIter, DBUS_TYPE_VARIANT, "(unbsd)", &variantActualIter);
-
- //begin variant content
- dbus_message_iter_open_container(&variantActualIter, DBUS_TYPE_STRUCT, NULL, &innerStructIter);
-
- dbus_bool_t dbusBool = 0;
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_UINT32, testStruct.getAderef());
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_INT16, testStruct.getBderef());
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_BOOLEAN, &dbusBool);
- const char* dPtr = std::get<3>(testStruct.values_).c_str();
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_STRING, &dPtr);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
-
- dbus_message_iter_close_container(&variantActualIter, &innerStructIter);
- //end variant content
-
- dbus_message_iter_close_container(&variantStructIter, &variantActualIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &variantStructIter);
- //end variant
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
- TestedVariantType referenceVariant(testStruct);
-
- //type-index(1) + varSigLen(1) + varSig(8) + struct-padding(6) + uint32(4) + int16(2) + padding(2) + bool(4) +
- //stringLen(4) + stringVal(11) + padding(5) + double(8) = 56
- EXPECT_EQ(56, scopedMessage.getBodyLength());
-
- TestedVariantType readVariant;
- inStream >> readVariant;
-
- bmw::test::TestSerializableStruct readStruct = readVariant.get<bmw::test::TestSerializableStruct>();
- EXPECT_EQ(testStruct.getA(), readStruct.getA());
- EXPECT_EQ(testStruct.getB(), readStruct.getB());
- EXPECT_EQ(testStruct.getC(), readStruct.getC());
- EXPECT_EQ(testStruct.getD(), readStruct.getD());
- EXPECT_EQ(testStruct.getE(), readStruct.getE());
- EXPECT_EQ(testStruct, readStruct);
- EXPECT_EQ(referenceVariant, readVariant);
-}
-
-
-TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStructs) {
- typedef CommonAPI::Variant<int32_t, double, std::vector<bmw::test::TestSerializableStruct>> TestedVariantType;
-
- bmw::test::TestSerializableStruct testStruct;
- testStruct.setA(15);
- testStruct.setB(-32);
- testStruct.setC(false);
- testStruct.setD("Hello all!");
- testStruct.setE(3.414);
-
- int8_t variantTypeIndex = 1;
-
- DBusMessageIter subIter;
- DBusMessageIter subSubIter;
- DBusMessageIter innerArrayIter;
- DBusMessageIter innerStructIter;
-
- //begin variant
- dbus_message_iter_open_container(&libdbusMessageWriteIter, DBUS_TYPE_STRUCT, NULL, &subIter);
- dbus_message_iter_append_basic(&subIter, DBUS_TYPE_BYTE, &variantTypeIndex);
- dbus_message_iter_open_container(&subIter, DBUS_TYPE_VARIANT, "a(unbsd)", &subSubIter);
-
- //begin array
- dbus_message_iter_open_container(&subSubIter, DBUS_TYPE_ARRAY, "(unbsd)", &innerArrayIter);
-
- //begin struct
- dbus_message_iter_open_container(&innerArrayIter, DBUS_TYPE_STRUCT, NULL, &innerStructIter);
-
- dbus_bool_t dbusBool = 0;
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_UINT32, testStruct.getAderef());
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_INT16, testStruct.getBderef());
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_BOOLEAN, &dbusBool);
- const char* dPtr = std::get<3>(testStruct.values_).c_str();
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_STRING, &dPtr);
- dbus_message_iter_append_basic(&innerStructIter, DBUS_TYPE_DOUBLE, testStruct.getEderef());
-
- dbus_message_iter_close_container(&innerArrayIter, &innerStructIter);
- //end struct
-
- dbus_message_iter_close_container(&subSubIter, &innerArrayIter);
- //end array
-
- dbus_message_iter_close_container(&subIter, &subSubIter);
- dbus_message_iter_close_container(&libdbusMessageWriteIter, &subIter);
- //end variant
-
- CommonAPI::DBus::DBusMessage scopedMessage(libdbusMessage);
- CommonAPI::DBus::DBusInputStream inStream(scopedMessage);
-
- std::vector<bmw::test::TestSerializableStruct> referenceInnerVector;
- referenceInnerVector.push_back(testStruct);
- TestedVariantType referenceVariant(referenceInnerVector);
-
- //type-index(1) + varSigLen(1) + variantSig(9) + padding(1) + arrayLength(4) + uint32(4) + int16(2) + padding(2)
- //bool(4) + stringLength(4) + string(11) + padding(5) + double(8) = 56
- EXPECT_EQ(56, scopedMessage.getBodyLength());
-
- TestedVariantType readVariant;
- inStream >> readVariant;
-
- std::vector<bmw::test::TestSerializableStruct> actualResult = readVariant.get<std::vector<bmw::test::TestSerializableStruct>>();
- bmw::test::TestSerializableStruct readStruct = actualResult[0];
-
- EXPECT_EQ(testStruct.getA(), readStruct.getA());
- EXPECT_EQ(testStruct.getB(), readStruct.getB());
- EXPECT_EQ(testStruct.getC(), readStruct.getC());
- EXPECT_EQ(testStruct.getD(), readStruct.getD());
- EXPECT_EQ(testStruct.getE(), readStruct.getE());
- EXPECT_EQ(testStruct, readStruct);
- EXPECT_EQ(referenceInnerVector, actualResult);
- EXPECT_EQ(referenceVariant, readVariant);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusLoadTest.cpp b/src/test/DBusLoadTest.cpp
deleted file mode 100644
index 9f23376..0000000
--- a/src/test/DBusLoadTest.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <array>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-#include <future>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-#define VERSION v1_0
-
-class TestInterfaceStubFinal : public VERSION::commonapi::tests::TestInterfaceStubDefault {
-
-public:
- void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client,
- uint32_t _uint32InValue,
- std::string _stringInValue,
- testPredefinedTypeMethodReply_t _reply) {
- (void)_client;
- uint32_t uint32OutValue = _uint32InValue;
- std::string stringOutValue = _stringInValue;
- _reply(uint32OutValue, stringOutValue);
- }
-};
-
-class DBusLoadTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool )runtime_);
-
- callSucceeded_.resize(numCallsPerProxy_ * numProxies_);
- std::fill(callSucceeded_.begin(), callSucceeded_.end(), false);
- }
-
- virtual void TearDown() {
- usleep(1000000);
- }
-
-public:
- void TestPredefinedTypeMethodAsyncCallback(
- const uint32_t callId,
- const uint32_t in1,
- const std::string in2,
- const CommonAPI::CallStatus& callStatus,
- const uint32_t& out1,
- const std::string& out2) {
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(out1, in1);
- EXPECT_EQ(out2, in2);
- mutexCallSucceeded_.lock();
- ASSERT_FALSE(callSucceeded_[callId]);
- callSucceeded_[callId] = true;
- mutexCallSucceeded_.unlock();
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::vector<bool> callSucceeded_;
- std::mutex mutexCallSucceeded_;
-
- static const std::string domain_;
- static const std::string serviceAddress_;
- static const uint32_t numCallsPerProxy_;
- static const uint32_t numProxies_;
-};
-
-const std::string DBusLoadTest::domain_ = "local";
-const std::string DBusLoadTest::serviceAddress_ = "CommonAPI.DBus.tests.DBusProxyTestService";
-const uint32_t DBusLoadTest::numCallsPerProxy_ = 100;
-
-#ifdef WIN32
-// test with just 50 proxies under windows as it becomes very slow with more ones
-const uint32_t DBusLoadTest::numProxies_ = 50;
-#else
-const uint32_t DBusLoadTest::numProxies_ = 65;
-#endif
-
-// Multiple proxies in one thread, one stub
-TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
- std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
-
- for (unsigned int i = 0; i < numProxies_; i++) {
- testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_);
- ASSERT_TRUE((bool )testProxies[i]);
- }
-
- auto stub = std::make_shared<TestInterfaceStubFinal>();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- for (auto i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- bool allProxiesAvailable = false;
- for (unsigned int i = 0; !allProxiesAvailable && i < 100; ++i) {
- allProxiesAvailable = true;
- for (unsigned int j = 0; j < numProxies_; ++j) {
- allProxiesAvailable = allProxiesAvailable && testProxies[j]->isAvailable();
- }
- if (!allProxiesAvailable)
- usleep(10000);
- }
- ASSERT_TRUE(allProxiesAvailable);
-
- uint32_t callId = 0;
- for (unsigned int i = 0; i < numCallsPerProxy_; i++) {
- for (unsigned int j = 0; j < numProxies_; j++) {
- uint32_t in1 = i;
- std::string in2 = "string" + std::to_string(i) + "_" + std::to_string(j);
- testProxies[j]->testPredefinedTypeMethodAsync(
- in1,
- in2,
- std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
- }
- }
-
- bool allCallsSucceeded = false;
- for (unsigned int i = 0; !allCallsSucceeded && i < 100; ++i) {
- allCallsSucceeded = std::all_of(callSucceeded_.cbegin(), callSucceeded_.cend(), [](int b){ return b; });
- if (!allCallsSucceeded)
- usleep(100000);
- }
- ASSERT_TRUE(allCallsSucceeded);
-
- runtime_->unregisterService(domain_, stub->getStubAdapter()->getInterface(), serviceAddress_);
-}
-
-// Multiple proxies in separate threads, one stub
-TEST_F(DBusLoadTest, MultipleClientsSingleStubCallsSucceed) {
- std::array<std::shared_ptr<CommonAPI::Factory>, numProxies_> testProxyFactories;
- std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
-
- for (unsigned int i = 0; i < numProxies_; i++) {
- testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_);
- ASSERT_TRUE((bool )testProxies[i]);
- }
-
- auto stub = std::make_shared<TestInterfaceStubFinal>();
- bool serviceRegistered = false;
- for (auto i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
- if(!serviceRegistered)
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
-
- bool allProxiesAvailable = false;
- for (unsigned int i = 0; !allProxiesAvailable && i < 100; ++i) {
- allProxiesAvailable = true;
- for (unsigned int j = 0; j < numProxies_; ++j) {
- allProxiesAvailable = allProxiesAvailable && testProxies[j]->isAvailable();
- }
- if (!allProxiesAvailable)
- usleep(10000);
- }
- ASSERT_TRUE(allProxiesAvailable);
-
- uint32_t callId = 0;
- for (unsigned int i = 0; i < numCallsPerProxy_; i++) {
- for (unsigned int j = 0; j < numProxies_; j++) {
- uint32_t in1 = i;
- std::string in2 = "string" + std::to_string(i) + "_" + std::to_string(j);
- testProxies[j]->testPredefinedTypeMethodAsync(
- in1,
- in2,
- std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
- }
- }
-
- bool allCallsSucceeded = false;
- for (unsigned int i = 0; !allCallsSucceeded && i < 100; ++i) {
- allCallsSucceeded = std::all_of(callSucceeded_.cbegin(), callSucceeded_.cend(), [](int b){ return b; });
- if (!allCallsSucceeded)
- usleep(100000);
- }
- ASSERT_TRUE(allCallsSucceeded);
-
- runtime_->unregisterService(domain_, stub->getStubAdapter()->getInterface(), serviceAddress_);
-}
-
-// Multiple proxies in separate threads, multiple stubs in separate threads
-TEST_F(DBusLoadTest, MultipleClientsMultipleServersCallsSucceed) {
- std::array<std::shared_ptr<CommonAPI::Factory>, numProxies_> testProxyFactories;
- std::array<std::shared_ptr<CommonAPI::Factory>, numProxies_> testStubFactories;
- std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
- std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStub>, numProxies_> testStubs;
-
- for (unsigned int i = 0; i < numProxies_; i++) {
- testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_ + std::to_string(i));
- ASSERT_TRUE((bool )testProxies[i]);
- }
-
- for (unsigned int i = 0; i < numProxies_; i++) {
- testStubs[i] = std::make_shared<TestInterfaceStubFinal>();
- ASSERT_TRUE((bool )testStubs[i]);
- bool serviceRegistered = false;
- for (auto j = 0; !serviceRegistered && j < 100; ++j) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_ + std::to_string(i), testStubs[i], "connection");
- if(!serviceRegistered)
- usleep(10000);
- }
- ASSERT_TRUE(serviceRegistered);
- }
-
- bool allProxiesAvailable = false;
- for (unsigned int i = 0; !allProxiesAvailable && i < 100; ++i) {
- allProxiesAvailable = true;
- for (unsigned int j = 0; j < numProxies_; ++j) {
- allProxiesAvailable = allProxiesAvailable && testProxies[j]->isAvailable();
- }
- if (!allProxiesAvailable)
- usleep(1000000);
- }
- ASSERT_TRUE(allProxiesAvailable);
-
- uint32_t callId = 0;
- for (unsigned int i = 0; i < numCallsPerProxy_; i++) {
- for (unsigned int j = 0; j < numProxies_; j++) {
- uint32_t in1 = i;
- std::string in2 = "string" + std::to_string(i) + "_" + std::to_string(j);
- testProxies[j]->testPredefinedTypeMethodAsync(
- in1,
- in2,
- std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
- }
- }
-
- bool allCallsSucceeded = false;
- for (auto i = 0; !allCallsSucceeded && i < 100; ++i) {
- allCallsSucceeded = std::all_of(callSucceeded_.cbegin(), callSucceeded_.cend(), [](int b){ return b; });
- if (!allCallsSucceeded)
- usleep(100000);
- }
- ASSERT_TRUE(allCallsSucceeded);
-
- for (unsigned int i = 0; i < numProxies_; i++) {
- runtime_->unregisterService(domain_, testStubs[i]->getStubAdapter()->getInterface(), serviceAddress_ + std::to_string(i));
- }
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusMainLoopIntegrationTest.cpp b/src/test/DBusMainLoopIntegrationTest.cpp
deleted file mode 100644
index d5b8103..0000000
--- a/src/test/DBusMainLoopIntegrationTest.cpp
+++ /dev/null
@@ -1,536 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-#ifndef WIN32
-#include <glib.h>
-#endif
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-
-#include "DBusTestUtils.hpp"
-#include "DemoMainLoop.hpp"
-
-#include "commonapi/tests/PredefinedTypeCollection.hpp"
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-
-#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-const std::string domain = "local";
-const std::string testAddress1 = "commonapi.address.one";
-const std::string testAddress2 = "commonapi.address.two";
-const std::string testAddress3 = "commonapi.address.three";
-const std::string testAddress4 = "commonapi.address.four";
-const std::string testAddress5 = "commonapi.address.five";
-const std::string testAddress6 = "commonapi.address.six";
-const std::string testAddress7 = "commonapi.address.seven";
-const std::string testAddress8 = "commonapi.address.eight";
-
-#define VERSION v1_0
-
-//####################################################################################################################
-
-class DBusBasicMainLoopTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-struct TestSource: public CommonAPI::DispatchSource {
- TestSource(const std::string value, std::string& result): value_(value), result_(result) {}
-
- bool prepare(int64_t& timeout) {
- (void)timeout;
- return true;
- }
- bool check() {
- return true;
- }
- bool dispatch() {
- result_.append(value_);
- return false;
- }
-
- private:
- std::string value_;
- std::string& result_;
-};
-
-TEST_F(DBusBasicMainLoopTest, PrioritiesAreHandledCorrectlyInDemoMainloop) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool) runtime);
-
- std::shared_ptr<CommonAPI::MainLoopContext> context = std::make_shared<CommonAPI::MainLoopContext>();
- ASSERT_TRUE((bool) context);
-
- auto mainLoop = new CommonAPI::MainLoop(context);
-
- std::string result = "";
-
- TestSource* testSource1Default = new TestSource("A", result);
- TestSource* testSource2Default = new TestSource("B", result);
- TestSource* testSource1High = new TestSource("C", result);
- TestSource* testSource1Low = new TestSource("D", result);
- TestSource* testSource1VeryHigh = new TestSource("E", result);
- context->registerDispatchSource(testSource1Default);
- context->registerDispatchSource(testSource2Default, CommonAPI::DispatchPriority::DEFAULT);
- context->registerDispatchSource(testSource1High, CommonAPI::DispatchPriority::HIGH);
- context->registerDispatchSource(testSource1Low, CommonAPI::DispatchPriority::LOW);
- context->registerDispatchSource(testSource1VeryHigh, CommonAPI::DispatchPriority::VERY_HIGH);
-
- mainLoop->wakeup();
- mainLoop->doSingleIteration(CommonAPI::TIMEOUT_INFINITE);
-
- std::string reference1("ECABD");
- std::string reference2("ECBAD");
- ASSERT_TRUE(reference1 == result || reference2 == result);
-}
-
-
-//####################################################################################################################
-
-class DBusMainLoopTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool) runtime_);
-
- context_ = std::make_shared<CommonAPI::MainLoopContext>();
- ASSERT_TRUE((bool) context_);
- mainLoop_ = new CommonAPI::MainLoop(context_);
- }
-
- virtual void TearDown() {
- delete mainLoop_;
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- std::shared_ptr<CommonAPI::MainLoopContext> context_;
- CommonAPI::MainLoop* mainLoop_;
-};
-
-
-TEST_F(DBusMainLoopTest, ServiceInDemoMainloopCanBeAddressed) {
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress1, stub, context_));
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress1, "connection");
- ASSERT_TRUE((bool) proxy);
-
- while (!proxy->isAvailable()) {
- mainLoop_->doSingleIteration(50000);
- }
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Hai :)";
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- mainLoop_->stop();
- }
- );
-
- mainLoop_->run();
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress1);
-}
-
-
-TEST_F(DBusMainLoopTest, ProxyInDemoMainloopCanCallMethods) {
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress2, stub, "connection"));
-
- usleep(500000);
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress2, context_);
- ASSERT_TRUE((bool) proxy);
-
- while (!proxy->isAvailable()) {
- mainLoop_->doSingleIteration();
- usleep(50000);
- }
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Hai :)";
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- mainLoop_->stop();
- }
- );
-
- mainLoop_->run();
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress2);
-}
-
-TEST_F(DBusMainLoopTest, ProxyAndServiceInSameDemoMainloopCanCommunicate) {
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress4, stub, context_));
-
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress4, context_);
- ASSERT_TRUE((bool) proxy);
-
- while (!proxy->isAvailable()) {
- mainLoop_->doSingleIteration();
- usleep(50000);
- }
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Hai :)";
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- mainLoop_->stop();
- }
- );
-
- mainLoop_->run();
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress4);
-}
-
-
-class BigDataTestStub : public VERSION::commonapi::tests::TestInterfaceStubDefault {
- void testDerivedTypeMethod(
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2InValue,
- ::commonapi::tests::DerivedTypeCollection::TestMap testMapInValue,
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2OutValue,
- ::commonapi::tests::DerivedTypeCollection::TestMap& testMapOutValue) {
- testEnumExtended2OutValue = testEnumExtended2InValue;
- testMapOutValue = testMapInValue;
- }
-};
-
-TEST_F(DBusMainLoopTest, DemoMainloopClientsHandleNonavailableServices) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress3, context_);
- ASSERT_TRUE((bool) proxy);
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Hai :)";
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- //Will never be called, @see DBusProxyAsyncCallbackHandler
- EXPECT_EQ(toString(CommonAPI::CallStatus::NOT_AVAILABLE), toString(status));
- }
- );
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::NOT_AVAILABLE), toString(futureStatus.get()));
-}
-
-//##################################################################################################
-#ifndef WIN32
-class GDispatchWrapper: public GSource {
- public:
- GDispatchWrapper(CommonAPI::DispatchSource* dispatchSource): dispatchSource_(dispatchSource) {}
- CommonAPI::DispatchSource* dispatchSource_;
-};
-
-gboolean dispatchPrepare(GSource* source, gint* timeout) {
- (void)timeout;
- int64_t eventTimeout;
- return static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
-}
-
-gboolean dispatchCheck(GSource* source) {
- return static_cast<GDispatchWrapper*>(source)->dispatchSource_->check();
-}
-
-gboolean dispatchExecute(GSource* source, GSourceFunc callback, gpointer userData) {
- (void)callback;
- (void)userData;
- static_cast<GDispatchWrapper*>(source)->dispatchSource_->dispatch();
- return true;
-}
-
-gboolean gWatchDispatcher(GIOChannel *source, GIOCondition condition, gpointer userData) {
- (void)source;
- CommonAPI::Watch* watch = static_cast<CommonAPI::Watch*>(userData);
- watch->dispatch(condition);
- return true;
-}
-
-gboolean gTimeoutDispatcher(void* userData) {
- return static_cast<CommonAPI::DispatchSource*>(userData)->dispatch();
-}
-
-
-static GSourceFuncs standardGLibSourceCallbackFuncs = {
- dispatchPrepare,
- dispatchCheck,
- dispatchExecute,
- NULL,
- NULL,
- NULL
-};
-
-
-class DBusInGLibMainLoopTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- running_ = true;
-
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool) runtime_);
-
- context_ = std::make_shared<CommonAPI::MainLoopContext>();
- ASSERT_TRUE((bool) context_);
-
- doSubscriptions();
- }
-
- virtual void TearDown() {
- }
-
- void doSubscriptions() {
- context_->subscribeForTimeouts(
- std::bind(&DBusInGLibMainLoopTest::timeoutAddedCallback, this, std::placeholders::_1, std::placeholders::_2),
- std::bind(&DBusInGLibMainLoopTest::timeoutRemovedCallback, this, std::placeholders::_1)
- );
-
- context_->subscribeForWatches(
- std::bind(&DBusInGLibMainLoopTest::watchAddedCallback, this, std::placeholders::_1, std::placeholders::_2),
- std::bind(&DBusInGLibMainLoopTest::watchRemovedCallback, this, std::placeholders::_1)
- );
-
- context_->subscribeForWakeupEvents(
- std::bind(&DBusInGLibMainLoopTest::wakeupMain, this)
- );
- }
-
-
- public:
- std::shared_ptr<CommonAPI::MainLoopContext> context_;
- std::shared_ptr<CommonAPI::Runtime> runtime_;
- bool running_;
- static constexpr bool mayBlock_ = true;
-
- std::map<CommonAPI::DispatchSource*, GSource*> gSourceMappings;
-
- GIOChannel* dbusChannel_;
-
- void watchAddedCallback(CommonAPI::Watch* watch, const CommonAPI::DispatchPriority dispatchPriority) {
- (void)dispatchPriority;
- const pollfd& fileDesc = watch->getAssociatedFileDescriptor();
- dbusChannel_ = g_io_channel_unix_new(fileDesc.fd);
-
- GSource* gWatch = g_io_create_watch(dbusChannel_, static_cast<GIOCondition>(fileDesc.events));
- g_source_set_callback(gWatch, reinterpret_cast<GSourceFunc>(&gWatchDispatcher), watch, NULL);
-
- const auto& dependentSources = watch->getDependentDispatchSources();
- for (auto dependentSourceIterator = dependentSources.begin();
- dependentSourceIterator != dependentSources.end();
- dependentSourceIterator++) {
- GSource* gDispatchSource = g_source_new(&standardGLibSourceCallbackFuncs, sizeof(GDispatchWrapper));
- static_cast<GDispatchWrapper*>(gDispatchSource)->dispatchSource_ = *dependentSourceIterator;
-
- g_source_add_child_source(gWatch, gDispatchSource);
-
- gSourceMappings.insert( {*dependentSourceIterator, gDispatchSource} );
- }
- g_source_attach(gWatch, NULL);
- }
-
- void watchRemovedCallback(CommonAPI::Watch* watch) {
- g_source_remove_by_user_data(watch);
-
- if(dbusChannel_) {
- g_io_channel_unref(dbusChannel_);
- dbusChannel_ = NULL;
- }
-
- const auto& dependentSources = watch->getDependentDispatchSources();
- for (auto dependentSourceIterator = dependentSources.begin();
- dependentSourceIterator != dependentSources.end();
- dependentSourceIterator++) {
- g_source_new(&standardGLibSourceCallbackFuncs, sizeof(GDispatchWrapper));
- GSource* gSource = gSourceMappings.find(*dependentSourceIterator)->second;
- g_source_destroy(gSource);
- g_source_unref(gSource);
- }
- }
-
- void timeoutAddedCallback(CommonAPI::Timeout* commonApiTimeoutSource, const CommonAPI::DispatchPriority dispatchPriority) {
- (void)dispatchPriority;
- GSource* gTimeoutSource = g_timeout_source_new(guint(commonApiTimeoutSource->getTimeoutInterval()));
- g_source_set_callback(gTimeoutSource, &gTimeoutDispatcher, commonApiTimeoutSource, NULL);
- g_source_attach(gTimeoutSource, NULL);
- }
-
- void timeoutRemovedCallback(CommonAPI::Timeout* timeout) {
- g_source_remove_by_user_data(timeout);
- }
-
- void wakeupMain() {
- g_main_context_wakeup(NULL);
- }
-};
-
-
-TEST_F(DBusInGLibMainLoopTest, ProxyInGLibMainloopCanCallMethods) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress5, context_);
- ASSERT_TRUE((bool) proxy);
-
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress5, stub, "connection"));
-
- while(!proxy->isAvailable()) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- uint32_t uint32Value = 24;
- std::string stringValue = "Hai :)";
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- running_ = false;
- }
- );
-
- while(running_) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress5);
-}
-
-
-TEST_F(DBusInGLibMainLoopTest, ServiceInGLibMainloopCanBeAddressed) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress6, "connection");
- ASSERT_TRUE((bool) proxy);
-
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress6, stub, context_));
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Ciao (:";
-
- while(!proxy->isAvailable()) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- running_ = false;
- //Wakeup needed as the service will be in a poll-block when the client
- //call returns, and no other timeout is present to get him out of there.
- g_main_context_wakeup(NULL);
- }
- );
-
- while(running_) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress6);
-}
-
-
-TEST_F(DBusInGLibMainLoopTest, ProxyAndServiceInSameGlibMainloopCanCommunicate) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress7, context_);
- ASSERT_TRUE((bool) proxy);
-
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, testAddress7, stub, context_));
-
- uint32_t uint32Value = 42;
- std::string stringValue = "Ciao (:";
-
- while(!proxy->isAvailable()) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- std::future<CommonAPI::CallStatus> futureStatus = proxy->testVoidPredefinedTypeMethodAsync(
- uint32Value,
- stringValue,
- [&] (const CommonAPI::CallStatus& status) {
- EXPECT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(status));
- running_ = false;
- //Wakeup needed as the service will be in a poll-block when the client
- //call returns, and no other timeout is present to get him out of there.
- g_main_context_wakeup(NULL);
- }
- );
-
- while(running_) {
- g_main_context_iteration(NULL, mayBlock_);
- usleep(50000);
- }
-
- ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
-
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress7);
-}
-#endif
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusManagedTest.cpp b/src/test/DBusManagedTest.cpp
deleted file mode 100644
index dd964b5..0000000
--- a/src/test/DBusManagedTest.cpp
+++ /dev/null
@@ -1,1595 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-#ifndef _GLIBCXX_USE_NANOSLEEP
-#define _GLIBCXX_USE_NANOSLEEP
-#endif
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#define COMMONAPI_INTERNAL_COMPILATION
-#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusInputStream.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-
-#include <CommonAPI/ProxyManager.hpp>
-
-#include "v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp"
-#include "v1/commonapi/tests/managed/SecondRootStubDefault.hpp"
-
-#include "v1/commonapi/tests/managed/RootInterfaceProxy.hpp"
-#include "v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp"
-#include "v1/commonapi/tests/managed/LeafInterfaceProxy.hpp"
-
-#include "v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp"
-#include "v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp"
-
-#include <gtest/gtest.h>
-#include <algorithm>
-#include <array>
-#include <memory>
-
-#define VERSION v1_0
-
-static const std::string serviceConnectionId = "managed-test-service";
-static const std::string clientConnectionId = "managed-test-client";
-static const std::string clientConnectionId2 = "managed-test-client2";;
-
-static const std::string domain = "local";
-
-static const std::string instanceNameBase = "commonapi.tests.managed";
-static const std::string objectPathBase = "/commonapi/tests/managed";
-
-//Root
-static const std::string rootInterfaceName = VERSION::commonapi::tests::managed::RootInterfaceStubDefault::StubInterface::getInterface();
-static const std::string rootInstanceName = instanceNameBase + ".RootInterface";
-static const std::string rootDbusServiceName = rootInterfaceName + "_" + rootInstanceName;
-static const std::string rootDbusObjectPath = objectPathBase + "/RootInterface";
-
-//SecondRoot
-static const std::string secondRootInterfaceName = VERSION::commonapi::tests::managed::SecondRootStubDefault::StubInterface::getInterface();
-static const std::string secondRootInstanceName = instanceNameBase + ".SecondRoot";
-static const std::string secondRootDbusServiceName = secondRootInterfaceName + "_" + secondRootInstanceName;
-static const std::string secondRootDbusObjectPath = objectPathBase + "/SecondRoot";
-
-//Leaf
-static const std::string leafInterfaceName = VERSION::commonapi::tests::managed::LeafInterfaceStubDefault::StubInterface::getInterface();
-
-//Leaf based on Root
-static const std::string leafInstanceNameRoot = rootInstanceName + ".LeafInterface";
-static const std::string leafDbusServiceNameRoot = leafInterfaceName + "_" + leafInstanceNameRoot;
-static const std::string leafDbusObjectPathRoot = rootDbusObjectPath + "/LeafInterface";
-
-//Leaf based on SecondRoot
-static const std::string leafInstanceNameSecondRoot = secondRootInstanceName + ".LeafInterface";
-static const std::string leafDbusObjectPathSecondRoot = secondRootDbusObjectPath + "/LeafInterface";
-
-//Branch
-static const std::string branchInterfaceName = VERSION::commonapi::tests::managed::BranchInterfaceStubDefault::StubInterface::getInterface();
-static const std::string branchInstanceNameRoot = rootInstanceName + ".BranchInterface";
-static const std::string branchDbusServiceNameRoot = branchInterfaceName + "_" + branchInstanceNameRoot;
-static const std::string branchDbusObjectPathRoot = rootDbusObjectPath + "/BranchInterface";
-
-
-const CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict getManagedObjects(const std::string& _dbusServiceName, const std::string& _dbusObjectPath,
- std::shared_ptr<CommonAPI::DBus::DBusConnection> _connection) {
- auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- CommonAPI::DBus::DBusAddress(_dbusServiceName, _dbusObjectPath, CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName()),
- "GetManagedObjects");
-
- CommonAPI::DBus::DBusError dbusError;
- CommonAPI::CallInfo info(1000);
- auto dbusMessageReply = _connection->sendDBusMessageWithReplyAndBlock(dbusMessageCall, dbusError, &info);
-
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
- if(!dbusMessageReply)
- return dbusObjectPathAndInterfacesDict;
-
- CommonAPI::DBus::DBusInputStream dbusInputStream(dbusMessageReply);
-
- dbusInputStream >> dbusObjectPathAndInterfacesDict;
-
- return dbusObjectPathAndInterfacesDict;
-}
-
-bool isManaged(const std::string& _objectPath, const std::string& _interfaceName,
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dbusObjectPathAndInterfacesDict)
-{
- for(auto objectPathDict : dbusObjectPathAndInterfacesDict)
- {
- std::string objectPath = objectPathDict.first;
- if(objectPath != _objectPath)
- continue;
- CommonAPI::DBus::DBusObjectManagerStub::DBusInterfacesAndPropertiesDict interfacesAndPropertiesDict = objectPathDict.second;
- for(auto interfaceDict : interfacesAndPropertiesDict)
- {
- std::string interfaceName = interfaceDict.first;
- if(interfaceName == _interfaceName)
- return true;
- }
- }
- return false;
-}
-
-class DBusManagedTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- leafStatus_ = CommonAPI::AvailabilityStatus::UNKNOWN;
- runtime_ = CommonAPI::Runtime::get();
-
- manualDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "manualConnection");
- ASSERT_TRUE(manualDBusConnection_->connect(false));
- }
-
- virtual void TearDown() {
- manualDBusConnection_->disconnect();
- manualDBusConnection_.reset();
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> manualDBusConnection_;
-
- CommonAPI::AvailabilityStatus leafStatus_;
-
-public:
- void managedObjectSignalled(std::string address, CommonAPI::AvailabilityStatus status) {
- (void)address;
- leafStatus_ = status;
- }
-};
-
-TEST_F(DBusManagedTest, RegisterRoot) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTest, RegisterLeafUnmanaged) {
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, leafInstanceNameRoot, leafStub, serviceConnectionId));
-
- //check that leaf is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceNameRoot,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- runtime_->unregisterService(domain, leafInterfaceName, leafInstanceNameRoot);
-
- //check that leaf is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceNameRoot,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTest, RegisterLeafManaged) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager& proxyManagerLeafInterface = rootProxy->getProxyManagerLeafInterface();
- proxyManagerLeafInterface.getInstanceAvailabilityStatusChangedEvent().subscribe(
- std::bind(&DBusManagedTest::managedObjectSignalled,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
-
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::AVAILABLE);
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- ASSERT_TRUE(rootStub->deregisterManagedStubLeafInterface(leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::NOT_AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeaf) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName , rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "test");
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager& proxyManagerLeafInterface = rootProxy->getProxyManagerLeafInterface();
- proxyManagerLeafInterface.getInstanceAvailabilityStatusChangedEvent().subscribe(
- std::bind(&DBusManagedTest::managedObjectSignalled,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::AVAILABLE);
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto leafProxy = proxyManagerLeafInterface.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(leafInstanceNameRoot);
- for (uint32_t i = 0; !leafProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
-
- ASSERT_TRUE(leafProxy->isAvailable());
-
- CommonAPI::CallStatus callStatus;
- VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
- int outInt;
- std::string outString;
- leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
-
- ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
-
- ASSERT_TRUE(rootStub->deregisterManagedStubLeafInterface(leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::NOT_AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- ASSERT_TRUE(runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName));
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTest, RegisterLeafManagedAndCreateProxyForLeafInCallback) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName , rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "test");
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- std::condition_variable proxyCondVar;
- bool proxyCallsSuccessful = false;
-
- CommonAPI::ProxyManager& proxyManagerLeafInterface = rootProxy->getProxyManagerLeafInterface();
- proxyManagerLeafInterface.getInstanceAvailabilityStatusChangedEvent().subscribe(
- [&](const std::string instanceName, CommonAPI::AvailabilityStatus availabilityStatus) {
- (void)instanceName;
-
- if(availabilityStatus == CommonAPI::AvailabilityStatus::AVAILABLE) {
- leafStatus_ = CommonAPI::AvailabilityStatus::AVAILABLE;
-
- auto leafProxy = proxyManagerLeafInterface.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(leafInstanceNameRoot, clientConnectionId2);
- for (uint32_t i = 0; !leafProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
-
- ASSERT_TRUE(leafProxy->isAvailable());
-
- CommonAPI::CallStatus callStatus;
- VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
- int outInt;
- std::string outString;
- leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
-
- ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
-
- proxyCallsSuccessful = true;
- proxyCondVar.notify_one();
-
- } else if(availabilityStatus == CommonAPI::AvailabilityStatus::NOT_AVAILABLE) {
- leafStatus_ = CommonAPI::AvailabilityStatus::NOT_AVAILABLE;
- }
- });
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::AVAILABLE);
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- std::mutex m;
- std::unique_lock<std::mutex> lock(m);
- std::chrono::milliseconds timeout(2000);
-
- proxyCondVar.wait_for(lock, timeout);
- ASSERT_TRUE(proxyCallsSuccessful);
-
- ASSERT_TRUE(rootStub->deregisterManagedStubLeafInterface(leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::NOT_AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- ASSERT_TRUE(runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName));
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-
-}
-
-TEST_F(DBusManagedTest, PropagateTeardown) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager& proxyManagerLeafInterface = rootProxy->getProxyManagerLeafInterface();
- proxyManagerLeafInterface.getInstanceAvailabilityStatusChangedEvent().subscribe(
- std::bind(&DBusManagedTest::managedObjectSignalled,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceNameRoot));
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::AVAILABLE);
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto leafProxy = proxyManagerLeafInterface.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(leafInstanceNameRoot);
-
- for (uint32_t i = 0; !leafProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
-
- ASSERT_TRUE(leafProxy->isAvailable());
-
- CommonAPI::CallStatus callStatus;
- VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
- int outInt;
- std::string outString;
- leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
-
- ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- for (uint32_t i = 0; leafStatus_ != CommonAPI::AvailabilityStatus::NOT_AVAILABLE && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(leafStatus_ == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root is still registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-class DBusManagedTestExtended: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
-
- leafInstanceAvailability = CommonAPI::AvailabilityStatus::UNKNOWN;
- branchInstanceAvailability = CommonAPI::AvailabilityStatus::UNKNOWN;
-
- manualDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "manualConnection");
- ASSERT_TRUE(manualDBusConnection_->connect(false));
- }
-
- virtual void TearDown() {
- manualDBusConnection_->disconnect();
- manualDBusConnection_.reset();
- }
-
- inline const std::string getSuffixedRootInstanceName(const std::string& suffix) {
- return rootInstanceName + suffix;
- }
-
- inline bool registerRootStubForSuffix(const std::string& suffix) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- const std::string instanceName = getSuffixedRootInstanceName(suffix);
- bool registered = runtime_->registerService(domain, instanceName, rootStub, serviceConnectionId);
-
- if(registered)
- rootStubs_.insert( { instanceName, rootStub });
-
- return registered;
- }
-
- inline bool unregisterRootForSuffix(const std::string& suffix) {
- const std::string instanceName = getSuffixedRootInstanceName(suffix);
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceStubDefault> rootStub = rootStubs_.find(instanceName)->second;
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- bool unregistered = runtime_->unregisterService(domain, rootInterfaceName, instanceName);
-
- if(unregistered)
- rootStubs_.erase(instanceName);
-
- return unregistered;
- }
-
- inline void createRootProxyForSuffix(const std::string& suffix) {
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, getSuffixedRootInstanceName(suffix), rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
- rootProxy->init();
- rootProxies_.push_back(rootProxy);
- }
-
- template<typename _ProxyType>
- bool waitForAllProxiesToBeAvailable(const std::vector<_ProxyType>& dbusProxies) {
- bool allAreAvailable = false;
- for (size_t i = 0; i < 500 && !allAreAvailable; i++) {
- allAreAvailable = std::all_of(dbusProxies.begin(),
- dbusProxies.end(),
- [](const _ProxyType& proxy) {
- return proxy->isAvailable();
- });
- usleep(10 * 1000);
- }
- return allAreAvailable;
- }
-
- bool registerXLeafStubsForAllRoots(uint32_t x) {
- bool success = true;
- bool expectedValueForRegistration = true;
- for (auto rootStubIterator: rootStubs_) {
- for (uint32_t i = 0; i < x; i++) {
- std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault> leafStub = std::make_shared<
- VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- success &= (rootStubIterator.second->registerManagedStubLeafInterfaceAutoInstance(leafStub) == expectedValueForRegistration);
- }
- //As all root interfaces are registered on the same object path, the leaf interfaces also will be registered with
- //this same object path as base. The first set of leaf interfaces therefore will be registered successfully.
- //The second and third set of leaf interfaces use a different object manager that does not know about the already
- //registered leaf interfaces, and therefore tries to register the same names on the same object paths again.
- //As of now, this will fail.
- expectedValueForRegistration = false;
- }
- return success;
- }
-
- void createXLeafProxiesForAllExistingLeafs() {
- for (auto rootProxyIterator : rootProxies_) {
- std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceProxyDefault>> leafProxiesForRootX;
-
- CommonAPI::ProxyManager& leafProxyManager = rootProxyIterator->getProxyManagerLeafInterface();
- std::vector<std::string> availableInstances;
- CommonAPI::CallStatus status;
- leafProxyManager.getAvailableInstances(status, availableInstances);
-
- for (const std::string& availableInstance : availableInstances) {
- auto newLeafProxy = leafProxyManager.buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(availableInstance);
- leafProxiesForRootX.push_back(newLeafProxy);
- }
- leafProxies_.push_back(std::move(leafProxiesForRootX));
- }
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> manualDBusConnection_;
-
- std::unordered_map<std::string, std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>> rootStubs_;
- std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>> rootProxies_;
- std::vector<std::vector<std::shared_ptr<VERSION::commonapi::tests::managed::LeafInterfaceProxyDefault>>> leafProxies_;
-
- CommonAPI::AvailabilityStatus leafInstanceAvailability;
- CommonAPI::AvailabilityStatus branchInstanceAvailability;
-public:
- void onLeafInstanceAvailabilityStatusChanged(const std::string instanceName, CommonAPI::AvailabilityStatus availabilityStatus) {
- (void)instanceName;
- leafInstanceAvailability = availabilityStatus;
- }
-
- void onBranchInstanceAvailabilityStatusChanged(const std::string instanceName, CommonAPI::AvailabilityStatus availabilityStatus) {
- (void)instanceName;
- branchInstanceAvailability = availabilityStatus;
- }
-};
-
-/*
- * Test fails. Registering several roots on same object path is not possible.
- */
-TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsOnSameObjectPath) {
-
- /* set environment variable (default config: commonapi-dbus.ini) to
- * to register the roots on the same object path
- */
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- ASSERT_TRUE(registerRootStubForSuffix("One"));
- ASSERT_TRUE(registerRootStubForSuffix("Two"));
- ASSERT_TRUE(registerRootStubForSuffix("Three"));
-
- const std::string dbusServiceNameBase = "commonapi.tests.managed.roots.on.same.object.path";
-
- //check that root one is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root two is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root three is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- ASSERT_TRUE(unregisterRootForSuffix("One"));
- ASSERT_TRUE(unregisterRootForSuffix("Two"));
- ASSERT_TRUE(unregisterRootForSuffix("Three"));
-
- //check that root one is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root two is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root three is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
-}
-
-/*
- * Test fails. Registering several roots on same object path is not possible.
- */
-TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsOnSameObjectPathAndCommunicate) {
-
- /* set environment variable (default config: commonapi-dbus.ini) to
- * to register the roots on the same object path
- */
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- ASSERT_TRUE(registerRootStubForSuffix("One"));
- ASSERT_TRUE(registerRootStubForSuffix("Two"));
- ASSERT_TRUE(registerRootStubForSuffix("Three"));
-
- const std::string dbusServiceNameBase = "commonapi.tests.managed.roots.on.same.object.path";
-
- //check that root one is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root two is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root three is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- createRootProxyForSuffix("One");
- createRootProxyForSuffix("Two");
- createRootProxyForSuffix("Three");
-
- bool allRootProxiesAreAvailable = waitForAllProxiesToBeAvailable(rootProxies_);
- ASSERT_TRUE(allRootProxiesAreAvailable);
-
- CommonAPI::CallStatus callStatus;
- CommonAPI::CallInfo *info = NULL;
- VERSION::commonapi::tests::managed::RootInterface::testRootMethodError applicationError;
- int32_t outInt;
- std::string outString;
-
- for (size_t i = 0; i < rootProxies_.size(); ++i) {
- rootProxies_[i]->testRootMethod(-5,
- std::string("More Cars"),
- callStatus,
- applicationError,
- outInt,
- outString,
- info);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, callStatus);
- }
-
- ASSERT_TRUE(unregisterRootForSuffix("One"));
- ASSERT_TRUE(unregisterRootForSuffix("Two"));
- ASSERT_TRUE(unregisterRootForSuffix("Three"));
-
- //check that root one is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root two is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root three is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- rootProxies_.clear();
-}
-
-/*
- * Test fails. Registering several roots on same object path is not possible.
- */
-TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsAndSeveralLeafsForEachOnSameObjectPath) {
-
- /* set environment variable (default config: commonapi-dbus.ini) to
- * to register the roots on the same object path
- */
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- ASSERT_TRUE(registerRootStubForSuffix("One"));
- ASSERT_TRUE(registerRootStubForSuffix("Two"));
- ASSERT_TRUE(registerRootStubForSuffix("Three"));
-
- const std::string dbusServiceNameBase = "commonapi.tests.managed.roots.on.same.object.path";
-
- //check that root one is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root two is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that root three is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- bool allLeafStubsWereRegistered = registerXLeafStubsForAllRoots(5);
- ASSERT_TRUE(allLeafStubsWereRegistered);
-
- //TODO check if leafs were registered
-
- ASSERT_TRUE(unregisterRootForSuffix("One"));
- ASSERT_TRUE(unregisterRootForSuffix("Two"));
- ASSERT_TRUE(unregisterRootForSuffix("Three"));
-
- //check that root one is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root two is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root three is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three","/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-/*
- * Test fails. Registering several roots on same object path is not possible.
- */
-TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsAndSeveralLeafsForEachOnSameObjectPathAndCommunicate) {
-
- /* set environment variable (default config: commonapi-dbus.ini) to
- * to register the roots on the same object path
- */
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- ASSERT_TRUE(registerRootStubForSuffix("One"));
- ASSERT_TRUE(registerRootStubForSuffix("Two"));
- ASSERT_TRUE(registerRootStubForSuffix("Three"));
-
- const std::string dbusServiceNameBase = "commonapi.tests.managed.roots.on.same.object.path";
-
- //check that root one is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One", "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName,dbusObjectPathAndInterfacesDict));
-
- //check that root two is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two", "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName,dbusObjectPathAndInterfacesDict));
-
- //check that root three is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three", "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName,dbusObjectPathAndInterfacesDict));
-
- createRootProxyForSuffix("One");
- createRootProxyForSuffix("Two");
- createRootProxyForSuffix("Three");
-
- bool allRootProxiesAreAvailable = waitForAllProxiesToBeAvailable(rootProxies_);
- ASSERT_TRUE(allRootProxiesAreAvailable);
-
- bool allLeafStubsWereRegistered = registerXLeafStubsForAllRoots(5);
- ASSERT_TRUE(allLeafStubsWereRegistered);
-
- //TODO check if leafs were registered
-
- createXLeafProxiesForAllExistingLeafs();
-
- usleep(50000);
-
- ASSERT_EQ(3, leafProxies_.size());
-
- uint32_t runNr = 1;
- for (const auto& leafProxiesForCurrentRoot : leafProxies_) {
- ASSERT_EQ(5, leafProxiesForCurrentRoot.size())<< "in run #" << runNr++;
-
- bool allLeafProxiesForCurrentRootAreAvailable = waitForAllProxiesToBeAvailable(leafProxiesForCurrentRoot);
- ASSERT_TRUE(allLeafProxiesForCurrentRootAreAvailable);
-
- ++runNr;
- }
-
- ASSERT_TRUE(unregisterRootForSuffix("One"));
- ASSERT_TRUE(unregisterRootForSuffix("Two"));
- ASSERT_TRUE(unregisterRootForSuffix("Three"));
-
- //check that root one is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".One", "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root two is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Two", "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that root three is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(dbusServiceNameBase + ".Three", "/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- rootProxies_.clear();
- leafProxies_.clear();
-}
-
-TEST_F(DBusManagedTestExtended, RegisterTwoRootsForSameLeafInterface) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto secondRootStub = std::make_shared<VERSION::commonapi::tests::managed::SecondRootStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, secondRootInstanceName, secondRootStub));
-
- //check that second root is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(secondRootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(secondRootDbusObjectPath, secondRootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto leafStub1 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto leafStub2 = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
-
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub1, leafInstanceNameRoot));
- ASSERT_TRUE(secondRootStub->registerManagedStubLeafInterface(leafStub2, leafInstanceNameSecondRoot));
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that second root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(secondRootDbusServiceName, secondRootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathSecondRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
- secondRootStub->getStubAdapter()->deactivateManagedInstances();
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that second root no longer manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(secondRootDbusServiceName, secondRootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
- runtime_->unregisterService(domain, secondRootInterfaceName, secondRootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that second root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(secondRootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootManaged) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& leafInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerLeafInterface().getInstanceAvailabilityStatusChangedEvent();
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& branchInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerBranchInterface().getInstanceAvailabilityStatusChangedEvent();
-
- leafInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onLeafInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
- branchInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onBranchInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto branchStub = std::make_shared<VERSION::commonapi::tests::managed::BranchInterfaceStubDefault>();
-
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceNameRoot));
-
- usleep(50000);
-
- ASSERT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, leafInstanceAvailability);
-
- // check that event for branch instances is not triggered by leaf instances
- ASSERT_NE(CommonAPI::AvailabilityStatus::AVAILABLE, branchInstanceAvailability);
-
- ASSERT_TRUE(rootStub->registerManagedStubBranchInterface(branchStub, branchInstanceNameRoot));
-
- usleep(50000);
-
- ASSERT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, branchInstanceAvailability);
-
- //check that root manages leaf and branch
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
- ASSERT_TRUE(isManaged(branchDbusObjectPathRoot, branchInterfaceName, dbusObjectPathAndInterfacesDict));
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- usleep(50000);
-
- ASSERT_TRUE(leafInstanceAvailability == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
- ASSERT_TRUE(branchInstanceAvailability == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf and branch
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTestExtended, RegisterLeafsWithDistinctInterfacesOnSameRootUnmanaged) {
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& leafInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerLeafInterface().getInstanceAvailabilityStatusChangedEvent();
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& branchInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerBranchInterface().getInstanceAvailabilityStatusChangedEvent();
-
- leafInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onLeafInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
- branchInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onBranchInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- runtime_->registerService(domain, leafInstanceNameRoot, leafStub, serviceConnectionId);
-
- auto branchStub = std::make_shared<VERSION::commonapi::tests::managed::BranchInterfaceStubDefault>();
- runtime_->registerService(domain, branchInstanceNameRoot, branchStub, serviceConnectionId);
-
- usleep(50000);
-
- // check, that events do not get triggered by unmanaged registration
- ASSERT_EQ(CommonAPI::AvailabilityStatus::UNKNOWN, leafInstanceAvailability);
- ASSERT_EQ(CommonAPI::AvailabilityStatus::UNKNOWN, branchInstanceAvailability);
-
- //check that root don't manages leaf and branch
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that leaf is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceNameRoot, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that branch is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(branchDbusServiceNameRoot, "/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(branchDbusObjectPathRoot, branchInterfaceName, dbusObjectPathAndInterfacesDict));
-
- runtime_->unregisterService(domain, leafInterfaceName, leafInstanceNameRoot);
- runtime_->unregisterService(domain, branchInterfaceName, branchInstanceNameRoot);
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that leaf is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceNameRoot,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that branch is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(branchDbusServiceNameRoot,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTestExtended, RegisterInvalidChildInstance)
-{
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto invalidLeafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
-
- const std::string invalidLeafInstanceName = instanceNameBase + ".InvalidInterface.LeafInterface";
- const std::string invalidLeafDbusServiceName = leafInterfaceName + "_" + invalidLeafInstanceName;
-
- ASSERT_FALSE(rootStub->registerManagedStubLeafInterface(invalidLeafStub, invalidLeafInstanceName));
-
- //check that root doesn't manage invalid leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that invalid leaf is not registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(invalidLeafDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTestExtended, RegsiterInvalidChildInstanceAndValidChildInstances)
-{
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& leafInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerLeafInterface().getInstanceAvailabilityStatusChangedEvent();
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& branchInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerBranchInterface().getInstanceAvailabilityStatusChangedEvent();
-
- leafInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onLeafInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
- branchInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onBranchInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto validLeafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto invalidLeafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- auto validBranchStub = std::make_shared<VERSION::commonapi::tests::managed::BranchInterfaceStubDefault>();
-
- const std::string invalidLeafInstanceName = instanceNameBase + ".InvalidInterface.LeafInterface";
- const std::string invalidLeafDbusServiceName = leafInterfaceName + "_" + invalidLeafInstanceName;
- const std::string invalidLeafDbusObjectPath = objectPathBase + "/InvalidInterface/LeafInterface";
-
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(validLeafStub, leafInstanceNameRoot));
-
- usleep(50000);
-
- ASSERT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, leafInstanceAvailability);
-
- ASSERT_FALSE(rootStub->registerManagedStubLeafInterface(invalidLeafStub, invalidLeafInstanceName));
-
- //check that root doesn't manage invalid leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_FALSE(isManaged(invalidLeafDbusObjectPath, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- //check that invalid leaf is not registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(invalidLeafDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- ASSERT_TRUE(rootStub->registerManagedStubBranchInterface(validBranchStub, branchInstanceNameRoot));
-
- usleep(50000);
-
- ASSERT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, branchInstanceAvailability);
-
- //check that root manages valid leaf and valid branch
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPathRoot, leafInterfaceName, dbusObjectPathAndInterfacesDict));
- ASSERT_TRUE(isManaged(branchDbusObjectPathRoot, branchInterfaceName, dbusObjectPathAndInterfacesDict));
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- usleep(50000);
-
- ASSERT_TRUE(leafInstanceAvailability == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
- ASSERT_TRUE(branchInstanceAvailability == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf and branch
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTestExtended, ReegisterLeafsWithAutoGeneratedInstanceIds)
-{
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- int numberOfAutoGeneratedInstances = 5;
- for(int i=0; i<numberOfAutoGeneratedInstances; i++)
- {
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterfaceAutoInstance(leafStub));
- }
-
- //check that root manages the auto generated leafs
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE((int)dbusObjectPathAndInterfacesDict.size() == numberOfAutoGeneratedInstances);
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- //check that root doesn't manage the auto generated leafs anymore
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTestExtended, RegisterLeafsWithAutoGeneratedInstanceIdsAndCommunicate)
-{
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
- int numberOfAutoGeneratedInstances = 5;
- for(int i=0; i<numberOfAutoGeneratedInstances; i++)
- {
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterfaceAutoInstance(leafStub));
- }
-
- //check that root manages the auto generated leafs
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE((int)dbusObjectPathAndInterfacesDict.size() == numberOfAutoGeneratedInstances);
-
- for(int i=0; i<numberOfAutoGeneratedInstances; i++)
- {
- const std::string autoGeneratedInstanceName = rootInstanceName + ".i" + std::to_string(i + 1);
- auto leafProxy = rootProxy->getProxyManagerLeafInterface().buildProxy<VERSION::commonapi::tests::managed::LeafInterfaceProxy>(autoGeneratedInstanceName);
-
- for (uint32_t i = 0; !leafProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
-
- ASSERT_TRUE(leafProxy->isAvailable());
-
- CommonAPI::CallStatus callStatus;
- VERSION::commonapi::tests::managed::LeafInterface::testLeafMethodError error;
- int outInt;
- std::string outString;
- leafProxy->testLeafMethod(42, "Test", callStatus, error, outInt, outString);
-
- ASSERT_TRUE(callStatus == CommonAPI::CallStatus::SUCCESS);
- }
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- //check that root doesn't manage the auto generated leafs anymore
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceUnmanaged) {
-
- //set environment variable (default config: commonapi-dbus.ini)
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
-
- //match with declared addresses in commonapi-dbus.ini
- const std::string leafInstanceName = "commonapi.tests.managed.config.affects.LeafInterface.Unmanaged";
- const std::string leafDbusServiceName = "commonapi.tests.managed.config.affects.interface.unmanaged";
- const std::string leafDbusObjectPath = "/commonapi/tests/managed/RootInterface/LeafInterface/Unmanaged";
-
- ASSERT_TRUE(runtime_->registerService(domain, leafInstanceName, leafStub, serviceConnectionId));
-
- //check that leaf is registered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPath, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
- runtime_->unregisterService(domain, leafInterfaceName, leafInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- //check that leaf is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(leafDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceManaged) {
-
- //set environment variable (default config: commonapi-dbus.ini)
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
- ASSERT_TRUE(defaultConfigSet);
-
- auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
- ASSERT_TRUE(runtime_->registerService(domain, rootInstanceName, rootStub, serviceConnectionId));
-
- //check that root is registered
- auto dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(rootDbusObjectPath, rootInterfaceName, dbusObjectPathAndInterfacesDict));
-
- CommonAPI::DBus::DBusAddress rootDBusAddress;
- CommonAPI::Address rootCommonAPIAddress(domain, rootInstanceName, rootInterfaceName);
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(rootCommonAPIAddress, rootDBusAddress);
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, clientConnectionId);
- proxyConnection->connect();
-
- std::shared_ptr<VERSION::commonapi::tests::managed::RootInterfaceDBusProxy> rootProxy = std::make_shared<
- VERSION::commonapi::tests::managed::RootInterfaceDBusProxy>(
- rootDBusAddress,
- proxyConnection
- );
-
- rootProxy->init();
-
- for (uint32_t i = 0; !rootProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- ASSERT_TRUE(rootProxy->isAvailable());
-
- CommonAPI::ProxyManager::InstanceAvailabilityStatusChangedEvent& leafInstanceAvailabilityStatusEvent =
- rootProxy->getProxyManagerLeafInterface().getInstanceAvailabilityStatusChangedEvent();
-
- leafInstanceAvailabilityStatusEvent.subscribe(
- std::bind(&DBusManagedTestExtended::onLeafInstanceAvailabilityStatusChanged,
- this,
- std::placeholders::_1,
- std::placeholders::_2));
-
- auto leafStub = std::make_shared<VERSION::commonapi::tests::managed::LeafInterfaceStubDefault>();
-
- //match with declared addresses in commonapi-dbus.ini
- const std::string leafInstanceName = "commonapi.tests.managed.config.affects.LeafInterface.Managed";
- const std::string leafDbusServiceName = "commonapi.tests.managed.config.affects.interface.managed";
- const std::string leafDbusObjectPath = "/commonapi/tests/managed/RootInterface/LeafInterface/Managed";
-
- ASSERT_TRUE(rootStub->registerManagedStubLeafInterface(leafStub, leafInstanceName));
-
- usleep(50000);
-
- ASSERT_EQ(CommonAPI::AvailabilityStatus::AVAILABLE, leafInstanceAvailability);
-
- //check that root manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_TRUE(isManaged(leafDbusObjectPath, leafInterfaceName, dbusObjectPathAndInterfacesDict));
-
- rootStub->getStubAdapter()->deactivateManagedInstances();
-
- usleep(50000);
-
- ASSERT_TRUE(leafInstanceAvailability == CommonAPI::AvailabilityStatus::NOT_AVAILABLE);
-
- //check that root no longer manages leaf
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName, rootDbusObjectPath, manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- runtime_->unregisterService(domain, rootInterfaceName, rootInstanceName);
-
- //check that root is unregistered
- dbusObjectPathAndInterfacesDict.clear();
- dbusObjectPathAndInterfacesDict = getManagedObjects(rootDbusServiceName,"/", manualDBusConnection_);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- proxyConnection->disconnect();
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusMultipleConnectionTest.cpp b/src/test/DBusMultipleConnectionTest.cpp
deleted file mode 100644
index dc417f5..0000000
--- a/src/test/DBusMultipleConnectionTest.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cassert>
-#include <cstdint>
-#include <iostream>
-#include <functional>
-#include <memory>
-#include <stdint.h>
-#include <string>
-#include <utility>
-#include <tuple>
-#include <type_traits>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#define VERSION v1_0
-
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-
-const std::string domain = "local";
-const std::string serviceAddress = "commonapi.tests.TestInterface";
-
-class DBusMultipleConnectionTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime = CommonAPI::Runtime::get();
- stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- bool serviceNameAcquired = runtime->registerService(domain, serviceAddress, stub, "connection");
-
- for(unsigned int i = 0; !serviceNameAcquired && i < 100; i++) {
- usleep(10000);
- serviceNameAcquired = runtime->registerService(domain, serviceAddress, stub, "connection");
- }
- ASSERT_TRUE(serviceNameAcquired);
-
- proxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, serviceAddress);
- ASSERT_TRUE((bool)proxy);
-
- for(unsigned int i = 0; !proxy->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- }
-
- virtual void TearDown() {
- runtime->unregisterService(domain, stub->getStubAdapter()->getInterface(), serviceAddress);
- usleep(30000);
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxy;
-};
-
-
-TEST_F(DBusMultipleConnectionTest, RemoteMethodCall) {
- uint32_t v1 = 5;
- std::string v2 = "Hai :)";
- CommonAPI::CallStatus stat;
- proxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, stat);
-}
-
-TEST_F(DBusMultipleConnectionTest, Broadcast) {
- uint32_t v1 = 5;
- uint32_t v3 = 0;
- std::string v2 = "Hai :)";
-
- std::promise<bool> promise;
- auto future = promise.get_future();
-
- auto subscription = proxy->getTestPredefinedTypeBroadcastEvent().subscribe([&](
- const uint32_t intVal, const std::string& strVal) {
- (void)strVal;
- v3 = intVal;
- promise.set_value(true);
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(v1, v2);
-
- ASSERT_TRUE(future.get());
- ASSERT_EQ(v1, v3);
-
- proxy->getTestPredefinedTypeBroadcastEvent().unsubscribe(subscription);
-}
-
-TEST_F(DBusMultipleConnectionTest, SetAttribute) {
- uint32_t v1 = 5;
- uint32_t v2;
- CommonAPI::CallStatus stat;
- proxy->getTestPredefinedTypeAttributeAttribute().setValue(v1, stat, v2);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, stat);
- ASSERT_EQ(v1, v2);
-}
-
-TEST_F(DBusMultipleConnectionTest, SetAttributeBroadcast) {
- uint32_t v1 = 6;
- uint32_t v2;
- uint32_t v3 = 0;
- bool initial = true;
-
- std::promise<bool> promise;
- auto future = promise.get_future();
-
- auto subscription = proxy->getTestPredefinedTypeAttributeAttribute().getChangedEvent().subscribe([&](
- const uint32_t intVal) {
- // this subscription is called twice. Ignore the first call (the initial value).
- if (initial) {
- initial = false;
- return;
- }
- v3 = intVal;
- promise.set_value(true);
- });
-
- CommonAPI::CallStatus stat;
- proxy->getTestPredefinedTypeAttributeAttribute().setValue(v1, stat, v2);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, stat);
- ASSERT_EQ(v1, v2);
-
- ASSERT_TRUE(future.get());
- ASSERT_EQ(v1, v3);
-
- proxy->getTestPredefinedTypeAttributeAttribute().getChangedEvent().unsubscribe(subscription);
-}
-
-
-TEST_F(DBusMultipleConnectionTest, GetAttribute) {
- uint32_t v1;
- CommonAPI::CallStatus status;
- proxy->getTestPredefinedTypeAttributeAttribute().getValue(status, v1);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusOutputStreamTest.cpp b/src/test/DBusOutputStreamTest.cpp
deleted file mode 100644
index 1e58699..0000000
--- a/src/test/DBusOutputStreamTest.cpp
+++ /dev/null
@@ -1,855 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <dbus/dbus.h>
-#include <gtest/gtest.h>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusMessage.hpp>
-#include <CommonAPI/DBus/DBusOutputStream.hpp>
-#include <CommonAPI/DBus/DBusInputStream.hpp>
-#include <CommonAPI/Struct.hpp>
-#include <CommonAPI/Variant.hpp>
-
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-
-class OutputStreamTest: public ::testing::Test {
-protected:
- size_t numOfElements;
- CommonAPI::DBus::DBusMessage message;
- const char* busName;
- const char* objectPath;
- const char* interfaceName;
- const char* methodName;
-
- void SetUp() {
- numOfElements = 10;
- busName = "no.bus.here";
- objectPath = "/no/object/here";
- interfaceName = "no.interface.here";
- methodName = "noMethodHere";
- }
-
- void TearDown() {
- }
-};
-
-TEST_F(OutputStreamTest, CanBeConstructed) {
- CommonAPI::DBus::DBusOutputStream outStream(message);
-}
-
-TEST_F(OutputStreamTest, WritesBytes) {
- const char signature[] = "yyyyyyyyyy";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements);
- uint8_t val1 = 0xff;
- uint8_t val2 = 0x00;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- uint8_t verifyVal1;
- uint8_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesBools) {
- const char signature[] = "bbbbbbbbbb";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 4);
- bool val1 = TRUE;
- bool val2 = FALSE;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*4, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- bool verifyVal1;
- bool verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesUInt16) {
- const char signature[] = "qqqqqqqqqq";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 2);
- uint16_t val1 = 0x0000;
- uint16_t val2 = 0xffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*2, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- uint16_t verifyVal1;
- uint16_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesInt16) {
- const char signature[] = "nnnnnnnnnn";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 2);
- int16_t val1 = static_cast<int16_t>(0x7fff);
- int16_t val2 = static_cast<int16_t>(0xffff);
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*2, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- int16_t verifyVal1;
- int16_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesUInt32) {
- const char signature[] = "uuuuuuuuuu";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 4);
- uint32_t val1 = 0x00000000;
- uint32_t val2 = 0xffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*4, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- uint32_t verifyVal1;
- uint32_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesInt32) {
- const char signature[] = "iiiiiiiiii";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 4);
- int32_t val1 = 0x7fffffff;
- int32_t val2 = 0xffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*4, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- int32_t verifyVal1;
- int32_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesUInt64) {
- const char signature[] = "tttttttttt";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 8);
- uint64_t val1 = 0x0000000000000000;
- uint64_t val2 = 0xffffffffffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*8, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- uint64_t verifyVal1;
- uint64_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesInt64) {
- const char signature[] = "xxxxxxxxxx";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 8);
- int64_t val1 = 0x7fffffffffffffff;
- int64_t val2 = 0xffffffffffffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*8, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- int64_t verifyVal1;
- int64_t verifyVal2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesDouble) {
- const char signature[] = "dddddddddd";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //outStream.reserveMemory(numOfElements * 8);
- double val1 = 13.37;
- double val2 = 3.414;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- outStream << val1;
- outStream << val2;
- }
- outStream.flush();
-
- EXPECT_EQ(numOfElements*8, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- double verifyVal1;
- double verifyVal2;
- std::string verifySignature;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- inStream >> verifyVal1;
- EXPECT_EQ(val1, verifyVal1);
-
- inStream >> verifyVal2;
- EXPECT_EQ(val2, verifyVal2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesStrings) {
- const char signature[] = "sss";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- std::string val1 = "hai";
- std::string val2 = "ciao";
- std::string val3 = "salut";
-
- //sizes of the strings + terminating null-bytes (each 1 byte) + length-fields (each 4 bytes)
- //outStream.reserveMemory(val1.size() + val2.size() + val3.size() + 3 + 3 * 4);
- outStream << val1 << val2 << val3;
- outStream.flush();
-
- //Length fields + actual strings + terminating '\0's + 3(padding)
- EXPECT_EQ(3*4 + 3 + 4 + 5 + 3 + 3, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- std::string verifyVal1;
- std::string verifyVal2;
- std::string verifyVal3;
- std::string verifySignature;
-
- inStream >> verifyVal1;
- inStream >> verifyVal2;
- inStream >> verifyVal3;
-
- EXPECT_EQ(val1, verifyVal1);
- EXPECT_EQ(val2, verifyVal2);
- EXPECT_EQ(val3, verifyVal3);
-}
-
-namespace bmw {
-namespace test {
-
-struct myStruct : CommonAPI::Struct<uint32_t, int16_t, bool, std::string, double> {
- ~myStruct();
-
- virtual uint32_t getA() { return std::get<0>(values_); }
- virtual int16_t getB() { return std::get<1>(values_); }
- virtual bool getC() { return std::get<2>(values_); }
- virtual std::string getD() { return std::get<3>(values_); }
- virtual double getE() { return std::get<4>(values_); }
-
- virtual void* getAderef() { return &std::get<0>(values_); }
- virtual void* getBderef() { return &std::get<1>(values_); }
- virtual void* getCderef() { return &std::get<2>(values_); }
- virtual void* getDderef() { return &std::get<3>(values_); }
- virtual void* getEderef() { return &std::get<4>(values_); }
-
- virtual void setA(uint32_t a) { std::get<0>(values_) = a; }
- virtual void setB(int16_t b) { std::get<1>(values_) = b; }
- virtual void setC(bool c) { std::get<2>(values_) = c; }
- virtual void setD(std::string d) { std::get<3>(values_) = d; }
- virtual void setE(double e) { std::get<4>(values_) = e; }
-
- virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputStream) {
- inputStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_) >> std::get<4>(values_);
- }
-
- virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputStream) const {
- outputStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_) << std::get<4>(values_);
- }
-
- static void writeToTypeOutputStream(CommonAPI::TypeOutputStream<CommonAPI::DBus::DBusTypeOutputStream>& typeOutputStream) {
- (void)typeOutputStream;
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- }
-};
-
-myStruct::~myStruct() {
-}
-
-} //namespace test
-} //namespace bmw
-
-TEST_F(OutputStreamTest, WritesStructs) {
- const char signature[] = "(unbsd)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- bmw::test::myStruct testStruct;
- testStruct.setA(15);
- testStruct.setB(-32);
- testStruct.setC(FALSE);
- testStruct.setD("Hello all");
- testStruct.setE(3.414);
-
- // 40(byte length of struct) = 4(uint32_t) + 2(int16_t) + 2(padding) + 4(bool) + 4(strlength)
- // + 9(string) + 1(terminating '\0' of string) + 6(padding) + 8 (double)
- //outStream.reserveMemory(40);
- outStream << testStruct;
- outStream.flush();
-
- EXPECT_EQ(40, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- bmw::test::myStruct verifyStruct;
- inStream >> verifyStruct;
-
- EXPECT_EQ(testStruct.getA(), verifyStruct.getA());
- EXPECT_EQ(testStruct.getB(), verifyStruct.getB());
- EXPECT_EQ(testStruct.getC(), verifyStruct.getC());
- EXPECT_EQ(testStruct.getD(), verifyStruct.getD());
- EXPECT_EQ(testStruct.getE(), verifyStruct.getE());
-}
-
-TEST_F(OutputStreamTest, WritesArrays) {
- const char signature[] = "ai";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- std::vector<int32_t> testVector;
- int32_t val1 = 0xffffffff;
- int32_t val2 = 0x7fffffff;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- testVector.push_back(val1);
- testVector.push_back(val2);
- }
-
- //outStream.reserveMemory(numOfElements * 4 + 4);
- outStream << testVector;
- outStream.flush();
-
- EXPECT_EQ(numOfElements*4 + 4, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- std::vector<int32_t> verifyVector;
- inStream >> verifyVector;
-
- int32_t res1;
- int32_t res2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- res1 = verifyVector[i];
- EXPECT_EQ(val1, res1);
- res2 = verifyVector[i + 1];
- EXPECT_EQ(val2, res2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesArraysOfStrings) {
- const char signature[] = "as";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- std::vector<std::string> testVector;
- std::string val1 = "Hai";
- std::string val2 = "Ciao";
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- testVector.push_back(val1);
- testVector.push_back(val2);
- }
-
- // 101 = 4(lengthFieldOfArray) +
- // 4*(4(lengthField1) + 4(string1 mit \0-byte) + 4(lengthField2) + 5(string2 mit \0-byte) + 3(paddingTo4)) +
- // (4(lengthField1) + 4(string1 mit \0-byte) + 4(lengthField2) + 5(string2 mit \0-byte))
- size_t vectorLength = 101;
- //outStream.reserveMemory(vectorLength);
- outStream << testVector;
- outStream.flush();
-
- EXPECT_EQ(vectorLength, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- std::vector<std::string> verifyVector;
- inStream >> verifyVector;
-
- std::string res1;
- std::string res2;
- for (unsigned int i = 0; i < numOfElements; i += 2) {
- res1 = verifyVector[i];
- EXPECT_EQ(val1, res1);
- res2 = verifyVector[i + 1];
- EXPECT_EQ(val2, res2);
- }
-}
-
-TEST_F(OutputStreamTest, WritesArraysInArrays) {
- const char signature[] = "aai";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- std::vector<std::vector<int32_t>> testVector;
- int32_t val1 = 0xffffffff;
- int32_t val2 = 0x7fffffff;
- for (unsigned int i = 0; i < numOfElements; i++) {
- std::vector<int32_t> inner;
- for (unsigned int j = 0; j < numOfElements; j += 2) {
- inner.push_back(val1);
- inner.push_back(val2);
- }
- testVector.push_back(inner);
- }
-
- //outStream.reserveMemory(numOfElements * numOfElements * 4 + numOfElements * 4 + 4);
- outStream << testVector;
- outStream.flush();
-
- EXPECT_EQ(numOfElements*numOfElements*4 + numOfElements*4 + 4, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- std::vector<std::vector<int32_t>> verifyVector;
- inStream >> verifyVector;
-
- int32_t res1;
- int32_t res2;
- for (unsigned int i = 0; i < numOfElements; i++) {
- std::vector<int32_t> innerVerify = verifyVector[i];
- for (unsigned int j = 0; j < numOfElements; j += 2) {
- res1 = innerVerify[j];
- EXPECT_EQ(val1, res1);
- res2 = innerVerify[j + 1];
- EXPECT_EQ(val2, res2);
- }
- }
-}
-
-typedef CommonAPI::Variant<int8_t, uint32_t, double, std::string> BasicTypeVariant;
-
-TEST_F(OutputStreamTest, WritesArraysOfVariants) {
- numOfElements = 4;
- const char signature[] = "(yv)(yv)(yv)(yv)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- int8_t fromInt8Value = 7;
- uint32_t fromUInt32Value = 42;
- double fromDoubleValue = 13.37;
- std::string fromStringValue = "Hai :)";
- BasicTypeVariant referenceInt8Variant(fromInt8Value);
- BasicTypeVariant referenceUint32Variant(fromUInt32Value);
- BasicTypeVariant referenceDoubleVariant(fromDoubleValue);
- BasicTypeVariant referenceStringVariant(fromStringValue);
-
- std::vector<BasicTypeVariant> testVector;
-
- testVector.push_back(referenceInt8Variant);
- testVector.push_back(fromUInt32Value);
- testVector.push_back(fromDoubleValue);
- testVector.push_back(fromStringValue);
-
- // 4(length field) + 4(padding) + (1(variant type byte) + 3(signature length + content + terminating null) + 1(int8_t))
- // + 3(padding) + (1(variant type byte) + 3(signature length + content + terminating null) + 4(uint32_t))
- // + (1(variant type byte) + 3(signature length + content + terminating null) + 8(uint32_t))
- // + 4(padding) + (1(variant type byte) + 3(signature length + content + terminating null) + 4(string length field) + 7(string))
- // = 55
- //outStream.reserveMemory(55);
- outStream.writeValue(testVector, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- outStream.flush();
-
- EXPECT_EQ(55, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- std::vector<BasicTypeVariant> verifyVector;
- inStream.readValue(verifyVector, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
-
- BasicTypeVariant resultInt8Variant = verifyVector[0];
- BasicTypeVariant resultUint32Variant = verifyVector[1];
- BasicTypeVariant resultDoubleVariant = verifyVector[2];
- BasicTypeVariant resultStringVariant = verifyVector[3];
-
- EXPECT_EQ(referenceInt8Variant, resultInt8Variant);
- EXPECT_EQ(referenceUint32Variant, resultUint32Variant);
- EXPECT_EQ(referenceDoubleVariant, resultDoubleVariant);
- EXPECT_EQ(referenceStringVariant, resultStringVariant);
-}
-
-namespace com {
-namespace bmw {
-namespace test {
-
-struct TestStruct : CommonAPI::Struct<int32_t, double, double, std::string> {
- TestStruct();
- TestStruct(int32_t v1, double v2, double v3, std::string v4);
- ~TestStruct();
-
- virtual int32_t getVal1() { return std::get<0>(values_); }
- virtual double getVal2() { return std::get<1>(values_); }
- virtual double getVal3() { return std::get<2>(values_); }
- virtual std::string getVal4() { return std::get<3>(values_); }
-
- virtual void setVal1(int32_t val1) { std::get<0>(values_) = val1; }
- virtual void setVal2(double val2) { std::get<1>(values_) = val2; }
- virtual void setVal3(double val3) { std::get<2>(values_) = val3; }
- virtual void setVal4(std::string val4) { std::get<3>(values_) = val4; }
-
- virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const;
-};
-
-typedef std::vector<TestStruct> TestStructList;
-
-TestStruct::TestStruct() {
- std::get<0>(values_) = 0;
- std::get<1>(values_) = 0;
- std::get<2>(values_) = 0;
- std::get<3>(values_) = "";
-}
-
-TestStruct::TestStruct(int32_t v1, double v2, double v3, std::string v4) {
- std::get<0>(values_) = v1;
- std::get<1>(values_) = v2;
- std::get<2>(values_) = v3;
- std::get<3>(values_) = v4;
-}
-
-TestStruct::~TestStruct() {
-}
-
-void TestStruct::readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream) {
- inputMessageStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_);
-}
-
-void TestStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const {
- outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_);
-}
-
-} // namespace test
-} // namespace bmw
-} // namespace com
-
-TEST_F(OutputStreamTest, WritesTestStructs) {
- const char signature[] = "(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- com::bmw::test::TestStruct testStruct(1, 12.6, 1e40, "XXXXXXXXXXXXXXXXXXXX");
-
- //4(int32_t) + 4(padding) + 8(double) + 8(double) + 4(str_length) + 20(string) + 1(null-termination)
- uint32_t expectedSize = 49;
- //outStream.reserveMemory(expectedSize);
- outStream << testStruct;
- outStream.flush();
-
- EXPECT_EQ(expectedSize, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- com::bmw::test::TestStruct verifyStruct;
- inStream >> verifyStruct;
-
- EXPECT_EQ(testStruct.getVal1(), verifyStruct.getVal1());
- EXPECT_EQ(testStruct.getVal2(), verifyStruct.getVal2());
- EXPECT_EQ(testStruct.getVal3(), verifyStruct.getVal3());
- EXPECT_EQ(testStruct.getVal4(), verifyStruct.getVal4());
-}
-
-TEST_F(OutputStreamTest, WritesTestStructLists) {
- const char signature[] = "a(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- com::bmw::test::TestStructList testList;
- for (unsigned int i = 0; i < numOfElements; i++) {
- testList.emplace_back(1, 12.6, 1e40, "XXXXXXXXXXXXXXXXXXXX");
- }
-
- //struct size: 49 = 4(int32_t) + 4(padding) + 8(double) + 8(double) + 4(str_length) + 20(string) + 1(null-termination)
- //array size: 4(array_length) + 4(struct_padding) + (numElements-1)*(49(struct) + 7(struct_padding)) + 49(struct)
- uint32_t expectedSize = static_cast<uint32_t>(8 + (numOfElements - 1) * (49 + 7) + 49);
- //outStream.reserveMemory(expectedSize);
- outStream << testList;
- outStream.flush();
-
- EXPECT_EQ(expectedSize, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- com::bmw::test::TestStructList verifyList;
- inStream >> verifyList;
-
- EXPECT_EQ(numOfElements, verifyList.size());
-}
-
-namespace com {
-namespace bmw {
-namespace test {
-
-struct ArrayStruct : CommonAPI::Struct<std::vector<int64_t>, std::vector<std::string>, std::vector<double>, std::vector<std::string>, std::vector<uint16_t>> {
- ArrayStruct();
- ArrayStruct(std::vector<int64_t> v1,
- std::vector<std::string> v2,
- std::vector<double> v3,
- std::vector<std::string> v4,
- std::vector<uint16_t> v5);
- ~ArrayStruct();
-
- virtual std::vector<int64_t> getVal1() { return std::get<0>(values_); }
- virtual std::vector<std::string> getVal2() { return std::get<1>(values_); }
- virtual std::vector<double> getVal3() { return std::get<2>(values_); }
- virtual std::vector<std::string> getVal4() { return std::get<3>(values_); }
- virtual std::vector<uint16_t> getVal5() { return std::get<4>(values_); }
-
- virtual void setVal1(std::vector<int64_t> val1) { std::get<0>(values_) = val1; }
- virtual void setVal2(std::vector<std::string> val2) { std::get<1>(values_) = val2; }
- virtual void setVal3(std::vector<double> val3) { std::get<2>(values_) = val3; }
- virtual void setVal4(std::vector<std::string> val4) { std::get<3>(values_) = val4; }
- virtual void setVal5(std::vector<uint16_t> val5) { std::get<4>(values_) = val5; }
-
- virtual void addToVal1(int64_t val1) { std::get<0>(values_).push_back(val1); }
- virtual void addToVal2(std::string val2) { std::get<1>(values_).push_back(val2); }
- virtual void addToVal3(double val3) { std::get<2>(values_).push_back(val3); }
- virtual void addToVal4(std::string val4) { std::get<3>(values_).push_back(val4); }
- virtual void addToVal5(uint16_t val5) { std::get<4>(values_).push_back(val5); }
-
- virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream);
- virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const;
-};
-
-typedef std::vector<TestStruct> TestStructList;
-
-ArrayStruct::ArrayStruct() {
-}
-
-ArrayStruct::ArrayStruct(std::vector<int64_t> v1,
- std::vector<std::string> v2,
- std::vector<double> v3,
- std::vector<std::string> v4,
- std::vector<uint16_t> v5) {
- std::get<0>(values_) = v1;
- std::get<1>(values_) = v2;
- std::get<2>(values_) = v3;
- std::get<3>(values_) = v4;
- std::get<4>(values_) = v5;
-}
-
-ArrayStruct::~ArrayStruct() {
-}
-
-void ArrayStruct::readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputMessageStream) {
- inputMessageStream >> std::get<0>(values_) >> std::get<1>(values_) >> std::get<2>(values_) >> std::get<3>(values_) >> std::get<4>(values_);
-}
-
-void ArrayStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputMessageStream) const {
- outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_) << std::get<4>(values_);
-}
-
-} // namespace test
-} // namespace bmw
-} // namespace com
-
-TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
- const char signature[] = "(axasadasaq)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- com::bmw::test::ArrayStruct arrayStruct;
- for (unsigned int i = 0; i < numOfElements; i++) {
- arrayStruct.addToVal1(i * 50);
- arrayStruct.addToVal2("Hai");
- arrayStruct.addToVal3(3.414);
- arrayStruct.addToVal4("Ciao");
- arrayStruct.addToVal5(uint16_t(i * 5));
- }
- uint16_t frontValue = 0;
-
- // 2(uint16) + 6(padding) --> 8
- // 4(LengthField) + 4(padding) + 10 * 8(int64) --> 88 --> 96
- // 4(LengthField) + 10 * (4(LengthField) + 4("Hai\0")) --> 84 --> 180
- // 4(LengthField) + 10 * 8(double) --> 84 --> 264
- // 4(LengthField) + 10 * (4(LengthField) + 5("Ciao\0") + 3(padding)) --> 124 --> 388
- // 4(LengthField) + 10 * 2(uint16) --> 24 --> 412
- size_t structLength = 412;
- //outStream.reserveMemory(structLength);
- outStream << frontValue << arrayStruct;
- outStream.flush();
-
- EXPECT_EQ(structLength, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
- com::bmw::test::ArrayStruct verifyStruct;
-
- uint16_t frontVerification;
- inStream >> frontVerification >> verifyStruct;
-
- EXPECT_EQ(frontValue, frontVerification);
-
- int64_t res1;
- std::string res2;
- double res3;
- std::string res4;
- uint16_t res5;
-
- for (unsigned int i = 0; i < numOfElements; i++) {
- res1 = verifyStruct.getVal1()[i];
- res2 = verifyStruct.getVal2()[i];
- res3 = verifyStruct.getVal3()[i];
- res4 = verifyStruct.getVal4()[i];
- res5 = verifyStruct.getVal5()[i];
-
- EXPECT_EQ(i*50, res1);
- EXPECT_EQ(std::string("Hai"), res2);
- EXPECT_EQ(3.414, res3);
- EXPECT_EQ(std::string("Ciao"), res4);
- EXPECT_EQ(i*5, res5);
- }
-}
-
-TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
- ::commonapi::tests::DerivedTypeCollection::TestEnumMap testEnumMap;
-
- ::commonapi::tests::DerivedTypeCollection::TestEnum key1 =
- ::commonapi::tests::DerivedTypeCollection::TestEnum::E_NOT_USED;
- ::commonapi::tests::DerivedTypeCollection::TestEnum key2 = ::commonapi::tests::DerivedTypeCollection::TestEnum::E_OK;
- ::commonapi::tests::DerivedTypeCollection::TestEnum key3 =
- ::commonapi::tests::DerivedTypeCollection::TestEnum::E_OUT_OF_RANGE;
- ::commonapi::tests::DerivedTypeCollection::TestEnum key4 =
- ::commonapi::tests::DerivedTypeCollection::TestEnum::E_UNKNOWN;
- std::string val = "Hai";
-
- testEnumMap.insert( {key1, val});
- testEnumMap.insert( {key2, val});
- testEnumMap.insert( {key3, val});
- testEnumMap.insert( {key4, val});
-
- const char signature[] = "a{is}";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
- CommonAPI::DBus::DBusOutputStream outStream(message);
-
- //array length (4) + struct-padding (4) +
- // 3 * (sizeof(int) + sizeof(string) + struct-padding) + (sizeof(int) + sizeof(string))
- size_t sizeOfBody = 4 + 4 + 3 * (4 + 8 + 4) + (4 + 8);
- //outStream.reserveMemory(sizeOfBody);
- outStream << testEnumMap;
- outStream.flush();
-
- EXPECT_EQ(sizeOfBody, message.getBodyLength());
-
- CommonAPI::DBus::DBusInputStream inStream(message);
-
- ::commonapi::tests::DerivedTypeCollection::TestEnumMap verificationMap;
- inStream >> verificationMap;
-
- for (auto it = verificationMap.begin(); it != verificationMap.end(); ++it) {
- ASSERT_EQ(it->second, testEnumMap[it->first]);
- }
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusPolymorphicTest.cpp b/src/test/DBusPolymorphicTest.cpp
deleted file mode 100644
index eb14176..0000000
--- a/src/test/DBusPolymorphicTest.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include "CommonAPI/CommonAPI.hpp"
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include "CommonAPI/DBus/DBusConnection.hpp"
-
-#define VERSION v1_0
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusProxy.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-
-static const std::string interfaceName = "commonapi.tests.TestInterface";
-static const std::string busName = "commonapi.tests.TestInterface_CommonAPI.DBus.tests.DBusProxyTestService";
-static const std::string objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService";
-
-class PolymorphicTestStub : public VERSION::commonapi::tests::TestInterfaceStubDefault {
-public:
-
- void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client,
- std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inArray,
- TestArrayOfPolymorphicStructMethodReply_t _reply) {
- (void)_client;
-
- numberOfContainedElements_ = static_cast<int>(inArray.size());
-
- if (numberOfContainedElements_ > 0) {
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
- std::dynamic_pointer_cast<
- ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- inArray[0]);
- firstElementIsExtended_ = (extended != NULL);
- }
-
- if (numberOfContainedElements_ > 1) {
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
- std::dynamic_pointer_cast<
- ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- inArray[1]);
- secondElementIsExtended_ = (extended != NULL);
- }
- _reply();
- }
-
-
- void TestMapOfPolymorphicStructMethod(
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic inMap,
- TestMapOfPolymorphicStructMethodReply_t _reply) {
- (void)clientId;
-
- numberOfContainedElements_ = static_cast<int>(inMap.size());
-
- auto iteratorFirst = inMap.find(5);
- auto iteratorSecond = inMap.find(10);
-
- if (iteratorFirst != inMap.end()) {
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
- std::dynamic_pointer_cast<
- ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- iteratorFirst->second);
- firstElementIsExtended_ = (extended != NULL);
- }
-
- if (iteratorSecond != inMap.end()) {
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
- std::dynamic_pointer_cast<
- ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- iteratorSecond->second);
- secondElementIsExtended_ = (extended != NULL);
- }
-
- _reply();
- }
-
- void TestStructWithPolymorphicMemberMethod(
- const std::shared_ptr<CommonAPI::ClientId> _client,
- ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inStruct,
- TestStructWithPolymorphicMemberMethodReply_t _reply) {
- (void)_client;
-
- if (inStruct.getPolymorphicMember() != NULL) {
- numberOfContainedElements_ = 1;
-
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extended =
- std::dynamic_pointer_cast<
- ::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>(
- inStruct.getPolymorphicMember());
- firstElementIsExtended_ = (extended != NULL);
- }
- _reply();
- }
-
- int numberOfContainedElements_;
- bool firstElementIsExtended_;
- bool secondElementIsExtended_;
-};
-
-class PolymorphicTest: public ::testing::Test {
-protected:
- void SetUp() {
- auto runtime = CommonAPI::Runtime::get();
-
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "clientConnection");
- ASSERT_TRUE(proxyDBusConnection_->connect());
-
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
- proxy_->init();
-
- registerTestStub();
-
- for (unsigned int i = 0; !proxy_->isAvailable() && i < 100; ++i) {
- usleep(10000);
- }
- ASSERT_TRUE(proxy_->isAvailable());
-
- baseInstance1_ = std::make_shared<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>();
- baseInstance1_->setTestString("abc");
-
- extendedInstance1_ = std::make_shared<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct>();
- extendedInstance1_->setAdditionalValue(7);
- }
-
- virtual void TearDown() {
- deregisterTestStub();
- usleep(30000);
- }
-
- void registerTestStub() {
- stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "serviceConnection");
- ASSERT_TRUE(stubDBusConnection_->connect());
-
- testStub = std::make_shared<PolymorphicTestStub>();
- stubAdapter_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusStubAdapter>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), stubDBusConnection_, testStub);
- stubAdapter_->init(stubAdapter_);
-
- const bool isStubAdapterRegistered = CommonAPI::Runtime::get()->registerService(
- stubAdapter_->getAddress().getDomain(), stubAdapter_->getAddress().getInstance(), testStub);
- ASSERT_TRUE(isStubAdapterRegistered);
- }
-
- void deregisterTestStub() {
- const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(stubAdapter_->getAddress().getDomain(), stubAdapter_->getInterface(), stubAdapter_->getAddress().getInstance());
- ASSERT_TRUE(isStubAdapterUnregistered);
- stubAdapter_.reset();
-
- if (stubDBusConnection_->isConnected()) {
- stubDBusConnection_->disconnect();
- }
- stubDBusConnection_.reset();
- }
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> stubDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusStubAdapter> stubAdapter_;
-
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> baseInstance1_;
- std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extendedInstance1_;
-
- std::shared_ptr<PolymorphicTestStub> testStub;
-};
-
-TEST_F(PolymorphicTest, SendVectorOfBaseType) {
- CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
- inputArray.push_back(baseInstance1_);
-
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testStub->numberOfContainedElements_, 1);
- ASSERT_FALSE(testStub->firstElementIsExtended_);
-}
-
-TEST_F(PolymorphicTest, SendVectorOfExtendedType) {
- CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
- inputArray.push_back(extendedInstance1_);
-
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testStub->numberOfContainedElements_, 1);
- ASSERT_TRUE(testStub->firstElementIsExtended_);
-}
-
-TEST_F(PolymorphicTest, SendVectorOfBaseAndExtendedType) {
- CommonAPI::CallStatus stat;
- std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
- inputArray.push_back(baseInstance1_);
- inputArray.push_back(extendedInstance1_);
-
- proxy_->TestArrayOfPolymorphicStructMethod(inputArray, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testStub->numberOfContainedElements_, 2);
- ASSERT_FALSE(testStub->firstElementIsExtended_);
- ASSERT_TRUE(testStub->secondElementIsExtended_);
-}
-
-TEST_F(PolymorphicTest, SendMapOfBaseAndExtendedType) {
- CommonAPI::CallStatus stat;
- std::unordered_map<uint8_t, std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputMap;
- inputMap.insert( {5, baseInstance1_});
- inputMap.insert( {10, extendedInstance1_});
-
- proxy_->TestMapOfPolymorphicStructMethod(inputMap, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testStub->numberOfContainedElements_, 2);
- ASSERT_FALSE(testStub->firstElementIsExtended_);
- ASSERT_TRUE(testStub->secondElementIsExtended_);
-}
-
-TEST_F(PolymorphicTest, SendStructWithPolymorphicMember) {
- CommonAPI::CallStatus stat;
- ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inputStruct;
- inputStruct.setPolymorphicMember(extendedInstance1_);
-
- proxy_->TestStructWithPolymorphicMemberMethod(inputStruct, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(testStub->numberOfContainedElements_, 1);
- ASSERT_TRUE(testStub->firstElementIsExtended_);
-}
-
-TEST_F(PolymorphicTest, SendStructWithMapWithEnumKeyMember) {
- CommonAPI::CallStatus stat;
- ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap inputStruct;
- std::get<0>(inputStruct.values_).insert( { commonapi::tests::DerivedTypeCollection::TestEnum::E_OK, "test" } );
-
- proxy_->TestStructWithEnumKeyMapMember(inputStruct, stat, nullptr);
-
- ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusProxyTest.cpp b/src/test/DBusProxyTest.cpp
deleted file mode 100644
index a70a84a..0000000
--- a/src/test/DBusProxyTest.cpp
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-#ifndef _GLIBCXX_USE_NANOSLEEP
-#define _GLIBCXX_USE_NANOSLEEP
-#endif
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusInputStream.hpp>
-#include <CommonAPI/DBus/DBusMessage.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-
-#include <v1/commonapi/tests/TestInterfaceDBusProxy.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-
-#include <v1/commonapi/tests/ExtendedInterfaceProxy.hpp>
-#include <v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp>
-#include <v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
-#include <v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp>
-
-#include "DBusTestUtils.hpp"
-
-#include <gtest/gtest.h>
-
-#include <algorithm>
-#include <cstdint>
-#include <iostream>
-#include <string>
-#include <thread>
-#include <vector>
-
-static const std::string domain = "local";
-static const std::string commonApiAddress = "CommonAPI.DBus.tests.DBusProxyTestService";
-static const std::string commonApiAddressExtended = "CommonAPI.DBus.tests.DBusProxyTestService2";
-static const std::string commonApiServiceName = "CommonAPI.DBus.tests.DBusProxyTestInterface";
-static const std::string interfaceName = "commonapi.tests.TestInterface";
-static const std::string busName = "commonapi.tests.TestInterface_CommonAPI.DBus.tests.DBusProxyTestService";
-static const std::string objectPath = "/CommonAPI/DBus/tests/DBusProxyTestService";
-static const std::string objectPathExtended = "/CommonAPI/DBus/tests/DBusProxyTestService2";
-static const std::string commonApiAddressFreedesktop = "CommonAPI.DBus.tests.DBusProxyTestInterface";
-
-#define VERSION v1_0
-
-class ProxyTest: public ::testing::Test {
-protected:
- void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
-
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "clientConnection");
- ASSERT_TRUE(proxyDBusConnection_->connect());
-
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
- CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName),
- proxyDBusConnection_);
- proxy_->init();
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- virtual void TearDown() {
- usleep(300000);
- }
-
- void registerTestStub() {
- stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- bool isTestStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_, "serviceConnection");
- ASSERT_TRUE(isTestStubAdapterRegistered_);
-
- usleep(100000);
- }
-
- void registerExtendedStub() {
- stubExtended_ = std::make_shared<VERSION::commonapi::tests::ExtendedInterfaceStubDefault>();
-
- bool isExtendedStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::ExtendedInterfaceStub>(domain, commonApiAddressExtended, stubExtended_, "serviceConnection");
- ASSERT_TRUE(isExtendedStubAdapterRegistered_);
-
- usleep(100000);
- }
-
- void deregisterTestStub() {
- const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(
- domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
- ASSERT_TRUE(isStubAdapterUnregistered);
- stubDefault_.reset();
- isTestStubAdapterRegistered_ = false;
- }
-
- void deregisterExtendedStub() {
- const bool isStubAdapterUnregistered = runtime_->unregisterService(
- domain, stubExtended_->CommonAPI::Stub<VERSION::commonapi::tests::ExtendedInterfaceStubAdapter, VERSION::commonapi::tests::ExtendedInterfaceStubRemoteEvent>::getStubAdapter()->VERSION::commonapi::tests::ExtendedInterface::getInterface(), commonApiAddressExtended);
- ASSERT_TRUE(isStubAdapterUnregistered);
- stubExtended_.reset();
- isExtendedStubAdapterRegistered_ = false;
- }
-
- void proxyRegisterForAvailabilityStatus() {
- proxyAvailabilityStatus_ = CommonAPI::AvailabilityStatus::UNKNOWN;
-
- proxyStatusSubscription_ = proxy_->getProxyStatusEvent().subscribe([&](const CommonAPI::AvailabilityStatus& availabilityStatus) {
- proxyAvailabilityStatus_ = availabilityStatus;
- });
- usleep(100000);
- }
-
- void proxyDeregisterForAvailabilityStatus() {
- proxy_->getProxyStatusEvent().unsubscribe(proxyStatusSubscription_);
- }
-
- bool proxyWaitForAvailabilityStatus(const CommonAPI::AvailabilityStatus& availabilityStatus) const {
- for (int i = 0; i < 10; i++) {
- if (proxyAvailabilityStatus_ == availabilityStatus) {
- return true;
- }
- usleep(200000);
- }
-
- return false;
- }
-
- bool isExtendedStubAdapterRegistered_;
- bool isTestStubAdapterRegistered_;
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
-
- CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
-
- CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
-
- std::shared_ptr<VERSION::commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
-};
-
-TEST_F(ProxyTest, HasCorrectConnectionName) {
- std::string actualName = proxy_->getDBusAddress().getService();
- EXPECT_EQ(busName, actualName);
-}
-
-TEST_F(ProxyTest, HasCorrectObjectPath) {
- std::string actualPath = proxy_->getDBusAddress().getObjectPath();
- EXPECT_EQ(objectPath, actualPath);
-}
-
-TEST_F(ProxyTest, HasCorrectInterfaceName) {
- std::string actualName = proxy_->getDBusAddress().getInterface();
- EXPECT_EQ(interfaceName, actualName);
-}
-
-TEST_F(ProxyTest, IsNotAvailable) {
- bool isAvailable = proxy_->isAvailable();
- EXPECT_FALSE(isAvailable);
-}
-
-TEST_F(ProxyTest, IsConnected) {
- ASSERT_TRUE(proxy_->getDBusConnection()->isConnected());
-}
-
-TEST_F(ProxyTest, DBusProxyStatusEventBeforeServiceIsRegistered) {
- proxyRegisterForAvailabilityStatus();
-
- EXPECT_NE(proxyAvailabilityStatus_, CommonAPI::AvailabilityStatus::AVAILABLE);
-
- registerTestStub();
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::AVAILABLE));
-
- deregisterTestStub();
- usleep(100000);
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
-
- proxyDeregisterForAvailabilityStatus();
-}
-
-/*
-This test fails in Windows. Calling disconnect and then connect again somehow
-damages the connection in libdbus. In Linux this all works fine.
-*/
-#ifndef WIN32
-TEST_F(ProxyTest, DBusProxyStatusEventAfterServiceIsRegistered) {
- proxyDBusConnection_->disconnect();
-
- registerTestStub();
-
- EXPECT_TRUE(proxyDBusConnection_->connect());
-
- proxyRegisterForAvailabilityStatus();
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::AVAILABLE));
-
- deregisterTestStub();
- usleep(100000);
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
-
- proxyDeregisterForAvailabilityStatus();
-}
-#endif
-
-
-TEST_F(ProxyTest, IsAvailableBlocking) {
- registerTestStub();
-
- // blocking in terms of "if it's still unknown"
- for (int i = 0; !proxy_->isAvailableBlocking() && i < 3; i++) {
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- EXPECT_TRUE(proxy_->isAvailableBlocking());
-
- deregisterTestStub();
-}
-
-TEST_F(ProxyTest, HasNecessaryAttributesAndEvents) {
- (proxy_->getInterfaceVersionAttribute());
- (proxy_->getProxyStatusEvent());
-}
-
-TEST_F(ProxyTest, TestInterfaceVersionAttribute) {
- CommonAPI::InterfaceVersionAttribute& versionAttribute = proxy_->getInterfaceVersionAttribute();
- CommonAPI::Version version;
- CommonAPI::CallStatus status;
- ASSERT_NO_THROW(versionAttribute.getValue(status, version));
- ASSERT_EQ(CommonAPI::CallStatus::NOT_AVAILABLE, status);
-}
-
-TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) {
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testInputStruct;
- ::commonapi::tests::DerivedTypeCollection::TestMap testInputMap;
- CommonAPI::CallInfo info;
- std::promise<bool> wasCalledPromise;
- std::future<bool> wasCalledFuture = wasCalledPromise.get_future();
- proxy_->testDerivedTypeMethodAsync(testInputStruct, testInputMap, [&] (
- const CommonAPI::CallStatus& callStatus,
- const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2&,
- const ::commonapi::tests::DerivedTypeCollection::TestMap&) {
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::NOT_AVAILABLE);
- wasCalledPromise.set_value(true);
- }
- , &info);
- ASSERT_TRUE(wasCalledFuture.get());
-}
-
-
-TEST_F(ProxyTest, CallMethodFromExtendedInterface) {
- registerExtendedStub();
-
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
-
- // give the proxy time to become available
- for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
- usleep(20 * 1000);
- }
-
- EXPECT_TRUE(extendedProxy->isAvailable());
-
- uint32_t inInt;
- bool wasCalled = false;
- extendedProxy->TestIntMethodExtendedAsync(
- inInt,
- [&](const CommonAPI::CallStatus& callStatus) {
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- wasCalled = true;
- });
- usleep(100000);
-
- EXPECT_TRUE(wasCalled);
- deregisterExtendedStub();
-}
-
-TEST_F(ProxyTest, CallMethodFromParentInterface) {
- registerExtendedStub();
-
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
-
- for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
- usleep(10 * 1000);
- }
- EXPECT_TRUE(extendedProxy->isAvailable());
-
- bool wasCalled = false;
- extendedProxy->testEmptyMethodAsync(
- [&](const CommonAPI::CallStatus& callStatus) {
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- wasCalled = true;
- });
- usleep(100000);
- EXPECT_TRUE(wasCalled);
-
- deregisterExtendedStub();
-}
-
-TEST_F(ProxyTest, CanHandleRemoteAttribute) {
- registerTestStub();
-
- for (uint32_t i = 0; !proxy_->isAvailable() && i < 200; ++i) {
- usleep(20 * 1000);
- }
- ASSERT_TRUE(proxy_->isAvailable());
-
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
-
- auto& testAttribute = proxy_->getTestPredefinedTypeAttributeAttribute();
-
- testAttribute.getValue(callStatus, value);
-
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-
- value = 7;
- uint32_t responseValue;
- testAttribute.setValue(value, callStatus, responseValue);
-
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(value, responseValue);
-
- usleep(50000);
- deregisterTestStub();
-}
-
-
-TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
- registerExtendedStub();
-
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
-
- for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
- usleep(20 * 1000);
- }
- ASSERT_TRUE(extendedProxy->isAvailable());
-
- CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
- uint32_t value;
-
- usleep(50000);
-
- auto& testAttribute = extendedProxy->getTestPredefinedTypeAttributeAttribute();
-
- testAttribute.getValue(callStatus, value);
-
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
-
- value = 7;
- uint32_t responseValue;
- testAttribute.setValue(value, callStatus, responseValue);
-
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(value, responseValue);
-
- usleep(50000);
- deregisterExtendedStub();
-}
-
-TEST_F(ProxyTest, ProxyCanFetchVersionAttributeFromInheritedInterfaceStub) {
- registerExtendedStub();
-
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
-
- for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
- usleep(20 * 1000);
- }
- EXPECT_TRUE(extendedProxy->isAvailable());
-
-
- CommonAPI::InterfaceVersionAttribute& versionAttribute = extendedProxy->getInterfaceVersionAttribute();
-
- CommonAPI::Version version;
- bool wasCalled = false;
-
- std::future<CommonAPI::CallStatus> futureVersion = versionAttribute.getValueAsync([&](const CommonAPI::CallStatus& callStatus, CommonAPI::Version version) {
- EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- EXPECT_TRUE(version.Major > 0 || version.Minor > 0);
- wasCalled = true;
- });
-
- futureVersion.wait();
- usleep(100000);
-
- EXPECT_TRUE(wasCalled);
-
- deregisterExtendedStub();
-}
-
-// this test does not build its proxies within SetUp
-class ProxyTest2: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- }
-
- virtual void TearDown() {
- std::this_thread::sleep_for(std::chrono::milliseconds(300));
- }
-
- void registerTestStub(const std::string commonApiAddress) {
- stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- bool isTestStubAdapterRegistered_ = runtime_->registerService<
- VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_, "serviceConnection");
- ASSERT_TRUE(isTestStubAdapterRegistered_);
-
- usleep(100000);
- }
-
- void deregisterTestStub(const std::string commonApiAddress) {
- const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
- ASSERT_TRUE(isStubAdapterUnregistered);
- stubDefault_.reset();
- isTestStubAdapterRegistered_ = false;
- }
-
- void proxyRegisterForAvailabilityStatus() {
- proxyAvailabilityStatus_ = CommonAPI::AvailabilityStatus::UNKNOWN;
-
- proxyStatusSubscription_ = proxy_->getProxyStatusEvent().subscribe(
- [&](const CommonAPI::AvailabilityStatus& availabilityStatus) {
- proxyAvailabilityStatus_ = availabilityStatus;
- });
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- void proxyDeregisterForAvailabilityStatus() {
- proxy_->getProxyStatusEvent().unsubscribe(proxyStatusSubscription_);
- }
-
- bool proxyWaitForAvailabilityStatus(const CommonAPI::AvailabilityStatus& availabilityStatus) const {
- for (int i = 0; i < 100; i++) {
- if (proxyAvailabilityStatus_ == availabilityStatus)
- return true;
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- return false;
- }
-
- bool isTestStubAdapterRegistered_;
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
- CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
-
- CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
-
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
-};
-
-TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
- registerTestStub(commonApiAddress);
-
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION, "clientConnection");
- ASSERT_TRUE(proxyDBusConnection_->connect());
-
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
- proxy_->init();
-
- proxyRegisterForAvailabilityStatus();
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::AVAILABLE));
-
- deregisterTestStub(commonApiAddress);
- usleep(100000);
-
- EXPECT_TRUE(proxyWaitForAvailabilityStatus(CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
-
- proxyDeregisterForAvailabilityStatus();
-}
-
-TEST_F(ProxyTest2, DBusProxyCanUseOrgFreedesktopAddress) {
- registerTestStub(commonApiAddressFreedesktop);
-
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxy =
- runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, commonApiAddressFreedesktop);
-
- for (int i = 0; i < 100; i++) {
- if (proxy->isAvailable())
- break;
- std::this_thread::sleep_for(std::chrono::milliseconds(100));
- }
-
- const bool proxyIsAvailable = proxy->isAvailable();
-
- EXPECT_TRUE(proxyIsAvailable);
-
- if(proxyIsAvailable) { // if we are not available, we failed the test and do not check a method call
- bool wasCalled = false;
- proxy->testEmptyMethodAsync(
- [&](const CommonAPI::CallStatus& callStatus) {
- ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- wasCalled = true;
- });
- usleep(100000);
- EXPECT_TRUE(wasCalled);
- }
-
- deregisterTestStub(commonApiAddressFreedesktop);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusRuntimeTest.cpp b/src/test/DBusRuntimeTest.cpp
deleted file mode 100644
index bcc99a6..0000000
--- a/src/test/DBusRuntimeTest.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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 <gtest/gtest.h>
-
-#include <cstring>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-//#include <CommonAPI/DBus/DBusFactory.hpp>
-
-class DBusRuntimeTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-
-TEST_F(DBusRuntimeTest, LoadsDefaultStaticallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-}
-
-
-/*TEST_F(DBusRuntimeTest, LoadsSpecifiedStaticallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-}*/
-
-
-/*TEST_F(DBusRuntimeTest, LoadsDBusLibraryAsSingleton) {
-#ifdef WIN32*/
- /*
- access the middlewareInfo in order to get a call to DBusRuntime. This forces the windows linker not to remove DBusRuntime from resulting binary
- */
-/* ASSERT_TRUE(CommonAPI::DBus::DBusRuntime::middlewareInfo_.middlewareName_);
-#endif
- std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime1);
- ASSERT_TRUE((bool)runtime2);
-
- ASSERT_TRUE(dbusRuntime1 != NULL);
- ASSERT_TRUE(dbusRuntime2 != NULL);
-
- ASSERT_TRUE(dbusRuntime1 == dbusRuntime2);
-}*/
-
-
-/*TEST_F(DBusRuntimeTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("UnknownMiddlewareId");
- ASSERT_FALSE((bool)runtime);
-}*/
-
-
-/*TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- ASSERT_TRUE((bool)proxyFactory);
- CommonAPI::DBus::DBusFactory* dbusProxyFactory = dynamic_cast<CommonAPI::DBus::DBusFactory*>(&(*proxyFactory));
- ASSERT_TRUE(dbusProxyFactory != NULL);
-}*/
-
-
-/*TEST_F(DBusRuntimeTest, DBusRuntimeLoadsDBusServicePublisher) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
- CommonAPI::DBus::DBusRuntime* dbusRuntime = dynamic_cast<CommonAPI::DBus::DBusRuntime*>(&(*runtime));
- ASSERT_TRUE(dbusRuntime != NULL);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- ASSERT_TRUE((bool)servicePublisher);
- CommonAPI::DBus::DBusServicePublisher* dbusServicePublisher = dynamic_cast<CommonAPI::DBus::DBusServicePublisher*>(&(*servicePublisher));
- ASSERT_TRUE(dbusServicePublisher != NULL);
-}*/
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusTestUtils.hpp b/src/test/DBusTestUtils.hpp
deleted file mode 100644
index 2343ec1..0000000
--- a/src/test/DBusTestUtils.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-#ifndef __DBUS_TEST_UTILS__
-#define __DBUS_TEST_UTILS__
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <dbus/dbus.h>
-#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
-#include <CommonAPI/DBus/DBusMessage.hpp>
-
-inline char eliminateZeroes(char val) {
- return !val ? '0' : val;
-}
-
-inline void printLibdbusMessageBody(char* data, uint32_t fromByteIndex, uint32_t toByteIndex) {
- for (unsigned int i = fromByteIndex; i < toByteIndex; i++) {
- std::cout << eliminateZeroes(data[i]);
- if (i % 8 == 7) {
- std::cout << std::endl;
- }
- }
- std::cout << std::endl;
-}
-
-inline void printLibdbusMessage(DBusMessage* libdbusMessage, uint32_t fromByteIndex, uint32_t toByteIndex) {
- char* data = dbus_message_get_body(libdbusMessage);
- printLibdbusMessageBody(data, fromByteIndex, toByteIndex);
-}
-
-inline void printLibdbusMessage(DBusMessage* libdbusMessage) {
- printLibdbusMessage(libdbusMessage, 0, dbus_message_get_body_length(libdbusMessage));
-}
-
-
-inline void printDBusMessage(CommonAPI::DBus::DBusMessage& dbusMessage) {
- printLibdbusMessageBody(dbusMessage.getBodyData(), 0, dbusMessage.getBodyLength());
-}
-
-inline std::string toString(CommonAPI::DBus::DBusServiceRegistry::DBusRecordState dbusRecordState) {
- switch(dbusRecordState) {
- case CommonAPI::DBus::DBusServiceRegistry::DBusRecordState::AVAILABLE:
- return "AVAILABLE";
- case CommonAPI::DBus::DBusServiceRegistry::DBusRecordState::NOT_AVAILABLE:
- return "NOT_AVAILABLE";
- case CommonAPI::DBus::DBusServiceRegistry::DBusRecordState::RESOLVED:
- return "RESOLVED";
- case CommonAPI::DBus::DBusServiceRegistry::DBusRecordState::RESOLVING:
- return "RESOLVING";
- case CommonAPI::DBus::DBusServiceRegistry::DBusRecordState::UNKNOWN:
- return "UNKNOWN";
- }
- return "";
-}
-
-inline std::string toString(CommonAPI::AvailabilityStatus state) {
- switch(state) {
- case CommonAPI::AvailabilityStatus::AVAILABLE:
- return "AVAILABLE";
- case CommonAPI::AvailabilityStatus::NOT_AVAILABLE:
- return "NOT_AVAILABLE";
- case CommonAPI::AvailabilityStatus::UNKNOWN:
- return "UNKNOWN";
- }
- return "";
-}
-
-inline std::string toString(CommonAPI::CallStatus state) {
- switch(state) {
- case CommonAPI::CallStatus::CONNECTION_FAILED:
- return "CONNECTION_FAILED";
- case CommonAPI::CallStatus::NOT_AVAILABLE:
- return "NOT_AVAILABLE";
- case CommonAPI::CallStatus::OUT_OF_MEMORY:
- return "OUT_OF_MEMORY";
- case CommonAPI::CallStatus::REMOTE_ERROR:
- return "REMOTE_ERROR";
- case CommonAPI::CallStatus::SUCCESS:
- return "SUCCESS";
- case CommonAPI::CallStatus::UNKNOWN:
- return "UNKNOWN";
- default:
- return "";
- }
- return "";
-}
-#endif //__DBUS_TEST_UTILS__
diff --git a/src/test/DemoMainLoop.hpp b/src/test/DemoMainLoop.hpp
deleted file mode 100644
index 52c2c5e..0000000
--- a/src/test/DemoMainLoop.hpp
+++ /dev/null
@@ -1,382 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-#ifndef DEMO_MAIN_LOOP_H_
-#define DEMO_MAIN_LOOP_H_
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/MainLoopContext.hpp>
-
-#include <vector>
-#include <set>
-#include <map>
-#ifdef WIN32
-#include <WinSock2.h>
-#else
-#include <poll.h>
-#include <sys/eventfd.h>
-#include <unistd.h>
-#endif
-
-
-#include <cassert>
-
-
-namespace CommonAPI {
-
-typedef pollfd DemoMainLoopPollFd;
-
-class MainLoop {
- public:
- MainLoop() = delete;
- MainLoop(const MainLoop&) = delete;
- MainLoop& operator=(const MainLoop&) = delete;
- MainLoop(MainLoop&&) = delete;
- MainLoop& operator=(MainLoop&&) = delete;
-
- explicit MainLoop(std::shared_ptr<MainLoopContext> context) :
- context_(context),
- currentMinimalTimeoutInterval_(TIMEOUT_INFINITE),
- breakLoop_(false),
- running_(false){
-
-#ifdef WIN32
- WSAEVENT wsaEvent = WSACreateEvent();
-
- if (wsaEvent != WSA_INVALID_EVENT) {
- wakeFd_.fd = PtrToInt(wsaEvent);
- }
-#else
- wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK);
-#endif
- wakeFd_.events = POLLIN;
-
- assert(wakeFd_.fd != -1);
- registerFileDescriptor(wakeFd_);
-
- dispatchSourceListenerSubscription_ = context_->subscribeForDispatchSources(
- std::bind(&CommonAPI::MainLoop::registerDispatchSource, this, std::placeholders::_1, std::placeholders::_2),
- std::bind(&CommonAPI::MainLoop::deregisterDispatchSource, this, std::placeholders::_1));
- watchListenerSubscription_ = context_->subscribeForWatches(
- std::bind(&CommonAPI::MainLoop::registerWatch, this, std::placeholders::_1, std::placeholders::_2),
- std::bind(&CommonAPI::MainLoop::deregisterWatch, this, std::placeholders::_1));
- timeoutSourceListenerSubscription_ = context_->subscribeForTimeouts(
- std::bind(&CommonAPI::MainLoop::registerTimeout, this, std::placeholders::_1, std::placeholders::_2),
- std::bind(&CommonAPI::MainLoop::deregisterTimeout, this, std::placeholders::_1));
- wakeupListenerSubscription_ = context_->subscribeForWakeupEvents(
- std::bind(&CommonAPI::MainLoop::wakeup, this));
- }
-
- ~MainLoop() {
- deregisterFileDescriptor(wakeFd_);
-
- context_->unsubscribeForDispatchSources(dispatchSourceListenerSubscription_);
- context_->unsubscribeForWatches(watchListenerSubscription_);
- context_->unsubscribeForTimeouts(timeoutSourceListenerSubscription_);
- context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_);
-
-#ifdef WIN32
- WSACloseEvent(IntToPtr(wakeFd_.fd));
-
-#else
- close(wakeFd_.fd);
-#endif
- }
-
- /**
- * \brief Runs the mainloop indefinitely until stop() is called.
- *
- * Runs the mainloop indefinitely until stop() is called. The given timeout (milliseconds)
- * will be overridden if a timeout-event is present that defines an earlier ready time.
- */
- void run(const int64_t& timeoutInterval = TIMEOUT_INFINITE) {
- running_ = true;
- while(running_) {
- doSingleIteration(timeoutInterval);
- }
- }
-
- void stop() {
- running_ = false;
- wakeup();
- }
-
- /**
- * \brief Executes a single cycle of the mainloop.
- *
- * Subsequently calls prepare(), poll(), check() and, if necessary, dispatch().
- * The given timeout (milliseconds) represents the maximum time
- * this iteration will remain in the poll state. All other steps
- * are handled in a non-blocking way. Note however that a source
- * might claim to have infinite amounts of data to dispatch.
- * This demo-implementation of a Mainloop will dispatch a source
- * until it no longer claims to have data to dispatch.
- * Dispatch will not be called if no sources, watches and timeouts
- * claim to be ready during the check()-phase.
- *
- * @param timeout The maximum poll-timeout for this iteration.
- */
- void doSingleIteration(const int64_t& timeout = TIMEOUT_INFINITE) {
- prepare(timeout);
- poll();
- if(check()) {
- dispatch();
- }
- }
-
- /*
- * The given timeout is a maximum timeout in ms, measured from the current time in the future
- * (a value of 0 means "no timeout"). It will be overridden if a timeout-event is present
- * that defines an earlier ready time.
- */
- void prepare(const int64_t& timeout = TIMEOUT_INFINITE) {
- currentMinimalTimeoutInterval_ = timeout;
-
- for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
- dispatchSourceIterator != registeredDispatchSources_.end();
- dispatchSourceIterator++) {
-
- int64_t dispatchTimeout = TIMEOUT_INFINITE;
- if(dispatchSourceIterator->second->prepare(dispatchTimeout)) {
- sourcesToDispatch_.insert(*dispatchSourceIterator);
- } else if (dispatchTimeout < currentMinimalTimeoutInterval_) {
- currentMinimalTimeoutInterval_ = dispatchTimeout;
- }
- }
-
- int64_t currentContextTime = getCurrentTimeInMs();
-
- for (auto timeoutPriorityRange = registeredTimeouts_.begin();
- timeoutPriorityRange != registeredTimeouts_.end();
- timeoutPriorityRange++) {
-
- int64_t intervalToReady = timeoutPriorityRange->second->getReadyTime() - currentContextTime;
-
- if (intervalToReady <= 0) {
- timeoutsToDispatch_.insert(*timeoutPriorityRange);
- currentMinimalTimeoutInterval_ = TIMEOUT_NONE;
- } else if (intervalToReady < currentMinimalTimeoutInterval_) {
- currentMinimalTimeoutInterval_ = intervalToReady;
- }
- }
- }
-
- void poll() {
- for (auto fileDescriptor = managedFileDescriptors_.begin() + 1; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
- (*fileDescriptor).revents = 0;
- }
-
-#if WIN32
- INT currentMinimalTimeoutIntervalWin32_ = 1;
- size_t numReadyFileDescriptors = ::WSAPoll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutIntervalWin32_);
-
- if (numReadyFileDescriptors == SOCKET_ERROR) {
- int iError = WSAGetLastError();
- //printf("WSAPoll failed with error: %ld\n", iError);
- }
-#else
- size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), int(currentMinimalTimeoutInterval_));
-#endif
- // If no FileDescriptors are ready, poll returned because of a timeout that has expired.
- // The only case in which this is not the reason is when the timeout handed in "prepare"
- // expired before any other timeouts.
- if(!numReadyFileDescriptors) {
- int64_t currentContextTime = getCurrentTimeInMs();
-
- for (auto timeoutPriorityRange = registeredTimeouts_.begin();
- timeoutPriorityRange != registeredTimeouts_.end();
- timeoutPriorityRange++) {
-
- int64_t intervalToReady = timeoutPriorityRange->second->getReadyTime() - currentContextTime;
-
- if (intervalToReady <= 0) {
- timeoutsToDispatch_.insert(*timeoutPriorityRange);
- }
- }
- }
-
- if (wakeFd_.revents) {
- acknowledgeWakeup();
- }
- }
-
- bool check() {
- //The first file descriptor always is the loop's wakeup-descriptor. All others need to be linked to a watch.
- for (auto fileDescriptor = managedFileDescriptors_.begin() + 1; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
- for (auto registeredWatchIterator = registeredWatches_.begin();
- registeredWatchIterator != registeredWatches_.end();
- registeredWatchIterator++) {
- const auto& correspondingWatchPriority = registeredWatchIterator->first;
- const auto& correspondingWatchPair = registeredWatchIterator->second;
-
- if (std::get<0>(correspondingWatchPair) == fileDescriptor->fd && fileDescriptor->revents) {
- watchesToDispatch_.insert( { correspondingWatchPriority, {std::get<1>(correspondingWatchPair)} } );
- }
- }
- }
-
- for(auto dispatchSourceIterator = registeredDispatchSources_.begin(); dispatchSourceIterator != registeredDispatchSources_.end(); ++dispatchSourceIterator) {
- if((std::get<1>(*dispatchSourceIterator))->check()) {
- sourcesToDispatch_.insert( {std::get<0>(*dispatchSourceIterator), std::get<1>(*dispatchSourceIterator)});
- }
- }
-
- return !timeoutsToDispatch_.empty() || !watchesToDispatch_.empty() || !sourcesToDispatch_.empty();
- }
-
- void dispatch() {
- for (auto timeoutIterator = timeoutsToDispatch_.begin();
- timeoutIterator != timeoutsToDispatch_.end();
- timeoutIterator++) {
- std::get<1>(*timeoutIterator)->dispatch();
- }
-
- for (auto watchIterator = watchesToDispatch_.begin();
- watchIterator != watchesToDispatch_.end();
- watchIterator++) {
- Watch* watch = watchIterator->second;
- const unsigned int flags = watch->getAssociatedFileDescriptor().events;
- watch->dispatch(flags);
- }
-
- breakLoop_ = false;
- for (auto dispatchSourceIterator = sourcesToDispatch_.begin();
- dispatchSourceIterator != sourcesToDispatch_.end() && !breakLoop_;
- dispatchSourceIterator++) {
-
- while(std::get<1>(*dispatchSourceIterator)->dispatch());
- }
-
- timeoutsToDispatch_.clear();
- sourcesToDispatch_.clear();
- watchesToDispatch_.clear();
- }
-
- void wakeup() {
-#ifdef WIN32
- HANDLE h = IntToPtr(wakeFd_.fd);
- SetEvent(h);
-#else
- int64_t wake = 1;
- if(::write(wakeFd_.fd, &wake, sizeof(int64_t)) == -1) {
- std::perror("MainLoop::wakeup");
- }
-#endif
- }
-
- private:
- void registerFileDescriptor(const DemoMainLoopPollFd& fileDescriptor) {
- managedFileDescriptors_.push_back(fileDescriptor);
- }
-
- void deregisterFileDescriptor(const DemoMainLoopPollFd& fileDescriptor) {
- for (auto it = managedFileDescriptors_.begin(); it != managedFileDescriptors_.end(); it++) {
- if ((*it).fd == fileDescriptor.fd) {
- managedFileDescriptors_.erase(it);
- break;
- }
- }
- }
-
- void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority) {
- registeredDispatchSources_.insert( {dispatchPriority, dispatchSource} );
- }
-
- void deregisterDispatchSource(DispatchSource* dispatchSource) {
- for(auto dispatchSourceIterator = registeredDispatchSources_.begin();
- dispatchSourceIterator != registeredDispatchSources_.end();
- dispatchSourceIterator++) {
-
- if(dispatchSourceIterator->second == dispatchSource) {
- registeredDispatchSources_.erase(dispatchSourceIterator);
- break;
- }
- }
- breakLoop_ = true;
- }
-
- void registerWatch(Watch* watch, const DispatchPriority dispatchPriority) {
-#ifdef WIN32
- DemoMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor();
-#else
- DemoMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor();
-#endif
-
- registerFileDescriptor(fdToRegister);
- registeredWatches_.insert( {dispatchPriority, {watch->getAssociatedFileDescriptor().fd, watch}});
- }
-
- void deregisterWatch(Watch* watch) {
- deregisterFileDescriptor(watch->getAssociatedFileDescriptor());
-
- for(auto watchIterator = registeredWatches_.begin();
- watchIterator != registeredWatches_.end();
- watchIterator++) {
-
- if(watchIterator->second.second == watch) {
- registeredWatches_.erase(watchIterator);
- break;
- }
- }
- }
-
- void registerTimeout(Timeout* timeout, const DispatchPriority dispatchPriority) {
- registeredTimeouts_.insert( {dispatchPriority, timeout} );
- }
-
- void deregisterTimeout(Timeout* timeout) {
- for(auto timeoutIterator = registeredTimeouts_.begin();
- timeoutIterator != registeredTimeouts_.end();
- timeoutIterator++) {
-
- if(timeoutIterator->second == timeout) {
- registeredTimeouts_.erase(timeoutIterator);
- break;
- }
- }
- }
-
- void acknowledgeWakeup() {
-#ifdef WIN32
- HANDLE h = IntToPtr(wakeFd_.fd);
- ResetEvent(h);
-#else
- int64_t buffer;
- while (::read(wakeFd_.fd, &buffer, sizeof(int64_t)) == sizeof(buffer))
- ;
-#endif
- }
-
- std::shared_ptr<MainLoopContext> context_;
-
- std::vector<DemoMainLoopPollFd> managedFileDescriptors_;
-
- std::multimap<DispatchPriority, DispatchSource*> registeredDispatchSources_;
- std::multimap<DispatchPriority, std::pair<int, Watch*>> registeredWatches_;
- std::multimap<DispatchPriority, Timeout*> registeredTimeouts_;
-
- std::set<std::pair<DispatchPriority, DispatchSource*>> sourcesToDispatch_;
- std::set<std::pair<DispatchPriority, Watch*>> watchesToDispatch_;
- std::set<std::pair<DispatchPriority, Timeout*>> timeoutsToDispatch_;
-
- DispatchSourceListenerSubscription dispatchSourceListenerSubscription_;
- WatchListenerSubscription watchListenerSubscription_;
- TimeoutSourceListenerSubscription timeoutSourceListenerSubscription_;
- WakeupListenerSubscription wakeupListenerSubscription_;
-
- int64_t currentMinimalTimeoutInterval_;
- bool breakLoop_;
- bool running_;
-
- DemoMainLoopPollFd wakeFd_;
-};
-
-
-} // namespace CommonAPI
-
-#endif /* DEMO_MAIN_LOOP_H_ */
diff --git a/src/test/README.txt b/src/test/README.txt
index 5f5a0ea..eaa6e7e 100644
--- a/src/test/README.txt
+++ b/src/test/README.txt
@@ -6,16 +6,6 @@ Required environment variables:
LD_LIBRARY_PATH should contain the folder where the dbus libraries are.
COMMONAPI_CONFIG should point to the file commonapi-dbus.ini in the src/test folder.
-For DBusAddressTranslatorTest and DBusManagedTest:
-The environment variable COMMONAPI_DBUS_CONFIG must be set to the absolute path to
-the test-commonapi-dbus.ini file contained in the folder src/test.
-The environment variable TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER
-must be set to the absolute path of the folder containing the FakeLegacyService python files.
-
-An example of the environment variable settings:
-
-export COMMONAPI_DBUS_CONFIG=$HOME/git/ascgit017.CommonAPI-D-Bus/src/test/test-commonapi-dbus.ini
-export TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER=$HOME/git/ascgit017.CommonAPI-D-Bus/src/test/fakeLegacyService
export LD_LIBRARY_PATH=$HOME/git/ascgit017.CommonAPI-D-Bus/patched-dbus/lib:$HOME/git/ascgit017.CommonAPI-D-Bus/build/src/test
export COMMONAPI_CONFIG=$HOME/git/ascgit017.CommonAPI-D-Bus/src/test/commonapi-dbus.ini
diff --git a/src/test/fakeLegacyService.fdepl b/src/test/fakeLegacyService.fdepl
deleted file mode 100644
index 971d7e4..0000000
--- a/src/test/fakeLegacyService.fdepl
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright (C) 2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
- * 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/. */
-
-import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment_spec.fdepl"
-import "fakeLegacyService.fidl"
-
-define org.genivi.commonapi.dbus.deployment for provider Service {
- instance fake.legacy.service.LegacyInterfaceNoObjectManager {
- InstanceId = "fake.legacy.service.LegacyInterfaceNoObjectManager"
-
- DBusPredefined = true
- }
-}
-
diff --git a/src/test/fakeLegacyService.fidl b/src/test/fakeLegacyService.fidl
deleted file mode 100644
index 87809e7..0000000
--- a/src/test/fakeLegacyService.fidl
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package fake.legacy.service
-
-interface LegacyInterface {
- version { major 1 minor 0 }
-
- method TestMethod {
- in {
- Int32 input
- }
- out {
- Int32 val1
- Int32 val2
- }
- }
-
- method OtherTestMethod {
- out {
- String greeting
- Int32 identifier
- }
- }
-
- method finish {}
-}
-
-interface LegacyInterfaceNoObjectManager extends LegacyInterface {
- version { major 1 minor 0 }
-}
diff --git a/src/test/fakeLegacyService/fake.legacy.service.xml b/src/test/fakeLegacyService/fake.legacy.service.xml
deleted file mode 100644
index 81b4e60..0000000
--- a/src/test/fakeLegacyService/fake.legacy.service.xml
+++ /dev/null
@@ -1,259 +0,0 @@
-<!-- Auto-Generated interface from Rhapsody: 'Repository::ssw_LifecycleSupport::NodeStateManagement::Concept::Interface::INSM_Consumer' -->
-<!-- Created at 2012-06-01 09:36:05 by uid65904 -->
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-<interface name="org.freedesktop.DBus.Introspectable">
- <method name="Introspect">
- <arg name="data" direction="out" type="s"/>
- </method>
-</interface>
-<interface name="org.freedesktop.DBus.Properties">
- <method name="Get">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="out" type="v"/>
- </method>
-
- <method name="Set">
- <arg name="interface" direction="in" type="s"/>
- <arg name="propname" direction="in" type="s"/>
- <arg name="value" direction="in" type="v"/>
- </method>
-
- <method name="GetAll">
- <arg name="interface" direction="in" type="s"/>
- <arg name="props" direction="out" type="a{sv}"/>
- </method>
-</interface>
- <!--
- org.genivi.NodeStateManager.Consumer:
- @short_description: "Consumer" interface of the NodeStateManager.
-
- This interface contains functions which are not safety critical and can be accessed by "every" client without further restrictions.
- -->
- <interface name="org.genivi.NodeStateManager.Consumer">
- <!--
- RestartReason: This property informs clients about the reason for the last restart. The values are based upon the enummeration NsmRestartReason_e. Note: The value is only set once at start-up.
- -->
- <property name="RestartReason" type="i" access="read"/>
-
- <!--
- ShutdownReason: This property informs clients about the reason for the last shutdown. The values are based upon the enummeration NsmShutdownReason_e. Note: The value is only set once at start-up.
- -->
- <property name="ShutdownReason" type="i" access="read"/>
-
- <!--
- WakeUpReason: This property informs clients about the recent reason for waking up the target. The values are based upon the enummeration NsmWakeUpReason_e. Note: The value is only set once at start-up.
- -->
- <property name="WakeUpReason" type="i" access="read"/>
-
- <!--
- BootMode: This property informs clients about the recent BootMode of the target. The values will be defined by a third party header, which has not been delivered yet. The description needs to be updated as soon as the header is available.
- -->
- <property name="BootMode" type="i" access="read"/>
-
- <!--
- NodeState:
- @NodeState: Numeric value for the current NodeState, defined in NsmNodeState_e.
-
- Clients can register for notifications when the NodeState is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeState as a parameter.
- -->
- <signal name="NodeState">
- <arg name="NodeState" type="i"/>
- </signal>
-
- <!--
- NodeApplicationMode:
- @ApplicationModeId: Numeric value for the current ApplicationMode, defined in NsmAplicationMode_e.
-
- Clients can register for notifications when the NodeApplicationMode is updated inside the NodeStateManager. This signal is sent to registered clients and will include the current NodeApplicationMode as a parameter.
- -->
- <signal name="NodeApplicationMode">
- <arg name="ApplicationModeId" type="i"/>
- </signal>
-
- <!--
- SessionStateChanged:
- @SessionStateName: The SessionName will be based upon either the pre-defined platform SessionNames or using a newly added product defined session name.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
-
- This signal is sent to registered clients when a particular session is state is changed. The client can register for notification about a specific session through the use of the SessionName, as a "match rule".
- -->
- <signal name="SessionStateChanged">
- <arg name="SessionStateName" type="s"/>
- <arg name="SeatID" type="i"/>
- <arg name="SessionState" type="i"/>
- </signal>
-
- <!--
- GetNodeState:
- @NodeStateId: Will be based on the NsmNodeState_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the NodeState without the need of registration to the signal.
- -->
- <method name="GetNodeState">
- <arg name="NodeStateId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- SetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform SessionNames (see NSM content page) or using a newly added product defined session name.
- @SessionOwner: This parameter defines the name of the application that is setting the state of the session. This must be the applications systemd unit filename.
- @SeatID: This parameter will be based upon the enum NsmSeat_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to set the state of a session.
- -->
- <method name="SetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetSessionState:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional SessionStates.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by applications to get the state of a session.
- -->
- <method name="GetSessionState">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetApplicationMode:
- @ApplicationModeId: This parameter will be based upon the NsmNodeApplicationMode_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to get the application mode.
- -->
- <method name="GetApplicationMode">
- <arg name="ApplicationModeId" direction="out" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to be informed (i.e normal, fast etc).
- @TimeoutMs: Max. Timeout to wait for response from shutdown client in ms.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register themselves as shutdown client. Any client that registers must provide a method in their D-Bus object called "LifecycleRequest". This method will take one parameter which is the RequestType (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST). For an example of the required client interface please see the BootManager component who will be a client of the NSM.
- -->
- <method name="RegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="TimeoutMs" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterShutdownClient:
- @BusName: Bus name of remote application.
- @ObjName: Object name of remote object that provides the shutdown interface.
- @ShutdownMode: Shutdown mode for which client wants to unregister (NSM_SHUTDOWNTYPE_NORMAL, NSM_SHUTDOWNTYPE_FAST).
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to unregister themselves as shutdown client.
- -->
- <method name="UnRegisterShutdownClient">
- <arg name="BusName" direction="in" type="s"/>
- <arg name="ObjName" direction="in" type="s"/>
- <arg name="ShutdownMode" direction="in" type="u"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- RegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that is registering the new session (this must be the applications systemd unit filename).
- @SeatID: This parameter will be based upon the enum NsmSeatId_e
- @SessionState: This parameter will be based upon the NsmSessionState_e but it will not be bounded by the values in that enumeration. The listed values are the default values that are mandatory for platform sessions, but product sessions may have additional session states.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to register a new session whose state should be observed and distributed by the NSM.
- -->
- <method name="RegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="SessionState" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- UnRegisterSession:
- @SessionName: The SessionName will be based upon either the pre-defined platform session names (see NSM content page) or using a newly added product defined SessionName.
- @SessionOwner: This is the name of the application that originally registered the session. It will be validated that this value matches the stored value from the registration.
- @SeatID: This parameter will be based upon the enum NsmSeat_e.
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The method is used by other applications to remove a new session from the session list hosted by NSM.
- -->
- <method name="UnRegisterSession">
- <arg name="SessionName" direction="in" type="s"/>
- <arg name="SessionOwner" direction="in" type="s"/>
- <arg name="SeatID" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
-
- <!--
- GetAppHealthCount:
- @Count: Return value passed to the caller. Number of applications that crashed or terminated accidentally.
-
- The method returns the number of applications that crashed or terminated accidentally, within the current life cycle. It can be used to observe the system state.
- -->
- <method name="GetAppHealthCount">
- <arg name="Count" direction="out" type="u"/>
- </method>
-
- <!--
- GetInterfaceVersion:
- @Version: Unsigned integer that represents the version number of the Node State Manager.
-
- The method returns the version number of the Node State Manager. The number is organized in four bytes:
-
- Version: VVV.RRR.PPP.BBB
-
- <literallayout>
- VVV => Version [1..255]
- RRR => Release [0..255]
- PPP => Patch [0..255]
- BBB => Build [0..255]
- </literallayout>
- -->
- <method name="GetInterfaceVersion">
- <arg name="Version" direction="out" type="u"/>
- </method>
-
- <!--
- LifecycleRequestComplete:
- @RequestId: The request Id of the called life cycle client. The value has been passed when "LifecycleRequest" was called.
- @Status: The result of the call to "LifecycleRequest". NsmErrorStatus_Ok: Request successfully processed. NsmErrorStatus_Error: An error occured while processing the "LifecycleRequest".
- @ErrorCode: Return value passed to the caller, based upon NsmErrorStatus_e.
-
- The function has to be called by a "asynchrounous" lifecycle client, when he processed the "LifecycleRequest".
- -->
- <method name="LifecycleRequestComplete">
- <arg name="RequestId" direction="in" type="u"/>
- <arg name="Status" direction="in" type="i"/>
- <arg name="ErrorCode" direction="out" type="i"/>
- </method>
- </interface>
-</node>
diff --git a/src/test/fakeLegacyService/fakeLegacyService.py b/src/test/fakeLegacyService/fakeLegacyService.py
deleted file mode 100644
index 0eb3a6d..0000000
--- a/src/test/fakeLegacyService/fakeLegacyService.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright (C) 2013 - 2015 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/. */
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-
-BASE_PATH = 'fake.legacy.service'
-OBJECT_PATH = '/some/legacy/path/6259504'
-
-command=sys.argv[1]
-if command=='withObjectManager':
- INTERFACE = BASE_PATH + '.LegacyInterface'
-elif command=='noObjectManager':
- INTERFACE = BASE_PATH + '.LegacyInterfaceNoObjectManager'
-
-loop = gobject.MainLoop()
-dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
-class FakeLegacyService(dbus.service.Object):
- def __init__(self, loop):
- busName = dbus.service.BusName(BASE_PATH + '.connection', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, OBJECT_PATH)
- #self.properties = {'RestartReason': 1, 'ShutdownReason': 2, 'WakeUpReason' :3, 'BootMode' :4}
- self.ABus=""
- self.APath=""
- self.loop=loop
-
- @dbus.service.method(dbus_interface=BASE_PATH + '.Introspectable', out_signature = 's')
- def Introspect(self):
- f = open('fake.legacy.service.xml', "r")
- text = f.read()
- return text
-
- @dbus.service.method(dbus_interface=INTERFACE, in_signature = 'i', out_signature = 'ii')
- def TestMethod(self, input):
- val1=input - 5
- val2=input + 5
- return val1, val2
-
- @dbus.service.method(dbus_interface=INTERFACE, out_signature = 'si')
- def OtherTestMethod(self):
- greeting='Hello'
- identifier=42
- return greeting, identifier
-
- @dbus.service.method(dbus_interface=INTERFACE)
- def finish(self):
- self.loop.quit()
- return 0
-
-class ObjectManager(dbus.service.Object):
- def __init__(self, loop):
- busName = dbus.service.BusName(BASE_PATH + '.connection', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, '/')
- self.ABus=""
- self.APath=""
- self.loop=loop
-
- @dbus.service.method(dbus_interface='org.freedesktop.DBus.ObjectManager', out_signature = 'a{oa{sa{sv}}}')
- def GetManagedObjects(self):
- response = {}
- idict = {}
- idict[INTERFACE] = {}
- idict[BASE_PATH + '.Introspectable'] = {}
- response[OBJECT_PATH] = idict
- return response
-
-nsm = FakeLegacyService(loop)
-if command=='withObjectManager':
- ObjectManager(loop)
-
-loop.run()
-
-
diff --git a/src/test/fakeLegacyService/sendToFakeLegacyService.py b/src/test/fakeLegacyService/sendToFakeLegacyService.py
deleted file mode 100644
index cfe2e6d..0000000
--- a/src/test/fakeLegacyService/sendToFakeLegacyService.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2013 - 2015 BMW Group
-# Author: Manfred Bathelt (manfred.bathelt@bmw.de)
-# Author: Juergen Gehring (juergen.gehring@bmw.de)
-# 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/. */
-
-import sys
-import traceback
-import gobject
-import math
-import dbus
-import dbus.service
-
-BASE_PATH = 'fake.legacy.service'
-OBJECT_PATH = '/some/legacy/path/6259504'
-
-def finish(interface):
- try:
- bus = dbus.SessionBus()
- remote_object = bus.get_object(BASE_PATH + '.connection', OBJECT_PATH)
- iface = dbus.Interface(remote_object, interface)
- iface.finish()
- return 0
- except:
- print "Service not existing, therefore could not be stopped"
- return 1
-
-def main():
- command=sys.argv[1]
- interface=sys.argv[2]
- if command=="finish":
- return finish(interface)
-
- return 0
-
-sys.exit(main())
diff --git a/src/test/leaf.fidl b/src/test/leaf.fidl
deleted file mode 100644
index 09f47c4..0000000
--- a/src/test/leaf.fidl
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests.managed
-
-interface LeafInterface {
- version { major 1 minor 0 }
-
-
- method testLeafMethod {
- in {
- Int32 inInt
- String inString
- }
- out {
- Int32 outInt
- String outString
- }
- error {
- OK
- NOTOK
- }
- }
-
-}
-
diff --git a/src/test/root.fidl b/src/test/root.fidl
deleted file mode 100644
index f669ed9..0000000
--- a/src/test/root.fidl
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests.managed
-
-import commonapi.tests.managed.* from "leaf.fidl"
-
-
-interface BranchInterface {
- version { major 1 minor 0 }
-
-
- method testBranchMethod {
- in {
- Int32 inInt
- String inString
- }
- out {
- Int32 outInt
- String outString
- }
- error {
- OK
- NOTOK
- }
- }
-
-}
-
-
-
-interface RootInterface manages LeafInterface, BranchInterface {
- version { major 1 minor 0 }
-
- method testRootMethod {
- in {
- Int32 inInt
- String inString
- }
- out {
- Int32 outInt
- String outString
- }
- error {
- OK
- NOTOK
- }
- }
-
-}
-
-interface SecondRoot manages LeafInterface {
- version { major 1 minor 0 }
-}
diff --git a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp b/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp
deleted file mode 100644
index 9f4fc7e..0000000
--- a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "DerivedTypeCollection.hpp"
-
-
-namespace commonapi {
-namespace tests {
-
-
-
-std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct> DerivedTypeCollection::TestPolymorphicStruct::create(CommonAPI::Serial _serial) {
- switch (_serial) {
- case DerivedTypeCollection::TESTPOLYMORPHICSTRUCT_SERIAL:
- return std::make_shared<DerivedTypeCollection::TestPolymorphicStruct>();
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- return std::make_shared<DerivedTypeCollection::TestExtendedPolymorphicStruct>();
- default:
- break;
- }
- return std::shared_ptr<DerivedTypeCollection::TestPolymorphicStruct>();
-}
-
-
-
-
-
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp b/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
deleted file mode 100644
index 3a8ade3..0000000
--- a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef COMMONAPI_TESTS_Derived_Type_Collection_HPP_
-#define COMMONAPI_TESTS_Derived_Type_Collection_HPP_
-
-
-#include <commonapi/tests/PredefinedTypeCollection.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Deployment.hpp>
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Struct.hpp>
-#include <CommonAPI/Types.hpp>
-#include <cstdint>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-struct DerivedTypeCollection {
- struct TestStruct : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> {
-
- TestStruct() {
- }
- TestStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
- {
- std::get<0>(values_) = _testString;
- std::get<1>(values_) = _uintValue;
- }
- /**
- * description: the name of the property
- */
- inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
- inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
- /**
- * description: the actual value
- */
- inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
- inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
- inline bool operator==(const TestStruct& _other) const {
- return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
- }
- inline bool operator!=(const TestStruct &_other) const {
- return !((*this) == _other);
- }
-
- };
- typedef std::vector<DerivedTypeCollection::TestStruct> TestArrayTestStruct;
- typedef std::unordered_map<uint32_t, ::commonapi::tests::DerivedTypeCollection::TestArrayTestStruct> TestMap;
-
- struct TestEnum : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- E_UNKNOWN = 0,
- E_OK = 1,
- E_OUT_OF_RANGE = 2,
- E_NOT_USED = 3
- };
-
- TestEnum()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E_UNKNOWN)) {}
- TestEnum(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::E_UNKNOWN):
- case static_cast<int32_t>(Literal::E_OK):
- case static_cast<int32_t>(Literal::E_OUT_OF_RANGE):
- case static_cast<int32_t>(Literal::E_NOT_USED):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const TestEnum &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const TestEnum &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const TestEnum &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const TestEnum &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const TestEnum &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const TestEnum &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
-
- struct TestEnumExtended : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- E_UNKNOWN = 0,
- E_OK = 1,
- E_OUT_OF_RANGE = 2,
- E_NOT_USED = 3,
- E_NEW = 4
- };
-
- TestEnumExtended()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E_UNKNOWN)) {}
- TestEnumExtended(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
- TestEnumExtended &operator=(const TestEnum::Literal &_value) {
- value_ = static_cast<int32_t>(_value);
- return (*this);
- }
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::E_UNKNOWN):
- case static_cast<int32_t>(Literal::E_OK):
- case static_cast<int32_t>(Literal::E_OUT_OF_RANGE):
- case static_cast<int32_t>(Literal::E_NOT_USED):
- case static_cast<int32_t>(Literal::E_NEW):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const TestEnumExtended &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const TestEnumExtended &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const TestEnumExtended &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const TestEnumExtended &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const TestEnumExtended &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const TestEnumExtended &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
-
- struct TestEnumExtended2 : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- E_UNKNOWN = 0,
- E_OK = 1,
- E_OUT_OF_RANGE = 2,
- E_NOT_USED = 3,
- E_NEW = 4,
- E_NEW2 = 5
- };
-
- TestEnumExtended2()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E_UNKNOWN)) {}
- TestEnumExtended2(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
- TestEnumExtended2 &operator=(const TestEnumExtended::Literal &_value) {
- value_ = static_cast<int32_t>(_value);
- return (*this);
- }
- TestEnumExtended2 &operator=(const TestEnum::Literal &_value) {
- value_ = static_cast<int32_t>(_value);
- return (*this);
- }
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::E_UNKNOWN):
- case static_cast<int32_t>(Literal::E_OK):
- case static_cast<int32_t>(Literal::E_OUT_OF_RANGE):
- case static_cast<int32_t>(Literal::E_NOT_USED):
- case static_cast<int32_t>(Literal::E_NEW):
- case static_cast<int32_t>(Literal::E_NEW2):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const TestEnumExtended2 &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const TestEnumExtended2 &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const TestEnumExtended2 &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const TestEnumExtended2 &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const TestEnumExtended2 &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const TestEnumExtended2 &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
- struct TestStructExtended : CommonAPI::Struct<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t, TestEnumExtended2> {
-
- TestStructExtended() {
- }
- TestStructExtended(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const TestEnumExtended2 &_testEnumExtended2)
- {
- std::get<0>(values_) = _testString;
- std::get<1>(values_) = _uintValue;
- std::get<2>(values_) = _testEnumExtended2;
- }
- /**
- * description: the name of the property
- */
- inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
- inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
- /**
- * description: the actual value
- */
- inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
- inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
- inline const TestEnumExtended2 &getTestEnumExtended2() const { return std::get<2>(values_); }
- inline void setTestEnumExtended2(const TestEnumExtended2 &_value) { std::get<2>(values_) = _value; }
- inline bool operator==(const TestStructExtended& _other) const {
- return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getTestEnumExtended2() == _other.getTestEnumExtended2());
- }
- inline bool operator!=(const TestStructExtended &_other) const {
- return !((*this) == _other);
- }
-
- };
- typedef std::unordered_map<::commonapi::tests::DerivedTypeCollection::TestEnum, std::string, CommonAPI::EnumHasher<::commonapi::tests::DerivedTypeCollection::TestEnum>> TestEnumMap;
-
- struct TestEnumMissingValue : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- E1 = 0,
- E2 = 1,
- E3 = 2
- };
-
- TestEnumMissingValue()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E1)) {}
- TestEnumMissingValue(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::E1):
- case static_cast<int32_t>(Literal::E2):
- case static_cast<int32_t>(Literal::E3):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const TestEnumMissingValue &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const TestEnumMissingValue &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const TestEnumMissingValue &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const TestEnumMissingValue &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const TestEnumMissingValue &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const TestEnumMissingValue &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
- typedef std::vector<uint64_t> TestArrayUInt64;
- static const CommonAPI::Serial TESTPOLYMORPHICSTRUCT_SERIAL = 0x8F51A326;
- static const CommonAPI::Serial TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL = 0xA49310F2;
-
- struct TestPolymorphicStruct : CommonAPI::PolymorphicStruct {
- static std::shared_ptr<TestPolymorphicStruct> create(CommonAPI::Serial _serial);
- CommonAPI::Serial getSerial() const { return TESTPOLYMORPHICSTRUCT_SERIAL; }
-
- TestPolymorphicStruct() {
- }
- TestPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue)
- {
- std::get<0>(values_) = _testString;
- std::get<1>(values_) = _uintValue;
- }
- template<class _Input>
- void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
- _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
- _input.template readValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<_Input>(_input, _depl);
- break;
- default:
- break;
- }
- }
-
- template<class _Input, class _Deployment>
- void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
- _input.template readValue<>(std::get<0>(values_), std::get<0>(_depl->values_));
- _input.template readValue<>(std::get<1>(values_), std::get<1>(_depl->values_));
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template readValue<>(_input, _depl);
- break;
- default:
- break;
- }
- }
- template<class _Output>
- void writeType(CommonAPI::TypeOutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
- _output.writeType(std::get<0>(values_), _depl);
- _output.writeType(std::get<1>(values_), _depl);
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output>(_output, _depl);
- break;
- default:
- break;
- }
- }
- template<class _Output, class _Deployment>
- void writeType(CommonAPI::TypeOutputStream<_Output> &_output, const _Deployment *_depl) {
- _output.writeType(std::get<0>(values_), std::get<0>(_depl->values_));
- _output.writeType(std::get<1>(values_), std::get<1>(_depl->values_));
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output, _Deployment>(_output, _depl);
- break;
- default:
- break;
- }
- }
-
- template<class _Output>
- void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
- _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
- _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<1>(values_));
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<_Output>(_output, _depl);
- break;
- default:
- break;
- }
- }
-
- template<class _Output, class _Deployment>
- void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
- _output.template writeValue<>(std::get<0>(values_), std::get<0>(_depl->values_));
- _output.template writeValue<>(std::get<1>(values_), std::get<1>(_depl->values_));
- switch (getSerial()) {
- case TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL:
- static_cast<TestExtendedPolymorphicStruct *>(this)->template writeValue<>(_output, _depl);
- break;
- default:
- break;
- }
- }
- /**
- * description: the name of the property
- */
- inline const ::commonapi::tests::PredefinedTypeCollection::TestString &getTestString() const { return std::get<0>(values_); }
- inline void setTestString(const ::commonapi::tests::PredefinedTypeCollection::TestString &_value) { std::get<0>(values_) = _value; }
- /**
- * description: the actual value
- */
- inline const uint16_t &getUintValue() const { return std::get<1>(values_); }
- inline void setUintValue(const uint16_t &_value) { std::get<1>(values_) = _value; }
-
- std::tuple<::commonapi::tests::PredefinedTypeCollection::TestString, uint16_t> values_;
- inline bool operator==(const TestPolymorphicStruct& _other) const {
- return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue());
- }
- inline bool operator!=(const TestPolymorphicStruct &_other) const {
- return !((*this) == _other);
- }
-
- };
- struct TestExtendedPolymorphicStruct : TestPolymorphicStruct {
- CommonAPI::Serial getSerial() const { return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
-
- TestExtendedPolymorphicStruct() {
- }
- TestExtendedPolymorphicStruct(const ::commonapi::tests::PredefinedTypeCollection::TestString &_testString, const uint16_t &_uintValue, const uint32_t &_additionalValue)
- : TestPolymorphicStruct(_testString, _uintValue)
- {
- std::get<0>(values_) = _additionalValue;
- }
- template<class _Input>
- void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
- (void) _depl;
- _input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
- }
-
- template<class _Input, class _Deployment>
- void readValue(CommonAPI::InputStream<_Input> &_input, const _Deployment *_depl) {
- _input.template readValue<>(std::get<0>(values_), std::get<2>(_depl->values_));
- }
- template<class _Output>
- void writeType(CommonAPI::TypeOutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
- _output.writeType(std::get<0>(values_), _depl);
- }
- template<class _Output, class _Deployment>
- void writeType(CommonAPI::TypeOutputStream<_Output> &_output, const _Deployment *_depl) {
- _output.writeType(std::get<0>(values_), std::get<2>(_depl->values_));
- }
-
- template<class _Output>
- void writeValue(CommonAPI::OutputStream<_Output> &_output, const CommonAPI::EmptyDeployment *_depl) {
- (void) _depl;
- _output.template writeValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
- }
-
- template<class _Output, class _Deployment>
- void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
- _output.template writeValue<>(std::get<0>(values_), std::get<2>(_depl->values_));
- }
- inline const uint32_t &getAdditionalValue() const { return std::get<0>(values_); }
- inline void setAdditionalValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
-
- std::tuple<uint32_t> values_;
- inline bool operator==(const TestExtendedPolymorphicStruct& _other) const {
- return (getTestString() == _other.getTestString() && getUintValue() == _other.getUintValue() && getAdditionalValue() == _other.getAdditionalValue());
- }
- inline bool operator!=(const TestExtendedPolymorphicStruct &_other) const {
- return !((*this) == _other);
- }
-
- };
- typedef std::unordered_map<uint8_t, std::shared_ptr<TestPolymorphicStruct>> MapIntToPolymorphic;
- struct StructWithPolymorphicMember : CommonAPI::Struct<uint32_t, std::shared_ptr<TestPolymorphicStruct>> {
-
- StructWithPolymorphicMember() {
- }
- StructWithPolymorphicMember(const uint32_t &_numberValue, const std::shared_ptr<TestPolymorphicStruct> &_polymorphicMember)
- {
- std::get<0>(values_) = _numberValue;
- std::get<1>(values_) = _polymorphicMember;
- }
- inline const uint32_t &getNumberValue() const { return std::get<0>(values_); }
- inline void setNumberValue(const uint32_t &_value) { std::get<0>(values_) = _value; }
- inline const std::shared_ptr<TestPolymorphicStruct> &getPolymorphicMember() const { return std::get<1>(values_); }
- inline void setPolymorphicMember(const std::shared_ptr<TestPolymorphicStruct> &_value) { std::get<1>(values_) = _value; }
- inline bool operator==(const StructWithPolymorphicMember& _other) const {
- return (getNumberValue() == _other.getNumberValue() && getPolymorphicMember() == _other.getPolymorphicMember());
- }
- inline bool operator!=(const StructWithPolymorphicMember &_other) const {
- return !((*this) == _other);
- }
-
- };
- struct StructWithEnumKeyMap : CommonAPI::Struct<TestEnumMap> {
-
- StructWithEnumKeyMap() {
- }
- StructWithEnumKeyMap(const TestEnumMap &_testMap)
- {
- std::get<0>(values_) = _testMap;
- }
- inline const TestEnumMap &getTestMap() const { return std::get<0>(values_); }
- inline void setTestMap(const TestEnumMap &_value) { std::get<0>(values_) = _value; }
- inline bool operator==(const StructWithEnumKeyMap& _other) const {
- return (getTestMap() == _other.getTestMap());
- }
- inline bool operator!=(const StructWithEnumKeyMap &_other) const {
- return !((*this) == _other);
- }
-
- };
-
-
-
-static inline const char* getTypeCollectionName() {
- static const char* typeCollectionName = "commonapi.tests.DerivedTypeCollection";
- return typeCollectionName;
-}
-
-
-}; // struct DerivedTypeCollection
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-}
-
-
-namespace std {
- //Hash for TestEnum
- template<>
- struct hash<::commonapi::tests::DerivedTypeCollection::TestEnum> {
- inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnum& testEnum) const {
- return static_cast<int32_t>(testEnum);
- }
- };
- //Hash for TestEnumExtended2
- template<>
- struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2> {
- inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2& testEnumExtended2) const {
- return static_cast<int32_t>(testEnumExtended2);
- }
- };
- //Hash for TestEnumMissingValue
- template<>
- struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue> {
- inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumMissingValue& testEnumMissingValue) const {
- return static_cast<int32_t>(testEnumMissingValue);
- }
- };
- //Hash for TestEnumExtended
- template<>
- struct hash<::commonapi::tests::DerivedTypeCollection::TestEnumExtended> {
- inline size_t operator()(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended& testEnumExtended) const {
- return static_cast<int32_t>(testEnumExtended);
- }
- };
-}
-
-
-
-#endif // COMMONAPI_TESTS_Derived_Type_Collection_HPP_
diff --git a/src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp b/src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp
deleted file mode 100644
index 3a98d9b..0000000
--- a/src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
-#define COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/ByteBuffer.hpp>
-#include <CommonAPI/Types.hpp>
-#include <cstdint>
-#include <string>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-
-struct PredefinedTypeCollection {
- typedef uint8_t TestUInt8;
- typedef uint16_t TestUInt16;
- typedef uint32_t TestUInt32;
- typedef uint64_t TestUInt64;
- typedef int8_t TestInt8;
- typedef int16_t TestInt16;
- typedef int32_t TestInt32;
- typedef int64_t TestInt64;
- typedef bool TestBoolean;
- typedef CommonAPI::ByteBuffer TestByteBuffer;
- typedef double TestDouble;
- typedef float TestFloat;
- typedef std::string TestString;
-
-
-
-static inline const char* getTypeCollectionName() {
- static const char* typeCollectionName = "commonapi.tests.PredefinedTypeCollection";
- return typeCollectionName;
-}
-
-
-}; // struct PredefinedTypeCollection
-
-} // namespace tests
-} // namespace commonapi
-
-namespace CommonAPI {
-}
-
-
-namespace std {
-}
-
-
-
-#endif // COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp
deleted file mode 100644
index 2f401f1..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
-
-
-
-#include <v1/commonapi/tests/TestInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class ExtendedInterface
-: virtual public TestInterface {
-public:
- virtual ~ExtendedInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* ExtendedInterface::getInterface() {
- return ("commonapi.tests.ExtendedInterface");
-}
-
-CommonAPI::Version ExtendedInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp
deleted file mode 100644
index 077c236..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
-
-#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class ExtendedInterfaceProxy
- : virtual public ExtendedInterface,
- virtual public ExtendedInterfaceProxyBase,
- public TestInterfaceProxy<_AttributeExtensions...>,
- virtual public _AttributeExtensions... {
-public:
- ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~ExtendedInterfaceProxy();
-
- typedef ExtendedInterface InterfaceType;
-
- inline static const char* getInterface() {
- return(ExtendedInterface::getInterface());
- }
-
-
-
- /**
- * Calls TestIntMethodExtended with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestIntMethodExtended with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * 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 = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<ExtendedInterfaceProxyBase> delegate_;
-};
-
-typedef ExtendedInterfaceProxy<> ExtendedInterfaceProxyDefault;
-
-
-//
-// ExtendedInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-ExtendedInterfaceProxy<_AttributeExtensions...>::ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- ::v1::commonapi::tests::TestInterfaceProxy<_AttributeExtensions...>(delegate),
- _AttributeExtensions(*(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-ExtendedInterfaceProxy<_AttributeExtensions...>::~ExtendedInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->TestIntMethodExtended(_inInt, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> ExtendedInterfaceProxy<_AttributeExtensions...>::TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestIntMethodExtendedAsync(_inInt, _callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &ExtendedInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool ExtendedInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool ExtendedInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& ExtendedInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp
deleted file mode 100644
index 9a3080f..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/ExtendedInterface.hpp>
-#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class ExtendedInterfaceProxyBase
- : virtual public TestInterfaceProxyBase {
-public:
-
- typedef std::function<void(const CommonAPI::CallStatus&)> TestIntMethodExtendedAsyncCallback;
-
-
-
- virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp
deleted file mode 100644
index 432640f..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-
-#include <v1/commonapi/tests/ExtendedInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service ExtendedInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class ExtendedInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual ExtendedInterface,
- public virtual TestInterfaceStubAdapter {
- public:
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for ExtendedInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class ExtendedInterfaceStubRemoteEvent
-: public virtual TestInterfaceStubRemoteEvent
-{
-public:
- virtual ~ExtendedInterfaceStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service ExtendedInterface to remote clients.
- * 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 ExtendedInterfaceStub
- : public virtual CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>,
- public virtual TestInterfaceStub
-{
-public:
- typedef std::function<void ()>TestIntMethodExtendedReply_t;
-
- 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> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply) = 0;
-
- using CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef ExtendedInterfaceStubRemoteEvent RemoteEventType;
- typedef ExtendedInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp
deleted file mode 100644
index f3bc8ac..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(ExtendedInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter> &_adapter) {
- TestInterfaceStubDefault::initStubAdapter(_adapter);
- CommonAPI::Stub<ExtendedInterfaceStubAdapter, ExtendedInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-void ExtendedInterfaceStubDefault::TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply) {
- (void)_client;
- (void) _inInt;
- _reply();
-}
-
-
-
-
-ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInterfaceStubDefault *_defaultStub)
- : TestInterfaceStubDefault::RemoteEventHandler(_defaultStub),
- defaultStub_(_defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp
deleted file mode 100644
index d353919..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-
-#include <v1/commonapi/tests/ExtendedInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for ExtendedInterfaceStubRemoteEvent and
- * ExtendedInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class ExtendedInterfaceStubDefault
- : public virtual ExtendedInterfaceStub,
- public virtual TestInterfaceStubDefault {
-public:
- ExtendedInterfaceStubDefault();
-
- ExtendedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<ExtendedInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
- virtual void TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply);
-
-
-
-protected:
- class RemoteEventHandler: public virtual ExtendedInterfaceStubRemoteEvent, public virtual TestInterfaceStubDefault::RemoteEventHandler {
- public:
- RemoteEventHandler(ExtendedInterfaceStubDefault *_defaultStub);
-
-
- private:
- ExtendedInterfaceStubDefault *defaultStub_;
- };
-private:
- ExtendedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp
deleted file mode 100644
index 5ce8a0e..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_DERIVED_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_DERIVED_INTERFACE_HPP_
-
-
-
-#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterface
-: virtual public TestFreedesktopInterface {
-public:
- virtual ~TestFreedesktopDerivedInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestFreedesktopDerivedInterface::getInterface() {
- return ("commonapi.tests.TestFreedesktopDerivedInterface");
-}
-
-CommonAPI::Version TestFreedesktopDerivedInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_DERIVED_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp
deleted file mode 100644
index edc78ab..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp>
-
-#include "v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/AttributeExtension.hpp>
-#include <CommonAPI/Factory.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestFreedesktopDerivedInterfaceProxy
- : virtual public TestFreedesktopDerivedInterface,
- virtual public TestFreedesktopDerivedInterfaceProxyBase,
- public TestFreedesktopInterfaceProxy<_AttributeExtensions...>,
- virtual public _AttributeExtensions... {
-public:
- TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestFreedesktopDerivedInterfaceProxy();
-
- typedef TestFreedesktopDerivedInterface InterfaceType;
-
- inline static const char* getInterface() {
- return(TestFreedesktopDerivedInterface::getInterface());
- }
-
- /**
- * Returns the wrapper class that provides access to the attribute TestAttributedFromDerivedInterface.
- */
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute() {
- return delegate_->getTestAttributedFromDerivedInterfaceAttribute();
- }
-
-
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestFreedesktopDerivedInterfaceProxyBase> delegate_;
-};
-
-typedef TestFreedesktopDerivedInterfaceProxy<> TestFreedesktopDerivedInterfaceProxyDefault;
-
-namespace TestFreedesktopDerivedInterfaceExtensions {
- template <template <typename > class _ExtensionType>
- class TestAttributedFromDerivedInterfaceAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopDerivedInterfaceProxyBase::TestAttributedFromDerivedInterfaceAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopDerivedInterfaceProxyBase::TestAttributedFromDerivedInterfaceAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestAttributedFromDerivedInterfaceAttributeExtension() {}
- #endif
-
- TestAttributedFromDerivedInterfaceAttributeExtension(TestFreedesktopDerivedInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestAttributedFromDerivedInterfaceAttribute()) {
- }
-
- inline extension_type& getTestAttributedFromDerivedInterfaceAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
-} // namespace TestFreedesktopDerivedInterfaceExtensions
-
-//
-// TestFreedesktopDerivedInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- ::v1::commonapi::tests::TestFreedesktopInterfaceProxy<_AttributeExtensions...>(delegate),
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::~TestFreedesktopDerivedInterfaceProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestFreedesktopDerivedInterfaceProxy,
- _AttributeExtension> {
- typedef typename ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceProxy<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceExtensions::TestAttributedFromDerivedInterfaceAttributeExtension<_AttributeExtension>
- > class_t;
-};
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp
deleted file mode 100644
index d1496e4..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Attribute.hpp>
-#include <CommonAPI/Proxy.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterfaceProxyBase
- : virtual public TestFreedesktopInterfaceProxyBase {
-public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestAttributedFromDerivedInterfaceAttribute;
-
-
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute() = 0;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp
deleted file mode 100644
index 4f2f3fe..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestFreedesktopDerivedInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestFreedesktopDerivedInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual TestFreedesktopDerivedInterface,
- public virtual TestFreedesktopInterfaceStubAdapter {
- public:
- ///Notifies all remote listeners about a change of value of the attribute TestAttributedFromDerivedInterface.
- virtual void fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& TestAttributedFromDerivedInterface) = 0;
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestFreedesktopDerivedInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopDerivedInterfaceStubRemoteEvent
-: public virtual TestFreedesktopInterfaceStubRemoteEvent
-{
-public:
- virtual ~TestFreedesktopDerivedInterfaceStubRemoteEvent() { }
-
- /// Verification callback for remote set requests on the attribute TestAttributedFromDerivedInterface
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) = 0;
- /// Action callback for remote set requests on the attribute TestAttributedFromDerivedInterface
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() = 0;
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestFreedesktopDerivedInterface to remote clients.
- * 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 TestFreedesktopDerivedInterfaceStub
- : public virtual CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>,
- public virtual TestFreedesktopInterfaceStub
-{
-public:
-
- virtual ~TestFreedesktopDerivedInterfaceStub() {}
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
- /// Provides getter access to the attribute TestAttributedFromDerivedInterface
- virtual const uint32_t &getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
-
-
- using CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestFreedesktopDerivedInterfaceStubRemoteEvent RemoteEventType;
- typedef TestFreedesktopDerivedInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
deleted file mode 100644
index 255ad8b..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-TestFreedesktopDerivedInterfaceStubDefault::TestFreedesktopDerivedInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestFreedesktopDerivedInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestFreedesktopDerivedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-TestFreedesktopDerivedInterfaceStubRemoteEvent* TestFreedesktopDerivedInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestFreedesktopDerivedInterfaceStubAdapter> &_adapter) {
- TestFreedesktopInterfaceStubDefault::initStubAdapter(_adapter);
- CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestFreedesktopDerivedInterfaceStubDefault::getTestAttributedFromDerivedInterfaceAttribute() {
- return testAttributedFromDerivedInterfaceAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopDerivedInterfaceStubDefault::getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestAttributedFromDerivedInterfaceAttribute();
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::setTestAttributedFromDerivedInterfaceAttribute(uint32_t _value) {
- const bool valueChanged = trySetTestAttributedFromDerivedInterfaceAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestAttributedFromDerivedInterfaceAttributeChanged(testAttributedFromDerivedInterfaceAttributeValue_);
- }
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::trySetTestAttributedFromDerivedInterfaceAttribute(uint32_t _value) {
- if (!validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testAttributedFromDerivedInterfaceAttributeValue_ != _value);
- testAttributedFromDerivedInterfaceAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(const uint32_t &_value) {
- (void)_value;
- return true;
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::setTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- setTestAttributedFromDerivedInterfaceAttribute(_value);
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestAttributedFromDerivedInterfaceAttribute(uint32_t _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestAttributedFromDerivedInterfaceAttribute(std::move(_value));
-}
-
-bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- return onRemoteSetTestAttributedFromDerivedInterfaceAttribute(_value);
-}
-
-
-
-
-
-TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestFreedesktopDerivedInterfaceStubDefault *_defaultStub)
- : TestFreedesktopInterfaceStubDefault::RemoteEventHandler(_defaultStub),
- defaultStub_(_defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp
deleted file mode 100644
index 63d7b42..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestFreedesktopDerivedInterfaceStubRemoteEvent and
- * TestFreedesktopDerivedInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestFreedesktopDerivedInterfaceStubDefault
- : public virtual TestFreedesktopDerivedInterfaceStub,
- public virtual TestFreedesktopInterfaceStubDefault {
-public:
- TestFreedesktopDerivedInterfaceStubDefault();
-
- TestFreedesktopDerivedInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestFreedesktopDerivedInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
- virtual const uint32_t& getTestAttributedFromDerivedInterfaceAttribute();
- virtual const uint32_t& getTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestAttributedFromDerivedInterfaceAttribute(uint32_t _value);
- virtual void setTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
-
-
-
-
-protected:
- virtual bool trySetTestAttributedFromDerivedInterfaceAttribute(uint32_t _value);
- virtual bool validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(const uint32_t &_value);
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
- class RemoteEventHandler: public virtual TestFreedesktopDerivedInterfaceStubRemoteEvent, public virtual TestFreedesktopInterfaceStubDefault::RemoteEventHandler {
- public:
- RemoteEventHandler(TestFreedesktopDerivedInterfaceStubDefault *_defaultStub);
-
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(uint32_t _value);
- virtual bool onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
- virtual void onRemoteTestAttributedFromDerivedInterfaceAttributeChanged();
-
-
- private:
- TestFreedesktopDerivedInterfaceStubDefault *defaultStub_;
- };
-private:
- TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testAttributedFromDerivedInterfaceAttributeValue_ {};
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp
deleted file mode 100644
index 801533d..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_INTERFACE_HPP_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterface {
-public:
- virtual ~TestFreedesktopInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestFreedesktopInterface::getInterface() {
- return ("commonapi.tests.TestFreedesktopInterface");
-}
-
-CommonAPI::Version TestFreedesktopInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_TEST_FREEDESKTOP_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp
deleted file mode 100644
index e1dc664..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/AttributeExtension.hpp>
-#include <CommonAPI/Factory.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestFreedesktopInterfaceProxy
- : virtual public TestFreedesktopInterface,
- virtual public TestFreedesktopInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- TestFreedesktopInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestFreedesktopInterfaceProxy();
-
- typedef TestFreedesktopInterface InterfaceType;
-
-
- /**
- * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute.
- */
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() {
- return delegate_->getTestPredefinedTypeAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestReadonlyAttribute.
- */
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute() {
- return delegate_->getTestReadonlyAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute.
- */
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() {
- return delegate_->getTestDerivedStructAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute.
- */
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() {
- return delegate_->getTestDerivedArrayAttributeAttribute();
- }
-
-
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestFreedesktopInterfaceProxyBase> delegate_;
-};
-
-typedef TestFreedesktopInterfaceProxy<> TestFreedesktopInterfaceProxyDefault;
-
-namespace TestFreedesktopInterfaceExtensions {
- template <template <typename > class _ExtensionType>
- class TestPredefinedTypeAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestPredefinedTypeAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestPredefinedTypeAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestPredefinedTypeAttributeAttributeExtension() {}
- #endif
-
- TestPredefinedTypeAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestPredefinedTypeAttributeAttribute()) {
- }
-
- inline extension_type& getTestPredefinedTypeAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestReadonlyAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestReadonlyAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestReadonlyAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestReadonlyAttributeAttributeExtension() {}
- #endif
-
- TestReadonlyAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestReadonlyAttributeAttribute()) {
- }
-
- inline extension_type& getTestReadonlyAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedStructAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestDerivedStructAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestDerivedStructAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedStructAttributeAttributeExtension() {}
- #endif
-
- TestDerivedStructAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedStructAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedStructAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedArrayAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestFreedesktopInterfaceProxyBase::TestDerivedArrayAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestFreedesktopInterfaceProxyBase::TestDerivedArrayAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedArrayAttributeAttributeExtension() {}
- #endif
-
- TestDerivedArrayAttributeAttributeExtension(TestFreedesktopInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedArrayAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedArrayAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
-} // namespace TestFreedesktopInterfaceExtensions
-
-//
-// TestFreedesktopInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestFreedesktopInterfaceProxy<_AttributeExtensions...>::TestFreedesktopInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestFreedesktopInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestFreedesktopInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestFreedesktopInterfaceProxy<_AttributeExtensions...>::~TestFreedesktopInterfaceProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestFreedesktopInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestFreedesktopInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestFreedesktopInterfaceProxy,
- _AttributeExtension> {
- typedef typename ::v1::commonapi::tests::TestFreedesktopInterfaceProxy<
- ::v1::commonapi::tests::TestFreedesktopInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- ::v1::commonapi::tests::TestFreedesktopInterfaceExtensions::TestReadonlyAttributeAttributeExtension<_AttributeExtension>,
- ::v1::commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- ::v1::commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_AttributeExtension>
- > class_t;
-};
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp
deleted file mode 100644
index fec0ce3..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
-
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <cstdint>
-#include <vector>
-
-#include <CommonAPI/Attribute.hpp>
-#include <CommonAPI/Proxy.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestPredefinedTypeAttributeAttribute;
- typedef CommonAPI::ObservableReadonlyAttribute<uint32_t> TestReadonlyAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestStructExtended> TestDerivedStructAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64> TestDerivedArrayAttributeAttribute;
-
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() = 0;
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute() = 0;
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() = 0;
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() = 0;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp
deleted file mode 100644
index c354509..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-
-#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <cstdint>
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestFreedesktopInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestFreedesktopInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual TestFreedesktopInterface {
- public:
- ///Notifies all remote listeners about a change of value of the attribute TestPredefinedTypeAttribute.
- virtual void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& TestPredefinedTypeAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestReadonlyAttribute.
- virtual void fireTestReadonlyAttributeAttributeChanged(const uint32_t& TestReadonlyAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedStructAttribute.
- virtual void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestDerivedStructAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedArrayAttribute.
- virtual void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestDerivedArrayAttribute) = 0;
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestFreedesktopInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestFreedesktopInterfaceStubRemoteEvent
-{
-public:
- virtual ~TestFreedesktopInterfaceStubRemoteEvent() { }
-
- /// Verification callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) = 0;
- /// Action callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged() = 0;
- /// Verification callback for remote set requests on the attribute TestDerivedStructAttribute
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) = 0;
- /// Action callback for remote set requests on the attribute TestDerivedStructAttribute
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged() = 0;
- /// Verification callback for remote set requests on the attribute TestDerivedArrayAttribute
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) = 0;
- /// Action callback for remote set requests on the attribute TestDerivedArrayAttribute
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0;
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestFreedesktopInterface to remote clients.
- * 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 TestFreedesktopInterfaceStub
- : public virtual CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>
-{
-public:
-
- virtual ~TestFreedesktopInterfaceStub() {}
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
- /// Provides getter access to the attribute TestPredefinedTypeAttribute
- virtual const uint32_t &getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /// Provides getter access to the attribute TestReadonlyAttribute
- virtual const uint32_t &getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /// Provides getter access to the attribute TestDerivedStructAttribute
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /// Provides getter access to the attribute TestDerivedArrayAttribute
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
-
-
- using CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestFreedesktopInterfaceStubRemoteEvent RemoteEventType;
- typedef TestFreedesktopInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
deleted file mode 100644
index 4dd9cda..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-TestFreedesktopInterfaceStubDefault::TestFreedesktopInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestFreedesktopInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestFreedesktopInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-TestFreedesktopInterfaceStubRemoteEvent* TestFreedesktopInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestFreedesktopInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttributeAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestPredefinedTypeAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- if (!validateTestPredefinedTypeAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testPredefinedTypeAttributeAttributeValue_ != _value);
- testPredefinedTypeAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value) {
- (void)_value;
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- setTestPredefinedTypeAttributeAttribute(_value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- return onRemoteSetTestPredefinedTypeAttributeAttribute(_value);
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestReadonlyAttributeAttribute() {
- return testReadonlyAttributeAttributeValue_;
-}
-
-const uint32_t& TestFreedesktopInterfaceStubDefault::getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestReadonlyAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestReadonlyAttributeAttribute(uint32_t _value) {
- const bool valueChanged = trySetTestReadonlyAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestReadonlyAttributeAttributeChanged(testReadonlyAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestReadonlyAttributeAttribute(uint32_t _value) {
- if (!validateTestReadonlyAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testReadonlyAttributeAttributeValue_ != _value);
- testReadonlyAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestReadonlyAttributeAttributeRequestedValue(const uint32_t &_value) {
- (void)_value;
- return true;
-}
-
-
-const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestFreedesktopInterfaceStubDefault::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttributeAttributeValue_;
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestFreedesktopInterfaceStubDefault::getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestDerivedStructAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- if (!validateTestDerivedStructAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testDerivedStructAttributeAttributeValue_ != _value);
- testDerivedStructAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value) {
- (void)_value;
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- (void)_client;
- setTestDerivedStructAttributeAttribute(_value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(_value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- (void)_client;
- return onRemoteSetTestDerivedStructAttributeAttribute(_value);
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestFreedesktopInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttributeAttributeValue_;
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestFreedesktopInterfaceStubDefault::getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestDerivedArrayAttributeAttribute();
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
-}
-
-bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- if (!validateTestDerivedArrayAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testDerivedArrayAttributeAttributeValue_ != _value);
- testDerivedArrayAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestFreedesktopInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value) {
- (void)_value;
- return true;
-}
-
-void TestFreedesktopInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- (void)_client;
- setTestDerivedArrayAttributeAttribute(_value);
-}
-
-void TestFreedesktopInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged();
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(_value));
-}
-
-bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- (void)_client;
- return onRemoteSetTestDerivedArrayAttributeAttribute(_value);
-}
-
-
-
-
-
-TestFreedesktopInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestFreedesktopInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp
deleted file mode 100644
index ba97beb..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestFreedesktopInterfaceStubRemoteEvent and
- * TestFreedesktopInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestFreedesktopInterfaceStubDefault
- : public virtual TestFreedesktopInterfaceStub {
-public:
- TestFreedesktopInterfaceStubDefault();
-
- TestFreedesktopInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestFreedesktopInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual void setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
- virtual const uint32_t& getTestReadonlyAttributeAttribute();
- virtual const uint32_t& getTestReadonlyAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestReadonlyAttributeAttribute(uint32_t _value);
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual void setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
-
-
-
-
-protected:
- virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
- virtual bool trySetTestReadonlyAttributeAttribute(uint32_t _value);
- virtual bool validateTestReadonlyAttributeAttributeRequestedValue(const uint32_t &_value);
- virtual bool trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
- virtual bool trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
- class RemoteEventHandler: public virtual TestFreedesktopInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(TestFreedesktopInterfaceStubDefault *_defaultStub);
-
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
-
-
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
-
-
- private:
- TestFreedesktopInterfaceStubDefault *defaultStub_;
- };
-private:
- TestFreedesktopInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testPredefinedTypeAttributeAttributeValue_ {};
- uint32_t testReadonlyAttributeAttributeValue_ {};
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_ {};
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_ {};
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp
deleted file mode 100644
index 2177ee6..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_TEST_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_TEST_INTERFACE_HPP_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterface {
-public:
- virtual ~TestInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestInterface::getInterface() {
- return ("commonapi.tests.TestInterface");
-}
-
-CommonAPI::Version TestInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_TEST_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManager.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManager.hpp
deleted file mode 100644
index 53e2afb..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManager.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_TEST_INTERFACE_MANAGER_HPP_
-#define V1_COMMONAPI_TESTS_TEST_INTERFACE_MANAGER_HPP_
-
-
-#include <set>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceManager {
-public:
- virtual ~TestInterfaceManager() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* TestInterfaceManager::getInterface() {
- return ("commonapi.tests.TestInterfaceManager");
-}
-
-CommonAPI::Version TestInterfaceManager::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_TEST_INTERFACE_MANAGER_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxy.hpp
deleted file mode 100644
index 41cbd78..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxy.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestInterfaceManagerProxy
- : virtual public TestInterfaceManager,
- virtual public TestInterfaceManagerProxyBase,
- virtual public _AttributeExtensions... {
-public:
- TestInterfaceManagerProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestInterfaceManagerProxy();
-
- typedef TestInterfaceManager InterfaceType;
-
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerTestInterface();
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestInterfaceManagerProxyBase> delegate_;
-};
-
-typedef TestInterfaceManagerProxy<> TestInterfaceManagerProxyDefault;
-
-
-//
-// TestInterfaceManagerProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestInterfaceManagerProxy<_AttributeExtensions...>::TestInterfaceManagerProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestInterfaceManagerProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestInterfaceManagerProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestInterfaceManagerProxy<_AttributeExtensions...>::~TestInterfaceManagerProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &TestInterfaceManagerProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestInterfaceManagerProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestInterfaceManagerProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestInterfaceManagerProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestInterfaceManagerProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyManager& TestInterfaceManagerProxy<_AttributeExtensions...>::getProxyManagerTestInterface() {
- return delegate_->getProxyManagerTestInterface();
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp
deleted file mode 100644
index 5a0e67f..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceManager.hpp>
-
-
-#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/ProxyManager.hpp>
-#include <CommonAPI/Proxy.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceManagerProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerTestInterface() = 0;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStub.hpp
deleted file mode 100644
index 640df57..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStub.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-
-#include <v1/commonapi/tests/TestInterfaceManager.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestInterfaceManager. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestInterfaceManagerStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual TestInterfaceManager {
- public:
-
-
- virtual bool registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub>, const std::string&) = 0;
- virtual bool deregisterManagedStubTestInterface(const std::string&) = 0;
- virtual std::set<std::string>& getTestInterfaceInstances() = 0;
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestInterfaceManager.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestInterfaceManagerStubRemoteEvent
-{
-public:
- virtual ~TestInterfaceManagerStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestInterfaceManager to remote clients.
- * 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 TestInterfaceManagerStub
- : public virtual CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>
-{
-public:
-
- virtual ~TestInterfaceManagerStub() {}
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
-
-
- virtual bool registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub>, const std::string&) = 0;
- virtual bool deregisterManagedStubTestInterface(const std::string&) = 0;
- virtual std::set<std::string>& getTestInterfaceInstances() = 0;
- using CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestInterfaceManagerStubRemoteEvent RemoteEventType;
- typedef TestInterfaceManager StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.cpp
deleted file mode 100644
index 0241f20..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-TestInterfaceManagerStubDefault::TestInterfaceManagerStubDefault():
- remoteEventHandler_(this),
- autoInstanceCounter_(0),
- interfaceVersion_(TestInterfaceManager::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestInterfaceManagerStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-TestInterfaceManagerStubRemoteEvent* TestInterfaceManagerStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceManagerStubAdapter> &_adapter) {
- CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-
-
-bool TestInterfaceManagerStubDefault::registerManagedStubTestInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- assert((CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- ss << stubAdapter->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter->registerManagedStubTestInterface(_stub, instance);
- } else {
- return false;
- }
-}
-bool TestInterfaceManagerStubDefault::registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->registerManagedStubTestInterface(_stub, _instance);
- else
- return false;
-}
-bool TestInterfaceManagerStubDefault::deregisterManagedStubTestInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->deregisterManagedStubTestInterface(_instance);
- else
- return false;
-}
-std::set<std::string>& TestInterfaceManagerStubDefault::getTestInterfaceInstances() {
- assert((CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceManagerStubAdapter, TestInterfaceManagerStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- return stubAdapter->getTestInterfaceInstances();
- } else {
- static std::set<std::string> emptySet = std::set<std::string>();
- return emptySet;
- }
-}
-
-TestInterfaceManagerStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceManagerStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp
deleted file mode 100644
index 67f21e8..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/TestInterfaceManagerStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestInterfaceManagerStubRemoteEvent and
- * TestInterfaceManagerStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestInterfaceManagerStubDefault
- : public virtual TestInterfaceManagerStub {
-public:
- TestInterfaceManagerStubDefault();
-
- TestInterfaceManagerStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceManagerStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
-
-
- bool registerManagedStubTestInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub>);
- bool registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub>, const std::string&);
- bool deregisterManagedStubTestInterface(const std::string&);
- std::set<std::string>& getTestInterfaceInstances();
-
-protected:
- class RemoteEventHandler: public virtual TestInterfaceManagerStubRemoteEvent {
- public:
- RemoteEventHandler(TestInterfaceManagerStubDefault *_defaultStub);
-
-
- private:
- TestInterfaceManagerStubDefault *defaultStub_;
- };
-private:
- TestInterfaceManagerStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t autoInstanceCounter_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp
deleted file mode 100644
index 82b94ce..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/AttributeExtension.hpp>
-#include <CommonAPI/Factory.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-template <typename ... _AttributeExtensions>
-class TestInterfaceProxy
- : virtual public TestInterface,
- virtual public TestInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~TestInterfaceProxy();
-
- typedef TestInterface InterfaceType;
-
-
- /**
- * Returns the wrapper class that provides access to the attribute TestPredefinedTypeAttribute.
- */
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() {
- return delegate_->getTestPredefinedTypeAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedStructAttribute.
- */
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() {
- return delegate_->getTestDerivedStructAttributeAttribute();
- }
- /**
- * Returns the wrapper class that provides access to the attribute TestDerivedArrayAttribute.
- */
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() {
- return delegate_->getTestDerivedArrayAttributeAttribute();
- }
-
- /**
- * Returns the wrapper class that provides access to the broadcast TestPredefinedTypeBroadcast.
- */
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() {
- return delegate_->getTestPredefinedTypeBroadcastEvent();
- }
- /**
- * Returns the wrapper class that provides access to the broadcast TestSelectiveBroadcast.
- */
- virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent() {
- return delegate_->getTestSelectiveBroadcastSelectiveEvent();
- }
- /**
- * Returns the wrapper class that provides access to the broadcast TestBroadcastWithOutArgs.
- */
- virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() {
- return delegate_->getTestBroadcastWithOutArgsSelectiveEvent();
- }
-
- /**
- * Calls testEmptyMethod with synchronous semantics.
- *
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testEmptyMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testVoidPredefinedTypeMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testVoidPredefinedTypeMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testPredefinedTypeMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_internalCallStatus, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testPredefinedTypeMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testVoidDerivedTypeMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testVoidDerivedTypeMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testDerivedTypeMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_internalCallStatus, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testDerivedTypeMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestArrayOfPolymorphicStructMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestArrayOfPolymorphicStructMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestMapOfPolymorphicStructMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestMapOfPolymorphicStructMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestStructWithPolymorphicMemberMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestStructWithPolymorphicMemberMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestStructWithEnumKeyMapMember with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestStructWithEnumKeyMapMember with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<TestInterfaceProxyBase> delegate_;
-};
-
-typedef TestInterfaceProxy<> TestInterfaceProxyDefault;
-
-namespace TestInterfaceExtensions {
- template <template <typename > class _ExtensionType>
- class TestPredefinedTypeAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestInterfaceProxyBase::TestPredefinedTypeAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestPredefinedTypeAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestPredefinedTypeAttributeAttributeExtension() {}
- #endif
-
- TestPredefinedTypeAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestPredefinedTypeAttributeAttribute()) {
- }
-
- inline extension_type& getTestPredefinedTypeAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedStructAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestInterfaceProxyBase::TestDerivedStructAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestDerivedStructAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedStructAttributeAttributeExtension() {}
- #endif
-
- TestDerivedStructAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedStructAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedStructAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
- template <template <typename > class _ExtensionType>
- class TestDerivedArrayAttributeAttributeExtension {
- public:
- typedef _ExtensionType<TestInterfaceProxyBase::TestDerivedArrayAttributeAttribute> extension_type;
-
- static_assert(std::is_base_of<typename CommonAPI::AttributeExtension<TestInterfaceProxyBase::TestDerivedArrayAttributeAttribute>, extension_type>::value,
- "Not CommonAPI Attribute Extension!");
- #ifdef WIN32
- TestDerivedArrayAttributeAttributeExtension() {}
- #endif
-
- TestDerivedArrayAttributeAttributeExtension(TestInterfaceProxyBase& proxy): attributeExtension_(proxy.getTestDerivedArrayAttributeAttribute()) {
- }
-
- inline extension_type& getTestDerivedArrayAttributeAttributeExtension() {
- return attributeExtension_;
- }
-
- private:
- extension_type attributeExtension_;
- };
-
-} // namespace TestInterfaceExtensions
-
-//
-// TestInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-TestInterfaceProxy<_AttributeExtensions...>::TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<TestInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<TestInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-TestInterfaceProxy<_AttributeExtensions...>::~TestInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->testEmptyMethod(_internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testEmptyMethodAsync(_callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->testVoidPredefinedTypeMethod(_uint32Value, _stringValue, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testVoidPredefinedTypeMethodAsync(_uint32Value, _stringValue, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_internalCallStatus, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info) {
- delegate_->testPredefinedTypeMethod(_uint32InValue, _stringInValue, _internalCallStatus, _uint32OutValue, _stringOutValue, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testPredefinedTypeMethodAsync(_uint32InValue, _stringInValue, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- if (!_testEnumExtended2Value.validate()) {
- _internalCallStatus = CommonAPI::CallStatus::INVALID_VALUE;
- return;
- }
- delegate_->testVoidDerivedTypeMethod(_testEnumExtended2Value, _testMapValue, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- if (!_testEnumExtended2Value.validate()) {
- _callback(CommonAPI::CallStatus::INVALID_VALUE);
- std::promise<CommonAPI::CallStatus> promise;
- promise.set_value(CommonAPI::CallStatus::INVALID_VALUE);
- return promise.get_future();
- }
- return delegate_->testVoidDerivedTypeMethodAsync(_testEnumExtended2Value, _testMapValue, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_internalCallStatus, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info) {
- if (!_testEnumExtended2InValue.validate()) {
- _internalCallStatus = CommonAPI::CallStatus::INVALID_VALUE;
- return;
- }
- delegate_->testDerivedTypeMethod(_testEnumExtended2InValue, _testMapInValue, _internalCallStatus, _testEnumExtended2OutValue, _testMapOutValue, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- if (!_testEnumExtended2InValue.validate()) {
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue = ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_NEW2;
- ::commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue;
- _callback(CommonAPI::CallStatus::INVALID_VALUE, testEnumExtended2OutValue, testMapOutValue);
- std::promise<CommonAPI::CallStatus> promise;
- promise.set_value(CommonAPI::CallStatus::INVALID_VALUE);
- return promise.get_future();
- }
- return delegate_->testDerivedTypeMethodAsync(_testEnumExtended2InValue, _testMapInValue, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->TestArrayOfPolymorphicStructMethod(_inArray, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestArrayOfPolymorphicStructMethodAsync(_inArray, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->TestMapOfPolymorphicStructMethod(_inMap, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestMapOfPolymorphicStructMethodAsync(_inMap, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->TestStructWithPolymorphicMemberMethod(_inStruct, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestStructWithPolymorphicMemberMethodAsync(_inStruct, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->TestStructWithEnumKeyMapMember(_inStruct, _internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestStructWithEnumKeyMapMemberAsync(_inStruct, _callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &TestInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool TestInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& TestInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestInterfaceProxy,
- _AttributeExtension> {
- typedef typename ::v1::commonapi::tests::TestInterfaceProxy<
- ::v1::commonapi::tests::TestInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- ::v1::commonapi::tests::TestInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- ::v1::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_AttributeExtension>
- > class_t;
-};
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp
deleted file mode 100644
index 5c6f74e..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/TestInterface.hpp>
-
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <commonapi/tests/PredefinedTypeCollection.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Deployment.hpp>
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Struct.hpp>
-#include <cstdint>
-#include <unordered_map>
-#include <vector>
-
-#include <CommonAPI/Attribute.hpp>
-#include <CommonAPI/Event.hpp>
-#include <CommonAPI/SelectiveEvent.hpp>
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
- typedef CommonAPI::ObservableAttribute<uint32_t> TestPredefinedTypeAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestStructExtended> TestDerivedStructAttributeAttribute;
- typedef CommonAPI::ObservableAttribute<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64> TestDerivedArrayAttributeAttribute;
- typedef CommonAPI::Event<
- uint32_t, std::string
- > TestPredefinedTypeBroadcastEvent;
- typedef CommonAPI::SelectiveEvent<> TestSelectiveBroadcastSelectiveEvent;
- typedef CommonAPI::SelectiveEvent<uint32_t, std::string> TestBroadcastWithOutArgsSelectiveEvent;
-
- typedef std::function<void(const CommonAPI::CallStatus&)> TestEmptyMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidPredefinedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const uint32_t&, const std::string&)> TestPredefinedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestVoidDerivedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2&, const ::commonapi::tests::DerivedTypeCollection::TestMap&)> TestDerivedTypeMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestArrayOfPolymorphicStructMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestMapOfPolymorphicStructMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithPolymorphicMemberMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> TestStructWithEnumKeyMapMemberAsyncCallback;
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute() = 0;
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute() = 0;
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute() = 0;
-
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent() = 0;
- virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent() = 0;
- virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() = 0;
-
- virtual void testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_internalCallStatus, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_internalCallStatus, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp
deleted file mode 100644
index dcf9441..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <commonapi/tests/PredefinedTypeCollection.hpp>
-
-#include <v1/commonapi/tests/TestInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Deployment.hpp>
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Struct.hpp>
-#include <cstdint>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service TestInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class TestInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual TestInterface {
- public:
- ///Notifies all remote listeners about a change of value of the attribute TestPredefinedTypeAttribute.
- virtual void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& TestPredefinedTypeAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedStructAttribute.
- virtual void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestDerivedStructAttribute) = 0;
- ///Notifies all remote listeners about a change of value of the attribute TestDerivedArrayAttribute.
- virtual void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestDerivedArrayAttribute) = 0;
-
- /**
- * Sends a broadcast event for TestPredefinedTypeBroadcast. Should not be called directly.
- * Instead, the "fire<broadcastName>Event" methods of the stub should be used.
- */
- virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
- /**
- * Sends a selective broadcast event for TestSelectiveBroadcast. Should not be called directly.
- * Instead, the "fire<broadcastName>Event" methods of the stub should be used.
- */
- virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- virtual void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
- virtual void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) = 0;
- virtual void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
- virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0;
- /**
- * Sends a selective broadcast event for TestBroadcastWithOutArgs. Should not be called directly.
- * Instead, the "fire<broadcastName>Event" methods of the stub should be used.
- */
- virtual void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
- virtual void sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
- 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
- * subscribed to the selective broadcasts
- */
- std::shared_ptr<CommonAPI::ClientIdList> subscribersForTestSelectiveBroadcastSelective_;
- std::shared_ptr<CommonAPI::ClientIdList> subscribersForTestBroadcastWithOutArgsSelective_;
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for TestInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class TestInterfaceStubRemoteEvent
-{
-public:
- virtual ~TestInterfaceStubRemoteEvent() { }
-
- /// Verification callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) = 0;
- /// Action callback for remote set requests on the attribute TestPredefinedTypeAttribute
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged() = 0;
- /// Verification callback for remote set requests on the attribute TestDerivedStructAttribute
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) = 0;
- /// Action callback for remote set requests on the attribute TestDerivedStructAttribute
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged() = 0;
- /// Verification callback for remote set requests on the attribute TestDerivedArrayAttribute
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) = 0;
- /// Action callback for remote set requests on the attribute TestDerivedArrayAttribute
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged() = 0;
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service TestInterface to remote clients.
- * 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 TestInterfaceStub
- : public virtual CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>
-{
-public:
- typedef std::function<void ()>testEmptyMethodReply_t;
- typedef std::function<void ()>testVoidPredefinedTypeMethodReply_t;
- typedef std::function<void (uint32_t _uint32OutValue, std::string _stringOutValue)>testPredefinedTypeMethodReply_t;
- typedef std::function<void ()>testVoidDerivedTypeMethodReply_t;
- typedef std::function<void (::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapOutValue)>testDerivedTypeMethodReply_t;
- typedef std::function<void ()>TestArrayOfPolymorphicStructMethodReply_t;
- typedef std::function<void ()>TestMapOfPolymorphicStructMethodReply_t;
- typedef std::function<void ()>TestStructWithPolymorphicMemberMethodReply_t;
- typedef std::function<void ()>TestStructWithEnumKeyMapMemberReply_t;
-
- virtual ~TestInterfaceStub() {}
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
- /// Provides getter access to the attribute TestPredefinedTypeAttribute
- virtual const uint32_t &getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /// Provides getter access to the attribute TestDerivedStructAttribute
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /// Provides getter access to the attribute TestDerivedArrayAttribute
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
-
- /// This is the method that will be called on remote calls on the method testEmptyMethod.
- virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method testVoidPredefinedTypeMethod.
- virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method testPredefinedTypeMethod.
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method testVoidDerivedTypeMethod.
- virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2Value, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapValue, testVoidDerivedTypeMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method testDerivedTypeMethod.
- virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2InValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapInValue, testDerivedTypeMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method TestArrayOfPolymorphicStructMethod.
- virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> _inArray, TestArrayOfPolymorphicStructMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method TestMapOfPolymorphicStructMethod.
- virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method TestStructWithPolymorphicMemberMethod.
- virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method TestStructWithEnumKeyMapMember.
- virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply) = 0;
- /// Sends a broadcast event for TestPredefinedTypeBroadcast.
- virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) = 0;
- /**
- * Sends a selective broadcast event for TestSelectiveBroadcast to the given ClientIds.
- * The ClientIds must all be out of the set of subscribed clients.
- * If no ClientIds are given, the selective broadcast is sent to all subscribed clients.
- */
- virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
- /// retreives the list of all subscribed clients for TestSelectiveBroadcast
- virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective() = 0;
- /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
- /// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
- /**
- * Sends a selective broadcast event for TestBroadcastWithOutArgs to the given ClientIds.
- * The ClientIds must all be out of the set of subscribed clients.
- * If no ClientIds are given, the selective broadcast is sent to all subscribed clients.
- */
- virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr) = 0;
- /// retreives the list of all subscribed clients for TestBroadcastWithOutArgs
- virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective() = 0;
- /// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
- virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) = 0;
- /// Hook method for reacting accepting or denying new subscriptions
- virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) = 0;
-
- using CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef TestInterfaceStubRemoteEvent RemoteEventType;
- typedef TestInterface StubInterface;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp
deleted file mode 100644
index f669169..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-TestInterfaceStubDefault::TestInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(TestInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-TestInterfaceStubRemoteEvent* TestInterfaceStubDefault::initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttributeAttributeValue_;
-}
-
-const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestPredefinedTypeAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- const bool valueChanged = trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- if (!validateTestPredefinedTypeAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testPredefinedTypeAttributeAttributeValue_ != _value);
- testPredefinedTypeAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value) {
- (void)_value;
- return true;
-}
-
-void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- setTestPredefinedTypeAttributeAttribute(_value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestPredefinedTypeAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestPredefinedTypeAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestPredefinedTypeAttributeAttribute(std::move(_value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
- (void)_client;
- return onRemoteSetTestPredefinedTypeAttributeAttribute(_value);
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttributeAttributeValue_;
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestInterfaceStubDefault::getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestDerivedStructAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- const bool valueChanged = trySetTestDerivedStructAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- if (!validateTestDerivedStructAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testDerivedStructAttributeAttributeValue_ != _value);
- testDerivedStructAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value) {
- (void)_value;
- return true;
-}
-
-void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- (void)_client;
- setTestDerivedStructAttributeAttribute(_value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestDerivedStructAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedStructAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestDerivedStructAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestDerivedStructAttributeAttribute(std::move(_value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
- (void)_client;
- return onRemoteSetTestDerivedStructAttributeAttribute(_value);
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttributeAttributeValue_;
-}
-
-const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestInterfaceStubDefault::getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return getTestDerivedArrayAttributeAttribute();
-}
-
-void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- const bool valueChanged = trySetTestDerivedArrayAttributeAttribute(std::move(_value));
- if (valueChanged) {
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
-}
-
-bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- if (!validateTestDerivedArrayAttributeAttributeRequestedValue(_value))
- return false;
-
- const bool valueChanged = (testDerivedArrayAttributeAttributeValue_ != _value);
- testDerivedArrayAttributeAttributeValue_ = std::move(_value);
- return valueChanged;
-}
-
-bool TestInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value) {
- (void)_value;
- return true;
-}
-
-void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- (void)_client;
- setTestDerivedArrayAttributeAttribute(_value);
-}
-
-void TestInterfaceStubDefault::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- // No operation in default
-}
-
-void TestInterfaceStubDefault::RemoteEventHandler::onRemoteTestDerivedArrayAttributeAttributeChanged() {
- assert(defaultStub_ !=NULL);
- defaultStub_->onRemoteTestDerivedArrayAttributeAttributeChanged();
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- assert(defaultStub_ !=NULL);
- return defaultStub_->trySetTestDerivedArrayAttributeAttribute(std::move(_value));
-}
-
-bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
- (void)_client;
- return onRemoteSetTestDerivedArrayAttributeAttribute(_value);
-}
-
-
-void TestInterfaceStubDefault::testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply) {
- (void)_client;
- _reply();
-}
-
-void TestInterfaceStubDefault::testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply) {
- (void)_client;
- (void) _uint32Value;
- (void) _stringValue;
- _reply();
-}
-
-void TestInterfaceStubDefault::testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply) {
- (void)_client;
- (void) _uint32InValue;
- (void) _stringInValue;
- uint32_t uint32OutValue = 0ul;
- std::string stringOutValue = "";
- _reply(uint32OutValue, stringOutValue);
-}
-
-void TestInterfaceStubDefault::testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2Value, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapValue, testVoidDerivedTypeMethodReply_t _reply) {
- (void)_client;
- (void) _testEnumExtended2Value;
- (void) _testMapValue;
- _reply();
-}
-
-void TestInterfaceStubDefault::testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2InValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapInValue, testDerivedTypeMethodReply_t _reply) {
- (void)_client;
- (void) _testEnumExtended2InValue;
- (void) _testMapInValue;
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue = ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2::E_NEW2;
- ::commonapi::tests::DerivedTypeCollection::TestMap testMapOutValue;
- if (!testEnumExtended2OutValue.validate()) {
- return;
- }
- _reply(testEnumExtended2OutValue, testMapOutValue);
-}
-
-void TestInterfaceStubDefault::TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> _inArray, TestArrayOfPolymorphicStructMethodReply_t _reply) {
- (void)_client;
- (void) _inArray;
- _reply();
-}
-
-void TestInterfaceStubDefault::TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply) {
- (void)_client;
- (void) _inMap;
- _reply();
-}
-
-void TestInterfaceStubDefault::TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply) {
- (void)_client;
- (void) _inStruct;
- _reply();
-}
-
-void TestInterfaceStubDefault::TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply) {
- (void)_client;
- (void) _inStruct;
- _reply();
-}
-
-
-void TestInterfaceStubDefault::fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue) {
- assert((CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->fireTestPredefinedTypeBroadcastEvent(_uint32Value, _stringValue);
-}
-void TestInterfaceStubDefault::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
- assert((CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->sendTestSelectiveBroadcastSelective(_receivers);
-}
-void TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) {
- (void)_client;
- (void)_event;
- // No operation in default
-}
-bool TestInterfaceStubDefault::onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- // Accept in default
- return true;
-}
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestSelectiveBroadcastSelective() {
- assert((CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return(stubAdapter->getSubscribersForTestSelectiveBroadcastSelective());
- else
- return NULL;
-}
-
-void TestInterfaceStubDefault::fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
- assert((CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- stubAdapter->sendTestBroadcastWithOutArgsSelective(_uint32Value, _stringValue, _receivers);
-}
-void TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event) {
- (void)_client;
- (void)_event;
- // No operation in default
-}
-bool TestInterfaceStubDefault::onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- // Accept in default
- return true;
-}
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceStubDefault::getSubscribersForTestBroadcastWithOutArgsSelective() {
- assert((CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return(stubAdapter->getSubscribersForTestBroadcastWithOutArgsSelective());
- else
- return NULL;
-}
-
-
-
-TestInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp
deleted file mode 100644
index 215345d..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-/**
- * Provides a default implementation for TestInterfaceStubRemoteEvent and
- * TestInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class TestInterfaceStubDefault
- : public virtual TestInterfaceStub {
-public:
- TestInterfaceStubDefault();
-
- TestInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<TestInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute();
- virtual const uint32_t& getTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual void setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute();
- virtual const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& getTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual void setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute();
- virtual const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& getTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client);
- virtual void setTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual void setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
-
- virtual void testEmptyMethod(const std::shared_ptr<CommonAPI::ClientId> _client, testEmptyMethodReply_t _reply);
- virtual void testVoidPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32Value, std::string _stringValue, testVoidPredefinedTypeMethodReply_t _reply);
- virtual void testPredefinedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _uint32InValue, std::string _stringInValue, testPredefinedTypeMethodReply_t _reply);
- virtual void testVoidDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2Value, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapValue, testVoidDerivedTypeMethodReply_t _reply);
- virtual void testDerivedTypeMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 _testEnumExtended2InValue, ::commonapi::tests::DerivedTypeCollection::TestMap _testMapInValue, testDerivedTypeMethodReply_t _reply);
- virtual void TestArrayOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> _inArray, TestArrayOfPolymorphicStructMethodReply_t _reply);
- virtual void TestMapOfPolymorphicStructMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic _inMap, TestMapOfPolymorphicStructMethodReply_t _reply);
- virtual void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember _inStruct, TestStructWithPolymorphicMemberMethodReply_t _reply);
- virtual void TestStructWithEnumKeyMapMember(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap _inStruct, TestStructWithEnumKeyMapMemberReply_t _reply);
-
-virtual void fireTestPredefinedTypeBroadcastEvent(const uint32_t &_uint32Value, const std::string &_stringValue);
-virtual void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
-virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective();
-/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
-virtual void onTestSelectiveBroadcastSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event);
-/// Hook method for reacting accepting or denying new subscriptions
-virtual bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client);
-virtual void fireTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
-virtual std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestBroadcastWithOutArgsSelective();
-/// Hook method for reacting on new subscriptions or removed subscriptions respectively for selective broadcasts.
-virtual void onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> _client, const CommonAPI::SelectiveBroadcastSubscriptionEvent _event);
-/// Hook method for reacting accepting or denying new subscriptions
-virtual bool onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(const std::shared_ptr<CommonAPI::ClientId> _client);
-
-
-protected:
- virtual bool trySetTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual bool validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
- virtual bool trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual bool validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
- virtual bool trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual bool validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
- class RemoteEventHandler: public virtual TestInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(TestInterfaceStubDefault *_defaultStub);
-
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(uint32_t _value);
- virtual bool onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value);
- virtual void onRemoteTestPredefinedTypeAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual bool onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value);
- virtual void onRemoteTestDerivedStructAttributeAttributeChanged();
-
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual bool onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value);
- virtual void onRemoteTestDerivedArrayAttributeAttributeChanged();
-
-
- private:
- TestInterfaceStubDefault *defaultStub_;
- };
-private:
- TestInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
- uint32_t testPredefinedTypeAttributeAttributeValue_ {};
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_ {};
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_ {};
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp
deleted file mode 100644
index 3381172..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterface {
-public:
- virtual ~BranchInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-
- struct testBranchMethodError : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- OK = 0,
- NOTOK = 1
- };
-
- testBranchMethodError()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
- testBranchMethodError(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::OK):
- case static_cast<int32_t>(Literal::NOTOK):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const testBranchMethodError &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const testBranchMethodError &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const testBranchMethodError &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const testBranchMethodError &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const testBranchMethodError &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const testBranchMethodError &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
-};
-
-const char* BranchInterface::getInterface() {
- return ("commonapi.tests.managed.BranchInterface");
-}
-
-CommonAPI::Version BranchInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp
deleted file mode 100644
index bdd01f3..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-template <typename ... _AttributeExtensions>
-class BranchInterfaceProxy
- : virtual public BranchInterface,
- virtual public BranchInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~BranchInterfaceProxy();
-
- typedef BranchInterface InterfaceType;
-
-
-
-
- /**
- * Calls testBranchMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testBranchMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * 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 = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<BranchInterfaceProxyBase> delegate_;
-};
-
-typedef BranchInterfaceProxy<> BranchInterfaceProxyDefault;
-
-
-//
-// BranchInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-BranchInterfaceProxy<_AttributeExtensions...>::BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<BranchInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<BranchInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-BranchInterfaceProxy<_AttributeExtensions...>::~BranchInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- delegate_->testBranchMethod(_inInt, _inString, _internalCallStatus, _error, _outInt, _outString, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> BranchInterfaceProxy<_AttributeExtensions...>::testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testBranchMethodAsync(_inInt, _inString, _callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &BranchInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool BranchInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool BranchInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& BranchInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
deleted file mode 100644
index 72507e9..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/managed/BranchInterface.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const BranchInterface::testBranchMethodError&, const int32_t&, const std::string&)> TestBranchMethodAsyncCallback;
-
-
-
- virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp
deleted file mode 100644
index 2122252..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-
-#include <v1/commonapi/tests/managed/BranchInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service BranchInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class BranchInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual BranchInterface {
- public:
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for BranchInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class BranchInterfaceStubRemoteEvent
-{
-public:
- virtual ~BranchInterfaceStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service BranchInterface to remote clients.
- * 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 BranchInterfaceStub
- : public virtual CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>
-{
-public:
- typedef std::function<void (BranchInterface::testBranchMethodError _error, int32_t _outInt, std::string _outString)>testBranchMethodReply_t;
-
- 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> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply) = 0;
-
- using CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef BranchInterfaceStubRemoteEvent RemoteEventType;
- typedef BranchInterface StubInterface;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
deleted file mode 100644
index 669bd1d..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-BranchInterfaceStubDefault::BranchInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(BranchInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<BranchInterfaceStubAdapter, BranchInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-void BranchInterfaceStubDefault::testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply) {
- (void)_client;
- (void) _inInt;
- (void) _inString;
- BranchInterface::testBranchMethodError error;
- int32_t outInt = 0;
- std::string outString = "";
- _reply(error, outInt, outString);
-}
-
-
-
-
-BranchInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(BranchInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
deleted file mode 100644
index 4913639..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Provides a default implementation for BranchInterfaceStubRemoteEvent and
- * BranchInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class BranchInterfaceStubDefault
- : public virtual BranchInterfaceStub {
-public:
- BranchInterfaceStubDefault();
-
- BranchInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<BranchInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
- virtual void testBranchMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testBranchMethodReply_t _reply);
-
-
-
-protected:
- class RemoteEventHandler: public virtual BranchInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(BranchInterfaceStubDefault *_defaultStub);
-
-
- private:
- BranchInterfaceStubDefault *defaultStub_;
- };
-private:
- BranchInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp
deleted file mode 100644
index f27f3e7..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterface {
-public:
- virtual ~LeafInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-
- struct testLeafMethodError : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- OK = 0,
- NOTOK = 1
- };
-
- testLeafMethodError()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
- testLeafMethodError(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::OK):
- case static_cast<int32_t>(Literal::NOTOK):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const testLeafMethodError &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const testLeafMethodError &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const testLeafMethodError &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const testLeafMethodError &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const testLeafMethodError &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const testLeafMethodError &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
-};
-
-const char* LeafInterface::getInterface() {
- return ("commonapi.tests.managed.LeafInterface");
-}
-
-CommonAPI::Version LeafInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp
deleted file mode 100644
index cce9ffa..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-template <typename ... _AttributeExtensions>
-class LeafInterfaceProxy
- : virtual public LeafInterface,
- virtual public LeafInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~LeafInterfaceProxy();
-
- typedef LeafInterface InterfaceType;
-
-
-
-
- /**
- * Calls testLeafMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testLeafMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<LeafInterfaceProxyBase> delegate_;
-};
-
-typedef LeafInterfaceProxy<> LeafInterfaceProxyDefault;
-
-
-//
-// LeafInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-LeafInterfaceProxy<_AttributeExtensions...>::LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<LeafInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<LeafInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-LeafInterfaceProxy<_AttributeExtensions...>::~LeafInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- delegate_->testLeafMethod(_inInt, _inString, _internalCallStatus, _error, _outInt, _outString, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LeafInterfaceProxy<_AttributeExtensions...>::testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testLeafMethodAsync(_inInt, _inString, _callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &LeafInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool LeafInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool LeafInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& LeafInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& LeafInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
deleted file mode 100644
index 752d4aa..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/managed/LeafInterface.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const LeafInterface::testLeafMethodError&, const int32_t&, const std::string&)> TestLeafMethodAsyncCallback;
-
-
-
- virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp
deleted file mode 100644
index 2193b8c..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-
-#include <v1/commonapi/tests/managed/LeafInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service LeafInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class LeafInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual LeafInterface {
- public:
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for LeafInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class LeafInterfaceStubRemoteEvent
-{
-public:
- virtual ~LeafInterfaceStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service LeafInterface to remote clients.
- * 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 LeafInterfaceStub
- : public virtual CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>
-{
-public:
- typedef std::function<void (LeafInterface::testLeafMethodError _error, int32_t _outInt, std::string _outString)>testLeafMethodReply_t;
-
- 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> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply) = 0;
-
- using CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef LeafInterfaceStubRemoteEvent RemoteEventType;
- typedef LeafInterface StubInterface;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
deleted file mode 100644
index 4e8b9a8..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-LeafInterfaceStubDefault::LeafInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(LeafInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<LeafInterfaceStubAdapter, LeafInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-void LeafInterfaceStubDefault::testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply) {
- (void)_client;
- (void) _inInt;
- (void) _inString;
- LeafInterface::testLeafMethodError error;
- int32_t outInt = 0;
- std::string outString = "";
- _reply(error, outInt, outString);
-}
-
-
-
-
-LeafInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LeafInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
deleted file mode 100644
index d388742..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Provides a default implementation for LeafInterfaceStubRemoteEvent and
- * LeafInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class LeafInterfaceStubDefault
- : public virtual LeafInterfaceStub {
-public:
- LeafInterfaceStubDefault();
-
- LeafInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LeafInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
- virtual void testLeafMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testLeafMethodReply_t _reply);
-
-
-
-protected:
- class RemoteEventHandler: public virtual LeafInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(LeafInterfaceStubDefault *_defaultStub);
-
-
- private:
- LeafInterfaceStubDefault *defaultStub_;
- };
-private:
- LeafInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp
deleted file mode 100644
index d7f9e33..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
-
-
-#include <set>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/InputStream.hpp>
-#include <CommonAPI/OutputStream.hpp>
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterface {
-public:
- virtual ~RootInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-
- struct testRootMethodError : CommonAPI::Enumeration<int32_t> {
- enum Literal : int32_t {
- OK = 0,
- NOTOK = 1
- };
-
- testRootMethodError()
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
- testRootMethodError(Literal _literal)
- : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_literal)) {}
-
- inline bool validate() const {
- switch (value_) {
- case static_cast<int32_t>(Literal::OK):
- case static_cast<int32_t>(Literal::NOTOK):
- return true;
- default:
- return false;
- }
- }
-
- inline bool operator==(const testRootMethodError &_other) const { return (value_ == _other.value_); }
- inline bool operator!=(const testRootMethodError &_other) const { return (value_ != _other.value_); }
- inline bool operator<=(const testRootMethodError &_other) const { return (value_ <= _other.value_); }
- inline bool operator>=(const testRootMethodError &_other) const { return (value_ >= _other.value_); }
- inline bool operator<(const testRootMethodError &_other) const { return (value_ < _other.value_); }
- inline bool operator>(const testRootMethodError &_other) const { return (value_ > _other.value_); }
-
- inline bool operator==(const Literal &_value) const { return (value_ == static_cast<int32_t>(_value)); }
- inline bool operator!=(const Literal &_value) const { return (value_ != static_cast<int32_t>(_value)); }
- inline bool operator<=(const Literal &_value) const { return (value_ <= static_cast<int32_t>(_value)); }
- inline bool operator>=(const Literal &_value) const { return (value_ >= static_cast<int32_t>(_value)); }
- inline bool operator<(const Literal &_value) const { return (value_ < static_cast<int32_t>(_value)); }
- inline bool operator>(const Literal &_value) const { return (value_ > static_cast<int32_t>(_value)); }
- };
-};
-
-const char* RootInterface::getInterface() {
- return ("commonapi.tests.managed.RootInterface");
-}
-
-CommonAPI::Version RootInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp
deleted file mode 100644
index 767ac1b..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-template <typename ... _AttributeExtensions>
-class RootInterfaceProxy
- : virtual public RootInterface,
- virtual public RootInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~RootInterfaceProxy();
-
- typedef RootInterface InterfaceType;
-
-
-
-
- /**
- * Calls testRootMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls testRootMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * 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 = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
- virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface();
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<RootInterfaceProxyBase> delegate_;
-};
-
-typedef RootInterfaceProxy<> RootInterfaceProxyDefault;
-
-
-//
-// RootInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-RootInterfaceProxy<_AttributeExtensions...>::RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<RootInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<RootInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-RootInterfaceProxy<_AttributeExtensions...>::~RootInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void RootInterfaceProxy<_AttributeExtensions...>::testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- delegate_->testRootMethod(_inInt, _inString, _internalCallStatus, _error, _outInt, _outString, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> RootInterfaceProxy<_AttributeExtensions...>::testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->testRootMethodAsync(_inInt, _inString, _callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &RootInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool RootInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool RootInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& RootInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& RootInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() {
- return delegate_->getProxyManagerLeafInterface();
-}
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyManagerBranchInterface() {
- return delegate_->getProxyManagerBranchInterface();
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp
deleted file mode 100644
index 248235a..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/managed/RootInterface.hpp>
-
-
-#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/ProxyManager.hpp>
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const RootInterface::testRootMethodError&, const int32_t&, const std::string&)> TestRootMethodAsyncCallback;
-
-
-
- virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0;
- virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface() = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp
deleted file mode 100644
index 0513590..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-
-#include <v1/commonapi/tests/managed/RootInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service RootInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class RootInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual RootInterface {
- public:
-
-
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::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<::v1::commonapi::tests::managed::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
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for RootInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class RootInterfaceStubRemoteEvent
-{
-public:
- virtual ~RootInterfaceStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service RootInterface to remote clients.
- * 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 RootInterfaceStub
- : public virtual CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>
-{
-public:
- typedef std::function<void (RootInterface::testRootMethodError _error, int32_t _outInt, std::string _outString)>testRootMethodReply_t;
-
- 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> _client, int32_t _inInt, std::string _inString, testRootMethodReply_t _reply) = 0;
-
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::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<::v1::commonapi::tests::managed::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;
- typedef RootInterfaceStubRemoteEvent RemoteEventType;
- typedef RootInterface StubInterface;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.cpp
deleted file mode 100644
index 5c129f0..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-RootInterfaceStubDefault::RootInterfaceStubDefault():
- remoteEventHandler_(this),
- autoInstanceCounter_(0),
- interfaceVersion_(RootInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& RootInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-RootInterfaceStubRemoteEvent* RootInterfaceStubDefault::initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-void RootInterfaceStubDefault::testRootMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testRootMethodReply_t _reply) {
- (void)_client;
- (void) _inInt;
- (void) _inString;
- RootInterface::testRootMethodError error;
- int32_t outInt = 0;
- std::string outString = "";
- _reply(error, outInt, outString);
-}
-
-
-
-bool RootInterfaceStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- ss << stubAdapter->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter->registerManagedStubLeafInterface(_stub, instance);
- } else {
- return false;
- }
-}
-bool RootInterfaceStubDefault::registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->registerManagedStubLeafInterface(_stub, _instance);
- else
- return false;
-}
-bool RootInterfaceStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->deregisterManagedStubLeafInterface(_instance);
- else
- return false;
-}
-std::set<std::string>& RootInterfaceStubDefault::getLeafInterfaceInstances() {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- return stubAdapter->getLeafInterfaceInstances();
- } else {
- static std::set<std::string> emptySet = std::set<std::string>();
- return emptySet;
- }
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- ss << stubAdapter->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter->registerManagedStubBranchInterface(_stub, instance);
- } else {
- return false;
- }
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterface(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->registerManagedStubBranchInterface(_stub, _instance);
- else
- return false;
-}
-bool RootInterfaceStubDefault::deregisterManagedStubBranchInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->deregisterManagedStubBranchInterface(_instance);
- else
- return false;
-}
-std::set<std::string>& RootInterfaceStubDefault::getBranchInterfaceInstances() {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- return stubAdapter->getBranchInterfaceInstances();
- } else {
- static std::set<std::string> emptySet = std::set<std::string>();
- return emptySet;
- }
-}
-
-RootInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(RootInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp
deleted file mode 100644
index ba18f95..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/managed/RootInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Provides a default implementation for RootInterfaceStubRemoteEvent and
- * RootInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class RootInterfaceStubDefault
- : public virtual RootInterfaceStub {
-public:
- RootInterfaceStubDefault();
-
- RootInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<RootInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
- virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testRootMethodReply_t _reply);
-
-
- bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>);
- bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>, const std::string&);
- bool deregisterManagedStubLeafInterface(const std::string&);
- std::set<std::string>& getLeafInterfaceInstances();
- bool registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub>);
- bool registerManagedStubBranchInterface(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub>, const std::string&);
- bool deregisterManagedStubBranchInterface(const std::string&);
- std::set<std::string>& getBranchInterfaceInstances();
-
-protected:
- class RemoteEventHandler: public virtual RootInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(RootInterfaceStubDefault *_defaultStub);
-
-
- private:
- RootInterfaceStubDefault *defaultStub_;
- };
-private:
- RootInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t autoInstanceCounter_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp
deleted file mode 100644
index 360a1ea..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
-
-
-#include <set>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class SecondRoot {
-public:
- virtual ~SecondRoot() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* SecondRoot::getInterface() {
- return ("commonapi.tests.managed.SecondRoot");
-}
-
-CommonAPI::Version SecondRoot::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp
deleted file mode 100644
index 0bcf226..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/SecondRootProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-template <typename ... _AttributeExtensions>
-class SecondRootProxy
- : virtual public SecondRoot,
- virtual public SecondRootProxyBase,
- virtual public _AttributeExtensions... {
-public:
- SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~SecondRootProxy();
-
- typedef SecondRoot InterfaceType;
-
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<SecondRootProxyBase> delegate_;
-};
-
-typedef SecondRootProxy<> SecondRootProxyDefault;
-
-
-//
-// SecondRootProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-SecondRootProxy<_AttributeExtensions...>::SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<SecondRootProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<SecondRootProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-SecondRootProxy<_AttributeExtensions...>::~SecondRootProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &SecondRootProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool SecondRootProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool SecondRootProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& SecondRootProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& SecondRootProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManagerLeafInterface() {
- return delegate_->getProxyManagerLeafInterface();
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp
deleted file mode 100644
index 41a4cc2..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
-
-#include <v1/commonapi/tests/managed/SecondRoot.hpp>
-
-
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/ProxyManager.hpp>
-#include <CommonAPI/Proxy.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class SecondRootProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface() = 0;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp
deleted file mode 100644
index ccdddfd..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-
-#include <v1/commonapi/tests/managed/SecondRoot.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service SecondRoot. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class SecondRootStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual SecondRoot {
- public:
-
-
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::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
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for SecondRoot.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class SecondRootStubRemoteEvent
-{
-public:
- virtual ~SecondRootStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service SecondRoot to remote clients.
- * 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 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<::v1::commonapi::tests::managed::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;
- typedef SecondRootStubRemoteEvent RemoteEventType;
- typedef SecondRoot StubInterface;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.cpp
deleted file mode 100644
index af9be9f..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/SecondRootStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-SecondRootStubDefault::SecondRootStubDefault():
- remoteEventHandler_(this),
- autoInstanceCounter_(0),
- interfaceVersion_(SecondRoot::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& SecondRootStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-SecondRootStubRemoteEvent* SecondRootStubDefault::initStubAdapter(const std::shared_ptr<SecondRootStubAdapter> &_adapter) {
- CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-
-
-bool SecondRootStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- ss << stubAdapter->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- return stubAdapter->registerManagedStubLeafInterface(_stub, instance);
- } else {
- return false;
- }
-}
-bool SecondRootStubDefault::registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->registerManagedStubLeafInterface(_stub, _instance);
- else
- return false;
-}
-bool SecondRootStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter)
- return stubAdapter->deregisterManagedStubLeafInterface(_instance);
- else
- return false;
-}
-std::set<std::string>& SecondRootStubDefault::getLeafInterfaceInstances() {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock()) !=NULL);
- auto stubAdapter = CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_.lock();
- if (stubAdapter) {
- return stubAdapter->getLeafInterfaceInstances();
- } else {
- static std::set<std::string> emptySet = std::set<std::string>();
- return emptySet;
- }
-}
-
-SecondRootStubDefault::RemoteEventHandler::RemoteEventHandler(SecondRootStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp
deleted file mode 100644
index dd7bb14..0000000
--- a/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_HPP_
-
-
-#include <v1/commonapi/tests/managed/SecondRootStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-/**
- * Provides a default implementation for SecondRootStubRemoteEvent and
- * SecondRootStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class SecondRootStubDefault
- : public virtual SecondRootStub {
-public:
- SecondRootStubDefault();
-
- SecondRootStubRemoteEvent* initStubAdapter(const std::shared_ptr<SecondRootStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
-
-
- bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>);
- bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>, const std::string&);
- bool deregisterManagedStubLeafInterface(const std::string&);
- std::set<std::string>& getLeafInterfaceInstances();
-
-protected:
- class RemoteEventHandler: public virtual SecondRootStubRemoteEvent {
- public:
- RemoteEventHandler(SecondRootStubDefault *_defaultStub);
-
-
- private:
- SecondRootStubDefault *defaultStub_;
- };
-private:
- SecondRootStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t autoInstanceCounter_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp
deleted file mode 100644
index d193bb8..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
-#define V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
-
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterface {
-public:
- virtual ~LegacyInterface() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* LegacyInterface::getInterface() {
- return ("fake.legacy.service.LegacyInterface");
-}
-
-CommonAPI::Version LegacyInterface::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp
deleted file mode 100644
index 25df376..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_NO_OBJECT_MANAGER_HPP_
-#define V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_NO_OBJECT_MANAGER_HPP_
-
-
-
-#include <v1/fake/legacy/service/LegacyInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Types.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceNoObjectManager
-: virtual public LegacyInterface {
-public:
- virtual ~LegacyInterfaceNoObjectManager() { }
-
- static inline const char* getInterface();
- static inline CommonAPI::Version getInterfaceVersion();
-};
-
-const char* LegacyInterfaceNoObjectManager::getInterface() {
- return ("fake.legacy.service.LegacyInterfaceNoObjectManager");
-}
-
-CommonAPI::Version LegacyInterfaceNoObjectManager::getInterfaceVersion() {
- return CommonAPI::Version(1, 0);
-}
-
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-namespace CommonAPI {
-}
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_NO_OBJECT_MANAGER_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxy.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxy.hpp
deleted file mode 100644
index 4397b30..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxy.hpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp>
-
-#include "v1/fake/legacy/service/LegacyInterfaceProxy.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-template <typename ... _AttributeExtensions>
-class LegacyInterfaceNoObjectManagerProxy
- : virtual public LegacyInterfaceNoObjectManager,
- virtual public LegacyInterfaceNoObjectManagerProxyBase,
- public LegacyInterfaceProxy<_AttributeExtensions...>,
- virtual public _AttributeExtensions... {
-public:
- LegacyInterfaceNoObjectManagerProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~LegacyInterfaceNoObjectManagerProxy();
-
- typedef LegacyInterfaceNoObjectManager InterfaceType;
-
- inline static const char* getInterface() {
- return(LegacyInterfaceNoObjectManager::getInterface());
- }
-
-
-
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<LegacyInterfaceNoObjectManagerProxyBase> delegate_;
-};
-
-typedef LegacyInterfaceNoObjectManagerProxy<> LegacyInterfaceNoObjectManagerProxyDefault;
-
-
-//
-// LegacyInterfaceNoObjectManagerProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::LegacyInterfaceNoObjectManagerProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- ::v1::fake::legacy::service::LegacyInterfaceProxy<_AttributeExtensions...>(delegate),
- _AttributeExtensions(*(std::dynamic_pointer_cast<LegacyInterfaceNoObjectManagerProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<LegacyInterfaceNoObjectManagerProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::~LegacyInterfaceNoObjectManagerProxy() {
-}
-
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& LegacyInterfaceNoObjectManagerProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp
deleted file mode 100644
index 34ff82e..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_BASE_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_BASE_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Proxy.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceNoObjectManagerProxyBase
- : virtual public LegacyInterfaceProxyBase {
-public:
-
-
-
-
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp
deleted file mode 100644
index 3afdae2..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_HPP_
-
-#include <functional>
-
-
-
-#include <v1/fake/legacy/service/LegacyInterfaceStub.hpp>
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service LegacyInterfaceNoObjectManager. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class LegacyInterfaceNoObjectManagerStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual LegacyInterfaceNoObjectManager,
- public virtual LegacyInterfaceStubAdapter {
- public:
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for LegacyInterfaceNoObjectManager.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class LegacyInterfaceNoObjectManagerStubRemoteEvent
-: public virtual LegacyInterfaceStubRemoteEvent
-{
-public:
- virtual ~LegacyInterfaceNoObjectManagerStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service LegacyInterfaceNoObjectManager to remote clients.
- * 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 LegacyInterfaceNoObjectManagerStub
- : public virtual CommonAPI::Stub<LegacyInterfaceNoObjectManagerStubAdapter, LegacyInterfaceNoObjectManagerStubRemoteEvent>,
- public virtual LegacyInterfaceStub
-{
-public:
-
- virtual ~LegacyInterfaceNoObjectManagerStub() {}
- virtual const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> clientId) = 0;
-
-
-
- using CommonAPI::Stub<LegacyInterfaceNoObjectManagerStubAdapter, LegacyInterfaceNoObjectManagerStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<LegacyInterfaceNoObjectManagerStubAdapter, LegacyInterfaceNoObjectManagerStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<LegacyInterfaceNoObjectManagerStubAdapter, LegacyInterfaceNoObjectManagerStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef LegacyInterfaceNoObjectManagerStubRemoteEvent RemoteEventType;
- typedef LegacyInterfaceNoObjectManager StubInterface;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.cpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.cpp
deleted file mode 100644
index a195973..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-LegacyInterfaceNoObjectManagerStubDefault::LegacyInterfaceNoObjectManagerStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(LegacyInterfaceNoObjectManager::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& LegacyInterfaceNoObjectManagerStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-LegacyInterfaceNoObjectManagerStubRemoteEvent* LegacyInterfaceNoObjectManagerStubDefault::initStubAdapter(const std::shared_ptr<LegacyInterfaceNoObjectManagerStubAdapter> &_adapter) {
- LegacyInterfaceStubDefault::initStubAdapter(_adapter);
- CommonAPI::Stub<LegacyInterfaceNoObjectManagerStubAdapter, LegacyInterfaceNoObjectManagerStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-
-
-
-LegacyInterfaceNoObjectManagerStubDefault::RemoteEventHandler::RemoteEventHandler(LegacyInterfaceNoObjectManagerStubDefault *_defaultStub)
- : LegacyInterfaceStubDefault::RemoteEventHandler(_defaultStub),
- defaultStub_(_defaultStub) {
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.hpp
deleted file mode 100644
index b970bcc..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStubDefault.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_DEFAULT_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_DEFAULT_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp>
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-/**
- * Provides a default implementation for LegacyInterfaceNoObjectManagerStubRemoteEvent and
- * LegacyInterfaceNoObjectManagerStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class LegacyInterfaceNoObjectManagerStubDefault
- : public virtual LegacyInterfaceNoObjectManagerStub,
- public virtual LegacyInterfaceStubDefault {
-public:
- LegacyInterfaceNoObjectManagerStubDefault();
-
- LegacyInterfaceNoObjectManagerStubRemoteEvent* initStubAdapter(const std::shared_ptr<LegacyInterfaceNoObjectManagerStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
-
-
-
-protected:
- class RemoteEventHandler: public virtual LegacyInterfaceNoObjectManagerStubRemoteEvent, public virtual LegacyInterfaceStubDefault::RemoteEventHandler {
- public:
- RemoteEventHandler(LegacyInterfaceNoObjectManagerStubDefault *_defaultStub);
-
-
- private:
- LegacyInterfaceNoObjectManagerStubDefault *defaultStub_;
- };
-private:
- LegacyInterfaceNoObjectManagerStubDefault::RemoteEventHandler remoteEventHandler_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp
deleted file mode 100644
index e4484ef..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-template <typename ... _AttributeExtensions>
-class LegacyInterfaceProxy
- : virtual public LegacyInterface,
- virtual public LegacyInterfaceProxyBase,
- virtual public _AttributeExtensions... {
-public:
- LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
- ~LegacyInterfaceProxy();
-
- typedef LegacyInterface InterfaceType;
-
-
-
-
- /**
- * Calls TestMethod with synchronous semantics.
- *
- * All const parameters are input parameters to this method.
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_internalCallStatus, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls TestMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls OtherTestMethod with synchronous semantics.
- *
- * All non-const parameters will be filled with the returned values.
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void OtherTestMethod(CommonAPI::CallStatus &_internalCallStatus, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls OtherTestMethod with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls finish with synchronous semantics.
- *
- * The CallStatus will be filled when the method returns and indicate either
- * "SUCCESS" or which type of error has occurred. In case of an error, ONLY the CallStatus
- * will be set.
- */
- virtual void finish(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr);
- /**
- * Calls finish with asynchronous semantics.
- *
- * The provided callback will be called when the reply to this call arrives or
- * an error occurs during the call. The CallStatus will indicate either "SUCCESS"
- * or which type of error has occurred. In case of any error, ONLY the CallStatus
- * will have a defined value.
- * The std::future returned by this method will be fulfilled at arrival of the reply.
- * It will provide the same value for CallStatus as will be handed to the callback.
- */
- virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
-
-
- /**
- * Returns the CommonAPI address of the remote partner this proxy communicates with.
- */
- virtual const CommonAPI::Address &getAddress() const;
-
- /**
- * Returns true if the remote partner for this proxy is currently known to be available.
- */
- virtual bool isAvailable() const;
-
- /**
- * Returns true if the remote partner for this proxy is available.
- */
- virtual bool isAvailableBlocking() const;
-
- /**
- * Returns the wrapper class that is used to (de-)register for notifications about
- * the availability of the remote partner of this proxy.
- */
- virtual CommonAPI::ProxyStatusEvent& getProxyStatusEvent();
-
- /**
- * Returns the wrapper class that is used to access version information of the remote
- * partner of this proxy.
- */
- virtual CommonAPI::InterfaceVersionAttribute& getInterfaceVersionAttribute();
-
- private:
- std::shared_ptr<LegacyInterfaceProxyBase> delegate_;
-};
-
-typedef LegacyInterfaceProxy<> LegacyInterfaceProxyDefault;
-
-
-//
-// LegacyInterfaceProxy Implementation
-//
-template <typename ... _AttributeExtensions>
-LegacyInterfaceProxy<_AttributeExtensions...>::LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- _AttributeExtensions(*(std::dynamic_pointer_cast<LegacyInterfaceProxyBase>(delegate)))...,
- delegate_(std::dynamic_pointer_cast<LegacyInterfaceProxyBase>(delegate)) {
-}
-
-template <typename ... _AttributeExtensions>
-LegacyInterfaceProxy<_AttributeExtensions...>::~LegacyInterfaceProxy() {
-}
-
-template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::TestMethod(const int32_t &_input, CommonAPI::CallStatus &_internalCallStatus, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info) {
- delegate_->TestMethod(_input, _internalCallStatus, _val1, _val2, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->TestMethodAsync(_input, _callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethod(CommonAPI::CallStatus &_internalCallStatus, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info) {
- delegate_->OtherTestMethod(_internalCallStatus, _greeting, _identifier, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->OtherTestMethodAsync(_callback, _info);
-}
-template <typename ... _AttributeExtensions>
-void LegacyInterfaceProxy<_AttributeExtensions...>::finish(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- delegate_->finish(_internalCallStatus, _info);
-}
-
-template <typename ... _AttributeExtensions>
-std::future<CommonAPI::CallStatus> LegacyInterfaceProxy<_AttributeExtensions...>::finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return delegate_->finishAsync(_callback, _info);
-}
-
-template <typename ... _AttributeExtensions>
-const CommonAPI::Address &LegacyInterfaceProxy<_AttributeExtensions...>::getAddress() const {
- return delegate_->getAddress();
-}
-
-template <typename ... _AttributeExtensions>
-bool LegacyInterfaceProxy<_AttributeExtensions...>::isAvailable() const {
- return delegate_->isAvailable();
-}
-
-template <typename ... _AttributeExtensions>
-bool LegacyInterfaceProxy<_AttributeExtensions...>::isAvailableBlocking() const {
- return delegate_->isAvailableBlocking();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::ProxyStatusEvent& LegacyInterfaceProxy<_AttributeExtensions...>::getProxyStatusEvent() {
- return delegate_->getProxyStatusEvent();
-}
-
-template <typename ... _AttributeExtensions>
-CommonAPI::InterfaceVersionAttribute& LegacyInterfaceProxy<_AttributeExtensions...>::getInterfaceVersionAttribute() {
- return delegate_->getInterfaceVersionAttribute();
-}
-
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp
deleted file mode 100644
index 03eb9a1..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterface.hpp>
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Proxy.hpp>
-#include <functional>
-#include <future>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceProxyBase
- : virtual public CommonAPI::Proxy {
-public:
-
- typedef std::function<void(const CommonAPI::CallStatus&, const int32_t&, const int32_t&)> TestMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, const std::string&, const int32_t&)> OtherTestMethodAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&)> FinishAsyncCallback;
-
-
-
- virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_internalCallStatus, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void OtherTestMethod(CommonAPI::CallStatus &_internalCallStatus, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual void finish(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr) = 0;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp
deleted file mode 100644
index 8aeca14..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
-
-#include <functional>
-
-
-
-
-#include <v1/fake/legacy/service/LegacyInterface.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <vector>
-
-#include <CommonAPI/Stub.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-/**
- * Receives messages from remote and handles all dispatching of deserialized calls
- * to a stub for the service LegacyInterface. Also provides means to send broadcasts
- * and attribute-changed-notifications of observable attributes as defined by this service.
- * An application developer should not need to bother with this class.
- */
-class LegacyInterfaceStubAdapter
- : public virtual CommonAPI::StubAdapter,
- public virtual LegacyInterface {
- public:
-
-
-
- virtual void deactivateManagedInstances() = 0;
-protected:
- /**
- * Defines properties for storing the ClientIds of clients / proxies that have
- * subscribed to the selective broadcasts
- */
-};
-
-/**
- * Defines the necessary callbacks to handle remote set events related to the attributes
- * defined in the IDL description for LegacyInterface.
- * For each attribute two callbacks are defined:
- * - a verification callback that allows to verify the requested value and to prevent setting
- * e.g. an invalid value ("onRemoteSet<AttributeName>").
- * - an action callback to do local work after the attribute value has been changed
- * ("onRemote<AttributeName>Changed").
- *
- * This class and the one below are the ones an application developer needs to have
- * a look at if he wants to implement a service.
- */
-class LegacyInterfaceStubRemoteEvent
-{
-public:
- virtual ~LegacyInterfaceStubRemoteEvent() { }
-
-};
-
-/**
- * Defines the interface that must be implemented by any class that should provide
- * the service LegacyInterface to remote clients.
- * 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 virtual CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>
-{
-public:
- typedef std::function<void (int32_t _val1, int32_t _val2)>TestMethodReply_t;
- typedef std::function<void (std::string _greeting, int32_t _identifier)>OtherTestMethodReply_t;
- typedef std::function<void ()>finishReply_t;
-
- 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.
- virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply) = 0;
- /// This is the method that will be called on remote calls on the method OtherTestMethod.
- virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply) = 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> _client, finishReply_t _reply) = 0;
-
- using CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::initStubAdapter;
- typedef CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::StubAdapterType StubAdapterType;
- typedef CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::RemoteEventHandlerType RemoteEventHandlerType;
- typedef LegacyInterfaceStubRemoteEvent RemoteEventType;
- typedef LegacyInterface StubInterface;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp
deleted file mode 100644
index 9c8237c..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-LegacyInterfaceStubDefault::LegacyInterfaceStubDefault():
- remoteEventHandler_(this),
- interfaceVersion_(LegacyInterface::getInterfaceVersion()) {
-}
-
-const CommonAPI::Version& LegacyInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
- (void)_client;
- return interfaceVersion_;
-}
-
-LegacyInterfaceStubRemoteEvent* LegacyInterfaceStubDefault::initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter> &_adapter) {
- CommonAPI::Stub<LegacyInterfaceStubAdapter, LegacyInterfaceStubRemoteEvent>::stubAdapter_ = _adapter;
- return &remoteEventHandler_;
-}
-
-
-void LegacyInterfaceStubDefault::TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply) {
- (void)_client;
- (void) _input;
- int32_t val1 = 0;
- int32_t val2 = 0;
- _reply(val1, val2);
-}
-
-void LegacyInterfaceStubDefault::OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply) {
- (void)_client;
- std::string greeting = "";
- int32_t identifier = 0;
- _reply(greeting, identifier);
-}
-
-void LegacyInterfaceStubDefault::finish(const std::shared_ptr<CommonAPI::ClientId> _client, finishReply_t _reply) {
- (void)_client;
- _reply();
-}
-
-
-
-
-LegacyInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LegacyInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp
deleted file mode 100644
index f5e459d..0000000
--- a/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.5.v201512091035.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_HPP_
-
-
-#include <v1/fake/legacy/service/LegacyInterfaceStub.hpp>
-#include <sstream>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-/**
- * Provides a default implementation for LegacyInterfaceStubRemoteEvent and
- * LegacyInterfaceStub. Method callbacks have an empty implementation,
- * remote set calls on attributes will always change the value of the attribute
- * to the one received.
- *
- * Override this stub if you only want to provide a subset of the functionality
- * that would be defined for this service, and/or if you do not need any non-default
- * behaviour.
- */
-class LegacyInterfaceStubDefault
- : public virtual LegacyInterfaceStub {
-public:
- LegacyInterfaceStubDefault();
-
- LegacyInterfaceStubRemoteEvent* initStubAdapter(const std::shared_ptr<LegacyInterfaceStubAdapter> &_adapter);
-
- const CommonAPI::Version& getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client);
-
-
- virtual void TestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _input, TestMethodReply_t _reply);
- virtual void OtherTestMethod(const std::shared_ptr<CommonAPI::ClientId> _client, OtherTestMethodReply_t _reply);
- virtual void finish(const std::shared_ptr<CommonAPI::ClientId> _client, finishReply_t _reply);
-
-
-
-protected:
- class RemoteEventHandler: public virtual LegacyInterfaceStubRemoteEvent {
- public:
- RemoteEventHandler(LegacyInterfaceStubDefault *_defaultStub);
-
-
- private:
- LegacyInterfaceStubDefault *defaultStub_;
- };
-private:
- LegacyInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
-
-
- CommonAPI::Version interfaceVersion_;
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-
-// Compatibility
-namespace v1_0 = v1;
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp
deleted file mode 100644
index c38adac..0000000
--- a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
- /*
- * This file was generated by the CommonAPI Generators.
- * Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
- * Used org.franca.core 0.9.1.201412191134.
- *
- * 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 "DerivedTypeCollectionDBusDeployment.hpp"
-
-namespace commonapi {
-namespace tests {
-namespace DerivedTypeCollection_ {
-
-// typecollection-specific deployments
-
-} // namespace DerivedTypeCollection_
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp
deleted file mode 100644
index f40ca1d..0000000
--- a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef COMMONAPI_TESTS_DERIVED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
-#define COMMONAPI_TESTS_DERIVED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace DerivedTypeCollection_ {
-
-// typecollection-specific deployment types
-typedef CommonAPI::MapDeployment<
- CommonAPI::EmptyDeployment,
- CommonAPI::DBus::ArrayDeployment<
- CommonAPI::DBus::StructDeployment<
- CommonAPI::DBus::StringDeployment,
- CommonAPI::EmptyDeployment
- >
- >
-> TestMapDeployment_t;
-
-typedef CommonAPI::DBus::StructDeployment<
- CommonAPI::DBus::StringDeployment,
- CommonAPI::EmptyDeployment,
- CommonAPI::EmptyDeployment
-> TestStructExtendedDeployment_t;
-
-typedef CommonAPI::MapDeployment<
- CommonAPI::EmptyDeployment,
- CommonAPI::DBus::StringDeployment
-> TestEnumMapDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestEnumDeployment_t;
-
-typedef CommonAPI::DBus::ArrayDeployment<
- CommonAPI::DBus::StructDeployment<
- CommonAPI::DBus::StringDeployment,
- CommonAPI::EmptyDeployment
- >
-> TestArrayTestStructDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestEnumExtended2Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestEnumMissingValueDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestEnumExtendedDeployment_t;
-
-typedef CommonAPI::DBus::ArrayDeployment<
- CommonAPI::EmptyDeployment
-> TestArrayUInt64Deployment_t;
-
-typedef CommonAPI::DBus::StructDeployment<
- CommonAPI::DBus::StringDeployment,
- CommonAPI::EmptyDeployment
-> TestStructDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestPolymorphicStructDeployment_t;
-
-typedef CommonAPI::DBus::StructDeployment<
- CommonAPI::DBus::StringDeployment,
- CommonAPI::EmptyDeployment,
- CommonAPI::EmptyDeployment
-> TestExtendedPolymorphicStructDeployment_t;
-
-typedef CommonAPI::MapDeployment<
- CommonAPI::EmptyDeployment,
- CommonAPI::EmptyDeployment
-> MapIntToPolymorphicDeployment_t;
-
-typedef CommonAPI::DBus::StructDeployment<
- CommonAPI::EmptyDeployment,
- CommonAPI::EmptyDeployment
-> StructWithPolymorphicMemberDeployment_t;
-
-typedef CommonAPI::DBus::StructDeployment<
- CommonAPI::MapDeployment<
- CommonAPI::EmptyDeployment,
- CommonAPI::DBus::StringDeployment
- >
-> StructWithEnumKeyMapDeployment_t;
-
-
-// typecollection-specific deployments
-
-} // namespace DerivedTypeCollection_
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_DERIVED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.cpp b/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.cpp
deleted file mode 100644
index 7bd03b9..0000000
--- a/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
- /*
- * This file was generated by the CommonAPI Generators.
- * Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
- * Used org.franca.core 0.9.1.201412191134.
- *
- * 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 "PredefinedTypeCollectionDBusDeployment.hpp"
-
-namespace commonapi {
-namespace tests {
-namespace PredefinedTypeCollection_ {
-
-// typecollection-specific deployments
-
-} // namespace PredefinedTypeCollection_
-} // namespace tests
-} // namespace commonapi
diff --git a/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.hpp b/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.hpp
deleted file mode 100644
index 7fe7971..0000000
--- a/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef COMMONAPI_TESTS_PREDEFINED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
-#define COMMONAPI_TESTS_PREDEFINED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace commonapi {
-namespace tests {
-namespace PredefinedTypeCollection_ {
-
-// typecollection-specific deployment types
-typedef CommonAPI::EmptyDeployment TestUInt8Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestUInt16Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestUInt32Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestUInt64Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestInt8Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestInt16Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestInt32Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestInt64Deployment_t;
-
-typedef CommonAPI::EmptyDeployment TestBooleanDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestByteBufferDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestDoubleDeployment_t;
-
-typedef CommonAPI::EmptyDeployment TestFloatDeployment_t;
-
-typedef CommonAPI::DBus::StringDeployment TestStringDeployment_t;
-
-
-// typecollection-specific deployments
-
-} // namespace PredefinedTypeCollection_
-} // namespace tests
-} // namespace commonapi
-
-#endif // COMMONAPI_TESTS_PREDEFINED_TYPE_COLLECTION_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp
deleted file mode 100644
index 0bd7ed8..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "ExtendedInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace ExtendedInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace ExtendedInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp
deleted file mode 100644
index 5253b0b..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace ExtendedInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace ExtendedInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
deleted file mode 100644
index 0b7e3f7..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createExtendedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<ExtendedInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerExtendedInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- ExtendedInterface::getInterface(),
- &createExtendedInterfaceDBusProxy);
-}
-
-ExtendedInterfaceDBusProxy::ExtendedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection),
- TestInterfaceDBusProxy(_address, _connection)
-{
-}
-
-
-
- void ExtendedInterfaceDBusProxy::TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "TestIntMethodExtended",
- "u",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inInt,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> ExtendedInterfaceDBusProxy::TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "TestIntMethodExtended",
- "u",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inInt,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
-
-
-void ExtendedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
deleted file mode 100644
index fc3cb8b..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusProxy.hpp>
-#include "v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class ExtendedInterfaceDBusProxy
- : virtual public ExtendedInterfaceProxyBase,
- virtual public TestInterfaceDBusProxy {
-public:
- ExtendedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~ExtendedInterfaceDBusProxy() { }
-
-
-
- virtual void TestIntMethodExtended(const uint32_t &_inInt, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 5eb09b1..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/ExtendedInterface.hpp>
-#include <v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createExtendedInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<ExtendedInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerExtendedInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- ExtendedInterface::getInterface(), &createExtendedInterfaceDBusStubAdapter);
-}
-
-ExtendedInterfaceDBusStubAdapterInternal::~ExtendedInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- ExtendedInterfaceDBusStubAdapterHelper::deinit();
-}
-
-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();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- CommonAPI::Version
- > ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu");
-
-
-#ifdef WIN32
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- uint32_t
- > ExtendedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute
- , "u"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- uint32_t
- > ExtendedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
- ,&ExtendedInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- ,"u"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute
- , "(sqi)"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
- ,&ExtendedInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- ,"(sqi)"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute
- , "at"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
- &ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
- ,&ExtendedInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- ,"at"
- );
-#endif
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher(
- &ExtendedInterfaceStub::TestIntMethodExtended, "",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- std::make_tuple());
-
-#ifdef WIN32
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(
- &ExtendedInterfaceStub::testEmptyMethod, "",
- std::make_tuple(),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(
- &ExtendedInterfaceStub::testVoidPredefinedTypeMethod, "",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<uint32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(
- &ExtendedInterfaceStub::testPredefinedTypeMethod, "us",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(
- &ExtendedInterfaceStub::testVoidDerivedTypeMethod, "",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(
- &ExtendedInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(
- &ExtendedInterfaceStub::TestArrayOfPolymorphicStructMethod, "",
- std::make_tuple(static_cast<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(
- &ExtendedInterfaceStub::TestMapOfPolymorphicStructMethod, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(
- &ExtendedInterfaceStub::TestStructWithPolymorphicMemberMethod, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
- std::tuple<>
-
- > ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(
- &ExtendedInterfaceStub::TestStructWithEnumKeyMapMember, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t*>(nullptr)),
- std::make_tuple());
-#endif
-
-
-
-#ifdef WIN32
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > ExtendedInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b");
-
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, "");
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > ExtendedInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b");
-
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, "");
-#endif
-
-const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& ExtendedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& ExtendedInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- ExtendedInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<ExtendedInterfaceStub>(_stub), false),
- TestInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
- stubDispatcherTable_({
- { { "TestIntMethodExtended", "u" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testIntMethodExtendedStubDispatcher }
- #ifdef WIN32
- ,
- { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher }
- , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher },
- { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher }
- , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher },
- { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher }
- , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher }
- ,
- { { "testEmptyMethod", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher },
- { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher },
- { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher },
- { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher },
- { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher },
- { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher },
- { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher },
- { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher },
- { { "TestStructWithEnumKeyMapMember", "(a{is})" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher }
- ,
- { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }
- ,
- { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher },
- { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }
- ,
- { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }
- #endif
- }),
- stubAttributeTable_() {
-
- #ifdef WIN32
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher });
- #else
- auto parentDispatcherTable = TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable();
- stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end());
-
- auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" });
- if(interfaceVersionGetter != stubDispatcherTable_.end()) {
- interfaceVersionGetter->second = &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher;
- } else {
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher });
- }
-
- auto parentAttributeTable = TestInterfaceDBusStubAdapterInternal::getStubAttributeTable();
- stubAttributeTable_.insert(parentAttributeTable.begin(), parentAttributeTable.end());
-
- #endif
-}
-
-bool ExtendedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index f87194d..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/ExtendedInterfaceStub.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include "v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<ExtendedInterfaceStub> ExtendedInterfaceDBusStubAdapterHelper;
-
-class ExtendedInterfaceDBusStubAdapterInternal
- : public virtual ExtendedInterfaceStubAdapter,
- public ExtendedInterfaceDBusStubAdapterHelper,
- public TestInterfaceDBusStubAdapterInternal
-{
-public:
- ExtendedInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~ExtendedInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return ExtendedInterface::getInterface();
- }
-
-
-
-
- const ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
- virtual const CommonAPI::Address &getAddress() const {
- return DBusStubAdapter::getAddress();
- }
-
- virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
- return ExtendedInterfaceDBusStubAdapterHelper::init(instance);
- }
-
- virtual void deinit() {
- return ExtendedInterfaceDBusStubAdapterHelper::deinit();
- }
-
- virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return ExtendedInterfaceDBusStubAdapterHelper::onInterfaceDBusMessage(dbusMessage);
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return ExtendedInterfaceDBusStubAdapterHelper::onInterfaceDBusFreedesktopPropertiesMessage(dbusMessage);
- }
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- CommonAPI::Version
- > getExtendedInterfaceInterfaceVersionStubDispatcher;
-
-
-#ifdef WIN32
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- uint32_t
- > getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- uint32_t
- > setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > setTestDerivedArrayAttributeAttributeStubDispatcher;
-#endif
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<>
-
- > testIntMethodExtendedStubDispatcher;
-
-#ifdef WIN32
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > testEmptyMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<>
-
- > testVoidPredefinedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<uint32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > testPredefinedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<>
-
- > testVoidDerivedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
-
- > testDerivedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>>,
- std::tuple<>
-
- > testArrayOfPolymorphicStructMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
- std::tuple<>
-
- > testMapOfPolymorphicStructMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
- std::tuple<>
-
- > testStructWithPolymorphicMemberMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
- std::tuple<>
-
- > testStructWithEnumKeyMapMemberStubDispatcher;
-#endif
-
-
-#ifdef WIN32
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > subscribeTestSelectiveBroadcastSelectiveStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher;
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::ExtendedInterfaceStub,
- ExtendedInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
-#endif
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- ExtendedInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class ExtendedInterfaceDBusStubAdapter
- : public ExtendedInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<ExtendedInterfaceDBusStubAdapter> {
-public:
- ExtendedInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- ExtendedInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp
deleted file mode 100644
index c958881..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "TestFreedesktopDerivedInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestFreedesktopDerivedInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace TestFreedesktopDerivedInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp
deleted file mode 100644
index f5d7490..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestFreedesktopDerivedInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace TestFreedesktopDerivedInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
deleted file mode 100644
index 07761c9..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopDerivedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<TestFreedesktopDerivedInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- TestFreedesktopDerivedInterface::getInterface(),
- &createTestFreedesktopDerivedInterfaceDBusProxy);
-}
-
-TestFreedesktopDerivedInterfaceDBusProxy::TestFreedesktopDerivedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection),
- TestFreedesktopInterfaceDBusProxy(_address, _connection)
-, testAttributedFromDerivedInterface_(*this, getAddress().getInterface(), "TestAttributedFromDerivedInterface", static_cast<CommonAPI::EmptyDeployment*>(nullptr))
-{
-}
-
- TestFreedesktopDerivedInterfaceDBusProxy::TestAttributedFromDerivedInterfaceAttribute& TestFreedesktopDerivedInterfaceDBusProxy::getTestAttributedFromDerivedInterfaceAttribute() {
- return testAttributedFromDerivedInterface_;
- }
-
-
-
-
-void TestFreedesktopDerivedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
deleted file mode 100644
index ec25b27..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp>
-#include "v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusAttribute.hpp>
-#include <CommonAPI/DBus/DBusFreedesktopAttribute.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopDerivedInterfaceDBusProxy
- : virtual public TestFreedesktopDerivedInterfaceProxyBase,
- virtual public TestFreedesktopInterfaceDBusProxy {
-public:
- TestFreedesktopDerivedInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~TestFreedesktopDerivedInterfaceDBusProxy() { }
-
- virtual TestAttributedFromDerivedInterfaceAttribute& getTestAttributedFromDerivedInterfaceAttribute();
-
-
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestAttributedFromDerivedInterfaceAttribute>> testAttributedFromDerivedInterface_;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 3efb939..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestFreedesktopDerivedInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<TestFreedesktopDerivedInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- TestFreedesktopDerivedInterface::getInterface(), &createTestFreedesktopDerivedInterfaceDBusStubAdapter);
-}
-
-TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::~TestFreedesktopDerivedInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
-
-}
-
-const char* TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- std::string(TestFreedesktopInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) +
- "<property name=\"TestAttributedFromDerivedInterface\" type=\"u\" access=\"readwrite\" />\n"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- CommonAPI::Version
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher(&TestFreedesktopDerivedInterfaceStub::getInterfaceVersion, "uu");
-
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestAttributedFromDerivedInterfaceAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestAttributedFromDerivedInterfaceAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestAttributedFromDerivedInterfaceAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged
- ,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestAttributedFromDerivedInterfaceAttributeChanged
- );
-
-#ifdef WIN32
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
- ,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestReadonlyAttributeAttribute
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
- ,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
- &TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
- ,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- );
-#endif
-
-
-#ifdef WIN32
-#endif
-
-void TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
- uint32_t,
- CommonAPI::EmptyDeployment
- > ::sendPropertiesChangedSignal(
- *this,
- "TestAttributedFromDerivedInterface",
- value,
- static_cast<CommonAPI::EmptyDeployment*>(nullptr)
- );
-}
-
-
-#ifdef WIN32
-#endif
-
-const TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- TestFreedesktopDerivedInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceStub>(_stub), false),
- TestFreedesktopInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
- stubDispatcherTable_({
- #ifdef WIN32
- #endif
- }),
- stubAttributeTable_({
- {
- "TestAttributedFromDerivedInterface",
- {
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestAttributedFromDerivedInterfaceAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestAttributedFromDerivedInterfaceAttributeStubDispatcher
- }
- }
- #ifdef WIN32
- ,
- {
- "TestPredefinedTypeAttribute",
- {
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher
- }
- },
- {
- "TestReadonlyAttribute",
- {
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher,
- NULL
- }
- },
- {
- "TestDerivedStructAttribute",
- {
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher
- }
- },
- {
- "TestDerivedArrayAttribute",
- {
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher
- }
- }
- #endif
- }
- ) {
-
- #ifdef WIN32
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher });
- #else
- auto parentDispatcherTable = TestFreedesktopInterfaceDBusStubAdapterInternal::getStubDispatcherTable();
- stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end());
-
- auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" });
- if(interfaceVersionGetter != stubDispatcherTable_.end()) {
- interfaceVersionGetter->second = &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher;
- } else {
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher });
- }
-
- auto parentAttributeTable = TestFreedesktopInterfaceDBusStubAdapterInternal::getStubAttributeTable();
- stubAttributeTable_.insert(parentAttributeTable.begin(), parentAttributeTable.end());
-
- #endif
-}
-
-bool TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return true;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index a261c2e..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp>
-#include "v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<TestFreedesktopDerivedInterfaceStub> TestFreedesktopDerivedInterfaceDBusStubAdapterHelper;
-
-class TestFreedesktopDerivedInterfaceDBusStubAdapterInternal
- : public virtual TestFreedesktopDerivedInterfaceStubAdapter,
- public TestFreedesktopDerivedInterfaceDBusStubAdapterHelper,
- public TestFreedesktopInterfaceDBusStubAdapterInternal
-{
-public:
- TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~TestFreedesktopDerivedInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return TestFreedesktopDerivedInterface::getInterface();
- }
-
- void fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& value);
-
-
-
- const TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
- virtual const CommonAPI::Address &getAddress() const {
- return DBusStubAdapter::getAddress();
- }
-
- virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
- return TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::init(instance);
- }
-
- virtual void deinit() {
- return TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::deinit();
- }
-
- virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::onInterfaceDBusMessage(dbusMessage);
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::onInterfaceDBusFreedesktopPropertiesMessage(dbusMessage);
- }
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- CommonAPI::Version
- > getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher;
-
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > getTestAttributedFromDerivedInterfaceAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > setTestAttributedFromDerivedInterfaceAttributeStubDispatcher;
-
-#ifdef WIN32
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- uint32_t
- > getTestReadonlyAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > setTestDerivedArrayAttributeAttributeStubDispatcher;
-#endif
-
-
-#ifdef WIN32
-#endif
-
-
-#ifdef WIN32
-#endif
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- TestFreedesktopDerivedInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class TestFreedesktopDerivedInterfaceDBusStubAdapter
- : public TestFreedesktopDerivedInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<TestFreedesktopDerivedInterfaceDBusStubAdapter> {
-public:
- TestFreedesktopDerivedInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- TestFreedesktopDerivedInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp
deleted file mode 100644
index 50dcd15..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "TestFreedesktopInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestFreedesktopInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace TestFreedesktopInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp
deleted file mode 100644
index 61a02b5..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_DEPLOYMENT_HPP_
-
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestFreedesktopInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace TestFreedesktopInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
deleted file mode 100644
index 7a6ff88..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<TestFreedesktopInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerTestFreedesktopInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- TestFreedesktopInterface::getInterface(),
- &createTestFreedesktopInterfaceDBusProxy);
-}
-
-TestFreedesktopInterfaceDBusProxy::TestFreedesktopInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-, testPredefinedTypeAttribute_(*this, getAddress().getInterface(), "TestPredefinedTypeAttribute", static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- testReadonlyAttribute_(*this, getAddress().getInterface(), "TestReadonlyAttribute", static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- testDerivedStructAttribute_(*this, getAddress().getInterface(), "TestDerivedStructAttribute", static_cast<::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t*>(nullptr)),
- testDerivedArrayAttribute_(*this, getAddress().getInterface(), "TestDerivedArrayAttribute", static_cast<::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t*>(nullptr))
-{
-}
-
- TestFreedesktopInterfaceDBusProxy::TestPredefinedTypeAttributeAttribute& TestFreedesktopInterfaceDBusProxy::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttribute_;
- }
- TestFreedesktopInterfaceDBusProxy::TestReadonlyAttributeAttribute& TestFreedesktopInterfaceDBusProxy::getTestReadonlyAttributeAttribute() {
- return testReadonlyAttribute_;
- }
- TestFreedesktopInterfaceDBusProxy::TestDerivedStructAttributeAttribute& TestFreedesktopInterfaceDBusProxy::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttribute_;
- }
- TestFreedesktopInterfaceDBusProxy::TestDerivedArrayAttributeAttribute& TestFreedesktopInterfaceDBusProxy::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttribute_;
- }
-
-
-
-
-void TestFreedesktopInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
deleted file mode 100644
index c9111cd..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
-#include "v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusAttribute.hpp>
-#include <CommonAPI/DBus/DBusFreedesktopAttribute.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestFreedesktopInterfaceDBusProxy
- : virtual public TestFreedesktopInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- TestFreedesktopInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~TestFreedesktopInterfaceDBusProxy() { }
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
- virtual TestReadonlyAttributeAttribute& getTestReadonlyAttributeAttribute();
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
-
-
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopReadonlyAttribute<TestReadonlyAttributeAttribute>> testReadonlyAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedStructAttributeAttribute, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t>> testDerivedStructAttribute_;
- CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestDerivedArrayAttributeAttribute, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t>> testDerivedArrayAttribute_;
-
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index b809c44..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestFreedesktopInterface.hpp>
-#include <v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestFreedesktopInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<TestFreedesktopInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerTestFreedesktopInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- TestFreedesktopInterface::getInterface(), &createTestFreedesktopInterfaceDBusStubAdapter);
-}
-
-TestFreedesktopInterfaceDBusStubAdapterInternal::~TestFreedesktopInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- TestFreedesktopInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void TestFreedesktopInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
-
-}
-
-const char* TestFreedesktopInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- "<method name=\"getInterfaceVersion\">\n"
- "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
- "</method>\n"
- "<property name=\"TestPredefinedTypeAttribute\" type=\"u\" access=\"readwrite\" />\n"
- "<property name=\"TestReadonlyAttribute\" type=\"u\" access=\"read\" />\n"
- "<property name=\"TestDerivedStructAttribute\" type=\"(sqi)\" access=\"readwrite\" />\n"
- "<property name=\"TestDerivedArrayAttribute\" type=\"at\" access=\"readwrite\" />\n"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- CommonAPI::Version
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestFreedesktopInterfaceInterfaceVersionStubDispatcher(&TestFreedesktopInterfaceStub::getInterfaceVersion, "uu");
-
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestPredefinedTypeAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestReadonlyAttributeAttribute
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- );
-CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute
- );
-CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- );
-
-
-
-
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
- uint32_t,
- CommonAPI::EmptyDeployment
- > ::sendPropertiesChangedSignal(
- *this,
- "TestPredefinedTypeAttribute",
- value,
- static_cast<CommonAPI::EmptyDeployment*>(nullptr)
- );
-}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestReadonlyAttributeAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
- uint32_t,
- CommonAPI::EmptyDeployment
- > ::sendPropertiesChangedSignal(
- *this,
- "TestReadonlyAttribute",
- value,
- static_cast<CommonAPI::EmptyDeployment*>(nullptr)
- );
-}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > ::sendPropertiesChangedSignal(
- *this,
- "TestDerivedStructAttribute",
- value,
- static_cast<::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t*>(nullptr)
- );
-}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value) {
- CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > ::sendPropertiesChangedSignal(
- *this,
- "TestDerivedArrayAttribute",
- value,
- static_cast<::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t*>(nullptr)
- );
-}
-
-
-
-const TestFreedesktopInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestFreedesktopInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& TestFreedesktopInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-TestFreedesktopInterfaceDBusStubAdapterInternal::TestFreedesktopInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- TestFreedesktopInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestFreedesktopInterfaceStub>(_stub), false),
- stubDispatcherTable_({
- }),
- stubAttributeTable_({
- {
- "TestPredefinedTypeAttribute",
- {
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher
- }
- },
- {
- "TestReadonlyAttribute",
- {
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher,
- NULL
- }
- },
- {
- "TestDerivedStructAttribute",
- {
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher
- }
- },
- {
- "TestDerivedArrayAttribute",
- {
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher,
- &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher
- }
- }
- }
- ) {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestFreedesktopInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool TestFreedesktopInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return true;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index 88a7d6d..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include "v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp"
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<TestFreedesktopInterfaceStub> TestFreedesktopInterfaceDBusStubAdapterHelper;
-
-class TestFreedesktopInterfaceDBusStubAdapterInternal
- : public virtual TestFreedesktopInterfaceStubAdapter,
- public TestFreedesktopInterfaceDBusStubAdapterHelper
-{
-public:
- TestFreedesktopInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~TestFreedesktopInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return TestFreedesktopInterface::getInterface();
- }
-
- void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value);
- void fireTestReadonlyAttributeAttributeChanged(const uint32_t& value);
- void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value);
- void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value);
-
-
-
- const TestFreedesktopInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- CommonAPI::Version
- > getTestFreedesktopInterfaceInterfaceVersionStubDispatcher;
-
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- uint32_t
- > getTestReadonlyAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > setTestDerivedArrayAttributeAttributeStubDispatcher;
-
-
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- TestFreedesktopInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class TestFreedesktopInterfaceDBusStubAdapter
- : public TestFreedesktopInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<TestFreedesktopInterfaceDBusStubAdapter> {
-public:
- TestFreedesktopInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- TestFreedesktopInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp
deleted file mode 100644
index e01f5b8..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "TestInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace TestInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp
deleted file mode 100644
index e534f66..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_DBUS_DEPLOYMENT_HPP_
-
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace TestInterface_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.cpp
deleted file mode 100644
index 2b4f03e..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,426 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<TestInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerTestInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- TestInterface::getInterface(),
- &createTestInterfaceDBusProxy);
-}
-
-TestInterfaceDBusProxy::TestInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-, testPredefinedTypeAttribute_(*this, "onTestPredefinedTypeAttributeAttributeChanged", "setTestPredefinedTypeAttributeAttribute", "u", "getTestPredefinedTypeAttributeAttribute", static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- testDerivedStructAttribute_(*this, "onTestDerivedStructAttributeAttributeChanged", "setTestDerivedStructAttributeAttribute", "(sqi)", "getTestDerivedStructAttributeAttribute", static_cast<::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t*>(nullptr)),
- testDerivedArrayAttribute_(*this, "onTestDerivedArrayAttributeAttributeChanged", "setTestDerivedArrayAttributeAttribute", "at", "getTestDerivedArrayAttributeAttribute", static_cast<::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t*>(nullptr))
-, testPredefinedTypeBroadcast_(*this, "TestPredefinedTypeBroadcast", "us", std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr))),
- testSelectiveBroadcastSelective_(*this, "TestSelectiveBroadcast", "", std::make_tuple()),
- testBroadcastWithOutArgsSelective_(*this, "TestBroadcastWithOutArgs", "us", std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)))
-{
-}
-
- TestInterfaceDBusProxy::TestPredefinedTypeAttributeAttribute& TestInterfaceDBusProxy::getTestPredefinedTypeAttributeAttribute() {
- return testPredefinedTypeAttribute_;
- }
- TestInterfaceDBusProxy::TestDerivedStructAttributeAttribute& TestInterfaceDBusProxy::getTestDerivedStructAttributeAttribute() {
- return testDerivedStructAttribute_;
- }
- TestInterfaceDBusProxy::TestDerivedArrayAttributeAttribute& TestInterfaceDBusProxy::getTestDerivedArrayAttributeAttribute() {
- return testDerivedArrayAttribute_;
- }
-
-TestInterfaceDBusProxy::TestPredefinedTypeBroadcastEvent& TestInterfaceDBusProxy::getTestPredefinedTypeBroadcastEvent() {
- return testPredefinedTypeBroadcast_;
-}
-TestInterfaceDBusProxy::TestSelectiveBroadcastSelectiveEvent& TestInterfaceDBusProxy::getTestSelectiveBroadcastSelectiveEvent() {
- return testSelectiveBroadcastSelective_;
-}
-TestInterfaceDBusProxy::TestBroadcastWithOutArgsSelectiveEvent& TestInterfaceDBusProxy::getTestBroadcastWithOutArgsSelectiveEvent() {
- return testBroadcastWithOutArgsSelective_;
-}
-
- void TestInterfaceDBusProxy::testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "testEmptyMethod",
- "",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "testEmptyMethod",
- "",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32Value(_uint32Value, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringValue(_stringValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "testVoidPredefinedTypeMethod",
- "us",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_uint32Value, deploy_stringValue,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32Value(_uint32Value, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringValue(_stringValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "testVoidPredefinedTypeMethod",
- "us",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_uint32Value, deploy_stringValue,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_internalCallStatus, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32InValue(_uint32InValue, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringInValue(_stringInValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32OutValue(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringOutValue(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodWithReply(
- *this,
- "testPredefinedTypeMethod",
- "us",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_uint32InValue, deploy_stringInValue,
-_internalCallStatus,
-deploy_uint32OutValue, deploy_stringOutValue);
-_uint32OutValue = deploy_uint32OutValue.getValue();
-_stringOutValue = deploy_stringOutValue.getValue();
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32InValue(_uint32InValue, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringInValue(_stringInValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> deploy_uint32OutValue(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_stringOutValue(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<uint32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodAsync(
- *this,
- "testPredefinedTypeMethod",
- "us",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_uint32InValue, deploy_stringInValue,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> _uint32OutValue, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _stringOutValue) {
- if (_callback)
- _callback(_internalCallStatus, _uint32OutValue.getValue(), _stringOutValue.getValue());
- },
- std::make_tuple(deploy_uint32OutValue, deploy_stringOutValue));
- }
- void TestInterfaceDBusProxy::testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2Value(_testEnumExtended2Value, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapValue(_testMapValue, static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "testVoidDerivedTypeMethod",
- "ia{ua(sq)}",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_testEnumExtended2Value, deploy_testMapValue,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2Value(_testEnumExtended2Value, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapValue(_testMapValue, static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "testVoidDerivedTypeMethod",
- "ia{ua(sq)}",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_testEnumExtended2Value, deploy_testMapValue,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_internalCallStatus, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2InValue(_testEnumExtended2InValue, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapInValue(_testMapInValue, static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2OutValue(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapOutValue(static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap,::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
- >
- >::callMethodWithReply(
- *this,
- "testDerivedTypeMethod",
- "ia{ua(sq)}",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_testEnumExtended2InValue, deploy_testMapInValue,
-_internalCallStatus,
-deploy_testEnumExtended2OutValue, deploy_testMapOutValue);
-_testEnumExtended2OutValue = deploy_testEnumExtended2OutValue.getValue();
-_testMapOutValue = deploy_testMapOutValue.getValue();
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2InValue(_testEnumExtended2InValue, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapInValue(_testMapInValue, static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> deploy_testEnumExtended2OutValue(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> deploy_testMapOutValue(static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap,::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
- >
- >::callMethodAsync(
- *this,
- "testDerivedTypeMethod",
- "ia{ua(sq)}",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_testEnumExtended2InValue, deploy_testMapInValue,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> _testEnumExtended2OutValue, CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> _testMapOutValue) {
- if (_callback)
- _callback(_internalCallStatus, _testEnumExtended2OutValue.getValue(), _testMapOutValue.getValue());
- },
- std::make_tuple(deploy_testEnumExtended2OutValue, deploy_testMapOutValue));
- }
- void TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>, CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>> deploy_inArray(_inArray, static_cast<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>, CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t> >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "TestArrayOfPolymorphicStructMethod",
- "a(uv)",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inArray,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>, CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>> deploy_inArray(_inArray, static_cast<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>, CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t> >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "TestArrayOfPolymorphicStructMethod",
- "a(uv)",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inArray,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic, ::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t> deploy_inMap(_inMap, static_cast<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic, ::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "TestMapOfPolymorphicStructMethod",
- "a{y(uv)}",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inMap,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic, ::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t> deploy_inMap(_inMap, static_cast<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic, ::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "TestMapOfPolymorphicStructMethod",
- "a{y(uv)}",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inMap,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember, ::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t> deploy_inStruct(_inStruct, static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember, ::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "TestStructWithPolymorphicMemberMethod",
- "(u(uv))",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inStruct,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember, ::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t> deploy_inStruct(_inStruct, static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember, ::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "TestStructWithPolymorphicMemberMethod",
- "(u(uv))",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inStruct,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
- void TestInterfaceDBusProxy::TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap, ::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t> deploy_inStruct(_inStruct, static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap, ::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "TestStructWithEnumKeyMapMember",
- "(a{is})",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inStruct,
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> TestInterfaceDBusProxy::TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap, ::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t> deploy_inStruct(_inStruct, static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap, ::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "TestStructWithEnumKeyMapMember",
- "(a{is})",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inStruct,
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
-
-
-void TestInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp
deleted file mode 100644
index 372ceaa..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
-#include "v1/commonapi/tests/TestInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusAttribute.hpp>
-#include <CommonAPI/DBus/DBusEvent.hpp>
-#include <CommonAPI/Types.hpp>
-#include <CommonAPI/DBus/DBusSelectiveEvent.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceDBusProxy
- : virtual public TestInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- TestInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~TestInterfaceDBusProxy() { }
-
- virtual TestPredefinedTypeAttributeAttribute& getTestPredefinedTypeAttributeAttribute();
- virtual TestDerivedStructAttributeAttribute& getTestDerivedStructAttributeAttribute();
- virtual TestDerivedArrayAttributeAttribute& getTestDerivedArrayAttributeAttribute();
-
- virtual TestPredefinedTypeBroadcastEvent& getTestPredefinedTypeBroadcastEvent();
- virtual TestSelectiveBroadcastSelectiveEvent& getTestSelectiveBroadcastSelectiveEvent();
- virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent();
-
- virtual void testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void testVoidPredefinedTypeMethod(const uint32_t &_uint32Value, const std::string &_stringValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testVoidPredefinedTypeMethodAsync(const uint32_t &_uint32Value, const std::string &_stringValue, TestVoidPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void testPredefinedTypeMethod(const uint32_t &_uint32InValue, const std::string &_stringInValue, CommonAPI::CallStatus &_internalCallStatus, uint32_t &_uint32OutValue, std::string &_stringOutValue, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testPredefinedTypeMethodAsync(const uint32_t &_uint32InValue, const std::string &_stringInValue, TestPredefinedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void testVoidDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testVoidDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2Value, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapValue, TestVoidDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void testDerivedTypeMethod(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, CommonAPI::CallStatus &_internalCallStatus, ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2OutValue, ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapOutValue, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testDerivedTypeMethodAsync(const ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 &_testEnumExtended2InValue, const ::commonapi::tests::DerivedTypeCollection::TestMap &_testMapInValue, TestDerivedTypeMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void TestArrayOfPolymorphicStructMethod(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestArrayOfPolymorphicStructMethodAsync(const std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> &_inArray, TestArrayOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void TestMapOfPolymorphicStructMethod(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestMapOfPolymorphicStructMethodAsync(const ::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic &_inMap, TestMapOfPolymorphicStructMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void TestStructWithPolymorphicMemberMethod(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestStructWithPolymorphicMemberMethodAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember &_inStruct, TestStructWithPolymorphicMemberMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void TestStructWithEnumKeyMapMember(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedStructAttributeAttribute, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t>> testDerivedStructAttribute_;
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestDerivedArrayAttributeAttribute, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t>> testDerivedArrayAttribute_;
-
- CommonAPI::DBus::DBusEvent<TestPredefinedTypeBroadcastEvent, CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment>, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>> testPredefinedTypeBroadcast_;
- CommonAPI::DBus::DBusSelectiveEvent<TestSelectiveBroadcastSelectiveEvent> testSelectiveBroadcastSelective_;
- CommonAPI::DBus::DBusSelectiveEvent<TestBroadcastWithOutArgsSelectiveEvent, CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment>, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>> testBroadcastWithOutArgsSelective_;
-
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 46562ab..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterface.hpp>
-#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<TestInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerTestInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- TestInterface::getInterface(), &createTestInterfaceDBusStubAdapter);
-}
-
-TestInterfaceDBusStubAdapterInternal::~TestInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- TestInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void TestInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
-
-}
-
-const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- "<method name=\"getInterfaceVersion\">\n"
- "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
- "</method>\n"
- "<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=\"(a{is})\" direction=\"in\" />\n"
- "</method>\n"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- CommonAPI::Version
- > TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu");
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- uint32_t
- > TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestPredefinedTypeAttributeAttribute
- , "u"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- uint32_t
- > TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestPredefinedTypeAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
- ,&TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- ,"u"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedStructAttributeAttribute
- , "(sqi)"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedStructAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
- ,&TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- ,"(sqi)"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedArrayAttributeAttribute
- , "at"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedArrayAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
- &TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
- ,&TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- ,"at"
- );
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher(
- &TestInterfaceStub::testEmptyMethod, "",
- std::make_tuple(),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher(
- &TestInterfaceStub::testVoidPredefinedTypeMethod, "",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<uint32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher(
- &TestInterfaceStub::testPredefinedTypeMethod, "us",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher(
- &TestInterfaceStub::testVoidDerivedTypeMethod, "",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
-
- > TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher(
- &TestInterfaceStub::testDerivedTypeMethod, "ia{ua(sq)}",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher(
- &TestInterfaceStub::TestArrayOfPolymorphicStructMethod, "",
- std::make_tuple(static_cast<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher(
- &TestInterfaceStub::TestMapOfPolymorphicStructMethod, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher(
- &TestInterfaceStub::TestStructWithPolymorphicMemberMethod, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t*>(nullptr)),
- std::make_tuple());
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
- std::tuple<>
-
- > TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher(
- &TestInterfaceStub::TestStructWithEnumKeyMapMember, "",
- std::make_tuple(static_cast<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t*>(nullptr)),
- std::make_tuple());
-
-
-void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t
- >>
- ::sendSignal(
- *this,
- "onTestPredefinedTypeAttributeAttributeChanged",
- "u",
- value
-
- );
-}
-void TestInterfaceDBusStubAdapterInternal::fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestStructExtended, ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t> deployedValue(value, static_cast<::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t*>(nullptr));
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- >
- >>
- ::sendSignal(
- *this,
- "onTestDerivedStructAttributeAttributeChanged",
- "(sqi)",
- deployedValue
-
- );
-}
-void TestInterfaceDBusStubAdapterInternal::fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value) {
- CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestArrayUInt64, ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t> deployedValue(value, static_cast<::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t*>(nullptr));
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- >
- >>
- ::sendSignal(
- *this,
- "onTestDerivedArrayAttributeAttributeChanged",
- "at",
- deployedValue
-
- );
-}
-
-void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>
- >>::sendSignal(
- *this,
- "TestPredefinedTypeBroadcast",
- "us",
- uint32Value,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>(stringValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr))
- );
-}
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b");
-
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, "");
-
-void TestInterfaceDBusStubAdapterInternal::fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client) {
- std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClient = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(_client);
-
- if(dbusClient)
- {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- >>::sendSignal(
- dbusClient->getDBusId(),
- *this,
- "TestSelectiveBroadcast",
- ""
- );
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
- std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList = _receivers;
-
- if (!_receivers)
- actualReceiverList = subscribersForTestSelectiveBroadcastSelective_;
-
- for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) {
- if (!_receivers || subscribersForTestSelectiveBroadcastSelective_->find(*clientIdIterator) != subscribersForTestSelectiveBroadcastSelective_->end()) {
- fireTestSelectiveBroadcastSelective(*clientIdIterator);
- }
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) {
- bool ok = TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionRequested(clientId);
- if (ok) {
- subscribersForTestSelectiveBroadcastSelective_->insert(clientId);
- TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
- success = true;
- } else {
- success = false;
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- subscribersForTestSelectiveBroadcastSelective_->erase(clientId);
- TestInterfaceDBusStubAdapterHelper::stub_->onTestSelectiveBroadcastSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
-}
-
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestSelectiveBroadcastSelective() {
- return subscribersForTestSelectiveBroadcastSelective_;
-}
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b");
-
-CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::unsubscribeFromTestBroadcastWithOutArgsSelective, "");
-
-void TestInterfaceDBusStubAdapterInternal::fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue) {
- std::shared_ptr<CommonAPI::DBus::DBusClientId> dbusClient = std::dynamic_pointer_cast<CommonAPI::DBus::DBusClientId, CommonAPI::ClientId>(_client);
-
- if(dbusClient)
- {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>
- >>::sendSignal(
- dbusClient->getDBusId(),
- *this,
- "TestBroadcastWithOutArgs",
- "us",
- _uint32Value,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment>(_stringValue, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr))
- );
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers) {
- std::shared_ptr<CommonAPI::ClientIdList> actualReceiverList = _receivers;
-
- if (!_receivers)
- actualReceiverList = subscribersForTestBroadcastWithOutArgsSelective_;
-
- for (auto clientIdIterator = actualReceiverList->cbegin(); clientIdIterator != actualReceiverList->cend(); clientIdIterator++) {
- if (!_receivers || subscribersForTestBroadcastWithOutArgsSelective_->find(*clientIdIterator) != subscribersForTestBroadcastWithOutArgsSelective_->end()) {
- fireTestBroadcastWithOutArgsSelective(*clientIdIterator, _uint32Value, _stringValue);
- }
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::subscribeForTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success) {
- bool ok = TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionRequested(clientId);
- if (ok) {
- subscribersForTestBroadcastWithOutArgsSelective_->insert(clientId);
- TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED);
- success = true;
- } else {
- success = false;
- }
-}
-
-void TestInterfaceDBusStubAdapterInternal::unsubscribeFromTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> clientId) {
- subscribersForTestBroadcastWithOutArgsSelective_->erase(clientId);
- TestInterfaceDBusStubAdapterHelper::stub_->onTestBroadcastWithOutArgsSelectiveSubscriptionChanged(clientId, CommonAPI::SelectiveBroadcastSubscriptionEvent::UNSUBSCRIBED);
-}
-
-std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInternal::getSubscribersForTestBroadcastWithOutArgsSelective() {
- return subscribersForTestBroadcastWithOutArgsSelective_;
-}
-
-
-const TestInterfaceDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& TestInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- TestInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestInterfaceStub>(_stub), false),
- stubDispatcherTable_({
- { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher }
- , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher },
- { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher }
- , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher },
- { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher }
- , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher }
- ,
- { { "testEmptyMethod", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testEmptyMethodStubDispatcher },
- { { "testVoidPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidPredefinedTypeMethodStubDispatcher },
- { { "testPredefinedTypeMethod", "us" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testPredefinedTypeMethodStubDispatcher },
- { { "testVoidDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testVoidDerivedTypeMethodStubDispatcher },
- { { "testDerivedTypeMethod", "ia{ua(sq)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testDerivedTypeMethodStubDispatcher },
- { { "TestArrayOfPolymorphicStructMethod", "a(uv)" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testArrayOfPolymorphicStructMethodStubDispatcher },
- { { "TestMapOfPolymorphicStructMethod", "a{y(uv)}" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testMapOfPolymorphicStructMethodStubDispatcher },
- { { "TestStructWithPolymorphicMemberMethod", "(u(uv))" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithPolymorphicMemberMethodStubDispatcher },
- { { "TestStructWithEnumKeyMapMember", "(a{is})" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::testStructWithEnumKeyMapMemberStubDispatcher }
- ,
- { { "subscribeForTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher }
- ,
- { { "unsubscribeFromTestSelectiveBroadcastSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher },
- { { "subscribeForTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }
- ,
- { { "unsubscribeFromTestBroadcastWithOutArgsSelective", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher }
- }),
- stubAttributeTable_() {
- subscribersForTestSelectiveBroadcastSelective_ = std::make_shared<CommonAPI::ClientIdList>();
- subscribersForTestBroadcastWithOutArgsSelective_ = std::make_shared<CommonAPI::ClientIdList>();
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool TestInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index a3e1d1b..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-#include "v1/commonapi/tests/TestInterfaceDBusDeployment.hpp"
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceStub> TestInterfaceDBusStubAdapterHelper;
-
-class TestInterfaceDBusStubAdapterInternal
- : public virtual TestInterfaceStubAdapter,
- public TestInterfaceDBusStubAdapterHelper
-{
-public:
- TestInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~TestInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return TestInterface::getInterface();
- }
-
- void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value);
- void fireTestDerivedStructAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& value);
- void fireTestDerivedArrayAttributeAttributeChanged(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& value);
-
- void fireTestPredefinedTypeBroadcastEvent(const uint32_t& uint32Value, const std::string& stringValue);
- void fireTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> _client);
- void sendTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
- void subscribeForTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId, bool& success);
- void unsubscribeFromTestSelectiveBroadcastSelective(const std::shared_ptr<CommonAPI::ClientId> clientId);
- std::shared_ptr<CommonAPI::ClientIdList> const getSubscribersForTestSelectiveBroadcastSelective();
- void fireTestBroadcastWithOutArgsSelective(const std::shared_ptr<CommonAPI::ClientId> _client, const uint32_t &_uint32Value, const std::string &_stringValue);
- void sendTestBroadcastWithOutArgsSelective(const uint32_t &_uint32Value, const std::string &_stringValue, const std::shared_ptr<CommonAPI::ClientIdList> _receivers = nullptr);
- 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();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- CommonAPI::Version
- > getTestInterfaceInterfaceVersionStubDispatcher;
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- uint32_t
- > getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- uint32_t
- > setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > setTestDerivedArrayAttributeAttributeStubDispatcher;
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > testEmptyMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<>
-
- > testVoidPredefinedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<uint32_t, std::string>,
- std::tuple<uint32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > testPredefinedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<>
-
- > testVoidDerivedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, ::commonapi::tests::DerivedTypeCollection::TestMap>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>,
- std::tuple<CommonAPI::EmptyDeployment, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t>
-
- > testDerivedTypeMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>>>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::ArrayDeployment<::commonapi::tests::DerivedTypeCollection_::TestPolymorphicStructDeployment_t>>,
- std::tuple<>
-
- > testArrayOfPolymorphicStructMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
- std::tuple<>
-
- > testMapOfPolymorphicStructMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
- std::tuple<>
-
- > testStructWithPolymorphicMemberMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
- std::tuple<>,
- std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
- std::tuple<>
-
- > testStructWithEnumKeyMapMemberStubDispatcher;
-
-
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > subscribeTestSelectiveBroadcastSelectiveStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher;
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<bool>
- > subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ::v1::commonapi::tests::TestInterfaceStub,
- TestInterfaceStubAdapter,
- std::tuple<>,
- std::tuple<>
- > unsubscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- TestInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class TestInterfaceDBusStubAdapter
- : public TestInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<TestInterfaceDBusStubAdapter> {
-public:
- TestInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- TestInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.cpp
deleted file mode 100644
index db4511e..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "TestInterfaceManagerDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestInterfaceManager_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace TestInterfaceManager_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp
deleted file mode 100644
index 01e3e12..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace TestInterfaceManager_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace TestInterfaceManager_
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.cpp
deleted file mode 100644
index 523088a..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestInterfaceManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<TestInterfaceManagerDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerTestInterfaceManagerDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- TestInterfaceManager::getInterface(),
- &createTestInterfaceManagerDBusProxy);
-}
-
-TestInterfaceManagerDBusProxy::TestInterfaceManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-, proxyManagerTestInterface_(*this, "commonapi.tests.TestInterface")
-{
-}
-
-
-
-
-CommonAPI::ProxyManager& TestInterfaceManagerDBusProxy::getProxyManagerTestInterface() {
-return proxyManagerTestInterface_;
- }
-
-void TestInterfaceManagerDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp
deleted file mode 100644
index f39b1fa..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp>
-#include "v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusProxyManager.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-class TestInterfaceManagerDBusProxy
- : virtual public TestInterfaceManagerProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- TestInterfaceManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~TestInterfaceManagerDBusProxy() { }
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerTestInterface();
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
- CommonAPI::DBus::DBusProxyManager proxyManagerTestInterface_;
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp
deleted file mode 100644
index c2b7ca2..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/TestInterfaceManager.hpp>
-#include <v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createTestInterfaceManagerDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<TestInterfaceManagerDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerTestInterfaceManagerDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- TestInterfaceManager::getInterface(), &createTestInterfaceManagerDBusStubAdapter);
-}
-
-TestInterfaceManagerDBusStubAdapterInternal::~TestInterfaceManagerDBusStubAdapterInternal() {
- deactivateManagedInstances();
- TestInterfaceManagerDBusStubAdapterHelper::deinit();
-}
-
-void TestInterfaceManagerDBusStubAdapterInternal::deactivateManagedInstances() {
- std::set<std::string>::iterator iter;
- std::set<std::string>::iterator iterNext;
-
- iter = registeredTestInterfaceInstances.begin();
- while (iter != registeredTestInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubTestInterface(*iter)) {
- iter = iterNext;
- }
- else {
- iter++;
- }
- }
-}
-
-const char* TestInterfaceManagerDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- "<method name=\"getInterfaceVersion\">\n"
- "<arg name=\"value\" type=\"uu\" direction=\"out\" />"
- "</method>\n"
-
- ""
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceManagerStub,
- CommonAPI::Version
- > TestInterfaceManagerDBusStubAdapterInternal::getTestInterfaceManagerInterfaceVersionStubDispatcher(&TestInterfaceManagerStub::getInterfaceVersion, "uu");
-
-
-
-
-
-
-
-
-const TestInterfaceManagerDBusStubAdapterHelper::StubDispatcherTable& TestInterfaceManagerDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& TestInterfaceManagerDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-bool TestInterfaceManagerDBusStubAdapterInternal::registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub> _stub, const std::string &_instance) {
- if (registeredTestInterfaceInstances.find(_instance) == registeredTestInterfaceInstances.end()) {
- std::string itsAddress = "local:commonapi.tests.TestInterface:" + _instance;
- CommonAPI::DBus::DBusAddress itsDBusAddress;
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
-
- std::string objectPath(itsDBusAddress.getObjectPath());
- std::string adapterObjectPath(getDBusAddress().getObjectPath());
-
- if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
-
- auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.TestInterface", itsDBusAddress, connection_);
- bool isRegistered = itsFactory->registerManagedService(stubAdapter);
- if (isRegistered) {
- bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
- if (isExported) {
- registeredTestInterfaceInstances.insert(_instance);
- return true;
- } else {
- itsFactory->unregisterManagedService(itsAddress);
- }
- }
- }
- }
- return false;
-}
-
-bool TestInterfaceManagerDBusStubAdapterInternal::deregisterManagedStubTestInterface(const std::string &_instance) {
- std::string itsAddress = "local:commonapi.tests.TestInterface:" + _instance;
- if (registeredTestInterfaceInstances.find(_instance) != registeredTestInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
- = itsFactory->getRegisteredService(itsAddress);
- if (stubAdapter) {
- connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
- getDBusAddress().getObjectPath(), stubAdapter);
- itsFactory->unregisterManagedService(itsAddress);
- registeredTestInterfaceInstances.erase(_instance);
- return true;
- }
- }
- return false;
-}
-
-std::set<std::string>& TestInterfaceManagerDBusStubAdapterInternal::getTestInterfaceInstances() {
- return registeredTestInterfaceInstances;
-}
-
-TestInterfaceManagerDBusStubAdapterInternal::TestInterfaceManagerDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,true),
- TestInterfaceManagerDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestInterfaceManagerStub>(_stub), true),
- stubDispatcherTable_({
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestInterfaceManagerDBusStubAdapterInternal::getTestInterfaceManagerInterfaceVersionStubDispatcher });
-}
-
-bool TestInterfaceManagerDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp
deleted file mode 100644
index 579bae9..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/TestInterfaceManagerStub.hpp>
-#include "v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusObjectManager.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<TestInterfaceManagerStub> TestInterfaceManagerDBusStubAdapterHelper;
-
-class TestInterfaceManagerDBusStubAdapterInternal
- : public virtual TestInterfaceManagerStubAdapter,
- public TestInterfaceManagerDBusStubAdapterHelper
-{
-public:
- TestInterfaceManagerDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~TestInterfaceManagerDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return TestInterfaceManager::getInterface();
- }
-
-
-
- bool registerManagedStubTestInterface(std::shared_ptr<::v1::commonapi::tests::TestInterfaceStub>, const std::string&);
- bool deregisterManagedStubTestInterface(const std::string&);
- std::set<std::string>& getTestInterfaceInstances();
-
- const TestInterfaceManagerDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::TestInterfaceManagerStub,
- CommonAPI::Version
- > getTestInterfaceManagerInterfaceVersionStubDispatcher;
-
-
-
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- std::set<std::string> registeredTestInterfaceInstances;
- TestInterfaceManagerDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class TestInterfaceManagerDBusStubAdapter
- : public TestInterfaceManagerDBusStubAdapterInternal,
- public std::enable_shared_from_this<TestInterfaceManagerDBusStubAdapter> {
-public:
- TestInterfaceManagerDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- true),
- TestInterfaceManagerDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_Test_Interface_Manager_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp
deleted file mode 100644
index 0d1717d..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "BranchInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace BranchInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace BranchInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp
deleted file mode 100644
index 8e1e77d..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace BranchInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace BranchInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
deleted file mode 100644
index 0cc455a..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createBranchInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<BranchInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerBranchInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- BranchInterface::getInterface(),
- &createBranchInterfaceDBusProxy);
-}
-
-BranchInterfaceDBusProxy::BranchInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-{
-}
-
-
-
- void BranchInterfaceDBusProxy::testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodWithReply(
- *this,
- "testBranchMethod",
- "is",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inInt, deploy_inString,
-_internalCallStatus,
-deploy_error,
-deploy_outInt, deploy_outString);
-_error = deploy_error.getValue();
-_outInt = deploy_outInt.getValue();
-_outString = deploy_outString.getValue();
-}
- std::future<CommonAPI::CallStatus> BranchInterfaceDBusProxy::testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodAsync(
- *this,
- "testBranchMethod",
- "is",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inInt, deploy_inString,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- if (_callback)
- _callback(_internalCallStatus, _deploy_error.getValue(), _outInt.getValue(), _outString.getValue());
- },
- std::make_tuple(deploy_error, deploy_outInt, deploy_outString));
- }
-
-
-void BranchInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace managed
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
deleted file mode 100644
index ff5db78..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
-#include "v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class BranchInterfaceDBusProxy
- : virtual public BranchInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- BranchInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~BranchInterfaceDBusProxy() { }
-
-
-
- virtual void testBranchMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, BranchInterface::testBranchMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index f29d7dd..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/BranchInterface.hpp>
-#include <v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createBranchInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<BranchInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerBranchInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- BranchInterface::getInterface(), &createBranchInterfaceDBusStubAdapter);
-}
-
-BranchInterfaceDBusStubAdapterInternal::~BranchInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- BranchInterfaceDBusStubAdapterHelper::deinit();
-}
-
-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=\"_error\" 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();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::BranchInterfaceStub,
- CommonAPI::Version
- > BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu");
-
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::BranchInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher(
- &BranchInterfaceStub::testBranchMethod, "iis",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment *>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
-
-
-
-
-
-const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& BranchInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& BranchInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- BranchInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<BranchInterfaceStub>(_stub), false),
- stubDispatcherTable_({
- { { "testBranchMethod", "is" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::testBranchMethodStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool BranchInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index febb27b..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include "v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<BranchInterfaceStub> BranchInterfaceDBusStubAdapterHelper;
-
-class BranchInterfaceDBusStubAdapterInternal
- : public virtual BranchInterfaceStubAdapter,
- public BranchInterfaceDBusStubAdapterHelper
-{
-public:
- BranchInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~BranchInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return BranchInterface::getInterface();
- }
-
-
-
-
- const BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::BranchInterfaceStub,
- CommonAPI::Version
- > getBranchInterfaceInterfaceVersionStubDispatcher;
-
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::BranchInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<BranchInterface::testBranchMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > testBranchMethodStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- BranchInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class BranchInterfaceDBusStubAdapter
- : public BranchInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<BranchInterfaceDBusStubAdapter> {
-public:
- BranchInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- BranchInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp
deleted file mode 100644
index cf1954e..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "LeafInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace LeafInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace LeafInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp
deleted file mode 100644
index 8af07cd..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace LeafInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace LeafInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
deleted file mode 100644
index 0f195aa..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createLeafInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<LeafInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerLeafInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- LeafInterface::getInterface(),
- &createLeafInterfaceDBusProxy);
-}
-
-LeafInterfaceDBusProxy::LeafInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-{
-}
-
-
-
- void LeafInterfaceDBusProxy::testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodWithReply(
- *this,
- "testLeafMethod",
- "is",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inInt, deploy_inString,
-_internalCallStatus,
-deploy_error,
-deploy_outInt, deploy_outString);
-_error = deploy_error.getValue();
-_outInt = deploy_outInt.getValue();
-_outString = deploy_outString.getValue();
-}
- std::future<CommonAPI::CallStatus> LeafInterfaceDBusProxy::testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodAsync(
- *this,
- "testLeafMethod",
- "is",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inInt, deploy_inString,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- if (_callback)
- _callback(_internalCallStatus, _deploy_error.getValue(), _outInt.getValue(), _outString.getValue());
- },
- std::make_tuple(deploy_error, deploy_outInt, deploy_outString));
- }
-
-
-void LeafInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace managed
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
deleted file mode 100644
index 8ae1945..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
-#include "v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class LeafInterfaceDBusProxy
- : virtual public LeafInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- LeafInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~LeafInterfaceDBusProxy() { }
-
-
-
- virtual void testLeafMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, LeafInterface::testLeafMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 7cfe184..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/LeafInterface.hpp>
-#include <v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLeafInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<LeafInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerLeafInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- LeafInterface::getInterface(), &createLeafInterfaceDBusStubAdapter);
-}
-
-LeafInterfaceDBusStubAdapterInternal::~LeafInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- LeafInterfaceDBusStubAdapterHelper::deinit();
-}
-
-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=\"_error\" 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();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::LeafInterfaceStub,
- CommonAPI::Version
- > LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu");
-
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::LeafInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher(
- &LeafInterfaceStub::testLeafMethod, "iis",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment *>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
-
-
-
-
-
-const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& LeafInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& LeafInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- LeafInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<LeafInterfaceStub>(_stub), false),
- stubDispatcherTable_({
- { { "testLeafMethod", "is" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::testLeafMethodStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool LeafInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index 996d9ee..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-#include "v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<LeafInterfaceStub> LeafInterfaceDBusStubAdapterHelper;
-
-class LeafInterfaceDBusStubAdapterInternal
- : public virtual LeafInterfaceStubAdapter,
- public LeafInterfaceDBusStubAdapterHelper
-{
-public:
- LeafInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~LeafInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return LeafInterface::getInterface();
- }
-
-
-
-
- const LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::LeafInterfaceStub,
- CommonAPI::Version
- > getLeafInterfaceInterfaceVersionStubDispatcher;
-
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::LeafInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<LeafInterface::testLeafMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > testLeafMethodStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- LeafInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class LeafInterfaceDBusStubAdapter
- : public LeafInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<LeafInterfaceDBusStubAdapter> {
-public:
- LeafInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- LeafInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp
deleted file mode 100644
index 0df6d39..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "RootInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace RootInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace RootInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp
deleted file mode 100644
index c12f214..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace RootInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace RootInterface_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
deleted file mode 100644
index e498af5..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createRootInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<RootInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerRootInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- RootInterface::getInterface(),
- &createRootInterfaceDBusProxy);
-}
-
-RootInterfaceDBusProxy::RootInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface"),
- proxyManagerBranchInterface_(*this, "commonapi.tests.managed.BranchInterface")
-{
-}
-
-
-
- void RootInterfaceDBusProxy::testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodWithReply(
- *this,
- "testRootMethod",
- "is",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_inInt, deploy_inString,
-_internalCallStatus,
-deploy_error,
-deploy_outInt, deploy_outString);
-_error = deploy_error.getValue();
-_outInt = deploy_outInt.getValue();
-_outString = deploy_outString.getValue();
-}
- std::future<CommonAPI::CallStatus> RootInterfaceDBusProxy::testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment> deploy_error(static_cast<CommonAPI::EmptyDeployment *>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_inInt(_inInt, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_inString(_inString, static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_outInt(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_outString(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >,
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>
- >
- >::callMethodAsync(
- *this,
- "testRootMethod",
- "is",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_inInt, deploy_inString,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- if (_callback)
- _callback(_internalCallStatus, _deploy_error.getValue(), _outInt.getValue(), _outString.getValue());
- },
- std::make_tuple(deploy_error, deploy_outInt, deploy_outString));
- }
-
-CommonAPI::ProxyManager& RootInterfaceDBusProxy::getProxyManagerLeafInterface() {
-return proxyManagerLeafInterface_;
- }
-CommonAPI::ProxyManager& RootInterfaceDBusProxy::getProxyManagerBranchInterface() {
-return proxyManagerBranchInterface_;
- }
-
-void RootInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace managed
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
deleted file mode 100644
index a10ede2..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
-#include "v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusProxyManager.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class RootInterfaceDBusProxy
- : virtual public RootInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- RootInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~RootInterfaceDBusProxy() { }
-
-
-
- virtual void testRootMethod(const int32_t &_inInt, const std::string &_inString, CommonAPI::CallStatus &_internalCallStatus, RootInterface::testRootMethodError &_error, int32_t &_outInt, std::string &_outString, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> testRootMethodAsync(const int32_t &_inInt, const std::string &_inString, TestRootMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
- virtual CommonAPI::ProxyManager& getProxyManagerBranchInterface();
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
- CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
- CommonAPI::DBus::DBusProxyManager proxyManagerBranchInterface_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 956c206..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/RootInterface.hpp>
-#include <v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createRootInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<RootInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerRootInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- RootInterface::getInterface(), &createRootInterfaceDBusStubAdapter);
-}
-
-RootInterfaceDBusStubAdapterInternal::~RootInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- RootInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void RootInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
- std::set<std::string>::iterator iter;
- std::set<std::string>::iterator iterNext;
-
- iter = registeredLeafInterfaceInstances.begin();
- while (iter != registeredLeafInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubLeafInterface(*iter)) {
- iter = iterNext;
- }
- else {
- iter++;
- }
- }
- iter = registeredBranchInterfaceInstances.begin();
- while (iter != registeredBranchInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubBranchInterface(*iter)) {
- iter = iterNext;
- }
- else {
- 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=\"_error\" 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();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::RootInterfaceStub,
- CommonAPI::Version
- > RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu");
-
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::RootInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<RootInterface::testRootMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher(
- &RootInterfaceStub::testRootMethod, "iis",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment *>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
-
-
-
-
-
-const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& RootInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub, const std::string &_instance) {
- if (registeredLeafInterfaceInstances.find(_instance) == registeredLeafInterfaceInstances.end()) {
- std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
- CommonAPI::DBus::DBusAddress itsDBusAddress;
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
-
- std::string objectPath(itsDBusAddress.getObjectPath());
- std::string adapterObjectPath(getDBusAddress().getObjectPath());
-
- if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
-
- auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.LeafInterface", itsDBusAddress, connection_);
- bool isRegistered = itsFactory->registerManagedService(stubAdapter);
- if (isRegistered) {
- bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
- if (isExported) {
- registeredLeafInterfaceInstances.insert(_instance);
- return true;
- } else {
- itsFactory->unregisterManagedService(itsAddress);
- }
- }
- }
- }
- return false;
-}
-
-bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string &_instance) {
- std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
- if (registeredLeafInterfaceInstances.find(_instance) != registeredLeafInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
- = itsFactory->getRegisteredService(itsAddress);
- if (stubAdapter) {
- connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
- getDBusAddress().getObjectPath(), stubAdapter);
- itsFactory->unregisterManagedService(itsAddress);
- registeredLeafInterfaceInstances.erase(_instance);
- return true;
- }
- }
- return false;
-}
-
-std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() {
- return registeredLeafInterfaceInstances;
-}
-bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub> _stub, const std::string &_instance) {
- if (registeredBranchInterfaceInstances.find(_instance) == registeredBranchInterfaceInstances.end()) {
- std::string itsAddress = "local:commonapi.tests.managed.BranchInterface:" + _instance;
- CommonAPI::DBus::DBusAddress itsDBusAddress;
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
-
- std::string objectPath(itsDBusAddress.getObjectPath());
- std::string adapterObjectPath(getDBusAddress().getObjectPath());
-
- if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
-
- auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.BranchInterface", itsDBusAddress, connection_);
- bool isRegistered = itsFactory->registerManagedService(stubAdapter);
- if (isRegistered) {
- bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
- if (isExported) {
- registeredBranchInterfaceInstances.insert(_instance);
- return true;
- } else {
- itsFactory->unregisterManagedService(itsAddress);
- }
- }
- }
- }
- return false;
-}
-
-bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubBranchInterface(const std::string &_instance) {
- std::string itsAddress = "local:commonapi.tests.managed.BranchInterface:" + _instance;
- if (registeredBranchInterfaceInstances.find(_instance) != registeredBranchInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
- = itsFactory->getRegisteredService(itsAddress);
- if (stubAdapter) {
- connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
- getDBusAddress().getObjectPath(), stubAdapter);
- itsFactory->unregisterManagedService(itsAddress);
- registeredBranchInterfaceInstances.erase(_instance);
- return true;
- }
- }
- return false;
-}
-
-std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getBranchInterfaceInstances() {
- return registeredBranchInterfaceInstances;
-}
-
-RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,true),
- RootInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<RootInterfaceStub>(_stub), true),
- stubDispatcherTable_({
- { { "testRootMethod", "is" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::testRootMethodStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool RootInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index b09573a..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/managed/RootInterfaceStub.hpp>
-#include "v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusObjectManager.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<RootInterfaceStub> RootInterfaceDBusStubAdapterHelper;
-
-class RootInterfaceDBusStubAdapterInternal
- : public virtual RootInterfaceStubAdapter,
- public RootInterfaceDBusStubAdapterHelper
-{
-public:
- RootInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~RootInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return RootInterface::getInterface();
- }
-
-
-
- bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>, const std::string&);
- bool deregisterManagedStubLeafInterface(const std::string&);
- std::set<std::string>& getLeafInterfaceInstances();
- bool registerManagedStubBranchInterface(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub>, const std::string&);
- bool deregisterManagedStubBranchInterface(const std::string&);
- std::set<std::string>& getBranchInterfaceInstances();
-
- const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::RootInterfaceStub,
- CommonAPI::Version
- > getRootInterfaceInterfaceVersionStubDispatcher;
-
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::commonapi::tests::managed::RootInterfaceStub,
- std::tuple<int32_t, std::string>,
- std::tuple<RootInterface::testRootMethodError, int32_t, std::string>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>
-
- > testRootMethodStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- std::set<std::string> registeredLeafInterfaceInstances;
- std::set<std::string> registeredBranchInterfaceInstances;
- RootInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class RootInterfaceDBusStubAdapter
- : public RootInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<RootInterfaceDBusStubAdapter> {
-public:
- RootInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- true),
- RootInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp
deleted file mode 100644
index 9586b10..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "SecondRootDBusDeployment.hpp"
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace SecondRoot_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace SecondRoot_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp
deleted file mode 100644
index f7f1ac5..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_DEPLOYMENT_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-namespace SecondRoot_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace SecondRoot_
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp
deleted file mode 100644
index d5c8df1..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/SecondRootDBusProxy.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<SecondRootDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerSecondRootDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- SecondRoot::getInterface(),
- &createSecondRootDBusProxy);
-}
-
-SecondRootDBusProxy::SecondRootDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-, proxyManagerLeafInterface_(*this, "commonapi.tests.managed.LeafInterface")
-{
-}
-
-
-
-
-CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() {
-return proxyManagerLeafInterface_;
- }
-
-void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace managed
- } // namespace tests
- } // namespace commonapi
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp
deleted file mode 100644
index a84fce2..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
-
-#include <v1/commonapi/tests/managed/SecondRootProxyBase.hpp>
-#include "v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusProxyManager.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-class SecondRootDBusProxy
- : virtual public SecondRootProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- SecondRootDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~SecondRootDBusProxy() { }
-
-
-
-
- virtual CommonAPI::ProxyManager& getProxyManagerLeafInterface();
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
- CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
deleted file mode 100644
index 58d33f3..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/commonapi/tests/managed/SecondRoot.hpp>
-#include <v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createSecondRootDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<SecondRootDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerSecondRootDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- SecondRoot::getInterface(), &createSecondRootDBusStubAdapter);
-}
-
-SecondRootDBusStubAdapterInternal::~SecondRootDBusStubAdapterInternal() {
- deactivateManagedInstances();
- SecondRootDBusStubAdapterHelper::deinit();
-}
-
-void SecondRootDBusStubAdapterInternal::deactivateManagedInstances() {
- std::set<std::string>::iterator iter;
- std::set<std::string>::iterator iterNext;
-
- iter = registeredLeafInterfaceInstances.begin();
- while (iter != registeredLeafInterfaceInstances.end()) {
- iterNext = std::next(iter);
-
- if (deregisterManagedStubLeafInterface(*iter)) {
- iter = iterNext;
- }
- else {
- 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();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::SecondRootStub,
- CommonAPI::Version
- > SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu");
-
-
-
-
-
-
-
-
-const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& SecondRootDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub> _stub, const std::string &_instance) {
- if (registeredLeafInterfaceInstances.find(_instance) == registeredLeafInterfaceInstances.end()) {
- std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
- CommonAPI::DBus::DBusAddress itsDBusAddress;
- CommonAPI::DBus::DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
-
- std::string objectPath(itsDBusAddress.getObjectPath());
- std::string adapterObjectPath(getDBusAddress().getObjectPath());
-
- if (objectPath.compare(0, adapterObjectPath.length(), adapterObjectPath) == 0) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
-
- auto stubAdapter = itsFactory->createDBusStubAdapter(_stub, "commonapi.tests.managed.LeafInterface", itsDBusAddress, connection_);
- bool isRegistered = itsFactory->registerManagedService(stubAdapter);
- if (isRegistered) {
- bool isExported = connection_->getDBusObjectManager()->exportManagedDBusStubAdapter(adapterObjectPath, stubAdapter);
- if (isExported) {
- registeredLeafInterfaceInstances.insert(_instance);
- return true;
- } else {
- itsFactory->unregisterManagedService(itsAddress);
- }
- }
- }
- }
- return false;
-}
-
-bool SecondRootDBusStubAdapterInternal::deregisterManagedStubLeafInterface(const std::string &_instance) {
- std::string itsAddress = "local:commonapi.tests.managed.LeafInterface:" + _instance;
- if (registeredLeafInterfaceInstances.find(_instance) != registeredLeafInterfaceInstances.end()) {
- std::shared_ptr<CommonAPI::DBus::Factory> itsFactory = CommonAPI::DBus::Factory::get();
- std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> stubAdapter
- = itsFactory->getRegisteredService(itsAddress);
- if (stubAdapter) {
- connection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(
- getDBusAddress().getObjectPath(), stubAdapter);
- itsFactory->unregisterManagedService(itsAddress);
- registeredLeafInterfaceInstances.erase(_instance);
- return true;
- }
- }
- return false;
-}
-
-std::set<std::string>& SecondRootDBusStubAdapterInternal::getLeafInterfaceInstances() {
- return registeredLeafInterfaceInstances;
-}
-
-SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,true),
- SecondRootDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<SecondRootStub>(_stub), true),
- stubDispatcherTable_({
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher });
-}
-
-bool SecondRootDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
deleted file mode 100644
index d0bdeed..0000000
--- a/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
-#define V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/commonapi/tests/managed/SecondRootStub.hpp>
-#include "v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusObjectManager.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace commonapi {
-namespace tests {
-namespace managed {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<SecondRootStub> SecondRootDBusStubAdapterHelper;
-
-class SecondRootDBusStubAdapterInternal
- : public virtual SecondRootStubAdapter,
- public SecondRootDBusStubAdapterHelper
-{
-public:
- SecondRootDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~SecondRootDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return SecondRoot::getInterface();
- }
-
-
-
- bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>, const std::string&);
- bool deregisterManagedStubLeafInterface(const std::string&);
- std::set<std::string>& getLeafInterfaceInstances();
-
- const SecondRootDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::commonapi::tests::managed::SecondRootStub,
- CommonAPI::Version
- > getSecondRootInterfaceVersionStubDispatcher;
-
-
-
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- std::set<std::string> registeredLeafInterfaceInstances;
- SecondRootDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class SecondRootDBusStubAdapter
- : public SecondRootDBusStubAdapterInternal,
- public std::enable_shared_from_this<SecondRootDBusStubAdapter> {
-public:
- SecondRootDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- true),
- SecondRootDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1
-
-#endif // V1_COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp
deleted file mode 100644
index 8ed45be..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "LegacyInterfaceDBusDeployment.hpp"
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-namespace LegacyInterface_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace LegacyInterface_
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp
deleted file mode 100644
index 0d84e65..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_DEPLOYMENT_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-namespace LegacyInterface_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace LegacyInterface_
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
deleted file mode 100644
index 3f731dd..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createLegacyInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<LegacyInterfaceDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerLegacyInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- LegacyInterface::getInterface(),
- &createLegacyInterfaceDBusProxy);
-}
-
-LegacyInterfaceDBusProxy::LegacyInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection)
-{
-}
-
-
-
- void LegacyInterfaceDBusProxy::TestMethod(const int32_t &_input, CommonAPI::CallStatus &_internalCallStatus, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_input(_input, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_val1(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_val2(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>
- >
- >::callMethodWithReply(
- *this,
- "TestMethod",
- "i",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-deploy_input,
-_internalCallStatus,
-deploy_val1, deploy_val2);
-_val1 = deploy_val1.getValue();
-_val2 = deploy_val2.getValue();
-}
- std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_input(_input, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_val1(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_val2(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment >
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>
- >
- >::callMethodAsync(
- *this,
- "TestMethod",
- "i",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- deploy_input,
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _val1, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _val2) {
- if (_callback)
- _callback(_internalCallStatus, _val1.getValue(), _val2.getValue());
- },
- std::make_tuple(deploy_val1, deploy_val2));
- }
- void LegacyInterfaceDBusProxy::OtherTestMethod(CommonAPI::CallStatus &_internalCallStatus, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_greeting(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_identifier(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>
- >
- >::callMethodWithReply(
- *this,
- "OtherTestMethod",
- "",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-_internalCallStatus,
-deploy_greeting, deploy_identifier);
-_greeting = deploy_greeting.getValue();
-_identifier = deploy_identifier.getValue();
-}
- std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> deploy_greeting(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr));
- CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> deploy_identifier(static_cast<CommonAPI::EmptyDeployment*>(nullptr));
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- CommonAPI::Deployable<std::string,CommonAPI::DBus::StringDeployment>,
- CommonAPI::Deployable<int32_t,CommonAPI::EmptyDeployment>
- >
- >::callMethodAsync(
- *this,
- "OtherTestMethod",
- "",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- [_callback] (CommonAPI::CallStatus _internalCallStatus, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _greeting, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _identifier) {
- if (_callback)
- _callback(_internalCallStatus, _greeting.getValue(), _identifier.getValue());
- },
- std::make_tuple(deploy_greeting, deploy_identifier));
- }
- void LegacyInterfaceDBusProxy::finish(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info) {
- CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodWithReply(
- *this,
- "finish",
- "",
-(_info ? _info : &CommonAPI::DBus::defaultCallInfo),
-_internalCallStatus);
-}
- std::future<CommonAPI::CallStatus> LegacyInterfaceDBusProxy::finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<
- >,
- CommonAPI::DBus::DBusSerializableArguments<
- >
- >::callMethodAsync(
- *this,
- "finish",
- "",
- (_info ? _info : &CommonAPI::DBus::defaultCallInfo),
- [_callback] (CommonAPI::CallStatus _internalCallStatus) {
- if (_callback)
- _callback(_internalCallStatus);
- },
- std::make_tuple());
- }
-
-
-void LegacyInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace service
- } // namespace legacy
- } // namespace fake
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
deleted file mode 100644
index 2978fbc..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
-#include "v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceDBusProxy
- : virtual public LegacyInterfaceProxyBase,
- virtual public CommonAPI::DBus::DBusProxy {
-public:
- LegacyInterfaceDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~LegacyInterfaceDBusProxy() { }
-
-
-
- virtual void TestMethod(const int32_t &_input, CommonAPI::CallStatus &_internalCallStatus, int32_t &_val1, int32_t &_val2, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void OtherTestMethod(CommonAPI::CallStatus &_internalCallStatus, std::string &_greeting, int32_t &_identifier, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback, const CommonAPI::CallInfo *_info);
- virtual void finish(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info);
- virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback, const CommonAPI::CallInfo *_info);
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index ed34480..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterface.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLegacyInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<LegacyInterfaceDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerLegacyInterfaceDBusStubAdapter) {
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- LegacyInterface::getInterface(), &createLegacyInterfaceDBusStubAdapter);
-}
-
-LegacyInterfaceDBusStubAdapterInternal::~LegacyInterfaceDBusStubAdapterInternal() {
- deactivateManagedInstances();
- LegacyInterfaceDBusStubAdapterHelper::deinit();
-}
-
-void LegacyInterfaceDBusStubAdapterInternal::deactivateManagedInstances() {
-
-}
-
-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"
- "<arg name=\"_val2\" type=\"i\" direction=\"out\" />\n"
- "</method>\n"
- "<method name=\"OtherTestMethod\">\n"
- "<arg name=\"_greeting\" type=\"s\" direction=\"out\" />\n"
- "<arg name=\"_identifier\" type=\"i\" direction=\"out\" />\n"
- "</method>\n"
- "<method name=\"finish\">\n"
- "</method>\n"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- CommonAPI::Version
- > LegacyInterfaceDBusStubAdapterInternal::getLegacyInterfaceInterfaceVersionStubDispatcher(&LegacyInterfaceStub::getInterfaceVersion, "uu");
-
-
-
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<int32_t>,
- std::tuple<int32_t, int32_t>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>
-
- > LegacyInterfaceDBusStubAdapterInternal::testMethodStubDispatcher(
- &LegacyInterfaceStub::TestMethod, "ii",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<>,
- std::tuple<std::string, int32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::StringDeployment, CommonAPI::EmptyDeployment>
-
- > LegacyInterfaceDBusStubAdapterInternal::otherTestMethodStubDispatcher(
- &LegacyInterfaceStub::OtherTestMethod, "si",
- std::make_tuple(),
- std::make_tuple(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > LegacyInterfaceDBusStubAdapterInternal::finishStubDispatcher(
- &LegacyInterfaceStub::finish, "",
- std::make_tuple(),
- std::make_tuple());
-
-
-
-
-
-const LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable& LegacyInterfaceDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& LegacyInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-LegacyInterfaceDBusStubAdapterInternal::LegacyInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- LegacyInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<LegacyInterfaceStub>(_stub), false),
- stubDispatcherTable_({
- { { "TestMethod", "i" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::testMethodStubDispatcher },
- { { "OtherTestMethod", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::otherTestMethodStubDispatcher },
- { { "finish", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::finishStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::getLegacyInterfaceInterfaceVersionStubDispatcher });
-}
-
-bool LegacyInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
deleted file mode 100644
index 1010478..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceStub.hpp>
-#include "v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<LegacyInterfaceStub> LegacyInterfaceDBusStubAdapterHelper;
-
-class LegacyInterfaceDBusStubAdapterInternal
- : public virtual LegacyInterfaceStubAdapter,
- public LegacyInterfaceDBusStubAdapterHelper
-{
-public:
- LegacyInterfaceDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~LegacyInterfaceDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return LegacyInterface::getInterface();
- }
-
-
-
-
- const LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- CommonAPI::Version
- > getLegacyInterfaceInterfaceVersionStubDispatcher;
-
-
-
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<int32_t>,
- std::tuple<int32_t, int32_t>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>
-
- > testMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<>,
- std::tuple<std::string, int32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::StringDeployment, CommonAPI::EmptyDeployment>
-
- > otherTestMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > finishStubDispatcher;
-
-
-
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- LegacyInterfaceDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class LegacyInterfaceDBusStubAdapter
- : public LegacyInterfaceDBusStubAdapterInternal,
- public std::enable_shared_from_this<LegacyInterfaceDBusStubAdapter> {
-public:
- LegacyInterfaceDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- LegacyInterfaceDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.cpp
deleted file mode 100644
index 9253afc..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 "LegacyInterfaceNoObjectManagerDBusDeployment.hpp"
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-namespace LegacyInterfaceNoObjectManager_ {
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-} // namespace LegacyInterfaceNoObjectManager_
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp
deleted file mode 100644
index 58cb658..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_DEPLOYMENT_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_DEPLOYMENT_HPP_
-
-
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-namespace LegacyInterfaceNoObjectManager_ {
-
-// Interface-specific deployment types
-
-// Type-specific deployments
-
-// Attribute-specific deployments
-
-// Argument-specific deployments
-
-// Broadcast-specific deployments
-
-
-} // namespace LegacyInterfaceNoObjectManager_
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.cpp
deleted file mode 100644
index 2098d31..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.hpp>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-std::shared_ptr<CommonAPI::DBus::DBusProxy> createLegacyInterfaceNoObjectManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection) {
- return std::make_shared<LegacyInterfaceNoObjectManagerDBusProxy>(_address, _connection);
-}
-
-INITIALIZER(registerLegacyInterfaceNoObjectManagerDBusProxy) {
- CommonAPI::DBus::DBusAddressTranslator::get()->insert(
- "local:fake.legacy.service.LegacyInterfaceNoObjectManager:fake.legacy.service.LegacyInterfaceNoObjectManager",
- "",
- "",
- "");
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
- LegacyInterfaceNoObjectManager::getInterface(),
- &createLegacyInterfaceNoObjectManagerDBusProxy);
-}
-
-LegacyInterfaceNoObjectManagerDBusProxy::LegacyInterfaceNoObjectManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
- : CommonAPI::DBus::DBusProxy(_address, _connection),
- LegacyInterfaceDBusProxy(_address, _connection)
-{
- CommonAPI::DBus::DBusServiceRegistry::get(_connection)->setDBusServicePredefined(_address.getService());
-}
-
-
-
-
-
-void LegacyInterfaceNoObjectManagerDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace service
- } // namespace legacy
- } // namespace fake
- } // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.hpp
deleted file mode 100644
index 8968f71..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusProxy.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_PROXY_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_PROXY_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerProxyBase.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp>
-#include "v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddress.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusProxy.hpp>
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-#include <string>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-class LegacyInterfaceNoObjectManagerDBusProxy
- : virtual public LegacyInterfaceNoObjectManagerProxyBase,
- virtual public LegacyInterfaceDBusProxy {
-public:
- LegacyInterfaceNoObjectManagerDBusProxy(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection);
-
- virtual ~LegacyInterfaceNoObjectManagerDBusProxy() { }
-
-
-
-
-
- virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
-
-private:
-
-
-
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_PROXY_HPP_
-
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.cpp
deleted file mode 100644
index 0eb82b0..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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 <v1/fake/legacy/service/LegacyInterfaceNoObjectManager.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.hpp>
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-std::shared_ptr<CommonAPI::DBus::DBusStubAdapter> createLegacyInterfaceNoObjectManagerDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub) {
- return std::make_shared<LegacyInterfaceNoObjectManagerDBusStubAdapter>(_address, _connection, _stub);
-}
-
-INITIALIZER(registerLegacyInterfaceNoObjectManagerDBusStubAdapter) {
- CommonAPI::DBus::DBusAddressTranslator::get()->insert(
- "local:fake.legacy.service.LegacyInterfaceNoObjectManager:fake.legacy.service.LegacyInterfaceNoObjectManager",
- "",
- "",
- "");
- CommonAPI::DBus::Factory::get()->registerStubAdapterCreateMethod(
- LegacyInterfaceNoObjectManager::getInterface(), &createLegacyInterfaceNoObjectManagerDBusStubAdapter);
-}
-
-LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::~LegacyInterfaceNoObjectManagerDBusStubAdapterInternal() {
- deactivateManagedInstances();
- LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::deinit();
-}
-
-void LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::deactivateManagedInstances() {
-
-}
-
-const char* LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
- static const std::string introspectionData =
- std::string(LegacyInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) +
-
- ""
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- CommonAPI::Version
- > LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getLegacyInterfaceNoObjectManagerInterfaceVersionStubDispatcher(&LegacyInterfaceNoObjectManagerStub::getInterfaceVersion, "uu");
-
-
-#ifdef WIN32
-#endif
-
-
-#ifdef WIN32
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<int32_t>,
- std::tuple<int32_t, int32_t>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>
-
- > LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::testMethodStubDispatcher(
- &LegacyInterfaceNoObjectManagerStub::TestMethod, "ii",
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<>,
- std::tuple<std::string, int32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::StringDeployment, CommonAPI::EmptyDeployment>
-
- > LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::otherTestMethodStubDispatcher(
- &LegacyInterfaceNoObjectManagerStub::OtherTestMethod, "si",
- std::make_tuple(),
- std::make_tuple(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
-
-CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::finishStubDispatcher(
- &LegacyInterfaceNoObjectManagerStub::finish, "",
- std::make_tuple(),
- std::make_tuple());
-#endif
-
-
-
-#ifdef WIN32
-#endif
-
-const LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::StubDispatcherTable& LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getStubDispatcherTable() {
- return stubDispatcherTable_;
-}
-
-const CommonAPI::DBus::StubAttributeTable& LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getStubAttributeTable() {
- return stubAttributeTable_;
-}
-
-LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(_address, _connection,false),
- LegacyInterfaceNoObjectManagerDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<LegacyInterfaceNoObjectManagerStub>(_stub), false),
- LegacyInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
- stubDispatcherTable_({
- #ifdef WIN32
- { { "TestMethod", "i" }, &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::testMethodStubDispatcher },
- { { "OtherTestMethod", "" }, &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::otherTestMethodStubDispatcher },
- { { "finish", "" }, &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::finishStubDispatcher }
- #endif
- }),
- stubAttributeTable_() {
-
- #ifdef WIN32
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getLegacyInterfaceNoObjectManagerInterfaceVersionStubDispatcher });
- #else
- auto parentDispatcherTable = LegacyInterfaceDBusStubAdapterInternal::getStubDispatcherTable();
- stubDispatcherTable_.insert(parentDispatcherTable.begin(), parentDispatcherTable.end());
-
- auto interfaceVersionGetter = stubDispatcherTable_.find({ "getInterfaceVersion", "" });
- if(interfaceVersionGetter != stubDispatcherTable_.end()) {
- interfaceVersionGetter->second = &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getLegacyInterfaceNoObjectManagerInterfaceVersionStubDispatcher;
- } else {
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::getLegacyInterfaceNoObjectManagerInterfaceVersionStubDispatcher });
- }
-
- auto parentAttributeTable = LegacyInterfaceDBusStubAdapterInternal::getStubAttributeTable();
- stubAttributeTable_.insert(parentAttributeTable.begin(), parentAttributeTable.end());
-
- #endif
-}
-
-bool LegacyInterfaceNoObjectManagerDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
diff --git a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.hpp
deleted file mode 100644
index 9c6fd92..0000000
--- a/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusStubAdapter.hpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.dbus 3.1.5.v201512091037.
-* Used org.franca.core 0.9.1.201412191134.
-*
-* 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/.
-*/
-#ifndef V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_STUB_ADAPTER_HPP_
-#define V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_STUB_ADAPTER_HPP_
-
-#include <v1/fake/legacy/service/LegacyInterfaceNoObjectManagerStub.hpp>
-#include <v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp>
-#include "v1/fake/legacy/service/LegacyInterfaceNoObjectManagerDBusDeployment.hpp"
-
-#if !defined (COMMONAPI_INTERNAL_COMPILATION)
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
-#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <CommonAPI/DBus/DBusStubAdapterHelper.hpp>
-#include <CommonAPI/DBus/DBusStubAdapter.hpp>
-#include <CommonAPI/DBus/DBusDeployment.hpp>
-
-#undef COMMONAPI_INTERNAL_COMPILATION
-
-namespace v1 {
-namespace fake {
-namespace legacy {
-namespace service {
-
-typedef CommonAPI::DBus::DBusStubAdapterHelper<LegacyInterfaceNoObjectManagerStub> LegacyInterfaceNoObjectManagerDBusStubAdapterHelper;
-
-class LegacyInterfaceNoObjectManagerDBusStubAdapterInternal
- : public virtual LegacyInterfaceNoObjectManagerStubAdapter,
- public LegacyInterfaceNoObjectManagerDBusStubAdapterHelper,
- public LegacyInterfaceDBusStubAdapterInternal
-{
-public:
- LegacyInterfaceNoObjectManagerDBusStubAdapterInternal(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub);
-
- ~LegacyInterfaceNoObjectManagerDBusStubAdapterInternal();
-
- virtual bool hasFreedesktopProperties();
-
- inline static const char* getInterface() {
- return LegacyInterfaceNoObjectManager::getInterface();
- }
-
-
-
-
- const LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::StubDispatcherTable& getStubDispatcherTable();
- const CommonAPI::DBus::StubAttributeTable& getStubAttributeTable();
-
- void deactivateManagedInstances();
-
- virtual const CommonAPI::Address &getAddress() const {
- return DBusStubAdapter::getAddress();
- }
-
- virtual void init(std::shared_ptr<DBusStubAdapter> instance) {
- return LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::init(instance);
- }
-
- virtual void deinit() {
- return LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::deinit();
- }
-
- virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::onInterfaceDBusMessage(dbusMessage);
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::onInterfaceDBusFreedesktopPropertiesMessage(dbusMessage);
- }
-
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- CommonAPI::Version
- > getLegacyInterfaceNoObjectManagerInterfaceVersionStubDispatcher;
-
-
-#ifdef WIN32
-#endif
-
-
-#ifdef WIN32
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<int32_t>,
- std::tuple<int32_t, int32_t>,
- std::tuple<CommonAPI::EmptyDeployment>,
- std::tuple<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>
-
- > testMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<>,
- std::tuple<std::string, int32_t>,
- std::tuple<>,
- std::tuple<CommonAPI::DBus::StringDeployment, CommonAPI::EmptyDeployment>
-
- > otherTestMethodStubDispatcher;
-
-static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ::v1::fake::legacy::service::LegacyInterfaceNoObjectManagerStub,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>,
- std::tuple<>
-
- > finishStubDispatcher;
-#endif
-
-
-#ifdef WIN32
-#endif
-
- protected:
- virtual const char* getMethodsDBusIntrospectionXmlData() const;
-
- private:
- LegacyInterfaceNoObjectManagerDBusStubAdapterHelper::StubDispatcherTable stubDispatcherTable_;
- CommonAPI::DBus::StubAttributeTable stubAttributeTable_;
-};
-
-class LegacyInterfaceNoObjectManagerDBusStubAdapter
- : public LegacyInterfaceNoObjectManagerDBusStubAdapterInternal,
- public std::enable_shared_from_this<LegacyInterfaceNoObjectManagerDBusStubAdapter> {
-public:
- LegacyInterfaceNoObjectManagerDBusStubAdapter(
- const CommonAPI::DBus::DBusAddress &_address,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection,
- const std::shared_ptr<CommonAPI::StubBase> &_stub)
- : CommonAPI::DBus::DBusStubAdapter(
- _address,
- _connection,
- false),
- LegacyInterfaceNoObjectManagerDBusStubAdapterInternal(
- _address,
- _connection,
- _stub) {
- }
-};
-
-} // namespace service
-} // namespace legacy
-} // namespace fake
-} // namespace v1
-
-#endif // V1_FAKE_LEGACY_SERVICE_Legacy_Interface_No_Object_Manager_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/test-derived-types.fidl b/src/test/test-derived-types.fidl
deleted file mode 100644
index 9add653..0000000
--- a/src/test/test-derived-types.fidl
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests
-
-import commonapi.tests.* from "test-predefined-types.fidl"
-
-typeCollection DerivedTypeCollection {
-
- map TestMap { UInt32 to TestArrayTestStruct }
-
- struct TestStructExtended extends TestStruct {
- TestEnumExtended2 testEnumExtended2
- }
-
- map TestEnumMap { TestEnum to String }
-
- <** @description : Common errors. **>
- enumeration TestEnum {
- <** @description : default **>
- E_UNKNOWN = "0x00"
- <** @description : no error - positive reply **>
- E_OK = "0x01"
- <** @description : value out of range **>
- E_OUT_OF_RANGE = "0x02"
- <** @description : not used **>
- E_NOT_USED = "0x03"
- }
-
- array TestArrayTestStruct of TestStruct
-
- enumeration TestEnumExtended2 extends TestEnumExtended {
- <** @description : new error **>
- E_NEW2 = "0x05"
- }
-
- enumeration TestEnumMissingValue {
- <** @description : default **>
- E1 = "A"
- E2
- E3 = "2"
- }
-
- enumeration TestEnumExtended extends TestEnum {
- <** @description : new error **>
- E_NEW = "0x04"
- }
-
- array TestArrayUInt64 of UInt64
-
- struct TestStruct {
- <** @description : the name of the property **>
- PredefinedTypeCollection.TestString testString
-
- <** @description : the actual value **>
- UInt16 uintValue
- }
-
- struct TestPolymorphicStruct polymorphic {
- <** @description : the name of the property **>
- PredefinedTypeCollection.TestString testString
-
- <** @description : the actual value **>
- UInt16 uintValue
- }
-
- struct TestExtendedPolymorphicStruct extends TestPolymorphicStruct {
- UInt32 additionalValue
- }
-
- map MapIntToPolymorphic { UInt8 to DerivedTypeCollection.TestPolymorphicStruct }
-
- struct StructWithPolymorphicMember {
- UInt32 numberValue
- DerivedTypeCollection.TestPolymorphicStruct polymorphicMember
- }
-
- struct StructWithEnumKeyMap {
- TestEnumMap testMap
- }
-
-}
-
-
diff --git a/src/test/test-freedesktop-interface.fdepl b/src/test/test-freedesktop-interface.fdepl
deleted file mode 100644
index cd2479a..0000000
--- a/src/test/test-freedesktop-interface.fdepl
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-import "platform:/plugin/org.genivi.commonapi.dbus/deployment/CommonAPI-DBus_deployment_spec.fdepl"
-import "test-freedesktop-interface.fidl"
-
-
-define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopInterface {
- DBusDefaultAttributeType = freedesktop
-}
-
-define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopDerivedInterface {
- DBusDefaultAttributeType = freedesktop
-}
diff --git a/src/test/test-freedesktop-interface.fidl b/src/test/test-freedesktop-interface.fidl
deleted file mode 100644
index 0131526..0000000
--- a/src/test/test-freedesktop-interface.fidl
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests
-
-import commonapi.tests.* from "test-derived-types.fidl"
-
-interface TestFreedesktopInterface {
- version { major 1 minor 0 }
-
- attribute UInt32 TestPredefinedTypeAttribute
- attribute UInt32 TestReadonlyAttribute readonly
- attribute DerivedTypeCollection.TestStructExtended TestDerivedStructAttribute
- attribute DerivedTypeCollection.TestArrayUInt64 TestDerivedArrayAttribute
-}
-
-interface TestFreedesktopDerivedInterface extends TestFreedesktopInterface {
- version { major 1 minor 0 }
-
- attribute UInt32 TestAttributedFromDerivedInterface
-} \ No newline at end of file
diff --git a/src/test/test-interface-proxy.fidl b/src/test/test-interface-proxy.fidl
deleted file mode 100644
index 3f12dec..0000000
--- a/src/test/test-interface-proxy.fidl
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests
-
-import commonapi.tests.* from "test-derived-types.fidl"
-
-interface TestInterface {
- version { major 1 minor 0 }
-
- attribute UInt32 TestPredefinedTypeAttribute
- attribute DerivedTypeCollection.TestStructExtended TestDerivedStructAttribute
- attribute DerivedTypeCollection.TestArrayUInt64 TestDerivedArrayAttribute
-
- method testEmptyMethod {
- }
-
- method testVoidPredefinedTypeMethod {
- in {
- UInt32 uint32Value
- String stringValue
- }
- }
-
- method testPredefinedTypeMethod {
- in {
- UInt32 uint32InValue
- String stringInValue
- }
- out {
- UInt32 uint32OutValue
- String stringOutValue
- }
- }
-
- method testVoidDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2Value
- DerivedTypeCollection.TestMap testMapValue
- }
- }
-
- method testDerivedTypeMethod {
- in {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2InValue
- DerivedTypeCollection.TestMap testMapInValue
- }
- out {
- DerivedTypeCollection.TestEnumExtended2 testEnumExtended2OutValue
- DerivedTypeCollection.TestMap testMapOutValue
- }
- }
-
- method TestArrayOfPolymorphicStructMethod {
- in {
- DerivedTypeCollection.TestPolymorphicStruct [] inArray
- }
- }
-
- method TestMapOfPolymorphicStructMethod {
- in {
- DerivedTypeCollection.MapIntToPolymorphic inMap
- }
- }
-
- method TestStructWithPolymorphicMemberMethod {
- in {
- DerivedTypeCollection.StructWithPolymorphicMember inStruct
- }
- }
-
- method TestStructWithEnumKeyMapMember {
- in {
- DerivedTypeCollection.StructWithEnumKeyMap inStruct
- }
- }
-
-
- broadcast TestPredefinedTypeBroadcast {
- out {
- UInt32 uint32Value
- String stringValue
- }
- }
-
- broadcast TestSelectiveBroadcast selective {
- }
-
- broadcast TestBroadcastWithOutArgs selective {
- out {
- UInt32 uint32Value
- String stringValue
- }
- }
-}
-
-interface ExtendedInterface extends TestInterface {
- version { major 1 minor 0 }
-
- method TestIntMethodExtended {
- in {
- UInt32 inInt
- }
- }
-}
-
-interface TestInterfaceManager manages TestInterface {
- version { major 1 minor 0 }
-}
diff --git a/src/test/test-predefined-types.fidl b/src/test/test-predefined-types.fidl
deleted file mode 100644
index d7893d2..0000000
--- a/src/test/test-predefined-types.fidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2013-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
-// 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/.
-
-package commonapi.tests
-
-typeCollection PredefinedTypeCollection {
- typedef TestUInt8 is UInt8
- typedef TestUInt16 is UInt16
- typedef TestUInt32 is UInt32
- typedef TestUInt64 is UInt64
- typedef TestInt8 is Int8
- typedef TestInt16 is Int16
- typedef TestInt32 is Int32
- typedef TestInt64 is Int64
- typedef TestBoolean is Boolean
- typedef TestByteBuffer is ByteBuffer
- typedef TestDouble is Double
- typedef TestFloat is Float
- typedef TestString is String
-}
-
-