summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Huss <dirk_huss@mentor.com>2015-11-25 14:59:52 +0100
committerDirk Huss <dirk_huss@mentor.com>2015-11-25 14:59:52 +0100
commitfaea5f299525500093843da72215d279c3eb483d (patch)
tree559a22a4f9844a4f8d04d8e39f37d04da797d1a0
parentdb96446ece67ba1f495811e29838e8c7bc7984ff (diff)
downloadgenivi-common-api-dbus-runtime-faea5f299525500093843da72215d279c3eb483d.tar.gz
CommonAPI-D-Bus 3.1.43.1.4
-rw-r--r--CMakeLists.txt46
-rw-r--r--CommonAPI-DBus.pc.in11
-rw-r--r--INSTALL11
-rw-r--r--README2
-rw-r--r--include/CommonAPI/DBus/DBusAddress.hpp34
-rw-r--r--include/CommonAPI/DBus/DBusAddressTranslator.hpp52
-rw-r--r--include/CommonAPI/DBus/DBusAttribute.hpp120
-rw-r--r--include/CommonAPI/DBus/DBusClientId.hpp14
-rw-r--r--include/CommonAPI/DBus/DBusConnection.hpp187
-rw-r--r--include/CommonAPI/DBus/DBusDaemonProxy.hpp44
-rw-r--r--include/CommonAPI/DBus/DBusDeployment.hpp38
-rw-r--r--include/CommonAPI/DBus/DBusError.hpp16
-rw-r--r--include/CommonAPI/DBus/DBusEvent.hpp92
-rw-r--r--include/CommonAPI/DBus/DBusFactory.hpp100
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp491
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp2
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp160
-rw-r--r--include/CommonAPI/DBus/DBusFreedesktopVariant.hpp65
-rw-r--r--include/CommonAPI/DBus/DBusFunctionalHash.hpp16
-rw-r--r--include/CommonAPI/DBus/DBusHelper.hpp32
-rw-r--r--include/CommonAPI/DBus/DBusInputStream.hpp508
-rw-r--r--include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp14
-rw-r--r--include/CommonAPI/DBus/DBusInterfaceHandler.hpp2
-rwxr-xr-xinclude/CommonAPI/DBus/DBusMainLoop.hpp185
-rw-r--r--include/CommonAPI/DBus/DBusMainLoopContext.hpp4
-rw-r--r--include/CommonAPI/DBus/DBusMessage.hpp4
-rw-r--r--include/CommonAPI/DBus/DBusMultiEvent.hpp122
-rw-r--r--include/CommonAPI/DBus/DBusObjectManager.hpp26
-rw-r--r--include/CommonAPI/DBus/DBusObjectManagerStub.hpp40
-rw-r--r--include/CommonAPI/DBus/DBusOutputStream.hpp435
-rw-r--r--include/CommonAPI/DBus/DBusProxy.hpp88
-rw-r--r--include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp95
-rw-r--r--include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp70
-rw-r--r--include/CommonAPI/DBus/DBusProxyBase.hpp40
-rw-r--r--include/CommonAPI/DBus/DBusProxyConnection.hpp14
-rw-r--r--include/CommonAPI/DBus/DBusProxyHelper.hpp223
-rw-r--r--include/CommonAPI/DBus/DBusProxyManager.hpp26
-rw-r--r--include/CommonAPI/DBus/DBusSelectiveEvent.hpp35
-rw-r--r--include/CommonAPI/DBus/DBusSerializableArguments.hpp10
-rw-r--r--include/CommonAPI/DBus/DBusServiceRegistry.hpp86
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapter.hpp28
-rw-r--r--include/CommonAPI/DBus/DBusStubAdapterHelper.hpp433
-rw-r--r--include/CommonAPI/DBus/DBusTypeOutputStream.hpp137
-rw-r--r--include/CommonAPI/DBus/DBusTypes.hpp4
-rw-r--r--include/CommonAPI/DBus/DBusUtils.hpp8
-rw-r--r--src/CommonAPI/DBus/DBusAddress.cpp70
-rw-r--r--src/CommonAPI/DBus/DBusAddressTranslator.cpp518
-rw-r--r--src/CommonAPI/DBus/DBusConnection.cpp445
-rw-r--r--src/CommonAPI/DBus/DBusDaemonProxy.cpp23
-rw-r--r--src/CommonAPI/DBus/DBusDeployment.cpp14
-rw-r--r--src/CommonAPI/DBus/DBusError.cpp14
-rw-r--r--src/CommonAPI/DBus/DBusFactory.cpp406
-rw-r--r--src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp22
-rw-r--r--src/CommonAPI/DBus/DBusFunctionalHash.cpp38
-rw-r--r--src/CommonAPI/DBus/DBusInputStream.cpp44
-rwxr-xr-xsrc/CommonAPI/DBus/DBusMainLoop.cpp697
-rw-r--r--src/CommonAPI/DBus/DBusMainLoopContext.cpp23
-rw-r--r--src/CommonAPI/DBus/DBusMessage.cpp42
-rw-r--r--src/CommonAPI/DBus/DBusObjectManager.cpp32
-rw-r--r--src/CommonAPI/DBus/DBusObjectManagerStub.cpp4
-rw-r--r--src/CommonAPI/DBus/DBusOutputStream.cpp20
-rw-r--r--src/CommonAPI/DBus/DBusProxy.cpp394
-rw-r--r--src/CommonAPI/DBus/DBusProxyBase.cpp39
-rw-r--r--src/CommonAPI/DBus/DBusProxyManager.cpp114
-rw-r--r--src/CommonAPI/DBus/DBusServiceRegistry.cpp365
-rw-r--r--src/CommonAPI/DBus/DBusStubAdapter.cpp11
-rw-r--r--src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch4
-rw-r--r--src/dbus-patches/capi-dbus-block-acquire-io-path-on-send.patch14
-rw-r--r--src/pugixml/pugixml.cpp6
-rw-r--r--src/test/CMakeLists.txt198
-rw-r--r--src/test/DBusAddressTranslatorTest.cpp440
-rw-r--r--src/test/DBusBroadcastTest.cpp447
-rw-r--r--src/test/DBusClientIdTest.cpp1
-rw-r--r--src/test/DBusCommunicationTest.cpp161
-rw-r--r--src/test/DBusConnectionTest.cpp18
-rw-r--r--src/test/DBusDaemonProxyTest.cpp10
-rw-r--r--src/test/DBusFactoryTest.cpp43
-rw-r--r--src/test/DBusFreedesktopPropertiesTest.cpp71
-rw-r--r--src/test/DBusInputStreamTest.cpp119
-rw-r--r--src/test/DBusLoadTest.cpp117
-rw-r--r--src/test/DBusMainLoopIntegrationTest.cpp71
-rw-r--r--src/test/DBusManagedTest.cpp49
-rw-r--r--src/test/DBusMultipleConnectionTest.cpp43
-rw-r--r--src/test/DBusObjectManagerStubTest.cpp490
-rw-r--r--src/test/DBusOutputStreamTest.cpp313
-rw-r--r--src/test/DBusPolymorphicTest.cpp89
-rw-r--r--src/test/DBusProxyTest.cpp142
-rw-r--r--src/test/DBusServicePublisherTest.cpp105
-rw-r--r--src/test/DBusServiceRegistryTest.cpp639
-rw-r--r--src/test/DBusStubAdapterTest.cpp6
-rw-r--r--src/test/DBusTestUtils.hpp4
-rw-r--r--src/test/DBusTypeStreamTest.cpp335
-rw-r--r--src/test/DBusVariantOutputStreamTest.cpp63
-rw-r--r--src/test/DemoMainLoop.hpp30
-rw-r--r--src/test/FakeGlueCode.cpp5
-rw-r--r--src/test/README.txt37
-rw-r--r--src/test/commonapi-dbus.ini68
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp195
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h116
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp202
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp145
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp188
-rw-r--r--src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp89
-rw-r--r--src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp89
-rw-r--r--src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h65
-rw-r--r--src/test/fakeLegacyService/fakeLegacyService.py34
-rw-r--r--src/test/fakeLegacyService/sendToFakeLegacyService.py30
-rw-r--r--src/test/root.fidl2
-rw-r--r--src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp2
-rw-r--r--src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp122
-rw-r--r--src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp4
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterface.hpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp)22
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp)18
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp)11
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp)26
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp)20
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp)23
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterface.hpp)10
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxy.hpp)26
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp)22
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp)63
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp)20
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterface.hpp)10
-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.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxy.hpp)64
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp)30
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStub.hpp)22
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp)119
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp)18
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.cpp)6
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.hpp)25
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.cpp)6
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.hpp)25
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp)12
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.cpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.cpp)6
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.hpp)25
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp)16
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp)18
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp)28
-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.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp)20
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRoot.hpp)10
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxy.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp)14
-rw-r--r--src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStub.hpp)22
-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.hpp (renamed from src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp)16
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterface.hpp)10
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp)20
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp)18
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp)16
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp)13
-rw-r--r--src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp (renamed from src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp)12
-rw-r--r--src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp92
-rw-r--r--src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp65
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp19
-rw-r--r--src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp8
-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.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp)6
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp)14
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp)66
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp)61
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp)32
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp)17
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp)157
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp)58
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp)7
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp)22
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp)49
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.hpp)7
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp)13
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp)64
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp)58
-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.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp)6
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp)12
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp)16
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp)21
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp)6
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp)12
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp)16
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp)21
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp)6
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp)12
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp)20
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp)24
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.hpp)6
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp)32
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp)12
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp)16
-rw-r--r--src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp)20
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp (renamed from src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp)6
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp (renamed from src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp)6
-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.hpp (renamed from src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp)12
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp (renamed from src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp)20
-rw-r--r--src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp (renamed from src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp)25
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp82
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp62
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp248
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp417
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp104
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp104
-rw-r--r--src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp112
-rw-r--r--src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp163
-rw-r--r--src/test/test-commonapi-dbus.ini66
-rw-r--r--src/test/test-derived-types.fidl126
-rw-r--r--src/test/test-freedesktop-interface.fdepl2
-rw-r--r--src/test/test-interface-proxy.fidl130
-rw-r--r--src/test/test-predefined-types.fidl26
253 files changed, 9989 insertions, 9398 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e24149..e456efc 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 3 )
+SET( LIBCOMMONAPI_DBUS_PATCH_VERSION 4 )
message(STATUS "Project name: ${PROJECT_NAME}")
@@ -24,7 +24,7 @@ set(GTEST_ROOT "n/a" CACHE STRING "Path to root folder of googletest. Must be se
# OS
set(DL_LIBRARY "")
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- set(DL_LIBRARY "dl")
+ set(DL_LIBRARY "dl")
endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
##############################################################################
@@ -100,9 +100,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.3 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
+ FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_CMAKE_PACKAGE_REGISTRY)
else()
- FIND_PACKAGE(CommonAPI 3.1.3 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
+ FIND_PACKAGE(CommonAPI 3.1.4 REQUIRED CONFIG NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
endif()
message(STATUS "CommonAPI_CONSIDERED_CONFIGS: ${CommonAPI_CONSIDERED_CONFIGS}")
@@ -112,18 +112,18 @@ message(STATUS "CommonAPI Version: ${CommonAPI_VERSION}")
###############################################################################
# find DBus by using the 'pkg-config' tool
if (MSVC)
- #Not beautiful, but it works
- 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 ()
+ #Not beautiful, but it works
+ 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 ()
else()
- pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
+ pkg_check_modules(DBus REQUIRED dbus-1>=1.4)
endif()
##############################################################################
@@ -135,7 +135,7 @@ if (MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /EHsc /wd\\\"4503\\\"")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DCOMMONAPI_INTERNAL_COMPILATION -DCOMMONAPI_DLL_COMPILATION /wd\\\"4503\\\"")
else()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector -fasynchronous-unwind-tables -fno-omit-frame-pointer -DCOMMONAPI_INTERNAL_COMPILATION -D_GLIBCXX_USE_NANOSLEEP")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOMMONAPI_LOGLEVEL=COMMONAPI_LOGLEVEL_${MAX_LOG_LEVEL}")
@@ -149,9 +149,9 @@ include_directories(
)
if ("${USE_INSTALLED_DBUS}" STREQUAL "OFF")
- link_directories(
- ${DBus_INCLUDE_DIRS}/dbus/.libs
- )
+ link_directories(
+ ${DBus_INCLUDE_DIRS}/dbus/.libs
+ )
endif()
# DBus source files
@@ -293,6 +293,13 @@ else()
endif()
##############################################################################
+# create pkg-config file
+if(NOT WIN32 AND PKG_CONFIG_FOUND)
+ configure_file(CommonAPI-DBus.pc.in ${PROJECT_BINARY_DIR}/CommonAPI-DBus.pc @ONLY)
+ install(FILES ${PROJECT_BINARY_DIR}/CommonAPI-DBus.pc DESTINATION lib/pkconfig)
+endif()
+
+##############################################################################
# Test section
##############################################################################
@@ -337,3 +344,4 @@ add_dependencies(check build_tests)
# add test directory
add_subdirectory( src/test EXCLUDE_FROM_ALL )
+
diff --git a/CommonAPI-DBus.pc.in b/CommonAPI-DBus.pc.in
new file mode 100644
index 0000000..e93ebee
--- /dev/null
+++ b/CommonAPI-DBus.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@
+includedir=@CMAKE_INSTALL_PREFIX@/include
+
+Name: @PROJECT@
+Description: GENIVI Common API D-Bus C++ Library
+Version: @COMPONENT_VERSION@
+Libs: -L${libdir} -lCommonAPI-DBus
+Cflags: -I${includedir}/CommonAPI-@COMMONAPI_API_HEADER_VERSION@
+
diff --git a/INSTALL b/INSTALL
index 4ef692b..173169b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
= IPC CommonAPI D-Bus C++
-:doctitle: IPC CommonAPI C++
+:doctitle: IPC CommonAPI D-Bus C++
:version:
== Copyright
@@ -27,20 +27,21 @@ Source code and latest news can be found at http://projects.genivi.org/commonapi
=== Patching libdbus
-CommonAPI-D-Bus needs some api functions of libdbus which are not available in actual libdbus versions. For these additional api functions it is necessary to patch the required libdbus version with the patches in the directory src/dbus-patches. Use autotools to build libdbus.
+CommonAPI-D-Bus needs some api functions of libdbus which are not available in actual libdbus versions. For these additional api functions it is necessary to patch the required libdbus version with all the patches in the directory src/dbus-patches. Use autotools to build libdbus.
----
$ wget http://dbus.freedesktop.org/releases/dbus/dbus-<VERSION>.tar.gz
$ tar -xzf dbus-<VERSION>.tar.gz
$ cd dbus-<VERSION>
$ patch -p1 < </path/to/CommonAPI-D-Bus/src/dbus-patches/patch-names>.patch
-$ ./configure --prefix=/usr/local
+$ ./configure --prefix=</path to your preferred installation folder for patched libdbus>
$ make -C dbus
-$ sudo make -C dbus install
-$ sudo make install-pkgconfigDATA
+$ make -C dbus install
+$ make install-pkgconfigDATA
----
You can change the installation directory by the prefix option or you can let it uninstalled (skip the +make install+ commands).
+WARNING: Installing the patched libdbus to /usr/local can prevent your system from booting correctly at the next reboot.
=== Build CommonAPI-D-Bus Runtime
diff --git a/README b/README
index a9ebbcc..a1c8d9b 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
-This is CommonAPI-DBus 3.1.3
+This is CommonAPI-DBus 3.1.4
Please refer to INSTALL for further information. \ No newline at end of file
diff --git a/include/CommonAPI/DBus/DBusAddress.hpp b/include/CommonAPI/DBus/DBusAddress.hpp
index 926b11b..448012c 100644
--- a/include/CommonAPI/DBus/DBusAddress.hpp
+++ b/include/CommonAPI/DBus/DBusAddress.hpp
@@ -20,29 +20,29 @@ namespace DBus {
class DBusAddress {
public:
- COMMONAPI_EXPORT DBusAddress(const std::string &_service = "",
- const std::string &_objectPath = "",
- const std::string &_interface = "");
- COMMONAPI_EXPORT DBusAddress(const DBusAddress &_source);
- COMMONAPI_EXPORT virtual ~DBusAddress();
+ COMMONAPI_EXPORT DBusAddress(const std::string &_service = "",
+ const std::string &_objectPath = "",
+ const std::string &_interface = "");
+ COMMONAPI_EXPORT DBusAddress(const DBusAddress &_source);
+ COMMONAPI_EXPORT virtual ~DBusAddress();
- COMMONAPI_EXPORT bool operator==(const DBusAddress &_other) const;
- COMMONAPI_EXPORT bool operator!=(const DBusAddress &_other) const;
- COMMONAPI_EXPORT bool operator<(const DBusAddress &_other) const;
+ COMMONAPI_EXPORT bool operator==(const DBusAddress &_other) const;
+ COMMONAPI_EXPORT bool operator!=(const DBusAddress &_other) const;
+ COMMONAPI_EXPORT bool operator<(const DBusAddress &_other) const;
- COMMONAPI_EXPORT const std::string &getInterface() const;
- COMMONAPI_EXPORT void setInterface(const std::string &_interface);
+ COMMONAPI_EXPORT const std::string &getInterface() const;
+ COMMONAPI_EXPORT void setInterface(const std::string &_interface);
- COMMONAPI_EXPORT const std::string &getObjectPath() const;
- COMMONAPI_EXPORT void setObjectPath(const std::string &_objectPath);
+ COMMONAPI_EXPORT const std::string &getObjectPath() const;
+ COMMONAPI_EXPORT void setObjectPath(const std::string &_objectPath);
- COMMONAPI_EXPORT const std::string &getService() const;
- COMMONAPI_EXPORT void setService(const std::string &_service);
+ COMMONAPI_EXPORT const std::string &getService() const;
+ COMMONAPI_EXPORT void setService(const std::string &_service);
private:
- std::string service_;
- std::string objectPath_;
- std::string interface_;
+ std::string service_;
+ std::string objectPath_;
+ std::string interface_;
friend std::ostream &operator<<(std::ostream &_out, const DBusAddress &_dbusAddress);
};
diff --git a/include/CommonAPI/DBus/DBusAddressTranslator.hpp b/include/CommonAPI/DBus/DBusAddressTranslator.hpp
index bbe1d75..ef95905 100644
--- a/include/CommonAPI/DBus/DBusAddressTranslator.hpp
+++ b/include/CommonAPI/DBus/DBusAddressTranslator.hpp
@@ -24,49 +24,49 @@ namespace DBus {
class DBusAddressTranslator {
public:
- COMMONAPI_EXPORT static std::shared_ptr<DBusAddressTranslator> get();
+ COMMONAPI_EXPORT static std::shared_ptr<DBusAddressTranslator> get();
- COMMONAPI_EXPORT DBusAddressTranslator();
+ COMMONAPI_EXPORT DBusAddressTranslator();
- COMMONAPI_EXPORT void init();
+ COMMONAPI_EXPORT void init();
- COMMONAPI_EXPORT bool translate(const std::string &_key, DBusAddress &_value);
- COMMONAPI_EXPORT bool translate(const CommonAPI::Address &_key, DBusAddress &_value);
+ COMMONAPI_EXPORT bool translate(const std::string &_key, DBusAddress &_value);
+ COMMONAPI_EXPORT bool translate(const CommonAPI::Address &_key, DBusAddress &_value);
- COMMONAPI_EXPORT bool translate(const DBusAddress &_key, std::string &_value);
- COMMONAPI_EXPORT bool translate(const DBusAddress &_key, CommonAPI::Address &_value);
+ COMMONAPI_EXPORT bool translate(const DBusAddress &_key, std::string &_value);
+ COMMONAPI_EXPORT bool translate(const DBusAddress &_key, CommonAPI::Address &_value);
- COMMONAPI_EXPORT void insert(const std::string &_address,
- const std::string &_service, const std::string &_path, const std::string &_interface, const bool _objPathStartWithDigits = false);
+ COMMONAPI_EXPORT void insert(const std::string &_address,
+ const std::string &_service, const std::string &_path, const std::string &_interface, const bool _objPathStartWithDigits = false);
- COMMONAPI_EXPORT DBusType_t getDBusBusType(const ConnectionId_t &_connectionId) const ;
+ COMMONAPI_EXPORT DBusType_t getDBusBusType(const ConnectionId_t &_connectionId) const ;
- /**
- * @brief Returns whether or not org.freedesktop.DBus.Peer interface is used in a (valid) name mapping.
- * @return true in case any (valid) mapping of org.freedesktop.DBus.Peer is present, otherwise false
- */
- COMMONAPI_EXPORT bool isOrgFreedesktopDBusPeerMapped() const;
+ /**
+ * @brief Returns whether or not org.freedesktop.DBus.Peer interface is used in a (valid) name mapping.
+ * @return true in case any (valid) mapping of org.freedesktop.DBus.Peer is present, otherwise false
+ */
+ COMMONAPI_EXPORT bool isOrgFreedesktopDBusPeerMapped() const;
private:
- COMMONAPI_EXPORT bool readConfiguration();
+ COMMONAPI_EXPORT bool readConfiguration();
- COMMONAPI_EXPORT bool isValid(const std::string &, const char,
- bool = false, bool = false, bool = false) const;
+ COMMONAPI_EXPORT bool isValid(const std::string &, const char,
+ bool = false, bool = false, bool = false) const;
private:
- bool isDefault_;
+ bool isDefault_;
- std::string defaultConfig_;
- std::string defaultDomain_;
+ std::string defaultConfig_;
+ std::string defaultDomain_;
- std::map<CommonAPI::Address, DBusAddress> forwards_;
- std::map<DBusAddress, CommonAPI::Address> backwards_;
+ std::map<CommonAPI::Address, DBusAddress> forwards_;
+ std::map<DBusAddress, CommonAPI::Address> backwards_;
- std::mutex mutex_;
+ std::mutex mutex_;
- std::map<ConnectionId_t, DBusType_t> dbusTypes_;
+ std::map<ConnectionId_t, DBusType_t> dbusTypes_;
- bool orgFreedesktopDBusPeerMapped_;
+ bool orgFreedesktopDBusPeerMapped_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusAttribute.hpp b/include/CommonAPI/DBus/DBusAttribute.hpp
index 50dea3b..ba3ca77 100644
--- a/include/CommonAPI/DBus/DBusAttribute.hpp
+++ b/include/CommonAPI/DBus/DBusAttribute.hpp
@@ -21,67 +21,67 @@
namespace CommonAPI {
namespace DBus {
-template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusReadonlyAttribute: public _AttributeType {
+template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusReadonlyAttribute: public AttributeType_ {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef _AttributeDepl ValueTypeDepl;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef AttributeDepl_ ValueTypeDepl;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
DBusReadonlyAttribute(DBusProxy &_proxy,
- const char *setMethodSignature, const char *getMethodName,
- _AttributeDepl *_depl = nullptr)
- : proxy_(_proxy),
+ const char *setMethodSignature, const char *getMethodName,
+ AttributeDepl_ *_depl = nullptr)
+ : proxy_(_proxy),
getMethodName_(getMethodName),
setMethodSignature_(setMethodSignature),
- depl_(_depl) {
+ depl_(_depl) {
assert(getMethodName);
}
void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedValue(depl_);
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedValue(depl_);
DBusProxyHelper<
- DBusSerializableArguments<
- >,
DBusSerializableArguments<
- CommonAPI::Deployable<
- ValueType,
- _AttributeDepl
- >
- >
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<
+ ValueType,
+ AttributeDepl_
+ >
+ >
>::callMethodWithReply(proxy_, getMethodName_, "", (_info ? _info : &defaultCallInfo), _status, deployedValue);
_value = deployedValue.getValue();
}
std::future<CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedValue(depl_);
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedValue(depl_);
return DBusProxyHelper<
- DBusSerializableArguments<>,
- DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>
- >::callMethodAsync(proxy_, getMethodName_, "", (_info ? _info : &defaultCallInfo),
- [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, _AttributeDepl> _response) {
- _callback(_status, _response.getValue());
- },
- std::make_tuple(deployedValue));
+ DBusSerializableArguments<>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, AttributeDepl_>>
+ >::callMethodAsync(proxy_, getMethodName_, "", (_info ? _info : &defaultCallInfo),
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, AttributeDepl_> _response) {
+ _callback(_status, _response.getValue());
+ },
+ std::make_tuple(deployedValue));
}
protected:
DBusProxy &proxy_;
const char *getMethodName_;
const char *setMethodSignature_;
- _AttributeDepl *depl_;
+ AttributeDepl_ *depl_;
};
-template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusAttribute: public DBusReadonlyAttribute<_AttributeType, _AttributeDepl> {
+template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusAttribute: public DBusReadonlyAttribute<AttributeType_, AttributeDepl_> {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
DBusAttribute(DBusProxy &_proxy,
- const char *_setMethodName, const char *_setMethodSignature, const char *_getMethodName,
- _AttributeDepl *_depl = nullptr)
- : DBusReadonlyAttribute<_AttributeType, _AttributeDepl>(_proxy, _setMethodSignature, _getMethodName, _depl),
+ const char *_setMethodName, const char *_setMethodSignature, const char *_getMethodName,
+ AttributeDepl_ *_depl = nullptr)
+ : DBusReadonlyAttribute<AttributeType_, AttributeDepl_>(_proxy, _setMethodSignature, _getMethodName, _depl),
setMethodName_(_setMethodName),
setMethodSignature_(_setMethodSignature) {
assert(_setMethodName);
@@ -89,34 +89,34 @@ public:
}
void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedRequest(_request, this->depl_);
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedResponse(this->depl_);
- DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>,
- DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>> >::callMethodWithReply(
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedRequest(_request, this->depl_);
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedResponse(this->depl_);
+ DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, AttributeDepl_>>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, AttributeDepl_>> >::callMethodWithReply(
this->proxy_,
setMethodName_,
setMethodSignature_,
- (_info ? _info : &defaultCallInfo),
+ (_info ? _info : &defaultCallInfo),
deployedRequest,
- _status,
+ _status,
deployedResponse);
- _response = deployedResponse.getValue();
+ _response = deployedResponse.getValue();
}
std::future<CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedRequest(_request, this->depl_);
- CommonAPI::Deployable<ValueType, _AttributeDepl> deployedResponse(this->depl_);
- return DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>>,
- DBusSerializableArguments<CommonAPI::Deployable<ValueType, _AttributeDepl>> >::callMethodAsync(
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedRequest(_request, this->depl_);
+ CommonAPI::Deployable<ValueType, AttributeDepl_> deployedResponse(this->depl_);
+ return DBusProxyHelper<DBusSerializableArguments<CommonAPI::Deployable<ValueType, AttributeDepl_>>,
+ DBusSerializableArguments<CommonAPI::Deployable<ValueType, AttributeDepl_>> >::callMethodAsync(
this->proxy_,
setMethodName_,
setMethodSignature_,
- (_info ? _info : &defaultCallInfo),
+ (_info ? _info : &defaultCallInfo),
deployedRequest,
- [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, _AttributeDepl> _response) {
- _callback(_status, _response.getValue());
- },
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, AttributeDepl_> _response) {
+ _callback(_status, _response.getValue());
+ },
std::make_tuple(deployedResponse));
}
@@ -125,21 +125,21 @@ public:
const char* setMethodSignature_;
};
-template <typename _AttributeType>
-class DBusObservableAttribute: public _AttributeType {
+template <typename AttributeType_>
+class DBusObservableAttribute: public AttributeType_ {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::ValueTypeDepl ValueTypeDepl;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef typename AttributeType_::ValueTypeDepl ValueTypeDepl;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ChangedEvent ChangedEvent;
- template <typename... _AttributeTypeArguments>
+ template <typename... AttributeType_Arguments>
DBusObservableAttribute(DBusProxy &_proxy,
- const char *_changedEventName,
- _AttributeTypeArguments... arguments)
- : _AttributeType(_proxy, arguments...),
- changedEvent_(_proxy, _changedEventName, this->setMethodSignature_, this->getMethodName_,
- std::make_tuple(CommonAPI::Deployable<ValueType, ValueTypeDepl>(this->depl_))) {
+ const char *_changedEventName,
+ AttributeType_Arguments... arguments)
+ : AttributeType_(_proxy, arguments...),
+ changedEvent_(_proxy, _changedEventName, this->setMethodSignature_, this->getMethodName_,
+ std::make_tuple(CommonAPI::Deployable<ValueType, ValueTypeDepl>(this->depl_))) {
}
ChangedEvent &getChangedEvent() {
diff --git a/include/CommonAPI/DBus/DBusClientId.hpp b/include/CommonAPI/DBus/DBusClientId.hpp
index 72dc1c5..02e369f 100644
--- a/include/CommonAPI/DBus/DBusClientId.hpp
+++ b/include/CommonAPI/DBus/DBusClientId.hpp
@@ -25,19 +25,19 @@ class DBusMessage;
* It internally uses a string to identify clients. This string is the unique sender id used by dbus.
*/
class DBusClientId
- : public CommonAPI::ClientId {
+ : public CommonAPI::ClientId {
friend struct std::hash<DBusClientId>;
public:
- COMMONAPI_EXPORT DBusClientId(std::string dbusId);
+ COMMONAPI_EXPORT DBusClientId(std::string dbusId);
- COMMONAPI_EXPORT bool operator==(CommonAPI::ClientId& clientIdToCompare);
- COMMONAPI_EXPORT bool operator==(DBusClientId& clientIdToCompare);
- COMMONAPI_EXPORT size_t hashCode();
+ COMMONAPI_EXPORT bool operator==(CommonAPI::ClientId& clientIdToCompare);
+ COMMONAPI_EXPORT bool operator==(DBusClientId& clientIdToCompare);
+ COMMONAPI_EXPORT size_t hashCode();
- COMMONAPI_EXPORT const char * getDBusId();
+ COMMONAPI_EXPORT const char * getDBusId();
- COMMONAPI_EXPORT DBusMessage createMessage(const std::string objectPath, const std::string interfaceName, const std::string signalName) const;
+ COMMONAPI_EXPORT DBusMessage createMessage(const std::string objectPath, const std::string interfaceName, const std::string signalName) const;
protected:
std::string dbusId_;
};
diff --git a/include/CommonAPI/DBus/DBusConnection.hpp b/include/CommonAPI/DBus/DBusConnection.hpp
index 97cb069..e3608da 100644
--- a/include/CommonAPI/DBus/DBusConnection.hpp
+++ b/include/CommonAPI/DBus/DBusConnection.hpp
@@ -11,11 +11,13 @@
#define COMMONAPI_DBUS_DBUS_CONNECTION_HPP_
#include <atomic>
+#include <mutex>
#include <dbus/dbus.h>
#include <CommonAPI/DBus/DBusConfig.hpp>
#include <CommonAPI/DBus/DBusDaemonProxy.hpp>
+#include <CommonAPI/DBus/DBusMainLoop.hpp>
#include <CommonAPI/DBus/DBusMainLoopContext.hpp>
#include <CommonAPI/DBus/DBusObjectManager.hpp>
#include <CommonAPI/DBus/DBusProxyConnection.hpp>
@@ -24,10 +26,11 @@
namespace CommonAPI {
namespace DBus {
+class DBusMainLoop;
class DBusObjectManager;
class DBusConnectionStatusEvent
- : public DBusProxyConnection::ConnectionStatusEvent {
+ : public DBusProxyConnection::ConnectionStatusEvent {
public:
DBusConnectionStatusEvent(DBusConnection* dbusConnection);
virtual ~DBusConnectionStatusEvent() {}
@@ -51,56 +54,56 @@ struct WatchContext {
};
class DBusConnection
- : public DBusProxyConnection,
- public std::enable_shared_from_this<DBusConnection> {
+ : public DBusProxyConnection,
+ public std::enable_shared_from_this<DBusConnection> {
public:
- COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> getBus(const DBusType_t &_type);
- COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> wrap(::DBusConnection *_connection);
+ COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> getBus(const DBusType_t &_type);
+ COMMONAPI_EXPORT static std::shared_ptr<DBusConnection> wrap(::DBusConnection *_connection);
- COMMONAPI_EXPORT DBusConnection(DBusType_t _type);
- COMMONAPI_EXPORT DBusConnection(const DBusConnection&) = delete;
- COMMONAPI_EXPORT DBusConnection(::DBusConnection* libDbusConnection);
- COMMONAPI_EXPORT virtual ~DBusConnection();
+ COMMONAPI_EXPORT DBusConnection(DBusType_t _type);
+ COMMONAPI_EXPORT DBusConnection(const DBusConnection&) = delete;
+ COMMONAPI_EXPORT DBusConnection(::DBusConnection* libDbusConnection);
+ COMMONAPI_EXPORT virtual ~DBusConnection();
- COMMONAPI_EXPORT DBusConnection& operator=(const DBusConnection&) = delete;
+ COMMONAPI_EXPORT DBusConnection& operator=(const DBusConnection&) = delete;
- COMMONAPI_EXPORT DBusType_t getBusType() const;
+ COMMONAPI_EXPORT DBusType_t getBusType() const;
- COMMONAPI_EXPORT bool connect(bool startDispatchThread = true);
- COMMONAPI_EXPORT bool connect(DBusError& dbusError, bool startDispatchThread = true);
- COMMONAPI_EXPORT void disconnect();
+ COMMONAPI_EXPORT bool connect(bool startDispatchThread = true);
+ COMMONAPI_EXPORT bool connect(DBusError& dbusError, bool startDispatchThread = true);
+ COMMONAPI_EXPORT void disconnect();
- COMMONAPI_EXPORT virtual bool isConnected() const;
+ COMMONAPI_EXPORT virtual bool isConnected() const;
- COMMONAPI_EXPORT virtual ConnectionStatusEvent& getConnectionStatusEvent();
+ COMMONAPI_EXPORT virtual ConnectionStatusEvent& getConnectionStatusEvent();
- COMMONAPI_EXPORT virtual bool requestServiceNameAndBlock(const std::string& serviceName) const;
- COMMONAPI_EXPORT virtual bool releaseServiceName(const std::string& serviceName) const;
+ COMMONAPI_EXPORT virtual bool requestServiceNameAndBlock(const std::string& serviceName) const;
+ COMMONAPI_EXPORT virtual bool releaseServiceName(const std::string& serviceName) const;
- COMMONAPI_EXPORT bool sendDBusMessage(const DBusMessage& dbusMessage/*, uint32_t* allocatedSerial = NULL*/) const;
+ COMMONAPI_EXPORT bool sendDBusMessage(const DBusMessage& dbusMessage/*, uint32_t* allocatedSerial = NULL*/) const;
- COMMONAPI_EXPORT std::future<CallStatus> sendDBusMessageWithReplyAsync(
+ COMMONAPI_EXPORT std::future<CallStatus> sendDBusMessageWithReplyAsync(
const DBusMessage& dbusMessage,
std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- const CommonAPI::CallInfo *_info) const;
+ const CommonAPI::CallInfo *_info) const;
- COMMONAPI_EXPORT DBusMessage sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
+ COMMONAPI_EXPORT DBusMessage sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
DBusError& dbusError,
- const CommonAPI::CallInfo *_info) const;
+ const CommonAPI::CallInfo *_info) const;
- COMMONAPI_EXPORT virtual bool addObjectManagerSignalMemberHandler(const std::string& dbusBusName,
+ COMMONAPI_EXPORT virtual bool addObjectManagerSignalMemberHandler(const std::string& dbusBusName,
DBusSignalHandler* dbusSignalHandler);
- COMMONAPI_EXPORT virtual bool removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
+ COMMONAPI_EXPORT virtual bool removeObjectManagerSignalMemberHandler(const std::string& dbusBusName,
DBusSignalHandler* dbusSignalHandler);
- COMMONAPI_EXPORT DBusSignalHandlerToken addSignalMemberHandler(const std::string& objectPath,
+ COMMONAPI_EXPORT DBusSignalHandlerToken addSignalMemberHandler(const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& inuint32_tterfaceMemberSignature,
DBusSignalHandler* dbusSignalHandler,
const bool justAddFilter = false);
- COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
+ COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcast(bool& subscriptionAccepted,
const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
@@ -108,37 +111,41 @@ public:
DBusSignalHandler* dbusSignalHandler,
DBusProxy* callingProxy);
- COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
+ COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
DBusProxyConnection::DBusSignalHandlerToken subscription,
DBusProxy* callingProxy,
const DBusSignalHandler* dbusSignalHandler);
- COMMONAPI_EXPORT void registerObjectPath(const std::string& objectPath);
- COMMONAPI_EXPORT void unregisterObjectPath(const std::string& objectPath);
+ COMMONAPI_EXPORT void registerObjectPath(const std::string& objectPath);
+ COMMONAPI_EXPORT void unregisterObjectPath(const std::string& objectPath);
- COMMONAPI_EXPORT bool removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
+ COMMONAPI_EXPORT bool removeSignalMemberHandler(const DBusSignalHandlerToken& dbusSignalHandlerToken,
const DBusSignalHandler* dbusSignalHandler = NULL);
- COMMONAPI_EXPORT bool readWriteDispatch(int timeoutMilliseconds = -1);
+ COMMONAPI_EXPORT bool readWriteDispatch(int timeoutMilliseconds = -1);
- COMMONAPI_EXPORT virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager();
+ COMMONAPI_EXPORT virtual const std::shared_ptr<DBusObjectManager> getDBusObjectManager();
- COMMONAPI_EXPORT void setObjectPathMessageHandler(DBusObjectPathMessageHandler);
- COMMONAPI_EXPORT bool isObjectPathMessageHandlerSet();
+ COMMONAPI_EXPORT void setObjectPathMessageHandler(DBusObjectPathMessageHandler);
+ COMMONAPI_EXPORT bool isObjectPathMessageHandlerSet();
- COMMONAPI_EXPORT virtual bool attachMainLoopContext(std::weak_ptr<MainLoopContext>);
+ COMMONAPI_EXPORT virtual bool attachMainLoopContext(std::weak_ptr<MainLoopContext>);
- COMMONAPI_EXPORT bool isDispatchReady();
- COMMONAPI_EXPORT bool singleDispatch();
+ COMMONAPI_EXPORT bool isDispatchReady();
+ COMMONAPI_EXPORT bool singleDispatch();
- COMMONAPI_EXPORT virtual bool hasDispatchThread();
+ COMMONAPI_EXPORT virtual bool hasDispatchThread();
- typedef std::tuple<std::string, std::string, std::string> DBusSignalMatchRuleTuple;
- typedef std::pair<uint32_t, std::string> DBusSignalMatchRuleMapping;
- typedef std::unordered_map<DBusSignalMatchRuleTuple, DBusSignalMatchRuleMapping> DBusSignalMatchRulesMap;
+#ifdef COMMONAPI_DBUS_TEST
+ inline std::weak_ptr<DBusMainloop> getLoop() { return loop_; }
+#endif
+
+ typedef std::tuple<std::string, std::string, std::string> DBusSignalMatchRuleTuple;
+ typedef std::pair<uint32_t, std::string> DBusSignalMatchRuleMapping;
+ typedef std::unordered_map<DBusSignalMatchRuleTuple, DBusSignalMatchRuleMapping> DBusSignalMatchRulesMap;
private:
- COMMONAPI_EXPORT void dispatch();
- COMMONAPI_EXPORT void suspendDispatching() const;
- COMMONAPI_EXPORT void resumeDispatching() const;
+ COMMONAPI_EXPORT void dispatch();
+ COMMONAPI_EXPORT void suspendDispatching() const;
+ COMMONAPI_EXPORT void resumeDispatching() const;
std::thread* dispatchThread_;
bool stopDispatching_;
@@ -151,46 +158,46 @@ public:
mutable bool pauseDispatching_;
mutable std::mutex dispatchSuspendLock_;
- COMMONAPI_EXPORT void addLibdbusSignalMatchRule(const std::string& objectPath,
+ COMMONAPI_EXPORT void addLibdbusSignalMatchRule(const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const bool justAddFilter = false);
- COMMONAPI_EXPORT void removeLibdbusSignalMatchRule(const std::string& objectPath,
+ COMMONAPI_EXPORT void removeLibdbusSignalMatchRule(const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName);
- COMMONAPI_EXPORT void initLibdbusSignalFilterAfterConnect();
+ COMMONAPI_EXPORT void initLibdbusSignalFilterAfterConnect();
::DBusHandlerResult onLibdbusSignalFilter(::DBusMessage* libdbusMessage);
- COMMONAPI_EXPORT void initLibdbusObjectPathHandlerAfterConnect();
+ COMMONAPI_EXPORT void initLibdbusObjectPathHandlerAfterConnect();
::DBusHandlerResult onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage);
COMMONAPI_EXPORT static DBusMessage convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall,
- CallStatus& _callStatus);
- COMMONAPI_EXPORT static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void* userData);
- COMMONAPI_EXPORT static void onLibdbusDataCleanup(void* userData);
+ CallStatus& _callStatus);
+ COMMONAPI_EXPORT static void onLibdbusPendingCallNotifyThunk(::DBusPendingCall* libdbusPendingCall, void* userData);
+ COMMONAPI_EXPORT static void onLibdbusDataCleanup(void* userData);
- COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
+ COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusObjectPathMessageThunk(::DBusConnection* libdbusConnection,
::DBusMessage* libdbusMessage,
void* userData);
- COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusSignalFilterThunk(::DBusConnection* libdbusConnection,
+ COMMONAPI_EXPORT static ::DBusHandlerResult onLibdbusSignalFilterThunk(::DBusConnection* libdbusConnection,
::DBusMessage* libdbusMessage,
void* userData);
- COMMONAPI_EXPORT static dbus_bool_t onAddWatch(::DBusWatch* libdbusWatch, void* data);
- COMMONAPI_EXPORT static void onRemoveWatch(::DBusWatch* libdbusWatch, void* data);
- COMMONAPI_EXPORT static void onToggleWatch(::DBusWatch* libdbusWatch, void* data);
+ COMMONAPI_EXPORT static dbus_bool_t onAddWatch(::DBusWatch* libdbusWatch, void* data);
+ COMMONAPI_EXPORT static void onRemoveWatch(::DBusWatch* libdbusWatch, void* data);
+ COMMONAPI_EXPORT static void onToggleWatch(::DBusWatch* libdbusWatch, void* data);
- COMMONAPI_EXPORT static dbus_bool_t onAddTimeout(::DBusTimeout* dbus_timeout, void* data);
- COMMONAPI_EXPORT static void onRemoveTimeout(::DBusTimeout* dbus_timeout, void* data);
- COMMONAPI_EXPORT static void onToggleTimeout(::DBusTimeout* dbus_timeout, void* data);
+ COMMONAPI_EXPORT static dbus_bool_t onAddTimeout(::DBusTimeout* dbus_timeout, void* data);
+ COMMONAPI_EXPORT static void onRemoveTimeout(::DBusTimeout* dbus_timeout, void* data);
+ COMMONAPI_EXPORT static void onToggleTimeout(::DBusTimeout* dbus_timeout, void* data);
- COMMONAPI_EXPORT static void onWakeupMainContext(void* data);
+ COMMONAPI_EXPORT static void onWakeupMainContext(void* data);
- COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const;
- COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable();
+ COMMONAPI_EXPORT void enforceAsynchronousTimeouts() const;
+ COMMONAPI_EXPORT static const DBusObjectPathVTable* getDBusObjectPathVTable();
::DBusConnection* connection_;
mutable std::mutex connectionGuard_;
@@ -213,11 +220,11 @@ public:
std::unordered_multimap<std::string, DBusSignalHandler*> dbusObjectManagerSignalHandlerTable_;
std::mutex dbusObjectManagerSignalGuard_;
- COMMONAPI_EXPORT bool addObjectManagerSignalMatchRule(const std::string& dbusBusName);
- COMMONAPI_EXPORT bool removeObjectManagerSignalMatchRule(const std::string& dbusBusName);
+ COMMONAPI_EXPORT bool addObjectManagerSignalMatchRule(const std::string& dbusBusName);
+ COMMONAPI_EXPORT bool removeObjectManagerSignalMatchRule(const std::string& dbusBusName);
- COMMONAPI_EXPORT bool addLibdbusSignalMatchRule(const std::string& dbusMatchRule);
- COMMONAPI_EXPORT bool removeLibdbusSignalMatchRule(const std::string& dbusMatchRule);
+ COMMONAPI_EXPORT bool addLibdbusSignalMatchRule(const std::string& dbusMatchRule);
+ COMMONAPI_EXPORT bool removeLibdbusSignalMatchRule(const std::string& dbusMatchRule);
std::atomic_size_t libdbusSignalMatchRulesCount_;
@@ -230,29 +237,30 @@ public:
mutable std::unordered_map<std::string, uint16_t> connectionNameCount_;
typedef std::pair<
- DBusPendingCall*,
- std::tuple<
- std::chrono::time_point<std::chrono::high_resolution_clock>,
- DBusMessageReplyAsyncHandler*,
- DBusMessage
- >
- > TimeoutMapElement;
+ DBusPendingCall*,
+ std::tuple<
+ std::chrono::time_point<std::chrono::high_resolution_clock>,
+ DBusMessageReplyAsyncHandler*,
+ DBusMessage
+ >
+ > TimeoutMapElement;
mutable std::map<
- DBusPendingCall*,
- std::tuple<
- std::chrono::time_point<std::chrono::high_resolution_clock>,
- DBusMessageReplyAsyncHandler*,
- DBusMessage
- >
- > timeoutMap_;
+ DBusPendingCall*,
+ std::tuple<
+ std::chrono::time_point<std::chrono::high_resolution_clock>,
+ DBusMessageReplyAsyncHandler*,
+ DBusMessage
+ >
+ > timeoutMap_;
typedef std::tuple<
- DBusMessageReplyAsyncHandler *,
- DBusMessage,
- CommonAPI::CallStatus,
- ::DBusPendingCall*
- > MainloopTimeout_t;
+ DBusMessageReplyAsyncHandler *,
+ DBusMessage,
+ CommonAPI::CallStatus,
+ ::DBusPendingCall*
+ > MainloopTimeout_t;
mutable std::list<MainloopTimeout_t> mainloopTimeouts_;
+ mutable std::mutex mainloopTimeoutsMutex_;
mutable std::mutex enforceTimeoutMutex_;
mutable std::condition_variable enforceTimeoutCondition_;
@@ -260,6 +268,13 @@ public:
mutable std::shared_ptr<std::thread> enforcerThread_;
mutable std::mutex enforcerThreadMutex_;
bool enforcerThreadCancelled_;
+
+ std::shared_ptr<DBusMainLoop> loop_;
+
+ // set contains asyncHandlers with infinite timeout
+ mutable std::set<DBusMessageReplyAsyncHandler*> timeoutInfiniteAsyncHandlers_;
+ mutable std::mutex timeoutInfiniteAsyncHandlersMutex_;
+
};
diff --git a/include/CommonAPI/DBus/DBusDaemonProxy.hpp b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
index 1333548..69541b6 100644
--- a/include/CommonAPI/DBus/DBusDaemonProxy.hpp
+++ b/include/CommonAPI/DBus/DBusDaemonProxy.hpp
@@ -37,40 +37,40 @@ class StaticInterfaceVersionAttribute: public InterfaceVersionAttribute {
class DBusDaemonProxy : public DBusProxyBase {
public:
- typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
+ typedef Event<std::string, std::string, std::string> NameOwnerChangedEvent;
- typedef std::unordered_map<std::string, int> PropertyDictStub;
- typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict;
- typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict;
+ typedef std::unordered_map<std::string, int> PropertyDictStub;
+ typedef std::unordered_map<std::string, PropertyDictStub> InterfaceToPropertyDict;
+ typedef std::unordered_map<std::string, InterfaceToPropertyDict> DBusObjectToInterfaceDict;
- typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, DBusObjectToInterfaceDict)> GetManagedObjectsAsyncCallback;
- typedef std::function<void(const CommonAPI::CallStatus&, std::string)> GetNameOwnerAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, std::vector<std::string>)> ListNamesAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, bool)> NameHasOwnerAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, DBusObjectToInterfaceDict)> GetManagedObjectsAsyncCallback;
+ typedef std::function<void(const CommonAPI::CallStatus&, std::string)> GetNameOwnerAsyncCallback;
- COMMONAPI_EXPORT DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection);
- COMMONAPI_EXPORT virtual ~DBusDaemonProxy() {}
+ COMMONAPI_EXPORT DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection);
+ COMMONAPI_EXPORT virtual ~DBusDaemonProxy() {}
- COMMONAPI_EXPORT virtual bool isAvailable() const;
- COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
- COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
+ COMMONAPI_EXPORT virtual bool isAvailable() const;
+ COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+ COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
- COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
+ COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
- COMMONAPI_EXPORT void init();
+ COMMONAPI_EXPORT void init();
- COMMONAPI_EXPORT static const char* getInterfaceId();
+ COMMONAPI_EXPORT static const char* getInterfaceId();
- COMMONAPI_EXPORT NameOwnerChangedEvent& getNameOwnerChangedEvent();
+ 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;
+ COMMONAPI_EXPORT void listNames(CommonAPI::CallStatus& callStatus, std::vector<std::string>& busNames) const;
+ COMMONAPI_EXPORT std::future<CallStatus> listNamesAsync(ListNamesAsyncCallback listNamesAsyncCallback) const;
- COMMONAPI_EXPORT void nameHasOwner(const std::string& busName, CommonAPI::CallStatus& callStatus, bool& hasOwner) const;
- COMMONAPI_EXPORT std::future<CallStatus> nameHasOwnerAsync(const std::string& busName,
+ 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;
- COMMONAPI_EXPORT std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName,
+ COMMONAPI_EXPORT std::future<CallStatus> getManagedObjectsAsync(const std::string& forDBusServiceName,
GetManagedObjectsAsyncCallback) const;
/**
diff --git a/include/CommonAPI/DBus/DBusDeployment.hpp b/include/CommonAPI/DBus/DBusDeployment.hpp
index dce9d21..c6ce15c 100644
--- a/include/CommonAPI/DBus/DBusDeployment.hpp
+++ b/include/CommonAPI/DBus/DBusDeployment.hpp
@@ -19,34 +19,32 @@
namespace CommonAPI {
namespace DBus {
-template<typename... _Types>
-struct VariantDeployment : CommonAPI::Deployment<_Types...> {
- VariantDeployment(bool _isDBus, _Types*... _t)
- : CommonAPI::Deployment<_Types...>(_t...),
- isDBus_(_isDBus) {};
-
- bool isDBus_;
+template<typename... Types_>
+struct VariantDeployment : CommonAPI::Deployment<Types_...> {
+ static const size_t size_ = std::tuple_size<std::tuple<Types_...>>::value;
+ VariantDeployment(bool _isDBus, Types_*... _t)
+ : CommonAPI::Deployment<Types_...>(_t...),
+ isDBus_(_isDBus) {};
+ bool isDBus_;
};
-extern COMMONAPI_IMPORT_EXPORT VariantDeployment<> freedesktopVariant;
-
struct StringDeployment : CommonAPI::Deployment<> {
- StringDeployment(bool _isObjectPath)
- : isObjectPath_(_isObjectPath) {};
+ StringDeployment(bool _isObjectPath)
+ : isObjectPath_(_isObjectPath) {};
- bool isObjectPath_;
+ bool isObjectPath_;
};
-template<typename... _Types>
-struct StructDeployment : CommonAPI::Deployment<_Types...> {
- StructDeployment(_Types*... t)
- : CommonAPI::Deployment<_Types...>(t...) {};
+template<typename... Types_>
+struct StructDeployment : CommonAPI::Deployment<Types_...> {
+ StructDeployment(Types_*... t)
+ : CommonAPI::Deployment<Types_...>(t...) {};
};
-template<typename _ElementDepl>
-struct ArrayDeployment : CommonAPI::ArrayDeployment<_ElementDepl> {
- ArrayDeployment(_ElementDepl *_element)
- : CommonAPI::ArrayDeployment<_ElementDepl>(_element) {}
+template<typename ElementDepl_>
+struct ArrayDeployment : CommonAPI::ArrayDeployment<ElementDepl_> {
+ ArrayDeployment(ElementDepl_ *_element)
+ : CommonAPI::ArrayDeployment<ElementDepl_>(_element) {}
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusError.hpp b/include/CommonAPI/DBus/DBusError.hpp
index 6e8f170..bd3a636 100644
--- a/include/CommonAPI/DBus/DBusError.hpp
+++ b/include/CommonAPI/DBus/DBusError.hpp
@@ -23,20 +23,20 @@ class DBusConnection;
class COMMONAPI_EXPORT DBusError {
public:
- DBusError();
- ~DBusError();
+ DBusError();
+ ~DBusError();
- operator bool() const;
+ operator bool() const;
- void clear();
+ void clear();
- std::string getName() const;
- std::string getMessage() const;
+ std::string getName() const;
+ std::string getMessage() const;
private:
- ::DBusError libdbusError_;
+ ::DBusError libdbusError_;
- friend class DBusConnection;
+ friend class DBusConnection;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusEvent.hpp b/include/CommonAPI/DBus/DBusEvent.hpp
index 3ce945c..550f4da 100644
--- a/include/CommonAPI/DBus/DBusEvent.hpp
+++ b/include/CommonAPI/DBus/DBusEvent.hpp
@@ -21,18 +21,18 @@
namespace CommonAPI {
namespace DBus {
-template <typename _Event, typename... _Arguments>
-class DBusEvent: public _Event, public DBusProxyConnection::DBusSignalHandler {
+template <typename Event_, typename... Arguments_>
+class DBusEvent: public Event_, public DBusProxyConnection::DBusSignalHandler {
public:
- typedef typename _Event::Subscription Subscription;
- typedef typename _Event::Listener Listener;
+ typedef typename Event_::Subscription Subscription;
+ typedef typename Event_::Listener Listener;
DBusEvent(DBusProxyBase &_proxy,
- const std::string &_name, const std::string &_signature,
- std::tuple<_Arguments...> _arguments)
- : proxy_(_proxy),
+ const std::string &_name, const std::string &_signature,
+ std::tuple<Arguments_...> _arguments)
+ : proxy_(_proxy),
name_(_name), signature_(_signature),
- getMethodName_(""),
+ getMethodName_(""),
arguments_(_arguments) {
interface_ = proxy_.getDBusAddress().getInterface();
@@ -40,53 +40,55 @@ public:
}
DBusEvent(DBusProxyBase &_proxy,
- const std::string &_name, const std::string &_signature,
- const std::string &_path, const std::string &_interface,
- std::tuple<_Arguments...> _arguments)
- : proxy_(_proxy),
+ const std::string &_name, const std::string &_signature,
+ const std::string &_path, const std::string &_interface,
+ std::tuple<Arguments_...> _arguments)
+ : proxy_(_proxy),
name_(_name), signature_(_signature),
path_(_path), interface_(_interface),
- getMethodName_(""),
+ getMethodName_(""),
arguments_(_arguments) {
}
DBusEvent(DBusProxyBase &_proxy,
- const std::string &_name,
- const std::string &_signature,
- const std::string &_getMethodName,
- std::tuple<_Arguments...> _arguments)
- : proxy_(_proxy),
- name_(_name),
- signature_(_signature),
- getMethodName_(_getMethodName),
- arguments_(_arguments) {
-
- interface_ = proxy_.getDBusAddress().getInterface();
- path_ = proxy_.getDBusAddress().getObjectPath();
- }
+ const std::string &_name,
+ const std::string &_signature,
+ const std::string &_getMethodName,
+ std::tuple<Arguments_...> _arguments)
+ : proxy_(_proxy),
+ name_(_name),
+ signature_(_signature),
+ getMethodName_(_getMethodName),
+ arguments_(_arguments) {
+
+ interface_ = proxy_.getDBusAddress().getInterface();
+ path_ = proxy_.getDBusAddress().getObjectPath();
+ }
virtual ~DBusEvent() {
proxy_.removeSignalMemberHandler(subscription_, this);
}
virtual void onSignalDBusMessage(const DBusMessage &_message) {
- handleSignalDBusMessage(_message, typename make_sequence<sizeof...(_Arguments)>::type());
+ handleSignalDBusMessage(_message, typename make_sequence<sizeof...(Arguments_)>::type());
}
virtual void onInitialValueSignalDBusMessage(const DBusMessage&_message, const uint32_t tag) {
- handleSignalDBusMessage(tag, _message, typename make_sequence<sizeof...(_Arguments)>::type());
+ handleSignalDBusMessage(tag, _message, typename make_sequence<sizeof...(Arguments_)>::type());
}
protected:
- virtual void onFirstListenerAdded(const Listener& listener) {
- subscription_ = proxy_.addSignalMemberHandler(
+ virtual void onFirstListenerAdded(const Listener &_listener) {
+ (void)_listener;
+ subscription_ = proxy_.addSignalMemberHandler(
path_, interface_, name_, signature_, getMethodName_, this, false);
}
- virtual void onListenerAdded(const Listener& listener, const Subscription subscription) {
- if ("" != getMethodName_) {
- proxy_.getCurrentValueForSignalListener(getMethodName_, this, subscription);
- }
+ virtual void onListenerAdded(const Listener &_listener, const Subscription subscription) {
+ (void)_listener;
+ if ("" != getMethodName_) {
+ proxy_.getCurrentValueForSignalListener(getMethodName_, this, subscription);
+ }
}
virtual void onLastListenerRemoved(const Listener&) {
@@ -97,23 +99,23 @@ public:
std::get<3>(subscription_) = "";
}
- template<int ... _Indices>
- inline void handleSignalDBusMessage(const DBusMessage &_message, index_sequence<_Indices...>) {
+ template<int ... Indices_>
+ inline void handleSignalDBusMessage(const DBusMessage &_message, index_sequence<Indices_...>) {
DBusInputStream input(_message);
if (DBusSerializableArguments<
- _Arguments...
- >::deserialize(input, std::get<_Indices>(arguments_)...)) {
- this->notifyListeners(std::get<_Indices>(arguments_)...);
+ Arguments_...
+ >::deserialize(input, std::get<Indices_>(arguments_)...)) {
+ this->notifyListeners(std::get<Indices_>(arguments_)...);
}
}
- template<int ... _Indices>
- inline void handleSignalDBusMessage(const uint32_t tag, const DBusMessage &_message, index_sequence<_Indices...>) {
+ template<int ... Indices_>
+ inline void handleSignalDBusMessage(const uint32_t tag, const DBusMessage &_message, index_sequence<Indices_...>) {
DBusInputStream input(_message);
if (DBusSerializableArguments<
- _Arguments...
- >::deserialize(input, std::get<_Indices>(arguments_)...)) {
- this->notifySpecificListener(tag, std::get<_Indices>(arguments_)...);
+ Arguments_...
+ >::deserialize(input, std::get<Indices_>(arguments_)...)) {
+ this->notifySpecificListener(tag, std::get<Indices_>(arguments_)...);
}
}
@@ -126,7 +128,7 @@ public:
std::string getMethodName_;
DBusProxyConnection::DBusSignalHandlerToken subscription_;
- std::tuple<_Arguments...> arguments_;
+ std::tuple<Arguments_...> arguments_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusFactory.hpp b/include/CommonAPI/DBus/DBusFactory.hpp
index 644e035..fda0129 100644
--- a/include/CommonAPI/DBus/DBusFactory.hpp
+++ b/include/CommonAPI/DBus/DBusFactory.hpp
@@ -26,79 +26,79 @@ class DBusStubAdapter;
typedef std::shared_ptr<DBusProxy>
(*ProxyCreateFunction)(const DBusAddress &_address,
- const std::shared_ptr<DBusProxyConnection> &_connection);
+ const std::shared_ptr<DBusProxyConnection> &_connection);
typedef std::shared_ptr<DBusStubAdapter>
(*StubAdapterCreateFunction) (const DBusAddress &_address,
- const std::shared_ptr<DBusProxyConnection> &_connection,
- const std::shared_ptr<StubBase> &_stub);
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const std::shared_ptr<StubBase> &_stub);
class Factory : public CommonAPI::Factory {
public:
- COMMONAPI_EXPORT static std::shared_ptr<Factory> get();
+ COMMONAPI_EXPORT static std::shared_ptr<Factory> get();
- COMMONAPI_EXPORT Factory();
- COMMONAPI_EXPORT virtual ~Factory();
+ COMMONAPI_EXPORT Factory();
+ COMMONAPI_EXPORT virtual ~Factory();
- COMMONAPI_EXPORT void registerProxyCreateMethod(const std::string &_address,
- ProxyCreateFunction _function);
+ COMMONAPI_EXPORT void registerProxyCreateMethod(const std::string &_address,
+ ProxyCreateFunction _function);
- COMMONAPI_EXPORT void registerStubAdapterCreateMethod(const std::string &_address,
- StubAdapterCreateFunction _function);
+ COMMONAPI_EXPORT void registerStubAdapterCreateMethod(const std::string &_address,
+ StubAdapterCreateFunction _function);
- COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- const ConnectionId_t &_connectionId);
+ COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ const ConnectionId_t &_connectionId);
- COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<MainLoopContext> _context);
+ COMMONAPI_EXPORT std::shared_ptr<Proxy> createProxy(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<MainLoopContext> _context);
- COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<StubBase> _stub,
- const ConnectionId_t &_connectionId);
+ COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ const ConnectionId_t &_connectionId);
- COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance,
- std::shared_ptr<StubBase> _stub,
- std::shared_ptr<MainLoopContext> _context);
+ COMMONAPI_EXPORT bool registerStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance,
+ std::shared_ptr<StubBase> _stub,
+ std::shared_ptr<MainLoopContext> _context);
- COMMONAPI_EXPORT bool unregisterStub(const std::string &_domain,
- const std::string &_interface,
- const std::string &_instance);
+ COMMONAPI_EXPORT bool unregisterStub(const std::string &_domain,
+ const std::string &_interface,
+ const std::string &_instance);
- // Services
- COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> getRegisteredService(const std::string &_address);
+ // Services
+ COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> getRegisteredService(const std::string &_address);
- // Managed services
- COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> createDBusStubAdapter(const std::shared_ptr<StubBase> &_stub,
- const std::string &_interface,
- const DBusAddress &_address,
- const std::shared_ptr<DBusProxyConnection> &_connection);
- COMMONAPI_EXPORT bool registerManagedService(const std::shared_ptr<DBusStubAdapter> &_adapter);
- COMMONAPI_EXPORT bool unregisterManagedService(const std::string &_address);
+ // Managed services
+ COMMONAPI_EXPORT std::shared_ptr<DBusStubAdapter> createDBusStubAdapter(const std::shared_ptr<StubBase> &_stub,
+ const std::string &_interface,
+ const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+ COMMONAPI_EXPORT bool registerManagedService(const std::shared_ptr<DBusStubAdapter> &_adapter);
+ COMMONAPI_EXPORT bool unregisterManagedService(const std::string &_address);
private:
- COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(const ConnectionId_t &);
- COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(std::shared_ptr<MainLoopContext>);
- COMMONAPI_EXPORT bool registerStubAdapter(std::shared_ptr<DBusStubAdapter>);
- COMMONAPI_EXPORT bool unregisterStubAdapter(std::shared_ptr<DBusStubAdapter>);
+ COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(const ConnectionId_t &);
+ COMMONAPI_EXPORT std::shared_ptr<DBusConnection> getConnection(std::shared_ptr<MainLoopContext>);
+ COMMONAPI_EXPORT bool registerStubAdapter(std::shared_ptr<DBusStubAdapter>);
+ COMMONAPI_EXPORT bool unregisterStubAdapter(std::shared_ptr<DBusStubAdapter>);
- // Managed services
- typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> ServicesMap;
- COMMONAPI_EXPORT bool unregisterManagedService(const ServicesMap::iterator &);
+ // Managed services
+ typedef std::unordered_map<std::string, std::shared_ptr<DBusStubAdapter>> ServicesMap;
+ COMMONAPI_EXPORT bool unregisterManagedService(const ServicesMap::iterator &);
private:
- static std::shared_ptr<Factory> theFactory;
+ static std::shared_ptr<Factory> theFactory;
- std::map<ConnectionId_t, std::shared_ptr<DBusConnection>> connections_;
- std::map<MainLoopContext *, std::shared_ptr<DBusConnection>> contextConnections_;
+ std::map<ConnectionId_t, std::shared_ptr<DBusConnection>> connections_;
+ std::map<MainLoopContext *, std::shared_ptr<DBusConnection>> contextConnections_;
std::map<std::string, ProxyCreateFunction> proxyCreateFunctions_;
std::map<std::string, StubAdapterCreateFunction> stubAdapterCreateFunctions_;
diff --git a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
index fd9237e..4f78f5c 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp
@@ -15,37 +15,38 @@
namespace CommonAPI {
namespace DBus {
-template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusFreedesktopReadonlyAttribute: public _AttributeType {
+template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusFreedesktopReadonlyAttribute: public AttributeType_ {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef _AttributeDepl ValueTypeDepl;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef AttributeDepl_ ValueTypeDepl;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
DBusFreedesktopReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName,
- _AttributeDepl *_depl = nullptr)
- : proxy_(_proxy),
+ AttributeDepl_ *_depl = nullptr)
+ : proxy_(_proxy),
interfaceName_(_interfaceName),
propertyName_(_propertyName),
depl_(_depl) {
}
void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ VariantDeployment<AttributeDepl_> actualDepl(true, depl_);
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedValue(&actualDepl);
DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string
- >,
DBusSerializableArguments<
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
- >
+ std::string, std::string
+ >,
+ DBusSerializableArguments<
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>>
+ >
>::callMethodWithReply(
- proxy_,
+ proxy_,
"org.freedesktop.DBus.Properties",
"Get",
"ss",
- (_info ? _info : &defaultCallInfo),
- interfaceName_,
+ (_info ? _info : &defaultCallInfo),
+ interfaceName_,
propertyName_,
_status,
deployedValue);
@@ -54,259 +55,173 @@ public:
}
std::future<CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant);
+ VariantDeployment<AttributeDepl_> actualDepl(true, depl_);
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedValue(&actualDepl);
return DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string
- >,
DBusSerializableArguments<
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
- >
- >::callMethodAsync(
- proxy_,
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- (_info ? _info : &defaultCallInfo),
- interfaceName_,
- propertyName_,
- [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> _value) {
- _callback(_status, _value.getValue().template get<ValueType>());
- },
- std::make_tuple(deployedValue)
- );
- }
-
-protected:
- DBusProxy &proxy_;
- std::string interfaceName_;
- std::string propertyName_;
- _AttributeDepl *depl_;
-};
-
-template <typename _AttributeType>
-class DBusFreedesktopUnionReadonlyAttribute: public _AttributeType {
-public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopUnionReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
- : proxy_(_proxy),
- interfaceName_(_interfaceName),
- propertyName_(_propertyName) {
- }
-
- void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const {
- CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant);
- DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string
- >,
- DBusSerializableArguments<
- CommonAPI::Deployable<ValueType, VariantDeployment<>>
- >
- >::callMethodWithReply(
- proxy_,
- "org.freedesktop.DBus.Properties",
- "Get",
- "ss",
- (_info ? _info : &defaultCallInfo),
- interfaceName_,
- propertyName_,
- _status,
- deployedValue);
-
- _value = deployedValue.getValue().template get<ValueType>();
- }
-
- std::future<CommonAPI::CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant);
- return DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string
- >,
+ std::string, std::string
+ >,
DBusSerializableArguments<
- CommonAPI::Deployable<ValueType, VariantDeployment<>>
- >
- >::callMethodAsync(
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>>
+ >
+ >::callMethodAsync(
proxy_,
- "org.freedesktop.DBus.Properties",
+ "org.freedesktop.DBus.Properties",
"Get",
"ss",
- (_info ? _info : &defaultCallInfo),
+ (_info ? _info : &defaultCallInfo),
interfaceName_,
propertyName_,
- [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) {
- _callback(_status, _value.getValue().template get<ValueType>());
- },
- std::make_tuple(deployedValue)
- );
+ [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> _value) {
+ _callback(_status, _value.getValue().template get<ValueType>());
+ },
+ std::make_tuple(deployedValue)
+ );
+ }
+ AttributeDepl_ *getDepl(void) {
+ return depl_;
}
-
protected:
DBusProxy &proxy_;
std::string interfaceName_;
std::string propertyName_;
+ AttributeDepl_ *depl_;
};
-template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
class DBusFreedesktopAttribute
- : public DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl> {
+ : public DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_> {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
- DBusFreedesktopAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, _AttributeDepl *_depl = nullptr)
- : DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>(_proxy, _interfaceName, _propertyName, _depl) {
+ DBusFreedesktopAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, AttributeDepl_ *_depl = nullptr)
+ : DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>(_proxy, _interfaceName, _propertyName, _depl) {
}
void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ VariantDeployment<AttributeDepl_> actualDepl(true, DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::depl_);
+ Variant<ValueType> reqVariant(_request);
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedVariant(reqVariant, &actualDepl);
DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
- >,
DBusSerializableArguments<
- >
+ std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>>
+ >,
+ DBusSerializableArguments<
+ >
>::callMethodWithReply(
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::proxy_,
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- (_info ? _info : &defaultCallInfo),
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::propertyName_,
- deployedVariant,
- _status);
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::propertyName_,
+ deployedVariant,
+ _status);
_response = _request;
}
std::future<CommonAPI::CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
+ VariantDeployment<AttributeDepl_> actualDepl(true, DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::depl_);
+ Variant<ValueType> reqVariant(_request);
+ CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedVariant(reqVariant, &actualDepl);
return DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>>
- >,
DBusSerializableArguments<
- >
- >::callMethodAsync(
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::proxy_,
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- (_info ? _info : &defaultCallInfo),
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::propertyName_,
- deployedVariant,
- [_callback, deployedVariant](CommonAPI::CallStatus _status) {
- _callback(_status, deployedVariant.getValue().template get<ValueType>());
- },
- std::tuple<>());
- }
-};
-
-template <typename _AttributeType>
-class DBusFreedesktopUnionAttribute
- : public DBusFreedesktopReadonlyAttribute<_AttributeType> {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
-
- DBusFreedesktopUnionAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
- : DBusFreedesktopUnionReadonlyAttribute<_AttributeType>(_proxy, _interfaceName, _propertyName) {
- }
-
- void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
- DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>>
- >,
- DBusSerializableArguments<
- >
- >::callMethodWithReply(
- DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- (_info ? _info : &defaultCallInfo),
- DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
- deployedVariant,
- _status);
- _response = _request;
- }
-
- std::future<CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) {
- CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant);
- return DBusProxyHelper<
- DBusSerializableArguments<
- std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>>
- >,
+ std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>>
+ >,
DBusSerializableArguments<
- >
- >::callMethodAsync(
- DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_,
- "org.freedesktop.DBus.Properties",
- "Set",
- "ssv",
- (_info ? _info : &defaultCallInfo),
- DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_,
- DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_,
- deployedVariant,
- [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) {
- _callback(_status, _value.getValue().template get<ValueType>());
- },
- std::make_tuple(deployedVariant));
+ >
+ >::callMethodAsync(
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::proxy_,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ "ssv",
+ (_info ? _info : &defaultCallInfo),
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::interfaceName_,
+ DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::propertyName_,
+ deployedVariant,
+ [_callback, deployedVariant](CommonAPI::CallStatus _status) {
+ _callback(_status, deployedVariant.getValue().template get<ValueType>());
+ },
+ std::tuple<>());
}
};
-template<class, class>
+template<class, class, class>
class LegacyEvent;
-
-template <template <class...> class _Type, class _Types, class _Variant>
-class LegacyEvent<_Type<_Types>, _Variant>: public _Type<_Types> {
+template <template <class...> class Type_, class Types_, class DataType_, class DataDeplType_>
+class LegacyEvent<Type_<Types_>, DataType_, DataDeplType_>: public Type_<Types_>,
+ public DBusProxyConnection::DBusSignalHandler {
public:
- typedef _Types ValueType;
- typedef typename _Type<ValueType>::Listener Listener;
- typedef std::unordered_map<std::string, _Variant> PropertyMap;
- typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment;
+ typedef Types_ ValueType;
+ typedef typename Type_<ValueType>::Listener Listener;
+ typedef std::unordered_map<std::string, Variant<DataType_>> PropertyMap;
+ typedef MapDeployment<EmptyDeployment, VariantDeployment<DataDeplType_>> PropertyMapDeployment;
typedef Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap;
typedef std::vector<std::string> InvalidArray;
typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent;
+ typedef typename Type_<ValueType>::Subscription Subscription;
- LegacyEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
- : interfaceName_(_interfaceName),
- propertyName_(_propertyName),
- isSubcriptionSet_(false),
- internalEvent_(_proxy,
- "PropertiesChanged",
- "sa{sv}as",
- _proxy.getDBusAddress().getObjectPath(),
- "org.freedesktop.DBus.Properties",
- std::make_tuple("", getDeployedMap(), InvalidArray())) {
+ LegacyEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, DataDeplType_ *_depl)
+ : interfaceName_(_interfaceName),
+ propertyName_(_propertyName),
+ variantDepl_(true, _depl),
+ mapDepl_(nullptr, &variantDepl_),
+ deployedMap_(&mapDepl_),
+ proxy_(_proxy),
+ isSubcriptionSet_(false),
+ internalEvent_(_proxy,
+ "PropertiesChanged",
+ "sa{sv}as",
+ _proxy.getDBusAddress().getObjectPath(),
+ "org.freedesktop.DBus.Properties",
+ std::make_tuple("", deployedMap_, InvalidArray())) {
}
protected:
void onFirstListenerAdded(const Listener &) {
- if (!isSubcriptionSet_) {
- subscription_ = internalEvent_.subscribe(
- [this](const std::string &_interfaceName,
- const PropertyMap &_properties,
- const InvalidArray &_invalid) {
- if (interfaceName_ == _interfaceName) {
- auto iter = _properties.find(propertyName_);
- if (iter != _properties.end()) {
- const ValueType &value = iter->second.template get<ValueType>();
- this->notifyListeners(value);
- }
- }
- });
+ if (!isSubcriptionSet_) {
+ subscription_ = internalEvent_.subscribe(
+ [this](const std::string &_interfaceName,
+ const PropertyMap &_properties,
+ const InvalidArray &_invalid) {
+ (void)_invalid;
+ if (interfaceName_ == _interfaceName) {
+ auto iter = _properties.find(propertyName_);
+ if (iter != _properties.end()) {
+ const ValueType &value = iter->second.template get<ValueType>();
+ this->notifyListeners(value);
+ }
+ }
+ });
+
+ isSubcriptionSet_ = true;
+ }
+ }
- isSubcriptionSet_ = true;
- }
+ virtual void onListenerAdded(const Listener& listener, const Subscription subscription) {
+ (void)listener;
+ proxy_.freeDesktopGetCurrentValueForSignalListener(this, subscription, interfaceName_, propertyName_);
}
+ virtual void onInitialValueSignalDBusMessage(const DBusMessage&_message, const uint32_t tag) {
+ CommonAPI::Deployable<Variant<DataType_>, VariantDeployment<DataDeplType_>> deployedValue(&variantDepl_);
+ DBusInputStream input(_message);
+ if (DBusSerializableArguments<
+ CommonAPI::Deployable<
+ Variant<DataType_>,
+ VariantDeployment<DataDeplType_>
+ >
+ >::deserialize(input, deployedValue)) {
+ Variant<DataType_> v = deployedValue.getValue();
+ const DataType_ &value = v.template get<DataType_>();
+ this->notifySpecificListener(tag, value);
+ }
+ }
+ virtual void onSignalDBusMessage(const DBusMessage&) {
+ // ignore
+ }
void onLastListenerRemoved(const Listener &) {
if (isSubcriptionSet_) {
internalEvent_.unsubscribe(subscription_);
@@ -316,36 +231,33 @@ protected:
std::string interfaceName_;
std::string propertyName_;
+ VariantDeployment<DataDeplType_> variantDepl_;
+ PropertyMapDeployment mapDepl_;
+ DeployedPropertyMap deployedMap_;
+ DBusProxy &proxy_;
typename DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray>::Subscription subscription_;
bool isSubcriptionSet_;
DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray> internalEvent_;
-
-private:
- static DeployedPropertyMap &getDeployedMap() {
- static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant);
- static DeployedPropertyMap itsDeployedMap(&itsDeployment);
- return itsDeployedMap;
- }
};
-template <typename _AttributeType, typename _Variant>
-class DBusFreedesktopObservableAttribute: public _AttributeType {
+template <typename AttributeType_>
+class DBusFreedesktopObservableAttribute: public AttributeType_ {
public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
-
- template <typename... _AttributeTypeArguments>
+ typedef typename AttributeType_::ValueType ValueType;
+ typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback;
+ typedef typename AttributeType_::ChangedEvent ChangedEvent;
+ typedef typename AttributeType_::ValueTypeDepl ValueTypeDepl;
+ template <typename... AttributeType_Arguments>
DBusFreedesktopObservableAttribute(DBusProxy &_proxy,
- const std::string &_interfaceName,
- const std::string &_propertyName,
- _AttributeTypeArguments... _arguments)
- : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...),
- interfaceName_(_interfaceName),
- propertyName_(_propertyName),
- externalChangedEvent_(_proxy, _interfaceName, _propertyName) {
+ const std::string &_interfaceName,
+ const std::string &_propertyName,
+ AttributeType_Arguments... _arguments)
+ : AttributeType_(_proxy, _interfaceName, _propertyName, _arguments...),
+ interfaceName_(_interfaceName),
+ propertyName_(_propertyName),
+ externalChangedEvent_(_proxy, _interfaceName, _propertyName, AttributeType_::getDepl()) {
}
ChangedEvent &getChangedEvent() {
@@ -355,98 +267,7 @@ class DBusFreedesktopObservableAttribute: public _AttributeType {
protected:
std::string interfaceName_;
std::string propertyName_;
- LegacyEvent<ChangedEvent, _Variant> externalChangedEvent_;
-};
-
-template<class, class>
-class LegacyUnionEvent;
-
-template <template <class...> class _Type, class _Types, class _Variant>
-class LegacyUnionEvent<_Type<_Types>, _Variant>: public _Type<_Types> {
-public:
- typedef _Types ValueType;
- typedef typename _Type<ValueType>::Listener Listener;
- typedef std::unordered_map<std::string, _Variant> PropertyMap;
- typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment;
- typedef CommonAPI::Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap;
- typedef std::vector<std::string> InvalidArray;
- typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent;
-
- LegacyUnionEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName)
- : interfaceName_(_interfaceName),
- propertyName_(_propertyName),
- isSubcriptionSet_(false),
- internalEvent_(_proxy,
- "PropertiesChanged",
- "sa{sv}as",
- _proxy.getDBusAddress().getObjectPath(),
- "org.freedesktop.DBus.Properties",
- std::make_tuple("", getDeployedMap(), InvalidArray())) {
- }
-
-protected:
- void onFirstListenerAdded(const Listener &) {
- if (isSubcriptionSet_) {
- subscription_ = internalEvent_.subscribe(
- [this](const std::string &_interfaceName,
- const PropertyMap &_properties,
- const std::vector<std::string> &_invalid) {
- if (interfaceName_ == _interfaceName) {
- auto iter = _properties.find(propertyName_);
- if (iter != _properties.end()) {
- this->notifyListeners(iter->second.template get<ValueType>());
- }
- }
- });
- isSubcriptionSet_ = true;
- }
- }
-
- void onLastListenerRemoved(const Listener &) {
- if (isSubcriptionSet_) {
- internalEvent_.unsubscribe(subscription_);
- isSubcriptionSet_ = false;
- }
- }
-
- DBusEvent<SignalEvent, ValueType> internalEvent_;
- std::string interfaceName_;
- std::string propertyName_;
-
- typename DBusEvent<SignalEvent>::Subscription subscription_;
- bool isSubcriptionSet_;
-
-private:
- static DeployedPropertyMap &getDeployedMap() {
- static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant);
- static DeployedPropertyMap itsDeployedMap(&itsDeployment);
- return itsDeployedMap;
- }
-};
-
-template <typename _AttributeType, typename _Variant>
-class DBusFreedesktopUnionObservableAttribute: public _AttributeType {
- public:
- typedef typename _AttributeType::ValueType ValueType;
- typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback;
- typedef typename _AttributeType::ChangedEvent ChangedEvent;
-
- template <typename... _AttributeTypeArguments>
- DBusFreedesktopUnionObservableAttribute(DBusProxy &_proxy,
- const std::string &_interfaceName,
- const std::string &_propertyName,
- _AttributeTypeArguments... _arguments)
- : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...),
- externalChangedEvent_(_proxy, _interfaceName, _propertyName) {
- }
-
- ChangedEvent &getChangedEvent() {
- return externalChangedEvent_;
- }
-
- protected:
- LegacyUnionEvent<ChangedEvent, _Variant> externalChangedEvent_;
-};
+ LegacyEvent<ChangedEvent, ValueType, ValueTypeDepl> externalChangedEvent_;};
} // namespace DBus
} // namespace CommonAPI
diff --git a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
index f7e2cdf..1c01da9 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopPropertiesStub.hpp
@@ -40,7 +40,7 @@ public:
virtual const char* getMethodsDBusIntrospectionXmlData() const;
virtual bool onInterfaceDBusMessage(const DBusMessage &_message);
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
private:
std::string path_;
diff --git a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
index bfe2493..4593400 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopStubAdapterHelper.hpp
@@ -16,48 +16,50 @@
namespace CommonAPI {
namespace DBus {
-template <typename _StubClass>
+template <typename StubClass_>
class DBusGetFreedesktopAttributeStubDispatcherBase {
public:
virtual ~DBusGetFreedesktopAttributeStubDispatcherBase() {}
virtual void dispatchDBusMessageAndAppendReply(const DBusMessage &_message,
- const std::shared_ptr<_StubClass> &_stub,
- DBusOutputStream &_output,
- const std::shared_ptr<DBusClientId> &_clientId) = 0;
+ const std::shared_ptr<StubClass_> &_stub,
+ DBusOutputStream &_output,
+ const std::shared_ptr<DBusClientId> &_clientId) = 0;
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
class DBusGetFreedesktopAttributeStubDispatcher
- : public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>,
- public virtual DBusGetFreedesktopAttributeStubDispatcherBase<_StubClass> {
+ : public virtual DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>,
+ public virtual DBusGetFreedesktopAttributeStubDispatcherBase<StubClass_> {
public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
+ typedef DBusStubAdapterHelper<StubClass_> DBusStubAdapterHelperType;
+ typedef typename DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
- DBusGetFreedesktopAttributeStubDispatcher(GetStubFunctor _getStubFunctor, _AttributeDepl *_depl = nullptr)
- : DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, "v", _depl) {
+ DBusGetFreedesktopAttributeStubDispatcher(GetStubFunctor _getStubFunctor, AttributeDepl_ *_depl = nullptr)
+ : DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, "v", _depl) {
}
virtual ~DBusGetFreedesktopAttributeStubDispatcher() {};
void dispatchDBusMessageAndAppendReply(const DBusMessage &_message,
- const std::shared_ptr<_StubClass> &_stub,
- DBusOutputStream &_output,
- const std::shared_ptr<DBusClientId> &_clientId) {
- CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<>> deployedVariant(
- (_stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::getStubFunctor_))(_clientId), &freedesktopVariant);
+ const std::shared_ptr<StubClass_> &_stub,
+ DBusOutputStream &_output,
+ const std::shared_ptr<DBusClientId> &_clientId) {
+ (void)_message;
+ VariantDeployment<AttributeDepl_> actualDepl(true, DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::depl_);
+ CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, VariantDeployment<AttributeDepl_>> deployedVariant(
+ (_stub.get()->*(DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::getStubFunctor_))(_clientId), &actualDepl);
_output << deployedVariant;
}
protected:
- virtual bool sendAttributeValueReply(const DBusMessage &_message, const std::shared_ptr<_StubClass> &_stub, DBusStubAdapterHelperType &_helper) {
- DBusMessage reply = _message.createMethodReturn(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::signature_);
+ virtual bool sendAttributeValueReply(const DBusMessage &_message, const std::shared_ptr<StubClass_> &_stub, DBusStubAdapterHelperType &_helper) {
+ DBusMessage reply = _message.createMethodReturn(DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::signature_);
- VariantDeployment<_AttributeDepl> actualDepl(true, DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::depl_);
+ VariantDeployment<AttributeDepl_> actualDepl(true, DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::depl_);
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(_message.getSender()));
- CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<_AttributeDepl>> deployedVariant(
- (_stub.get()->*(DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::getStubFunctor_))(clientId), &actualDepl);
+ CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, VariantDeployment<AttributeDepl_>> deployedVariant(
+ (_stub.get()->*(DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::getStubFunctor_))(clientId), &actualDepl);
DBusOutputStream output(reply);
output << deployedVariant;
@@ -67,120 +69,120 @@ protected:
}
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
class DBusSetFreedesktopAttributeStubDispatcher
- : public virtual DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>,
- public virtual DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
+ : public virtual DBusGetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>,
+ public virtual DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_> {
public:
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
+ typedef typename DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
typedef typename DBusStubAdapterHelperType::RemoteEventHandlerType RemoteEventHandlerType;
- typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, _AttributeType);
+ typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, AttributeType_);
typedef void (RemoteEventHandlerType::*OnRemoteChangedFunctor)();
DBusSetFreedesktopAttributeStubDispatcher(
- GetStubFunctor _getStubFunctor,
- OnRemoteSetFunctor _onRemoteSetFunctor,
+ GetStubFunctor _getStubFunctor,
+ OnRemoteSetFunctor _onRemoteSetFunctor,
OnRemoteChangedFunctor _onRemoteChangedFunctor,
- _AttributeDepl * _depl = nullptr)
- : DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, "v", _depl),
- DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _depl),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, "v", _depl) {
+ AttributeDepl_ * _depl = nullptr)
+ : DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, "v", _depl),
+ DBusGetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _depl),
+ DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, "v", _depl) {
}
virtual ~DBusSetFreedesktopAttributeStubDispatcher() {};
protected:
- virtual _AttributeType retrieveAttributeValue(const DBusMessage &_message, bool &_error) {
+ virtual AttributeType_ retrieveAttributeValue(const DBusMessage &_message, bool &_error) {
std::string interfaceName, attributeName;
DBusInputStream input(_message);
- CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, VariantDeployment<>> deployedVariant(&freedesktopVariant);
+ VariantDeployment<AttributeDepl_> actualDepl(true, DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::depl_);
+ CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, VariantDeployment<AttributeDepl_>> deployedVariant(&actualDepl);
input >> interfaceName; // skip over interface and attribute name
input >> attributeName;
input >> deployedVariant;
_error = input.hasError();
- _AttributeType attributeValue = deployedVariant.getValue().template get<_AttributeType>() ;
+ AttributeType_ attributeValue = deployedVariant.getValue().template get<AttributeType_>() ;
return attributeValue;
}
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
class DBusSetFreedesktopObservableAttributeStubDispatcher
- : public virtual DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>,
- public virtual DBusSetObservableAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
+ : public virtual DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>,
+ public virtual DBusSetObservableAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_> {
public:
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
typedef typename DBusStubAdapterHelperType::StubAdapterType StubAdapterType;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteSetFunctor OnRemoteSetFunctor;
- typedef typename DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
- typedef void (StubAdapterType::*FireChangedFunctor)(const _AttributeType&);
+ typedef typename DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
+ typedef typename DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteSetFunctor OnRemoteSetFunctor;
+ typedef typename DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
+ typedef void (StubAdapterType::*FireChangedFunctor)(const AttributeType_&);
DBusSetFreedesktopObservableAttributeStubDispatcher(
- GetStubFunctor _getStubFunctor,
+ GetStubFunctor _getStubFunctor,
OnRemoteSetFunctor _onRemoteSetFunctor,
OnRemoteChangedFunctor _onRemoteChangedFunctor,
FireChangedFunctor _fireChangedFunctor,
- _AttributeDepl *_depl = nullptr)
- : DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, "v", _depl),
- DBusGetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _depl),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, "v", _depl),
- DBusSetFreedesktopAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, _depl),
- DBusSetObservableAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, _fireChangedFunctor, "v", _depl) {
+ AttributeDepl_ *_depl = nullptr)
+ : DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, "v", _depl),
+ DBusGetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _depl),
+ DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, "v", _depl),
+ DBusSetFreedesktopAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, _depl),
+ DBusSetObservableAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(_getStubFunctor, _onRemoteSetFunctor, _onRemoteChangedFunctor, _fireChangedFunctor, "v", _depl) {
}
};
-template<class>
+template<typename, typename>
struct DBusStubFreedesktopPropertiesSignalHelper;
-template<template<class ...> class _In, class _InArg>
-struct DBusStubFreedesktopPropertiesSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArg>> {
+template<typename DataType_, typename DeplType_>
+struct DBusStubFreedesktopPropertiesSignalHelper {
- template <typename _ValueType>
+ template <typename ValueType_>
struct DBusPropertiesEntry
- : public CommonAPI::Struct<std::string, CommonAPI::Variant<_ValueType>> {
+ : public CommonAPI::Struct<std::string, CommonAPI::Variant<ValueType_>> {
- DBusPropertiesEntry() = default;
+ DBusPropertiesEntry() = default;
DBusPropertiesEntry(const std::string &_propertyName,
- const _ValueType &_propertyValue) {
- std::get<0>(this->values_) = _propertyName;
- std::get<1>(this->values_) = _propertyValue;
+ 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; }
+ 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<_InArg>> PropertiesArray;
- typedef CommonAPI::Deployment<CommonAPI::EmptyDeployment, VariantDeployment<>> PropertyDeployment;
- typedef CommonAPI::ArrayDeployment<PropertyDeployment> PropertiesDeployment;
- typedef CommonAPI::Deployable<PropertiesArray, PropertiesDeployment> DeployedPropertiesArray;
+ 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;
- template <typename _StubClass>
- static bool sendPropertiesChangedSignal(const _StubClass &_stub, const std::string &_propertyName, const _InArg &_inArg) {
+ 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<_InArg> entry(_propertyName, _inArg);
+ DBusPropertiesEntry<DataType_> entry(_propertyName, _inArg);
changedProperties.push_back(entry);
- PropertyDeployment propertyDeployment(nullptr, &freedesktopVariant);
+ VariantDeployment<DeplType_> actualDepl(true, _depl);
+ PropertyDeployment propertyDeployment(nullptr, &actualDepl);
PropertiesDeployment changedPropertiesDeployment(&propertyDeployment);
DeployedPropertiesArray deployedChangedProperties(changedProperties, &changedPropertiesDeployment);
return DBusStubSignalHelper<
- _In<
- DBusInputStream,
- DBusOutputStream,
- const std::string,
- DeployedPropertiesArray,
- std::vector<std::string>
- >
- >::sendSignal(
- _stub.getDBusAddress().getObjectPath().c_str(),
+ DBusSerializableArguments<
+ const std::string,
+ DeployedPropertiesArray,
+ std::vector<std::string>
+ >
+ >::sendSignal(
+ _stub.getDBusAddress().getObjectPath().c_str(),
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
"sa{sv}as",
diff --git a/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp
index 31490d2..243604e 100644
--- a/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp
+++ b/include/CommonAPI/DBus/DBusFreedesktopVariant.hpp
@@ -14,58 +14,65 @@
namespace CommonAPI {
namespace DBus {
-
-template<class Visitor, class Variant, typename ... _Types>
+template<class Visitor_, class Variant_, class Deployment_, typename ... Types_>
struct ApplyTypeCompareVisitor;
-template<class Visitor, class Variant>
-struct ApplyTypeCompareVisitor<Visitor, Variant> {
+template<class Visitor_, class Variant_, class Deployment_>
+struct ApplyTypeCompareVisitor<Visitor_, Variant_, Deployment_> {
static const uint8_t index = 0;
- static uint8_t visit(Visitor&, const Variant&) {
- // won't be called if the variant contains the requested type
- assert(false);
- return 0;
+ static bool visit(Visitor_&, const Variant_&, const Deployment_ *_depl, uint8_t &typeindex) {
+ (void)_depl;
+ // will be called only if the variant does not contain the requested type
+ typeindex = index;
+ return false;
}
};
-template<class Visitor, class Variant, typename _Type, typename ... _Types>
-struct ApplyTypeCompareVisitor<Visitor, Variant, _Type, _Types...> {
+template<class Visitor_, class Variant_, class Deployment_, typename Type_, typename ... Types_>
+struct ApplyTypeCompareVisitor<Visitor_, Variant_, Deployment_, Type_, Types_...> {
static const uint8_t index
- = ApplyTypeCompareVisitor<Visitor, Variant, _Types...>::index + 1;
+ = ApplyTypeCompareVisitor<Visitor_, Variant_, Deployment_, Types_...>::index + 1;
- static uint8_t visit(Visitor &_visitor, const Variant &_variant) {
+ static bool visit(Visitor_ &_visitor, const Variant_ &_variant, const Deployment_ *_depl, uint8_t &typeindex) {
DBusTypeOutputStream output;
- _Type current;
- output.writeType(current);
+ Type_ current;
+
+ if ((0 < Deployment_::size_) && (_depl)) {
+ output.writeType(current, std::get<Deployment_::size_-index>(_depl->values_));
+ }
+ else {
+ output.writeType(current, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
+ }
+
#ifdef WIN32
- if (_visitor.operator()<_Type>(output.getSignature())) {
+ if (_visitor.operator()<Type_>(output.getSignature())) {
#else
- if (_visitor.template operator()<_Type>(output.getSignature())) {
+ if (_visitor.template operator()<Type_>(output.getSignature())) {
#endif
- return index;
+ typeindex = index;
+ return true;
} else {
return ApplyTypeCompareVisitor<
- Visitor, Variant, _Types...
- >::visit(_visitor, _variant);
+ Visitor_, Variant_, Deployment_, Types_...
+ >::visit(_visitor, _variant, _depl, typeindex);
}
}
};
-
-template<typename ... _Types>
+template<typename ... Types_>
struct TypeCompareVisitor {
public:
- TypeCompareVisitor(const std::string &_type)
- : type_(_type) {
- }
+ TypeCompareVisitor(const std::string &_type)
+ : type_(_type) {
+ }
- template<typename _Type>
- bool operator()(const std::string &_type) const {
- return (_type == type_);
- }
+ template<typename Type_>
+ bool operator()(const std::string &_type) const {
+ return (_type == type_);
+ }
private:
- const std::string type_;
+ const std::string type_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusFunctionalHash.hpp b/include/CommonAPI/DBus/DBusFunctionalHash.hpp
index 78848c7..4903c21 100644
--- a/include/CommonAPI/DBus/DBusFunctionalHash.hpp
+++ b/include/CommonAPI/DBus/DBusFunctionalHash.hpp
@@ -20,56 +20,56 @@ namespace std {
template<>
struct COMMONAPI_EXPORT hash<pair<const char*, const char*> >
- : public unary_function<pair<const char*, const char*>, size_t> {
+ : public unary_function<pair<const char*, const char*>, size_t> {
size_t operator()(const pair<const char*, const char*>& t) const;
};
template<>
struct COMMONAPI_EXPORT hash<const char*>
- : public unary_function<const char*, size_t> {
+ : public unary_function<const char*, size_t> {
size_t operator()(const char* const t) const;
};
template<>
struct COMMONAPI_EXPORT hash<pair<string, string> >
- : public unary_function<pair<string, string>, size_t> {
+ : public unary_function<pair<string, string>, size_t> {
size_t operator()(const pair<string, string>& t) const;
};
template<>
struct COMMONAPI_EXPORT hash<tuple<string, string, string> >
- : public unary_function<tuple<string, string, string>, size_t> {
+ : public unary_function<tuple<string, string, string>, size_t> {
size_t operator()(const tuple<string, string, string>& t) const;
};
template<>
struct COMMONAPI_EXPORT hash<tuple<string, string, string, bool> >
- : public unary_function<tuple<string, string, string, bool>, size_t> {
+ : public unary_function<tuple<string, string, string, bool>, size_t> {
size_t operator()(const tuple<string, string, string, bool>& t) const;
};
template<>
struct COMMONAPI_EXPORT hash<tuple<string, string, string, int> >
- : public unary_function<tuple<string, string, string, int>, size_t> {
+ : public unary_function<tuple<string, string, string, int>, size_t> {
size_t operator()(const tuple<string, string, string, int>& t) const;
};
template<>
struct COMMONAPI_EXPORT hash<tuple<string, string, string, string> >
- : public std::unary_function<tuple<string, string, string, string>, size_t> {
+ : public std::unary_function<tuple<string, string, string, string>, size_t> {
size_t operator()(const tuple<string, string, string, string>& t) const;
};
template<>
struct COMMONAPI_EXPORT equal_to<pair<const char*, const char*> >
- : public binary_function<pair<const char*, const char*>,
+ : public binary_function<pair<const char*, const char*>,
pair<const char*, const char*>,
bool> {
diff --git a/include/CommonAPI/DBus/DBusHelper.hpp b/include/CommonAPI/DBus/DBusHelper.hpp
index 53a5625..889cf53 100644
--- a/include/CommonAPI/DBus/DBusHelper.hpp
+++ b/include/CommonAPI/DBus/DBusHelper.hpp
@@ -20,34 +20,34 @@ template <int ...>
struct index_sequence {};
-template <int N, int ...S>
-struct make_sequence : make_sequence<N-1, N-1, S...> {};
+template <int N_, int ...S_>
+struct make_sequence : make_sequence<N_-1, N_-1, S_...> {};
-template <int ...S>
-struct make_sequence<0, S...> {
- typedef index_sequence<S...> type;
+template <int ...S_>
+struct make_sequence<0, S_...> {
+ typedef index_sequence<S_...> type;
};
-template <int N, int _Offset, int ...S>
-struct make_sequence_range : make_sequence_range<N-1, _Offset, N-1+_Offset, S...> {};
+template <int N_, int Offset_, int ...S_>
+struct make_sequence_range : make_sequence_range<N_-1, Offset_, N_-1+Offset_, S_...> {};
-template <int _Offset, int ...S>
-struct make_sequence_range<0, _Offset, S...> {
- typedef index_sequence<S...> type;
+template <int Offset_, int ...S_>
+struct make_sequence_range<0, Offset_, S_...> {
+ typedef index_sequence<S_...> type;
};
-template<typename _Type>
+template<typename Type>
struct is_std_vector { static const bool value = false; };
-template<typename _Type>
-struct is_std_vector<std::vector<_Type> > { static const bool value = true; };
+template<typename Type_>
+struct is_std_vector<std::vector<Type_> > { static const bool value = true; };
-template<typename _Type>
+template<typename Type_>
struct is_std_unordered_map { static const bool value = false; };
-template<typename _Key, typename _Value, typename _Hash>
-struct is_std_unordered_map<std::unordered_map<_Key, _Value, _Hash>> { static const bool value = true; };
+template<typename KeyType_, typename ValueType_, typename HasherType_>
+struct is_std_unordered_map<std::unordered_map<KeyType_, ValueType_, HasherType_>> { static const bool value = true; };
} // namespace DBus
} // namespace CommonAPI
diff --git a/include/CommonAPI/DBus/DBusInputStream.hpp b/include/CommonAPI/DBus/DBusInputStream.hpp
index 4f00cec..b4c81d1 100644
--- a/include/CommonAPI/DBus/DBusInputStream.hpp
+++ b/include/CommonAPI/DBus/DBusInputStream.hpp
@@ -42,272 +42,282 @@ typedef uint32_t position_t;
* (this operator is predefined for all basic data types and for vectors).
*/
class DBusInputStream
- : public InputStream<DBusInputStream> {
+ : public InputStream<DBusInputStream> {
public:
- COMMONAPI_EXPORT bool hasError() const {
+ COMMONAPI_EXPORT bool hasError() const {
return isErrorSet();
}
- COMMONAPI_EXPORT InputStream &readValue(bool &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(bool &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(int8_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(int16_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(int32_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(int64_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int8_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int16_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int32_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(int64_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(uint8_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(uint16_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(uint32_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(uint64_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint8_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint16_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint32_t &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(uint64_t &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(float &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(double &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(float &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(double &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(std::string &_value, const EmptyDeployment *_depl);
+ COMMONAPI_EXPORT InputStream &readValue(std::string &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(std::string &_value, const CommonAPI::DBus::StringDeployment* _depl) {
- return readValue(_value, static_cast<EmptyDeployment *>(nullptr));
- }
+ COMMONAPI_EXPORT InputStream &readValue(std::string &_value, const CommonAPI::DBus::StringDeployment* _depl) {
+ (void)_depl;
+ return readValue(_value, static_cast<EmptyDeployment *>(nullptr));
+ }
+
+ COMMONAPI_EXPORT InputStream &readValue(Version &_value, const EmptyDeployment *_depl);
- COMMONAPI_EXPORT InputStream &readValue(Version &_value, const EmptyDeployment *_depl);
-
- COMMONAPI_EXPORT void beginReadMapOfSerializableStructs() {
- uint32_t itsSize;
- _readValue(itsSize);
- pushSize(itsSize);
- align(8); /* correct alignment for first DICT_ENTRY */
- pushPosition();
- }
-
- COMMONAPI_EXPORT bool readMapCompleted() {
- return (sizes_.top() <= (current_ - positions_.top()));
- }
-
- COMMONAPI_EXPORT void endReadMapOfSerializableStructs() {
- (void)popSize();
- (void)popPosition();
- }
-
- COMMONAPI_EXPORT InputStream &skipMap() {
- uint32_t itsSize;
- _readValue(itsSize);
- align(8); /* skip padding (if any) */
- assert(itsSize <= (sizes_.top() + positions_.top() - current_));
- _readRaw(itsSize);
- return (*this);
- }
-
- template<class _Deployment, typename _Base>
- COMMONAPI_EXPORT InputStream &readValue(Enumeration<_Base> &_value, const _Deployment *_depl) {
- _Base tmpValue;
- readValue(tmpValue, _depl);
- _value = tmpValue;
- return (*this);
+ COMMONAPI_EXPORT void beginReadMapOfSerializableStructs() {
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
+ align(8); /* correct alignment for first DICT_ENTRY */
+ pushPosition();
}
- template<class _Deployment, typename... _Types>
- COMMONAPI_EXPORT InputStream &readValue(Struct<_Types...> &_value, const _Deployment *_depl) {
- align(8);
- const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
- StructReader<itsSize-1, DBusInputStream, Struct<_Types...>, _Deployment>{}(
- (*this), _value, _depl);
- return (*this);
+ COMMONAPI_EXPORT bool readMapCompleted() {
+ return (sizes_.top() <= (current_ - positions_.top()));
}
- template<class _Deployment, class _PolymorphicStruct>
- COMMONAPI_EXPORT InputStream &readValue(std::shared_ptr<_PolymorphicStruct> &_value,
- const _Deployment *_depl) {
- uint32_t serial;
- align(8);
- _readValue(serial);
- skipSignature();
- align(8);
- if (!hasError()) {
- _value = _PolymorphicStruct::create(serial);
- _value->template readValue<>(*this, _depl);
- }
-
- return (*this);
+ COMMONAPI_EXPORT void endReadMapOfSerializableStructs() {
+ (void)popSize();
+ (void)popPosition();
}
- template<typename... _Types>
- COMMONAPI_EXPORT InputStream &readValue(Variant<_Types...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
- if(_value.hasValue()) {
- DeleteVisitor<_value.maxSize> visitor(_value.valueStorage_);
- ApplyVoidVisitor<DeleteVisitor<_value.maxSize>,
- Variant<_Types...>, _Types... >::visit(visitor, _value);
- }
+ COMMONAPI_EXPORT InputStream &skipMap() {
+ uint32_t itsSize;
+ _readValue(itsSize);
+ align(8); /* skip padding (if any) */
+ assert(itsSize <= (sizes_.top() + positions_.top() - current_));
+ _readRaw(itsSize);
+ return (*this);
+ }
- align(8);
- readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
- skipSignature();
+ template<class Deployment_, typename Base_>
+ COMMONAPI_EXPORT InputStream &readValue(Enumeration<Base_> &_value, const Deployment_ *_depl) {
+ Base_ tmpValue;
+ readValue(tmpValue, _depl);
+ _value = tmpValue;
+ return (*this);
+ }
- InputStreamReadVisitor<DBusInputStream, _Types...> visitor((*this), _value);
- ApplyVoidVisitor<InputStreamReadVisitor<DBusInputStream, _Types... >,
- Variant<_Types...>, _Types...>::visit(visitor, _value);
+ template<class Deployment_, typename... Types_>
+ COMMONAPI_EXPORT InputStream &readValue(Struct<Types_...> &_value, const Deployment_ *_depl) {
+ align(8);
+ const auto itsSize(std::tuple_size<std::tuple<Types_...>>::value);
+ StructReader<itsSize-1, DBusInputStream, Struct<Types_...>, Deployment_>{}(
+ (*this), _value, _depl);
+ return (*this);
+ }
- return (*this);
+ template<class Deployment_, class PolymorphicStruct_>
+ COMMONAPI_EXPORT InputStream &readValue(std::shared_ptr<PolymorphicStruct_> &_value,
+ const Deployment_ *_depl) {
+ uint32_t serial;
+ align(8);
+ _readValue(serial);
+ skipSignature();
+ align(8);
+ if (!hasError()) {
+ _value = PolymorphicStruct_::create(serial);
+ _value->template readValue<>(*this, _depl);
+ }
+
+ return (*this);
+ }
+
+ template<typename... Types_>
+ 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>,
+ Variant<Types_...>, Types_... >::visit(visitor, _value);
+ }
+
+ align(8);
+ readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
+ skipSignature();
+
+ InputStreamReadVisitor<DBusInputStream, Types_...> visitor((*this), _value);
+ ApplyVoidVisitor<InputStreamReadVisitor<DBusInputStream, Types_... >,
+ Variant<Types_...>, Types_...>::visit(visitor, _value);
+
+ return (*this);
}
- 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>,
- Variant<_Types...>, _Types... >::visit(visitor, _value);
- }
-
- if (_depl != nullptr && _depl->isDBus_) {
- // 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);
- _value.valueType_ = ApplyTypeCompareVisitor<
- TypeCompareVisitor<_Types...>,
- Variant<_Types...>,
- _Types...
- >::visit(visitor, _value);
- } else {
- align(8);
- readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
- skipSignature();
- }
-
-
- InputStreamReadVisitor<DBusInputStream, _Types...> visitor((*this), _value);
- ApplyVoidVisitor<InputStreamReadVisitor<DBusInputStream, _Types... >,
- Variant<_Types...>, _Types...>::visit(visitor, _value);
-
- return (*this);
+ 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>,
+ Variant<Types_...>, Types_... >::visit(visitor, _value);
+ }
+
+ if (_depl != nullptr && _depl->isDBus_) {
+ // 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_ = _value.maxSize + 1;
+ setError();
+ return (*this);
+ }
+ } else {
+ align(8);
+ readValue(_value.valueType_, static_cast<EmptyDeployment *>(nullptr));
+ skipSignature();
+ }
+
+
+ InputStreamReadVisitor<DBusInputStream, Types_...> visitor((*this), _value);
+ ApplyStreamVisitor<InputStreamReadVisitor<DBusInputStream, Types_... >,
+ Variant<Types_...>, Deployment_, Types_...>::visit(visitor, _value, _depl);
+
+ return (*this);
}
- template<typename _ElementType>
- COMMONAPI_EXPORT InputStream &readValue(std::vector<_ElementType> &_value, const EmptyDeployment *_depl) {
- uint32_t itsSize;
- _readValue(itsSize);
- pushSize(itsSize);
+ template<typename ElementType_>
+ COMMONAPI_EXPORT InputStream &readValue(std::vector<ElementType_> &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
- alignVector<_ElementType>();
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
- pushPosition();
+ alignVector<ElementType_>();
- _value.clear();
- while (sizes_.top() > current_ - positions_.top()) {
- _ElementType itsElement;
- readValue(itsElement, static_cast<EmptyDeployment *>(nullptr));
+ pushPosition();
- if (hasError()) {
- break;
- }
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ ElementType_ itsElement;
+ readValue(itsElement, static_cast<EmptyDeployment *>(nullptr));
- _value.push_back(std::move(itsElement));
- }
+ if (hasError()) {
+ break;
+ }
- popSize();
- popPosition();
+ _value.push_back(std::move(itsElement));
+ }
- return (*this);
+ popSize();
+ popPosition();
+
+ return (*this);
}
- template<class _Deployment, typename _ElementType>
- COMMONAPI_EXPORT InputStream &readValue(std::vector<_ElementType> &_value, const _Deployment *_depl) {
- uint32_t itsSize;
- _readValue(itsSize);
- pushSize(itsSize);
+ template<class Deployment_, typename ElementType_>
+ COMMONAPI_EXPORT InputStream &readValue(std::vector<ElementType_> &_value, const Deployment_ *_depl) {
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
- alignVector<_ElementType>();
+ alignVector<ElementType_>();
- pushPosition();
+ pushPosition();
- _value.clear();
- while (sizes_.top() > current_ - positions_.top()) {
- _ElementType itsElement;
- readValue(itsElement, (_depl ? _depl->elementDepl_ : nullptr));
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ ElementType_ itsElement;
+ readValue(itsElement, (_depl ? _depl->elementDepl_ : nullptr));
- if (hasError()) {
- break;
- }
+ if (hasError()) {
+ break;
+ }
- _value.push_back(std::move(itsElement));
- }
+ _value.push_back(std::move(itsElement));
+ }
- popSize();
- popPosition();
+ popSize();
+ popPosition();
- return (*this);
+ return (*this);
}
- template<typename _KeyType, typename _ValueType, typename _HasherType>
- COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const EmptyDeployment *_depl) {
+ template<typename KeyType_, typename ValueType_, typename HasherType_>
+ COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const EmptyDeployment *_depl) {
- typedef typename std::unordered_map<_KeyType, _ValueType, _HasherType>::value_type MapElement;
+ typedef typename std::unordered_map<KeyType_, ValueType_, HasherType_>::value_type MapElement;
- uint32_t itsSize;
- _readValue(itsSize);
- pushSize(itsSize);
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
- align(8);
- pushPosition();
+ align(8);
+ pushPosition();
- _value.clear();
- while (sizes_.top() > current_ - positions_.top()) {
- _KeyType itsKey;
- _ValueType itsValue;
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ KeyType_ itsKey;
+ ValueType_ itsValue;
- align(8);
- readValue(itsKey, _depl);
- readValue(itsValue, _depl);
+ align(8);
+ readValue(itsKey, _depl);
+ readValue(itsValue, _depl);
- if (hasError()) {
- break;
- }
+ if (hasError()) {
+ break;
+ }
- _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
- }
+ _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
+ }
- (void)popSize();
- (void)popPosition();
+ (void)popSize();
+ (void)popPosition();
- return (*this);
+ return (*this);
}
- template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
- COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const _Deployment *_depl) {
+ template<class Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ COMMONAPI_EXPORT InputStream &readValue(std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const Deployment_ *_depl) {
- typedef typename std::unordered_map<_KeyType, _ValueType, _HasherType>::value_type MapElement;
+ typedef typename std::unordered_map<KeyType_, ValueType_, HasherType_>::value_type MapElement;
- uint32_t itsSize;
- _readValue(itsSize);
- pushSize(itsSize);
+ uint32_t itsSize;
+ _readValue(itsSize);
+ pushSize(itsSize);
- align(8);
- pushPosition();
+ align(8);
+ pushPosition();
- _value.clear();
- while (sizes_.top() > current_ - positions_.top()) {
- _KeyType itsKey;
- _ValueType itsValue;
+ _value.clear();
+ while (sizes_.top() > current_ - positions_.top()) {
+ KeyType_ itsKey;
+ ValueType_ itsValue;
- align(8);
- readValue(itsKey, (_depl ? _depl->key_ : nullptr));
- readValue(itsValue, (_depl ? _depl->value_ : nullptr));
+ align(8);
+ readValue(itsKey, (_depl ? _depl->key_ : nullptr));
+ readValue(itsValue, (_depl ? _depl->value_ : nullptr));
- if (hasError()) {
- break;
- }
+ if (hasError()) {
+ break;
+ }
- _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
- }
+ _value.insert(MapElement(std::move(itsKey), std::move(itsValue)));
+ }
- (void)popSize();
- (void)popPosition();
+ (void)popSize();
+ (void)popPosition();
- return (*this);
+ return (*this);
}
/**
@@ -316,31 +326,31 @@ public:
*
* @param message the #DBusMessage from which data should be read.
*/
- COMMONAPI_EXPORT DBusInputStream(const CommonAPI::DBus::DBusMessage &_message);
- COMMONAPI_EXPORT DBusInputStream(const DBusInputStream &_stream) = delete;
+ COMMONAPI_EXPORT DBusInputStream(const CommonAPI::DBus::DBusMessage &_message);
+ COMMONAPI_EXPORT DBusInputStream(const DBusInputStream &_stream) = delete;
/**
* Destructor; does not call the destructor of the referred #DBusMessage. Make sure to maintain a reference to the
* #DBusMessage outside of the stream if you intend to make further use of the message.
*/
- COMMONAPI_EXPORT ~DBusInputStream();
+ COMMONAPI_EXPORT ~DBusInputStream();
// Marks the stream as erroneous.
- COMMONAPI_EXPORT void setError();
+ COMMONAPI_EXPORT void setError();
/**
* @return An instance of #DBusError if this stream is in an erroneous state, NULL otherwise
*/
- COMMONAPI_EXPORT const DBusError &getError() const;
+ COMMONAPI_EXPORT const DBusError &getError() const;
/**
* @return true if this stream is in an erroneous state, false otherwise.
*/
- COMMONAPI_EXPORT bool isErrorSet() const;
+ COMMONAPI_EXPORT bool isErrorSet() const;
// Marks the state of the stream as cleared from all errors. Further reading is possible afterwards.
// The stream will have maintained the last valid position from before its state became erroneous.
- COMMONAPI_EXPORT void clearError();
+ COMMONAPI_EXPORT void clearError();
/**
* Aligns the stream to the given byte boundary, i.e. the stream skips as many bytes as are necessary to execute the next read
@@ -348,7 +358,7 @@ public:
*
* @param _boundary the byte boundary to which the stream needs to be aligned.
*/
- COMMONAPI_EXPORT void align(const size_t _boundary);
+ COMMONAPI_EXPORT void align(const size_t _boundary);
/**
* Reads the given number of bytes and returns them as an array of characters.
@@ -368,7 +378,7 @@ public:
* ...
* @endcode
*/
- COMMONAPI_EXPORT char *_readRaw(const size_t _size);
+ COMMONAPI_EXPORT char *_readRaw(const size_t _size);
/**
* Handles all reading of basic types from a given #DBusInputMessageStream.
@@ -376,33 +386,33 @@ public:
* Any types not listed here (especially all complex types, e.g. structs, unions etc.) need to provide a
* specialized implementation of this operator.
*
- * @tparam _Type The type of the value that is to be read from the given stream.
+ * @tparam Type_ The type of the value that is to be read from the given stream.
* @param _value The variable in which the retrieved value is to be stored
* @return The given inputMessageStream to allow for successive reading
*/
- template<typename _Type>
- COMMONAPI_EXPORT DBusInputStream &_readValue(_Type &_value) {
+ template<typename Type_>
+ COMMONAPI_EXPORT DBusInputStream &_readValue(Type_ &_value) {
if (sizeof(_value) > 1)
- align(sizeof(_Type));
+ align(sizeof(Type_));
- _value = *(reinterpret_cast<_Type *>(_readRaw(sizeof(_Type))));
+ _value = *(reinterpret_cast<Type_ *>(_readRaw(sizeof(Type_))));
return (*this);
}
- COMMONAPI_EXPORT DBusInputStream &_readValue(float &_value) {
- align(sizeof(double));
+ COMMONAPI_EXPORT DBusInputStream &_readValue(float &_value) {
+ align(sizeof(double));
_value = (float) (*(reinterpret_cast<double*>(_readRaw(sizeof(double)))));
return (*this);
}
private:
- COMMONAPI_EXPORT void pushPosition();
- COMMONAPI_EXPORT size_t popPosition();
+ COMMONAPI_EXPORT void pushPosition();
+ COMMONAPI_EXPORT size_t popPosition();
- COMMONAPI_EXPORT void pushSize(size_t _size);
- COMMONAPI_EXPORT size_t popSize();
+ COMMONAPI_EXPORT void pushSize(size_t _size);
+ COMMONAPI_EXPORT size_t popSize();
inline void skipSignature() {
uint8_t length;
@@ -410,34 +420,40 @@ private:
_readRaw(length + 1);
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
- if (4 < sizeof(_Type)) align(8);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<Type_>::value>::type * = nullptr) {
+ if (4 < sizeof(Type_)) align(8);
+ }
+
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<Type_, std::string>::value>::type * = nullptr,
+ typename std::enable_if<std::is_class<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!std::is_base_of<Enumeration<int32_t>, Type_>::value>::type * = nullptr) {
+ align(8);
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<_Type, std::string>::value>::type * = nullptr,
- typename std::enable_if<std::is_class<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
- align(8);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<Type_, std::string>::value>::type * = nullptr) {
+ // Intentionally do nothing
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<_Type, std::string>::value>::type * = nullptr) {
- // Intentionally do nothing
- }
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<Type_>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<_Type>::value>::type * = nullptr) {
- // Intentionally do nothing
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<Type_>::value>::type * = nullptr) {
+ align(4);
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<_Type>::value>::type * = nullptr) {
- align(4);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_base_of<Enumeration<int32_t>, Type_>::value>::type * = nullptr) {
+ align(4);
}
char *begin_;
diff --git a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
index 0f3dd24..6c6c9e1 100644
--- a/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
+++ b/include/CommonAPI/DBus/DBusInstanceAvailabilityStatusChangedEvent.hpp
@@ -36,8 +36,8 @@ class DBusInstanceAvailabilityStatusChangedEvent:
}
virtual ~DBusInstanceAvailabilityStatusChangedEvent() {
- proxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
- proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
+ proxy_.removeSignalMemberHandler(interfacesAddedSubscription_, this);
+ proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_, this);
}
virtual void onSignalDBusMessage(const DBusMessage& dbusMessage) {
@@ -59,7 +59,7 @@ class DBusInstanceAvailabilityStatusChangedEvent:
false);
interfacesRemovedSubscription_ = proxy_.addSignalMemberHandler(
- proxy_.getDBusAddress().getObjectPath(),
+ proxy_.getDBusAddress().getObjectPath(),
DBusObjectManagerStub::getInterfaceName(),
"InterfacesRemoved",
"oas",
@@ -68,8 +68,8 @@ class DBusInstanceAvailabilityStatusChangedEvent:
}
virtual void onLastListenerRemoved(const Listener&) {
- proxy_.removeSignalMemberHandler(interfacesAddedSubscription_);
- proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_);
+ proxy_.removeSignalMemberHandler(interfacesAddedSubscription_, this);
+ proxy_.removeSignalMemberHandler(interfacesRemovedSubscription_, this);
}
private:
@@ -118,8 +118,8 @@ class DBusInstanceAvailabilityStatusChangedEvent:
const AvailabilityStatus &_availability) {
CommonAPI::Address itsAddress;
DBusAddress itsDBusAddress(proxy_.getDBusAddress().getService(),
- _objectPath,
- _interfaceName);
+ _objectPath,
+ _interfaceName);
DBusAddressTranslator::get()->translate(itsDBusAddress, itsAddress);
diff --git a/include/CommonAPI/DBus/DBusInterfaceHandler.hpp b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp
index c570975..fa6c0bb 100644
--- a/include/CommonAPI/DBus/DBusInterfaceHandler.hpp
+++ b/include/CommonAPI/DBus/DBusInterfaceHandler.hpp
@@ -22,7 +22,7 @@ class DBusInterfaceHandler {
virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage) = 0;
- virtual const bool hasFreedesktopProperties() = 0;
+ virtual bool hasFreedesktopProperties() = 0;
};
} // namespace dbus
diff --git a/include/CommonAPI/DBus/DBusMainLoop.hpp b/include/CommonAPI/DBus/DBusMainLoop.hpp
new file mode 100755
index 0000000..2fff847
--- /dev/null
+++ b/include/CommonAPI/DBus/DBusMainLoop.hpp
@@ -0,0 +1,185 @@
+// 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_DBUS_MAIN_LOOP_HPP_
+#define COMMONAPI_DBUS_MAIN_LOOP_HPP_
+
+#if !defined (COMMONAPI_INTERNAL_COMPILATION)
+#define COMMONAPI_INTERNAL_COMPILATION
+#endif
+
+#include <CommonAPI/MainLoopContext.hpp>
+
+#include <condition_variable>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <set>
+#include <vector>
+
+namespace CommonAPI {
+namespace DBus {
+
+typedef pollfd DBusMainLoopPollFd;
+
+class DBusMainLoop {
+ public:
+ DBusMainLoop() = delete;
+ DBusMainLoop(const DBusMainLoop&) = delete;
+ DBusMainLoop& operator=(const DBusMainLoop&) = delete;
+ DBusMainLoop(DBusMainLoop&&) = delete;
+ DBusMainLoop& operator=(DBusMainLoop&&) = delete;
+
+ COMMONAPI_EXPORT explicit DBusMainLoop(std::shared_ptr<MainLoopContext> context);
+ COMMONAPI_EXPORT ~DBusMainLoop();
+
+ /**
+ * \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.
+ */
+ COMMONAPI_EXPORT void run(const int64_t& timeoutInterval = TIMEOUT_INFINITE);
+ COMMONAPI_EXPORT void stop();
+
+ /**
+ * \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.
+ */
+ COMMONAPI_EXPORT void doSingleIteration(const int64_t& timeout = TIMEOUT_INFINITE);
+
+ /*
+ * 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.
+ */
+ COMMONAPI_EXPORT bool prepare(const int64_t& timeout = TIMEOUT_INFINITE);
+ COMMONAPI_EXPORT void poll();
+ COMMONAPI_EXPORT bool check();
+ COMMONAPI_EXPORT void dispatch();
+
+ private:
+ COMMONAPI_EXPORT void wakeup();
+ COMMONAPI_EXPORT void wakeupAck();
+
+ COMMONAPI_EXPORT void registerFileDescriptor(const DBusMainLoopPollFd& fileDescriptor);
+ COMMONAPI_EXPORT void unregisterFileDescriptor(const DBusMainLoopPollFd& fileDescriptor);
+
+ COMMONAPI_EXPORT void registerDispatchSource(DispatchSource* dispatchSource, const DispatchPriority dispatchPriority);
+ COMMONAPI_EXPORT void unregisterDispatchSource(DispatchSource* dispatchSource);
+
+ COMMONAPI_EXPORT void registerWatch(Watch* watch, const DispatchPriority dispatchPriority);
+ COMMONAPI_EXPORT void unregisterWatch(Watch* watch);
+
+ COMMONAPI_EXPORT void registerTimeout(Timeout* timeout, const DispatchPriority dispatchPriority);
+ COMMONAPI_EXPORT void unregisterTimeout(Timeout* timeout);
+
+
+ std::shared_ptr<MainLoopContext> context_;
+
+ std::vector<DBusMainLoopPollFd> managedFileDescriptors_;
+ std::mutex fileDescriptorsMutex_;
+
+ struct DispatchSourceToDispatchStruct {
+ DispatchSource* dispatchSource_;
+ std::mutex* mutex_;
+ bool isExecuted_; /* execution flag: indicates, whether the dispatchSource is dispatched currently */
+ bool deleteObject_; /* delete flag: indicates, whether the dispatchSource can be deleted*/
+
+ DispatchSourceToDispatchStruct(DispatchSource* _dispatchSource,
+ std::mutex* _mutex,
+ bool _isExecuted,
+ bool _deleteObject) {
+ dispatchSource_ = _dispatchSource;
+ mutex_ = _mutex;
+ isExecuted_ = _isExecuted;
+ deleteObject_ = _deleteObject;
+ }
+ };
+
+ struct TimeoutToDispatchStruct {
+ Timeout* timeout_;
+ std::mutex* mutex_;
+ bool isExecuted_; /* execution flag: indicates, whether the timeout is dispatched currently */
+ bool deleteObject_; /* delete flag: indicates, whether the timeout can be deleted*/
+ bool timeoutElapsed_; /* timeout elapsed flag: indicates, whether the timeout is elapsed*/
+
+ TimeoutToDispatchStruct(Timeout* _timeout,
+ std::mutex* _mutex,
+ bool _isExecuted,
+ bool _deleteObject,
+ bool _timeoutElapsed) {
+ timeout_ = _timeout;
+ mutex_ = _mutex;
+ isExecuted_ = _isExecuted;
+ deleteObject_ = _deleteObject;
+ timeoutElapsed_ = _timeoutElapsed;
+ }
+ };
+
+ struct WatchToDispatchStruct {
+ int fd_;
+ Watch* watch_;
+ std::mutex* mutex_;
+ bool isExecuted_; /* execution flag: indicates, whether the watch is dispatched currently */
+ bool deleteObject_; /* delete flag: indicates, whether the watch can be deleted*/
+
+ WatchToDispatchStruct(int _fd,
+ Watch* _watch,
+ std::mutex* _mutex,
+ bool _isExecuted,
+ bool _deleteObject) {
+ fd_ = _fd;
+ watch_ = _watch;
+ mutex_ = _mutex;
+ isExecuted_ = _isExecuted;
+ deleteObject_ = _deleteObject;
+ }
+ };
+
+ std::multimap<DispatchPriority, DispatchSourceToDispatchStruct*> registeredDispatchSources_;
+ std::multimap<DispatchPriority, WatchToDispatchStruct*> registeredWatches_;
+ std::multimap<DispatchPriority, TimeoutToDispatchStruct*> registeredTimeouts_;
+
+ std::mutex dispatchSourcesMutex_;
+ std::mutex watchesMutex_;
+ std::mutex timeoutsMutex_;
+
+ std::set<DispatchSourceToDispatchStruct*> sourcesToDispatch_;
+ std::set<WatchToDispatchStruct*> watchesToDispatch_;
+ std::set<TimeoutToDispatchStruct*> timeoutsToDispatch_;
+
+ DispatchSourceListenerSubscription dispatchSourceListenerSubscription_;
+ WatchListenerSubscription watchListenerSubscription_;
+ TimeoutSourceListenerSubscription timeoutSourceListenerSubscription_;
+ WakeupListenerSubscription wakeupListenerSubscription_;
+
+ int64_t currentMinimalTimeoutInterval_;
+
+ DBusMainLoopPollFd wakeFd_;
+
+#ifdef WIN32
+ DBusMainLoopPollFd sendFd_;
+#endif
+
+ bool hasToStop_;
+ bool isBroken_;
+};
+
+} // namespace DBus
+} // namespace CommonAPI
+
+#endif // COMMONAPI_DEMO_MAIN_LOOP_HPP_
diff --git a/include/CommonAPI/DBus/DBusMainLoopContext.hpp b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
index 27428db..8cf9cf2 100644
--- a/include/CommonAPI/DBus/DBusMainLoopContext.hpp
+++ b/include/CommonAPI/DBus/DBusMainLoopContext.hpp
@@ -48,7 +48,7 @@ class DBusWatch: public Watch {
const pollfd& getAssociatedFileDescriptor();
#ifdef WIN32
- const HANDLE& getAssociatedEvent();
+ const HANDLE& getAssociatedEvent();
#endif
const std::vector<DispatchSource*>& getDependentDispatchSources();
@@ -63,7 +63,7 @@ class DBusWatch: public Watch {
std::weak_ptr<MainLoopContext> mainLoopContext_;
#ifdef WIN32
- HANDLE wsaEvent_;
+ HANDLE wsaEvent_;
#endif
};
diff --git a/include/CommonAPI/DBus/DBusMessage.hpp b/include/CommonAPI/DBus/DBusMessage.hpp
index 97c521d..0519e9d 100644
--- a/include/CommonAPI/DBus/DBusMessage.hpp
+++ b/include/CommonAPI/DBus/DBusMessage.hpp
@@ -70,7 +70,7 @@ public:
const char* getSignature() const;
const char* getError() const;
const char* getDestination() const;
- const uint32_t getSerial() const;
+ uint32_t getSerial() const;
bool hasObjectPath(const std::string& objectPath) const;
@@ -79,7 +79,7 @@ public:
bool hasMemberName(const char* memberName) const;
bool hasSignature(const char* signature) const;
- const Type getType() const;
+ Type getType() const;
bool isInvalidType() const;
bool isMethodCallType() const;
bool isMethodReturnType() const;
diff --git a/include/CommonAPI/DBus/DBusMultiEvent.hpp b/include/CommonAPI/DBus/DBusMultiEvent.hpp
index 8215d4f..db0c1e5 100644
--- a/include/CommonAPI/DBus/DBusMultiEvent.hpp
+++ b/include/CommonAPI/DBus/DBusMultiEvent.hpp
@@ -18,98 +18,98 @@
namespace CommonAPI {
namespace DBus {
-template <typename... _Arguments>
+template <typename... Arguments_>
class DBusMultiEvent {
public:
- typedef std::function<SubscriptionStatus(const std::string&, const _Arguments&...)> Listener;
- typedef std::unordered_multimap<std::string, Listener> ListenersMap;
- typedef typename ListenersMap::iterator Subscription;
+ typedef std::function<SubscriptionStatus(const std::string&, const Arguments_&...)> Listener;
+ typedef std::unordered_multimap<std::string, Listener> ListenersMap;
+ typedef typename ListenersMap::iterator Subscription;
- virtual ~DBusMultiEvent() {}
+ virtual ~DBusMultiEvent() {}
- Subscription subscribeAll(const Listener& listener);
- Subscription subscribe(const std::string& eventName, const Listener& listener);
+ Subscription subscribeAll(const Listener& listener);
+ Subscription subscribe(const std::string& eventName, const Listener& listener);
- void unsubscribe(Subscription listenerSubscription);
+ void unsubscribe(Subscription listenerSubscription);
protected:
- SubscriptionStatus notifyListeners(const std::string& name, const _Arguments&... eventArguments);
+ SubscriptionStatus notifyListeners(const std::string& name, const Arguments_&... eventArguments);
- virtual void onFirstListenerAdded(const std::string& name, const Listener& listener) { }
- virtual void onListenerAdded(const std::string& name, const Listener& listener) { }
+ virtual void onFirstListenerAdded(const std::string& name, const Listener& listener) { }
+ virtual void onListenerAdded(const std::string& name, const Listener& listener) { }
- virtual void onListenerRemoved(const std::string& name, const Listener& listener) { }
- virtual void onLastListenerRemoved(const std::string& name, const Listener& listener) { }
+ virtual void onListenerRemoved(const std::string& name, const Listener& listener) { }
+ virtual void onLastListenerRemoved(const std::string& name, const Listener& listener) { }
private:
- typedef std::pair<typename ListenersMap::iterator, typename ListenersMap::iterator> IteratorRange;
- SubscriptionStatus notifyListenersRange(const std::string& name, IteratorRange listenersRange, const _Arguments&... eventArguments);
+ typedef std::pair<typename ListenersMap::iterator, typename ListenersMap::iterator> IteratorRange;
+ SubscriptionStatus notifyListenersRange(const std::string& name, IteratorRange listenersRange, const Arguments_&... eventArguments);
- ListenersMap listenersMap_;
+ ListenersMap listenersMap_;
};
-template <typename... _Arguments>
-typename DBusMultiEvent<_Arguments...>::Subscription
-DBusMultiEvent<_Arguments...>::subscribeAll(const Listener& listener) {
- return subscribe(std::string(), listener);
+template <typename... Arguments_>
+typename DBusMultiEvent<Arguments_...>::Subscription
+DBusMultiEvent<Arguments_...>::subscribeAll(const Listener& listener) {
+ return subscribe(std::string(), listener);
}
-template <typename... _Arguments>
-typename DBusMultiEvent<_Arguments...>::Subscription
-DBusMultiEvent<_Arguments...>::subscribe(const std::string& eventName, const Listener& listener) {
- const bool firstListenerAdded = listenersMap_.empty();
+template <typename... Arguments_>
+typename DBusMultiEvent<Arguments_...>::Subscription
+DBusMultiEvent<Arguments_...>::subscribe(const std::string& eventName, const Listener& listener) {
+ const bool firstListenerAdded = listenersMap_.empty();
- auto listenerSubscription = listenersMap_.insert({eventName, listener});
+ auto listenerSubscription = listenersMap_.insert({eventName, listener});
- if (firstListenerAdded) {
- onFirstListenerAdded(eventName, listener);
- }
+ if (firstListenerAdded) {
+ onFirstListenerAdded(eventName, listener);
+ }
- onListenerAdded(eventName, listener);
+ onListenerAdded(eventName, listener);
- return listenerSubscription;
+ return listenerSubscription;
}
-template <typename... _Arguments>
-void DBusMultiEvent<_Arguments...>::unsubscribe(Subscription listenerSubscription) {
- const std::string name = listenerSubscription->first;
- const Listener listener = listenerSubscription->second;
+template <typename... Arguments_>
+void DBusMultiEvent<Arguments_...>::unsubscribe(Subscription listenerSubscription) {
+ const std::string name = listenerSubscription->first;
+ const Listener listener = listenerSubscription->second;
- listenersMap_.erase(listenerSubscription);
+ listenersMap_.erase(listenerSubscription);
- onListenerRemoved(name, listener);
+ onListenerRemoved(name, listener);
- const bool lastListenerRemoved = listenersMap_.empty();
- if (lastListenerRemoved)
- onLastListenerRemoved(name, listener);
+ const bool lastListenerRemoved = listenersMap_.empty();
+ if (lastListenerRemoved)
+ onLastListenerRemoved(name, listener);
}
-template <typename... _Arguments>
-SubscriptionStatus DBusMultiEvent<_Arguments...>::notifyListeners(const std::string& name, const _Arguments&... eventArguments) {
- const SubscriptionStatus subscriptionStatus = notifyListenersRange(name, listenersMap_.equal_range(name), eventArguments...);
+template <typename... Arguments_>
+SubscriptionStatus DBusMultiEvent<Arguments_...>::notifyListeners(const std::string& name, const Arguments_&... eventArguments) {
+ const SubscriptionStatus subscriptionStatus = notifyListenersRange(name, listenersMap_.equal_range(name), eventArguments...);
- if (subscriptionStatus == SubscriptionStatus::CANCEL)
- return SubscriptionStatus::CANCEL;
+ if (subscriptionStatus == SubscriptionStatus::CANCEL)
+ return SubscriptionStatus::CANCEL;
- return notifyListenersRange(name, listenersMap_.equal_range(std::string()), eventArguments...);
+ return notifyListenersRange(name, listenersMap_.equal_range(std::string()), eventArguments...);
}
-template <typename... _Arguments>
-SubscriptionStatus DBusMultiEvent<_Arguments...>::notifyListenersRange(
- const std::string& name,
- IteratorRange listenersRange,
- const _Arguments&... eventArguments) {
- for (auto iterator = listenersRange.first; iterator != listenersRange.second; iterator++) {
- const Listener& listener = iterator->second;
- const SubscriptionStatus listenerSubcriptionStatus = listener(name, eventArguments...);
-
- if (listenerSubcriptionStatus == SubscriptionStatus::CANCEL) {
- auto listenerIterator = iterator;
- listenersMap_.erase(listenerIterator);
- }
- }
-
- return listenersMap_.empty() ? SubscriptionStatus::CANCEL : SubscriptionStatus::RETAIN;
+template <typename... Arguments_>
+SubscriptionStatus DBusMultiEvent<Arguments_...>::notifyListenersRange(
+ const std::string& name,
+ IteratorRange listenersRange,
+ const Arguments_&... eventArguments) {
+ for (auto iterator = listenersRange.first; iterator != listenersRange.second; iterator++) {
+ const Listener& listener = iterator->second;
+ const SubscriptionStatus listenerSubcriptionStatus = listener(name, eventArguments...);
+
+ if (listenerSubcriptionStatus == SubscriptionStatus::CANCEL) {
+ auto listenerIterator = iterator;
+ listenersMap_.erase(listenerIterator);
+ }
+ }
+
+ return listenersMap_.empty() ? SubscriptionStatus::CANCEL : SubscriptionStatus::RETAIN;
}
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusObjectManager.hpp b/include/CommonAPI/DBus/DBusObjectManager.hpp
index 8c7225b..e2ec2c5 100644
--- a/include/CommonAPI/DBus/DBusObjectManager.hpp
+++ b/include/CommonAPI/DBus/DBusObjectManager.hpp
@@ -22,32 +22,32 @@ class DBusInterfaceHandler;
class DBusObjectManager {
public:
- COMMONAPI_EXPORT DBusObjectManager(const std::shared_ptr<DBusProxyConnection>&);
- COMMONAPI_EXPORT ~DBusObjectManager();
+ COMMONAPI_EXPORT DBusObjectManager(const std::shared_ptr<DBusProxyConnection>&);
+ COMMONAPI_EXPORT ~DBusObjectManager();
- COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
//Zusammenfassbar mit "registerDBusStubAdapter"?
- COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool handleMessage(const DBusMessage&);
+ COMMONAPI_EXPORT bool handleMessage(const DBusMessage&);
- COMMONAPI_EXPORT std::shared_ptr<DBusObjectManagerStub> getRootDBusObjectManagerStub();
+ COMMONAPI_EXPORT std::shared_ptr<DBusObjectManagerStub> getRootDBusObjectManagerStub();
private:
// objectPath, interfaceName
- typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;
+ typedef std::pair<std::string, std::string> DBusInterfaceHandlerPath;
- COMMONAPI_EXPORT bool addDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
+ COMMONAPI_EXPORT bool addDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
- COMMONAPI_EXPORT bool removeDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
+ COMMONAPI_EXPORT bool removeDBusInterfaceHandler(const DBusInterfaceHandlerPath& dbusInterfaceHandlerPath,
std::shared_ptr<DBusInterfaceHandler> dbusInterfaceHandler);
- COMMONAPI_EXPORT bool onIntrospectableInterfaceDBusMessage(const DBusMessage& callMessage);
- COMMONAPI_EXPORT bool onFreedesktopPropertiesDBusMessage(const DBusMessage& callMessage);
+ COMMONAPI_EXPORT bool onIntrospectableInterfaceDBusMessage(const DBusMessage& callMessage);
+ COMMONAPI_EXPORT bool onFreedesktopPropertiesDBusMessage(const DBusMessage& callMessage);
typedef std::unordered_map<DBusInterfaceHandlerPath, std::shared_ptr<DBusInterfaceHandler>> DBusRegisteredObjectsTable;
diff --git a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
index a16578b..6d88951 100644
--- a/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
+++ b/include/CommonAPI/DBus/DBusObjectManagerStub.hpp
@@ -42,17 +42,17 @@ class DBusStubAdapter;
class DBusObjectManagerStub : public DBusInterfaceHandler {
public:
// serialization trick: use bool instead of variant since we never serialize it
- typedef std::unordered_map<std::string, bool> DBusPropertiesChangedDict;
- typedef std::unordered_map<std::string, DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
- typedef std::unordered_map<std::string, DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
+ typedef std::unordered_map<std::string, bool> DBusPropertiesChangedDict;
+ typedef std::unordered_map<std::string, DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
+ typedef std::unordered_map<std::string, DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
public:
- COMMONAPI_EXPORT DBusObjectManagerStub(const std::string& dbusObjectPath, const std::shared_ptr<DBusProxyConnection>&);
+ COMMONAPI_EXPORT DBusObjectManagerStub(const std::string& dbusObjectPath, const std::shared_ptr<DBusProxyConnection>&);
- /**
- * Unregisters all currently registered DBusStubAdapter instances from the DBusServicePublisher
- */
- COMMONAPI_EXPORT virtual ~DBusObjectManagerStub();
+ /**
+ * Unregisters all currently registered DBusStubAdapter instances from the DBusServicePublisher
+ */
+ COMMONAPI_EXPORT virtual ~DBusObjectManagerStub();
/**
* Export DBusStubAdapter instance with the current DBusObjectManagerStub instance.
@@ -72,7 +72,7 @@ public:
* @see CommonAPI::ServicePublisher
* @see DBusObjectManager
*/
- COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool exportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
/**
* Unexport DBusStubAdapter instance from this DBusObjectManagerStub instance.
@@ -88,25 +88,25 @@ public:
*
* @see exportDBusStubAdapter()
*/
- COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unexportManagedDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool isDBusStubAdapterExported(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT const std::string& getDBusObjectPath() const;
- COMMONAPI_EXPORT static const char* getInterfaceName();
+ COMMONAPI_EXPORT const std::string& getDBusObjectPath() const;
+ COMMONAPI_EXPORT static const char* getInterfaceName();
- COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const;
- COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
- COMMONAPI_EXPORT virtual const bool hasFreedesktopProperties();
+ COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const;
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage& dbusMessage);
+ COMMONAPI_EXPORT virtual bool hasFreedesktopProperties();
private:
- COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
+ COMMONAPI_EXPORT bool unregisterDBusStubAdapter(std::shared_ptr<DBusStubAdapter> dbusStubAdapter);
- COMMONAPI_EXPORT bool emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
+ COMMONAPI_EXPORT bool emitInterfacesAddedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
- COMMONAPI_EXPORT bool emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
+ COMMONAPI_EXPORT bool emitInterfacesRemovedSignal(std::shared_ptr<DBusStubAdapter> dbusStubAdapter,
const std::shared_ptr<DBusProxyConnection>& dbusConnection) const;
std::string dbusObjectPath_;
diff --git a/include/CommonAPI/DBus/DBusOutputStream.hpp b/include/CommonAPI/DBus/DBusOutputStream.hpp
index 93afca2..b99c9c8 100644
--- a/include/CommonAPI/DBus/DBusOutputStream.hpp
+++ b/include/CommonAPI/DBus/DBusOutputStream.hpp
@@ -45,251 +45,268 @@ public:
*
* @param dbusMessage The #DBusMessage any data pushed into this stream should be written to.
*/
- COMMONAPI_EXPORT DBusOutputStream(DBusMessage dbusMessage);
+ COMMONAPI_EXPORT DBusOutputStream(DBusMessage dbusMessage);
- COMMONAPI_EXPORT void beginWriteVectorOfSerializableStructs() {
- align(sizeof(uint32_t));
- pushPosition();
- _writeValue(static_cast<uint32_t>(0)); // Placeholder
+ COMMONAPI_EXPORT void beginWriteVectorOfSerializableStructs() {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
- align(8);
- pushPosition(); // Start of map data
- }
+ align(8);
+ pushPosition(); // Start of map data
+ }
- COMMONAPI_EXPORT void endWriteVector() {
- // Write number of written bytes to placeholder position
- const uint32_t length = getPosition() - popPosition();
- _writeValueAt(popPosition(), length);
- }
+ COMMONAPI_EXPORT void endWriteVector() {
+ // Write number of written bytes to placeholder position
+ const uint32_t length = uint32_t(getPosition() - popPosition());
+ _writeValueAt(popPosition(), length);
+ }
- COMMONAPI_EXPORT OutputStream &writeValue(const bool &_value, const EmptyDeployment *_depl) {
- uint32_t tmp = (_value ? 1 : 0);
+ COMMONAPI_EXPORT OutputStream &writeValue(const bool &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
+ uint32_t tmp = (_value ? 1 : 0);
return _writeValue(tmp);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const int8_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const int8_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const int16_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const int16_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const int32_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const int32_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const int64_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const int64_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const uint8_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint8_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const uint16_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint16_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const uint32_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint32_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const uint64_t &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const uint64_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const float &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const float &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(static_cast<double>(_value));
}
- COMMONAPI_EXPORT OutputStream &writeValue(const double &_value, const EmptyDeployment *_depl) {
+ COMMONAPI_EXPORT OutputStream &writeValue(const double &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _writeValue(_value);
}
- COMMONAPI_EXPORT OutputStream &writeValue(const std::string &_value, const EmptyDeployment * = nullptr) {
- return writeString(_value.c_str(), _value.length());
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::string &_value, const EmptyDeployment *_depl = nullptr) {
+ (void)_depl;
+ return writeString(_value.c_str(), uint32_t(_value.length()));
}
- COMMONAPI_EXPORT OutputStream &writeValue(const std::string &_value, const CommonAPI::DBus::StringDeployment* _depl) {
- return writeString(_value.c_str(), _value.length());
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::string &_value, const CommonAPI::DBus::StringDeployment* _depl) {
+ (void)_depl;
+ return writeString(_value.c_str(), uint32_t(_value.length()));
}
- COMMONAPI_EXPORT OutputStream &writeValue(const Version &_value, const EmptyDeployment *_depl = nullptr) {
- align(8);
- writeValue(_value.Major, _depl);
- writeValue(_value.Minor, _depl);
- return (*this);
+ COMMONAPI_EXPORT OutputStream &writeValue(const Version &_value, const EmptyDeployment *_depl = nullptr) {
+ align(8);
+ writeValue(_value.Major, _depl);
+ writeValue(_value.Minor, _depl);
+ return (*this);
}
- template<class _Deployment, typename _Base>
- COMMONAPI_EXPORT OutputStream &writeValue(const Enumeration<_Base> &_value, const _Deployment *_depl = nullptr) {
- return writeValue(static_cast<_Base>(_value), _depl);
+ template<class Deployment_, typename Base_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Enumeration<Base_> &_value, const Deployment_ *_depl = nullptr) {
+ return writeValue(static_cast<Base_>(_value), _depl);
}
- template<class _Deployment, typename... _Types>
- COMMONAPI_EXPORT OutputStream &writeValue(const Struct<_Types...> &_value, const _Deployment *_depl = nullptr) {
- align(8);
+ template<class Deployment_, typename... Types_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Struct<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ align(8);
- const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
- StructWriter<itsSize-1, DBusOutputStream, Struct<_Types...>, _Deployment>{}((*this), _value, _depl);
+ const auto itsSize(std::tuple_size<std::tuple<Types_...>>::value);
+ StructWriter<itsSize-1, DBusOutputStream, Struct<Types_...>, Deployment_>{}((*this), _value, _depl);
- return (*this);
+ return (*this);
}
- template<class _Deployment, class _PolymorphicStruct>
- COMMONAPI_EXPORT OutputStream &writeValue(const std::shared_ptr<_PolymorphicStruct> &_value, const _Deployment *_depl = nullptr) {
- align(8);
- _writeValue(_value->getSerial());
+ template<class Deployment_, class PolymorphicStruct_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::shared_ptr<PolymorphicStruct_> &_value, const Deployment_ *_depl = nullptr) {
+ align(8);
+ _writeValue(_value->getSerial());
- DBusTypeOutputStream typeOutput;
- typeOutput.writeType(_value);
- writeSignature(typeOutput.getSignature());
+ DBusTypeOutputStream typeOutput;
+ typeOutput.writeType(_value, _depl);
+ writeSignature(typeOutput.getSignature());
- align(8);
- _value->template writeValue<>((*this), _depl);
+ align(8);
+ _value->template writeValue<>((*this), _depl);
- return (*this);
+ return (*this);
}
- template<typename... _Types>
- COMMONAPI_EXPORT OutputStream &writeValue(const Variant<_Types...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
- align(8);
- writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
+ template<typename... Types_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Variant<Types_...> &_value, const CommonAPI::EmptyDeployment *_depl = nullptr) {
+ (void)_depl;
- DBusTypeOutputStream typeOutput;
- TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
- ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
- Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
- writeSignature(typeOutput.getSignature());
+ align(8);
+ writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
- OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
- ApplyVoidVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
- Variant<_Types...>, _Types...>::visit(valueVisitor, _value);
+ DBusTypeOutputStream typeOutput;
+ TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
+ ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
+ Variant<Types_...>, Types_...>::visit(typeVisitor, _value);
+ writeSignature(typeOutput.getSignature());
- return (*this);
- }
+ OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
+ ApplyVoidVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
+ Variant<Types_...>, Types_...>::visit(valueVisitor, _value);
- template<typename _Deployment, typename... _Types>
- COMMONAPI_EXPORT OutputStream &writeValue(const Variant<_Types...> &_value, const _Deployment *_depl = nullptr) {
- if (_depl != nullptr && _depl->isDBus_) {
- align(1);
- } else {
- align(8);
- writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
- }
-
- DBusTypeOutputStream typeOutput;
- TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
- ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
- Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
- writeSignature(typeOutput.getSignature());
+ return (*this);
+ }
- OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
- ApplyVoidVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
- Variant<_Types...>, _Types...>::visit(valueVisitor, _value);
+ template<typename Deployment_, typename... Types_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const Variant<Types_...> &_value, const Deployment_ *_depl = nullptr) {
+ if (_depl != nullptr && _depl->isDBus_) {
+ align(1);
+ } else {
+ align(8);
+ writeValue(_value.getValueType(), static_cast<EmptyDeployment *>(nullptr));
+ }
+
+ DBusTypeOutputStream typeOutput;
+ TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(typeOutput);
+ ApplyStreamVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
+ Variant<Types_...>, Deployment_, Types_...>::visit(typeVisitor, _value, _depl);
+ writeSignature(typeOutput.getSignature());
+
+ OutputStreamWriteVisitor<DBusOutputStream> valueVisitor(*this);
+ ApplyStreamVisitor<OutputStreamWriteVisitor<DBusOutputStream>,
+ Variant<Types_...>, Deployment_, Types_...>::visit(valueVisitor, _value, _depl);
- return (*this);
+ return (*this);
}
- template<typename _ElementType>
- COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<_ElementType> &_value,
- const EmptyDeployment *_depl) {
- align(sizeof(uint32_t));
- pushPosition();
- _writeValue(static_cast<uint32_t>(0)); // Placeholder
+ template<typename ElementType_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<ElementType_> &_value,
+ const EmptyDeployment *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
- alignVector<_ElementType>();
- pushPosition(); // Start of vector data
+ alignVector<ElementType_>();
+ pushPosition(); // Start of vector data
- for (auto i : _value) {
- writeValue(i, _depl);
- if (hasError()) {
- break;
- }
- }
+ for (auto i : _value) {
+ writeValue(i, _depl);
+ if (hasError()) {
+ break;
+ }
+ }
- // Write number of written bytes to placeholder position
- uint32_t length = getPosition() - popPosition();
- _writeValueAt(popPosition(), length);
+ // Write number of written bytes to placeholder position
+ uint32_t length = uint32_t(getPosition() - popPosition());
+ _writeValueAt(popPosition(), length);
- return (*this);
+ return (*this);
}
- template<class _Deployment, typename _ElementType>
- COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<_ElementType> &_value,
- const _Deployment *_depl) {
- align(sizeof(uint32_t));
- pushPosition();
- _writeValue(static_cast<uint32_t>(0)); // Placeholder
+ template<class Deployment_, typename ElementType_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::vector<ElementType_> &_value,
+ const Deployment_ *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
- alignVector<_ElementType>();
- pushPosition(); // Start of vector data
+ alignVector<ElementType_>();
+ pushPosition(); // Start of vector data
- for (auto i : _value) {
- writeValue(i, (_depl ? _depl->elementDepl_ : nullptr));
- if (hasError()) {
- break;
- }
- }
+ for (auto i : _value) {
+ writeValue(i, (_depl ? _depl->elementDepl_ : nullptr));
+ if (hasError()) {
+ break;
+ }
+ }
- // Write number of written bytes to placeholder position
- uint32_t length = getPosition() - popPosition();
- _writeValueAt(popPosition(), length);
+ // Write number of written bytes to placeholder position
+ uint32_t length = uint32_t(getPosition() - popPosition());
+ _writeValueAt(popPosition(), length);
- return (*this);
+ return (*this);
}
- template<typename _KeyType, typename _ValueType, typename _HasherType>
- COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const EmptyDeployment *_depl) {
- align(sizeof(uint32_t));
- pushPosition();
- _writeValue(static_cast<uint32_t>(0)); // Placeholder
+ template<typename KeyType_, typename ValueType_, typename HasherType_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const EmptyDeployment *_depl) {
+ (void)_depl;
- align(8);
- pushPosition(); // Start of map data
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
- for (auto v : _value) {
- align(8);
- writeValue(v.first, static_cast<EmptyDeployment *>(nullptr));
- writeValue(v.second, static_cast<EmptyDeployment *>(nullptr));
+ align(8);
+ pushPosition(); // Start of map data
+
+ for (auto v : _value) {
+ align(8);
+ writeValue(v.first, static_cast<EmptyDeployment *>(nullptr));
+ writeValue(v.second, static_cast<EmptyDeployment *>(nullptr));
- if (hasError()) {
- return (*this);
- }
- }
+ if (hasError()) {
+ return (*this);
+ }
+ }
- // Write number of written bytes to placeholder position
- uint32_t length = getPosition() - popPosition();
- _writeValueAt(popPosition(), length);
- return (*this);
+ // Write number of written bytes to placeholder position
+ uint32_t length = uint32_t(getPosition() - popPosition());
+ _writeValueAt(popPosition(), length);
+ return (*this);
}
- template<class _Deployment, typename _KeyType, typename _ValueType, typename _HasherType>
- COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value,
- const _Deployment *_depl) {
- align(sizeof(uint32_t));
- pushPosition();
- _writeValue(static_cast<uint32_t>(0)); // Placeholder
-
- align(8);
- pushPosition(); // Start of map data
+ template<class Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ COMMONAPI_EXPORT OutputStream &writeValue(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value,
+ const Deployment_ *_depl) {
+ align(sizeof(uint32_t));
+ pushPosition();
+ _writeValue(static_cast<uint32_t>(0)); // Placeholder
+
+ align(8);
+ pushPosition(); // Start of map data
- for (auto v : _value) {
- align(8);
- writeValue(v.first, (_depl ? _depl->key_ : nullptr));
- writeValue(v.second, (_depl ? _depl->value_ : nullptr));
+ for (auto v : _value) {
+ align(8);
+ writeValue(v.first, (_depl ? _depl->key_ : nullptr));
+ writeValue(v.second, (_depl ? _depl->value_ : nullptr));
- if (hasError()) {
- return (*this);
- }
- }
+ if (hasError()) {
+ return (*this);
+ }
+ }
- // Write number of written bytes to placeholder position
- uint32_t length = getPosition() - popPosition();
- _writeValueAt(popPosition(), length);
- return (*this);
+ // Write number of written bytes to placeholder position
+ uint32_t length = uint32_t(getPosition() - popPosition());
+ _writeValueAt(popPosition(), length);
+ return (*this);
}
/**
@@ -306,11 +323,11 @@ public:
* will completely override the data that currently is contained in the #DBusMessage. The data that is buffered in this #DBusOutputMessageStream is
* not deleted by calling flush().
*/
- COMMONAPI_EXPORT void flush();
+ COMMONAPI_EXPORT void flush();
- COMMONAPI_EXPORT bool hasError() const;
+ COMMONAPI_EXPORT bool hasError() const;
- // Helper for serializing Freedesktop properties
+ // Helper for serializing Freedesktop properties
COMMONAPI_EXPORT void beginWriteMap() {
align(sizeof(uint32_t));
pushPosition();
@@ -322,46 +339,52 @@ public:
COMMONAPI_EXPORT void endWriteMap() {
// Write number of written bytes to placeholder position
- const uint32_t length = getPosition() - popPosition();
+ const uint32_t length = uint32_t(getPosition() - popPosition());
_writeValueAt(popPosition(), length);
}
private:
- COMMONAPI_EXPORT size_t getPosition();
- COMMONAPI_EXPORT void pushPosition();
- COMMONAPI_EXPORT size_t popPosition();
+ COMMONAPI_EXPORT size_t getPosition();
+ COMMONAPI_EXPORT void pushPosition();
+ COMMONAPI_EXPORT size_t popPosition();
+
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<Type_>::value>::type * = nullptr) {
+ if (4 < sizeof(Type_)) align(8);
+ }
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_class<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
- if (4 < sizeof(_Type)) align(8);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<Type_, std::string>::value>::type * = nullptr,
+ typename std::enable_if<std::is_class<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_vector<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!is_std_unordered_map<Type_>::value>::type * = nullptr,
+ typename std::enable_if<!std::is_base_of<Enumeration<int32_t>, Type_>::value>::type * = nullptr) {
+ align(8);
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<!std::is_same<_Type, std::string>::value>::type * = nullptr,
- typename std::enable_if<std::is_class<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_vector<_Type>::value>::type * = nullptr,
- typename std::enable_if<!is_std_unordered_map<_Type>::value>::type * = nullptr) {
- align(8);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<Type_, std::string>::value>::type * = nullptr) {
+ // Intentionally do nothing
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_same<_Type, std::string>::value>::type * = nullptr) {
- // Intentionally do nothing
- }
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<Type_>::value>::type * = nullptr) {
+ // Intentionally do nothing
+ }
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_vector<_Type>::value>::type * = nullptr) {
- // Intentionally do nothing
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<Type_>::value>::type * = nullptr) {
+ align(4);
}
- template<typename _Type>
- COMMONAPI_EXPORT void alignVector(typename std::enable_if<is_std_unordered_map<_Type>::value>::type * = nullptr) {
- align(4);
+ template<typename Type_>
+ COMMONAPI_EXPORT void alignVector(typename std::enable_if<std::is_base_of<Enumeration<int32_t>, Type_>::value>::type * = nullptr) {
+ align(4);
}
- COMMONAPI_EXPORT void setError();
+ COMMONAPI_EXPORT void setError();
/**
* Reserves the given number of bytes for writing, thereby negating the need to dynamically allocate memory while writing.
@@ -369,25 +392,25 @@ private:
*
* @param numOfBytes The number of bytes that should be reserved for writing.
*/
- COMMONAPI_EXPORT void reserveMemory(size_t numOfBytes);
+ COMMONAPI_EXPORT void reserveMemory(size_t numOfBytes);
- template<typename _Type>
- COMMONAPI_EXPORT DBusOutputStream &_writeValue(const _Type &_value) {
- if (sizeof(_Type) > 1)
- align(sizeof(_Type));
+ template<typename Type_>
+ COMMONAPI_EXPORT DBusOutputStream &_writeValue(const Type_ &_value) {
+ if (sizeof(Type_) > 1)
+ align(sizeof(Type_));
- _writeRaw(reinterpret_cast<const char*>(&_value), sizeof(_Type));
+ _writeRaw(reinterpret_cast<const char*>(&_value), sizeof(Type_));
return (*this);
}
- template<typename _Type>
- COMMONAPI_EXPORT void _writeValueAt(size_t _position, const _Type &_value) {
- assert(_position + sizeof(_Type) <= payload_.size());
+ template<typename Type_>
+ COMMONAPI_EXPORT void _writeValueAt(size_t _position, const Type_ &_value) {
+ assert(_position + sizeof(Type_) <= payload_.size());
_writeRawAt(reinterpret_cast<const char *>(&_value),
- sizeof(_Type), _position);
+ sizeof(Type_), _position);
}
- COMMONAPI_EXPORT DBusOutputStream &writeString(const char *_data, const uint32_t &_length);
+ COMMONAPI_EXPORT DBusOutputStream &writeString(const char *_data, const uint32_t &_length);
/**
* Takes sizeInByte characters, starting from the character which val points to, and stores them for later writing.
@@ -410,16 +433,16 @@ private:
* @see DBusOutputMessageStream()
* @see flush()
*/
- COMMONAPI_EXPORT void _writeRaw(const char *_data, const size_t _size);
- COMMONAPI_EXPORT void _writeRawAt(const char *_data, const size_t _size, size_t _position);
+ COMMONAPI_EXPORT void _writeRaw(const char *_data, const size_t _size);
+ COMMONAPI_EXPORT void _writeRawAt(const char *_data, const size_t _size, size_t _position);
protected:
std::string payload_;
private:
- COMMONAPI_EXPORT void writeSignature(const std::string& signature);
+ COMMONAPI_EXPORT void writeSignature(const std::string& signature);
- COMMONAPI_EXPORT size_t getCurrentStreamPosition();
+ COMMONAPI_EXPORT size_t getCurrentStreamPosition();
DBusError dbusError_;
DBusMessage dbusMessage_;
diff --git a/include/CommonAPI/DBus/DBusProxy.hpp b/include/CommonAPI/DBus/DBusProxy.hpp
index 2f8a89c..ad5439e 100644
--- a/include/CommonAPI/DBus/DBusProxy.hpp
+++ b/include/CommonAPI/DBus/DBusProxy.hpp
@@ -22,7 +22,7 @@ namespace CommonAPI {
namespace DBus {
class DBusProxyStatusEvent
- : public ProxyStatusEvent {
+ : public ProxyStatusEvent {
friend class DBusProxy;
public:
@@ -37,32 +37,32 @@ class DBusProxyStatusEvent
class DBusProxy
- : public DBusProxyBase {
+ : public DBusProxyBase {
public:
- COMMONAPI_EXPORT DBusProxy(const DBusAddress &_address,
+ COMMONAPI_EXPORT DBusProxy(const DBusAddress &_address,
const std::shared_ptr<DBusProxyConnection> &_connection);
- COMMONAPI_EXPORT virtual ~DBusProxy();
+ COMMONAPI_EXPORT virtual ~DBusProxy();
- COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
- COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
+ COMMONAPI_EXPORT virtual ProxyStatusEvent& getProxyStatusEvent();
+ COMMONAPI_EXPORT virtual InterfaceVersionAttribute& getInterfaceVersionAttribute();
- COMMONAPI_EXPORT virtual bool isAvailable() const;
- COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
+ COMMONAPI_EXPORT virtual bool isAvailable() const;
+ COMMONAPI_EXPORT virtual bool isAvailableBlocking() const;
- COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcastOnConnection(
+ COMMONAPI_EXPORT DBusProxyConnection::DBusSignalHandlerToken subscribeForSelectiveBroadcastOnConnection(
bool& subscriptionAccepted,
const std::string& objectPath,
const std::string& interfaceName,
const std::string& interfaceMemberName,
const std::string& interfaceMemberSignature,
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
- COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
+ COMMONAPI_EXPORT void unsubscribeFromSelectiveBroadcast(const std::string& eventName,
DBusProxyConnection::DBusSignalHandlerToken subscription,
const DBusProxyConnection::DBusSignalHandler* dbusSignalHandler);
- COMMONAPI_EXPORT void init();
+ COMMONAPI_EXPORT void init();
- COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
+ COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
const std::string &objectPath,
const std::string &interfaceName,
const std::string &signalName,
@@ -70,48 +70,54 @@ public:
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const bool justAddFilter);
- COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
+ COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
const std::string &objectPath,
const std::string &interfaceName,
const std::string &signalName,
const std::string &signalSignature,
- const std::string &getMethodName,
+ const std::string &getMethodName,
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const bool justAddFilter);
- COMMONAPI_EXPORT virtual bool removeSignalMemberHandler(
- const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
- const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler = NULL);
+ COMMONAPI_EXPORT virtual bool removeSignalMemberHandler(
+ const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
+ const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler = NULL);
- COMMONAPI_EXPORT virtual void getCurrentValueForSignalListener(
+ COMMONAPI_EXPORT virtual void getCurrentValueForSignalListener(
const std::string &getMethodName,
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
- const uint32_t subscription);
+ const uint32_t subscription);
+
+ COMMONAPI_EXPORT virtual void freeDesktopGetCurrentValueForSignalListener(
+ DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
+ const uint32_t subscription,
+ const std::string &interfaceName,
+ const std::string &propertyName);
private:
typedef std::tuple<
- const std::string,
- const std::string,
- const std::string,
- const std::string,
- const std::string,
- DBusProxyConnection::DBusSignalHandler*,
- const bool,
- bool
- > SignalMemberHandlerTuple;
-
- COMMONAPI_EXPORT DBusProxy(const DBusProxy &) = delete;
-
- COMMONAPI_EXPORT void onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus);
- COMMONAPI_EXPORT void signalMemberCallback(const CallStatus dbusMessageCallStatus,
- const DBusMessage& dbusMessage,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandlers,
- const uint32_t tag);
- COMMONAPI_EXPORT void signalInitialValueCallback(const CallStatus dbusMessageCallStatus,
- const DBusMessage& dbusMessage,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandlers,
- const uint32_t tag);
- COMMONAPI_EXPORT void addSignalMemberHandlerToQueue(SignalMemberHandlerTuple& _signalMemberHandler);
+ const std::string,
+ const std::string,
+ const std::string,
+ const std::string,
+ const std::string,
+ DBusProxyConnection::DBusSignalHandler*,
+ const bool,
+ bool
+ > SignalMemberHandlerTuple;
+
+ COMMONAPI_EXPORT DBusProxy(const DBusProxy &) = delete;
+
+ COMMONAPI_EXPORT void onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus);
+ COMMONAPI_EXPORT void signalMemberCallback(const CallStatus dbusMessageCallStatus,
+ const DBusMessage& dbusMessage,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandlers,
+ const uint32_t tag);
+ COMMONAPI_EXPORT void signalInitialValueCallback(const CallStatus dbusMessageCallStatus,
+ const DBusMessage& dbusMessage,
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandlers,
+ const uint32_t tag);
+ COMMONAPI_EXPORT void addSignalMemberHandlerToQueue(SignalMemberHandlerTuple& _signalMemberHandler);
DBusProxyStatusEvent dbusProxyStatusEvent_;
DBusServiceRegistry::DBusServiceSubscription dbusServiceRegistrySubscription_;
diff --git a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
index eac96d2..0a0ee56 100644
--- a/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
+++ b/include/CommonAPI/DBus/DBusProxyAsyncCallbackHandler.hpp
@@ -22,20 +22,26 @@
namespace CommonAPI {
namespace DBus {
-template<typename ... _ArgTypes>
-class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageReplyAsyncHandler {
+template<typename ... ArgTypes_>
+class DBusProxyAsyncCallbackHandler:
+ public DBusProxyConnection::DBusMessageReplyAsyncHandler {
public:
- typedef std::function<void(CallStatus, _ArgTypes...)> FunctionType;
+ typedef std::function<void(CallStatus, ArgTypes_...)> FunctionType;
static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType&& callback, std::tuple<_ArgTypes...> args) {
+ FunctionType&& callback, std::tuple<ArgTypes_...> args) {
return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
new DBusProxyAsyncCallbackHandler(std::move(callback), args));
}
DBusProxyAsyncCallbackHandler() = delete;
- DBusProxyAsyncCallbackHandler(FunctionType&& callback, std::tuple<_ArgTypes...> args):
- callback_(std::move(callback)), args_(args) {
+ DBusProxyAsyncCallbackHandler(FunctionType&& callback, std::tuple<ArgTypes_...> args)
+ : callback_(std::move(callback)),
+ args_(args),
+ executionStarted_(false),
+ executionFinished_(false),
+ timeoutOccurred_(false),
+ hasToBeDeleted_(false) {
}
virtual ~DBusProxyAsyncCallbackHandler() {}
@@ -43,19 +49,74 @@ class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageRepl
return promise_.get_future();
}
- virtual void onDBusMessageReply(const CallStatus& dbusMessageCallStatus, const DBusMessage& dbusMessage) {
- promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus, dbusMessage, typename make_sequence<sizeof...(_ArgTypes)>::type(), args_));
+ virtual void onDBusMessageReply(const CallStatus& dbusMessageCallStatus,
+ const DBusMessage& dbusMessage) {
+ promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus,
+ dbusMessage,
+ typename make_sequence<sizeof...(ArgTypes_)>::type(), args_));
+ }
+
+ virtual void setExecutionStarted() {
+ executionStarted_ = true;
+ }
+
+ virtual bool getExecutionStarted() {
+ return executionStarted_;
+ }
+
+ virtual void setExecutionFinished() {
+ executionFinished_ = true;
+ // free assigned std::function<> immediately
+ callback_ = [](CallStatus, ArgTypes_...) {};
+ }
+
+ virtual bool getExecutionFinished() {
+ return executionFinished_;
+ }
+
+ virtual void setTimeoutOccurred() {
+ timeoutOccurred_ = true;
+ }
+
+ virtual bool getTimeoutOccurred() {
+ return timeoutOccurred_;
+ }
+
+ virtual void setHasToBeDeleted() {
+ hasToBeDeleted_ = true;
+ }
+
+ virtual bool hasToBeDeleted() {
+ return hasToBeDeleted_;
+ }
+
+ virtual void lock() {
+ asyncHandlerMutex_.lock();
+ }
+
+ virtual void unlock() {
+ asyncHandlerMutex_.unlock();
}
private:
- template <int... _ArgIndices>
- inline CallStatus handleDBusMessageReply(const CallStatus dbusMessageCallStatus, const DBusMessage& dbusMessage, index_sequence<_ArgIndices...>, std::tuple<_ArgTypes...> argTuple) const {
+ template <int... ArgIndices_>
+ inline CallStatus handleDBusMessageReply(
+ const CallStatus dbusMessageCallStatus,
+ const DBusMessage& dbusMessage,
+ index_sequence<ArgIndices_...>,
+ std::tuple<ArgTypes_...> argTuple) const {
+ (void)argTuple; // this suppresses warning "set but not used" in case of empty _ArgTypes
+ // Looks like: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57560 - Bug 57650
+
CallStatus callStatus = dbusMessageCallStatus;
if (dbusMessageCallStatus == CallStatus::SUCCESS) {
if (!dbusMessage.isErrorType()) {
DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_ArgTypes...>::deserialize(dbusInputStream, std::get<_ArgIndices>(argTuple)...);
+ const bool success
+ = DBusSerializableArguments<ArgTypes_...>::deserialize(
+ dbusInputStream,
+ std::get<ArgIndices_>(argTuple)...);
if (!success)
callStatus = CallStatus::REMOTE_ERROR;
} else {
@@ -63,13 +124,19 @@ class DBusProxyAsyncCallbackHandler: public DBusProxyConnection::DBusMessageRepl
}
}
- callback_(callStatus, std::move(std::get<_ArgIndices>(argTuple))...);
+ callback_(callStatus, std::move(std::get<ArgIndices_>(argTuple))...);
return callStatus;
}
std::promise<CallStatus> promise_;
- const FunctionType callback_;
- std::tuple<_ArgTypes...> args_;
+ FunctionType callback_;
+ std::tuple<ArgTypes_...> args_;
+ bool executionStarted_;
+ bool executionFinished_;
+ bool timeoutOccurred_;
+ bool hasToBeDeleted_;
+
+ std::mutex asyncHandlerMutex_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
index 9c706ca..f6d7791 100644
--- a/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
+++ b/include/CommonAPI/DBus/DBusProxyAsyncSignalMemberCallbackHandler.hpp
@@ -23,21 +23,23 @@ namespace DBus {
class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBusMessageReplyAsyncHandler {
public:
- typedef std::function<void(CallStatus, DBusMessage, DBusProxyConnection::DBusSignalHandler*, int)> FunctionType;
+ typedef std::function<void(CallStatus, DBusMessage, DBusProxyConnection::DBusSignalHandler*, int)> FunctionType;
static std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler> create(
- FunctionType& callback, DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const int tag) {
- return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
- new DBusProxyAsyncSignalMemberCallbackHandler(std::move(callback), dbusSignalHandler, tag));
- }
+ FunctionType& callback, DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ const int tag) {
+ return std::unique_ptr<DBusProxyConnection::DBusMessageReplyAsyncHandler>(
+ new DBusProxyAsyncSignalMemberCallbackHandler(std::move(callback), dbusSignalHandler, tag));
+ }
DBusProxyAsyncSignalMemberCallbackHandler() = delete;
DBusProxyAsyncSignalMemberCallbackHandler(FunctionType&& callback,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const int tag):
- callback_(std::move(callback)), dbusSignalHandler_(dbusSignalHandler), tag_(tag) {
- }
+ DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
+ const int tag):
+ callback_(std::move(callback)), dbusSignalHandler_(dbusSignalHandler), tag_(tag),
+ executionStarted_(false), executionFinished_(false),
+ timeoutOccurred_(false), hasToBeDeleted_(false) {
+ }
virtual ~DBusProxyAsyncSignalMemberCallbackHandler() {}
virtual std::future<CallStatus> getFuture() {
@@ -45,7 +47,47 @@ class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBu
}
virtual void onDBusMessageReply(const CallStatus& dbusMessageCallStatus, const DBusMessage& dbusMessage) {
- promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus, dbusMessage));
+ promise_.set_value(handleDBusMessageReply(dbusMessageCallStatus, dbusMessage));
+ }
+
+ virtual void setExecutionStarted() {
+ executionStarted_ = true;
+ }
+
+ virtual bool getExecutionStarted() {
+ return executionStarted_;
+ }
+
+ virtual void setExecutionFinished() {
+ executionFinished_ = true;
+ }
+
+ virtual bool getExecutionFinished() {
+ return executionFinished_;
+ }
+
+ virtual void setTimeoutOccurred() {
+ timeoutOccurred_ = true;
+ }
+
+ virtual bool getTimeoutOccurred() {
+ return timeoutOccurred_;
+ }
+
+ virtual void setHasToBeDeleted() {
+ hasToBeDeleted_ = true;
+ }
+
+ virtual bool hasToBeDeleted() {
+ return hasToBeDeleted_;
+ }
+
+ virtual void lock() {
+ asyncHandlerMutex_.lock();
+ }
+
+ virtual void unlock() {
+ asyncHandlerMutex_.unlock();
}
private:
@@ -60,6 +102,12 @@ class DBusProxyAsyncSignalMemberCallbackHandler: public DBusProxyConnection::DBu
const FunctionType callback_;
DBusProxyConnection::DBusSignalHandler* dbusSignalHandler_;
const int tag_;
+ bool executionStarted_;
+ bool executionFinished_;
+ bool timeoutOccurred_;
+ bool hasToBeDeleted_;
+
+ std::mutex asyncHandlerMutex_;
};
} // namespace DBus
diff --git a/include/CommonAPI/DBus/DBusProxyBase.hpp b/include/CommonAPI/DBus/DBusProxyBase.hpp
index 970035f..4657bbf 100644
--- a/include/CommonAPI/DBus/DBusProxyBase.hpp
+++ b/include/CommonAPI/DBus/DBusProxyBase.hpp
@@ -27,19 +27,19 @@ namespace DBus {
class DBusAddress;
class DBusProxyBase
- : public virtual CommonAPI::Proxy {
+ : public virtual CommonAPI::Proxy {
public:
- COMMONAPI_EXPORT DBusProxyBase(const DBusAddress &_address,
- const std::shared_ptr<DBusProxyConnection> &_connection);
- COMMONAPI_EXPORT virtual ~DBusProxyBase() {}
+ COMMONAPI_EXPORT DBusProxyBase(const DBusAddress &_address,
+ const std::shared_ptr<DBusProxyConnection> &_connection);
+ COMMONAPI_EXPORT virtual ~DBusProxyBase() {}
- COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
- COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
+ COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
+ COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
- COMMONAPI_EXPORT DBusMessage createMethodCall(const std::string &_method,
+ COMMONAPI_EXPORT DBusMessage createMethodCall(const std::string &_method,
const std::string &_signature = "") const;
- COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
+ COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
const std::string &objectPath,
const std::string &interfaceName,
const std::string &signalName,
@@ -47,7 +47,7 @@ public:
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const bool justAddFilter);
- COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
+ COMMONAPI_EXPORT virtual DBusProxyConnection::DBusSignalHandlerToken addSignalMemberHandler(
const std::string &objectPath,
const std::string &interfaceName,
const std::string &signalName,
@@ -56,19 +56,23 @@ public:
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const bool justAddFilter);
- COMMONAPI_EXPORT virtual bool removeSignalMemberHandler(
- const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
- const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler = NULL);
+ COMMONAPI_EXPORT virtual bool removeSignalMemberHandler(
+ const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
+ const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler = NULL);
- COMMONAPI_EXPORT virtual void getCurrentValueForSignalListener(
- const std::string &getMethodName,
- DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
- const uint32_t subscription) {}
+ COMMONAPI_EXPORT virtual void getCurrentValueForSignalListener(
+ const std::string &_getMethodName,
+ DBusProxyConnection::DBusSignalHandler *_handler,
+ const uint32_t _subscription) {
+ (void)_getMethodName;
+ (void)_handler;
+ (void)_subscription;
+ }
- COMMONAPI_EXPORT virtual void init() = 0;
+ COMMONAPI_EXPORT virtual void init() = 0;
protected:
- COMMONAPI_EXPORT DBusProxyBase(const DBusProxyBase &) = delete;
+ COMMONAPI_EXPORT DBusProxyBase(const DBusProxyBase &) = delete;
DBusAddress dbusAddress_;
std::shared_ptr<DBusProxyConnection> connection_;
diff --git a/include/CommonAPI/DBus/DBusProxyConnection.hpp b/include/CommonAPI/DBus/DBusProxyConnection.hpp
index 10c2ea4..0dc7cf2 100644
--- a/include/CommonAPI/DBus/DBusProxyConnection.hpp
+++ b/include/CommonAPI/DBus/DBusProxyConnection.hpp
@@ -45,6 +45,16 @@ class DBusProxyConnection {
virtual ~DBusMessageReplyAsyncHandler() {}
virtual std::future<CallStatus> getFuture() = 0;
virtual void onDBusMessageReply(const CallStatus&, const DBusMessage&) = 0;
+ virtual void setExecutionStarted() = 0;
+ virtual bool getExecutionStarted() = 0;
+ virtual void setExecutionFinished() = 0;
+ virtual bool getExecutionFinished() = 0;
+ virtual void setTimeoutOccurred() = 0;
+ virtual bool getTimeoutOccurred() = 0;
+ virtual void setHasToBeDeleted() = 0;
+ virtual bool hasToBeDeleted() = 0;
+ virtual void lock() = 0;
+ virtual void unlock() = 0;
};
class DBusSignalHandler {
@@ -72,12 +82,12 @@ class DBusProxyConnection {
virtual std::future<CallStatus> sendDBusMessageWithReplyAsync(
const DBusMessage& dbusMessage,
std::unique_ptr<DBusMessageReplyAsyncHandler> dbusMessageReplyAsyncHandler,
- const CommonAPI::CallInfo *_info) const = 0;
+ const CommonAPI::CallInfo *_info) const = 0;
virtual DBusMessage sendDBusMessageWithReplyAndBlock(
const DBusMessage& dbusMessage,
DBusError& dbusError,
- const CommonAPI::CallInfo *_info) const = 0;
+ const CommonAPI::CallInfo *_info) const = 0;
virtual DBusSignalHandlerToken addSignalMemberHandler(
const std::string& objectPath,
diff --git a/include/CommonAPI/DBus/DBusProxyHelper.hpp b/include/CommonAPI/DBus/DBusProxyHelper.hpp
index 4a2748b..ef468ee 100644
--- a/include/CommonAPI/DBus/DBusProxyHelper.hpp
+++ b/include/CommonAPI/DBus/DBusProxyHelper.hpp
@@ -30,29 +30,41 @@ class DBusProxy;
template< class, class >
struct DBusProxyHelper;
+#ifdef WIN32
+// Visual Studio 2013 does not support 'magic statics' yet.
+// Change back when switched to Visual Studio 2015 or higher.
+static std::mutex callMethod_mutex_;
+static std::mutex callMethodWithReply_mutex_;
+static std::mutex callMethodAsync_mutex_;
+#endif
+
template<
- template<class ...> class _In, class... _InArgs,
- template <class...> class _Out, class... _OutArgs>
-struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
- _Out<DBusInputStream, DBusOutputStream, _OutArgs...>> {
-
- template <typename _DBusProxy = DBusProxy>
- static void callMethod(const _DBusProxy &_proxy,
- const std::string &_method,
- const std::string &_signature,
- const _InArgs&... _in,
- CommonAPI::CallStatus &_status) {
-
- if (_proxy.isAvailable()) {
- DBusMessage message = _proxy.createMethodCall(_method, _signature);
- if (sizeof...(_InArgs) > 0) {
- DBusOutputStream output(message);
- if (!DBusSerializableArguments<_InArgs...>::serialize(output, _in...)) {
- _status = CallStatus::OUT_OF_MEMORY;
- return;
- }
- output.flush();
- }
+ template<class ...> class In_, class... InArgs_,
+ template <class...> class Out_, class... OutArgs_>
+struct DBusProxyHelper<In_<DBusInputStream, DBusOutputStream, InArgs_...>,
+ Out_<DBusInputStream, DBusOutputStream, OutArgs_...>> {
+
+ template <typename DBusProxy_ = DBusProxy>
+ static void callMethod(const DBusProxy_ &_proxy,
+ const std::string &_method,
+ const std::string &_signature,
+ const InArgs_&... _in,
+ CommonAPI::CallStatus &_status) {
+#ifndef WIN32
+ static std::mutex callMethod_mutex_;
+#endif
+ std::lock_guard<std::mutex> lock(callMethod_mutex_);
+
+ if (_proxy.isAvailable()) {
+ DBusMessage message = _proxy.createMethodCall(_method, _signature);
+ if (sizeof...(InArgs_) > 0) {
+ DBusOutputStream output(message);
+ if (!DBusSerializableArguments<InArgs_...>::serialize(output, _in...)) {
+ _status = CallStatus::OUT_OF_MEMORY;
+ return;
+ }
+ output.flush();
+ }
const bool isSent = _proxy.getDBusConnection()->sendDBusMessage(message);
_status = (isSent ? CallStatus::SUCCESS : CallStatus::OUT_OF_MEMORY);
@@ -61,18 +73,18 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
}
}
- template <typename _DBusProxy = DBusProxy>
+ template <typename DBusProxy_ = DBusProxy>
static void callMethodWithReply(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
DBusMessage &_message,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
CommonAPI::CallStatus &_status,
- _OutArgs&... _out) {
+ OutArgs_&... _out) {
- if (sizeof...(_InArgs) > 0) {
+ if (sizeof...(InArgs_) > 0) {
DBusOutputStream output(_message);
- if (!DBusSerializableArguments<_InArgs...>::serialize(output, _in...)) {
+ if (!DBusSerializableArguments<InArgs_...>::serialize(output, _in...)) {
_status = CallStatus::OUT_OF_MEMORY;
return;
}
@@ -86,9 +98,9 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
return;
}
- if (sizeof...(_OutArgs) > 0) {
+ if (sizeof...(OutArgs_) > 0) {
DBusInputStream input(reply);
- if (!DBusSerializableArguments<_OutArgs...>::deserialize(input, _out...)) {
+ if (!DBusSerializableArguments<OutArgs_...>::deserialize(input, _out...)) {
_status = CallStatus::REMOTE_ERROR;
return;
}
@@ -96,16 +108,21 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
_status = CallStatus::SUCCESS;
}
- template <typename _DBusProxy = DBusProxy>
+ template <typename DBusProxy_ = DBusProxy>
static void callMethodWithReply(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const DBusAddress &_address,
const char *_method,
const char *_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
CommonAPI::CallStatus &_status,
- _OutArgs&... _out) {
+ OutArgs_&... _out) {
+#ifndef WIN32
+ static std::mutex callMethodWithReply_mutex_;
+#endif
+ std::lock_guard<std::mutex> lock(callMethodWithReply_mutex_);
+
if (_proxy.isAvailable()) {
DBusMessage message = DBusMessage::createMethodCall(_address, _method, _signature);
callMethodWithReply(_proxy, message, _info, _in..., _status, _out...);
@@ -114,34 +131,39 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
}
}
- template <typename _DBusProxy = DBusProxy>
+ template <typename DBusProxy_ = DBusProxy>
static void callMethodWithReply(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const std::string &_interface,
const std::string &_method,
const std::string &_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
CommonAPI::CallStatus &_status,
- _OutArgs&... _out) {
- DBusAddress itsAddress(_proxy.getDBusAddress());
- itsAddress.setInterface(_interface);
+ OutArgs_&... _out) {
+ DBusAddress itsAddress(_proxy.getDBusAddress());
+ itsAddress.setInterface(_interface);
callMethodWithReply(
- _proxy, itsAddress,
- _method.c_str(), _signature.c_str(),
- _info,
- _in..., _status, _out...);
+ _proxy, itsAddress,
+ _method.c_str(), _signature.c_str(),
+ _info,
+ _in..., _status, _out...);
}
- template <typename _DBusProxy = DBusProxy>
+ template <typename DBusProxy_ = DBusProxy>
static void callMethodWithReply(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const std::string &_method,
const std::string &_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
CommonAPI::CallStatus &_status,
- _OutArgs&... _out) {
+ OutArgs_&... _out) {
+#ifndef WIN32
+ static std::mutex callMethodWithReply_mutex_;
+#endif
+ std::lock_guard<std::mutex> lock(callMethodWithReply_mutex_);
+
if (_proxy.isAvailable()) {
DBusMessage message = _proxy.createMethodCall(_method, _signature);
callMethodWithReply(_proxy, message, _info, _in..., _status, _out...);
@@ -150,19 +172,19 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
}
}
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
static std::future<CallStatus> callMethodAsync(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
DBusMessage &_message,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
- _AsyncCallback _callback,
- std::tuple<_OutArgs...> _out) {
- if (sizeof...(_InArgs) > 0) {
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
+ AsyncCallback_ _callback,
+ std::tuple<OutArgs_...> _out) {
+ if (sizeof...(InArgs_) > 0) {
DBusOutputStream output(_message);
const bool success = DBusSerializableArguments<
- _InArgs...
- >::serialize(output, _in...);
+ InArgs_...
+ >::serialize(output, _in...);
if (!success) {
std::promise<CallStatus> promise;
promise.set_value(CallStatus::OUT_OF_MEMORY);
@@ -174,27 +196,32 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
return _proxy.getDBusConnection()->sendDBusMessageWithReplyAsync(
_message,
DBusProxyAsyncCallbackHandler<
- _OutArgs...
+ OutArgs_...
>::create(std::move(_callback), _out),
- _info);
+ _info);
}
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
static std::future<CallStatus> callMethodAsync(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const DBusAddress &_address,
const std::string &_method,
const std::string &_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
- _AsyncCallback _callback,
- std::tuple<_OutArgs...> _out) {
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
+ AsyncCallback_ _callback,
+ 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);
+ callCallbackOnNotAvailable(_callback, typename make_sequence<sizeof...(OutArgs_)>::type(), _out);
std::promise<CallStatus> promise;
promise.set_value(status);
@@ -202,53 +229,59 @@ struct DBusProxyHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>,
}
}
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
static std::future<CallStatus> callMethodAsync(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const std::string &_interface,
const std::string &_method,
const std::string &_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
- _AsyncCallback _callback,
- std::tuple<_OutArgs...> _out) {
- DBusAddress itsAddress(_proxy.getDBusAddress());
- itsAddress.setInterface(_interface);
- return callMethodAsync(
- _proxy, itsAddress,
- _method, _signature,
- _info,
- _in..., _callback, _out);
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
+ AsyncCallback_ _callback,
+ std::tuple<OutArgs_...> _out) {
+ DBusAddress itsAddress(_proxy.getDBusAddress());
+ itsAddress.setInterface(_interface);
+ return callMethodAsync(
+ _proxy, itsAddress,
+ _method, _signature,
+ _info,
+ _in..., _callback, _out);
}
- template <typename _DBusProxy = DBusProxy, typename _AsyncCallback>
+ template <typename DBusProxy_ = DBusProxy, typename AsyncCallback_>
static std::future<CallStatus> callMethodAsync(
- const _DBusProxy &_proxy,
+ const DBusProxy_ &_proxy,
const std::string &_method,
const std::string &_signature,
- const CommonAPI::CallInfo *_info,
- const _InArgs&... _in,
- _AsyncCallback _callback,
- std::tuple<_OutArgs...> _out) {
+ const CommonAPI::CallInfo *_info,
+ const InArgs_&... _in,
+ AsyncCallback_ _callback,
+ 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);
+ _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();
- }
+ }
}
- template <int... _ArgIndices>
- static void callCallbackOnNotAvailable(std::function<void(CallStatus, _OutArgs&...)> _callback,
- index_sequence<_ArgIndices...>, std::tuple<_OutArgs...> _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)...);
+ _callback(status, std::get<ArgIndices_>(_out)...);
+ (void)_out;
}
};
diff --git a/include/CommonAPI/DBus/DBusProxyManager.hpp b/include/CommonAPI/DBus/DBusProxyManager.hpp
index a28527a..15ed474 100644
--- a/include/CommonAPI/DBus/DBusProxyManager.hpp
+++ b/include/CommonAPI/DBus/DBusProxyManager.hpp
@@ -30,33 +30,33 @@ public:
COMMONAPI_EXPORT DBusProxyManager(DBusProxy &_proxy,
const std::string &_interfaceName);
- COMMONAPI_EXPORT const std::string &getDomain() const;
- COMMONAPI_EXPORT const std::string &getInterface() const;
- COMMONAPI_EXPORT const ConnectionId_t &getConnectionId() const;
+ COMMONAPI_EXPORT const std::string &getDomain() const;
+ COMMONAPI_EXPORT const std::string &getInterface() const;
+ COMMONAPI_EXPORT const ConnectionId_t &getConnectionId() const;
- COMMONAPI_EXPORT virtual void getAvailableInstances(CommonAPI::CallStatus &, std::vector<std::string> &_instances);
- COMMONAPI_EXPORT virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback _callback);
+ COMMONAPI_EXPORT virtual void getAvailableInstances(CommonAPI::CallStatus &, std::vector<std::string> &_instances);
+ COMMONAPI_EXPORT virtual std::future<CallStatus> getAvailableInstancesAsync(GetAvailableInstancesCallback _callback);
- COMMONAPI_EXPORT virtual void getInstanceAvailabilityStatus(const std::string &_address,
+ COMMONAPI_EXPORT virtual void getInstanceAvailabilityStatus(const std::string &_address,
CallStatus &_callStatus,
AvailabilityStatus &_availabilityStatus);
- COMMONAPI_EXPORT virtual std::future<CallStatus> getInstanceAvailabilityStatusAsync(
- const std::string&,
+ COMMONAPI_EXPORT virtual std::future<CallStatus> getInstanceAvailabilityStatusAsync(
+ const std::string&,
GetInstanceAvailabilityStatusCallback callback);
- COMMONAPI_EXPORT virtual InstanceAvailabilityStatusChangedEvent& getInstanceAvailabilityStatusChangedEvent();
+ COMMONAPI_EXPORT virtual InstanceAvailabilityStatusChangedEvent& getInstanceAvailabilityStatusChangedEvent();
private:
- COMMONAPI_EXPORT void instancesAsyncCallback(const CommonAPI::CallStatus& status,
+ COMMONAPI_EXPORT void instancesAsyncCallback(const CommonAPI::CallStatus& status,
const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dict,
GetAvailableInstancesCallback& call);
- COMMONAPI_EXPORT void instanceAliveAsyncCallback(const AvailabilityStatus &_alive,
+ COMMONAPI_EXPORT void instanceAliveAsyncCallback(const AvailabilityStatus &_alive,
GetInstanceAvailabilityStatusCallback &_call,
- std::shared_ptr<std::promise<CallStatus>> &_status);
+ std::shared_ptr<std::promise<CallStatus>> &_status);
- COMMONAPI_EXPORT void translateCommonApiAddresses(const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
+ COMMONAPI_EXPORT void translateCommonApiAddresses(const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
std::vector<std::string> &_instances);
DBusProxy &proxy_;
diff --git a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
index 65c61f9..05f2f5f 100644
--- a/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
+++ b/include/CommonAPI/DBus/DBusSelectiveEvent.hpp
@@ -15,37 +15,42 @@
namespace CommonAPI {
namespace DBus {
-template<typename _EventType, typename... _Arguments>
-class DBusSelectiveEvent: public DBusEvent<_EventType, _Arguments...> {
+template<typename EventType_, typename... Arguments_>
+class DBusSelectiveEvent: public DBusEvent<EventType_, Arguments_...> {
public:
- typedef typename DBusEvent<_EventType, _Arguments...>::Listener Listener;
- typedef DBusEvent<_EventType, _Arguments...> DBusEventBase;
+ typedef typename DBusEvent<EventType_, Arguments_...>::Listener Listener;
+ typedef DBusEvent<EventType_, Arguments_...> DBusEventBase;
DBusSelectiveEvent(DBusProxy &_proxy,
- const char *_name, const char *_signature,
- std::tuple<_Arguments...> _arguments)
- : DBusEventBase(_proxy, _name, _signature, _arguments) {
+ const char *_name, const char *_signature,
+ std::tuple<Arguments_...> _arguments)
+ : DBusEventBase(_proxy, _name, _signature, _arguments) {
}
DBusSelectiveEvent(DBusProxy &_proxy,
- const char *_name, const char *_signature,
+ const char *_name, const char *_signature,
const char *_path, const char *_interface,
- std::tuple<_Arguments...> _arguments)
- : DBusEventBase(_proxy, _name, _signature, _path, _interface, _arguments) {
+ std::tuple<Arguments_...> _arguments)
+ : DBusEventBase(_proxy, _name, _signature, _path, _interface, _arguments) {
}
virtual ~DBusSelectiveEvent() {}
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);
+ 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 onLastListenerRemoved(const Listener &) {
- static_cast<DBusProxy&>(this->proxy_).unsubscribeFromSelectiveBroadcast(
+ static_cast<DBusProxy&>(this->proxy_).unsubscribeFromSelectiveBroadcast(
this->name_, this->subscription_, this);
}
};
diff --git a/include/CommonAPI/DBus/DBusSerializableArguments.hpp b/include/CommonAPI/DBus/DBusSerializableArguments.hpp
index f763ce5..6b48eff 100644
--- a/include/CommonAPI/DBus/DBusSerializableArguments.hpp
+++ b/include/CommonAPI/DBus/DBusSerializableArguments.hpp
@@ -17,12 +17,12 @@
namespace CommonAPI {
namespace DBus {
-template<typename... _Arguments>
+template<typename... Arguments_>
using DBusSerializableArguments = CommonAPI::SerializableArguments<
- DBusInputStream,
- DBusOutputStream,
- _Arguments...
- >;
+ DBusInputStream,
+ DBusOutputStream,
+ Arguments_...
+ >;
} // namespace DBus
} // namespace CommonAPI
diff --git a/include/CommonAPI/DBus/DBusServiceRegistry.hpp b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
index 3dbcf1b..584c47a 100644
--- a/include/CommonAPI/DBus/DBusServiceRegistry.hpp
+++ b/include/CommonAPI/DBus/DBusServiceRegistry.hpp
@@ -31,6 +31,7 @@
#include <CommonAPI/Types.hpp>
#include <CommonAPI/DBus/DBusProxyConnection.hpp>
#include <CommonAPI/DBus/DBusFactory.hpp>
+#include <CommonAPI/DBus/DBusObjectManagerStub.hpp>
namespace CommonAPI {
namespace DBus {
@@ -98,15 +99,17 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
virtual void onSignalDBusMessage(const DBusMessage&);
+ void setDBusServicePredefined(const std::string& _serviceName);
+
private:
struct DBusInterfaceNameListenersRecord {
DBusInterfaceNameListenersRecord()
- : state(DBusRecordState::UNKNOWN) {
+ : state(DBusRecordState::UNKNOWN) {
}
DBusInterfaceNameListenersRecord(DBusInterfaceNameListenersRecord &&_other)
- : state(_other.state),
- listenerList(std::move(_other.listenerList)) {
+ : state(_other.state),
+ listenerList(std::move(_other.listenerList)) {
}
DBusRecordState state;
@@ -117,23 +120,23 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
struct DBusServiceListenersRecord {
DBusServiceListenersRecord()
- : uniqueBusNameState(DBusRecordState::UNKNOWN),
- mutexOnResolve() {
+ : uniqueBusNameState(DBusRecordState::UNKNOWN),
+ mutexOnResolve() {
}
DBusServiceListenersRecord(DBusServiceListenersRecord&& other)
- : uniqueBusNameState(other.uniqueBusNameState),
- uniqueBusName(std::move(other.uniqueBusName)),
- promiseOnResolve(std::move(other.promiseOnResolve)),
- futureOnResolve(std::move(other.futureOnResolve)),
- mutexOnResolve(std::move(other.mutexOnResolve)),
- dbusObjectPathListenersMap(std::move(other.dbusObjectPathListenersMap)) {
+ : uniqueBusNameState(other.uniqueBusNameState),
+ uniqueBusName(std::move(other.uniqueBusName)),
+ promiseOnResolve(std::move(other.promiseOnResolve)),
+ futureOnResolve(std::move(other.futureOnResolve)),
+ mutexOnResolve(std::move(other.mutexOnResolve)),
+ dbusObjectPathListenersMap(std::move(other.dbusObjectPathListenersMap)) {
}
~DBusServiceListenersRecord() {};
DBusRecordState uniqueBusNameState;
- std::string uniqueBusName;
+ std::string uniqueBusName;
std::promise<DBusRecordState> promiseOnResolve;
std::shared_future<DBusRecordState> futureOnResolve;
@@ -147,15 +150,16 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
struct DBusObjectPathCache {
DBusObjectPathCache()
- : referenceCount(0),
- state(DBusRecordState::UNKNOWN) {
+ : referenceCount(0),
+ state(DBusRecordState::UNKNOWN){
}
DBusObjectPathCache(DBusObjectPathCache&& other)
- : referenceCount(other.referenceCount),
- state(other.state),
- promiseOnResolve(std::move(other.promiseOnResolve)),
- dbusInterfaceNamesCache(std::move(other.dbusInterfaceNamesCache)) {
+ : referenceCount(other.referenceCount),
+ state(other.state),
+ promiseOnResolve(std::move(other.promiseOnResolve)),
+ serviceName(std::move(other.serviceName)),
+ dbusInterfaceNamesCache(std::move(other.dbusInterfaceNamesCache)){
}
~DBusObjectPathCache() {}
@@ -163,20 +167,21 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
size_t referenceCount;
DBusRecordState state;
std::promise<DBusRecordState> promiseOnResolve;
+ std::string serviceName;
std::unordered_set<std::string> dbusInterfaceNamesCache;
};
struct DBusUniqueNameRecord {
DBusUniqueNameRecord()
- : objectPathsState(DBusRecordState::UNKNOWN) {
+ : objectPathsState(DBusRecordState::UNKNOWN) {
}
DBusUniqueNameRecord(DBusUniqueNameRecord&& other)
- : uniqueName(std::move(other.uniqueName)),
- objectPathsState(other.objectPathsState),
- ownedBusNames(std::move(other.ownedBusNames)),
- dbusObjectPathsCache(std::move(other.dbusObjectPathsCache)) {
+ : uniqueName(std::move(other.uniqueName)),
+ objectPathsState(other.objectPathsState),
+ ownedBusNames(std::move(other.ownedBusNames)),
+ dbusObjectPathsCache(std::move(other.dbusObjectPathsCache)) {
}
std::string uniqueName;
@@ -198,8 +203,8 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
DBusServiceListenersRecord& dbusServiceListenersRecord);
void onGetNameOwnerCallback(const CallStatus& status,
- std::string dbusServiceUniqueName,
- const std::string& dbusServiceName);
+ std::string dbusServiceUniqueName,
+ const std::string& dbusServiceName);
DBusRecordState resolveDBusInterfaceNameState(const DBusAddress &_address,
@@ -207,12 +212,37 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
DBusObjectPathCache& getDBusObjectPathCacheReference(const std::string& dbusObjectPath,
+ const std::string& dbusServiceName,
const std::string& dbusServiceUniqueName,
DBusUniqueNameRecord& dbusUniqueNameRecord);
void releaseDBusObjectPathCacheReference(const std::string& dbusObjectPath,
const DBusServiceListenersRecord& dbusServiceListenersRecord);
+ typedef std::function<void(const CallStatus&,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict,
+ const std::string&,
+ const std::string&)> GetManagedObjectsCallback;
+
+ bool resolveObjectPathWithObjectManager(const std::string& dbusServiceUniqueName, const std::string& dbusObjectPath);
+
+ bool getManagedObjects(const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath,
+ GetManagedObjectsCallback callback);
+
+ void onGetManagedObjectsCallbackResolve(const CallStatus& callStatus,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict,
+ const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath);
+
+ void onGetManagedObjectsCallbackResolveFurther(const CallStatus& callStatus,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict,
+ const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath);
+
+ void processManagedObject(const std::string& dbusObjectPath,
+ const std::string& dbusServiceUniqueName,
+ const std::string& interfaceName);
bool introspectDBusObjectPath(const std::string& dbusServiceUniqueName, const std::string& dbusObjectPath);
@@ -290,17 +320,19 @@ class DBusServiceRegistry: public std::enable_shared_from_this<DBusServiceRegist
void fetchAllServiceNames();
- inline const bool isDBusServiceName(const std::string &_name) {
+ inline bool isDBusServiceName(const std::string &_name) {
return (_name.length() > 0 && _name[0] != ':');
};
- inline const bool isOrgFreedesktopDBusInterface(const std::string& dbusInterfaceName) {
+ inline bool isOrgFreedesktopDBusInterface(const std::string& dbusInterfaceName) {
return dbusInterfaceName.find("org.freedesktop.DBus.") == 0;
}
std::thread::id notificationThread_;
+ std::unordered_set<std::string> dbusPredefinedServices_;
+
private:
typedef std::map<std::shared_ptr<DBusProxyConnection>, std::shared_ptr<DBusServiceRegistry>> RegistryMap_t;
static RegistryMap_t registries_;
diff --git a/include/CommonAPI/DBus/DBusStubAdapter.hpp b/include/CommonAPI/DBus/DBusStubAdapter.hpp
index 5d1657b..b2bea37 100644
--- a/include/CommonAPI/DBus/DBusStubAdapter.hpp
+++ b/include/CommonAPI/DBus/DBusStubAdapter.hpp
@@ -23,29 +23,29 @@ namespace DBus {
class DBusProxyConnection;
class DBusStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public DBusInterfaceHandler {
+ : virtual public CommonAPI::StubAdapter,
+ public DBusInterfaceHandler {
public:
- COMMONAPI_EXPORT DBusStubAdapter(const DBusAddress &_dbusAddress,
+ COMMONAPI_EXPORT DBusStubAdapter(const DBusAddress &_dbusAddress,
const std::shared_ptr<DBusProxyConnection> &_connection,
const bool isManagingInterface);
- COMMONAPI_EXPORT virtual ~DBusStubAdapter();
+ COMMONAPI_EXPORT virtual ~DBusStubAdapter();
- COMMONAPI_EXPORT virtual void init(std::shared_ptr<DBusStubAdapter> _instance);
- COMMONAPI_EXPORT virtual void deinit();
+ COMMONAPI_EXPORT virtual void init(std::shared_ptr<DBusStubAdapter> _instance);
+ COMMONAPI_EXPORT virtual void deinit();
- COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
- COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
+ COMMONAPI_EXPORT const DBusAddress &getDBusAddress() const;
+ COMMONAPI_EXPORT const std::shared_ptr<DBusProxyConnection> &getDBusConnection() const;
- COMMONAPI_EXPORT const bool isManaging() const;
+ COMMONAPI_EXPORT bool isManaging() const;
- COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
- COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage &_message) = 0;
+ COMMONAPI_EXPORT virtual const char* getMethodsDBusIntrospectionXmlData() const = 0;
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusMessage(const DBusMessage &_message) = 0;
- COMMONAPI_EXPORT virtual void deactivateManagedInstances() = 0;
- COMMONAPI_EXPORT virtual const bool hasFreedesktopProperties();
- COMMONAPI_EXPORT virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage &_message) = 0;
+ COMMONAPI_EXPORT virtual void deactivateManagedInstances() = 0;
+ COMMONAPI_EXPORT virtual bool hasFreedesktopProperties();
+ COMMONAPI_EXPORT virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const DBusMessage &_message) = 0;
protected:
DBusAddress dbusAddress_;
diff --git a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
index 90efba5..b533a2e 100644
--- a/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
+++ b/include/CommonAPI/DBus/DBusStubAdapterHelper.hpp
@@ -47,22 +47,27 @@ struct DBusAttributeDispatcherStruct {
typedef std::unordered_map<std::string, DBusAttributeDispatcherStruct> StubAttributeTable;
-template <typename _StubClass>
+template <typename StubClass_>
class DBusStubAdapterHelper: public virtual DBusStubAdapter {
public:
- typedef typename _StubClass::StubAdapterType StubAdapterType;
- typedef typename _StubClass::RemoteEventHandlerType RemoteEventHandlerType;
+ typedef typename StubClass_::StubAdapterType StubAdapterType;
+ typedef typename StubClass_::RemoteEventHandlerType RemoteEventHandlerType;
class StubDispatcher: public StubDispatcherBase {
public:
- virtual ~StubDispatcher() {}
- virtual bool dispatchDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelper<_StubClass>& dbusStubAdapterHelper) = 0;
- virtual void appendGetAllReply(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
- DBusStubAdapterHelper<_StubClass>& dbusStubAdapterHelper,
- DBusOutputStream &_output) {}
+ virtual ~StubDispatcher() {}
+ virtual bool dispatchDBusMessage(const DBusMessage &_message,
+ const std::shared_ptr<StubClass_> &_stub,
+ DBusStubAdapterHelper<StubClass_> &_helper) = 0;
+ virtual void appendGetAllReply(const DBusMessage &_message,
+ const std::shared_ptr<StubClass_> &_stub,
+ DBusStubAdapterHelper<StubClass_> &_helper,
+ DBusOutputStream &_output) {
+ (void)_message;
+ (void)_stub;
+ (void)_helper;
+ (void)_output;
+ }
};
// interfaceMemberName, interfaceMemberSignature
typedef std::pair<const char*, const char*> DBusInterfaceMemberPath;
@@ -70,7 +75,7 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
DBusStubAdapterHelper(const DBusAddress &_address,
const std::shared_ptr<DBusProxyConnection> &_connection,
- const std::shared_ptr<_StubClass> &_stub,
+ const std::shared_ptr<StubClass_> &_stub,
const bool _isManaging):
DBusStubAdapter(_address, _connection, _isManaging),
stub_(_stub),
@@ -135,7 +140,7 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
virtual const StubDispatcherTable& getStubDispatcherTable() = 0;
virtual const StubAttributeTable& getStubAttributeTable() = 0;
- std::shared_ptr<_StubClass> stub_;
+ std::shared_ptr<StubClass_> stub_;
RemoteEventHandlerType* remoteEventHandler_;
private:
@@ -154,9 +159,9 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
return false;
}
- StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
- assert(getterDispatcher != NULL); // all attributes have at least a getter
- return (getterDispatcher->dispatchDBusMessage(_message, stub_, *this));
+ StubDispatcher* getterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.getter);
+ assert(getterDispatcher != NULL); // all attributes have at least a getter
+ return (getterDispatcher->dispatchDBusMessage(_message, stub_, *this));
}
bool handleFreedesktopSet(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
@@ -174,12 +179,12 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
return false;
}
- StubDispatcher *setterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.setter);
- if (setterDispatcher == NULL) { // readonly attributes do not have a setter
- return false;
- }
+ StubDispatcher *setterDispatcher = static_cast<StubDispatcher*>(attributeDispatcherIterator->second.setter);
+ if (setterDispatcher == NULL) { // readonly attributes do not have a setter
+ return false;
+ }
- return setterDispatcher->dispatchDBusMessage(dbusMessage, stub_, *this);
+ return setterDispatcher->dispatchDBusMessage(dbusMessage, stub_, *this);
}
bool handleFreedesktopGetAll(const DBusMessage& dbusMessage, DBusInputStream& dbusInputStream) {
@@ -218,24 +223,24 @@ class DBusStubAdapterHelper: public virtual DBusStubAdapter {
template< class >
struct DBusStubSignalHelper;
-template<template<class ...> class _In, class... _InArgs>
-struct DBusStubSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>> {
+template<template<class ...> class In_, class... InArgs_>
+struct DBusStubSignalHelper<In_<DBusInputStream, DBusOutputStream, InArgs_...>> {
static inline bool sendSignal(const char* objectPath,
const char* interfaceName,
const char* signalName,
const char* signalSignature,
const std::shared_ptr<DBusProxyConnection>& dbusConnection,
- const _InArgs&... inArgs) {
+ const InArgs_&... inArgs) {
DBusMessage dbusMessage = DBusMessage::createSignal(
objectPath,
interfaceName,
signalName,
signalSignature);
- if (sizeof...(_InArgs) > 0) {
+ if (sizeof...(InArgs_) > 0) {
DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
+ const bool success = DBusSerializableArguments<InArgs_...>::serialize(outputStream, inArgs...);
if (!success) {
return false;
}
@@ -246,11 +251,11 @@ struct DBusStubSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>>
return dbusMessageSent;
}
- template <typename _DBusStub = DBusStubAdapter>
- static bool sendSignal(const _DBusStub &_stub,
+ template <typename DBusStub_ = DBusStubAdapter>
+ static bool sendSignal(const DBusStub_ &_stub,
const char *_name,
const char *_signature,
- const _InArgs&... inArgs) {
+ const InArgs_&... inArgs) {
return(sendSignal(_stub.getDBusAddress().getObjectPath().c_str(),
_stub.getDBusAddress().getInterface().c_str(),
_name,
@@ -260,24 +265,24 @@ struct DBusStubSignalHelper<_In<DBusInputStream, DBusOutputStream, _InArgs...>>
}
- template <typename _DBusStub = DBusStubAdapter>
+ template <typename DBusStub_ = DBusStubAdapter>
static bool sendSignal(const char *_target,
- const _DBusStub &_stub,
- const char *_name,
- const char *_signature,
- const _InArgs&... inArgs) {
+ const DBusStub_ &_stub,
+ const char *_name,
+ const char *_signature,
+ const InArgs_&... inArgs) {
DBusMessage dbusMessage
- = DBusMessage::createSignal(
- _stub.getDBusAddress().getObjectPath().c_str(),
- _stub.getDBusAddress().getInterface().c_str(),
- _name,
- _signature);
+ = DBusMessage::createSignal(
+ _stub.getDBusAddress().getObjectPath().c_str(),
+ _stub.getDBusAddress().getInterface().c_str(),
+ _name,
+ _signature);
dbusMessage.setDestination(_target);
- if (sizeof...(_InArgs) > 0) {
+ if (sizeof...(InArgs_) > 0) {
DBusOutputStream outputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::serialize(outputStream, inArgs...);
+ const bool success = DBusSerializableArguments<InArgs_...>::serialize(outputStream, inArgs...);
if (!success) {
return false;
}
@@ -292,52 +297,54 @@ template< class, class, class >
class DBusMethodStubDispatcher;
template <
- typename _StubClass,
- template <class...> class _In, class... _InArgs,
- template <class...> class _DeplIn, class... _DeplInArgs>
+ typename StubClass_,
+ template <class...> class In_, class... InArgs_,
+ template <class...> class DeplIn_, class... DeplIn_Args>
-class DBusMethodStubDispatcher<_StubClass, _In<_InArgs...>, _DeplIn<_DeplInArgs...> >: public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
+class DBusMethodStubDispatcher<StubClass_, In_<InArgs_...>, DeplIn_<DeplIn_Args...> >: public DBusStubAdapterHelper<StubClass_>::StubDispatcher {
public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef void (_StubClass::*_StubFunctor)(std::shared_ptr<CommonAPI::ClientId>, _InArgs...);
+ typedef DBusStubAdapterHelper<StubClass_> DBusStubAdapterHelperType;
+ typedef void (StubClass_::*StubFunctor_)(std::shared_ptr<CommonAPI::ClientId>, InArgs_...);
- DBusMethodStubDispatcher(_StubFunctor stubFunctor, std::tuple<_DeplInArgs*...> _in):
+ DBusMethodStubDispatcher(StubFunctor_ stubFunctor, std::tuple<DeplIn_Args*...> _in):
stubFunctor_(stubFunctor) {
- initialize(typename make_sequence_range<sizeof...(_DeplInArgs), 0>::type(), _in);
+ initialize(typename make_sequence_range<sizeof...(DeplIn_Args), 0>::type(), _in);
}
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- return handleDBusMessage(dbusMessage, stub, dbusStubAdapterHelper, typename make_sequence_range<sizeof...(_InArgs), 0>::type());
+ bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ return handleDBusMessage(dbusMessage, stub, dbusStubAdapterHelper, typename make_sequence_range<sizeof...(InArgs_), 0>::type());
}
private:
- template <int... _DeplInArgIndices>
- inline void initialize(index_sequence<_DeplInArgIndices...>, std::tuple<_DeplInArgs*...> &_in) {
- in_ = std::make_tuple(std::get<_DeplInArgIndices>(_in)...);
+ template <int... DeplIn_ArgIndices>
+ inline void initialize(index_sequence<DeplIn_ArgIndices...>, std::tuple<DeplIn_Args*...> &_in) {
+ in_ = std::make_tuple(std::get<DeplIn_ArgIndices>(_in)...);
}
- template <int... _InArgIndices>
+ template <int... InArgIndices_>
inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
+ const std::shared_ptr<StubClass_>& stub,
DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>) {
+ index_sequence<InArgIndices_...>) {
+ (void)dbusStubAdapterHelper;
+ std::tuple<InArgs_...> argTuple;
- if (sizeof...(_InArgs) > 0) {
+ if (sizeof...(InArgs_) > 0) {
DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<CommonAPI::Deployable<_InArgs, _DeplInArgs>...>::deserialize(dbusInputStream, std::get<_InArgIndices>(in_)...);
+ const bool success = DBusSerializableArguments<CommonAPI::Deployable<InArgs_, DeplIn_Args>...>::deserialize(dbusInputStream, std::get<InArgIndices_>(in_)...);
if (!success)
return false;
}
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- (stub.get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(in_).getValue())...);
+ (stub.get()->*stubFunctor_)(clientId, std::move(std::get<InArgIndices_>(in_).getValue())...);
return true;
}
- _StubFunctor stubFunctor_;
- std::tuple<CommonAPI::Deployable<_InArgs, _DeplInArgs>...> in_;
+ StubFunctor_ stubFunctor_;
+ std::tuple<CommonAPI::Deployable<InArgs_, DeplIn_Args>...> in_;
};
@@ -345,189 +352,192 @@ template< class, class, class, class, class>
class DBusMethodWithReplyStubDispatcher;
template <
- typename _StubClass,
- template <class...> class _In, class... _InArgs,
- template <class...> class _Out, class... _OutArgs,
- template <class...> class _DeplIn, class... _DeplInArgs,
- template <class...> class _DeplOut, class... _DeplOutArgs>
+ typename StubClass_,
+ template <class...> class In_, class... InArgs_,
+ template <class...> class Out_, class... OutArgs_,
+ template <class...> class DeplIn_, class... DeplIn_Args,
+ template <class...> class DeplOut_, class... DeplOutArgs_>
class DBusMethodWithReplyStubDispatcher<
- _StubClass,
- _In<_InArgs...>,
- _Out<_OutArgs...>,
- _DeplIn<_DeplInArgs...>,
- _DeplOut<_DeplOutArgs...> >:
- public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
+ StubClass_,
+ In_<InArgs_...>,
+ Out_<OutArgs_...>,
+ DeplIn_<DeplIn_Args...>,
+ DeplOut_<DeplOutArgs_...> >:
+ public DBusStubAdapterHelper<StubClass_>::StubDispatcher {
public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef std::function<void (_OutArgs...)> ReplyType_t;
- typedef void (_StubClass::*_StubFunctor)(
- std::shared_ptr<CommonAPI::ClientId>, _InArgs..., ReplyType_t);
+ typedef DBusStubAdapterHelper<StubClass_> DBusStubAdapterHelperType;
+ typedef std::function<void (OutArgs_...)> ReplyType_t;
+ typedef void (StubClass_::*StubFunctor_)(
+ std::shared_ptr<CommonAPI::ClientId>, InArgs_..., ReplyType_t);
- DBusMethodWithReplyStubDispatcher(_StubFunctor stubFunctor,
+ DBusMethodWithReplyStubDispatcher(StubFunctor_ stubFunctor,
const char* dbusReplySignature,
- std::tuple<_DeplInArgs*...> _inDepArgs,
- std::tuple<_DeplOutArgs*...> _outDepArgs):
+ std::tuple<DeplIn_Args*...> _inDepArgs,
+ std::tuple<DeplOutArgs_*...> _outDepArgs):
stubFunctor_(stubFunctor),
dbusReplySignature_(dbusReplySignature),
out_(_outDepArgs),
currentCall_(0) {
- initialize(typename make_sequence_range<sizeof...(_DeplInArgs), 0>::type(), _inDepArgs);
+ initialize(typename make_sequence_range<sizeof...(DeplIn_Args), 0>::type(), _inDepArgs);
}
bool dispatchDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
+ const std::shared_ptr<StubClass_>& stub,
DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- connection_ = dbusStubAdapterHelper.getDBusConnection();
+ connection_ = dbusStubAdapterHelper.getDBusConnection();
return handleDBusMessage(
dbusMessage,
stub,
dbusStubAdapterHelper,
- typename make_sequence_range<sizeof...(_InArgs), 0>::type(),
- typename make_sequence_range<sizeof...(_OutArgs), 0>::type());
+ typename make_sequence_range<sizeof...(InArgs_), 0>::type(),
+ typename make_sequence_range<sizeof...(OutArgs_), 0>::type());
}
- bool sendReply(CommonAPI::CallId_t _call,
- std::tuple<CommonAPI::Deployable<_OutArgs, _DeplOutArgs>...> args = std::make_tuple()) {
- return sendReplyInternal(_call, typename make_sequence_range<sizeof...(_OutArgs), 0>::type(), args);
- }
+ bool sendReply(CommonAPI::CallId_t _call,
+ std::tuple<CommonAPI::Deployable<OutArgs_, DeplOutArgs_>...> args = std::make_tuple()) {
+ return sendReplyInternal(_call, typename make_sequence_range<sizeof...(OutArgs_), 0>::type(), args);
+ }
private:
- template <int... _DeplInArgIndices>
- inline void initialize(index_sequence<_DeplInArgIndices...>, std::tuple<_DeplInArgs*...> &_in) {
- in_ = std::make_tuple(std::get<_DeplInArgIndices>(_in)...);
- }
+ template <int... DeplIn_ArgIndices>
+ inline void initialize(index_sequence<DeplIn_ArgIndices...>, std::tuple<DeplIn_Args*...> &_in) {
+ in_ = std::make_tuple(std::get<DeplIn_ArgIndices>(_in)...);
+ }
- template <int... _InArgIndices, int... _OutArgIndices>
+ template <int... InArgIndices_, int... OutArgIndices_>
inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
+ const std::shared_ptr<StubClass_>& stub,
DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>,
- index_sequence<_OutArgIndices...>) {
- if (sizeof...(_DeplInArgs) > 0) {
+ index_sequence<InArgIndices_...>,
+ index_sequence<OutArgIndices_...>) {
+ (void)dbusStubAdapterHelper;
+ if (sizeof...(DeplIn_Args) > 0) {
DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<CommonAPI::Deployable<_InArgs, _DeplInArgs>...>::deserialize(dbusInputStream, std::get<_InArgIndices>(in_)...);
+ const bool success = DBusSerializableArguments<CommonAPI::Deployable<InArgs_, DeplIn_Args>...>::deserialize(dbusInputStream, std::get<InArgIndices_>(in_)...);
if (!success)
return false;
}
std::shared_ptr<DBusClientId> clientId
- = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
+ = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
DBusMessage reply = dbusMessage.createMethodReturn(dbusReplySignature_);
CommonAPI::CallId_t call;
{
- std::lock_guard<std::mutex> lock(mutex_);
- call = currentCall_++;
- pending_[call] = reply;
+ std::lock_guard<std::mutex> lock(mutex_);
+ call = currentCall_++;
+ pending_[call] = reply;
}
(stub.get()->*stubFunctor_)(
- clientId,
- std::move(std::get<_InArgIndices>(in_).getValue())...,
- [call, this](_OutArgs... _args){
- this->sendReply(call, std::make_tuple(CommonAPI::Deployable<_OutArgs, _DeplOutArgs>(
- _args, std::get<_OutArgIndices>(out_)
- )...));
- }
+ clientId,
+ std::move(std::get<InArgIndices_>(in_).getValue())...,
+ [call, this](OutArgs_... _args){
+ this->sendReply(call, std::make_tuple(CommonAPI::Deployable<OutArgs_, DeplOutArgs_>(
+ _args, std::get<OutArgIndices_>(out_)
+ )...));
+ }
);
- return true;
- }
+ return true;
+ }
- template<int... _OutArgIndices>
+ template<int... OutArgIndices_>
bool sendReplyInternal(CommonAPI::CallId_t _call,
- index_sequence<_OutArgIndices...>,
- std::tuple<CommonAPI::Deployable<_OutArgs, _DeplOutArgs>...> args) {
- std::lock_guard<std::mutex> lock(mutex_);
- auto reply = pending_.find(_call);
- if (reply != pending_.end()) {
- if (sizeof...(_DeplOutArgs) > 0) {
- DBusOutputStream output(reply->second);
- if (!DBusSerializableArguments<CommonAPI::Deployable<_OutArgs, _DeplOutArgs>...>::serialize(
- output, std::get<_OutArgIndices>(args)...)) {
- pending_.erase(_call);
- return false;
- }
- output.flush();
- }
- bool isSuccessful = connection_->sendDBusMessage(reply->second);
- pending_.erase(_call);
- return isSuccessful;
- }
- return false;
- }
-
- _StubFunctor stubFunctor_;
+ index_sequence<OutArgIndices_...>,
+ std::tuple<CommonAPI::Deployable<OutArgs_, DeplOutArgs_>...> args) {
+ std::lock_guard<std::mutex> lock(mutex_);
+ auto reply = pending_.find(_call);
+ if (reply != pending_.end()) {
+ if (sizeof...(DeplOutArgs_) > 0) {
+ DBusOutputStream output(reply->second);
+ if (!DBusSerializableArguments<CommonAPI::Deployable<OutArgs_, DeplOutArgs_>...>::serialize(
+ output, std::get<OutArgIndices_>(args)...)) {
+ (void)args;
+ pending_.erase(_call);
+ return false;
+ }
+ output.flush();
+ }
+ bool isSuccessful = connection_->sendDBusMessage(reply->second);
+ pending_.erase(_call);
+ return isSuccessful;
+ }
+ return false;
+ }
+
+ StubFunctor_ stubFunctor_;
const char* dbusReplySignature_;
- std::tuple<CommonAPI::Deployable<_InArgs, _DeplInArgs>...> in_;
- std::tuple<_DeplOutArgs*...> out_;
- CommonAPI::CallId_t currentCall_;
- std::map<CommonAPI::CallId_t, DBusMessage> pending_;
- std::mutex mutex_; // protects pending_
+ std::tuple<CommonAPI::Deployable<InArgs_, DeplIn_Args>...> in_;
+ std::tuple<DeplOutArgs_*...> out_;
+ CommonAPI::CallId_t currentCall_;
+ std::map<CommonAPI::CallId_t, DBusMessage> pending_;
+ std::mutex mutex_; // protects pending_
- std::shared_ptr<DBusProxyConnection> connection_;
+ std::shared_ptr<DBusProxyConnection> connection_;
};
template< class, class, class, class >
class DBusMethodWithReplyAdapterDispatcher;
template <
- typename _StubClass,
- typename _StubAdapterClass,
- template <class...> class _In, class... _InArgs,
- template <class...> class _Out, class... _OutArgs>
-class DBusMethodWithReplyAdapterDispatcher<_StubClass, _StubAdapterClass, _In<_InArgs...>, _Out<_OutArgs...> >:
- public DBusStubAdapterHelper<_StubClass>::StubDispatcher {
+ typename StubClass_,
+ typename StubAdapterClass_,
+ template <class...> class In_, class... InArgs_,
+ template <class...> class Out_, class... OutArgs_>
+class DBusMethodWithReplyAdapterDispatcher<StubClass_, StubAdapterClass_, In_<InArgs_...>, Out_<OutArgs_...> >:
+ public DBusStubAdapterHelper<StubClass_>::StubDispatcher {
public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef void (_StubAdapterClass::*_StubFunctor)(std::shared_ptr<CommonAPI::ClientId>, _InArgs..., _OutArgs&...);
- typedef typename CommonAPI::Stub<typename DBusStubAdapterHelperType::StubAdapterType, typename _StubClass::RemoteEventType> StubType;
+ typedef DBusStubAdapterHelper<StubClass_> DBusStubAdapterHelperType;
+ typedef void (StubAdapterClass_::*StubFunctor_)(std::shared_ptr<CommonAPI::ClientId>, InArgs_..., OutArgs_&...);
+ typedef typename CommonAPI::Stub<typename DBusStubAdapterHelperType::StubAdapterType, typename StubClass_::RemoteEventType> StubType;
- DBusMethodWithReplyAdapterDispatcher(_StubFunctor stubFunctor, const char* dbusReplySignature):
+ DBusMethodWithReplyAdapterDispatcher(StubFunctor_ stubFunctor, const char* dbusReplySignature):
stubFunctor_(stubFunctor),
dbusReplySignature_(dbusReplySignature) {
}
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
- std::tuple<_InArgs..., _OutArgs...> argTuple;
+ bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ std::tuple<InArgs_..., OutArgs_...> argTuple;
return handleDBusMessage(
dbusMessage,
stub,
dbusStubAdapterHelper,
- typename make_sequence_range<sizeof...(_InArgs), 0>::type(),
- typename make_sequence_range<sizeof...(_OutArgs), sizeof...(_InArgs)>::type(),argTuple);
+ typename make_sequence_range<sizeof...(InArgs_), 0>::type(),
+ typename make_sequence_range<sizeof...(OutArgs_), sizeof...(InArgs_)>::type(),argTuple);
}
private:
- template <int... _InArgIndices, int... _OutArgIndices>
+ template <int... InArgIndices_, int... OutArgIndices_>
inline bool handleDBusMessage(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
+ const std::shared_ptr<StubClass_>& stub,
DBusStubAdapterHelperType& dbusStubAdapterHelper,
- index_sequence<_InArgIndices...>,
- index_sequence<_OutArgIndices...>,
- std::tuple<_InArgs..., _OutArgs...> argTuple) const {
+ index_sequence<InArgIndices_...>,
+ index_sequence<OutArgIndices_...>,
+ std::tuple<InArgs_..., OutArgs_...> argTuple) const {
+ (void)argTuple;
- if (sizeof...(_InArgs) > 0) {
+ if (sizeof...(InArgs_) > 0) {
DBusInputStream dbusInputStream(dbusMessage);
- const bool success = DBusSerializableArguments<_InArgs...>::deserialize(dbusInputStream, std::get<_InArgIndices>(argTuple)...);
+ const bool success = DBusSerializableArguments<InArgs_...>::deserialize(dbusInputStream, std::get<InArgIndices_>(argTuple)...);
if (!success)
return false;
}
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- (stub->StubType::getStubAdapter().get()->*stubFunctor_)(clientId, std::move(std::get<_InArgIndices>(argTuple))..., std::get<_OutArgIndices>(argTuple)...);
+ (stub->StubType::getStubAdapter().get()->*stubFunctor_)(clientId, std::move(std::get<InArgIndices_>(argTuple))..., std::get<OutArgIndices_>(argTuple)...);
DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(dbusReplySignature_);
- if (sizeof...(_OutArgs) > 0) {
+ if (sizeof...(OutArgs_) > 0) {
DBusOutputStream dbusOutputStream(dbusMessageReply);
- const bool success = DBusSerializableArguments<_OutArgs...>::serialize(dbusOutputStream, std::get<_OutArgIndices>(argTuple)...);
+ const bool success = DBusSerializableArguments<OutArgs_...>::serialize(dbusOutputStream, std::get<OutArgIndices_>(argTuple)...);
if (!success)
return false;
@@ -537,18 +547,18 @@ class DBusMethodWithReplyAdapterDispatcher<_StubClass, _StubAdapterClass, _In<_I
return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
}
- _StubFunctor stubFunctor_;
+ StubFunctor_ stubFunctor_;
const char* dbusReplySignature_;
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_StubClass>::StubDispatcher {
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<StubClass_>::StubDispatcher {
public:
- typedef DBusStubAdapterHelper<_StubClass> DBusStubAdapterHelperType;
- typedef const _AttributeType& (_StubClass::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
+ typedef DBusStubAdapterHelper<StubClass_> DBusStubAdapterHelperType;
+ typedef const AttributeType_& (StubClass_::*GetStubFunctor)(std::shared_ptr<CommonAPI::ClientId>);
- DBusGetAttributeStubDispatcher(GetStubFunctor _getStubFunctor, const char *_signature, _AttributeDepl *_depl = nullptr):
+ DBusGetAttributeStubDispatcher(GetStubFunctor _getStubFunctor, const char *_signature, AttributeDepl_ *_depl = nullptr):
getStubFunctor_(_getStubFunctor),
signature_(_signature),
depl_(_depl) {
@@ -556,25 +566,27 @@ class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_Stub
virtual ~DBusGetAttributeStubDispatcher() {};
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
return sendAttributeValueReply(dbusMessage, stub, dbusStubAdapterHelper);
}
- void appendGetAllReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper, DBusOutputStream &_output) {
+ void appendGetAllReply(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper, DBusOutputStream &_output) {
+ (void)dbusStubAdapterHelper;
+
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- auto varDepl = CommonAPI::DBus::VariantDeployment<_AttributeDepl>(true, depl_); // presuming FreeDesktop variant deployment, as support for "legacy" service only
- _output << CommonAPI::Deployable<CommonAPI::Variant<_AttributeType>, CommonAPI::DBus::VariantDeployment<_AttributeDepl>>((stub.get()->*getStubFunctor_)(clientId), &varDepl);
+ auto varDepl = CommonAPI::DBus::VariantDeployment<AttributeDepl_>(true, depl_); // presuming FreeDesktop variant deployment, as support for "legacy" service only
+ _output << CommonAPI::Deployable<CommonAPI::Variant<AttributeType_>, CommonAPI::DBus::VariantDeployment<AttributeDepl_>>((stub.get()->*getStubFunctor_)(clientId), &varDepl);
_output.flush();
}
protected:
- virtual bool sendAttributeValueReply(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ virtual bool sendAttributeValueReply(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
DBusMessage dbusMessageReply = dbusMessage.createMethodReturn(signature_);
DBusOutputStream dbusOutputStream(dbusMessageReply);
std::shared_ptr<DBusClientId> clientId = std::make_shared<DBusClientId>(std::string(dbusMessage.getSender()));
- dbusOutputStream << CommonAPI::Deployable<_AttributeType, _AttributeDepl>((stub.get()->*getStubFunctor_)(clientId), depl_);
+ dbusOutputStream << CommonAPI::Deployable<AttributeType_, AttributeDepl_>((stub.get()->*getStubFunctor_)(clientId), depl_);
dbusOutputStream.flush();
return dbusStubAdapterHelper.getDBusConnection()->sendDBusMessage(dbusMessageReply);
@@ -583,32 +595,32 @@ class DBusGetAttributeStubDispatcher: public virtual DBusStubAdapterHelper<_Stub
GetStubFunctor getStubFunctor_;
const char* signature_;
- _AttributeDepl *depl_;
+ AttributeDepl_ *depl_;
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_> {
public:
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
typedef typename DBusStubAdapterHelperType::RemoteEventHandlerType RemoteEventHandlerType;
- typedef typename DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
- typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, _AttributeType);
+ typedef typename DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
+ typedef bool (RemoteEventHandlerType::*OnRemoteSetFunctor)(std::shared_ptr<CommonAPI::ClientId>, AttributeType_);
typedef void (RemoteEventHandlerType::*OnRemoteChangedFunctor)();
DBusSetAttributeStubDispatcher(GetStubFunctor getStubFunctor,
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
const char* dbusSignature,
- _AttributeDepl *_depl = nullptr) :
- DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(getStubFunctor, dbusSignature, _depl),
+ AttributeDepl_ *_depl = nullptr) :
+ DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(getStubFunctor, dbusSignature, _depl),
onRemoteSetFunctor_(onRemoteSetFunctor),
onRemoteChangedFunctor_(onRemoteChangedFunctor) {
}
virtual ~DBusSetAttributeStubDispatcher() {};
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
bool attributeValueChanged;
if (!setAttributeValue(dbusMessage, stub, dbusStubAdapterHelper, attributeValueChanged))
@@ -621,11 +633,11 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
}
protected:
- virtual _AttributeType retrieveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
+ virtual AttributeType_ retrieveAttributeValue(const DBusMessage& dbusMessage, bool& errorOccured) {
errorOccured = false;
DBusInputStream dbusInputStream(dbusMessage);
- CommonAPI::Deployable<_AttributeType, _AttributeDepl> attributeValue(this->depl_);
+ CommonAPI::Deployable<AttributeType_, AttributeDepl_> attributeValue(this->depl_);
dbusInputStream >> attributeValue;
if (dbusInputStream.hasError()) {
@@ -636,12 +648,12 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
}
inline bool setAttributeValue(const DBusMessage& dbusMessage,
- const std::shared_ptr<_StubClass>& stub,
+ const std::shared_ptr<StubClass_>& stub,
DBusStubAdapterHelperType& dbusStubAdapterHelper,
bool& attributeValueChanged) {
bool errorOccured;
- CommonAPI::Deployable<_AttributeType, _AttributeDepl> attributeValue(
- retrieveAttributeValue(dbusMessage, errorOccured), this->depl_);
+ CommonAPI::Deployable<AttributeType_, AttributeDepl_> attributeValue(
+ retrieveAttributeValue(dbusMessage, errorOccured), this->depl_);
if(errorOccured) {
return false;
@@ -658,7 +670,7 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
(dbusStubAdapterHelper.getRemoteEventHandler()->*onRemoteChangedFunctor_)();
}
- inline const _AttributeType& getAttributeValue(std::shared_ptr<CommonAPI::ClientId> clientId, const std::shared_ptr<_StubClass>& stub) {
+ inline const AttributeType_& getAttributeValue(std::shared_ptr<CommonAPI::ClientId> clientId, const std::shared_ptr<StubClass_>& stub) {
return (stub.get()->*(this->getStubFunctor_))(clientId);
}
@@ -666,33 +678,33 @@ class DBusSetAttributeStubDispatcher: public virtual DBusGetAttributeStubDispatc
const OnRemoteChangedFunctor onRemoteChangedFunctor_;
};
-template <typename _StubClass, typename _AttributeType, typename _AttributeDepl = EmptyDeployment>
-class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl> {
+template <typename StubClass_, typename AttributeType_, typename AttributeDepl_ = EmptyDeployment>
+class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_> {
public:
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
+ typedef typename DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::DBusStubAdapterHelperType DBusStubAdapterHelperType;
typedef typename DBusStubAdapterHelperType::StubAdapterType StubAdapterType;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::GetStubFunctor GetStubFunctor;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteSetFunctor OnRemoteSetFunctor;
- typedef typename DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
- typedef typename CommonAPI::Stub<StubAdapterType, typename _StubClass::RemoteEventType> StubType;
- typedef void (StubAdapterType::*FireChangedFunctor)(const _AttributeType&);
+ typedef typename DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::GetStubFunctor GetStubFunctor;
+ typedef typename DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteSetFunctor OnRemoteSetFunctor;
+ typedef typename DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>::OnRemoteChangedFunctor OnRemoteChangedFunctor;
+ typedef typename CommonAPI::Stub<StubAdapterType, typename StubClass_::RemoteEventType> StubType;
+ typedef void (StubAdapterType::*FireChangedFunctor)(const AttributeType_&);
DBusSetObservableAttributeStubDispatcher(GetStubFunctor getStubFunctor,
OnRemoteSetFunctor onRemoteSetFunctor,
OnRemoteChangedFunctor onRemoteChangedFunctor,
FireChangedFunctor fireChangedFunctor,
const char* dbusSignature,
- _AttributeDepl *_depl = nullptr)
- : DBusGetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(
- getStubFunctor, dbusSignature, _depl),
- DBusSetAttributeStubDispatcher<_StubClass, _AttributeType, _AttributeDepl>(
- getStubFunctor, onRemoteSetFunctor, onRemoteChangedFunctor, dbusSignature, _depl),
+ AttributeDepl_ *_depl = nullptr)
+ : DBusGetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(
+ getStubFunctor, dbusSignature, _depl),
+ DBusSetAttributeStubDispatcher<StubClass_, AttributeType_, AttributeDepl_>(
+ getStubFunctor, onRemoteSetFunctor, onRemoteChangedFunctor, dbusSignature, _depl),
fireChangedFunctor_(fireChangedFunctor) {
}
virtual ~DBusSetObservableAttributeStubDispatcher() {};
- bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<_StubClass>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
+ bool dispatchDBusMessage(const DBusMessage& dbusMessage, const std::shared_ptr<StubClass_>& stub, DBusStubAdapterHelperType& dbusStubAdapterHelper) {
bool attributeValueChanged;
if (!this->setAttributeValue(dbusMessage, stub, dbusStubAdapterHelper, attributeValueChanged))
return false;
@@ -705,10 +717,11 @@ class DBusSetObservableAttributeStubDispatcher: public virtual DBusSetAttributeS
return true;
}
protected:
- virtual void fireAttributeValueChanged(std::shared_ptr<CommonAPI::ClientId> clientId,
- DBusStubAdapterHelperType& dbusStubAdapterHelper,
- const std::shared_ptr<_StubClass> stub) {
- (stub->StubType::getStubAdapter().get()->*fireChangedFunctor_)(this->getAttributeValue(clientId, stub));
+ virtual void fireAttributeValueChanged(std::shared_ptr<CommonAPI::ClientId> _client,
+ DBusStubAdapterHelperType &_helper,
+ const std::shared_ptr<StubClass_> _stub) {
+ (void)_helper;
+ (_stub->StubType::getStubAdapter().get()->*fireChangedFunctor_)(this->getAttributeValue(_client, _stub));
}
const FireChangedFunctor fireChangedFunctor_;
diff --git a/include/CommonAPI/DBus/DBusTypeOutputStream.hpp b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp
index 074d76a..a2e96e5 100644
--- a/include/CommonAPI/DBus/DBusTypeOutputStream.hpp
+++ b/include/CommonAPI/DBus/DBusTypeOutputStream.hpp
@@ -15,62 +15,71 @@ class DBusTypeOutputStream: public TypeOutputStream<DBusTypeOutputStream> {
public:
DBusTypeOutputStream() : signature_("") {}
- TypeOutputStream &writeType(const bool &_type) {
+ TypeOutputStream &writeType(const bool &, const EmptyDeployment *) {
signature_.append("b");
return (*this);
}
- TypeOutputStream &writeType(const int8_t &) {
+ TypeOutputStream &writeType(const int8_t &, const EmptyDeployment *) {
signature_.append("y");
return (*this);
}
- TypeOutputStream &writeType(const int16_t &) {
+ TypeOutputStream &writeType(const int16_t &, const EmptyDeployment *) {
signature_.append("n");
return (*this);
}
- TypeOutputStream &writeType(const int32_t &) {
+ TypeOutputStream &writeType(const int32_t &, const EmptyDeployment *) {
signature_.append("i");
return (*this);
}
- TypeOutputStream &writeType(const int64_t &) {
+ TypeOutputStream &writeType(const int64_t &, const EmptyDeployment *) {
signature_.append("x");
return (*this);
}
- TypeOutputStream &writeType(const uint8_t &) {
+ TypeOutputStream &writeType(const uint8_t &, const EmptyDeployment *) {
signature_.append("y");
return (*this);
}
- TypeOutputStream &writeType(const uint16_t &) {
+ TypeOutputStream &writeType(const uint16_t &, const EmptyDeployment *) {
signature_.append("q");
return (*this);
}
- TypeOutputStream &writeType(const uint32_t &) {
+ TypeOutputStream &writeType(const uint32_t &, const EmptyDeployment *) {
signature_.append("u");
return (*this);
}
- TypeOutputStream &writeType(const uint64_t &) {
+ TypeOutputStream &writeType(const uint64_t &, const EmptyDeployment *) {
signature_.append("t");
return (*this);
}
- TypeOutputStream &writeType(const float &) {
+ TypeOutputStream &writeType(const float &, const EmptyDeployment *) {
signature_.append("d");
return (*this);
}
- TypeOutputStream &writeType(const double &) {
+ TypeOutputStream &writeType(const double &, const EmptyDeployment *) {
signature_.append("d");
return (*this);
}
- TypeOutputStream &writeType(const std::string &) {
+ TypeOutputStream &writeType(const std::string &, const StringDeployment *_depl) {
+ if ((_depl != nullptr) && _depl->isObjectPath_) {
+ signature_.append("o");
+ } else {
+ signature_.append("s");
+ }
+ return (*this);
+ }
+
+ TypeOutputStream &writeType(const std::string &, const CommonAPI::EmptyDeployment * = nullptr) {
signature_.append("s");
return (*this);
}
@@ -80,7 +89,7 @@ public:
return (*this);
}
- TypeOutputStream &writeType(const Version &) {
+ TypeOutputStream &writeType(const Version &, const EmptyDeployment *) {
signature_.append("(uu)");
return (*this);
}
@@ -90,61 +99,88 @@ public:
return (*this);
}
- template<typename... _Types>
- TypeOutputStream &writeType(const Struct<_Types...> &_value) {
+ template<typename Deployment_, typename... Types_>
+ TypeOutputStream &writeType(const Struct<Types_...> &_value, const Deployment_ * _depl = nullptr) {
+ (void)_value;
signature_.append("(");
- const auto itsSize(std::tuple_size<std::tuple<_Types...>>::value);
- StructTypeWriter<itsSize-1, DBusTypeOutputStream, Struct<_Types...>>{}
- (*this, _value);
+ const auto itsSize(std::tuple_size<std::tuple<Types_...>>::value);
+ StructTypeWriter<Deployment_, itsSize-1, DBusTypeOutputStream, Struct<Types_...>>{}
+ (*this, _value, _depl);
+
signature_.append(")");
return (*this);
}
- template<class _PolymorphicStruct>
- TypeOutputStream &writeType(const std::shared_ptr<_PolymorphicStruct> &_value) {
+ template<typename Deployment_, class PolymorphicStruct_>
+ TypeOutputStream &writeType(const std::shared_ptr<PolymorphicStruct_> &_value, const Deployment_ * _depl = nullptr) {
+ (void)_value;
signature_.append("(");
- _value->template writeType<>((*this));
+ _value->template writeType<>((*this), _depl);
signature_.append(")");
return (*this);
}
- template<typename... _Types>
- TypeOutputStream &writeType(const Variant<_Types...> &_value) {
+ template<typename... Types_>
+ TypeOutputStream &writeType(const Variant<Types_...> &_value, const EmptyDeployment *_depl) {
+ (void)_value;
+ (void)_depl;
signature_.append("(yv)");
return (*this);
}
- template<typename _Deployment, typename... _Types>
- TypeOutputStream &writeType(const Variant<_Types...> &_value, const _Deployment *_depl) {
- if (_depl != nullptr && _depl->isDBus_) {
- signature_.append("v");
- } else {
- signature_.append("(yv)");
- }
- TypeOutputStreamWriteVisitor<DBusTypeOutputStream> typeVisitor(*this);
- ApplyVoidVisitor<TypeOutputStreamWriteVisitor<DBusTypeOutputStream>,
- Variant<_Types...>, _Types...>::visit(typeVisitor, _value);
+ template<typename Deployment_, typename... Types_>
+ TypeOutputStream &writeType(const Variant<Types_...> &_value, const Deployment_ *_depl) {
+ (void)_value;
+ if (_depl != nullptr && _depl->isDBus_) {
+ signature_.append("v");
+ } else {
+ signature_.append("(yv)");
+ }
+
+ return (*this);
+ }
+
+ template<typename ElementType_>
+ TypeOutputStream &writeType(const std::vector<ElementType_> &_value, const EmptyDeployment * _depl = nullptr) {
+ (void)_value;
+ signature_.append("a");
+ ElementType_ dummyElement;
+ writeType(dummyElement, _depl);
return (*this);
}
- template<typename _ElementType>
- TypeOutputStream &writeType(const std::vector<_ElementType> &_value) {
- signature_.append("a");
- _ElementType dummyElement;
- writeType(dummyElement);
- return (*this);
- }
+ template<typename Deployment_, typename ElementType_>
+ TypeOutputStream &writeType(const std::vector<ElementType_> &_value, const Deployment_ * _depl = nullptr) {
+ (void)_value;
+ signature_.append("a");
+ ElementType_ dummyElement;
+ writeType(dummyElement, (_depl ? _depl->elementDepl_ : nullptr));
+ return (*this);
+ }
+
+ template<typename KeyType_, typename ValueType_, typename HasherType_>
+ TypeOutputStream &writeType(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value, const EmptyDeployment *_depl = nullptr) {
+ (void)_value;
+ signature_.append("a{");
+ KeyType_ dummyKey;
+ writeType(dummyKey, _depl);
+ ValueType_ dummyValue;
+ writeType(dummyValue, _depl);
+ signature_.append("}");
+ return (*this);
+ }
- template<typename _KeyType, typename _ValueType, typename _HasherType>
- TypeOutputStream &writeType(const std::unordered_map<_KeyType, _ValueType, _HasherType> &_value) {
- signature_.append("a{");
- _KeyType dummyKey;
- writeType(dummyKey);
- _ValueType dummyValue;
- writeType(dummyValue);
- signature_.append("}");
- return (*this);
- }
+ template<typename Deployment_, typename KeyType_, typename ValueType_, typename HasherType_>
+ TypeOutputStream &writeType(const std::unordered_map<KeyType_, ValueType_, HasherType_> &_value, const Deployment_ *_depl = nullptr) {
+ (void)_value;
+ signature_.append("a{");
+ KeyType_ dummyKey;
+ writeType(dummyKey, (_depl ? _depl->key_ : nullptr));
+ ValueType_ dummyValue;
+ writeType(dummyValue, (_depl ? _depl->value_ : nullptr));
+ signature_.append("}");
+ return (*this);
+ }
inline std::string getSignature() {
return std::move(signature_);
@@ -158,3 +194,4 @@ private:
} // namespace CommonAPI
#endif // COMMONAPI_DBUS_DBUSTYPEOUTPUTSTREAM_HPP_
+
diff --git a/include/CommonAPI/DBus/DBusTypes.hpp b/include/CommonAPI/DBus/DBusTypes.hpp
index 4c723c4..86bed2d 100644
--- a/include/CommonAPI/DBus/DBusTypes.hpp
+++ b/include/CommonAPI/DBus/DBusTypes.hpp
@@ -20,9 +20,9 @@ namespace DBus {
typedef std::unordered_map<std::string, bool> DBusPropertiesChangedDict;
typedef std::unordered_map<std::string,
- DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
+ DBusPropertiesChangedDict> DBusInterfacesAndPropertiesDict;
typedef std::unordered_map<std::string,
- DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
+ DBusInterfacesAndPropertiesDict> DBusObjectPathAndInterfacesDict;
enum class DBusType_t {
SESSION = DBUS_BUS_SESSION,
diff --git a/include/CommonAPI/DBus/DBusUtils.hpp b/include/CommonAPI/DBus/DBusUtils.hpp
index ba8826d..d12e024 100644
--- a/include/CommonAPI/DBus/DBusUtils.hpp
+++ b/include/CommonAPI/DBus/DBusUtils.hpp
@@ -18,17 +18,17 @@ namespace DBus {
//In gcc 4.4.1, the enumeration "std::future_status" is defined, but the return values of some functions
//are bool where the same functions in gcc 4.6. return a value from this enum. This template is a way
//to ensure compatibility for this issue.
-template<typename _FutureWaitType>
-inline bool checkReady(_FutureWaitType&);
+template<typename FutureWaitType_>
+inline bool checkReady(FutureWaitType_&);
template<>
inline bool checkReady<bool>(bool& returnedValue) {
- return returnedValue;
+ return returnedValue;
}
template<>
inline bool checkReady<std::future_status>(std::future_status& returnedValue) {
- return returnedValue == std::future_status::ready;
+ return returnedValue == std::future_status::ready;
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusAddress.cpp b/src/CommonAPI/DBus/DBusAddress.cpp
index f317e57..d73cfc0 100644
--- a/src/CommonAPI/DBus/DBusAddress.cpp
+++ b/src/CommonAPI/DBus/DBusAddress.cpp
@@ -11,17 +11,17 @@ namespace CommonAPI {
namespace DBus {
DBusAddress::DBusAddress(const std::string &_service,
- const std::string &_objectPath,
- const std::string &_interface)
- : service_(_service),
- objectPath_(_objectPath),
- interface_(_interface) {
+ const std::string &_objectPath,
+ const std::string &_interface)
+ : service_(_service),
+ objectPath_(_objectPath),
+ interface_(_interface) {
}
DBusAddress::DBusAddress(const DBusAddress &_source)
- : service_(_source.service_),
- objectPath_(_source.objectPath_),
- interface_(_source.interface_) {
+ : service_(_source.service_),
+ objectPath_(_source.objectPath_),
+ interface_(_source.interface_) {
}
DBusAddress::~DBusAddress() {
@@ -29,72 +29,72 @@ DBusAddress::~DBusAddress() {
bool
DBusAddress::operator==(const DBusAddress &_other) const {
- return (service_ == _other.service_ &&
- objectPath_ == _other.objectPath_ &&
- interface_ == _other.interface_);
+ return (service_ == _other.service_ &&
+ objectPath_ == _other.objectPath_ &&
+ interface_ == _other.interface_);
}
bool
DBusAddress::operator !=(const DBusAddress &_other) const {
- return (service_ != _other.service_ ||
- objectPath_ != _other.objectPath_ ||
- interface_ != _other.interface_);
+ return (service_ != _other.service_ ||
+ objectPath_ != _other.objectPath_ ||
+ interface_ != _other.interface_);
}
bool
DBusAddress::operator<(const DBusAddress &_other) const {
- if (service_ < _other.service_)
- return true;
+ if (service_ < _other.service_)
+ return true;
- if (service_ == _other.service_) {
- if (objectPath_ < _other.objectPath_)
- return true;
+ if (service_ == _other.service_) {
+ if (objectPath_ < _other.objectPath_)
+ return true;
- if (objectPath_ == _other.objectPath_) {
- if (interface_ < _other.interface_)
- return true;
- }
- }
+ if (objectPath_ == _other.objectPath_) {
+ if (interface_ < _other.interface_)
+ return true;
+ }
+ }
- return false;
+ return false;
}
const std::string &
DBusAddress::getService() const {
- return service_;
+ return service_;
}
void
DBusAddress::setService(const std::string &_service) {
- service_ = _service;
+ service_ = _service;
}
const std::string &
DBusAddress::getObjectPath() const {
- return objectPath_;
+ return objectPath_;
}
void
DBusAddress::setObjectPath(const std::string &_objectPath) {
- objectPath_ = _objectPath;
+ objectPath_ = _objectPath;
}
const std::string &
DBusAddress::getInterface() const {
- return interface_;
+ return interface_;
}
void
DBusAddress::setInterface(const std::string &_interface) {
- interface_ = _interface;
+ interface_ = _interface;
}
std::ostream &
operator<<(std::ostream &_out, const DBusAddress &_dbusAddress) {
- _out << "service=" << _dbusAddress.service_.c_str()
- << ":path=" << _dbusAddress.objectPath_.c_str()
- << ":interface=" << _dbusAddress.interface_.c_str();
- return _out;
+ _out << "service=" << _dbusAddress.service_.c_str()
+ << ":path=" << _dbusAddress.objectPath_.c_str()
+ << ":interface=" << _dbusAddress.interface_.c_str();
+ return _out;
}
diff --git a/src/CommonAPI/DBus/DBusAddressTranslator.cpp b/src/CommonAPI/DBus/DBusAddressTranslator.cpp
index 0c653dc..cb208c0 100644
--- a/src/CommonAPI/DBus/DBusAddressTranslator.cpp
+++ b/src/CommonAPI/DBus/DBusAddressTranslator.cpp
@@ -26,314 +26,310 @@ const char *COMMONAPI_DBUS_DEFAULT_CONFIG_FOLDER = "/etc/";
std::shared_ptr<DBusAddressTranslator> DBusAddressTranslator::get() {
- static std::shared_ptr<DBusAddressTranslator> theTranslator = std::make_shared<DBusAddressTranslator>();
- return theTranslator;
+ static std::shared_ptr<DBusAddressTranslator> theTranslator = std::make_shared<DBusAddressTranslator>();
+ return theTranslator;
}
DBusAddressTranslator::DBusAddressTranslator()
- : defaultDomain_("local"), orgFreedesktopDBusPeerMapped_(false) {
- init();
+ : defaultDomain_("local"), orgFreedesktopDBusPeerMapped_(false) {
+ init();
- isDefault_ = ("dbus" == Runtime::get()->getDefaultBinding());
+ isDefault_ = ("dbus" == Runtime::get()->getDefaultBinding());
}
void
DBusAddressTranslator::init() {
- // Determine default configuration file
- const char *config = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
- if (config) {
- defaultConfig_ = config;
- } else {
- defaultConfig_ = COMMONAPI_DBUS_DEFAULT_CONFIG_FOLDER;
- defaultConfig_ += "/";
- defaultConfig_ += COMMONAPI_DBUS_DEFAULT_CONFIG_FILE;
- }
-
- (void)readConfiguration();
+ // Determine default configuration file
+ const char *config = getenv("COMMONAPI_DBUS_CONFIG");
+ if (config) {
+ defaultConfig_ = config;
+ } else {
+ defaultConfig_ = COMMONAPI_DBUS_DEFAULT_CONFIG_FOLDER;
+ defaultConfig_ += "/";
+ defaultConfig_ += COMMONAPI_DBUS_DEFAULT_CONFIG_FILE;
+ }
+
+ (void)readConfiguration();
}
bool
DBusAddressTranslator::translate(const std::string &_key, DBusAddress &_value) {
- return translate(CommonAPI::Address(_key), _value);
+ return translate(CommonAPI::Address(_key), _value);
}
bool
DBusAddressTranslator::translate(const CommonAPI::Address &_key, DBusAddress &_value) {
- bool result(true);
- std::lock_guard<std::mutex> itsLock(mutex_);
-
- const auto it = forwards_.find(_key);
- if (it != forwards_.end()) {
- _value = it->second;
- } else if (isDefault_) {
- std::string interfaceName(_key.getInterface());
- std::string objectPath("/" + _key.getInstance());
- std::replace(objectPath.begin(), objectPath.end(), '.', '/');
- std::string service(_key.getInterface() + "_" + _key.getInstance());
-
- if (isValid(service, '.', false, false, true)
- && isValid(objectPath, '/', true)
- && isValid(interfaceName, '.')) {
- _value.setInterface(interfaceName);
- _value.setObjectPath(objectPath);
- _value.setService(service);
-
- forwards_.insert({ _key, _value });
- backwards_.insert({ _value, _key });
- }
- } else {
- result = false;
- }
-
- return result;
+ bool result(true);
+ std::lock_guard<std::mutex> itsLock(mutex_);
+
+ const auto it = forwards_.find(_key);
+ if (it != forwards_.end()) {
+ _value = it->second;
+ } else if (isDefault_) {
+ std::string interfaceName(_key.getInterface());
+ std::string objectPath("/" + _key.getInstance());
+ std::replace(objectPath.begin(), objectPath.end(), '.', '/');
+ std::string service(_key.getInterface() + "_" + _key.getInstance());
+
+ if (isValid(service, '.', false, false, true)
+ && isValid(objectPath, '/', true)
+ && isValid(interfaceName, '.')) {
+ _value.setInterface(interfaceName);
+ _value.setObjectPath(objectPath);
+ _value.setService(service);
+
+ forwards_.insert({ _key, _value });
+ backwards_.insert({ _value, _key });
+ }
+ } else {
+ result = false;
+ }
+
+ return result;
}
bool
DBusAddressTranslator::translate(const DBusAddress &_key, std::string &_value) {
- CommonAPI::Address address;
- if (translate(_key, address)) {
- _value = address.getAddress();
- return true;
- }
- return false;
+ CommonAPI::Address address;
+ if (translate(_key, address)) {
+ _value = address.getAddress();
+ return true;
+ }
+ return false;
}
bool
DBusAddressTranslator::translate(const DBusAddress &_key, CommonAPI::Address &_value) {
- bool result(true);
- std::lock_guard<std::mutex> itsLock(mutex_);
-
- const auto it = backwards_.find(_key);
- if (it != backwards_.end()) {
- _value = it->second;
- } else if (isDefault_) {
- if (isValid(_key.getObjectPath(), '/', true) && isValid(_key.getInterface(), '.')) {
- std::string interfaceName(_key.getInterface());
- std::string instance(_key.getObjectPath().substr(1));
- std::replace(instance.begin(), instance.end(), '/', '.');
-
- _value.setDomain(defaultDomain_);
- _value.setInterface(interfaceName);
- _value.setInstance(instance);
-
- forwards_.insert({_value, _key});
- backwards_.insert({_key, _value});
- } else {
- result = false;
- }
- } else {
- result = false;
- }
-
- return result;
+ bool result(true);
+ std::lock_guard<std::mutex> itsLock(mutex_);
+
+ const auto it = backwards_.find(_key);
+ if (it != backwards_.end()) {
+ _value = it->second;
+ } else if (isDefault_) {
+ if (isValid(_key.getObjectPath(), '/', true) && isValid(_key.getInterface(), '.')) {
+ std::string interfaceName(_key.getInterface());
+ std::string instance(_key.getObjectPath().substr(1));
+ std::replace(instance.begin(), instance.end(), '/', '.');
+
+ _value.setDomain(defaultDomain_);
+ _value.setInterface(interfaceName);
+ _value.setInstance(instance);
+
+ std::string service = _key.getService();
+ if(isValid(service, '.',
+ (service.length() > 0 && service[0] == ':'),
+ (service.length() > 0 && service[0] == ':'),
+ true)) {
+ forwards_.insert({_value, _key});
+ backwards_.insert({_key, _value});
+ }
+ } else {
+ result = false;
+ }
+ } else {
+ result = false;
+ }
+
+ return result;
}
-
void
DBusAddressTranslator::insert(
- const std::string &_address,
- const std::string &_service, const std::string &_path, const std::string &_interface, const bool _objPathStartWithDigits) {
-
- if (isValid(_service, '.',
- (_service.length() > 0 && _service[0] == ':'),
- (_service.length() > 0 && _service[0] == ':'),
- true)
- && isValid(_path, '/', true, _objPathStartWithDigits)
- && isValid(_interface, '.')) {
- CommonAPI::Address address(_address);
- DBusAddress dbusAddress(_service, _path, _interface);
-
- std::lock_guard<std::mutex> itsLock(mutex_);
- auto fw = forwards_.find(address);
- auto bw = backwards_.find(dbusAddress);
- if (fw == forwards_.end() && bw == backwards_.end()) {
- forwards_[address] = dbusAddress;
- backwards_[dbusAddress] = address;
- COMMONAPI_DEBUG(
- "Added address mapping: ", address, " <--> ", dbusAddress);
- if (!orgFreedesktopDBusPeerMapped_) {
- orgFreedesktopDBusPeerMapped_ = (_interface == "org.freedesktop.DBus.Peer");
- if (orgFreedesktopDBusPeerMapped_) {
- COMMONAPI_DEBUG("org.freedesktop.DBus.Peer mapped");
- }
- }
- } else if(bw != backwards_.end() && bw->second != address) {
- COMMONAPI_ERROR("Trying to overwrite existing DBus address "
- "which is already mapped to a CommonAPI address: ",
- dbusAddress, " <--> ", _address);
- } else if(fw != forwards_.end() && fw->second != dbusAddress) {
- COMMONAPI_ERROR("Trying to overwrite existing CommonAPI address "
- "which is already mapped to a DBus address: ",
- _address, " <--> ", dbusAddress);
- }
- }
+ const std::string &_address,
+ const std::string &_service, const std::string &_path, const std::string &_interface, const bool _objPathStartWithDigits) {
+
+ if (isValid(_service, '.',
+ (_service.length() > 0 && _service[0] == ':'),
+ (_service.length() > 0 && _service[0] == ':'),
+ true)
+ && isValid(_path, '/', true, _objPathStartWithDigits)
+ && isValid(_interface, '.')) {
+ CommonAPI::Address address(_address);
+ DBusAddress dbusAddress(_service, _path, _interface);
+
+ std::lock_guard<std::mutex> itsLock(mutex_);
+ auto fw = forwards_.find(address);
+ auto bw = backwards_.find(dbusAddress);
+ if (fw == forwards_.end() && bw == backwards_.end()) {
+ forwards_[address] = dbusAddress;
+ backwards_[dbusAddress] = address;
+ COMMONAPI_DEBUG(
+ "Added address mapping: ", address, " <--> ", dbusAddress);
+ if (!orgFreedesktopDBusPeerMapped_) {
+ orgFreedesktopDBusPeerMapped_ = (_interface == "org.freedesktop.DBus.Peer");
+ if (orgFreedesktopDBusPeerMapped_) {
+ COMMONAPI_DEBUG("org.freedesktop.DBus.Peer mapped");
+ }
+ }
+ } else if(bw != backwards_.end() && bw->second != address) {
+ COMMONAPI_ERROR("Trying to overwrite existing DBus address "
+ "which is already mapped to a CommonAPI address: ",
+ dbusAddress, " <--> ", _address);
+ } else if(fw != forwards_.end() && fw->second != dbusAddress) {
+ COMMONAPI_ERROR("Trying to overwrite existing CommonAPI address "
+ "which is already mapped to a DBus address: ",
+ _address, " <--> ", dbusAddress);
+ }
+ }
}
bool
DBusAddressTranslator::readConfiguration() {
#define MAX_PATH_LEN 255
- std::string config;
- char currentDirectory[MAX_PATH_LEN];
+ std::string config;
+ char currentDirectory[MAX_PATH_LEN];
#ifdef WIN32
- if (GetCurrentDirectory(MAX_PATH_LEN, currentDirectory)) {
+ if (GetCurrentDirectory(MAX_PATH_LEN, currentDirectory)) {
#else
- if (getcwd(currentDirectory, MAX_PATH_LEN)) {
+ if (getcwd(currentDirectory, MAX_PATH_LEN)) {
#endif
- config = currentDirectory;
- config += "/";
- config += COMMONAPI_DBUS_DEFAULT_CONFIG_FILE;
-
- struct stat s;
- if (stat(config.c_str(), &s) != 0) {
- config = defaultConfig_;
- }
- }
-
- IniFileReader reader;
- if (!reader.load(config))
- return false;
-
- for (auto itsMapping : reader.getSections()) {
- if(itsMapping.first == "segments") {
- std::map<std::string, std::string> mappings = itsMapping.second->getMappings();
- ConnectionId_t connectionId;
- std::string busType;
- for(auto const &it : mappings) {
- connectionId = it.first;
- busType = it.second;
- if(busType == "SESSION") {
- dbusTypes_.insert({ connectionId, DBusType_t::SESSION });
- } else if (busType == "SYSTEM") {
- dbusTypes_.insert({ connectionId, DBusType_t::SYSTEM });
- } else {
- COMMONAPI_FATAL("Invalid bus type specified in .ini file, "
- "choose one of {SYSTEM, SESSION}");
- continue;
- }
- COMMONAPI_INFO("D-Bus bus type for connection: " + connectionId +
- " is set to: " + busType + " via ini file");
- }
- continue;
- }
-
- CommonAPI::Address itsAddress(itsMapping.first);
-
- std::string service = itsMapping.second->getValue("service");
- std::string path = itsMapping.second->getValue("path");
- std::string interfaceName = itsMapping.second->getValue("interface");
-
- insert(itsMapping.first, service, path, interfaceName);
- }
-
- return true;
+ config = currentDirectory;
+ config += "/";
+ config += COMMONAPI_DBUS_DEFAULT_CONFIG_FILE;
+
+ struct stat s;
+ if (stat(config.c_str(), &s) != 0) {
+ config = defaultConfig_;
+ }
+ }
+
+ IniFileReader reader;
+ if (!reader.load(config))
+ return false;
+
+ for (auto itsMapping : reader.getSections()) {
+ if(itsMapping.first == "segments") {
+ std::map<std::string, std::string> mappings = itsMapping.second->getMappings();
+ ConnectionId_t connectionId;
+ std::string busType;
+ for(auto const &it : mappings) {
+ connectionId = it.first;
+ busType = it.second;
+ if(busType == "SESSION") {
+ dbusTypes_.insert({ connectionId, DBusType_t::SESSION });
+ } else if (busType == "SYSTEM") {
+ dbusTypes_.insert({ connectionId, DBusType_t::SYSTEM });
+ } else {
+ COMMONAPI_FATAL("Invalid bus type specified in .ini file, "
+ "choose one of {SYSTEM, SESSION}");
+ continue;
+ }
+ COMMONAPI_INFO("D-Bus bus type for connection: " + connectionId +
+ " is set to: " + busType + " via ini file");
+ }
+ continue;
+ }
+
+ CommonAPI::Address itsAddress(itsMapping.first);
+
+ std::string service = itsMapping.second->getValue("service");
+ std::string path = itsMapping.second->getValue("path");
+ std::string interfaceName = itsMapping.second->getValue("interface");
+
+ insert(itsMapping.first, service, path, interfaceName);
+ }
+
+ return true;
}
bool
DBusAddressTranslator::isValid(
- const std::string &_name, const char _separator,
- bool _ignoreFirst, bool _isAllowedToStartWithDigit, bool _isBusName) const {
- // DBus addresses must contain at least one separator
- std::size_t separatorPos = _name.find(_separator);
- if (separatorPos == std::string::npos) {
- COMMONAPI_ERROR(
- "Invalid name \'", _name,
- "\'. Contains no \'", _separator, "\'");
- return false;
- }
-
- bool isInitial(true);
- std::size_t start(0);
-
- if (_ignoreFirst) {
- start = 1;
- if (separatorPos == 0) {
- // accept "root-only" i.e. '/' object path
- if (1 == _name.length()) {
- return true;
- }
- separatorPos = _name.find(_separator, separatorPos+1);
- }
- }
-
- while (start != std::string::npos) {
- // DBus names parts must not be empty
- std::string part;
-
- if (isInitial) {
- isInitial = false;
- } else {
- start++;
- }
-
- if (separatorPos == std::string::npos) {
- part = _name.substr(start);
- } else {
- part = _name.substr(start, separatorPos-start);
- }
-
- if ("" == part) {
- COMMONAPI_ERROR(
- "Invalid interface name \'", _name,
- "\'. Must not contain empty parts.");
- return false;
- }
-
- // DBus name parts must not start with a digit (not valid for unique names)
- if (!_isAllowedToStartWithDigit) {
- if (part[0] >= '0' && part[0] <= '9') {
- COMMONAPI_ERROR(
- "Invalid interface name \'", _name,
- "\'. First character must not be a digit.");
- return false;
- }
- }
-
- // DBus name parts consist of the ASCII characters [0-9][A-Z][a-z]_,
- for (auto c : part) {
- // bus names may additionally contain [-]
- if (_isBusName && c == '-')
- continue;
-
- if (c < '0' ||
- (c > '9' && c < 'A') ||
- (c > 'Z' && c < '_') ||
- (c > '_' && c < 'a') ||
- c > 'z') {
- COMMONAPI_ERROR(
- "Invalid interface name \'", _name,
- "\'. Contains illegal character \'", c,
- "\'. Only \'[0-9][A-Z][a-z]_\' are allowed.");
- return false;
- }
- }
-
- start = separatorPos;
- separatorPos = _name.find(_separator, separatorPos+1);
- }
-
- // DBus names must not exceed the maximum length
- if (_name.length() > DBUS_MAXIMUM_NAME_LENGTH) {
- COMMONAPI_ERROR(
- "Invalid interface name \'", _name,
- "\'. Size exceeds maximum size.");
- return false;
- }
-
- return true;
+ const std::string &_name, const char _separator,
+ bool _ignoreFirst, bool _isAllowedToStartWithDigit, bool _isBusName) const {
+ (void)_isAllowedToStartWithDigit;
+ // DBus addresses must contain at least one separator
+ std::size_t separatorPos = _name.find(_separator);
+ if (separatorPos == std::string::npos) {
+ COMMONAPI_ERROR(
+ "Invalid name \'", _name,
+ "\'. Contains no \'", _separator, "\'");
+ return false;
+ }
+
+ bool isInitial(true);
+ std::size_t start(0);
+
+ if (_ignoreFirst) {
+ start = 1;
+ if (separatorPos == 0) {
+ // accept "root-only" i.e. '/' object path
+ if (1 == _name.length()) {
+ return true;
+ }
+ separatorPos = _name.find(_separator, separatorPos+1);
+ }
+ }
+
+ while (start != std::string::npos) {
+ // DBus names parts must not be empty
+ std::string part;
+
+ if (isInitial) {
+ isInitial = false;
+ } else {
+ start++;
+ }
+
+ if (separatorPos == std::string::npos) {
+ part = _name.substr(start);
+ } else {
+ part = _name.substr(start, separatorPos-start);
+ }
+
+ if ("" == part) {
+ COMMONAPI_ERROR(
+ "Invalid interface name \'", _name,
+ "\'. Must not contain empty parts.");
+ return false;
+ }
+
+ // DBus name parts consist of the ASCII characters [0-9][A-Z][a-z]_,
+ for (auto c : part) {
+ // bus names may additionally contain [-]
+ if (_isBusName && c == '-')
+ continue;
+
+ if (c < '0' ||
+ (c > '9' && c < 'A') ||
+ (c > 'Z' && c < '_') ||
+ (c > '_' && c < 'a') ||
+ c > 'z') {
+ COMMONAPI_ERROR(
+ "Invalid interface name \'", _name,
+ "\'. Contains illegal character \'", c,
+ "\'. Only \'[0-9][A-Z][a-z]_\' are allowed.");
+ return false;
+ }
+ }
+
+ start = separatorPos;
+ separatorPos = _name.find(_separator, separatorPos+1);
+ }
+
+ // DBus names must not exceed the maximum length
+ if (_name.length() > DBUS_MAXIMUM_NAME_LENGTH) {
+ COMMONAPI_ERROR(
+ "Invalid interface name \'", _name,
+ "\'. Size exceeds maximum size.");
+ return false;
+ }
+
+ return true;
}
DBusType_t
DBusAddressTranslator::getDBusBusType(const ConnectionId_t &_connectionId) const {
- auto itsDbusTypesIterator = dbusTypes_.find(_connectionId);
- if(itsDbusTypesIterator != dbusTypes_.end()) {
- return itsDbusTypesIterator->second;
- } else {
- return DBusType_t::SESSION;
- }
+ auto itsDbusTypesIterator = dbusTypes_.find(_connectionId);
+ if(itsDbusTypesIterator != dbusTypes_.end()) {
+ return itsDbusTypesIterator->second;
+ } else {
+ return DBusType_t::SESSION;
+ }
}
bool DBusAddressTranslator::isOrgFreedesktopDBusPeerMapped() const {
- return orgFreedesktopDBusPeerMapped_;
+ return orgFreedesktopDBusPeerMapped_;
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusConnection.cpp b/src/CommonAPI/DBus/DBusConnection.cpp
index e3fb4a4..c5ab406 100644
--- a/src/CommonAPI/DBus/DBusConnection.cpp
+++ b/src/CommonAPI/DBus/DBusConnection.cpp
@@ -13,6 +13,7 @@
#include <CommonAPI/Logger.hpp>
#include <CommonAPI/DBus/DBusConnection.hpp>
#include <CommonAPI/DBus/DBusInputStream.hpp>
+#include <CommonAPI/DBus/DBusMainLoop.hpp>
#include <CommonAPI/DBus/DBusProxy.hpp>
#include <CommonAPI/DBus/DBusAddressTranslator.hpp>
@@ -24,16 +25,21 @@ DBusConnectionStatusEvent::DBusConnectionStatusEvent(DBusConnection* dbusConnect
dbusConnection_(dbusConnection) {
}
-void DBusConnectionStatusEvent::onListenerAdded(const Listener& listener, const Subscription subscription) {
+void DBusConnectionStatusEvent::onListenerAdded(const Listener &_listener, const Subscription _subscription) {
+ (void)_subscription;
if (dbusConnection_->isConnected())
- listener(AvailabilityStatus::AVAILABLE);
+ _listener(AvailabilityStatus::AVAILABLE);
}
const DBusObjectPathVTable* DBusConnection::getDBusObjectPathVTable() {
static const DBusObjectPathVTable libdbusObjectPathVTable = {
NULL, // no need to handle unregister callbacks
- &DBusConnection::onLibdbusObjectPathMessageThunk
+ &DBusConnection::onLibdbusObjectPathMessageThunk,
+ NULL, // dbus_internal_pad1 reserved for future expansion
+ NULL, // dbus_internal_pad2 reserved for future expansion
+ NULL, // dbus_internal_pad3 reserved for future expansion
+ NULL // dbus_internal_pad4 reserved for future expansion
};
return &libdbusObjectPathVTable;
}
@@ -44,30 +50,7 @@ const DBusObjectPathVTable* DBusConnection::getDBusObjectPathVTable() {
const int32_t ownUseCount = 2;
void DBusConnection::dispatch() {
- std::shared_ptr<DBusConnection> selfReference = this->shared_from_this();
- while (!stopDispatching_ && readWriteDispatch(10) && selfReference.use_count() > ownUseCount) {
- if (pauseDispatching_) {
- dispatchSuspendLock_.lock();
- dispatchSuspendLock_.unlock();
- }
- }
-}
-
-bool DBusConnection::readWriteDispatch(int _timeout) {
- if(isConnected()) {
- return 0 != dbus_connection_read_write_dispatch(connection_, _timeout);
- }
- return false;
-}
-
-void DBusConnection::suspendDispatching() const {
- dispatchSuspendLock_.lock();
- pauseDispatching_ = true;
-}
-
-void DBusConnection::resumeDispatching() const {
- pauseDispatching_ = false;
- dispatchSuspendLock_.unlock();
+ loop_->run();
}
DBusConnection::DBusConnection(DBusType_t busType) :
@@ -116,8 +99,10 @@ bool DBusConnection::isObjectPathMessageHandlerSet() {
DBusConnection::~DBusConnection() {
if (auto lockedContext = mainLoopContext_.lock()) {
- dbus_connection_set_watch_functions(connection_, NULL, NULL, NULL, NULL, NULL);
- dbus_connection_set_timeout_functions(connection_, NULL, NULL, NULL, NULL, NULL);
+ if (isConnected()) {
+ dbus_connection_set_watch_functions(connection_, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_timeout_functions(connection_, NULL, NULL, NULL, NULL, NULL);
+ }
lockedContext->deregisterDispatchSource(dispatchSource_);
delete watchContext_;
@@ -126,25 +111,57 @@ DBusConnection::~DBusConnection() {
// ensure, the registry survives until disconnecting is done...
//std::shared_ptr<DBusServiceRegistry> itsRegistry = DBusServiceRegistry::get(shared_from_this());
- disconnect();
+ 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.
auto it = timeoutMap_.begin();
while (it != timeoutMap_.end()) {
+ DBusMessageReplyAsyncHandler* asyncHandler = std::get<1>(it->second);
DBusPendingCall* libdbusPendingCall = it->first;
- if (!dbus_pending_call_get_completed(libdbusPendingCall)) {
+ asyncHandler->lock();
+ bool executionStarted = asyncHandler->getExecutionStarted();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ if (executionStarted && !executionFinished) {
+ asyncHandler->setHasToBeDeleted();
+ it = timeoutMap_.erase(it);
+ asyncHandler->unlock();
+ continue;
+ }
+ if (!executionStarted && !executionFinished && !dbus_pending_call_get_completed(libdbusPendingCall)) {
dbus_pending_call_cancel(libdbusPendingCall);
- DBusMessageReplyAsyncHandler* asyncHandler = std::get<1>(it->second);
+ }
+ asyncHandler->unlock();
+
+ if (!executionStarted && !executionFinished) {
DBusMessage& dbusMessageCall = std::get<2>(it->second);
asyncHandler->onDBusMessageReply(CallStatus::REMOTE_ERROR, dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT));
- delete asyncHandler;
+ dbus_pending_call_unref(libdbusPendingCall);
}
it = timeoutMap_.erase(it);
- dbus_pending_call_unref(libdbusPendingCall);
+ delete asyncHandler;
+ }
+
+ auto itTimeoutInf = timeoutInfiniteAsyncHandlers_.begin();
+ while (itTimeoutInf != timeoutInfiniteAsyncHandlers_.end()) {
+ DBusMessageReplyAsyncHandler* asyncHandler = (*itTimeoutInf);
+
+ asyncHandler->lock();
+ bool executionStarted = asyncHandler->getExecutionStarted();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ if (executionStarted && !executionFinished) {
+ asyncHandler->setHasToBeDeleted();
+ itTimeoutInf = timeoutInfiniteAsyncHandlers_.erase(itTimeoutInf);
+ asyncHandler->unlock();
+ continue;
+ }
+ asyncHandler->unlock();
+
+ itTimeoutInf = timeoutInfiniteAsyncHandlers_.erase(itTimeoutInf);
+ delete asyncHandler;
}
}
@@ -219,24 +236,37 @@ dbus_bool_t DBusConnection::onAddWatch(::DBusWatch* libdbusWatch, void* data) {
void DBusConnection::onRemoveWatch(::DBusWatch* libdbusWatch, void* data) {
assert(static_cast<WatchContext*>(data));
+ (void)data;
DBusWatch* dbusWatch = static_cast<DBusWatch*>(dbus_watch_get_data(libdbusWatch));
- if(dbusWatch->isReadyToBeWatched()) {
- dbusWatch->stopWatching();
+ if (dbusWatch != NULL) {
+ if(dbusWatch->isReadyToBeWatched()) {
+ dbusWatch->stopWatching();
+ }
+ dbus_watch_set_data(libdbusWatch, NULL, NULL);
}
- dbus_watch_set_data(libdbusWatch, NULL, NULL);
- delete dbusWatch;
+ // DBusWatch will be deleted in Mainloop
}
void DBusConnection::onToggleWatch(::DBusWatch* libdbusWatch, void* data) {
- assert(static_cast<WatchContext*>(data));
+ WatchContext* watchContext = static_cast<WatchContext*>(data);
+ assert(watchContext);
DBusWatch* dbusWatch = static_cast<DBusWatch*>(dbus_watch_get_data(libdbusWatch));
- if (dbusWatch->isReadyToBeWatched()) {
- dbusWatch->startWatching();
+ if (dbusWatch == NULL) {
+ DBusWatch* dbusWatch = new DBusWatch(libdbusWatch, watchContext->mainLoopContext_);
+ dbusWatch->addDependentDispatchSource(watchContext->dispatchSource_);
+ dbus_watch_set_data(libdbusWatch, dbusWatch, NULL);
+
+ if (dbusWatch->isReadyToBeWatched()) {
+ dbusWatch->startWatching();
+ }
} else {
- dbusWatch->stopWatching();
+ if (!dbusWatch->isReadyToBeWatched()) {
+ dbusWatch->stopWatching();
+ dbus_watch_set_data(libdbusWatch, NULL, NULL);
+ }
}
}
@@ -257,15 +287,19 @@ dbus_bool_t DBusConnection::onAddTimeout(::DBusTimeout* libdbusTimeout, void* da
void DBusConnection::onRemoveTimeout(::DBusTimeout* libdbusTimeout, void* data) {
assert(static_cast<std::weak_ptr<MainLoopContext>*>(data));
+ (void)data;
DBusTimeout* dbusTimeout = static_cast<DBusTimeout*>(dbus_timeout_get_data(libdbusTimeout));
- dbusTimeout->stopMonitoring();
+ if (dbusTimeout) {
+ dbusTimeout->stopMonitoring();
+ }
dbus_timeout_set_data(libdbusTimeout, NULL, NULL);
- delete dbusTimeout;
+ // DBusTimeout will be deleted in Mainloop
}
void DBusConnection::onToggleTimeout(::DBusTimeout* dbustimeout, void* data) {
assert(static_cast<std::weak_ptr<MainLoopContext>*>(data));
+ (void)data;
DBusTimeout* timeout = static_cast<DBusTimeout*>(dbus_timeout_get_data(dbustimeout));
if (timeout->isReadyToBeMonitored()) {
@@ -309,16 +343,19 @@ bool DBusConnection::connect(DBusError &dbusError, bool startDispatchThread) {
initLibdbusSignalFilterAfterConnect();
- stopDispatching_ = !startDispatchThread;
- if (startDispatchThread) {
- dispatchThread_ = new std::thread(std::bind(&DBusConnection::dispatch, this->shared_from_this()));
- }
-
enforcerThread_ = std::make_shared<std::thread>(
- std::bind(&DBusConnection::enforceAsynchronousTimeouts, shared_from_this()));
+ std::bind(&DBusConnection::enforceAsynchronousTimeouts, shared_from_this()));
dbusConnectionStatusEvent_.notifyListeners(AvailabilityStatus::AVAILABLE);
+ stopDispatching_ = !startDispatchThread;
+ if (startDispatchThread) {
+ std::shared_ptr<MainLoopContext> itsContext = std::make_shared<MainLoopContext>();
+ loop_ = std::make_shared<DBusMainLoop>(itsContext);
+ attachMainLoopContext(itsContext);
+ dispatchThread_ = new std::thread(std::bind(&DBusConnection::dispatch, shared_from_this()));
+ }
+
return true;
}
@@ -339,6 +376,7 @@ void DBusConnection::disconnect() {
dbus_connection_close(connection_);
if(dispatchThread_) {
+ loop_->stop();
//It is possible for the disconnect to be called from within a callback, i.e. from within the dispatch
//thread. Self-join is prevented this way.
if (dispatchThread_->joinable() && std::this_thread::get_id() != dispatchThread_->get_id()) {
@@ -357,6 +395,10 @@ void DBusConnection::disconnect() {
}
enforcerThreadCancelled_ = false;
+ // remote mainloop watchers
+ dbus_connection_set_watch_functions(connection_, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_timeout_functions(connection_, NULL, NULL, NULL, NULL, NULL);
+
dbus_connection_unref(connection_);
connection_ = nullptr;
}
@@ -389,32 +431,30 @@ bool DBusConnection::requestServiceNameAndBlock(const std::string& serviceName)
std::lock_guard<std::mutex> dbusConnectionLock(connectionGuard_);
auto conIter = connectionNameCount_.find(serviceName);
if (conIter == connectionNameCount_.end()) {
- suspendDispatching();
-
const int libdbusStatus = dbus_bus_request_name(connection_,
serviceName.c_str(),
DBUS_NAME_FLAG_DO_NOT_QUEUE,
&dbusError.libdbusError_);
- resumeDispatching();
-
isServiceNameAcquired = (libdbusStatus == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER);
if (isServiceNameAcquired) {
connectionNameCount_.insert( { serviceName, (uint16_t)1 } );
}
else {
- #ifdef _MSC_VER // Visual Studio
- COMMONAPI_ERROR(std::string(__FUNCTION__) +
- ": Name: " + dbusError.getName() +
- " Message: " + dbusError.getMessage())
- #else
- COMMONAPI_ERROR(std::string(__PRETTY_FUNCTION__) +
- ": Name: " + dbusError.getName() +
- " Message: " + dbusError.getMessage())
- #endif
+ if (libdbusStatus == -1) {
+ #ifdef _MSC_VER // Visual Studio
+ COMMONAPI_ERROR(std::string(__FUNCTION__) +
+ ": Name: " + dbusError.getName() +
+ " Message: " + dbusError.getMessage())
+ #else
+ COMMONAPI_ERROR(std::string(__PRETTY_FUNCTION__) +
+ ": Name: " + dbusError.getName() +
+ " Message: " + dbusError.getMessage())
+ #endif
+ }
}
} else {
- conIter->second = conIter->second + 1;
+ conIter->second++;
isServiceNameAcquired = true;
}
@@ -428,17 +468,15 @@ bool DBusConnection::releaseServiceName(const std::string& serviceName) const {
auto conIter = connectionNameCount_.find(serviceName);
if (conIter != connectionNameCount_.end()) {
if (conIter->second == 1) {
- suspendDispatching();
const int libdbusStatus = dbus_bus_release_name(connection_,
serviceName.c_str(),
&dbusError.libdbusError_);
- resumeDispatching();
isServiceNameReleased = (libdbusStatus == DBUS_RELEASE_NAME_REPLY_RELEASED);
if (isServiceNameReleased) {
connectionNameCount_.erase(conIter);
}
} else {
- conIter->second = conIter->second - 1;
+ conIter->second--;
isServiceNameReleased = true;
}
}
@@ -455,19 +493,19 @@ bool DBusConnection::sendDBusMessage(const DBusMessage &_message) const {
}
DBusMessage DBusConnection::convertToDBusMessage(::DBusPendingCall* _libdbusPendingCall,
- CallStatus& _callStatus) {
- assert(_libdbusPendingCall);
+ CallStatus& _callStatus) {
+ assert(_libdbusPendingCall);
- ::DBusMessage* libdbusMessage = dbus_pending_call_steal_reply(_libdbusPendingCall);
- const bool increaseLibdbusMessageReferenceCount = false;
- DBusMessage dbusMessage(libdbusMessage, increaseLibdbusMessageReferenceCount);
- _callStatus = CallStatus::SUCCESS;
+ ::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;
- }
+ if (!dbusMessage.isMethodReturnType()) {
+ _callStatus = CallStatus::REMOTE_ERROR;
+ }
- return dbusMessage;
+ return dbusMessage;
}
void DBusConnection::onLibdbusPendingCallNotifyThunk(::DBusPendingCall* _libdbusPendingCall, void *_userData) {
@@ -476,19 +514,36 @@ void DBusConnection::onLibdbusPendingCallNotifyThunk(::DBusPendingCall* _libdbus
auto dbusMessageReplyAsyncHandler = reinterpret_cast<DBusMessageReplyAsyncHandler*>(_userData);
- DBusMessage dbusMessage;
- CallStatus callStatus;
- dbusMessage = DBusConnection::convertToDBusMessage(_libdbusPendingCall, callStatus);
+ dbusMessageReplyAsyncHandler->lock();
+ bool processAsyncHandler = !dbusMessageReplyAsyncHandler->getTimeoutOccurred();
+ dbusMessageReplyAsyncHandler->setExecutionStarted();
+ dbusMessageReplyAsyncHandler->unlock();
- dbusMessageReplyAsyncHandler->onDBusMessageReply(callStatus, dbusMessage);
+ if (processAsyncHandler) {
+ DBusMessage dbusMessage;
+ CallStatus callStatus;
+ dbusMessage = DBusConnection::convertToDBusMessage(_libdbusPendingCall, callStatus);
+ dbusMessageReplyAsyncHandler->onDBusMessageReply(callStatus, dbusMessage);
+ }
+
+ dbusMessageReplyAsyncHandler->lock();
// libdbus calls the cleanup method below
dbus_pending_call_unref(_libdbusPendingCall);
+
+ dbusMessageReplyAsyncHandler->setExecutionFinished();
+ if (dbusMessageReplyAsyncHandler->hasToBeDeleted()) {
+ dbusMessageReplyAsyncHandler->unlock();
+ delete dbusMessageReplyAsyncHandler;
+ return;
+ }
+ dbusMessageReplyAsyncHandler->unlock();
}
-void DBusConnection::onLibdbusDataCleanup(void* userData) {
- auto dbusMessageReplyAsyncHandler = reinterpret_cast<DBusMessageReplyAsyncHandler*>(userData);
- delete dbusMessageReplyAsyncHandler;
+void DBusConnection::onLibdbusDataCleanup(void *_data) {
+ // Dummy method -> deleting of userData is not executed in this method. Deleting is
+ // executed by handling of the timeouts.
+ (void)_data;
}
//Would not be needed if libdbus would actually handle its timeouts for pending calls.
@@ -523,38 +578,103 @@ void DBusConnection::enforceAsynchronousTimeouts() const {
while (it != timeoutMap_.end()) {
std::chrono::high_resolution_clock::time_point now = std::chrono::high_resolution_clock::now();
+ DBusMessageReplyAsyncHandler* asyncHandler = std::get<1>(it->second);
+ DBusPendingCall* libdbusPendingCall = it->first;
+
if (now > std::get<0>(it->second)) {
- DBusPendingCall* libdbusPendingCall = it->first;
-
- if (!dbus_pending_call_get_completed(libdbusPendingCall)) {
- dbus_pending_call_cancel(libdbusPendingCall);
- DBusMessageReplyAsyncHandler* asyncHandler = std::get<1>(it->second);
- DBusMessage& dbusMessageCall = std::get<2>(it->second);
-
- if (mainLoopContext_.lock()) {
- mainloopTimeouts_.push_back(std::make_tuple(asyncHandler,
- dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT),
- CallStatus::REMOTE_ERROR,
- nullptr));
- mainLoopContext_.lock()->wakeup();
+
+ asyncHandler->lock();
+ bool executionStarted = asyncHandler->getExecutionStarted();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ if (!executionStarted && !executionFinished) {
+ asyncHandler->setTimeoutOccurred();
+ if (!dbus_pending_call_get_completed(libdbusPendingCall)) {
+ dbus_pending_call_cancel(libdbusPendingCall);
+ }
+ }
+ asyncHandler->unlock();
+
+ if (executionStarted && !executionFinished) {
+ // execution of asyncHandler is still running
+ // ==> add 100 ms for next timeout check
+ std::get<0>(it->second) = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(100);
+ } else {
+ if (!executionFinished) {
+ // execution of asyncHandler was not finished (and not started)
+ // => 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));
+ }
+ mainLoopContext_.lock()->wakeup();
+ it = timeoutMap_.erase(it);
+
+ //This unref MIGHT cause the destruction of the last callback object that references the DBusConnection.
+ //So after this unref has been called, it has to be ensured that continuation of the loop is an option.
+ dbus_pending_call_unref(libdbusPendingCall);
} else {
- enforceTimeoutMutex_.unlock(); // unlock before making callbacks to application to avoid deadlocks
- asyncHandler->onDBusMessageReply(CallStatus::REMOTE_ERROR, dbusMessageCall.createMethodError(DBUS_ERROR_TIMEOUT));
- enforceTimeoutMutex_.lock();
- delete asyncHandler;
+ // execution of asyncHandler was finished
+ it = timeoutMap_.erase(it);
+ delete asyncHandler;
}
}
- it = timeoutMap_.erase(it);
+ } else {
+ asyncHandler->lock();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ asyncHandler->unlock();
+ if (executionFinished) {
+ // execution of asyncHandler was finished but timeout is not expired
+ it = timeoutMap_.erase(it);
+ delete asyncHandler;
+ } else {
+ ++it;
+ }
+ }
+ }
+ enforceTimeoutMutex_.unlock();
+ } else {
+ std::lock_guard<std::mutex> itsLock(enforceTimeoutMutex_);
- //This unref MIGHT cause the destruction of the last callback object that references the DBusConnection.
- //So after this unref has been called, it has to be ensured that continuation of the loop is an option.
- dbus_pending_call_unref(libdbusPendingCall);
+ auto it = timeoutMap_.begin();
+ while (it != timeoutMap_.end()) {
+ DBusMessageReplyAsyncHandler* asyncHandler = std::get<1>(it->second);
+ asyncHandler->lock();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ asyncHandler->unlock();
+ if (executionFinished) {
+ // execution of asyncHandler was finished but timeout is not expired
+ it = timeoutMap_.erase(it);
+ delete asyncHandler;
} else {
++it;
}
}
- enforceTimeoutMutex_.unlock();
}
+
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutInfiniteAsyncHandlersMutex_);
+ // check for asyncHandler with infinite timeout whose execution is finished
+ auto it = timeoutInfiniteAsyncHandlers_.begin();
+ while (it != timeoutInfiniteAsyncHandlers_.end()) {
+ DBusMessageReplyAsyncHandler* asyncHandler = (*it);
+ asyncHandler->lock();
+ bool executionFinished = asyncHandler->getExecutionFinished();
+ asyncHandler->unlock();
+ if ( executionFinished ) {
+ it = timeoutInfiniteAsyncHandlers_.erase(it);
+ delete asyncHandler;
+ } else {
+ it++;
+ }
+ }
+ }
+
}
}
@@ -569,39 +689,45 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
DBusPendingCall* libdbusPendingCall;
dbus_bool_t libdbusSuccess;
- suspendDispatching();
+ DBusMessageReplyAsyncHandler* replyAsyncHandler = dbusMessageReplyAsyncHandler.release();
+
+ std::future<CallStatus> callStatusFuture = replyAsyncHandler->getFuture();
+
libdbusSuccess = dbus_connection_send_with_reply_set_notify(connection_,
- dbusMessage.message_,
- &libdbusPendingCall,
- onLibdbusPendingCallNotifyThunk,
- dbusMessageReplyAsyncHandler.get(),
- onLibdbusDataCleanup,
- _info->timeout_);
+ dbusMessage.message_,
+ &libdbusPendingCall,
+ onLibdbusPendingCallNotifyThunk,
+ replyAsyncHandler,
+ onLibdbusDataCleanup,
+ _info->timeout_);
if (_info->sender_ != 0) {
COMMONAPI_DEBUG("Message sent: SenderID: ", _info->sender_, " - Serial number: ", dbusMessage.getSerial());
}
if (!libdbusSuccess || !libdbusPendingCall) {
- #ifdef _MSC_VER // Visual Studio
+ #ifdef _MSC_VER // Visual Studio
COMMONAPI_ERROR(std::string(__FUNCTION__) +
": (!libdbusSuccess || !libdbusPendingCall) == true")
#else
COMMONAPI_ERROR(std::string(__PRETTY_FUNCTION__) +
": (!libdbusSuccess || !libdbusPendingCall) == true")
#endif
- if (libdbusPendingCall) {
- dbus_pending_call_unref(libdbusPendingCall);
- }
- dbusMessageReplyAsyncHandler->onDBusMessageReply(CallStatus::CONNECTION_FAILED, dbusMessage.createMethodError(DBUS_ERROR_DISCONNECTED));
- resumeDispatching();
- return dbusMessageReplyAsyncHandler->getFuture();
+ if (libdbusPendingCall) {
+ dbus_pending_call_unref(libdbusPendingCall);
+ }
+ {
+ std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
+ mainloopTimeouts_.push_back(std::make_tuple(replyAsyncHandler,
+ dbusMessage.createMethodError(DBUS_ERROR_DISCONNECTED),
+ CallStatus::CONNECTION_FAILED,
+ nullptr));
+ }
+ mainLoopContext_.lock()->wakeup();
+ return callStatusFuture;
}
- DBusMessageReplyAsyncHandler* replyAsyncHandler = dbusMessageReplyAsyncHandler.release();
-
if (_info->timeout_ != DBUS_TIMEOUT_INFINITE) {
- dbus_pending_call_ref(libdbusPendingCall);
auto timeoutPoint = std::chrono::high_resolution_clock::now() + std::chrono::milliseconds(_info->timeout_);
std::tuple<
std::chrono::time_point<std::chrono::high_resolution_clock>,
@@ -616,14 +742,16 @@ std::future<CallStatus> DBusConnection::sendDBusMessageWithReplyAsync(
timeoutMap_.insert( { libdbusPendingCall, toInsert } );
enforceTimeoutMutex_.unlock();
+ enforcerThreadMutex_.lock();
enforceTimeoutCondition_.notify_all();
+ enforcerThreadMutex_.unlock();
+ } else {
+ // add asyncHandler with infinite timeout to corresponding list
+ std::lock_guard<std::mutex> itsLock(timeoutInfiniteAsyncHandlersMutex_);
+ timeoutInfiniteAsyncHandlers_.insert(replyAsyncHandler);
}
- std::future<CallStatus> result = replyAsyncHandler->getFuture();
-
- resumeDispatching();
-
- return result;
+ return callStatusFuture;
}
DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage& dbusMessage,
@@ -633,8 +761,6 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
assert(!dbusError);
assert(isConnected());
- suspendDispatching();
-
::DBusMessage* libdbusMessageReply = dbus_connection_send_with_reply_and_block(connection_,
dbusMessage.message_,
_info->timeout_,
@@ -644,8 +770,6 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
COMMONAPI_DEBUG("Message sent: SenderID: ", _info->sender_, " - Serial number: ", dbusMessage.getSerial());
}
- resumeDispatching();
-
if (dbusError) {
return DBusMessage();
}
@@ -656,19 +780,23 @@ DBusMessage DBusConnection::sendDBusMessageWithReplyAndBlock(const DBusMessage&
bool DBusConnection::singleDispatch() {
- for (auto t : mainloopTimeouts_) {
- std::get<0>(t)->onDBusMessageReply(std::get<2>(t), std::get<1>(t));
- if (std::get<3>(t) != nullptr) {
- dbus_pending_call_unref(std::get<3>(t));
- }
- delete std::get<0>(t);
+ {
+ std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
+ for (auto t : mainloopTimeouts_) {
+ std::get<0>(t)->onDBusMessageReply(std::get<2>(t), std::get<1>(t));
+ if (std::get<3>(t) != nullptr) {
+ dbus_pending_call_unref(std::get<3>(t));
+ }
+ delete std::get<0>(t);
+ }
+ mainloopTimeouts_.clear();
}
- mainloopTimeouts_.clear();
return (dbus_connection_dispatch(connection_) == DBUS_DISPATCH_DATA_REMAINS);
}
bool DBusConnection::isDispatchReady() {
+ std::lock_guard<std::mutex> itsLock(mainloopTimeoutsMutex_);
return (dbus_connection_get_dispatch_status(connection_) == DBUS_DISPATCH_DATA_REMAINS ||
!mainloopTimeouts_.empty());
}
@@ -778,11 +906,11 @@ bool DBusConnection::removeSignalMemberHandler(const DBusSignalHandlerToken &dbu
}
if (lastHandlerRemoved) {
- dbusSignalHandlerTable_.erase(signalEntry);
- removeLibdbusSignalMatchRule(std::get<0>(dbusSignalHandlerToken),
- std::get<1>(dbusSignalHandlerToken),
- std::get<2>(dbusSignalHandlerToken));
- }
+ dbusSignalHandlerTable_.erase(signalEntry);
+ removeLibdbusSignalMatchRule(std::get<0>(dbusSignalHandlerToken),
+ std::get<1>(dbusSignalHandlerToken),
+ std::get<2>(dbusSignalHandlerToken));
+ }
return lastHandlerRemoved;
}
@@ -810,6 +938,7 @@ bool DBusConnection::addObjectManagerSignalMemberHandler(const std::string& dbus
if (isConnected()) {
const bool isRemoveSignalMatchRuleSuccessful = removeObjectManagerSignalMatchRule(dbusBusName);
assert(isRemoveSignalMatchRuleSuccessful);
+ (void)isRemoveSignalMatchRuleSuccessful;
}
return false;
}
@@ -891,8 +1020,6 @@ bool DBusConnection::removeObjectManagerSignalMatchRule(const std::string& dbusB
bool DBusConnection::addLibdbusSignalMatchRule(const std::string& dbusMatchRule) {
bool libdbusSuccess = true;
- suspendDispatching();
-
// add the libdbus message signal filter
if (!libdbusSignalMatchRulesCount_) {
libdbusSuccess = 0 != dbus_connection_add_filter(
@@ -914,8 +1041,6 @@ bool DBusConnection::addLibdbusSignalMatchRule(const std::string& dbusMatchRule)
libdbusSignalMatchRulesCount_++;
}
- resumeDispatching();
-
return libdbusSuccess;
}
@@ -929,8 +1054,6 @@ bool DBusConnection::removeLibdbusSignalMatchRule(const std::string& dbusMatchRu
if(libdbusSignalMatchRulesCount_ == 0)
return true;
- suspendDispatching();
-
dbus_bus_remove_match(connection_, dbusMatchRule.c_str(), NULL);
libdbusSignalMatchRulesCount_--;
@@ -938,8 +1061,6 @@ bool DBusConnection::removeLibdbusSignalMatchRule(const std::string& dbusMatchRu
dbus_connection_remove_filter(connection_, &onLibdbusSignalFilterThunk, this);
}
- resumeDispatching();
-
return true;
}
@@ -967,6 +1088,8 @@ void DBusConnection::registerObjectPath(const std::string& objectPath) {
&dbusError.libdbusError_);
assert(libdbusSuccess);
assert(!dbusError);
+ (void)libdbusSuccess;
+ (void)dbusError;
}
}
@@ -978,6 +1101,7 @@ void DBusConnection::unregisterObjectPath(const std::string& objectPath) {
const bool foundRegisteredObjectPathHandler = handlerIterator != libdbusRegisteredObjectPaths_.end();
assert(foundRegisteredObjectPathHandler);
+ (void)foundRegisteredObjectPathHandler;
uint32_t& referenceCount = handlerIterator->second;
if (referenceCount > 1) {
@@ -991,6 +1115,7 @@ void DBusConnection::unregisterObjectPath(const std::string& objectPath) {
dbus_bool_t libdbusSuccess
= dbus_connection_unregister_object_path(connection_, objectPath.c_str());
assert(libdbusSuccess);
+ (void)libdbusSuccess;
}
}
@@ -1024,10 +1149,10 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
DBusSignalMatchRulesMap::value_type(dbusSignalMatchRuleTuple,
DBusSignalMatchRuleMapping(1, matchRuleString)));
assert(success.second);
+ (void)success;
if (isConnected()) {
bool libdbusSuccess = true;
- suspendDispatching();
// add the libdbus message signal filter
if (isFirstMatchRule) {
@@ -1046,13 +1171,12 @@ void DBusConnection::addLibdbusSignalMatchRule(const std::string& objectPath,
DBusError dbusError;
dbus_bus_add_match(connection_, matchRuleString.c_str(), &dbusError.libdbusError_);
assert(!dbusError);
+ (void)dbusError;
}
if (libdbusSuccess) {
libdbusSignalMatchRulesCount_++;
}
-
- resumeDispatching();
}
}
@@ -1065,6 +1189,7 @@ void DBusConnection::removeLibdbusSignalMatchRule(const std::string& objectPath,
const bool matchRuleFound = matchRuleIterator != dbusSignalMatchRulesMap_.end();
assert(matchRuleFound);
+ (void)matchRuleFound;
uint32_t& matchRuleReferenceCount = matchRuleIterator->second.first;
if (matchRuleReferenceCount > 1) {
@@ -1076,6 +1201,7 @@ void DBusConnection::removeLibdbusSignalMatchRule(const std::string& objectPath,
const std::string& matchRuleString = matchRuleIterator->second.second;
const bool libdbusSuccess = removeLibdbusSignalMatchRule(matchRuleString);
assert(libdbusSuccess);
+ (void)libdbusSuccess;
}
dbusSignalMatchRulesMap_.erase(matchRuleIterator);
@@ -1105,6 +1231,8 @@ void DBusConnection::initLibdbusObjectPathHandlerAfterConnect() {
this,
&dbusError.libdbusError_);
assert(libdbusSuccess);
+ (void)libdbusSuccess;
+
assert(!dbusError);
}
}
@@ -1118,6 +1246,7 @@ void DBusConnection::initLibdbusSignalFilterAfterConnect() {
const std::string& dbusMatchRuleString = dbusSignalMatchRuleMapping.second;
const bool libdbusSuccess = addLibdbusSignalMatchRule(dbusMatchRuleString);
assert(libdbusSuccess);
+ (void)libdbusSuccess;
}
// object manager match rules (see DBusServiceRegistry)
@@ -1125,11 +1254,13 @@ void DBusConnection::initLibdbusSignalFilterAfterConnect() {
const std::string& dbusBusName = dbusObjectManagerSignalMatchRuleIterator.first;
const bool libdbusSuccess = addObjectManagerSignalMatchRule(dbusBusName);
assert(libdbusSuccess);
+ (void)libdbusSuccess;
}
}
::DBusHandlerResult DBusConnection::onLibdbusObjectPathMessage(::DBusMessage* libdbusMessage) {
assert(libdbusMessage);
+ (void)libdbusMessage;
// handle only method call messages
if (dbus_message_get_type(libdbusMessage) != DBUS_MESSAGE_TYPE_METHOD_CALL) {
@@ -1167,6 +1298,8 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
typename DBusSignalHandlersTable::iterator>& equalRange,
const CommonAPI::DBus::DBusMessage &dbusMessage,
::DBusHandlerResult &dbusHandlerResult) {
+ (void)dbusSignalHandlerstable;
+
if (equalRange.first != equalRange.second) {
dbusHandlerResult = DBUS_HANDLER_RESULT_HANDLED;
}
@@ -1233,6 +1366,7 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
assert(_dbusConnection);
assert(libdbusMessage);
assert(userData);
+ (void)_dbusConnection;
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
assert(dbusConnection->connection_ == _dbusConnection);
@@ -1245,6 +1379,7 @@ void notifyDBusOMSignalHandlers(DBusSignalHandlersTable& dbusSignalHandlerstable
assert(_dbusConnection);
assert(libdbusMessage);
assert(userData);
+ (void)_dbusConnection;
DBusConnection* dbusConnection = reinterpret_cast<DBusConnection*>(userData);
assert(dbusConnection->connection_ == _dbusConnection);
diff --git a/src/CommonAPI/DBus/DBusDaemonProxy.cpp b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
index fe87335..ee434b1 100644
--- a/src/CommonAPI/DBus/DBusDaemonProxy.cpp
+++ b/src/CommonAPI/DBus/DBusDaemonProxy.cpp
@@ -16,13 +16,16 @@ StaticInterfaceVersionAttribute::StaticInterfaceVersionAttribute(const uint32_t&
}
void StaticInterfaceVersionAttribute::getValue(CallStatus &_status, Version &_version,
- const CommonAPI::CallInfo *_info) const {
+ const CommonAPI::CallInfo *_info) const {
+ (void)_info;
_version = version_;
_status = CallStatus::SUCCESS;
}
std::future<CallStatus> StaticInterfaceVersionAttribute::getValueAsync(AttributeAsyncCallback attributeAsyncCallback,
- const CommonAPI::CallInfo *_info) {
+ const CommonAPI::CallInfo *_info) {
+ (void)_info;
+
attributeAsyncCallback(CallStatus::SUCCESS, version_);
std::promise<CallStatus> versionPromise;
@@ -41,8 +44,8 @@ static CommonAPI::CallInfo daemonProxyInfo(30000);
DBusDaemonProxy::DBusDaemonProxy(const std::shared_ptr<DBusProxyConnection>& dbusConnection):
DBusProxyBase(dbusProxyAddress, dbusConnection),
nameOwnerChangedEvent_(*this,
- "NameOwnerChanged", "sss",
- std::tuple<std::string, std::string, std::string>()),
+ "NameOwnerChanged", "sss",
+ std::tuple<std::string, std::string, std::string>()),
interfaceVersionAttribute_(1, 0) {
}
@@ -74,7 +77,7 @@ void DBusDaemonProxy::listNames(CommonAPI::CallStatus& callStatus, std::vector<s
DBusError dbusError;
DBusMessage dbusMessageReply
- = getDBusConnection()->sendDBusMessageWithReplyAndBlock(dbusMethodCall, dbusError, &daemonProxyInfo);
+ = getDBusConnection()->sendDBusMessageWithReplyAndBlock(dbusMethodCall, dbusError, &daemonProxyInfo);
if (dbusError || !dbusMessageReply.isMethodReturnType()) {
callStatus = CallStatus::REMOTE_ERROR;
@@ -114,7 +117,7 @@ void DBusDaemonProxy::nameHasOwner(const std::string& busName, CommonAPI::CallSt
DBusMessage dbusMessageReply = getDBusConnection()->sendDBusMessageWithReplyAndBlock(
dbusMethodCall,
dbusError,
- &daemonProxyInfo);
+ &daemonProxyInfo);
if (dbusError || !dbusMessageReply.isMethodReturnType()) {
callStatus = CallStatus::REMOTE_ERROR;
return;
@@ -144,7 +147,7 @@ std::future<CallStatus> DBusDaemonProxy::nameHasOwnerAsync(const std::string& bu
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMessage,
DBusProxyAsyncCallbackHandler<bool>::create(nameHasOwnerAsyncCallback, std::tuple<bool>()),
- &daemonProxyInfo);
+ &daemonProxyInfo);
}
std::future<CallStatus> DBusDaemonProxy::getManagedObjectsAsync(const std::string& forDBusServiceName, GetManagedObjectsAsyncCallback callback) const {
@@ -154,9 +157,9 @@ std::future<CallStatus> DBusDaemonProxy::getManagedObjectsAsync(const std::strin
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMethodCallMessage,
DBusProxyAsyncCallbackHandler<DBusObjectToInterfaceDict>::create(
- callback, std::tuple<DBusObjectToInterfaceDict>()
+ callback, std::tuple<DBusObjectToInterfaceDict>()
),
- &daemonProxyInfo);
+ &daemonProxyInfo);
}
std::future<CallStatus> DBusDaemonProxy::getNameOwnerAsync(const std::string& busName, GetNameOwnerAsyncCallback getNameOwnerAsyncCallback) const {
@@ -174,7 +177,7 @@ std::future<CallStatus> DBusDaemonProxy::getNameOwnerAsync(const std::string& bu
return getDBusConnection()->sendDBusMessageWithReplyAsync(
dbusMessage,
DBusProxyAsyncCallbackHandler<std::string>::create(getNameOwnerAsyncCallback, std::tuple<std::string>()),
- &daemonProxyInfo);
+ &daemonProxyInfo);
}
const char* DBusDaemonProxy::getInterfaceId() {
diff --git a/src/CommonAPI/DBus/DBusDeployment.cpp b/src/CommonAPI/DBus/DBusDeployment.cpp
deleted file mode 100644
index 973d5ff..0000000
--- a/src/CommonAPI/DBus/DBusDeployment.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2014-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 <CommonAPI/DBus/DBusDeployment.hpp>
-
-namespace CommonAPI {
-namespace DBus {
-
- COMMONAPI_IMPORT_EXPORT VariantDeployment<> freedesktopVariant(true);
-
-} // namespace DBus
-} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusError.cpp b/src/CommonAPI/DBus/DBusError.cpp
index 9dfb082..b5f5d5c 100644
--- a/src/CommonAPI/DBus/DBusError.cpp
+++ b/src/CommonAPI/DBus/DBusError.cpp
@@ -12,31 +12,29 @@ namespace CommonAPI {
namespace DBus {
DBusError::DBusError() {
- dbus_error_init(&libdbusError_);
+ dbus_error_init(&libdbusError_);
}
DBusError::~DBusError() {
- dbus_error_free(&libdbusError_);
+ dbus_error_free(&libdbusError_);
}
DBusError::operator bool() const {
- return 0 != dbus_error_is_set(&libdbusError_);
+ return 0 != dbus_error_is_set(&libdbusError_);
}
void DBusError::clear() {
- dbus_error_free(&libdbusError_);
+ dbus_error_free(&libdbusError_);
}
std::string DBusError::getName() const {
- assert(*this);
- return std::string(libdbusError_.name);
+ return std::string(libdbusError_.name);
}
std::string DBusError::getMessage() const {
- assert(*this);
- return std::string(libdbusError_.message);
+ return std::string(libdbusError_.message);
}
} // namespace DBus
diff --git a/src/CommonAPI/DBus/DBusFactory.cpp b/src/CommonAPI/DBus/DBusFactory.cpp
index afe5ad7..6371da9 100644
--- a/src/CommonAPI/DBus/DBusFactory.cpp
+++ b/src/CommonAPI/DBus/DBusFactory.cpp
@@ -18,13 +18,13 @@ namespace CommonAPI {
namespace DBus {
INITIALIZER(FactoryInit) {
- Runtime::get()->registerFactory("dbus", Factory::get());
+ Runtime::get()->registerFactory("dbus", Factory::get());
}
std::shared_ptr<CommonAPI::DBus::Factory>
Factory::get() {
- static std::shared_ptr<Factory> theFactory = std::make_shared<Factory>();
- return theFactory;
+ static std::shared_ptr<Factory> theFactory = std::make_shared<Factory>();
+ return theFactory;
}
Factory::Factory() {
@@ -35,180 +35,185 @@ Factory::~Factory() {
void
Factory::registerProxyCreateMethod(
- const std::string &_interface, ProxyCreateFunction _function) {
- proxyCreateFunctions_[_interface] = _function;
+ const std::string &_interface, ProxyCreateFunction _function) {
+ proxyCreateFunctions_[_interface] = _function;
}
void
Factory::registerStubAdapterCreateMethod(
- const std::string &_interface, StubAdapterCreateFunction _function) {
- stubAdapterCreateFunctions_[_interface] = _function;
+ const std::string &_interface, StubAdapterCreateFunction _function) {
+ stubAdapterCreateFunctions_[_interface] = _function;
}
std::shared_ptr<Proxy>
Factory::createProxy(
- const std::string &_domain, const std::string &_interface, const std::string &_instance,
- const ConnectionId_t &_connectionId) {
- auto proxyCreateFunctionsIterator = proxyCreateFunctions_.find(_interface);
- if (proxyCreateFunctionsIterator != proxyCreateFunctions_.end()) {
- CommonAPI::Address address(_domain, _interface, _instance);
- DBusAddress dbusAddress;
-
- if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
- std::shared_ptr<DBusProxy> proxy
- = proxyCreateFunctionsIterator->second(dbusAddress, getConnection(_connectionId));
- if (proxy)
- proxy->init();
- return proxy;
- }
- }
- return nullptr;
+ const std::string &_domain, const std::string &_interface, const std::string &_instance,
+ const ConnectionId_t &_connectionId) {
+ auto proxyCreateFunctionsIterator = proxyCreateFunctions_.find(_interface);
+ if (proxyCreateFunctionsIterator != proxyCreateFunctions_.end()) {
+ CommonAPI::Address address(_domain, _interface, _instance);
+ DBusAddress dbusAddress;
+
+ if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
+ std::shared_ptr<DBusProxy> proxy
+ = proxyCreateFunctionsIterator->second(dbusAddress, getConnection(_connectionId));
+ if (proxy)
+ proxy->init();
+ return proxy;
+ }
+ }
+ return nullptr;
}
std::shared_ptr<Proxy>
Factory::createProxy(
- const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<MainLoopContext> _context) {
-
- auto proxyCreateFunctionsIterator = proxyCreateFunctions_.find(_interface);
- if (proxyCreateFunctionsIterator != proxyCreateFunctions_.end()) {
- CommonAPI::Address address(_domain, _interface, _instance);
- DBusAddress dbusAddress;
-
- if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
- std::shared_ptr<DBusProxy> proxy
- = proxyCreateFunctionsIterator->second(dbusAddress, getConnection(_context));
- if (proxy)
- proxy->init();
- return proxy;
- }
- }
-
- return nullptr;
+ const std::string &_domain, const std::string &_interface, const std::string &_instance,
+ std::shared_ptr<MainLoopContext> _context) {
+
+ auto proxyCreateFunctionsIterator = proxyCreateFunctions_.find(_interface);
+ if (proxyCreateFunctionsIterator != proxyCreateFunctions_.end()) {
+ CommonAPI::Address address(_domain, _interface, _instance);
+ DBusAddress dbusAddress;
+
+ if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
+ std::shared_ptr<DBusProxy> proxy
+ = proxyCreateFunctionsIterator->second(dbusAddress, getConnection(_context));
+ if (proxy)
+ proxy->init();
+ return proxy;
+ }
+ }
+
+ return nullptr;
}
bool
Factory::registerStub(
- const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
- auto stubAdapterCreateFunctionsIterator = stubAdapterCreateFunctions_.find(_interface);
- if (stubAdapterCreateFunctionsIterator != stubAdapterCreateFunctions_.end()) {
- CommonAPI::Address address(_domain, _interface, _instance);
- DBusAddress dbusAddress;
- if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
- std::shared_ptr<DBusStubAdapter> adapter
- = stubAdapterCreateFunctionsIterator->second(dbusAddress, getConnection(_connectionId), _stub);
- if (adapter) {
- adapter->init(adapter);
- return registerStubAdapter(adapter);
- }
- }
- }
-
- return false;
+ const std::string &_domain, const std::string &_interface, const std::string &_instance,
+ std::shared_ptr<StubBase> _stub, const ConnectionId_t &_connectionId) {
+ auto stubAdapterCreateFunctionsIterator = stubAdapterCreateFunctions_.find(_interface);
+ if (stubAdapterCreateFunctionsIterator != stubAdapterCreateFunctions_.end()) {
+ CommonAPI::Address address(_domain, _interface, _instance);
+ DBusAddress dbusAddress;
+ if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
+ std::shared_ptr<DBusStubAdapter> adapter
+ = stubAdapterCreateFunctionsIterator->second(dbusAddress, getConnection(_connectionId), _stub);
+ if (adapter) {
+ adapter->init(adapter);
+ return registerStubAdapter(adapter);
+ }
+ }
+ }
+
+ return false;
}
bool
Factory::registerStub(
- const std::string &_domain, const std::string &_interface, const std::string &_instance,
- std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
- auto stubAdapterCreateFunctionsIterator = stubAdapterCreateFunctions_.find(_interface);
- if (stubAdapterCreateFunctionsIterator != stubAdapterCreateFunctions_.end()) {
- CommonAPI::Address address(_domain, _interface, _instance);
- DBusAddress dbusAddress;
- if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
- std::shared_ptr<DBusStubAdapter> adapter
- = stubAdapterCreateFunctionsIterator->second(dbusAddress, getConnection(_context), _stub);
- if (adapter) {
- adapter->init(adapter);
- return registerStubAdapter(adapter);
- }
- }
- }
- return false;
+ const std::string &_domain, const std::string &_interface, const std::string &_instance,
+ std::shared_ptr<StubBase> _stub, std::shared_ptr<MainLoopContext> _context) {
+ auto stubAdapterCreateFunctionsIterator = stubAdapterCreateFunctions_.find(_interface);
+ if (stubAdapterCreateFunctionsIterator != stubAdapterCreateFunctions_.end()) {
+ CommonAPI::Address address(_domain, _interface, _instance);
+ DBusAddress dbusAddress;
+ if (DBusAddressTranslator::get()->translate(address, dbusAddress)) {
+ std::shared_ptr<DBusStubAdapter> adapter
+ = stubAdapterCreateFunctionsIterator->second(dbusAddress, getConnection(_context), _stub);
+ if (adapter) {
+ adapter->init(adapter);
+ return registerStubAdapter(adapter);
+ }
+ }
+ }
+ return false;
}
bool
Factory::unregisterStub(const std::string &_domain, const std::string &_interface, const std::string &_instance) {
- CommonAPI::Address address(_domain, _interface, _instance);
- const auto &adapterResult = services_.find(address.getAddress());
- if (adapterResult != services_.end()) {
- const auto _adapter = adapterResult->second;
- const auto &connection = _adapter->getDBusConnection();
- const auto objectManager = connection->getDBusObjectManager();
-
- if (!objectManager->unregisterDBusStubAdapter(_adapter)) {
- return false;
- }
-
- if (!connection->releaseServiceName(_adapter->getDBusAddress().getService())) {
- return false;
- }
-
- if (!unregisterStubAdapter(_adapter)) {
- return false;
- }
-
- services_.erase(adapterResult->first);
-
- return true;
- }
-
- return false;
+ CommonAPI::Address address(_domain, _interface, _instance);
+ const auto &adapterResult = services_.find(address.getAddress());
+ if (adapterResult != services_.end()) {
+ const auto _adapter = adapterResult->second;
+ const auto &connection = _adapter->getDBusConnection();
+ const auto objectManager = connection->getDBusObjectManager();
+
+ if (!objectManager->unregisterDBusStubAdapter(_adapter)) {
+ return false;
+ }
+
+ if (!connection->releaseServiceName(_adapter->getDBusAddress().getService())) {
+ return false;
+ }
+
+ if (!unregisterStubAdapter(_adapter)) {
+ return false;
+ }
+
+ services_.erase(adapterResult->first);
+
+ return true;
+ }
+
+ return false;
}
bool
Factory::registerStubAdapter(std::shared_ptr<DBusStubAdapter> _adapter) {
- CommonAPI::Address address;
- DBusAddress dbusAddress = _adapter->getDBusAddress();
- if (DBusAddressTranslator::get()->translate(dbusAddress, address)) {
- const auto &insertResult = services_.insert( { address.getAddress(), _adapter } );
-
- const auto &connection = _adapter->getDBusConnection();
- const auto objectManager = connection->getDBusObjectManager();
- if (!objectManager->registerDBusStubAdapter(_adapter)) {
- services_.erase(insertResult.first);
- return false;
- }
-
- const bool isServiceNameAcquired
- = connection->requestServiceNameAndBlock(dbusAddress.getService());
- if (!isServiceNameAcquired) {
- (void)objectManager->unregisterDBusStubAdapter(_adapter);
- services_.erase(insertResult.first);
- return false;
- }
-
- std::shared_ptr<DBusObjectManagerStub> root
- = connection->getDBusObjectManager()->getRootDBusObjectManagerStub();
- if (!root->exportManagedDBusStubAdapter(_adapter)) {
- (void)unregisterManagedService(address.getAddress());
- return false;
- }
-
- return true;
- }
-
- return false;
+ CommonAPI::Address address;
+ DBusAddress dbusAddress = _adapter->getDBusAddress();
+ if (DBusAddressTranslator::get()->translate(dbusAddress, address)) {
+ const auto &insertResult = services_.insert( { address.getAddress(), _adapter } );
+
+ const auto &connection = _adapter->getDBusConnection();
+
+ std::shared_ptr<DBusObjectManagerStub> root
+ = connection->getDBusObjectManager()->getRootDBusObjectManagerStub();
+ if (!root->exportManagedDBusStubAdapter(_adapter)) {
+ (void)unregisterManagedService(address.getAddress());
+ return false;
+ }
+
+ const auto objectManager = connection->getDBusObjectManager();
+ if (!objectManager->registerDBusStubAdapter(_adapter)) {
+ (void)root->unexportManagedDBusStubAdapter(_adapter);
+ (void)unregisterManagedService(address.getAddress());
+ services_.erase(insertResult.first);
+ return false;
+ }
+
+ const bool isServiceNameAcquired
+ = connection->requestServiceNameAndBlock(dbusAddress.getService());
+ if (!isServiceNameAcquired) {
+ (void)root->unexportManagedDBusStubAdapter(_adapter);
+ (void)objectManager->unregisterDBusStubAdapter(_adapter);
+ (void)unregisterManagedService(address.getAddress());
+ services_.erase(insertResult.first);
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
}
bool
Factory::unregisterStubAdapter(std::shared_ptr<DBusStubAdapter> _adapter) {
- CommonAPI::Address address;
- DBusAddress dbusAddress = _adapter->getDBusAddress();
- if (DBusAddressTranslator::get()->translate(dbusAddress, address)) {
- const auto &connection = _adapter->getDBusConnection();
-
- std::shared_ptr<DBusObjectManagerStub> root
- = connection->getDBusObjectManager()->getRootDBusObjectManagerStub();
- if (!root->unexportManagedDBusStubAdapter(_adapter)) {
- //(void)unregisterManagedService(address.getAddress());
- return false;
- }
-
- return true;
- }
- return false;
+ CommonAPI::Address address;
+ DBusAddress dbusAddress = _adapter->getDBusAddress();
+ if (DBusAddressTranslator::get()->translate(dbusAddress, address)) {
+ const auto &connection = _adapter->getDBusConnection();
+
+ std::shared_ptr<DBusObjectManagerStub> root
+ = connection->getDBusObjectManager()->getRootDBusObjectManagerStub();
+ if (!root->unexportManagedDBusStubAdapter(_adapter)) {
+ //(void)unregisterManagedService(address.getAddress());
+ return false;
+ }
+
+ return true;
+ }
+ return false;
}
///////////////////////////////////////////////////////////////////////////////
@@ -217,41 +222,41 @@ Factory::unregisterStubAdapter(std::shared_ptr<DBusStubAdapter> _adapter) {
std::shared_ptr<DBusConnection>
Factory::getConnection(const ConnectionId_t &_connectionId) {
- auto itsConnectionIterator = connections_.find(_connectionId);
- if (itsConnectionIterator != connections_.end()) {
- return itsConnectionIterator->second;
- }
+ 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);
- std::shared_ptr<DBusConnection> itsConnection
- = std::make_shared<DBusConnection>(dbusType);
- connections_.insert({ _connectionId, itsConnection });
+ // No connection found, lets create and initialize one
+ DBusType_t dbusType = DBusAddressTranslator::get()->getDBusBusType(_connectionId);
+ std::shared_ptr<DBusConnection> itsConnection
+ = std::make_shared<DBusConnection>(dbusType);
+ connections_.insert({ _connectionId, itsConnection });
- itsConnection->connect(true);
- return itsConnection;
+ itsConnection->connect(true);
+ return itsConnection;
}
std::shared_ptr<DBusConnection>
Factory::getConnection(std::shared_ptr<MainLoopContext> _context) {
- if (!_context)
- return getConnection(DEFAULT_CONNECTION_ID);
+ if (!_context)
+ return getConnection(DEFAULT_CONNECTION_ID);
- auto itsConnectionIterator = contextConnections_.find(_context.get());
- if (itsConnectionIterator != contextConnections_.end()) {
- return itsConnectionIterator->second;
- }
+ auto itsConnectionIterator = contextConnections_.find(_context.get());
+ if (itsConnectionIterator != contextConnections_.end()) {
+ return itsConnectionIterator->second;
+ }
- // No connection found, lets create and initialize one
- std::shared_ptr<DBusConnection> itsConnection
- = std::make_shared<DBusConnection>(DBusType_t::SESSION);
- contextConnections_.insert({ _context.get(), itsConnection } );
+ // No connection found, lets create and initialize one
+ std::shared_ptr<DBusConnection> itsConnection
+ = std::make_shared<DBusConnection>(DBusType_t::SESSION);
+ contextConnections_.insert({ _context.get(), itsConnection } );
- itsConnection->connect(false);
- if (_context)
- itsConnection->attachMainLoopContext(_context);
+ itsConnection->connect(false);
+ if (_context)
+ itsConnection->attachMainLoopContext(_context);
- return itsConnection;
+ return itsConnection;
}
///////////////////////////////////////////////////////////////////////////////
@@ -271,18 +276,18 @@ Factory::getRegisteredService(const std::string &_address) {
///////////////////////////////////////////////////////////////////////////////
std::shared_ptr<DBusStubAdapter>
Factory::createDBusStubAdapter(
- const std::shared_ptr<StubBase> &_stub,
+ const std::shared_ptr<StubBase> &_stub,
const std::string &_interface,
- const DBusAddress &_dbusAddress,
- const std::shared_ptr<DBusProxyConnection> &_connection) {
+ const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection) {
std::shared_ptr<DBusStubAdapter> stubAdapter;
auto stubAdapterCreateFunctionsIterator = stubAdapterCreateFunctions_.find(_interface);
if (stubAdapterCreateFunctionsIterator != stubAdapterCreateFunctions_.end()) {
stubAdapter = stubAdapterCreateFunctionsIterator->second(
- _dbusAddress, _connection, _stub);
+ _dbusAddress, _connection, _stub);
if (stubAdapter)
- stubAdapter->init(stubAdapter);
+ stubAdapter->init(stubAdapter);
}
return stubAdapter;
}
@@ -293,24 +298,25 @@ Factory::registerManagedService(const std::shared_ptr<DBusStubAdapter> &_stubAda
const auto &insertResult = services_.insert( { itsAddress, _stubAdapter} );
if (insertResult.second) {
- const auto &connection = _stubAdapter->getDBusConnection();
- const auto objectManager = connection->getDBusObjectManager();
- const bool isRegistered = objectManager->registerDBusStubAdapter(_stubAdapter);
- if (!isRegistered) {
- services_.erase(insertResult.first);
- return false;
- }
-
- const auto &serviceName = _stubAdapter->getDBusAddress().getService();
- const bool isAcquired = connection->requestServiceNameAndBlock(serviceName);
- if (!isAcquired) {
- const bool isDeregistered = objectManager->unregisterDBusStubAdapter(_stubAdapter);
- assert(isDeregistered);
-
- services_.erase(insertResult.first);
- }
-
- return isAcquired;
+ const auto &connection = _stubAdapter->getDBusConnection();
+ const auto objectManager = connection->getDBusObjectManager();
+ const bool isRegistered = objectManager->registerDBusStubAdapter(_stubAdapter);
+ if (!isRegistered) {
+ services_.erase(insertResult.first);
+ return false;
+ }
+
+ const auto &serviceName = _stubAdapter->getDBusAddress().getService();
+ const bool isAcquired = connection->requestServiceNameAndBlock(serviceName);
+ if (!isAcquired) {
+ const bool isDeregistered = objectManager->unregisterDBusStubAdapter(_stubAdapter);
+ assert(isDeregistered);
+ (void)isDeregistered;
+
+ services_.erase(insertResult.first);
+ }
+
+ return isAcquired;
}
return false;
@@ -319,24 +325,24 @@ Factory::registerManagedService(const std::shared_ptr<DBusStubAdapter> &_stubAda
bool
Factory::unregisterManagedService(const std::string &_address) {
- return unregisterManagedService(services_.find(_address));
+ return unregisterManagedService(services_.find(_address));
}
bool
Factory::unregisterManagedService(const ServicesMap::iterator &iterator) {
- if (iterator == services_.end())
- return true;
+ if (iterator == services_.end())
+ return true;
- const auto &stubAdapter = iterator->second;
+ const auto &stubAdapter = iterator->second;
const auto &connection = stubAdapter->getDBusConnection();
const auto objectManager = connection->getDBusObjectManager();
const auto &serviceName = stubAdapter->getDBusAddress().getService();
const bool isUnregistered
- = objectManager->unregisterDBusStubAdapter(stubAdapter);
+ = objectManager->unregisterDBusStubAdapter(stubAdapter);
if (isUnregistered) {
- connection->releaseServiceName(serviceName);
- services_.erase(iterator);
+ connection->releaseServiceName(serviceName);
+ services_.erase(iterator);
}
// TODO: log error
return isUnregistered;
diff --git a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
index 7d9ce62..75fc0b5 100644
--- a/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
+++ b/src/CommonAPI/DBus/DBusFreedesktopPropertiesStub.cpp
@@ -15,12 +15,12 @@ namespace CommonAPI {
namespace DBus {
DBusFreedesktopPropertiesStub::DBusFreedesktopPropertiesStub(
- const std::string &_path, const std::string &_interface,
- const std::shared_ptr<DBusProxyConnection> &_connection,
- const std::shared_ptr<DBusStubAdapter> &_adapter)
- : path_(_path),
- connection_(_connection),
- adapter_(_adapter) {
+ const std::string &_path, const std::string &_interface,
+ const std::shared_ptr<DBusProxyConnection> &_connection,
+ const std::shared_ptr<DBusStubAdapter> &_adapter)
+ : path_(_path),
+ connection_(_connection),
+ adapter_(_adapter) {
assert(!path_.empty());
assert(path_[0] == '/');
assert(_connection);
@@ -66,9 +66,9 @@ DBusFreedesktopPropertiesStub::onInterfaceDBusMessage(const DBusMessage &_messag
}
if (!_message.isMethodCallType() ||
- !(_message.hasMemberName("Get") ||
- _message.hasMemberName("GetAll") ||
- _message.hasMemberName("Set"))) {
+ !(_message.hasMemberName("Get") ||
+ _message.hasMemberName("GetAll") ||
+ _message.hasMemberName("Set"))) {
return false;
}
@@ -89,7 +89,7 @@ DBusFreedesktopPropertiesStub::onInterfaceDBusMessage(const DBusMessage &_messag
return it->second->onInterfaceDBusFreedesktopPropertiesMessage(_message);
}
-const bool DBusFreedesktopPropertiesStub::hasFreedesktopProperties() {
+bool DBusFreedesktopPropertiesStub::hasFreedesktopProperties() {
return false;
}
@@ -98,7 +98,7 @@ const std::string &DBusFreedesktopPropertiesStub::getObjectPath() const {
}
const std::string &DBusFreedesktopPropertiesStub::getInterface() {
- static std::string theInterface("org.freedesktop.DBus.Properties");
+ static std::string theInterface("org.freedesktop.DBus.Properties");
return theInterface;
}
diff --git a/src/CommonAPI/DBus/DBusFunctionalHash.cpp b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
index 7eeb67f..00b5da6 100644
--- a/src/CommonAPI/DBus/DBusFunctionalHash.cpp
+++ b/src/CommonAPI/DBus/DBusFunctionalHash.cpp
@@ -13,7 +13,7 @@
/*
* @see http://code.google.com/p/smhasher/
*/
-#define SMHASHER_SEED_VALUE 0xc70f6907UL
+#define SMHASHER_SEED_VALUE 0xc70f6907UL
namespace std {
@@ -25,15 +25,15 @@ size_t hash<pair<const char*, const char*> >::operator()(const pair<const char*,
assert(b);
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a, strlen(a), seed, &seed);
- MurmurHash3_x86_32(b, strlen(b), seed, &seed);
+ MurmurHash3_x86_32(a, static_cast<int>(strlen(a)), seed, &seed);
+ MurmurHash3_x86_32(b, static_cast<int>(strlen(b)), seed, &seed);
return static_cast<size_t>(seed);
}
size_t hash<const char*>::operator()(const char* const t) const {
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(t, strlen(t), seed, &seed);
+ MurmurHash3_x86_32(t, static_cast<int>(strlen(t)), seed, &seed);
return static_cast<size_t>(seed);
}
@@ -42,8 +42,8 @@ size_t hash<pair<string, string> >::operator()(const pair<string, string>& t) co
const string& b = t.second;
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a.c_str(), a.length(), seed, &seed);
- MurmurHash3_x86_32(b.c_str(), b.length(), seed, &seed);
+ MurmurHash3_x86_32(a.c_str(), static_cast<int>(a.length()), seed, &seed);
+ MurmurHash3_x86_32(b.c_str(), static_cast<int>(b.length()), seed, &seed);
return static_cast<size_t>(seed);
}
@@ -54,9 +54,9 @@ size_t hash<tuple<string, string, string> >::operator()(const tuple<string, stri
const string& c = get<2>(t);
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a.c_str(), a.length(), seed, &seed);
- MurmurHash3_x86_32(b.c_str(), b.length(), seed, &seed);
- MurmurHash3_x86_32(c.c_str(), c.length(), seed, &seed);
+ MurmurHash3_x86_32(a.c_str(), static_cast<int>(a.length()), seed, &seed);
+ MurmurHash3_x86_32(b.c_str(), static_cast<int>(b.length()), seed, &seed);
+ MurmurHash3_x86_32(c.c_str(), static_cast<int>(c.length()), seed, &seed);
return static_cast<size_t>(seed);
}
@@ -68,9 +68,9 @@ size_t hash<tuple<string, string, string, bool> >::operator()(const tuple<string
const bool d = get<3>(t);
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a.c_str(), a.length(), seed, &seed);
- MurmurHash3_x86_32(b.c_str(), b.length(), seed, &seed);
- MurmurHash3_x86_32(c.c_str(), c.length(), seed, &seed);
+ MurmurHash3_x86_32(a.c_str(), static_cast<int>(a.length()), seed, &seed);
+ MurmurHash3_x86_32(b.c_str(), static_cast<int>(b.length()), seed, &seed);
+ MurmurHash3_x86_32(c.c_str(), static_cast<int>(c.length()), seed, &seed);
MurmurHash3_x86_32(&d, sizeof(bool), seed, &seed);
return static_cast<size_t>(seed);
@@ -83,9 +83,9 @@ size_t hash<tuple<string, string, string, int> >::operator()(const tuple<string,
const int d = get<3>(t);
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a.c_str(), a.length(), seed, &seed);
- MurmurHash3_x86_32(b.c_str(), b.length(), seed, &seed);
- MurmurHash3_x86_32(c.c_str(), c.length(), seed, &seed);
+ MurmurHash3_x86_32(a.c_str(), static_cast<int>(a.length()), seed, &seed);
+ MurmurHash3_x86_32(b.c_str(), static_cast<int>(b.length()), seed, &seed);
+ MurmurHash3_x86_32(c.c_str(), static_cast<int>(c.length()), seed, &seed);
MurmurHash3_x86_32(&d, sizeof(d), seed, &seed);
return static_cast<size_t>(seed);
@@ -98,10 +98,10 @@ size_t hash<tuple<string, string, string, string> >::operator()(const tuple<stri
const string& d = get<3>(t);
uint32_t seed = static_cast<uint32_t>(SMHASHER_SEED_VALUE);
- MurmurHash3_x86_32(a.c_str(), a.length(), seed, &seed);
- MurmurHash3_x86_32(b.c_str(), b.length(), seed, &seed);
- MurmurHash3_x86_32(c.c_str(), c.length(), seed, &seed);
- MurmurHash3_x86_32(d.c_str(), d.length(), seed, &seed);
+ MurmurHash3_x86_32(a.c_str(), static_cast<int>(a.length()), seed, &seed);
+ MurmurHash3_x86_32(b.c_str(), static_cast<int>(b.length()), seed, &seed);
+ MurmurHash3_x86_32(c.c_str(), static_cast<int>(c.length()), seed, &seed);
+ MurmurHash3_x86_32(d.c_str(), static_cast<int>(d.length()), seed, &seed);
return static_cast<size_t>(seed);
}
diff --git a/src/CommonAPI/DBus/DBusInputStream.cpp b/src/CommonAPI/DBus/DBusInputStream.cpp
index 07964d8..ae2201a 100644
--- a/src/CommonAPI/DBus/DBusInputStream.cpp
+++ b/src/CommonAPI/DBus/DBusInputStream.cpp
@@ -11,7 +11,7 @@ namespace CommonAPI {
namespace DBus {
DBusInputStream::DBusInputStream(const CommonAPI::DBus::DBusMessage &_message)
- : begin_(_message.getBodyData()),
+ : begin_(_message.getBodyData()),
current_(0),
size_(_message.getBodyLength()),
exception_(nullptr),
@@ -33,7 +33,7 @@ void DBusInputStream::clearError() {
}
void DBusInputStream::align(const size_t _boundary) {
- const unsigned int mask = _boundary - 1;
+ const unsigned int mask = static_cast<unsigned int>(_boundary) - 1;
current_ = (current_ + mask) & (~mask);
}
@@ -50,75 +50,86 @@ void DBusInputStream::setError() {
}
void DBusInputStream::pushPosition() {
- positions_.push(current_);
+ positions_.push(current_);
}
size_t DBusInputStream::popPosition() {
- size_t itsPosition = positions_.top();
- positions_.pop();
- return itsPosition;
+ size_t itsPosition = positions_.top();
+ positions_.pop();
+ return itsPosition;
}
void DBusInputStream::pushSize(size_t _size) {
- sizes_.push(_size);
+ sizes_.push(static_cast<unsigned int>(_size));
}
size_t DBusInputStream::popSize() {
- size_t itsSize = sizes_.top();
- sizes_.pop();
- return itsSize;
+ size_t itsSize = sizes_.top();
+ sizes_.pop();
+ return itsSize;
}
InputStream<DBusInputStream> &DBusInputStream::readValue(bool &_value, const EmptyDeployment *_depl) {
- uint32_t tmp;
- readValue(tmp, _depl);
- if (tmp > 1)
- setError();
- _value = (tmp != 0);
- return (*this);
+ uint32_t tmp;
+ readValue(tmp, _depl);
+ if (tmp > 1)
+ setError();
+ _value = (tmp != 0);
+ return (*this);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(int8_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(int16_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(int32_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(int64_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(uint8_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(uint16_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(uint32_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(uint64_t &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(float &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(double &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
return _readValue(_value);
}
InputStream<DBusInputStream> &DBusInputStream::readValue(std::string &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
uint32_t length;
_readValue(length);
@@ -132,6 +143,7 @@ InputStream<DBusInputStream> &DBusInputStream::readValue(std::string &_value, co
}
InputStream<DBusInputStream> &DBusInputStream::readValue(Version &_value, const EmptyDeployment *_depl) {
+ (void)_depl;
align(8);
_readValue(_value.Major);
_readValue(_value.Minor);
diff --git a/src/CommonAPI/DBus/DBusMainLoop.cpp b/src/CommonAPI/DBus/DBusMainLoop.cpp
new file mode 100755
index 0000000..f674387
--- /dev/null
+++ b/src/CommonAPI/DBus/DBusMainLoop.cpp
@@ -0,0 +1,697 @@
+// 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/.
+
+#ifdef WIN32
+#include <WinSock2.h>
+#include <ws2tcpip.h>
+#define DEFAULT_BUFLEN 512
+#else
+#include <poll.h>
+#include <sys/eventfd.h>
+#include <unistd.h>
+#endif
+
+#include <iostream>
+#include <thread>
+#include <cstdio>
+
+#include <CommonAPI/DBus/DBusMainLoop.hpp>
+
+namespace CommonAPI {
+namespace DBus {
+
+DBusMainLoop::DBusMainLoop(std::shared_ptr<MainLoopContext> context)
+ : context_(context),
+ currentMinimalTimeoutInterval_(TIMEOUT_INFINITE),
+ hasToStop_(false),
+ isBroken_(false) {
+#ifdef WIN32
+ WSADATA wsaData;
+ int iResult;
+
+ SOCKET ListenSocket = INVALID_SOCKET;
+
+ struct addrinfo *result = NULL;
+ struct addrinfo hints;
+
+ // Initialize Winsock
+ iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
+ if (iResult != 0) {
+ printf("WSAStartup failed with error: %d\n", iResult);
+ }
+
+ ZeroMemory(&hints, sizeof(hints));
+ hints.ai_family = AF_INET;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+ hints.ai_flags = AI_PASSIVE;
+
+ // Resolve the server address and port
+ iResult = getaddrinfo(NULL, "0", &hints, &result);
+ if (iResult != 0) {
+ printf("getaddrinfo failed with error: %d\n", iResult);
+ WSACleanup();
+ }
+
+ // Create a SOCKET for connecting to server
+ ListenSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
+ if (ListenSocket == INVALID_SOCKET) {
+ printf("socket failed with error: %ld\n", WSAGetLastError());
+ freeaddrinfo(result);
+ WSACleanup();
+ }
+
+ // Setup the TCP listening socket
+ iResult = bind(ListenSocket, result->ai_addr, (int)result->ai_addrlen);
+ if (iResult == SOCKET_ERROR) {
+ printf("bind failed with error: %d\n", WSAGetLastError());
+ freeaddrinfo(result);
+ closesocket(ListenSocket);
+ WSACleanup();
+ }
+
+ sockaddr* connected_addr = new sockaddr();
+ USHORT port = 0;
+ int namelength = sizeof(sockaddr);
+ iResult = getsockname(ListenSocket, connected_addr, &namelength);
+ if (iResult == SOCKET_ERROR) {
+ printf("getsockname failed with error: %d\n", WSAGetLastError());
+ } else if (connected_addr->sa_family == AF_INET) {
+ port = ((struct sockaddr_in*)connected_addr)->sin_port;
+ }
+ delete connected_addr;
+
+ freeaddrinfo(result);
+
+ iResult = listen(ListenSocket, SOMAXCONN);
+ if (iResult == SOCKET_ERROR) {
+ printf("listen failed with error: %d\n", WSAGetLastError());
+ closesocket(ListenSocket);
+ WSACleanup();
+ }
+
+ wsaData;
+ wakeFd_.fd = INVALID_SOCKET;
+ struct addrinfo *ptr = NULL;
+
+ // Initialize Winsock
+ iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
+ if (iResult != 0) {
+ printf("WSAStartup failed with error: %d\n", iResult);
+ }
+
+ ZeroMemory(&hints, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+
+ // Resolve the server address and port
+ iResult = getaddrinfo("127.0.0.1", std::to_string(ntohs(port)).c_str(), &hints, &result);
+ if (iResult != 0) {
+ printf("getaddrinfo failed with error: %d\n", iResult);
+ WSACleanup();
+ }
+
+ // Attempt to connect to an address until one succeeds
+ for (ptr = result; ptr != NULL; ptr = ptr->ai_next) {
+
+ // Create a SOCKET for connecting to server
+ wakeFd_.fd = socket(ptr->ai_family, ptr->ai_socktype,
+ ptr->ai_protocol);
+ if (wakeFd_.fd == INVALID_SOCKET) {
+ printf("socket failed with error: %ld\n", WSAGetLastError());
+ WSACleanup();
+ }
+
+ // Connect to server.
+ iResult = connect(wakeFd_.fd, ptr->ai_addr, (int)ptr->ai_addrlen);
+ if (iResult == SOCKET_ERROR) {
+ printf("connect failed with error: %ld\n", WSAGetLastError());
+ closesocket(wakeFd_.fd);
+ wakeFd_.fd = INVALID_SOCKET;
+ continue;
+ }
+ break;
+ }
+
+ freeaddrinfo(result);
+
+ if (wakeFd_.fd == INVALID_SOCKET) {
+ printf("Unable to connect to server!\n");
+ WSACleanup();
+ }
+
+ // Accept a client socket
+ sendFd_.fd = accept(ListenSocket, NULL, NULL);
+ if (sendFd_.fd == INVALID_SOCKET) {
+ printf("accept failed with error: %d\n", WSAGetLastError());
+ closesocket(ListenSocket);
+ WSACleanup();
+ }
+
+ wakeFd_.events = POLLIN;
+ registerFileDescriptor(wakeFd_);
+#else
+ wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK);
+ wakeFd_.events = POLLIN;
+ registerFileDescriptor(wakeFd_);
+#endif
+
+ dispatchSourceListenerSubscription_ = context_->subscribeForDispatchSources(
+ std::bind(&DBusMainLoop::registerDispatchSource, this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(&DBusMainLoop::unregisterDispatchSource,
+ this, std::placeholders::_1));
+ watchListenerSubscription_ = context_->subscribeForWatches(
+ std::bind(&DBusMainLoop::registerWatch, this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(&DBusMainLoop::unregisterWatch, this,
+ std::placeholders::_1));
+ timeoutSourceListenerSubscription_ = context_->subscribeForTimeouts(
+ std::bind(&DBusMainLoop::registerTimeout, this,
+ std::placeholders::_1, std::placeholders::_2),
+ std::bind(&DBusMainLoop::unregisterTimeout, this,
+ std::placeholders::_1));
+ wakeupListenerSubscription_ = context_->subscribeForWakeupEvents(
+ std::bind(&DBusMainLoop::wakeup, this));
+}
+
+DBusMainLoop::~DBusMainLoop() {
+ unregisterFileDescriptor (wakeFd_);
+
+ context_->unsubscribeForDispatchSources(
+ dispatchSourceListenerSubscription_);
+ context_->unsubscribeForWatches(watchListenerSubscription_);
+ context_->unsubscribeForTimeouts(timeoutSourceListenerSubscription_);
+ context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_);
+
+#ifdef WIN32
+ // shutdown the connection since no more data will be sent
+ int iResult = shutdown(wakeFd_.fd, SD_SEND);
+ if (iResult == SOCKET_ERROR) {
+ printf("shutdown failed with error: %d\n", WSAGetLastError());
+ closesocket(wakeFd_.fd);
+ WSACleanup();
+ }
+
+ // cleanup
+ closesocket(wakeFd_.fd);
+ WSACleanup();
+#else
+ close(wakeFd_.fd);
+#endif
+}
+
+void DBusMainLoop::run(const int64_t& timeoutInterval) {
+ while (!hasToStop_) {
+ doSingleIteration(timeoutInterval);
+ }
+}
+
+void DBusMainLoop::stop() {
+ hasToStop_ = true;
+ wakeup();
+}
+
+void DBusMainLoop::doSingleIteration(const int64_t& timeout) {
+ {
+ std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
+ for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
+ dispatchSourceIterator != registeredDispatchSources_.end();
+ dispatchSourceIterator++) {
+
+ (dispatchSourceIterator->second)->mutex_->lock();
+ if ((dispatchSourceIterator->second)->deleteObject_) {
+ if (!(dispatchSourceIterator->second)->isExecuted_) {
+ (dispatchSourceIterator->second)->mutex_->unlock();
+ bool contained = false;
+ for (std::set<DispatchSourceToDispatchStruct*>::iterator dispatchSourceIteratorInner = sourcesToDispatch_.begin();
+ dispatchSourceIteratorInner != sourcesToDispatch_.end(); dispatchSourceIteratorInner++) {
+ if ((*dispatchSourceIteratorInner)->dispatchSource_ == (dispatchSourceIterator->second)->dispatchSource_) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained) {
+ delete (dispatchSourceIterator->second)->dispatchSource_;
+ (dispatchSourceIterator->second)->dispatchSource_ = NULL;
+ delete (dispatchSourceIterator->second)->mutex_;
+ (dispatchSourceIterator->second)->mutex_ = NULL;
+ delete dispatchSourceIterator->second;
+ dispatchSourceIterator = registeredDispatchSources_.erase(dispatchSourceIterator);
+ }
+ if (dispatchSourceIterator == registeredDispatchSources_.end()) {
+ break;
+ }
+ }
+ else {
+ (dispatchSourceIterator->second)->mutex_->unlock();
+ }
+ }
+ else {
+ (dispatchSourceIterator->second)->mutex_->unlock();
+ }
+ }
+ }
+
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ for (auto timeoutIterator = registeredTimeouts_.begin();
+ timeoutIterator != registeredTimeouts_.end();
+ timeoutIterator++) {
+
+ (timeoutIterator->second)->mutex_->lock();
+ if ((timeoutIterator->second)->deleteObject_) {
+ if (!(timeoutIterator->second)->isExecuted_) {
+ (timeoutIterator->second)->mutex_->unlock();
+ bool contained = false;
+ for (std::set<TimeoutToDispatchStruct*>::iterator timeoutIteratorInner = timeoutsToDispatch_.begin();
+ timeoutIteratorInner != timeoutsToDispatch_.end(); timeoutIteratorInner++) {
+ if ((*timeoutIteratorInner)->timeout_ == (timeoutIterator->second)->timeout_) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained) {
+ delete (timeoutIterator->second)->timeout_;
+ (timeoutIterator->second)->timeout_ = NULL;
+ delete (timeoutIterator->second)->mutex_;
+ (timeoutIterator->second)->mutex_ = NULL;
+ delete timeoutIterator->second;
+ timeoutIterator = registeredTimeouts_.erase(timeoutIterator);
+ }
+ if (timeoutIterator == registeredTimeouts_.end()) {
+ break;
+ }
+ }
+ else {
+ (timeoutIterator->second)->mutex_->unlock();
+ }
+ }
+ else {
+ (timeoutIterator->second)->mutex_->unlock();
+ }
+ }
+ }
+
+ {
+ std::lock_guard<std::mutex> itsLock(watchesMutex_);
+ for (auto watchesIterator = registeredWatches_.begin();
+ watchesIterator != registeredWatches_.end();
+ watchesIterator++) {
+
+ (watchesIterator->second)->mutex_->lock();
+ if ((watchesIterator->second)->deleteObject_) {
+ if (!(watchesIterator->second)->isExecuted_) {
+ (watchesIterator->second)->mutex_->unlock();
+ bool contained = false;
+ for (auto watchesIteratorInner = watchesToDispatch_.begin();
+ watchesIteratorInner != watchesToDispatch_.end(); watchesIteratorInner++) {
+ if ((*watchesIteratorInner)->watch_ == (watchesIterator->second)->watch_) {
+ contained = true;
+ break;
+ }
+ }
+ if (!contained) {
+ delete (watchesIterator->second)->watch_;
+ (watchesIterator->second)->watch_ = NULL;
+ delete (watchesIterator->second)->mutex_;
+ (watchesIterator->second)->mutex_ = NULL;
+ delete watchesIterator->second;
+ watchesIterator = registeredWatches_.erase(watchesIterator);
+ }
+ if (watchesIterator == registeredWatches_.end()) {
+ break;
+ }
+ }
+ else {
+ (watchesIterator->second)->mutex_->unlock();
+ }
+ }
+ else {
+ (watchesIterator->second)->mutex_->unlock();
+ }
+ }
+ }
+
+ if (prepare(timeout)) {
+ dispatch();
+ } else {
+ poll();
+ if (check()) {
+ dispatch();
+ }
+ }
+}
+
+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++) {
+
+ int64_t dispatchTimeout = TIMEOUT_INFINITE;
+ if ((dispatchSourceIterator->second)->dispatchSource_->prepare(dispatchTimeout)) {
+ sourcesToDispatch_.insert(dispatchSourceIterator->second);
+ } else if (dispatchTimeout < currentMinimalTimeoutInterval_) {
+ currentMinimalTimeoutInterval_ = dispatchTimeout;
+ }
+ }
+ }
+
+ int64_t currentContextTime = getCurrentTimeInMs();
+
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ for (auto timeoutPriorityRange = registeredTimeouts_.begin();
+ timeoutPriorityRange != registeredTimeouts_.end();
+ timeoutPriorityRange++) {
+
+ (timeoutPriorityRange->second)->mutex_->lock();
+ bool deleteObject = (timeoutPriorityRange->second)->deleteObject_;
+ (timeoutPriorityRange->second)->mutex_->unlock();
+
+ if (!deleteObject) {
+ if (!(timeoutPriorityRange->second)->timeoutElapsed_) { // check that timeout is not elapsed
+ int64_t intervalToReady = (timeoutPriorityRange->second)->timeout_->getReadyTime()
+ - currentContextTime;
+
+ if (intervalToReady <= 0) {
+ // set information that timeout is elapsed
+ (timeoutPriorityRange->second)->timeoutElapsed_ = true;
+
+ timeoutsToDispatch_.insert(timeoutPriorityRange->second);
+ currentMinimalTimeoutInterval_ = TIMEOUT_NONE;
+ } else if (intervalToReady < currentMinimalTimeoutInterval_) {
+ currentMinimalTimeoutInterval_ = intervalToReady;
+ }
+ }
+ }
+ }
+ }
+
+ return (!sourcesToDispatch_.empty() || !timeoutsToDispatch_.empty());
+}
+
+void DBusMainLoop::poll() {
+ int managedFileDescriptorOffset = 0;
+
+ for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset; fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
+ (*fileDescriptor).revents = 0;
+ }
+
+#ifdef WIN32
+ size_t numReadyFileDescriptors = WSAPoll(&managedFileDescriptors_[0], managedFileDescriptors_.size(), -1);
+#else
+ size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]),
+ managedFileDescriptors_.size(), -1);
+#endif
+ if (!numReadyFileDescriptors) {
+ int64_t currentContextTime = getCurrentTimeInMs();
+
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ for (auto timeoutPriorityRange = registeredTimeouts_.begin();
+ timeoutPriorityRange != registeredTimeouts_.end();
+ timeoutPriorityRange++) {
+
+ (timeoutPriorityRange->second)->mutex_->lock();
+ bool deleteObject = (timeoutPriorityRange->second)->deleteObject_;
+ (timeoutPriorityRange->second)->mutex_->unlock();
+
+ if (!deleteObject) {
+ if (!(timeoutPriorityRange->second)->timeoutElapsed_) { // check that timeout is not elapsed
+ int64_t intervalToReady =
+ (timeoutPriorityRange->second)->timeout_->getReadyTime()
+ - currentContextTime;
+
+ if (intervalToReady <= 0) {
+ // set information that timeout is elapsed
+ (timeoutPriorityRange->second)->timeoutElapsed_ = true;
+
+ timeoutsToDispatch_.insert(timeoutPriorityRange->second);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // If the wakeup descriptor woke us up, we must acknowledge
+ if (managedFileDescriptors_[0].revents) {
+ wakeupAck();
+ }
+}
+
+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.
+ int managedFileDescriptorOffset = 1;
+ {
+ std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
+ for (auto fileDescriptor = managedFileDescriptors_.begin() + managedFileDescriptorOffset;
+ fileDescriptor != managedFileDescriptors_.end(); ++fileDescriptor) {
+ {
+ std::lock_guard<std::mutex> itsWatchesLock(watchesMutex_);
+ for (auto registeredWatchIterator = registeredWatches_.begin();
+ registeredWatchIterator != registeredWatches_.end();
+ registeredWatchIterator++) {
+
+ (registeredWatchIterator->second)->mutex_->lock();
+ bool deleteObject = (registeredWatchIterator->second)->deleteObject_;
+ (registeredWatchIterator->second)->mutex_->unlock();
+
+ if (!deleteObject) {
+ if ((registeredWatchIterator->second)->fd_ == fileDescriptor->fd
+ && fileDescriptor->revents) {
+ watchesToDispatch_.insert(registeredWatchIterator->second);
+ }
+ }
+ }
+ }
+ }
+ }
+ {
+ 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);
+ }
+ }
+ }
+
+ return (!timeoutsToDispatch_.empty() ||
+ !watchesToDispatch_.empty() ||
+ !sourcesToDispatch_.empty());
+}
+
+void DBusMainLoop::dispatch() {
+ if (timeoutsToDispatch_.size() > 0)
+ {
+ 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;
+ }
+ (*timeoutIterator)->mutex_->unlock();
+ }
+
+ timeoutsToDispatch_.clear();
+ }
+
+ if (watchesToDispatch_.size() > 0)
+ {
+ 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;
+ watch->dispatch(flags);
+ (*watchIterator)->mutex_->lock();
+ (*watchIterator)->isExecuted_ = false;
+ }
+ (*watchIterator)->mutex_->unlock();
+ }
+ watchesToDispatch_.clear();
+ }
+
+ if (sourcesToDispatch_.size() > 0)
+ {
+ isBroken_ = false;
+ 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;
+ }
+ (*dispatchSourceIterator)->mutex_->unlock();
+ }
+ {
+ sourcesToDispatch_.clear();
+ }
+ }
+}
+
+void DBusMainLoop::wakeup() {
+#ifdef WIN32
+ // Send an initial buffer
+ char *sendbuf = "1";
+
+ int iResult = send(sendFd_.fd, sendbuf, (int)strlen(sendbuf), 0);
+ if (iResult == SOCKET_ERROR) {
+ printf("send failed with error: %d\n", WSAGetLastError());
+ }
+#else
+ int64_t wake = 1;
+ if(::write(wakeFd_.fd, &wake, sizeof(int64_t)) == -1) {
+ std::perror("DBusMainLoop::wakeup");
+ }
+#endif
+}
+
+void DBusMainLoop::wakeupAck() {
+#ifdef WIN32
+ // Receive until the peer closes the connection
+ int iResult;
+ char recvbuf[DEFAULT_BUFLEN];
+ int recvbuflen = DEFAULT_BUFLEN;
+
+ iResult = recv(wakeFd_.fd, recvbuf, recvbuflen, 0);
+ if (iResult > 0) {
+ //printf("Bytes received from %d: %d\n", wakeFd_.fd, iResult);
+ }
+ else if (iResult == 0) {
+ printf("Connection closed\n");
+ }
+ else {
+ printf("recv failed with error: %d\n", WSAGetLastError());
+ }
+
+#else
+ int64_t buffer;
+ while(::read(wakeFd_.fd, &buffer, sizeof(int64_t)) == sizeof(buffer));
+#endif
+}
+
+void DBusMainLoop::registerFileDescriptor(
+ const DBusMainLoopPollFd& fileDescriptor) {
+ std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
+ managedFileDescriptors_.push_back(fileDescriptor);
+}
+
+void DBusMainLoop::unregisterFileDescriptor(
+ const DBusMainLoopPollFd& fileDescriptor) {
+ wakeup();
+ std::lock_guard<std::mutex> itsLock(fileDescriptorsMutex_);
+ for (auto it = managedFileDescriptors_.begin();
+ it != managedFileDescriptors_.end(); it++) {
+ if ((*it).fd == fileDescriptor.fd && (*it).events == fileDescriptor.events) {
+ managedFileDescriptors_.erase(it);
+ break;
+ }
+ }
+}
+
+void DBusMainLoop::registerDispatchSource(DispatchSource* dispatchSource,
+ const DispatchPriority dispatchPriority) {
+ DispatchSourceToDispatchStruct* dispatchSourceStruct = new DispatchSourceToDispatchStruct(dispatchSource, new std::mutex, false, false);
+ std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
+ registeredDispatchSources_.insert({ dispatchPriority, dispatchSourceStruct });
+}
+
+void DBusMainLoop::unregisterDispatchSource(DispatchSource* dispatchSource) {
+ {
+ std::lock_guard<std::mutex> itsLock(dispatchSourcesMutex_);
+ for (auto dispatchSourceIterator = registeredDispatchSources_.begin();
+ dispatchSourceIterator != registeredDispatchSources_.end();
+ dispatchSourceIterator++) {
+
+ if ((dispatchSourceIterator->second)->dispatchSource_ == dispatchSource){
+ (dispatchSourceIterator->second)->mutex_->lock();
+ (dispatchSourceIterator->second)->deleteObject_ = true;
+ (dispatchSourceIterator->second)->mutex_->unlock();
+ break;
+ }
+ }
+ isBroken_ = true;
+ }
+}
+
+void DBusMainLoop::registerWatch(Watch* watch,
+ const DispatchPriority dispatchPriority) {
+
+ std::lock_guard<std::mutex> itsLock(watchesMutex_);
+ DBusMainLoopPollFd fdToRegister = watch->getAssociatedFileDescriptor();
+
+ registerFileDescriptor(fdToRegister);
+ std::mutex* mtx = new std::mutex;
+#ifndef WIN32
+ asm volatile ("":::"memory");
+#endif
+ WatchToDispatchStruct* watchStruct = new WatchToDispatchStruct(fdToRegister.fd, watch, mtx, false, false);
+ registeredWatches_.insert({ dispatchPriority, watchStruct});
+}
+
+void DBusMainLoop::unregisterWatch(Watch* watch) {
+ unregisterFileDescriptor(watch->getAssociatedFileDescriptor());
+ {
+ std::lock_guard<std::mutex> itsLock(watchesMutex_);
+
+ for (auto watchIterator = registeredWatches_.begin();
+ watchIterator != registeredWatches_.end(); watchIterator++) {
+
+ if ((watchIterator->second)->watch_ == watch) {
+ (watchIterator->second)->mutex_->lock();
+ (watchIterator->second)->deleteObject_ = true;
+ (watchIterator->second)->mutex_->unlock();
+ break;
+ }
+ }
+ }
+}
+
+void DBusMainLoop::registerTimeout(Timeout* timeout,
+ const DispatchPriority dispatchPriority) {
+ TimeoutToDispatchStruct* timeoutStruct = new TimeoutToDispatchStruct(timeout, new std::mutex, false, false, false);
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ registeredTimeouts_.insert({ dispatchPriority, timeoutStruct });
+}
+
+void DBusMainLoop::unregisterTimeout(Timeout* timeout) {
+ {
+ std::lock_guard<std::mutex> itsLock(timeoutsMutex_);
+ for (auto timeoutIterator = registeredTimeouts_.begin();
+ timeoutIterator != registeredTimeouts_.end();
+ timeoutIterator++) {
+
+ if ((timeoutIterator->second)->timeout_ == timeout) {
+ (timeoutIterator->second)->mutex_->lock();
+ (timeoutIterator->second)->deleteObject_ = true;
+ (timeoutIterator->second)->mutex_->unlock();
+ break;
+ }
+ }
+ }
+}
+
+} // namespace DBus
+} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusMainLoopContext.cpp b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
index c20beb9..1c795ad 100644
--- a/src/CommonAPI/DBus/DBusMainLoopContext.cpp
+++ b/src/CommonAPI/DBus/DBusMainLoopContext.cpp
@@ -24,7 +24,8 @@ DBusDispatchSource::DBusDispatchSource(DBusConnection* dbusConnection):
DBusDispatchSource::~DBusDispatchSource() {
}
-bool DBusDispatchSource::prepare(int64_t& timeout) {
+bool DBusDispatchSource::prepare(int64_t &_timeout) {
+ (void)_timeout;
return dbusConnection_->isDispatchReady();
}
@@ -44,7 +45,7 @@ DBusWatch::DBusWatch(::DBusWatch* libdbusWatch, std::weak_ptr<MainLoopContext>&
}
bool DBusWatch::isReadyToBeWatched() {
- return 0 != dbus_watch_get_enabled(libdbusWatch_);
+ return 0 != dbus_watch_get_enabled(libdbusWatch_);
}
void DBusWatch::startWatching() {
@@ -54,7 +55,7 @@ void DBusWatch::startWatching() {
#ifdef WIN32
short int pollFlags = 0;
#else
- short int pollFlags = POLLERR | POLLHUP;
+ short int pollFlags = POLLERR | POLLHUP;
#endif
if(channelFlags_ & DBUS_WATCH_READABLE) {
pollFlags |= POLLIN;
@@ -64,11 +65,11 @@ void DBusWatch::startWatching() {
}
#ifdef WIN32
- pollFileDescriptor_.fd = dbus_watch_get_socket(libdbusWatch_);
- wsaEvent_ = WSACreateEvent();
- WSAEventSelect(pollFileDescriptor_.fd, wsaEvent_, FD_READ);
+ pollFileDescriptor_.fd = dbus_watch_get_socket(libdbusWatch_);
+ wsaEvent_ = WSACreateEvent();
+ WSAEventSelect(pollFileDescriptor_.fd, wsaEvent_, FD_READ);
#else
- pollFileDescriptor_.fd = dbus_watch_get_unix_fd(libdbusWatch_);
+ pollFileDescriptor_.fd = dbus_watch_get_unix_fd(libdbusWatch_);
#endif
pollFileDescriptor_.events = pollFlags;
@@ -82,7 +83,7 @@ void DBusWatch::startWatching() {
void DBusWatch::stopWatching() {
auto lockedContext = mainLoopContext_.lock();
if (lockedContext) {
- lockedContext->deregisterWatch(this);
+ lockedContext->deregisterWatch(this);
}
}
@@ -92,7 +93,7 @@ const pollfd& DBusWatch::getAssociatedFileDescriptor() {
#ifdef WIN32
const HANDLE& DBusWatch::getAssociatedEvent() {
- return wsaEvent_;
+ return wsaEvent_;
}
#endif
@@ -142,7 +143,7 @@ DBusTimeout::DBusTimeout(::DBusTimeout* libdbusTimeout, std::weak_ptr<MainLoopCo
}
bool DBusTimeout::isReadyToBeMonitored() {
- return 0 != dbus_timeout_get_enabled(libdbusTimeout_);
+ return 0 != dbus_timeout_get_enabled(libdbusTimeout_);
}
void DBusTimeout::startMonitoring() {
@@ -156,7 +157,7 @@ void DBusTimeout::stopMonitoring() {
dueTimeInMs_ = TIMEOUT_INFINITE;
auto lockedContext = mainLoopContext_.lock();
if (lockedContext) {
- lockedContext->deregisterTimeoutSource(this);
+ lockedContext->deregisterTimeoutSource(this);
}
}
diff --git a/src/CommonAPI/DBus/DBusMessage.cpp b/src/CommonAPI/DBus/DBusMessage.cpp
index e041b79..5a6a549 100644
--- a/src/CommonAPI/DBus/DBusMessage.cpp
+++ b/src/CommonAPI/DBus/DBusMessage.cpp
@@ -13,7 +13,7 @@ namespace CommonAPI {
namespace DBus {
DBusMessage::DBusMessage()
- : message_(NULL) {
+ : message_(NULL) {
}
DBusMessage::DBusMessage(::DBusMessage *_message) {
@@ -27,7 +27,7 @@ DBusMessage::DBusMessage(::DBusMessage *_message, bool reference) {
DBusMessage::DBusMessage(const DBusMessage &_source) {
message_ = (_source.message_ != nullptr ?
- dbus_message_ref(_source.message_) : nullptr);
+ dbus_message_ref(_source.message_) : nullptr);
}
DBusMessage::DBusMessage(DBusMessage &&_source) {
@@ -47,7 +47,7 @@ DBusMessage::operator=(const DBusMessage &_source) {
dbus_message_unref(message_);
message_ = (_source.message_ != nullptr ?
- dbus_message_ref(_source.message_) : nullptr);
+ dbus_message_ref(_source.message_) : nullptr);
}
return (*this);
}
@@ -70,24 +70,24 @@ DBusMessage::operator bool() const {
DBusMessage
DBusMessage::createOrgFreedesktopOrgMethodCall(
- const std::string &_method, const std::string &_signature) {
+ const std::string &_method, const std::string &_signature) {
- static DBusAddress address("org.freedesktop.DBus", "/", "org.freedesktop.DBus");
+ static DBusAddress address("org.freedesktop.DBus", "/", "org.freedesktop.DBus");
return DBusMessage::createMethodCall(address, _method, _signature);
}
DBusMessage
DBusMessage::createMethodCall(
- const DBusAddress &_address,
+ const DBusAddress &_address,
const std::string &_method, const std::string &_signature) {
- std::string service = _address.getService();
- std::string path = _address.getObjectPath();
- std::string interface = _address.getInterface();
+ std::string service = _address.getService();
+ std::string path = _address.getObjectPath();
+ std::string interface = _address.getInterface();
::DBusMessage *methodCall = dbus_message_new_method_call(
- service.c_str(), path.c_str(),
- interface.c_str(), _method.c_str());
+ service.c_str(), path.c_str(),
+ interface.c_str(), _method.c_str());
assert(methodCall);
if ("" != _signature)
@@ -109,10 +109,10 @@ DBusMessage::createMethodReturn(const std::string &_signature) const {
DBusMessage
DBusMessage::createMethodError(
- const std::string &_code, const std::string &_info) const {
+ const std::string &_code, const std::string &_info) const {
- ::DBusMessage *methodError
- = dbus_message_new_error(message_, _code.c_str(), _info.c_str());
+ ::DBusMessage *methodError
+ = dbus_message_new_error(message_, _code.c_str(), _info.c_str());
assert(methodError);
return DBusMessage(methodError, false);
@@ -120,11 +120,11 @@ DBusMessage::createMethodError(
DBusMessage
DBusMessage::createSignal(
- const std::string &_path, const std::string &_interface,
+ const std::string &_path, const std::string &_interface,
const std::string &_signal, const std::string &_signature) {
::DBusMessage *messageSignal
- = dbus_message_new_signal(_path.c_str(), _interface.c_str(), _signal.c_str());
+ = dbus_message_new_signal(_path.c_str(), _interface.c_str(), _signal.c_str());
assert(messageSignal);
if ("" != _signature)
@@ -169,8 +169,8 @@ DBusMessage::getDestination() const {
return dbus_message_get_destination(message_);
}
-const uint32_t DBusMessage::getSerial() const {
- return dbus_message_get_serial(message_);
+uint32_t DBusMessage::getSerial() const {
+ return dbus_message_get_serial(message_);
}
bool
@@ -210,7 +210,7 @@ bool DBusMessage::hasSignature(const char *_signature) const {
return (!strcmp(signature, _signature));
}
-const DBusMessage::Type DBusMessage::getType() const {
+DBusMessage::Type DBusMessage::getType() const {
return static_cast<Type>(dbus_message_get_type(message_));
}
@@ -227,12 +227,12 @@ int DBusMessage::getBodySize() const {
}
bool DBusMessage::setBodyLength(const int _length) {
- return 0 != dbus_message_set_body_length(message_, _length);
+ return 0 != dbus_message_set_body_length(message_, _length);
}
bool DBusMessage::setDestination(const char *_destination)
{
- return 0 != dbus_message_set_destination(message_, _destination);
+ return 0 != dbus_message_set_destination(message_, _destination);
}
bool DBusMessage::hasObjectPath(const std::string &_path) const {
diff --git a/src/CommonAPI/DBus/DBusObjectManager.cpp b/src/CommonAPI/DBus/DBusObjectManager.cpp
index 35a3d4f..3d10c6d 100644
--- a/src/CommonAPI/DBus/DBusObjectManager.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManager.cpp
@@ -55,12 +55,12 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
if (isRegistrationSuccessful && dbusStubAdapter->hasFreedesktopProperties()) {
const std::shared_ptr<DBusFreedesktopPropertiesStub> dbusFreedesktopPropertiesStub =
- std::make_shared<DBusFreedesktopPropertiesStub>(dbusStubAdapterObjectPath,
+ std::make_shared<DBusFreedesktopPropertiesStub>(dbusStubAdapterObjectPath,
dbusStubAdapterInterfaceName,
dbusStubAdapter->getDBusConnection(),
dbusStubAdapter);
isRegistrationSuccessful = isRegistrationSuccessful
- && addDBusInterfaceHandler({ dbusFreedesktopPropertiesStub->getObjectPath(),
+ && addDBusInterfaceHandler({ dbusFreedesktopPropertiesStub->getObjectPath(),
dbusFreedesktopPropertiesStub->getInterface() },
dbusFreedesktopPropertiesStub);
}
@@ -71,10 +71,10 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
if (!managerStubExists) {
const std::shared_ptr<DBusObjectManagerStub> newManagerStub
- = std::make_shared<DBusObjectManagerStub>(
- dbusStubAdapterObjectPath,
- dbusStubAdapter->getDBusConnection()
- );
+ = std::make_shared<DBusObjectManagerStub>(
+ dbusStubAdapterObjectPath,
+ dbusStubAdapter->getDBusConnection()
+ );
auto insertResult = managerStubs_.insert( {dbusStubAdapterObjectPath, {newManagerStub, 1} });
assert(insertResult.second);
managerStubIterator = insertResult.first;
@@ -92,6 +92,7 @@ bool DBusObjectManager::registerDBusStubAdapter(std::shared_ptr<DBusStubAdapter>
if (!isRegistrationSuccessful) {
const bool isDBusStubAdapterRemoved = removeDBusInterfaceHandler(dbusStubAdapterHandlerPath, dbusStubAdapter);
assert(isDBusStubAdapterRemoved);
+ (void)isDBusStubAdapterRemoved;
}
}
@@ -164,11 +165,12 @@ bool DBusObjectManager::exportManagedDBusStubAdapter(const std::string& parentOb
bool DBusObjectManager::unexportManagedDBusStubAdapter(const std::string& parentObjectPath, std::shared_ptr<DBusStubAdapter> dbusStubAdapter) {
auto foundManagerStubIterator = managerStubs_.find(parentObjectPath);
- assert(foundManagerStubIterator != managerStubs_.end());
-
- if (std::get<0>(foundManagerStubIterator->second)->unexportManagedDBusStubAdapter(dbusStubAdapter)) {
- // Check if other handling is necessary?
- return true;
+ if (foundManagerStubIterator != managerStubs_.end()) {
+ if (std::get<0>(foundManagerStubIterator->second)->unexportManagedDBusStubAdapter(
+ dbusStubAdapter)) {
+ // Check if other handling is necessary?
+ return true;
+ }
}
return false;
}
@@ -205,8 +207,10 @@ bool DBusObjectManager::addDBusInterfaceHandler(const DBusInterfaceHandlerPath&
const bool isDBusInterfaceHandlerAlreadyAdded = (dbusRegisteredObjectsTableIter != dbusRegisteredObjectsTable_.end());
if (isDBusInterfaceHandlerAlreadyAdded) {
- //If another ObjectManager is to be registered, you can go on and just use the first one.
- if (dbusInterfaceHandlerPath.second == "org.freedesktop.DBus.ObjectManager") {
+ //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;
@@ -226,7 +230,7 @@ bool DBusObjectManager::removeDBusInterfaceHandler(const DBusInterfaceHandlerPat
if (isDBusInterfaceHandlerAdded) {
auto registeredDBusStubAdapter = dbusRegisteredObjectsTableIter->second;
assert(registeredDBusStubAdapter == dbusInterfaceHandler);
-
+ (void)dbusInterfaceHandler;
dbusRegisteredObjectsTable_.erase(dbusRegisteredObjectsTableIter);
}
diff --git a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
index e292473..7516994 100644
--- a/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
+++ b/src/CommonAPI/DBus/DBusObjectManagerStub.cpp
@@ -30,7 +30,7 @@ DBusObjectManagerStub::~DBusObjectManagerStub() {
for (auto& dbusInterfaceIterator : registeredDBusInterfacesMap) {
auto managedDBusStubAdapter = dbusInterfaceIterator.second;
auto managedDBusStubAdapterServiceAddress = managedDBusStubAdapter->getDBusAddress();
-#ifdef LB_TODO
+#ifdef COMMONAPI_TODO
const bool isServiceUnregistered = DBusServicePublisher::getInstance()->unregisterManagedService(
managedDBusStubAdapterServiceAddress);
assert(isServiceUnregistered);
@@ -284,7 +284,7 @@ bool DBusObjectManagerStub::onInterfaceDBusMessage(const DBusMessage& dbusMessag
}
-const bool DBusObjectManagerStub::hasFreedesktopProperties() {
+bool DBusObjectManagerStub::hasFreedesktopProperties() {
return false;
}
diff --git a/src/CommonAPI/DBus/DBusOutputStream.cpp b/src/CommonAPI/DBus/DBusOutputStream.cpp
index 7d59360..728c017 100644
--- a/src/CommonAPI/DBus/DBusOutputStream.cpp
+++ b/src/CommonAPI/DBus/DBusOutputStream.cpp
@@ -16,22 +16,22 @@ namespace CommonAPI {
namespace DBus {
DBusOutputStream::DBusOutputStream(DBusMessage dbusMessage)
- : dbusMessage_(dbusMessage) {
+ : dbusMessage_(dbusMessage) {
}
// Internal
size_t DBusOutputStream::getPosition() {
- return payload_.size();
+ return payload_.size();
}
void DBusOutputStream::pushPosition() {
- positions_.push(payload_.size());
+ positions_.push(payload_.size());
}
size_t DBusOutputStream::popPosition() {
- size_t itsPosition = positions_.top();
- positions_.pop();
- return itsPosition;
+ size_t itsPosition = positions_.top();
+ positions_.pop();
+ return itsPosition;
}
// TODO Check where dbusError_ is set
@@ -45,8 +45,8 @@ bool DBusOutputStream::hasError() const {
// #DBusMessage. The data that is buffered in this #DBusOutputMessageStream
// is not deleted by calling flush().
void DBusOutputStream::flush() {
- const int toWrite = payload_.size();
- dbusMessage_.setBodyLength(toWrite);
+ const std::string::size_type toWrite = payload_.size();
+ dbusMessage_.setBodyLength(static_cast<int>(toWrite));
char* destinationDataPtr = dbusMessage_.getBodyData();
memcpy(destinationDataPtr, payload_.c_str(), toWrite);
}
@@ -63,7 +63,7 @@ void DBusOutputStream::setError() {
* @param numOfBytes The number of bytes that should be reserved for writing.
*/
void DBusOutputStream::reserveMemory(size_t numOfBytes) {
- assert(numOfBytes >= 0);
+ assert(numOfBytes > 0);
payload_.reserve(numOfBytes);
}
@@ -82,7 +82,7 @@ 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));
+ (_boundary % 2 == 0 || _boundary == 1));
size_t mask = _boundary - 1;
size_t necessary = ((mask - (payload_.size() & mask)) + 1) & mask;
diff --git a/src/CommonAPI/DBus/DBusProxy.cpp b/src/CommonAPI/DBus/DBusProxy.cpp
index 1de88fc..19f2eb0 100644
--- a/src/CommonAPI/DBus/DBusProxy.cpp
+++ b/src/CommonAPI/DBus/DBusProxy.cpp
@@ -16,12 +16,13 @@ namespace CommonAPI {
namespace DBus {
DBusProxyStatusEvent::DBusProxyStatusEvent(DBusProxy *_dbusProxy)
- : dbusProxy_(_dbusProxy) {
+ : dbusProxy_(_dbusProxy) {
}
-void DBusProxyStatusEvent::onListenerAdded(const Listener& listener, const Subscription subscription) {
+void DBusProxyStatusEvent::onListenerAdded(const Listener &_listener, const Subscription _subscription) {
+ (void)_subscription;
if (dbusProxy_->isAvailable())
- listener(AvailabilityStatus::AVAILABLE);
+ _listener(AvailabilityStatus::AVAILABLE);
}
DBusProxy::DBusProxy(const DBusAddress &_dbusAddress,
@@ -31,7 +32,7 @@ DBusProxy::DBusProxy(const DBusAddress &_dbusAddress,
availabilityStatus_(AvailabilityStatus::UNKNOWN),
interfaceVersionAttribute_(*this, "uu", "getInterfaceVersion"),
dbusServiceRegistry_(DBusServiceRegistry::get(_connection)),
- signalMemberHandlerInfo_(3000)
+ signalMemberHandlerInfo_(3000)
{
}
@@ -73,80 +74,85 @@ InterfaceVersionAttribute& DBusProxy::getInterfaceVersionAttribute() {
return interfaceVersionAttribute_;
}
-void DBusProxy::signalMemberCallback(const CallStatus dbusMessageCallStatus,
- const DBusMessage& dbusMessage,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const uint32_t tag) {
- dbusSignalHandler->onSignalDBusMessage(dbusMessage);
+void DBusProxy::signalMemberCallback(const CallStatus _status,
+ const DBusMessage& dbusMessage,
+ DBusProxyConnection::DBusSignalHandler *_handler,
+ const uint32_t _tag) {
+ (void)_status;
+ (void)_tag;
+ _handler->onSignalDBusMessage(dbusMessage);
}
-void DBusProxy::signalInitialValueCallback(const CallStatus dbusMessageCallStatus,
- const DBusMessage& dbusMessage,
- DBusProxyConnection::DBusSignalHandler* dbusSignalHandler,
- const uint32_t tag) {
- dbusSignalHandler->onInitialValueSignalDBusMessage(dbusMessage, tag);
+void DBusProxy::signalInitialValueCallback(const CallStatus _status,
+ const DBusMessage &_message,
+ DBusProxyConnection::DBusSignalHandler *_handler,
+ const uint32_t _tag) {
+ (void)_status;
+ _handler->onInitialValueSignalDBusMessage(_message, _tag);
}
void DBusProxy::onDBusServiceInstanceStatus(const AvailabilityStatus& availabilityStatus) {
- if (availabilityStatus != availabilityStatus_) {
- availabilityStatusMutex_.lock();
- availabilityStatus_ = availabilityStatus;
- availabilityStatusMutex_.unlock();
-
- dbusProxyStatusEvent_.notifyListeners(availabilityStatus);
-
- if (availabilityStatus == AvailabilityStatus::AVAILABLE) {
- std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
-
- for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
- signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
- signalMemberHandlerIterator++) {
-
- if (!std::get<7>(*signalMemberHandlerIterator)) {
- connection_->addSignalMemberHandler(
- std::get<0>(*signalMemberHandlerIterator),
- std::get<1>(*signalMemberHandlerIterator),
- std::get<2>(*signalMemberHandlerIterator),
- std::get<3>(*signalMemberHandlerIterator),
- std::get<5>(*signalMemberHandlerIterator),
- std::get<6>(*signalMemberHandlerIterator));
- std::get<7>(*signalMemberHandlerIterator) = true;
-
- DBusMessage message = createMethodCall(std::get<4>(*signalMemberHandlerIterator), "");
-
- DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(
- &DBusProxy::signalMemberCallback,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3,
- std::placeholders::_4);
- connection_->sendDBusMessageWithReplyAsync(
- message,
- DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, std::get<5>(*signalMemberHandlerIterator), 0),
- &signalMemberHandlerInfo_);
- }
- }
- } else {
- std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
-
- for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
- signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
- signalMemberHandlerIterator++) {
-
- if (std::get<7>(*signalMemberHandlerIterator)) {
- DBusProxyConnection::DBusSignalHandlerToken signalHandlerToken (
- std::get<0>(*signalMemberHandlerIterator),
- std::get<1>(*signalMemberHandlerIterator),
- std::get<2>(*signalMemberHandlerIterator),
- std::get<3>(*signalMemberHandlerIterator));
- connection_->removeSignalMemberHandler(signalHandlerToken, std::get<5>(*signalMemberHandlerIterator));
- std::get<7>(*signalMemberHandlerIterator) = false;
- }
- }
- }
- }
+ if (availabilityStatus != availabilityStatus_) {
+ availabilityStatusMutex_.lock();
+ availabilityStatus_ = availabilityStatus;
+ availabilityStatusMutex_.unlock();
+
+ dbusProxyStatusEvent_.notifyListeners(availabilityStatus);
+
+ if (availabilityStatus == AvailabilityStatus::AVAILABLE) {
+ std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
+
+ for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
+ signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
+ signalMemberHandlerIterator++) {
+
+ if (!std::get<7>(*signalMemberHandlerIterator)) {
+ connection_->addSignalMemberHandler(
+ std::get<0>(*signalMemberHandlerIterator),
+ std::get<1>(*signalMemberHandlerIterator),
+ std::get<2>(*signalMemberHandlerIterator),
+ std::get<3>(*signalMemberHandlerIterator),
+ std::get<5>(*signalMemberHandlerIterator),
+ std::get<6>(*signalMemberHandlerIterator));
+ std::get<7>(*signalMemberHandlerIterator) = true;
+
+ DBusMessage message = createMethodCall(std::get<4>(*signalMemberHandlerIterator), "");
+
+ DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(
+ &DBusProxy::signalMemberCallback,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3,
+ std::placeholders::_4);
+ connection_->sendDBusMessageWithReplyAsync(
+ message,
+ DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, std::get<5>(*signalMemberHandlerIterator), 0),
+ &signalMemberHandlerInfo_);
+ }
+ }
+ } else {
+ std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
+
+ for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
+ signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
+ signalMemberHandlerIterator++) {
+
+ if (std::get<7>(*signalMemberHandlerIterator)) {
+ DBusProxyConnection::DBusSignalHandlerToken signalHandlerToken (
+ std::get<0>(*signalMemberHandlerIterator),
+ std::get<1>(*signalMemberHandlerIterator),
+ std::get<2>(*signalMemberHandlerIterator),
+ std::get<3>(*signalMemberHandlerIterator));
+ connection_->removeSignalMemberHandler(signalHandlerToken, std::get<5>(*signalMemberHandlerIterator));
+ std::get<7>(*signalMemberHandlerIterator) = false;
+ }
+ }
+ }
+ }
+ availabilityStatusMutex_.lock();
availabilityCondition_.notify_one();
+ availabilityStatusMutex_.unlock();
}
DBusProxyConnection::DBusSignalHandlerToken DBusProxy::subscribeForSelectiveBroadcastOnConnection(
@@ -194,101 +200,101 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxy::addSignalMemberHandler(
const std::string &interfaceName,
const std::string &signalName,
const std::string &signalSignature,
- const std::string &getMethodName,
+ const std::string &getMethodName,
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
const bool justAddFilter) {
- DBusProxyConnection::DBusSignalHandlerToken signalHandlerToken (
- objectPath,
- interfaceName,
- signalName,
- signalSignature);
-
- if (getMethodName != "") {
-
- SignalMemberHandlerTuple signalMemberHandler(
- objectPath,
- interfaceName,
- signalName,
- signalSignature,
- getMethodName,
- dbusSignalHandler,
- justAddFilter,
- false);
-
- availabilityStatusMutex_.lock();
- if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
- availabilityStatusMutex_.unlock();
- signalHandlerToken = connection_->addSignalMemberHandler(
- objectPath,
- interfaceName,
- signalName,
- signalSignature,
- dbusSignalHandler,
- justAddFilter);
- std::get<7>(signalMemberHandler) = true;
- } else {
- availabilityStatusMutex_.unlock();
- }
- addSignalMemberHandlerToQueue(signalMemberHandler);
- } else {
- signalHandlerToken = connection_->addSignalMemberHandler(
- objectPath,
- interfaceName,
- signalName,
- signalSignature,
- dbusSignalHandler,
- justAddFilter);
- }
+ DBusProxyConnection::DBusSignalHandlerToken signalHandlerToken (
+ objectPath,
+ interfaceName,
+ signalName,
+ signalSignature);
+
+ if (getMethodName != "") {
+
+ SignalMemberHandlerTuple signalMemberHandler(
+ objectPath,
+ interfaceName,
+ signalName,
+ signalSignature,
+ getMethodName,
+ dbusSignalHandler,
+ justAddFilter,
+ false);
+
+ availabilityStatusMutex_.lock();
+ if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
+ availabilityStatusMutex_.unlock();
+ signalHandlerToken = connection_->addSignalMemberHandler(
+ objectPath,
+ interfaceName,
+ signalName,
+ signalSignature,
+ dbusSignalHandler,
+ justAddFilter);
+ std::get<7>(signalMemberHandler) = true;
+ } else {
+ availabilityStatusMutex_.unlock();
+ }
+ addSignalMemberHandlerToQueue(signalMemberHandler);
+ } else {
+ signalHandlerToken = connection_->addSignalMemberHandler(
+ objectPath,
+ interfaceName,
+ signalName,
+ signalSignature,
+ dbusSignalHandler,
+ justAddFilter);
+ }
return signalHandlerToken;
}
void DBusProxy::addSignalMemberHandlerToQueue(SignalMemberHandlerTuple& _signalMemberHandler) {
- std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
- bool found = false;
-
- for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
- signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
- signalMemberHandlerIterator++) {
-
- if ( (std::get<0>(*signalMemberHandlerIterator) == std::get<0>(_signalMemberHandler)) &&
- (std::get<1>(*signalMemberHandlerIterator) == std::get<1>(_signalMemberHandler)) &&
- (std::get<2>(*signalMemberHandlerIterator) == std::get<2>(_signalMemberHandler)) &&
- (std::get<3>(*signalMemberHandlerIterator) == std::get<3>(_signalMemberHandler))) {
-
- found = true;
- break;
- }
- }
- if (!found) {
- signalMemberHandlerQueue_.push_back(_signalMemberHandler);
- }
+ std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
+ bool found = false;
+
+ for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
+ signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
+ signalMemberHandlerIterator++) {
+
+ if ( (std::get<0>(*signalMemberHandlerIterator) == std::get<0>(_signalMemberHandler)) &&
+ (std::get<1>(*signalMemberHandlerIterator) == std::get<1>(_signalMemberHandler)) &&
+ (std::get<2>(*signalMemberHandlerIterator) == std::get<2>(_signalMemberHandler)) &&
+ (std::get<3>(*signalMemberHandlerIterator) == std::get<3>(_signalMemberHandler))) {
+
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ signalMemberHandlerQueue_.push_back(_signalMemberHandler);
+ }
}
bool DBusProxy::removeSignalMemberHandler(
- const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
- const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler) {
-
- {
- std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
- for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
- signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
- signalMemberHandlerIterator++) {
-
- if ( (std::get<0>(*signalMemberHandlerIterator) == std::get<0>(_dbusSignalHandlerToken)) &&
- (std::get<1>(*signalMemberHandlerIterator) == std::get<1>(_dbusSignalHandlerToken)) &&
- (std::get<2>(*signalMemberHandlerIterator) == std::get<2>(_dbusSignalHandlerToken)) &&
- (std::get<3>(*signalMemberHandlerIterator) == std::get<3>(_dbusSignalHandlerToken))) {
- signalMemberHandlerIterator = signalMemberHandlerQueue_.erase(signalMemberHandlerIterator);
-
- if (signalMemberHandlerIterator == signalMemberHandlerQueue_.end()) {
- break;
- }
- }
- }
- }
+ const DBusProxyConnection::DBusSignalHandlerToken &_dbusSignalHandlerToken,
+ const DBusProxyConnection::DBusSignalHandler *_dbusSignalHandler) {
+
+ {
+ std::lock_guard < std::mutex > queueLock(signalMemberHandlerQueueMutex_);
+ for(auto signalMemberHandlerIterator = signalMemberHandlerQueue_.begin();
+ signalMemberHandlerIterator != signalMemberHandlerQueue_.end();
+ signalMemberHandlerIterator++) {
+
+ if ( (std::get<0>(*signalMemberHandlerIterator) == std::get<0>(_dbusSignalHandlerToken)) &&
+ (std::get<1>(*signalMemberHandlerIterator) == std::get<1>(_dbusSignalHandlerToken)) &&
+ (std::get<2>(*signalMemberHandlerIterator) == std::get<2>(_dbusSignalHandlerToken)) &&
+ (std::get<3>(*signalMemberHandlerIterator) == std::get<3>(_dbusSignalHandlerToken))) {
+ signalMemberHandlerIterator = signalMemberHandlerQueue_.erase(signalMemberHandlerIterator);
+
+ if (signalMemberHandlerIterator == signalMemberHandlerQueue_.end()) {
+ break;
+ }
+ }
+ }
+ }
return connection_->removeSignalMemberHandler(_dbusSignalHandlerToken, _dbusSignalHandler);
}
@@ -296,28 +302,64 @@ bool DBusProxy::removeSignalMemberHandler(
void DBusProxy::getCurrentValueForSignalListener(
const std::string &getMethodName,
DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
- const uint32_t subscription) {
-
- availabilityStatusMutex_.lock();
- if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
- availabilityStatusMutex_.unlock();
-
- DBusMessage message = createMethodCall(getMethodName, "");
-
- DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
- this,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3,
- std::placeholders::_4);
- connection_->sendDBusMessageWithReplyAsync(
- message,
- DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, dbusSignalHandler, subscription),
- &signalMemberHandlerInfo_);
- } else {
- availabilityStatusMutex_.unlock();
- }
+ const uint32_t subscription) {
+
+ availabilityStatusMutex_.lock();
+ if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
+ availabilityStatusMutex_.unlock();
+
+ DBusMessage message = createMethodCall(getMethodName, "");
+
+ DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3,
+ std::placeholders::_4);
+ connection_->sendDBusMessageWithReplyAsync(
+ message,
+ DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, dbusSignalHandler, subscription),
+ &signalMemberHandlerInfo_);
+ } else {
+ availabilityStatusMutex_.unlock();
+ }
+}
+
+void DBusProxy::freeDesktopGetCurrentValueForSignalListener(
+ DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
+ const uint32_t subscription,
+ const std::string &interfaceName,
+ const std::string &propertyName) {
+
+ availabilityStatusMutex_.lock();
+ if (availabilityStatus_ == AvailabilityStatus::AVAILABLE) {
+ availabilityStatusMutex_.unlock();
+
+ DBusAddress itsAddress(getDBusAddress());
+ itsAddress.setInterface("org.freedesktop.DBus.Properties");
+ DBusMessage _message = DBusMessage::createMethodCall(itsAddress, "Get", "ss");
+ DBusOutputStream output(_message);
+ const bool success = DBusSerializableArguments<const std::string, const std::string>
+ ::serialize(output, interfaceName, propertyName);
+ if (success) {
+ output.flush();
+ DBusProxyAsyncSignalMemberCallbackHandler::FunctionType myFunc = std::bind(&DBusProxy::signalInitialValueCallback,
+ this,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3,
+ std::placeholders::_4);
+
+ connection_->sendDBusMessageWithReplyAsync(
+ _message,
+ DBusProxyAsyncSignalMemberCallbackHandler::create(myFunc, dbusSignalHandler, subscription),
+ &signalMemberHandlerInfo_);
+ }
+ } else {
+ availabilityStatusMutex_.unlock();
+ }
}
+
} // namespace DBus
} // namespace CommonAPI
diff --git a/src/CommonAPI/DBus/DBusProxyBase.cpp b/src/CommonAPI/DBus/DBusProxyBase.cpp
index ae8faac..0b1ebe4 100644
--- a/src/CommonAPI/DBus/DBusProxyBase.cpp
+++ b/src/CommonAPI/DBus/DBusProxyBase.cpp
@@ -12,11 +12,11 @@ namespace CommonAPI {
namespace DBus {
DBusProxyBase::DBusProxyBase(
- const DBusAddress &_dbusAddress,
- const std::shared_ptr<DBusProxyConnection> &_connection)
- : dbusAddress_(_dbusAddress),
- connection_(_connection) {
- DBusAddressTranslator::get()->translate(dbusAddress_, address_);
+ const DBusAddress &_dbusAddress,
+ const std::shared_ptr<DBusProxyConnection> &_connection)
+ : dbusAddress_(_dbusAddress),
+ connection_(_connection) {
+ DBusAddressTranslator::get()->translate(dbusAddress_, address_);
}
DBusMessage
@@ -27,7 +27,7 @@ DBusProxyBase::createMethodCall(const std::string &_method, const std::string &_
const DBusAddress &
DBusProxyBase::getDBusAddress() const {
- return dbusAddress_;
+ return dbusAddress_;
}
const std::shared_ptr<DBusProxyConnection> &
@@ -52,20 +52,21 @@ DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandle
}
DBusProxyConnection::DBusSignalHandlerToken DBusProxyBase::addSignalMemberHandler(
- const std::string &objectPath,
- const std::string &interfaceName,
- const std::string &signalName,
- const std::string &signalSignature,
- const std::string &getMethodName,
- DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
- const bool justAddFilter) {
+ const std::string &objectPath,
+ const std::string &interfaceName,
+ const std::string &signalName,
+ const std::string &signalSignature,
+ const std::string &getMethodName,
+ DBusProxyConnection::DBusSignalHandler *dbusSignalHandler,
+ const bool justAddFilter) {
+ (void)getMethodName;
return addSignalMemberHandler(
- objectPath,
- interfaceName,
- signalName,
- signalSignature,
- dbusSignalHandler,
- justAddFilter);
+ objectPath,
+ interfaceName,
+ signalName,
+ signalSignature,
+ dbusSignalHandler,
+ justAddFilter);
}
bool DBusProxyBase::removeSignalMemberHandler(const DBusProxyConnection::DBusSignalHandlerToken& _dbusSignalHandlerToken, const DBusProxyConnection::DBusSignalHandler* _dbusSignalHandler) {
diff --git a/src/CommonAPI/DBus/DBusProxyManager.cpp b/src/CommonAPI/DBus/DBusProxyManager.cpp
index 5a69083..6a48994 100644
--- a/src/CommonAPI/DBus/DBusProxyManager.cpp
+++ b/src/CommonAPI/DBus/DBusProxyManager.cpp
@@ -11,9 +11,9 @@ namespace CommonAPI {
namespace DBus {
DBusProxyManager::DBusProxyManager(
- DBusProxy &_proxy,
+ DBusProxy &_proxy,
const std::string &_interfaceId)
- : proxy_(_proxy),
+ : proxy_(_proxy),
instanceAvailabilityStatusEvent_(_proxy, _interfaceId),
interfaceId_(_interfaceId),
registry_(DBusServiceRegistry::get(_proxy.getDBusConnection()))
@@ -22,23 +22,23 @@ DBusProxyManager::DBusProxyManager(
const std::string &
DBusProxyManager::getDomain() const {
- static std::string domain("local");
- return domain;
+ static std::string domain("local");
+ return domain;
}
const std::string &
DBusProxyManager::getInterface() const {
- return interfaceId_;
+ return interfaceId_;
}
const ConnectionId_t &
DBusProxyManager::getConnectionId() const {
- return connectionId_;
+ return connectionId_;
}
void
DBusProxyManager::instancesAsyncCallback(
- const CommonAPI::CallStatus &_status,
+ const CommonAPI::CallStatus &_status,
const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
GetAvailableInstancesCallback &_call) {
std::vector<std::string> result;
@@ -50,20 +50,20 @@ DBusProxyManager::instancesAsyncCallback(
void
DBusProxyManager::getAvailableInstances(
- CommonAPI::CallStatus &_status,
- std::vector<std::string> &_availableInstances) {
+ CommonAPI::CallStatus &_status,
+ std::vector<std::string> &_availableInstances) {
DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dict;
DBusProxyHelper<
- DBusSerializableArguments<>,
+ DBusSerializableArguments<>,
DBusSerializableArguments<
- DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
- >
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
+ >
>::callMethodWithReply(proxy_,
DBusObjectManagerStub::getInterfaceName(),
"GetManagedObjects",
"",
- &defaultCallInfo,
+ &defaultCallInfo,
_status,
dict);
@@ -74,44 +74,44 @@ DBusProxyManager::getAvailableInstances(
std::future<CallStatus>
DBusProxyManager::getAvailableInstancesAsync(
- GetAvailableInstancesCallback _callback) {
+ GetAvailableInstancesCallback _callback) {
return CommonAPI::DBus::DBusProxyHelper<
- CommonAPI::DBus::DBusSerializableArguments<>,
- CommonAPI::DBus::DBusSerializableArguments<
- DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
- >
- >::callMethodAsync(
- proxy_,
- DBusObjectManagerStub::getInterfaceName(),
- "GetManagedObjects",
- "a{oa{sa{sv}}}",
- &defaultCallInfo,
- std::move(
- std::bind(
- &DBusProxyManager::instancesAsyncCallback,
- this,
- std::placeholders::_1, std::placeholders::_2,
- _callback
- )
- ),
- std::tuple<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict>());
+ CommonAPI::DBus::DBusSerializableArguments<>,
+ CommonAPI::DBus::DBusSerializableArguments<
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
+ >
+ >::callMethodAsync(
+ proxy_,
+ DBusObjectManagerStub::getInterfaceName(),
+ "GetManagedObjects",
+ "",
+ &defaultCallInfo,
+ std::move(
+ std::bind(
+ &DBusProxyManager::instancesAsyncCallback,
+ this,
+ std::placeholders::_1, std::placeholders::_2,
+ _callback
+ )
+ ),
+ std::tuple<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict>());
}
void
DBusProxyManager::getInstanceAvailabilityStatus(
- const std::string &_address,
- CallStatus &_callStatus,
- AvailabilityStatus &_availabilityStatus) {
+ const std::string &_address,
+ CallStatus &_callStatus,
+ AvailabilityStatus &_availabilityStatus) {
- CommonAPI::Address itsAddress("local", interfaceId_, _address);
- DBusAddress itsDBusAddress;
- DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
+ CommonAPI::Address itsAddress("local", interfaceId_, _address);
+ DBusAddress itsDBusAddress;
+ DBusAddressTranslator::get()->translate(itsAddress, itsDBusAddress);
- _availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
+ _availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
if (registry_->isServiceInstanceAlive(
- itsDBusAddress.getInterface(),
- itsDBusAddress.getService(),
- itsDBusAddress.getObjectPath())) {
+ itsDBusAddress.getInterface(),
+ itsDBusAddress.getService(),
+ itsDBusAddress.getObjectPath())) {
_availabilityStatus = AvailabilityStatus::AVAILABLE;
}
_callStatus = CallStatus::SUCCESS;
@@ -119,19 +119,19 @@ DBusProxyManager::getInstanceAvailabilityStatus(
void
DBusProxyManager::instanceAliveAsyncCallback(
- const AvailabilityStatus &_alive,
- GetInstanceAvailabilityStatusCallback &_call,
- std::shared_ptr<std::promise<CallStatus> > &_status) {
+ const AvailabilityStatus &_alive,
+ GetInstanceAvailabilityStatusCallback &_call,
+ std::shared_ptr<std::promise<CallStatus> > &_status) {
_call(CallStatus::SUCCESS, _alive);
_status->set_value(CallStatus::SUCCESS);
}
std::future<CallStatus>
DBusProxyManager::getInstanceAvailabilityStatusAsync(
- const std::string &_instance,
+ const std::string &_instance,
GetInstanceAvailabilityStatusCallback _callback) {
- CommonAPI::Address itsAddress("local", interfaceId_, _instance);
+ CommonAPI::Address itsAddress("local", interfaceId_, _instance);
std::shared_ptr<std::promise<CallStatus> > promise = std::make_shared<std::promise<CallStatus>>();
registry_->subscribeAvailabilityListener(
@@ -153,22 +153,24 @@ DBusProxyManager::getInstanceAvailabilityStatusChangedEvent() {
void
DBusProxyManager::translateCommonApiAddresses(
- const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
- std::vector<std::string> &_instances) {
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict &_dict,
+ std::vector<std::string> &_instances) {
- CommonAPI::Address itsAddress;
- DBusAddress itsDBusAddress;
+ CommonAPI::Address itsAddress;
+ DBusAddress itsDBusAddress;
for (const auto &objectPathIter : _dict) {
itsDBusAddress.setObjectPath(objectPathIter.first);
const auto &interfacesDict = objectPathIter.second;
for (const auto &interfaceIter : interfacesDict) {
- itsDBusAddress.setInterface(interfaceIter.first);
-
- DBusAddressTranslator::get()->translate(itsDBusAddress, itsAddress);
- _instances.push_back(itsAddress.getInstance());
+ // return only those addresses whose interface matches with ours
+ if (interfaceIter.first == interfaceId_) {
+ itsDBusAddress.setInterface(interfaceIter.first);
+ DBusAddressTranslator::get()->translate(itsDBusAddress, itsAddress);
+ _instances.push_back(itsAddress.getInstance());
+ }
}
}
}
diff --git a/src/CommonAPI/DBus/DBusServiceRegistry.cpp b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
index f18ff44..55e0239 100644
--- a/src/CommonAPI/DBus/DBusServiceRegistry.cpp
+++ b/src/CommonAPI/DBus/DBusServiceRegistry.cpp
@@ -23,18 +23,18 @@ static CommonAPI::CallInfo serviceRegistryInfo(10000);
std::shared_ptr<DBusServiceRegistry>
DBusServiceRegistry::get(std::shared_ptr<DBusProxyConnection> _connection) {
- std::lock_guard<std::mutex> itsGuard(registriesMutex_);
- auto registryIterator = registries_.find(_connection);
- if (registryIterator != registries_.end())
- return registryIterator->second;
-
- std::shared_ptr<DBusServiceRegistry> registry
- = std::make_shared<DBusServiceRegistry>(_connection);
- if (registry) {
- registry->init();
- registries_.insert( { _connection, registry } );
- }
- return registry;
+ std::lock_guard<std::mutex> itsGuard(registriesMutex_);
+ auto registryIterator = registries_.find(_connection);
+ if (registryIterator != registries_.end())
+ return registryIterator->second;
+
+ std::shared_ptr<DBusServiceRegistry> registry
+ = std::make_shared<DBusServiceRegistry>(_connection);
+ if (registry) {
+ registry->init();
+ registries_.insert( { _connection, registry } );
+ }
+ return registry;
}
DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> dbusProxyConnection) :
@@ -46,11 +46,11 @@ DBusServiceRegistry::DBusServiceRegistry(std::shared_ptr<DBusProxyConnection> db
}
DBusServiceRegistry::~DBusServiceRegistry() {
- if (!initialized_) {
- return;
- }
+ if (!initialized_) {
+ return;
+ }
- dbusDaemonProxy_->getNameOwnerChangedEvent().unsubscribe(dbusDaemonProxyNameOwnerChangedEventSubscription_);
+ dbusDaemonProxy_->getNameOwnerChangedEvent().unsubscribe(dbusDaemonProxyNameOwnerChangedEventSubscription_);
dbusDaemonProxy_->getProxyStatusEvent().unsubscribe(dbusDaemonProxyStatusEventSubscription_);
// notify only listeners of resolved services (online > offline)
@@ -71,11 +71,12 @@ DBusServiceRegistry::~DBusServiceRegistry() {
dbusServiceUniqueName,
this);
assert(isSubscriptionCancelled);
+ (void)isSubscriptionCancelled;
}
}
void DBusServiceRegistry::init() {
- translator_ = DBusAddressTranslator::get();
+ translator_ = DBusAddressTranslator::get();
dbusDaemonProxyStatusEventSubscription_ =
dbusDaemonProxy_->getProxyStatusEvent().subscribe(
@@ -96,13 +97,13 @@ void DBusServiceRegistry::init() {
DBusServiceRegistry::DBusServiceSubscription
DBusServiceRegistry::subscribeAvailabilityListener(
- const std::string &_address, DBusServiceListener serviceListener) {
- DBusAddress dbusAddress;
- translator_->translate(_address, dbusAddress);
+ const std::string &_address, DBusServiceListener serviceListener) {
+ DBusAddress dbusAddress;
+ translator_->translate(_address, dbusAddress);
if (notificationThread_ == std::this_thread::get_id()) {
- COMMONAPI_ERROR(
- "You must not build proxies in callbacks of ProxyStatusEvent.",
+ COMMONAPI_ERROR(
+ "You must not build proxies in callbacks of ProxyStatusEvent.",
" Please refer to the documentation for suggestions how to avoid this.");
assert(false);
}
@@ -124,7 +125,7 @@ DBusServiceRegistry::subscribeAvailabilityListener(
} else if (dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::NOT_AVAILABLE) {
availabilityStatus = AvailabilityStatus::NOT_AVAILABLE;
} else if (dbusServiceListenersRecord.uniqueBusNameState != DBusRecordState::RESOLVING &&
- dbusInterfaceNameListenersRecord.state == DBusRecordState::UNKNOWN) {
+ dbusInterfaceNameListenersRecord.state == DBusRecordState::UNKNOWN) {
dbusInterfaceNameListenersRecord.state = resolveDBusInterfaceNameState(dbusAddress, dbusServiceListenersRecord);
}
@@ -156,9 +157,9 @@ DBusServiceRegistry::subscribeAvailabilityListener(
void
DBusServiceRegistry::unsubscribeAvailabilityListener(
- const std::string &_address, DBusServiceSubscription& listenerSubscription) {
- DBusAddress dbusAddress;
- translator_->translate(_address, dbusAddress);
+ const std::string &_address, DBusServiceSubscription& listenerSubscription) {
+ DBusAddress dbusAddress;
+ translator_->translate(_address, dbusAddress);
std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
auto dbusServiceListenersIterator = dbusServiceListenersMap.find(dbusAddress.getService());
@@ -277,11 +278,24 @@ bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfac
if(dbusObjectPathCacheIterator != dbusObjectPathsCache.end()) {
dbusObjectPathCache = &(dbusObjectPathCacheIterator->second);
+ if (dbusObjectPathCache->state != DBusRecordState::RESOLVED) {
+ dbusObjectPathCache->state = DBusRecordState::RESOLVING;
+ dbusServicesMutex_.lock();
+
+ dbusObjectPathCache = &(dbusObjectPathCacheIterator->second);
+
+ std::future<DBusRecordState> futureObjectPathResolved = dbusObjectPathCache->promiseOnResolve.get_future();
+ dbusServicesMutex_.unlock();
+
+ introspectDBusObjectPath(uniqueName, dbusObjectPath);
+ futureObjectPathResolved.wait_for(timeout);
+ }
}
else {
// try to resolve object paths
DBusObjectPathCache newDbusObjectPathCache;
newDbusObjectPathCache.state = DBusRecordState::RESOLVING;
+ newDbusObjectPathCache.serviceName = dbusServiceName;
dbusServicesMutex_.lock();
@@ -314,11 +328,11 @@ bool DBusServiceRegistry::isServiceInstanceAlive(const std::string& dbusInterfac
}
void DBusServiceRegistry::fetchAllServiceNames() {
- if (!dbusDaemonProxy_->isAvailable()) {
+ if (!dbusDaemonProxy_->isAvailable()) {
return;
}
- CallStatus callStatus;
+ CallStatus callStatus;
std::vector<std::string> availableServiceNames;
dbusDaemonProxy_->listNames(callStatus, availableServiceNames);
@@ -335,6 +349,7 @@ void DBusServiceRegistry::fetchAllServiceNames() {
// d-feet mode
std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const std::string& interfaceName,
const std::string& domainName) {
+ (void)domainName;
std::vector<std::string> availableServiceInstances;
// resolve all service names
@@ -412,7 +427,7 @@ std::vector<std::string> DBusServiceRegistry::getAvailableServiceInstances(const
!= dbusObjectPathCacheIterator->second.dbusInterfaceNamesCache.end()) {
std::string commonApiAddress;
translator_->translate(
- dbusObjectPathCacheIterator->first + "/" + interfaceName + "/" + serviceName, commonApiAddress);
+ dbusObjectPathCacheIterator->first + "/" + interfaceName + "/" + serviceName, commonApiAddress);
availableServiceInstances.push_back(commonApiAddress);
}
}
@@ -432,6 +447,7 @@ void DBusServiceRegistry::getAvailableServiceInstancesAsync(CommonAPI::Factory::
//shall return without delay.
std::thread(
[this, _cbk, _interface, _domain](std::shared_ptr<DBusServiceRegistry> selfRef) {
+ (void)selfRef;
auto instances = getAvailableServiceInstances(_interface, _domain);
_cbk(instances);
}, this->shared_from_this()
@@ -491,30 +507,38 @@ void DBusServiceRegistry::onSignalDBusMessage(const DBusMessage &_dbusMessage) {
const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
if (!isDBusServiceUniqueNameFound) {
- // LB TODO: unsubscribe here!
- // Needs to be reworked in order to store the subscription identifier!
+ // LB TODO: unsubscribe here!
+ // Needs to be reworked in order to store the subscription identifier!
return;
}
auto& dbusUniqueNameRecord = dbusServiceUniqueNameIterator->second;
- DBusObjectPathCache& dbusObjectPathRecord = dbusUniqueNameRecord.dbusObjectPathsCache[dbusObjectPath];
+ DBusObjectPathCache *dbusObjectPathRecord;
+ auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
+ if(dbusObjectPathCacheIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end())
+ dbusObjectPathRecord = &(dbusObjectPathCacheIterator->second);
+ else
+ return;
- if (dbusObjectPathRecord.state != DBusRecordState::RESOLVED) {
+ if (dbusObjectPathRecord->state != DBusRecordState::RESOLVED) {
return;
}
for (const auto& dbusInterfaceName : dbusInterfaceNames) {
if (dbusInterfaceNameState == DBusRecordState::AVAILABLE) {
- dbusObjectPathRecord.dbusInterfaceNamesCache.insert(dbusInterfaceName);
+ dbusObjectPathRecord->dbusInterfaceNamesCache.insert(dbusInterfaceName);
} else {
- dbusObjectPathRecord.dbusInterfaceNamesCache.erase(dbusInterfaceName);
+ dbusObjectPathRecord->dbusInterfaceNamesCache.erase(dbusInterfaceName);
}
}
notifyDBusServiceListeners(dbusUniqueNameRecord, dbusObjectPath, dbusInterfaceNames, dbusInterfaceNameState);
}
+void DBusServiceRegistry::setDBusServicePredefined(const std::string& _serviceName) {
+ dbusPredefinedServices_.insert(_serviceName);
+}
void DBusServiceRegistry::resolveDBusServiceName(const std::string& dbusServiceName,
DBusServiceListenersRecord& dbusServiceListenersRecord) {
@@ -575,7 +599,7 @@ void DBusServiceRegistry::onGetNameOwnerCallback(const CallStatus& status,
DBusServiceRegistry::DBusRecordState
DBusServiceRegistry::resolveDBusInterfaceNameState(
- const DBusAddress &_dbusAddress, DBusServiceListenersRecord &dbusServiceListenersRecord) {
+ const DBusAddress &_dbusAddress, DBusServiceListenersRecord &dbusServiceListenersRecord) {
assert(dbusServiceListenersRecord.uniqueBusNameState == DBusRecordState::RESOLVED);
assert(!dbusServiceListenersRecord.uniqueBusName.empty());
@@ -583,7 +607,8 @@ DBusServiceRegistry::resolveDBusInterfaceNameState(
assert(!dbusServiceUniqueNameRecord.ownedBusNames.empty());
auto& dbusObjectPathRecord = getDBusObjectPathCacheReference(
- _dbusAddress.getObjectPath(),
+ _dbusAddress.getObjectPath(),
+ _dbusAddress.getService(),
dbusServiceListenersRecord.uniqueBusName,
dbusServiceUniqueNameRecord);
@@ -592,7 +617,7 @@ DBusServiceRegistry::resolveDBusInterfaceNameState(
}
auto dbusInterfaceNameIterator
- = dbusObjectPathRecord.dbusInterfaceNamesCache.find(_dbusAddress.getInterface());
+ = dbusObjectPathRecord.dbusInterfaceNamesCache.find(_dbusAddress.getInterface());
const bool isDBusInterfaceNameFound =
(dbusInterfaceNameIterator != dbusObjectPathRecord.dbusInterfaceNamesCache.end());
@@ -602,14 +627,17 @@ DBusServiceRegistry::resolveDBusInterfaceNameState(
DBusServiceRegistry::DBusObjectPathCache &
DBusServiceRegistry::getDBusObjectPathCacheReference(
- const std::string& dbusObjectPath,
- const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath,
+ const std::string& dbusServiceName,
+ const std::string& dbusServiceUniqueName,
DBusUniqueNameRecord& dbusUniqueNameRecord) {
const bool isFirstDBusObjectPathCache = dbusUniqueNameRecord.dbusObjectPathsCache.empty();
auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
if(dbusObjectPathCacheIterator == dbusUniqueNameRecord.dbusObjectPathsCache.end()) {
- std::unordered_map<std::string, DBusObjectPathCache>::value_type value (dbusObjectPath, DBusObjectPathCache());
+ DBusObjectPathCache objectPathCache;
+ objectPathCache.serviceName = dbusServiceName;
+ std::unordered_map<std::string, DBusObjectPathCache>::value_type value (dbusObjectPath, std::move(objectPathCache));
dbusUniqueNameRecord.dbusObjectPathsCache.insert(std::move(value));
dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
}
@@ -620,10 +648,11 @@ DBusServiceRegistry::getDBusObjectPathCacheReference(
dbusServiceUniqueName,
this);
assert(isSubscriptionSuccessful);
+ (void)isSubscriptionSuccessful;
}
if (dbusObjectPathCacheIterator->second.state == DBusRecordState::UNKNOWN
- && introspectDBusObjectPath(dbusServiceUniqueName, dbusObjectPath)) {
+ && resolveObjectPathWithObjectManager(dbusServiceUniqueName, dbusObjectPath)) {
dbusObjectPathCacheIterator->second.state = DBusRecordState::RESOLVING;
}
@@ -649,6 +678,7 @@ void DBusServiceRegistry::releaseDBusObjectPathCacheReference(const std::string&
auto dbusObjectPathCacheIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
const bool isDBusObjectPathCacheFound = (dbusObjectPathCacheIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end());
assert(isDBusObjectPathCacheFound);
+ (void)isDBusObjectPathCacheFound;
auto& dbusObjectPathCache = dbusObjectPathCacheIterator->second;
assert(dbusObjectPathCache.referenceCount > 0);
@@ -665,10 +695,196 @@ void DBusServiceRegistry::releaseDBusObjectPathCacheReference(const std::string&
dbusServiceListenersRecord.uniqueBusName,
this);
assert(isSubscriptionCancelled);
+ (void)isSubscriptionCancelled;
}
}
}
+bool DBusServiceRegistry::resolveObjectPathWithObjectManager(const std::string& dbusServiceUniqueName, const std::string& dbusObjectPath) {
+ // get managed objects from root object manager
+ auto getManagedObjectsCallback = std::bind(
+ &DBusServiceRegistry::onGetManagedObjectsCallbackResolve,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2,
+ dbusServiceUniqueName,
+ dbusObjectPath);
+ return getManagedObjects(dbusServiceUniqueName, "/", getManagedObjectsCallback);
+}
+
+bool DBusServiceRegistry::getManagedObjects(const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath,
+ GetManagedObjectsCallback callback) {
+ bool isSendingInProgress = false;
+ auto dbusConnection = dbusDaemonProxy_->getDBusConnection();
+
+ assert(!dbusServiceUniqueName.empty());
+
+ if(dbusConnection->isConnected()) {
+
+ if(dbusObjectPath != "/") {
+ mutexObjectPathsResolveCount.lock();
+ objectPathsToResolve++;
+ mutexObjectPathsResolveCount.unlock();
+ }
+
+ DBusAddress dbusAddress(dbusServiceUniqueName, dbusObjectPath, "org.freedesktop.DBus.ObjectManager");
+ DBusMessage dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
+ dbusAddress,
+ "GetManagedObjects");
+
+ auto getManagedObjectsCallback = std::bind(
+ callback,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ dbusServiceUniqueName,
+ dbusObjectPath);
+
+ dbusConnection->sendDBusMessageWithReplyAsync(
+ dbusMessageCall,
+ DBusProxyAsyncCallbackHandler<
+ DBusObjectManagerStub::DBusObjectPathAndInterfacesDict
+ >::create(getManagedObjectsCallback, std::tuple<DBusObjectManagerStub::DBusObjectPathAndInterfacesDict>()),
+ &serviceRegistryInfo);
+
+ isSendingInProgress = true;
+ }
+ return isSendingInProgress;
+}
+
+void DBusServiceRegistry::onGetManagedObjectsCallbackResolve(const CallStatus& callStatus,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict,
+ const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath) {
+
+ if(callStatus == CallStatus::SUCCESS) {
+ //has object manager
+ bool objectPathFound = false;
+ for(auto objectPathDict : dbusObjectPathAndInterfacesDict)
+ {
+ std::string objectPath = objectPathDict.first;
+ if(objectPath != dbusObjectPath)
+ continue;
+
+ // object path that should be resolved is found --> resolve
+ objectPathFound = true;
+ CommonAPI::DBus::DBusObjectManagerStub::DBusInterfacesAndPropertiesDict interfacesAndPropertiesDict = objectPathDict.second;
+ for(auto interfaceDict : interfacesAndPropertiesDict)
+ {
+ std::string interfaceName = interfaceDict.first;
+ dbusServicesMutex_.lock();
+ processManagedObject(dbusObjectPath, dbusServiceUniqueName, interfaceName);
+ dbusServicesMutex_.unlock();
+ }
+
+ // resolve further managed objects
+ auto callback = std::bind(
+ &DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3,
+ std::placeholders::_4);
+ getManagedObjects(dbusServiceUniqueName, dbusObjectPath, callback);
+ }
+
+ if(!objectPathFound) {
+ // object path is managed. Try to resolve object path with the help of the manager
+ auto getManagedObjectsCallback = std::bind(
+ &DBusServiceRegistry::onGetManagedObjectsCallbackResolve,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2,
+ dbusServiceUniqueName,
+ dbusObjectPath);
+ std::string objectPathManager = dbusObjectPath.substr(0, dbusObjectPath.find_last_of("\\/"));
+ getManagedObjects(dbusServiceUniqueName, objectPathManager, getManagedObjectsCallback);
+ }
+ } else {
+ COMMONAPI_ERROR("There is no Object Manager that manages " + dbusObjectPath + ". Resolving failed!");
+ }
+}
+
+void DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther(const CallStatus& callStatus,
+ const DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict,
+ const std::string& dbusServiceUniqueName,
+ const std::string& dbusObjectPath) {
+
+ if(callStatus == CallStatus::SUCCESS) {
+ for(auto objectPathDict : dbusObjectPathAndInterfacesDict)
+ {
+ //resolve
+ std::string objectPath = objectPathDict.first;
+ CommonAPI::DBus::DBusObjectManagerStub::DBusInterfacesAndPropertiesDict interfacesAndPropertiesDict = objectPathDict.second;
+ for(auto interfaceDict : interfacesAndPropertiesDict)
+ {
+ std::string interfaceName = interfaceDict.first;
+ dbusServicesMutex_.lock();
+ processManagedObject(objectPath, dbusServiceUniqueName, interfaceName);
+ dbusServicesMutex_.unlock();
+ }
+
+ // resolve further managed objects
+ auto callback = std::bind(
+ &DBusServiceRegistry::onGetManagedObjectsCallbackResolveFurther,
+ this->shared_from_this(),
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3,
+ std::placeholders::_4);
+ getManagedObjects(dbusServiceUniqueName, objectPath, callback);
+ }
+ } else {
+ // No further managed objects
+ }
+
+ std::lock_guard<std::mutex> dbusServicesLock(dbusServicesMutex_);
+
+ auto dbusServiceUniqueNameIterator = dbusUniqueNamesMap_.find(dbusServiceUniqueName);
+ const bool isDBusServiceUniqueNameFound = (dbusServiceUniqueNameIterator != dbusUniqueNamesMap_.end());
+
+ if (!isDBusServiceUniqueNameFound) {
+ return;
+ }
+
+ DBusUniqueNameRecord& dbusUniqueNameRecord = dbusServiceUniqueNameIterator->second;
+ auto dbusObjectPathIterator = dbusUniqueNameRecord.dbusObjectPathsCache.find(dbusObjectPath);
+ const bool isDBusObjectPathFound = (dbusObjectPathIterator != dbusUniqueNameRecord.dbusObjectPathsCache.end());
+
+ if (!isDBusObjectPathFound) {
+ return;
+ }
+
+ DBusObjectPathCache& dbusObjectPathRecord = dbusObjectPathIterator->second;
+
+ dbusObjectPathRecord.state = DBusRecordState::RESOLVED;
+ dbusObjectPathRecord.promiseOnResolve.set_value(dbusObjectPathRecord.state);
+ mutexObjectPathsResolveCount.lock();
+ objectPathsToResolve--;
+ mutexObjectPathsResolveCount.unlock();
+ monitorResolveAllObjectPaths_.notify_all();
+
+ dbusUniqueNameRecord.objectPathsState = DBusRecordState::RESOLVED;
+
+ notifyDBusServiceListeners(
+ dbusUniqueNameRecord,
+ dbusObjectPath,
+ dbusObjectPathRecord.dbusInterfaceNamesCache,
+ DBusRecordState::RESOLVED);
+}
+
+void DBusServiceRegistry::processManagedObject(const std::string& dbusObjectPath,
+ const std::string& dbusServiceUniqueName,
+ const std::string& interfaceName) {
+ DBusUniqueNameRecord& dbusUniqueNameRecord = dbusUniqueNamesMap_[dbusServiceUniqueName];
+ DBusObjectPathCache& dbusObjectPathCache = dbusUniqueNameRecord.dbusObjectPathsCache[dbusObjectPath];
+
+ if(!isOrgFreedesktopDBusInterface(interfaceName)) {
+ dbusObjectPathCache.dbusInterfaceNamesCache.insert(interfaceName);
+ } else if (translator_->isOrgFreedesktopDBusPeerMapped() && (interfaceName == "org.freedesktop.DBus.Peer")) {
+ dbusObjectPathCache.dbusInterfaceNamesCache.insert(interfaceName);
+ }
+}
bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServiceUniqueName,
const std::string& dbusObjectPath) {
@@ -697,13 +913,12 @@ bool DBusServiceRegistry::introspectDBusObjectPath(const std::string& dbusServic
dbusConnection->sendDBusMessageWithReplyAsync(
dbusMessageCall,
DBusProxyAsyncCallbackHandler<
- std::string
+ std::string
>::create(instrospectAsyncCallback, std::tuple<std::string>()),
&serviceRegistryInfo);
isResolvingInProgress = true;
}
-
return isResolvingInProgress;
}
@@ -765,7 +980,7 @@ void DBusServiceRegistry::onIntrospectCallback(const CallStatus& callStatus,
}
void DBusServiceRegistry::parseIntrospectionNode(const pugi::xml_node& node, const std::string& rootObjectPath, const std::string& fullObjectPath, const std::string& dbusServiceUniqueName) {
- std::string nodeName;
+ std::string nodeName;
for(pugi::xml_node& subNode : node.children()) {
nodeName = std::string(subNode.name());
@@ -909,19 +1124,35 @@ void DBusServiceRegistry::onDBusServiceAvailable(const std::string& dbusServiceN
if (!isDBusServiceNameObserved) {
return;
}
-
- // resolve object path and notify service listners
for (auto dbusObjectPathListenersIterator = dbusServiceListenersRecord.dbusObjectPathListenersMap.begin();
dbusObjectPathListenersIterator != dbusServiceListenersRecord.dbusObjectPathListenersMap.end();) {
const std::string& listenersDBusObjectPath = dbusObjectPathListenersIterator->first;
auto& dbusInterfaceNameListenersMap = dbusObjectPathListenersIterator->second;
- auto& dbusObjectPathRecord = getDBusObjectPathCacheReference(
- listenersDBusObjectPath,
- dbusServiceUniqueName,
- *dbusUniqueNameRecord);
- if (dbusObjectPathRecord.state == DBusRecordState::RESOLVED) {
- notifyDBusObjectPathResolved(dbusInterfaceNameListenersMap, dbusObjectPathRecord.dbusInterfaceNamesCache);
+ if(dbusPredefinedServices_.find(dbusServiceName) == dbusPredefinedServices_.end()) {
+ //service not predefined -> resolve object path and notify service listeners
+ auto& dbusObjectPathRecord = getDBusObjectPathCacheReference(
+ listenersDBusObjectPath,
+ dbusServiceName,
+ dbusServiceUniqueName,
+ *dbusUniqueNameRecord);
+
+ if (dbusObjectPathRecord.state == DBusRecordState::RESOLVED) {
+ notifyDBusObjectPathResolved(dbusInterfaceNameListenersMap, dbusObjectPathRecord.dbusInterfaceNamesCache);
+ }
+ } else {
+ //service is predefined -> notify service listeners about availability
+ for(auto dbusInterfaceNameListenerRecordIterator = dbusInterfaceNameListenersMap.begin();
+ dbusInterfaceNameListenerRecordIterator != dbusInterfaceNameListenersMap.end();
+ ++dbusInterfaceNameListenerRecordIterator) {
+ auto& dbusInterfaceNameListenerRecord = dbusInterfaceNameListenerRecordIterator->second;
+ dbusInterfaceNameListenerRecord.state = DBusRecordState::RESOLVED;
+ for(auto dbusServiceListenerIterator = dbusInterfaceNameListenerRecord.listenerList.begin();
+ dbusServiceListenerIterator != dbusInterfaceNameListenerRecord.listenerList.end();
+ ++dbusServiceListenerIterator) {
+ (*dbusServiceListenerIterator)(AvailabilityStatus::AVAILABLE);
+ }
+ }
}
if (dbusInterfaceNameListenersMap.empty()) {
@@ -939,7 +1170,7 @@ void DBusServiceRegistry::onDBusServiceNotAvailable(DBusServiceListenersRecord&
const DBusUniqueNamesMapIterator dbusUniqueNameRecordIterator = dbusUniqueNamesMap_.find(dbusServiceListenersRecord.uniqueBusName);
if (dbusUniqueNameRecordIterator != dbusUniqueNamesMap_.end()) {
- removeUniqueName(dbusUniqueNameRecordIterator, _serviceName);
+ removeUniqueName(dbusUniqueNameRecordIterator, _serviceName);
}
dbusServiceListenersRecord.uniqueBusName.clear();
@@ -1068,17 +1299,31 @@ void DBusServiceRegistry::removeUniqueName(const DBusUniqueNamesMapIterator& dbu
dbusUniqueNamesIterator->first,
this);
assert(isSubscriptionCancelled);
+ (void)isSubscriptionCancelled;
if ("" != _serviceName) {
- auto findServiceName = dbusUniqueNamesIterator->second.ownedBusNames.find(_serviceName);
- if (findServiceName != dbusUniqueNamesIterator->second.ownedBusNames.end())
- dbusUniqueNamesIterator->second.ownedBusNames.erase(findServiceName);
+ auto findServiceName = dbusUniqueNamesIterator->second.ownedBusNames.find(_serviceName);
+ if (findServiceName != dbusUniqueNamesIterator->second.ownedBusNames.end())
+ dbusUniqueNamesIterator->second.ownedBusNames.erase(findServiceName);
} else {
- dbusUniqueNamesIterator->second.ownedBusNames.clear();
+ dbusUniqueNamesIterator->second.ownedBusNames.clear();
}
- if (dbusUniqueNamesIterator->second.ownedBusNames.size() == 0)
- dbusUniqueNamesMap_.erase(dbusUniqueNamesIterator);
+ if (dbusUniqueNamesIterator->second.ownedBusNames.size() == 0) {
+ dbusUniqueNamesMap_.erase(dbusUniqueNamesIterator);
+ } else {
+ //delete object path cache entry of service
+ auto& dbusObjectPathsCache = dbusUniqueNamesIterator->second.dbusObjectPathsCache;
+ auto dbusObjectPathCacheIterator = dbusObjectPathsCache.begin();
+ while(dbusObjectPathCacheIterator != dbusObjectPathsCache.end()) {
+ DBusObjectPathCache *objectPathCache = &(dbusObjectPathCacheIterator->second);
+ if(objectPathCache->serviceName == _serviceName) {
+ dbusObjectPathCacheIterator = dbusUniqueNamesIterator->second.dbusObjectPathsCache.erase(dbusObjectPathCacheIterator);
+ } else {
+ ++dbusObjectPathCacheIterator;
+ }
+ }
+ }
}
DBusServiceRegistry::DBusUniqueNameRecord* DBusServiceRegistry::insertServiceNameMapping(const std::string& dbusUniqueName,
diff --git a/src/CommonAPI/DBus/DBusStubAdapter.cpp b/src/CommonAPI/DBus/DBusStubAdapter.cpp
index 03fa6c3..6a3a8cf 100644
--- a/src/CommonAPI/DBus/DBusStubAdapter.cpp
+++ b/src/CommonAPI/DBus/DBusStubAdapter.cpp
@@ -12,8 +12,8 @@ namespace DBus {
DBusStubAdapter::DBusStubAdapter(const DBusAddress &_dbusAddress,
const std::shared_ptr<DBusProxyConnection> &_connection,
const bool _isManaging)
- : dbusAddress_(_dbusAddress),
- connection_(_connection),
+ : dbusAddress_(_dbusAddress),
+ connection_(_connection),
isManaging_(_isManaging) {
}
@@ -22,7 +22,8 @@ DBusStubAdapter::~DBusStubAdapter() {
}
void DBusStubAdapter::init(std::shared_ptr<DBusStubAdapter> _instance) {
- DBusAddressTranslator::get()->translate(dbusAddress_, address_);
+ (void)_instance;
+ DBusAddressTranslator::get()->translate(dbusAddress_, address_);
}
void DBusStubAdapter::deinit() {
@@ -36,11 +37,11 @@ const std::shared_ptr<DBusProxyConnection> &DBusStubAdapter::getDBusConnection()
return connection_;
}
-const bool DBusStubAdapter::isManaging() const {
+bool DBusStubAdapter::isManaging() const {
return isManaging_;
}
-const bool DBusStubAdapter::hasFreedesktopProperties() {
+bool DBusStubAdapter::hasFreedesktopProperties() {
return false;
}
diff --git a/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch b/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
index 3f92169..fee91c3 100644
--- a/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
+++ b/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
@@ -106,17 +106,17 @@ index e1068e3..233f179 100644
+ timeout_milliseconds,
+ reply_handler_timeout);
+
++ CONNECTION_UNLOCK (connection);
+ if (pending == NULL)
+ {
-+ CONNECTION_UNLOCK (connection);
+ return FALSE;
+ }
+
+ if (!dbus_pending_call_set_notify(pending, function0, user_data0, free_user_data0))
+ {
-+ CONNECTION_UNLOCK (connection);
+ return FALSE;
+ }
++ CONNECTION_LOCK (connection);
+
+ /* Assign a serial to the message */
+ serial = dbus_message_get_serial (message);
diff --git a/src/dbus-patches/capi-dbus-block-acquire-io-path-on-send.patch b/src/dbus-patches/capi-dbus-block-acquire-io-path-on-send.patch
new file mode 100644
index 0000000..1fb7316
--- /dev/null
+++ b/src/dbus-patches/capi-dbus-block-acquire-io-path-on-send.patch
@@ -0,0 +1,14 @@
+diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c
+index a3dafa0..1fc7254 100644
+--- a/dbus/dbus-connection.c
++++ b/dbus/dbus-connection.c
+@@ -1207,8 +1207,7 @@ _dbus_connection_do_iteration_unlocked (DBusConnection *connection,
+ if (connection->n_outgoing == 0)
+ flags &= ~DBUS_ITERATION_DO_WRITING;
+
+- if (_dbus_connection_acquire_io_path (connection,
+- (flags & DBUS_ITERATION_BLOCK) ? timeout_milliseconds : 0))
++ if (_dbus_connection_acquire_io_path (connection, timeout_milliseconds))
+ {
+ HAVE_LOCK_CHECK (connection);
+
diff --git a/src/pugixml/pugixml.cpp b/src/pugixml/pugixml.cpp
index 4e45ba3..e5b5e22 100644
--- a/src/pugixml/pugixml.cpp
+++ b/src/pugixml/pugixml.cpp
@@ -22,6 +22,8 @@
#include <assert.h>
#include <wchar.h>
+#include <cmath>
+
#ifndef PUGIXML_NO_XPATH
# include <math.h>
# include <float.h>
@@ -6230,7 +6232,7 @@ PUGI__NS_BEGIN
#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__)
return !!_isnan(value);
#elif defined(fpclassify) && defined(FP_NAN)
- return fpclassify(value) == FP_NAN;
+ return std::fpclassify(value) == FP_NAN;
#else
// fallback
const volatile double v = value;
@@ -6245,7 +6247,7 @@ PUGI__NS_BEGIN
if (_isnan(value)) return PUGIXML_TEXT("NaN");
return value > 0 ? PUGIXML_TEXT("Infinity") : PUGIXML_TEXT("-Infinity");
#elif defined(fpclassify) && defined(FP_NAN) && defined(FP_INFINITE) && defined(FP_ZERO)
- switch (fpclassify(value))
+ switch (std::fpclassify(value))
{
case FP_NAN:
return PUGIXML_TEXT("NaN");
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index 5bc063a..84e9ac4 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -16,7 +16,14 @@ include_directories(.
${GLIB_INCLUDE_DIRS}
)
-set(VERSION "v1_0")
+if ("${USE_INSTALLED_DBUS}" STREQUAL "OFF")
+ set(DBus_LDFLAGS dbus-1)
+ link_directories(
+ ${DBus_INCLUDE_DIRS}/dbus/.libs
+ )
+endif()
+
+set(VERSION "v1")
set(TestInterfaceSources src-gen/core/commonapi/tests/DerivedTypeCollection.cpp
src-gen/core/${VERSION}/commonapi/tests/TestInterfaceStubDefault.cpp)
@@ -26,14 +33,20 @@ set(TestInterfaceDBusSources ${TestInterfaceSources}
src-gen/dbus/${VERSION}/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
src-gen/dbus/${VERSION}/fake/legacy/service/LegacyInterfaceDBusProxy.cpp)
+set(TestInterfaceManagerSources src-gen/core/${VERSION}/commonapi/tests/TestInterfaceManagerStubDefault.cpp)
+
+set(TestInterfaceManagerDBusSources ${TestInterfaceManagerSources}
+ src-gen/dbus/${VERSION}/commonapi/tests/TestInterfaceManagerDBusProxy.cpp
+ src-gen/dbus/${VERSION}/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp)
+
+set(FreedesktopPropertiesSources src-gen/core/${VERSION}/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
+ src-gen/core/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp)
-set(FreedesktopPropertiesDBusSources ${TestInterfaceSources}
+set(FreedesktopPropertiesDBusSources ${FreedesktopPropertiesSources}
src-gen/dbus/${VERSION}/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
src-gen/dbus/${VERSION}/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
- src-gen/core/${VERSION}/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
src-gen/dbus/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
- src-gen/dbus/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
- src-gen/core/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp)
+ src-gen/dbus/${VERSION}/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp)
set(ManagedSources src-gen/core/${VERSION}/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
src-gen/core/${VERSION}/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
@@ -50,51 +63,35 @@ set(ManagedDBusSources ${ManagedSources}
src-gen/dbus/${VERSION}/commonapi/tests/managed/SecondRootDBusProxy.cpp
src-gen/dbus/${VERSION}/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp)
-set(ExtendedInterfaceSources src-gen/dbus/${VERSION}/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
- src-gen/dbus/${VERSION}/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
- src-gen/core/${VERSION}/commonapi/tests/ExtendedInterfaceStubDefault.cpp)
+set(ExtendedInterfaceSources src-gen/core/${VERSION}/commonapi/tests/ExtendedInterfaceStubDefault.cpp)
+
+set(ExtendedInterfaceDBusSources ${ExtendedInterfaceSources}
+ src-gen/dbus/${VERSION}/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
+ src-gen/dbus/${VERSION}/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp)
-set(LIB_LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI)
set(TEST_LINK_LIBRARIES -Wl,--no-as-needed CommonAPI-DBus -Wl,--as-needed CommonAPI ${DBus_LDFLAGS} ${DL_LIBRARY} gtest ${PTHREAD_LIBRARY})
set(TEST_LINK_LIBRARIES_WITHOUT_COMMONAPI_DBUS CommonAPI gtest ${PTHREAD_LIBRARY})
-##### FIXME: disabled due to removal of MiddlewareInfo from CommonAPI
-##### add_library(CommonAPI-Fake SHARED dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp)
-##### set_target_properties(CommonAPI-Fake PROPERTIES VERSION 1.0.0 SOVERSION 1 LINKER_LANGUAGE C)
-##### target_link_libraries(CommonAPI-Fake ${LIB_LINK_LIBRARIES})
-
-add_library(DBusGen-TestInterface SHARED ${TestInterfaceDBusSources})
-set_target_properties(DBusGen-TestInterface PROPERTIES VERSION 3.0.0 SOVERSION 3 LINKER_LANGUAGE C)
-target_link_libraries(DBusGen-TestInterface ${LIB_LINK_LIBRARIES})
-
-add_library(SomeOtherNameForGeneratedDBus SHARED ${TestInterfaceDBusSources})
-set_target_properties(SomeOtherNameForGeneratedDBus PROPERTIES VERSION 3.0.0 SOVERSION 3 LINKER_LANGUAGE C)
-target_link_libraries(SomeOtherNameForGeneratedDBus ${LIB_LINK_LIBRARIES})
+add_library(fakeGlueCode-dbus SHARED FakeGlueCode.cpp)
+set_target_properties(fakeGlueCode-dbus PROPERTIES VERSION 3.0.0 SOVERSION 3 LINKER_LANGUAGE C)
+target_link_libraries(fakeGlueCode-dbus)
##############################################################################
# DBusManagedTest
##############################################################################
add_executable(DBusManagedTest DBusManagedTest.cpp
- ${ManagedDBusSources})
+ ${ManagedDBusSources})
target_link_libraries(DBusManagedTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusObjectManagerStubTest
-##############################################################################
-
-##### FIXME: SubscriptionStatus not part of CommonAPI 3.0
-##### add_executable(DBusObjectManagerStubTest DBusObjectManagerStubTest.cpp)
-##### target_link_libraries(DBusObjectManagerStubTest ${TEST_LINK_LIBRARIES} ${GLIB_LDFLAGS})
-
-##############################################################################
# DBusMainLoopIntegrationTest
##############################################################################
add_executable(DBusMainLoopIntegrationTest DBusMainLoopIntegrationTest.cpp
- ${TestInterfaceDBusSources})
+ ${TestInterfaceDBusSources})
if (MSVC)
target_link_libraries(DBusMainLoopIntegrationTest ${TEST_LINK_LIBRARIES} ws2_32)
else()
@@ -102,16 +99,6 @@ target_link_libraries(DBusMainLoopIntegrationTest ${TEST_LINK_LIBRARIES} ${GLIB_
endif()
##############################################################################
-# DBusServiceRegistryTest
-##############################################################################
-
-##### FIXME: getCurrentBinaryFileFQN, SubscriptionStatus not part of CommonAPI 3.0
-##### add_executable(DBusServiceRegistryTest DBusServiceRegistryTest.cpp
-##### ${TestInterfaceDBusSources})
-#####
-##### target_link_libraries(DBusServiceRegistryTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusAddressTranslatorTest
##############################################################################
@@ -131,15 +118,6 @@ add_executable(DBusConnectionTest DBusConnectionTest.cpp)
target_link_libraries(DBusConnectionTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusTypeStreamTest
-##############################################################################
-
-##### FIXME: CommonAPI::Typewriter not part of CommonAPI 3.0
-##### add_executable(DBusTypeStreamTest DBusTypeStreamTest.cpp)
-#####
-##### target_link_libraries(DBusTypeStreamTest ${TEST_LINK_LIBRARIES})
-
-##############################################################################
# DBusVariantOutputStreamTest
##############################################################################
@@ -206,31 +184,21 @@ target_link_libraries(DBusMultipleConnectionTest ${TEST_LINK_LIBRARIES})
# DBusProxyTest
##############################################################################
-##### FIXME: generated ExtendedInterfaceProxy.hpp contains serveral errors
-##### add_executable(DBusProxyTest DBusProxyTest.cpp
-##### ${TestInterfaceDBusSources}
-##### ${ExtendedInterfaceSources})
-#####
-##### target_link_libraries(DBusProxyTest ${TEST_LINK_LIBRARIES})
+add_executable(DBusProxyTest DBusProxyTest.cpp
+ ${TestInterfaceDBusSources}
+ ${ExtendedInterfaceDBusSources})
-##############################################################################
-# DBusFreedesktopPropertiesTest
-##############################################################################
-
-##### FIXME: generated TestFreedesktopDerivedInterfaceProxy.hpp contains serveral errors
-##### add_executable(DBusFreedesktopPropertiesTest DBusFreedesktopPropertiesTest.cpp
-##### ${FreedesktopPropertiesDBusSources})
-#####
-##### target_link_libraries(DBusFreedesktopPropertiesTest ${TEST_LINK_LIBRARIES})
+target_link_libraries(DBusProxyTest ${TEST_LINK_LIBRARIES})
##############################################################################
-# DBusServicePublisherTest
+# DBusFreedesktopPropertiesTest
##############################################################################
-add_executable(DBusServicePublisherTest DBusServicePublisherTest.cpp
- ${TestInterfaceDBusSources})
+add_executable(DBusFreedesktopPropertiesTest DBusFreedesktopPropertiesTest.cpp
+ ${TestInterfaceSources}
+ ${FreedesktopPropertiesDBusSources})
-target_link_libraries(DBusServicePublisherTest ${TEST_LINK_LIBRARIES})
+target_link_libraries(DBusFreedesktopPropertiesTest ${TEST_LINK_LIBRARIES})
##############################################################################
# DBusVariantTest
@@ -248,54 +216,6 @@ add_executable(DBusRuntimeTest DBusRuntimeTest.cpp)
target_link_libraries(DBusRuntimeTest ${TEST_LINK_LIBRARIES})
-#####
-##### FIXME: commented out disfunctional test, due to different middleware loading mechanism
-#####
-###################################################################################
-###### DBusDynamicLoadingBasicTest
-###################################################################################
-#####
-#####add_executable(DBusDynamicLoadingBasicTest ${TestInterfaceSources}
-##### dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp)
-#####
-#####target_link_libraries(DBusDynamicLoadingBasicTest ${TEST_LINK_LIBRARIES})
-#####
-###################################################################################
-###### DBusDynamicLoadingMultipleDefinitionTest
-###################################################################################
-#####
-#####add_executable(DBusDynamicLoadingMultipleDefinitionTest ${TestInterfaceSources}
-##### dbusDynamicLoadingTests/DBusDynamicLoadingMul
-#####
-#####target_link_libraries(DBusDynamicLoadingMultipleDefinitionTest ${TEST_LINK_LIBRARIES})
-#####
-###################################################################################
-###### DBusDynamicLoadingMultipleBindingsTest
-###################################################################################
-#####
-#####add_executable(DBusDynamicLoadingMultipleBindingsTest ${TestInterfaceSources}
-##### dbusDynamicLoadingTests/DBusDynamicLoadingMulti
-#####
-#####target_link_libraries(DBusDynamicLoadingMultipleBindingsTest ${TEST_LINK_LIBRARIES})
-#####
-###################################################################################
-###### DBusDynamicLoadingMixedValidityTest
-###################################################################################
-#####
-#####add_executable(DBusDynamicLoadingMixedValidityTest ${TestInterfaceSources}
-##### dbusDynamicLoadingTests/DBusDynamicLoadingMixedVal
-#####
-#####target_link_libraries(DBusDynamicLoadingMixedValidityTest ${TEST_LINK_LIBRARIES})
-#####
-###################################################################################
-###### DBusDynamicLoadingNoValidityTest
-###################################################################################
-#####
-#####add_executable(DBusDynamicLoadingNoValidityTest ${TestInterfaceSources}
-##### dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityT
-#####
-#####target_link_libraries(DBusDynamicLoadingNoValidityTest ${TEST_LINK_LIBRARIES_WITHOUT_COMMONAPI_DBUS})
-
##############################################################################
# DBusClientIdTest
##############################################################################
@@ -309,6 +229,7 @@ target_link_libraries(DBusClientIdTest ${TEST_LINK_LIBRARIES})
##############################################################################
add_executable(DBusBroadcastTest ${TestInterfaceDBusSources}
+ ${TestInterfaceManagerDBusSources}
DBusBroadcastTest.cpp)
target_link_libraries(DBusBroadcastTest ${TEST_LINK_LIBRARIES})
@@ -337,12 +258,9 @@ target_link_libraries(DBusLoadTest ${TEST_LINK_LIBRARIES})
##############################################################################
add_dependencies(DBusManagedTest gtest)
-##### add_dependencies(DBusObjectManagerStubTest gtest)
add_dependencies(DBusMainLoopIntegrationTest gtest)
-##### add_dependencies(DBusServiceRegistryTest gtest)
add_dependencies(DBusAddressTranslatorTest gtest)
add_dependencies(DBusConnectionTest gtest)
-##### add_dependencies(DBusTypeStreamTest gtest)
add_dependencies(DBusVariantOutputStreamTest gtest)
add_dependencies(DBusCommunicationTest gtest)
add_dependencies(DBusDaemonProxyTest gtest)
@@ -350,16 +268,10 @@ 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(DBusServicePublisherTest gtest)
+add_dependencies(DBusProxyTest gtest)
+add_dependencies(DBusFreedesktopPropertiesTest gtest)
add_dependencies(DBusVariantTest gtest)
add_dependencies(DBusRuntimeTest gtest)
-##### add_dependencies(DBusDynamicLoadingBasicTest gtest)
-##### add_dependencies(DBusDynamicLoadingMultipleDefinitionTest gtest)
-##### add_dependencies(DBusDynamicLoadingMultipleBindingsTest gtest)
-##### add_dependencies(DBusDynamicLoadingMixedValidityTest gtest)
-##### add_dependencies(DBusDynamicLoadingNoValidityTest gtest)
add_dependencies(DBusClientIdTest gtest)
add_dependencies(DBusBroadcastTest gtest)
add_dependencies(DBusPolymorphicTest gtest)
@@ -369,16 +281,11 @@ add_dependencies(DBusLoadTest gtest)
# Add tests to the target build_tests
##############################################################################
-##### add_dependencies(build_tests CommonAPI-Fake)
-add_dependencies(build_tests DBusGen-TestInterface)
-add_dependencies(build_tests SomeOtherNameForGeneratedDBus)
+add_dependencies(build_tests fakeGlueCode-dbus)
add_dependencies(build_tests DBusManagedTest)
-##### add_dependencies(build_tests DBusObjectManagerStubTest)
add_dependencies(build_tests DBusMainLoopIntegrationTest)
-##### add_dependencies(build_tests DBusServiceRegistryTest)
add_dependencies(build_tests DBusAddressTranslatorTest)
add_dependencies(build_tests DBusConnectionTest)
-##### add_dependencies(build_tests DBusTypeStreamTest)
add_dependencies(build_tests DBusVariantOutputStreamTest)
add_dependencies(build_tests DBusCommunicationTest)
add_dependencies(build_tests DBusDaemonProxyTest)
@@ -386,16 +293,10 @@ 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 DBusServicePublisherTest)
+add_dependencies(build_tests DBusProxyTest)
+add_dependencies(build_tests DBusFreedesktopPropertiesTest)
add_dependencies(build_tests DBusVariantTest)
add_dependencies(build_tests DBusRuntimeTest)
-##### add_dependencies(build_tests DBusDynamicLoadingBasicTest)
-##### add_dependencies(build_tests DBusDynamicLoadingMultipleDefinitionTest)
-##### add_dependencies(build_tests DBusDynamicLoadingMultipleBindingsTest)
-##### add_dependencies(build_tests DBusDynamicLoadingMixedValidityTest)
-##### add_dependencies(build_tests DBusDynamicLoadingNoValidityTest)
add_dependencies(build_tests DBusClientIdTest)
add_dependencies(build_tests DBusBroadcastTest)
add_dependencies(build_tests DBusPolymorphicTest)
@@ -406,12 +307,9 @@ add_dependencies(build_tests DBusLoadTest)
##############################################################################
add_test(NAME DBusManagedTest COMMAND DBusManagedTest)
-##### add_test(NAME DBusObjectManagerStubTest COMMAND DBusObjectManagerStubTest)
add_test(NAME DBusMainLoopIntegrationTest COMMAND DBusMainLoopIntegrationTest)
-##### add_test(NAME DBusServiceRegistryTest COMMAND DBusServiceRegistryTest)
add_test(NAME DBusAddressTranslatorTest WORKING_DIRECTORY ${libcommonapi-dbus_SOURCE_DIR} COMMAND DBusAddressTranslatorTest)
add_test(NAME DBusConnectionTest COMMAND DBusConnectionTest)
-##### add_test(NAME DBusTypeStreamTest COMMAND DBusTypeStreamTest)
add_test(NAME DBusVariantOutputStreamTest COMMAND DBusVariantOutputStreamTest)
add_test(NAME DBusCommunicationTest COMMAND DBusCommunicationTest)
add_test(NAME DBusDaemonProxyTest COMMAND DBusDaemonProxyTest)
@@ -419,16 +317,10 @@ 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 DBusServicePublisherTest COMMAND DBusServicePublisherTest)
+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 DBusDynamicLoadingBasicTest COMMAND DBusDynamicLoadingBasicTest)
-##### add_test(NAME DBusDynamicLoadingMultipleDefinitionTest COMMAND DBusDynamicLoadingMultipleDefinitionTest)
-##### add_test(NAME DBusDynamicLoadingMultipleBindingsTest COMMAND DBusDynamicLoadingMultipleBindingsTest)
-##### add_test(NAME DBusDynamicLoadingMixedValidityTest COMMAND DBusDynamicLoadingMixedValidityTest)
-##### add_test(NAME DBusDynamicLoadingNoValidityTest COMMAND DBusDynamicLoadingNoValidityTest)
add_test(NAME DBusClientIdTest COMMAND DBusClientIdTest)
add_test(NAME DBusBroadcastTest COMMAND DBusBroadcastTest)
add_test(NAME DBusPolymorphicTest COMMAND DBusPolymorphicTest)
diff --git a/src/test/DBusAddressTranslatorTest.cpp b/src/test/DBusAddressTranslatorTest.cpp
index e26eef9..4423130 100644
--- a/src/test/DBusAddressTranslatorTest.cpp
+++ b/src/test/DBusAddressTranslatorTest.cpp
@@ -25,11 +25,11 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include <v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceProxy.hpp>
static const std::string domain = "local";
@@ -99,15 +99,15 @@ static const std::string fileString =
;
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: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"
};
typedef std::vector<CommonAPI::DBus::DBusAddress>::value_type vt;
@@ -120,7 +120,20 @@ static const std::vector<CommonAPI::DBus::DBusAddress> dbusAddresses = {
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.LegacyInterface_fake.legacy.service", "/fake/legacy/service", "fake.legacy.service.LegacyInterface")
+ vt("fake.legacy.service.connection", "/some/legacy/path/6259504", "fake.legacy.service.LegacyInterface")
+};
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
};
class AddressTranslatorTest: public ::testing::Test {
@@ -136,8 +149,8 @@ protected:
};
TEST_F(AddressTranslatorTest, InstanceCanBeRetrieved) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> dbusAddressTranslator = CommonAPI::DBus::DBusAddressTranslator::get();
- ASSERT_TRUE((bool) dbusAddressTranslator);
+ std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> dbusAddressTranslator = CommonAPI::DBus::DBusAddressTranslator::get();
+ ASSERT_TRUE((bool) dbusAddressTranslator);
}
TEST_F(AddressTranslatorTest, ParsesDBusAddresses) {
@@ -145,287 +158,287 @@ TEST_F(AddressTranslatorTest, ParsesDBusAddresses) {
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());
+ 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());
+ ASSERT_EQ(dbusAddresses[i].getInterface(), dbusAddress.getInterface());
}
}
TEST_F(AddressTranslatorTest, ParsesCommonAPIAddresses) {
- std::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
+ 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;
+ 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::shared_ptr<CommonAPI::DBus::DBusAddressTranslator> translator = CommonAPI::DBus::DBusAddressTranslator::get();
- std::string commonApiAddressRef = "local:my.service:my.instance";
+ 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 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;
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
- // insert new address
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
+ // 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());
+ //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;
+ 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;
+ // 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());
+ 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();
+ 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");
+ 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;
+ CommonAPI::DBus::DBusAddress dbusAddress;
- translator->translate("local:my.Interface:busname.legacy.service_1_133", dbusAddress);
+ translator->translate("local:my.Interface:busname.legacy.service_1_133", dbusAddress);
- ASSERT_EQ(":1.133", dbusAddress.getService());
+ 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();
+ 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 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 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;
+ 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());
+ // 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;
+ 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;
+ // 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;
+ 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;
+ 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());
+ 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::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");
+ 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;
+ 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;
+ 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());
+ 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::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");
+ 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;
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
+ 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;
+ 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());
+ 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::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");
+ 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;
+ 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;
+ 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());
+ 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::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");
+ 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;
+ CommonAPI::DBus::DBusAddress dbusAddressResult;
+ CommonAPI::Address commonApiAddressResult;
- translator->insert(commonApiAddressRef,
- dbusAddressInsertRef.getService(),
- dbusAddressInsertRef.getObjectPath(),
- dbusAddressInsertRef.getInterface());
+ 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;
+ 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());
+ 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());
+ 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");
+ 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");
+ serviceNameAcquired = runtime->registerService(commonApiAddress.getDomain(), commonApiAddress.getInstance(), stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceNameAcquired);
@@ -438,11 +451,11 @@ TEST_F(AddressTranslatorTest, ServicesUsingPredefinedAddressesCanCommunicate) {
uint32_t v1 = 5;
std::string v2 = "Hai :)";
CommonAPI::CallStatus stat;
- defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
+ defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
ASSERT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
-
- runtime->unregisterService(commonApiAddress.getDomain(), stub->getStubAdapter()->getInterface(), commonApiAddress.getInstance());
+
+ runtime->unregisterService(commonApiAddress.getDomain(), stub->getStubAdapter()->getInterface(), commonApiAddress.getInstance());
}
#ifndef WIN32
@@ -465,22 +478,22 @@ TEST_F(AddressTranslatorTest, CreatedProxyHasCorrectCommonApiAddress) {
}
void callPythonService(std::string _pythonFileNameAndCommand) {
- const char *pathToFolderForFakeLegacyService =
- getenv("TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER");
+ 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!";
+ 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;
+ std::stringstream stream;
+ stream << "python " << pathToFolderForFakeLegacyService << "/" << _pythonFileNameAndCommand;
- int resultCode = system(stream.str().c_str());
+ int resultCode = system(stream.str().c_str());
EXPECT_EQ(0, resultCode);
}
void fakeLegacyServiceThread() {
- callPythonService("fakeLegacyService.py");
+ callPythonService("fakeLegacyService.py");
}
TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
@@ -498,6 +511,8 @@ TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
ASSERT_EQ(interfaceOfFakeLegacyService, address.getInterface());
ASSERT_EQ(instanceOfFakeLegacyService, address.getInstance());
+ proxyForFakeLegacyService->isAvailableBlocking();
+
CommonAPI::CallStatus status;
const int32_t input = 42;
@@ -528,6 +543,7 @@ TEST_F(AddressTranslatorTest, FakeLegacyServiceCanBeAddressed) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusBroadcastTest.cpp b/src/test/DBusBroadcastTest.cpp
index c74c296..36f8121 100644
--- a/src/test/DBusBroadcastTest.cpp
+++ b/src/test/DBusBroadcastTest.cpp
@@ -27,11 +27,16 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.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
@@ -42,11 +47,11 @@ public:
acceptSubs(true),
sentBroadcasts(0) {
- }
+ }
- virtual ~SelectiveBroadcastSender() {
+ virtual ~SelectiveBroadcastSender() {
- }
+ }
void startSending() {
sentBroadcasts = 0;
@@ -69,6 +74,7 @@ public:
bool onTestSelectiveBroadcastSelectiveSubscriptionRequested(
const std::shared_ptr<CommonAPI::ClientId> clientId) {
+ (void)clientId;
return acceptSubs;
}
@@ -83,7 +89,7 @@ public:
int getNumberOfSubscribedClients() {
- return getSubscribersForTestSelectiveBroadcastSelective()->size();
+ return static_cast<int>(getSubscribersForTestSelectiveBroadcastSelective()->size());
}
@@ -96,7 +102,18 @@ private:
std::shared_ptr<CommonAPI::ClientId> lastSubscribedClient;
};
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
class DBusBroadcastTest: public ::testing::Test {
protected:
@@ -104,59 +121,65 @@ protected:
runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool)runtime_);
- serviceAddressObject_ = CommonAPI::Address(serviceAddress_);
+ serviceAddressObject_ = CommonAPI::Address(serviceAddress_);
- selectiveBroadcastArrivedAtProxyFromSameFactory1 = 0;
- selectiveBroadcastArrivedAtProxyFromSameFactory2 = 0;
- selectiveBroadcastArrivedAtProxyFromOtherFactory = 0;
+ selectiveBroadcastArrivedAtProxyFromSameConnection1 = 0;
+ selectiveBroadcastArrivedAtProxyFromSameConnection2 = 0;
+ selectiveBroadcastArrivedAtProxyFromOtherConnection = 0;
}
virtual void TearDown() {
- runtime_->unregisterService(serviceAddressObject_.getDomain(), serviceAddressInterface_, serviceAddressObject_.getInstance());
+ 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 connectionId_;
+ static const CommonAPI::ConnectionId_t connectionIdService_;
+ static const CommonAPI::ConnectionId_t connectionIdClient1_;
+ static const CommonAPI::ConnectionId_t connectionIdClient2_;
- int selectiveBroadcastArrivedAtProxyFromSameFactory1;
- int selectiveBroadcastArrivedAtProxyFromSameFactory2;
- int selectiveBroadcastArrivedAtProxyFromOtherFactory;
+ int selectiveBroadcastArrivedAtProxyFromSameConnection1;
+ int selectiveBroadcastArrivedAtProxyFromSameConnection2;
+ int selectiveBroadcastArrivedAtProxyFromOtherConnection;
public:
- void selectiveBroadcastCallbackForProxyFromSameFactory1() {
- selectiveBroadcastArrivedAtProxyFromSameFactory1++;
+ void selectiveBroadcastCallbackForProxyFromSameConnection1() {
+ selectiveBroadcastArrivedAtProxyFromSameConnection1++;
}
- void selectiveBroadcastCallbackForProxyFromSameFactory2() {
- selectiveBroadcastArrivedAtProxyFromSameFactory2++;
+ void selectiveBroadcastCallbackForProxyFromSameConnection2() {
+ selectiveBroadcastArrivedAtProxyFromSameConnection2++;
}
- void selectiveBroadcastCallbackForProxyFromOtherFactory() {
- selectiveBroadcastArrivedAtProxyFromOtherFactory++;
+ void selectiveBroadcastCallbackForProxyFromOtherConnection() {
+ selectiveBroadcastArrivedAtProxyFromOtherConnection++;
}
};
-const std::string DBusBroadcastTest::serviceAddress_ = "local:CommonAPI.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyTestService";
-const CommonAPI::ConnectionId_t DBusBroadcastTest::connectionId_ = "connection";
+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";
TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ 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());
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
@@ -164,6 +187,8 @@ TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
bool callbackArrived = false;
broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)intParam;
+ (void)stringParam;
callbackArrived = true;
});
@@ -176,20 +201,20 @@ TEST_F(DBusBroadcastTest, ProxysCanHandleBroadcast) {
ASSERT_TRUE(callbackArrived);
}
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
+TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgain) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ 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());
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
@@ -197,6 +222,7 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
bool callbackArrived = false;
auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)stringParam;
EXPECT_EQ(intParam, 1);
callbackArrived = true;
});
@@ -213,9 +239,10 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
callbackArrived = false;
- auto broadcastSubscription2 = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- EXPECT_EQ(intParam, 2);
- callbackArrived = true;
+ auto broadcastSubscription2 = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)stringParam;
+ EXPECT_EQ(intParam, 2);
+ callbackArrived = true;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -226,22 +253,22 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
ASSERT_TRUE(callbackArrived);
- broadcastEvent.unsubscribe(broadcastSubscription2);
+ broadcastEvent.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInALoop) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
+TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainInALoop) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ 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());
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
VERSION::commonapi::tests::TestInterfaceProxyDefault::TestPredefinedTypeBroadcastEvent& broadcastEvent =
proxy->getTestPredefinedTypeBroadcastEvent();
@@ -250,8 +277,9 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
bool callbackArrived = false;
auto broadcastSubscription = broadcastEvent.subscribe([&,i](uint32_t intParam, std::string stringParam) {
- EXPECT_EQ(intParam, i);
- callbackArrived = true;
+ (void)stringParam;
+ EXPECT_EQ(intParam, i);
+ callbackArrived = true;
});
stub->fireTestPredefinedTypeBroadcastEvent(i, "xyz");
@@ -263,31 +291,32 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
ASSERT_TRUE(callbackArrived);
broadcastEvent.unsubscribe(broadcastSubscription);
- }
+ }
}
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWithOtherProxy) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
+TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWithOtherProxy) {
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ 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());
+ 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) {
- EXPECT_EQ(intParam, 1);
- callbackArrived = true;
+ auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)stringParam;
+ EXPECT_EQ(intParam, 1);
+ callbackArrived = true;
});
stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
@@ -300,16 +329,17 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
broadcastEvent.unsubscribe(broadcastSubscription);
- auto proxy2 = 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& broadcastEvent2 =
proxy->getTestPredefinedTypeBroadcastEvent();
callbackArrived = false;
- auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
- EXPECT_EQ(intParam, 2);
- callbackArrived = true;
+ auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)stringParam;
+ EXPECT_EQ(intParam, 2);
+ callbackArrived = true;
});
stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
@@ -320,79 +350,24 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
ASSERT_TRUE(callbackArrived);
- broadcastEvent.unsubscribe(broadcastSubscription2);
+ broadcastEvent.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanCancelSubscriptionAndSubscribeAgainWithOtherProxy) {
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
-
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
- for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
- 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) {
- EXPECT_EQ(intParam, 1);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(1, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- 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) {
- EXPECT_EQ(intParam, 2);
- callbackArrived = true;
- });
-
- stub->fireTestPredefinedTypeBroadcastEvent(2, "xyz");
-
- for(unsigned int i=0; i<100 && !callbackArrived; i++) {
- usleep(10000);
- }
-
- ASSERT_TRUE(callbackArrived);
-
- broadcastEvent2.unsubscribe(broadcastSubscription2);
-}
-
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhileOtherProxyIsStillSubscribed) {
+TEST_F(DBusBroadcastTest, ProxysCanUnsubscribeFromBroadcastAndSubscribeAgainWhileOtherProxyIsStillSubscribed) {
// register service
- auto stub = std::make_shared<SelectiveBroadcastSender>();
- serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- // build 2 proxies from same factory
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- auto proxy2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
+ // 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();
@@ -405,11 +380,15 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
// subscribe for each proxy's broadcast event
auto broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- callback1Arrived = true;
+ (void)intParam;
+ (void)stringParam;
+ callback1Arrived = true;
});
- auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
- callback2Arrived = true;
+ auto broadcastSubscription2 = broadcastEvent2.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)intParam;
+ (void)stringParam;
+ callback2Arrived = true;
});
// fire broadcast and wait for results
@@ -441,8 +420,10 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
EXPECT_TRUE(onlyCallback2Arrived);
// subscribe first proxy again
- broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
- callback1Arrived = true;
+ broadcastSubscription = broadcastEvent.subscribe([&](uint32_t intParam, std::string stringParam) {
+ (void)intParam;
+ (void)stringParam;
+ callback1Arrived = true;
});
// fire broadcast another time
@@ -460,35 +441,35 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanUnsubscribeFromBroadcastAndSubscribe
EXPECT_TRUE(callbackOnBothSubscriptionsArrivedAgain);
broadcastEvent.unsubscribe(broadcastSubscription);
- broadcastEvent2.unsubscribe(broadcastSubscription2);
+ broadcastEvent2.unsubscribe(broadcastSubscription2);
}
-TEST_F(DBusBroadcastTest, DISABLED_ProxysCanSubscribeForSelectiveBroadcast)
+TEST_F(DBusBroadcastTest, ProxysCanSubscribeForSelectiveBroadcast)
{
- auto proxyFromSameFactory1 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- ASSERT_TRUE((bool)proxyFromSameFactory1);
- auto proxyFromSameFactory2 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- ASSERT_TRUE((bool)proxyFromSameFactory2);
- auto proxyFromOtherFactory = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- ASSERT_TRUE((bool)proxyFromOtherFactory);
+ 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();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- for (unsigned int i = 0; !proxyFromSameFactory1->isAvailable() && i < 200; ++i) {
+ for (unsigned int i = 0; !proxyFromSameConnection->isAvailable() && i < 200; ++i) {
usleep(10000);
}
- ASSERT_TRUE(proxyFromSameFactory1->isAvailable());
+ ASSERT_TRUE(proxyFromSameConnection->isAvailable());
- auto subscriptionResult1 = proxyFromSameFactory1->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameFactory1, this));
+ auto subscriptionResult1 = proxyFromSameConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(
+ std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameConnection1, this));
usleep(20000);
ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
@@ -496,87 +477,189 @@ TEST_F(DBusBroadcastTest, DISABLED_ProxysCanSubscribeForSelectiveBroadcast)
stub->send();
usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory1, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory2, 0);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 1);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 0);
- auto subscriptionResult2 = proxyFromSameFactory2->getTestSelectiveBroadcastSelectiveEvent().subscribe(std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameFactory2, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1); // should still be one because these were created by the same factory thus using the same connection
+ 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(selectiveBroadcastArrivedAtProxyFromSameFactory1, 2);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory2, 1);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 2);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 1);
- proxyFromOtherFactory->getTestSelectiveBroadcastSelectiveEvent().subscribe(std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherFactory, this));
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 2); // should still be two because proxyFromSameFactory1_ is still subscribed
+ proxyFromOtherConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherConnection, this));
+ ASSERT_EQ(stub->getNumberOfSubscribedClients(), 2); // should still be two because proxyFromSameConnection1_ is still subscribed
- proxyFromSameFactory2->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult2);
- ASSERT_EQ(stub->getNumberOfSubscribedClients(), 2); // should still be two because proxyFromSameFactory1_ 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(selectiveBroadcastArrivedAtProxyFromSameFactory1, 3);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory2, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 1);
+ 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 factory) should receive the signal
+ // now only the last subscribed client (which is the one from the other connection) should receive the signal
stub->sendToLastSubscribedClient();
usleep(200000);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory1, 3);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory2, 1);
- EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 2);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection1, 3);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromSameConnection2, 1);
+ EXPECT_EQ(selectiveBroadcastArrivedAtProxyFromOtherConnection, 2);
- proxyFromSameFactory1->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult1);
- EXPECT_EQ(stub->getNumberOfSubscribedClients(), 1);
+ proxyFromSameConnection->getTestSelectiveBroadcastSelectiveEvent().unsubscribe(subscriptionResult1);
+ EXPECT_EQ(stub->getNumberOfSubscribedClients(), 1);
}
TEST_F(DBusBroadcastTest, ProxysCanBeRejectedForSelectiveBroadcast) {
- auto proxyFromSameFactory1 = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- ASSERT_TRUE((bool)proxyFromSameFactory1);
- auto proxyFromOtherFactory = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance());
- ASSERT_TRUE((bool)proxyFromOtherFactory);
+ 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();
+ auto stub = std::make_shared<SelectiveBroadcastSender>();
+ serviceAddressInterface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionId_);
+ 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, connectionId_);
+ serviceRegistered = runtime_->registerService(serviceAddressObject_.getDomain(), serviceAddressObject_.getInstance(), stub, connectionIdService_);
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
- for (unsigned int i = 0; !proxyFromSameFactory1->isAvailable() && i < 200; ++i) {
+ for (unsigned int i = 0; !proxyFromSameConnection1->isAvailable() && i < 200; ++i) {
usleep(10000);
}
- ASSERT_TRUE(proxyFromSameFactory1->isAvailable());
+ ASSERT_TRUE(proxyFromSameConnection1->isAvailable());
- bool subbed = false;
+ //bool subbed = false;
- proxyFromSameFactory1->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameFactory1, this));
+ proxyFromSameConnection1->getTestSelectiveBroadcastSelectiveEvent().subscribe(
+ std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromSameConnection1, this));
ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
//ASSERT_TRUE(subbed);
stub->acceptSubs = false;
- proxyFromOtherFactory->getTestSelectiveBroadcastSelectiveEvent().subscribe(
- std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherFactory, this));
+ proxyFromOtherConnection->getTestSelectiveBroadcastSelectiveEvent().subscribe(
+ std::bind(&DBusBroadcastTest::selectiveBroadcastCallbackForProxyFromOtherConnection, this));
ASSERT_EQ(stub->getNumberOfSubscribedClients(), 1);
//ASSERT_FALSE(subbed);
stub->send();
usleep(20000);
- ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromSameFactory1, 1);
- ASSERT_EQ(selectiveBroadcastArrivedAtProxyFromOtherFactory, 0);
+ 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());
+ 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);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusClientIdTest.cpp b/src/test/DBusClientIdTest.cpp
index 38d9d29..1a75943 100644
--- a/src/test/DBusClientIdTest.cpp
+++ b/src/test/DBusClientIdTest.cpp
@@ -29,6 +29,7 @@ public:
class TestClientId: public CommonAPI::ClientId {
public:
bool operator==(CommonAPI::ClientId& clientIdToCompare) {
+ (void)clientIdToCompare;
return false; // doesn't matter, as we are just comparing this class with DBusClientId;
}
diff --git a/src/test/DBusCommunicationTest.cpp b/src/test/DBusCommunicationTest.cpp
index 2471d5e..1642a36 100644
--- a/src/test/DBusCommunicationTest.cpp
+++ b/src/test/DBusCommunicationTest.cpp
@@ -30,14 +30,27 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
#define VERSION v1_0
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
class DBusCommunicationTest: public ::testing::Test {
protected:
virtual void SetUp() {
@@ -46,19 +59,19 @@ class DBusCommunicationTest: public ::testing::Test {
}
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_);
+ 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_;
+ std::string interface_;
- static const std::string domain_;
+ static const std::string domain_;
static const std::string serviceAddress_;
static const std::string serviceAddress2_;
static const std::string serviceAddress3_;
@@ -77,15 +90,15 @@ const std::string DBusCommunicationTest::serviceAddress5_ = "CommonAPI.DBus.test
TEST_F(DBusCommunicationTest, RemoteMethodCallSucceeds) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress_);
+ 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();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -100,20 +113,20 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallSucceeds) {
CommonAPI::CallStatus stat;
defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
+ 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");
+ 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");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
usleep(10000);
}
@@ -122,17 +135,17 @@ TEST_F(DBusCommunicationTest, AccessStubAdapterAfterInitialised) {
}
TEST_F(DBusCommunicationTest, AccessStubAdapterBeforeInitialised) {
- auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- interface_ = stub->getStubAdapter()->getInterface();
+ 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");
+ 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");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
usleep(10000);
}
@@ -140,28 +153,28 @@ TEST_F(DBusCommunicationTest, AccessStubAdapterBeforeInitialised) {
}
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_);
+ 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();
+ 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");
+ 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");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
}
if (!serviceRegistered2) {
- serviceRegistered2 = runtime_->registerService(domain_, serviceAddress2_, stub, "connection");
+ serviceRegistered2 = runtime_->registerService(domain_, serviceAddress2_, stub, "connection");
}
if (!serviceRegistered3) {
- serviceRegistered3 = runtime_->registerService(domain_, serviceAddress3_, stub, "connection");
+ serviceRegistered3 = runtime_->registerService(domain_, serviceAddress3_, stub, "connection");
}
usleep(10000);
}
@@ -185,20 +198,20 @@ TEST_F(DBusCommunicationTest, SameStubCanBeRegisteredSeveralTimes) {
EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
EXPECT_EQ(stat2, CommonAPI::CallStatus::SUCCESS);
- EXPECT_EQ(stat3, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(stat3, CommonAPI::CallStatus::SUCCESS);
}
TEST_F(DBusCommunicationTest, RemoteMethodCallWithNonstandardAddressSucceeds) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, nonstandardAddress_);
+ 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();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
+ bool serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
+ serviceRegistered = runtime_->registerService(domain_, nonstandardAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -213,20 +226,20 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallWithNonstandardAddressSucceeds) {
CommonAPI::CallStatus stat;
defaultTestProxy->testVoidPredefinedTypeMethod(v1, v2, stat);
- EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
+ EXPECT_EQ(stat, CommonAPI::CallStatus::SUCCESS);
}
TEST_F(DBusCommunicationTest, MixedSyncAndAsyncCallsSucceed) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress5_);
+ 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();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
for(unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress5_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -255,20 +268,20 @@ TEST_F(DBusCommunicationTest, MixedSyncAndAsyncCallsSucceed) {
for (unsigned int i = 0; i < 500 && responseCounter < 10; i++) {
usleep(1000);
}
- EXPECT_EQ(10, responseCounter);
+ EXPECT_EQ(10, responseCounter);
}
TEST_F(DBusCommunicationTest, RemoteMethodCallHeavyLoad) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, serviceAddress4_);
+ 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();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
for (unsigned int i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -285,17 +298,17 @@ TEST_F(DBusCommunicationTest, RemoteMethodCallHeavyLoad) {
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_);
+ 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();
+ auto stub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ interface_ = stub->getStubAdapter()->getInterface();
- bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress4_, stub, "connection");
ASSERT_TRUE(serviceRegistered);
@@ -416,8 +429,8 @@ class DBusLowLevelCommunicationTest: public ::testing::Test {
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);
+ 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>();
@@ -427,46 +440,47 @@ class DBusLowLevelCommunicationTest: public ::testing::Test {
std::shared_ptr<CommonAPI::DBus::DBusObjectManagerStub> rootDBusObjectManagerStub = dbusConnection->getDBusObjectManager()->getRootDBusObjectManagerStub();
+ rootDBusObjectManagerStub->exportManagedDBusStubAdapter(dbusStubAdapter);
+
const auto dbusObjectManager = dbusConnection->getDBusObjectManager();
dbusObjectManager->registerDBusStubAdapter(dbusStubAdapter);
- rootDBusObjectManagerStub->exportManagedDBusStubAdapter(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 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.DBus.tests.DBusProxyTestInterface:CommonAPI.DBus.tests.DBusProxyLowLevelService";
+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.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
+ &onLibdbusObjectPathMessageThunk,
+ NULL, NULL, NULL, NULL
};
}
-TEST_F(DBusLowLevelCommunicationTest, DISABLED_AgressiveNameClaimingOfServicesIsHandledCorrectly) {
- std::shared_ptr<CommonAPI::DBus::DBusConnection> connection1 = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
- std::shared_ptr<CommonAPI::DBus::DBusConnection> connection2 = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
-
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, lowLevelAddressInstance_);
+TEST_F(DBusLowLevelCommunicationTest, AgressiveNameClaimingOfServicesIsHandledCorrectly) {
+ auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain_, lowLevelAddressInstance_);
ASSERT_TRUE((bool)defaultTestProxy);
uint32_t counter = 0;
@@ -560,6 +574,7 @@ TEST_F(DBusLowLevelCommunicationTest, DISABLED_AgressiveNameClaimingOfServicesIs
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusConnectionTest.cpp b/src/test/DBusConnectionTest.cpp
index 9c8212e..bb2e60b 100644
--- a/src/test/DBusConnectionTest.cpp
+++ b/src/test/DBusConnectionTest.cpp
@@ -30,7 +30,7 @@ class DBusConnectionTest: public ::testing::Test {
protected:
virtual void SetUp() {
- dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+ dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
}
virtual void TearDown() {
@@ -98,7 +98,7 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
const char interfaceName[] = "commonapi.dbus.test.TestInterface";
const char methodName[] = "TestMethod";
- auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+ auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(interfaceHandlerDBusConnection->connect());
ASSERT_TRUE(interfaceHandlerDBusConnection->requestServiceNameAndBlock(service));
@@ -121,7 +121,7 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
for (uint32_t expectedDBusMessageCount = 1; expectedDBusMessageCount <= 10; expectedDBusMessageCount++) {
CommonAPI::DBus::DBusMessage dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- CommonAPI::DBus::DBusAddress(service, objectPath, interfaceName),
+ CommonAPI::DBus::DBusAddress(service, objectPath, interfaceName),
methodName,
"");
@@ -137,7 +137,7 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
&CommonAPI::DBus::defaultCallInfo);
for (int i = 0; i < 100; i++) {
- usleep(10);
+ usleep(10);
}
ASSERT_EQ(serviceHandlerDBusMessageCount, expectedDBusMessageCount);
@@ -153,13 +153,13 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorks) {
interfaceHandlerDBusConnection->disconnect();
}
-TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorksManualDispatch) {
+/*TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorksManualDispatch) {
const char service[] = "commonapi.dbus.test.TestInterface_commonapi.dbus.test.TestObject";
const char objectPath[] = "/commonapi/dbus/test/TestObject";
- const char interfaceName[] = "commonapi.dbus.test.TestInterface";
+ const char interfaceName[] = "commonapi.dbus.test.TestInterface";
const char methodName[] = "TestMethod";
- auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+ auto interfaceHandlerDBusConnection = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(interfaceHandlerDBusConnection->connect(false));
ASSERT_TRUE(interfaceHandlerDBusConnection->requestServiceNameAndBlock(service));
@@ -182,7 +182,7 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorksManualDispatch) {
for (uint32_t expectedDBusMessageCount = 1; expectedDBusMessageCount <= 10; expectedDBusMessageCount++) {
CommonAPI::DBus::DBusMessage dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- CommonAPI::DBus::DBusAddress(service, objectPath, interfaceName),
+ CommonAPI::DBus::DBusAddress(service, objectPath, interfaceName),
methodName,
"");
@@ -216,7 +216,7 @@ TEST_F(DBusConnectionTest, SendingAsyncDBusMessagesWorksManualDispatch) {
ASSERT_TRUE(interfaceHandlerDBusConnection->releaseServiceName(service));
interfaceHandlerDBusConnection->disconnect();
-}
+}*/
void dispatch(::DBusConnection* libdbusConnection) {
diff --git a/src/test/DBusDaemonProxyTest.cpp b/src/test/DBusDaemonProxyTest.cpp
index 629f4ae..cf28b74 100644
--- a/src/test/DBusDaemonProxyTest.cpp
+++ b/src/test/DBusDaemonProxyTest.cpp
@@ -21,7 +21,7 @@ namespace {
class DBusDaemonProxyTest: public ::testing::Test {
protected:
virtual void SetUp() {
- dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+ dbusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(dbusConnection_->connect());
dbusDaemonProxy_ = std::make_shared<CommonAPI::DBus::DBusDaemonProxy>(dbusConnection_);
}
@@ -47,7 +47,7 @@ TEST_F(DBusDaemonProxyTest, ListNames) {
}
}
-TEST_F(DBusDaemonProxyTest, DISABLED_ListNamesAsync) {
+TEST_F(DBusDaemonProxyTest, ListNamesAsync) {
std::promise<std::tuple<CommonAPI::CallStatus, std::vector<std::string>>>promise;
auto future = promise.get_future();
@@ -75,7 +75,7 @@ TEST_F(DBusDaemonProxyTest, DISABLED_ListNamesAsync) {
}
}
-TEST_F(DBusDaemonProxyTest, DISABLED_NameHasOwner) {
+TEST_F(DBusDaemonProxyTest, NameHasOwner) {
bool nameHasOwner;
CommonAPI::CallStatus callStatus;
@@ -112,7 +112,7 @@ TEST_F(DBusDaemonProxyTest, NameHasOwnerAsync) {
ASSERT_TRUE(nameHasOwner);
}
-TEST_F(DBusDaemonProxyTest, DISABLED_NameOwnerChangedEvent) {
+TEST_F(DBusDaemonProxyTest, NameOwnerChangedEvent) {
std::promise<bool> promise;
auto future = promise.get_future();
@@ -126,7 +126,7 @@ TEST_F(DBusDaemonProxyTest, DISABLED_NameOwnerChangedEvent) {
});
// Trigger NameOwnerChanged using a new DBusConnection
- ASSERT_TRUE(CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION)->connect());
+ ASSERT_TRUE(CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION)->connect());
ASSERT_TRUE(future.get());
diff --git a/src/test/DBusFactoryTest.cpp b/src/test/DBusFactoryTest.cpp
index 43f00e1..866130a 100644
--- a/src/test/DBusFactoryTest.cpp
+++ b/src/test/DBusFactoryTest.cpp
@@ -29,11 +29,11 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
#define VERSION v1_0
@@ -47,6 +47,18 @@ static const std::string fileString =
"dbus_bustype=system\n"
"";
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
class DBusProxyFactoryTest: public ::testing::Test {
protected:
@@ -55,14 +67,16 @@ class DBusProxyFactoryTest: public ::testing::Test {
ASSERT_TRUE((bool)runtime_);
#ifdef WIN32
- configFileName_ = _pgmptr;
+ configFileName_ = _pgmptr;
#else
- char cCurrentPath[FILENAME_MAX];
- getcwd(cCurrentPath, sizeof(cCurrentPath));
- configFileName_ = cCurrentPath;
+ char cCurrentPath[FILENAME_MAX];
+ if(getcwd(cCurrentPath, sizeof(cCurrentPath)) == NULL) {
+ std::perror("DBusProxyFactoryTest::SetUp");
+ }
+ configFileName_ = cCurrentPath;
#endif
- configFileName_ += DBUS_CONFIG_SUFFIX;
+ configFileName_ += DBUS_CONFIG_SUFFIX;
std::ofstream configFile(configFileName_);
ASSERT_TRUE(configFile.is_open());
configFile << fileString;
@@ -108,12 +122,12 @@ TEST_F(DBusProxyFactoryTest, DBusFactoryCanBeCreated) {
}
TEST_F(DBusProxyFactoryTest, CreatesDefaultTestProxy) {
- auto defaultTestProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>("local", "commonapi.tests.TestInterface");
+ 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");
+ auto defaultTestProxy = runtime_->buildProxyWithDefaultAttributeExtension<VERSION::commonapi::tests::TestInterfaceProxy, myExtensions::AttributeTestExtension>("local", "commonapi.tests.TestInterface");
ASSERT_TRUE((bool)defaultTestProxy);
auto attributeExtension = defaultTestProxy->getTestDerivedArrayAttributeAttributeExtension();
@@ -121,9 +135,9 @@ TEST_F(DBusProxyFactoryTest, CreatesDefaultExtendedTestProxy) {
}
TEST_F(DBusProxyFactoryTest, CreatesIndividuallyExtendedTestProxy) {
- auto specificAttributeExtendedTestProxy = runtime_->buildProxy<
- VERSION::commonapi::tests::TestInterfaceProxy,
- VERSION::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<myExtensions::AttributeTestExtension> >
+ auto specificAttributeExtendedTestProxy = runtime_->buildProxy<
+ VERSION::commonapi::tests::TestInterfaceProxy,
+ VERSION::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<myExtensions::AttributeTestExtension> >
("local", "commonapi.tests.TestInterface");
ASSERT_TRUE((bool)specificAttributeExtendedTestProxy);
@@ -138,6 +152,7 @@ TEST_F(DBusProxyFactoryTest, CreateNamedFactory) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusFreedesktopPropertiesTest.cpp b/src/test/DBusFreedesktopPropertiesTest.cpp
index 5ee5cbc..19cfb6e 100644
--- a/src/test/DBusFreedesktopPropertiesTest.cpp
+++ b/src/test/DBusFreedesktopPropertiesTest.cpp
@@ -12,23 +12,37 @@
#endif
#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceProxy.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.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.DBus.tests.DBusProxyTestFreedesktopPropertiesInterface";
+static const std::string commonApiAddress = "commonapi.tests.TestFreedesktopInterface";
+static const std::string commonApiDerivedAddress = "commonapi.tests.TestFreedesktopDerivedInterface";
+
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
class FreedesktopPropertiesTest: public ::testing::Test {
protected:
void SetUp() {
runtime = CommonAPI::Runtime::get();
- proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopInterfaceProxy>(domain, commonApiAddress);
+ proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopInterfaceProxy>(domain, commonApiAddress, "client");
registerTestStub();
@@ -44,21 +58,21 @@ protected:
}
void registerTestStub() {
- testStub_ = std::make_shared<VERSION::commonapi::tests::TestFreedesktopInterfaceStubDefault>();
- const bool isServiceRegistered = runtime->registerService(domain, commonApiAddress, testStub_, "connection");
+ 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);
+ 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_;
+ 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) {
@@ -100,10 +114,16 @@ 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) {
- ASSERT_EQ(7, value);
- callbackArrived = true;
+ // the first call is for the initial value. Ignore it.
+ if (initialCall) {
+ initialCall = false;
+ } else {
+ ASSERT_EQ(8, value);
+ callbackArrived = true;
+ }
});
usleep(200000);
@@ -112,11 +132,11 @@ TEST_F(FreedesktopPropertiesTest, CanSendAndReceiveNotificationForSingleProperty
CommonAPI::CallStatus callStatus = CommonAPI::CallStatus::REMOTE_ERROR;
uint32_t value;
- uint32_t newValue = 7;
+ uint32_t newValue = 8;
testAttribute.setValue(newValue, callStatus, value);
ASSERT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
- ASSERT_EQ(value, 7);
+ ASSERT_EQ(value, 8);
uint8_t waitCounter = 0;
@@ -133,7 +153,7 @@ protected:
void SetUp() {
runtime = CommonAPI::Runtime::get();
- proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceProxy>(domain, commonApiAddress);
+ proxy_ = runtime->buildProxy<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceProxy>(domain, commonApiDerivedAddress, "client");
registerTestStub();
@@ -149,21 +169,21 @@ protected:
}
void registerTestStub() {
- testStub_ = std::make_shared<VERSION::commonapi::tests::TestFreedesktopDerivedInterfaceStubDefault>();
- const bool isServiceRegistered = runtime->registerService(domain, commonApiAddress, testStub_, "connection");
+ 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(), commonApiAddress);
+ 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_;
+ 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) {
@@ -215,6 +235,7 @@ TEST_F(FreedesktopPropertiesOnInheritedInterfacesTest, CanGetAndSetRemoteAttribu
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusInputStreamTest.cpp b/src/test/DBusInputStreamTest.cpp
index 9a6a0f3..ee3b7a0 100644
--- a/src/test/DBusInputStreamTest.cpp
+++ b/src/test/DBusInputStreamTest.cpp
@@ -238,51 +238,52 @@ TEST_F(InputStreamTest, ReadsStrings) {
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) {
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- }
+ 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_));
+ 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
@@ -303,7 +304,7 @@ TEST_F(InputStreamTest, ReadsStructs) {
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();
+ 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);
@@ -435,7 +436,7 @@ TEST_F(InputStreamTest, ReadsInt32Variants) {
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<int32_t, double, std::string>*>(nullptr));
+ 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>());
@@ -474,7 +475,7 @@ TEST_F(InputStreamTest, ReadsStringVariants) {
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<int32_t, double, std::string>*>(nullptr));
+ inStream.readValue(readVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
std::string actualResult = readVariant.get<std::string>();
@@ -528,7 +529,7 @@ TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStrings) {
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<int32_t, double, std::vector<std::string>>*>(nullptr));
+ 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>>();
@@ -553,7 +554,7 @@ TEST_F(InputStreamTest, ReadsVariantsWithVariants) {
int8_t innerVariant1TypeIndex = 1;
int8_t innerVariant2TypeIndex = 3;
- const uint32_t byteBufferElementCount = numOfElements*10;
+ const uint32_t byteBufferElementCount = static_cast<uint32_t>(numOfElements*10);
CommonAPI::ByteBuffer innerVariant1Value;
for (unsigned int i = 0; i < byteBufferElementCount; ++i) {
@@ -638,8 +639,8 @@ TEST_F(InputStreamTest, ReadsVariantsWithVariants) {
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::ByteBuffer>>*>(nullptr));
- inStream.readValue(readVariant2, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment, CommonAPI::ByteBuffer>>*>(nullptr));
+ 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);
@@ -724,12 +725,12 @@ TEST_F(InputStreamTest, ReadsVariantsWithStructs) {
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);
+ 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;
@@ -752,8 +753,8 @@ TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStructs) {
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_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());
@@ -784,11 +785,11 @@ TEST_F(InputStreamTest, ReadsVariantsWithAnArrayOfStructs) {
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.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);
diff --git a/src/test/DBusLoadTest.cpp b/src/test/DBusLoadTest.cpp
index fdd0351..3eed056 100644
--- a/src/test/DBusLoadTest.cpp
+++ b/src/test/DBusLoadTest.cpp
@@ -29,24 +29,38 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.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) {
- uint32_t uint32OutValue = _uint32InValue;
- std::string stringOutValue = _stringInValue;
- _reply(uint32OutValue, stringOutValue);
- }
+ 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 Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
};
class DBusLoadTest: public ::testing::Test {
@@ -84,7 +98,7 @@ public:
std::vector<bool> callSucceeded_;
std::mutex mutexCallSucceeded_;
- static const std::string domain_;
+ static const std::string domain_;
static const std::string serviceAddress_;
static const uint32_t numCallsPerProxy_;
static const uint32_t numProxies_;
@@ -103,17 +117,17 @@ const uint32_t DBusLoadTest::numProxies_ = 65;
// Multiple proxies in one thread, one stub
TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
- std::array<std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxyBase>, numProxies_> testProxies;
+ 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_);
+ 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");
+ bool serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
for (auto i = 0; !serviceRegistered && i < 100; ++i) {
- serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
usleep(10000);
}
ASSERT_TRUE(serviceRegistered);
@@ -138,14 +152,14 @@ TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
in1,
in2,
std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
+ &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
+ this,
+ callId++,
+ in1,
+ in2,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3));
}
}
@@ -157,23 +171,23 @@ TEST_F(DBusLoadTest, SingleClientMultipleProxiesSingleStubCallsSucceed) {
}
ASSERT_TRUE(allCallsSucceeded);
- runtime_->unregisterService(domain_, stub->getStubAdapter()->getInterface(), serviceAddress_);
+ 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;
+ 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_);
+ 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");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_, stub, "connection");
if(!serviceRegistered)
usleep(10000);
}
@@ -198,15 +212,15 @@ TEST_F(DBusLoadTest, MultipleClientsSingleStubCallsSucceed) {
testProxies[j]->testPredefinedTypeMethodAsync(
in1,
in2,
- std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
+ std::bind(
+ &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
+ this,
+ callId++,
+ in1,
+ in2,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3));
}
}
@@ -218,18 +232,18 @@ TEST_F(DBusLoadTest, MultipleClientsSingleStubCallsSucceed) {
}
ASSERT_TRUE(allCallsSucceeded);
- runtime_->unregisterService(domain_, stub->getStubAdapter()->getInterface(), serviceAddress_);
+ 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;
+ 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));
+ testProxies[i] = runtime_->buildProxy < VERSION::commonapi::tests::TestInterfaceProxy >(domain_, serviceAddress_ + std::to_string(i));
ASSERT_TRUE((bool )testProxies[i]);
}
@@ -238,7 +252,7 @@ TEST_F(DBusLoadTest, MultipleClientsMultipleServersCallsSucceed) {
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");
+ serviceRegistered = runtime_->registerService(domain_, serviceAddress_ + std::to_string(i), testStubs[i], "connection");
if(!serviceRegistered)
usleep(10000);
}
@@ -265,14 +279,14 @@ TEST_F(DBusLoadTest, MultipleClientsMultipleServersCallsSucceed) {
in1,
in2,
std::bind(
- &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
- this,
- callId++,
- in1,
- in2,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3));
+ &DBusLoadTest::TestPredefinedTypeMethodAsyncCallback,
+ this,
+ callId++,
+ in1,
+ in2,
+ std::placeholders::_1,
+ std::placeholders::_2,
+ std::placeholders::_3));
}
}
@@ -285,13 +299,14 @@ TEST_F(DBusLoadTest, MultipleClientsMultipleServersCallsSucceed) {
ASSERT_TRUE(allCallsSucceeded);
for (unsigned int i = 0; i < numProxies_; i++) {
- runtime_->unregisterService(domain_, testStubs[i]->getStubAdapter()->getInterface(), serviceAddress_ + std::to_string(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);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusMainLoopIntegrationTest.cpp b/src/test/DBusMainLoopIntegrationTest.cpp
index a7a364e..341870c 100644
--- a/src/test/DBusMainLoopIntegrationTest.cpp
+++ b/src/test/DBusMainLoopIntegrationTest.cpp
@@ -33,11 +33,11 @@
#include "commonapi/tests/PredefinedTypeCollection.hpp"
#include "commonapi/tests/DerivedTypeCollection.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceStubDefault.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceDBusProxy.hpp"
const std::string domain = "local";
const std::string testAddress1 = "commonapi.address.one";
@@ -53,6 +53,19 @@ const std::string testAddress8 = "commonapi.address.eight";
//####################################################################################################################
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
class DBusBasicMainLoopTest: public ::testing::Test {
protected:
virtual void SetUp() {
@@ -66,6 +79,7 @@ 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() {
@@ -85,7 +99,7 @@ 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>();
+ std::shared_ptr<CommonAPI::MainLoopContext> context = std::make_shared<CommonAPI::MainLoopContext>();
ASSERT_TRUE((bool) context);
auto mainLoop = new CommonAPI::MainLoop(context);
@@ -120,7 +134,7 @@ protected:
runtime_ = CommonAPI::Runtime::get();
ASSERT_TRUE((bool) runtime_);
- context_ = std::make_shared<CommonAPI::MainLoopContext>();
+ context_ = std::make_shared<CommonAPI::MainLoopContext>();
ASSERT_TRUE((bool) context_);
mainLoop_ = new CommonAPI::MainLoop(context_);
}
@@ -137,10 +151,10 @@ protected:
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_));
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ ASSERT_TRUE(runtime_->registerService(domain, testAddress1, stub, context_));
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress1, "connection");
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress1, "connection");
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -168,13 +182,13 @@ TEST_F(DBusMainLoopTest, ServiceInDemoMainloopCanBeAddressed) {
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"));
+ 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_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress2, context_);
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -198,15 +212,15 @@ TEST_F(DBusMainLoopTest, ProxyInDemoMainloopCanCallMethods) {
ASSERT_EQ(toString(CommonAPI::CallStatus::SUCCESS), toString(futureStatus.get()));
- runtime_->unregisterService(domain, stub->getStubAdapter()->getInterface(), testAddress2);
+ 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_));
+ 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_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress4, context_);
ASSERT_TRUE((bool) proxy);
while (!proxy->isAvailable()) {
@@ -246,7 +260,7 @@ class BigDataTestStub : public VERSION::commonapi::tests::TestInterfaceStubDefau
};
TEST_F(DBusMainLoopTest, DemoMainloopClientsHandleNonavailableServices) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress3, context_);
+ auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress3, context_);
ASSERT_TRUE((bool) proxy);
uint32_t uint32Value = 42;
@@ -273,6 +287,7 @@ class GDispatchWrapper: public GSource {
};
gboolean dispatchPrepare(GSource* source, gint* timeout) {
+ (void)timeout;
int64_t eventTimeout;
return static_cast<GDispatchWrapper*>(source)->dispatchSource_->prepare(eventTimeout);
}
@@ -282,11 +297,14 @@ gboolean dispatchCheck(GSource* source) {
}
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;
@@ -301,6 +319,8 @@ static GSourceFuncs standardGLibSourceCallbackFuncs = {
dispatchPrepare,
dispatchCheck,
dispatchExecute,
+ NULL,
+ NULL,
NULL
};
@@ -350,6 +370,7 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
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);
@@ -390,7 +411,8 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
}
void timeoutAddedCallback(CommonAPI::Timeout* commonApiTimeoutSource, const CommonAPI::DispatchPriority dispatchPriority) {
- GSource* gTimeoutSource = g_timeout_source_new(commonApiTimeoutSource->getTimeoutInterval());
+ (void)dispatchPriority;
+ GSource* gTimeoutSource = g_timeout_source_new(guint(commonApiTimeoutSource->getTimeoutInterval()));
g_source_set_callback(gTimeoutSource, &gTimeoutDispatcher, commonApiTimeoutSource, NULL);
g_source_attach(gTimeoutSource, NULL);
}
@@ -406,11 +428,11 @@ class DBusInGLibMainLoopTest: public ::testing::Test {
TEST_F(DBusInGLibMainLoopTest, ProxyInGLibMainloopCanCallMethods) {
- auto proxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, testAddress5, context_);
+ 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>();
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
ASSERT_TRUE(runtime_->registerService(domain, testAddress5, stub, "connection"));
while(!proxy->isAvailable()) {
@@ -446,7 +468,7 @@ TEST_F(DBusInGLibMainLoopTest, ServiceInGLibMainloopCanBeAddressed) {
ASSERT_TRUE((bool) proxy);
std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
ASSERT_TRUE(runtime_->registerService(domain, testAddress6, stub, context_));
uint32_t uint32Value = 42;
@@ -485,7 +507,7 @@ TEST_F(DBusInGLibMainLoopTest, ProxyAndServiceInSameGlibMainloopCanCommunicate)
ASSERT_TRUE((bool) proxy);
std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub = std::make_shared<
- VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ VERSION::commonapi::tests::TestInterfaceStubDefault>();
ASSERT_TRUE(runtime_->registerService(domain, testAddress7, stub, context_));
uint32_t uint32Value = 42;
@@ -522,6 +544,7 @@ TEST_F(DBusInGLibMainLoopTest, ProxyAndServiceInSameGlibMainloopCanCommunicate)
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusManagedTest.cpp b/src/test/DBusManagedTest.cpp
index 5c0fa12..e50d78e 100644
--- a/src/test/DBusManagedTest.cpp
+++ b/src/test/DBusManagedTest.cpp
@@ -18,17 +18,17 @@
#include <CommonAPI/ProxyManager.hpp>
-#include "v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/managed/SecondRootStubDefault.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_0/commonapi/tests/managed/RootInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp"
-#include "v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp"
+#include "v1/commonapi/tests/managed/RootInterfaceProxy.hpp"
+#include "v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp"
+#include "v1/commonapi/tests/managed/LeafInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp"
-#include "v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp"
+#include "v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp"
#include <gtest/gtest.h>
#include <algorithm>
@@ -115,6 +115,19 @@ bool isManaged(const std::string& _objectPath, const std::string& _interfaceName
return false;
}
+class Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
class DBusManagedTest: public ::testing::Test {
protected:
virtual void SetUp() {
@@ -138,6 +151,7 @@ protected:
public:
void managedObjectSignalled(std::string address, CommonAPI::AvailabilityStatus status) {
+ (void)address;
leafStatus_ = status;
}
};
@@ -552,10 +566,12 @@ protected:
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;
}
};
@@ -568,7 +584,7 @@ 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_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
ASSERT_TRUE(registerRootStubForSuffix("One"));
@@ -623,7 +639,7 @@ TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsOnSameObjectPathAnd
/* set environment variable (default config: commonapi-dbus.ini) to
* to register the roots on the same object path
*/
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
ASSERT_TRUE(registerRootStubForSuffix("One"));
@@ -657,7 +673,7 @@ TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsOnSameObjectPathAnd
ASSERT_TRUE(allRootProxiesAreAvailable);
CommonAPI::CallStatus callStatus;
- CommonAPI::CallInfo *info;
+ CommonAPI::CallInfo *info = NULL;
VERSION::commonapi::tests::managed::RootInterface::testRootMethodError applicationError;
int32_t outInt;
std::string outString;
@@ -703,7 +719,7 @@ TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsAndSeveralLeafsForE
/* set environment variable (default config: commonapi-dbus.ini) to
* to register the roots on the same object path
*/
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
ASSERT_TRUE(registerRootStubForSuffix("One"));
@@ -762,7 +778,7 @@ TEST_F(DBusManagedTestExtended, DISABLED_RegisterSeveralRootsAndSeveralLeafsForE
/* set environment variable (default config: commonapi-dbus.ini) to
* to register the roots on the same object path
*/
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
ASSERT_TRUE(registerRootStubForSuffix("One"));
@@ -1354,7 +1370,7 @@ TEST_F(DBusManagedTestExtended, RegisterLeafsWithAutoGeneratedInstanceIdsAndComm
TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceUnmanaged) {
//set environment variable (default config: commonapi-dbus.ini)
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
@@ -1397,7 +1413,7 @@ TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceUnmanaged) {
TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceManaged) {
//set environment variable (default config: commonapi-dbus.ini)
- const char *defaultConfigSet = getenv("COMMONAPI_DBUS_DEFAULT_CONFIG");
+ const char *defaultConfigSet = getenv("COMMONAPI_DBUS_CONFIG");
ASSERT_TRUE(defaultConfigSet);
auto rootStub = std::make_shared<VERSION::commonapi::tests::managed::RootInterfaceStubDefault>();
@@ -1480,6 +1496,7 @@ TEST_F(DBusManagedTestExtended, ConfigurationFileAffectsInterfaceManaged) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusMultipleConnectionTest.cpp b/src/test/DBusMultipleConnectionTest.cpp
index f482267..c27f1fc 100644
--- a/src/test/DBusMultipleConnectionTest.cpp
+++ b/src/test/DBusMultipleConnectionTest.cpp
@@ -24,26 +24,39 @@
#define VERSION v1_0
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
+#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 Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
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");
+ 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");
+ serviceNameAcquired = runtime->registerService(domain, serviceAddress, stub, "connection");
}
ASSERT_TRUE(serviceNameAcquired);
- proxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, serviceAddress);
+ proxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, serviceAddress);
ASSERT_TRUE((bool)proxy);
for(unsigned int i = 0; !proxy->isAvailable() && i < 100; ++i) {
@@ -52,13 +65,13 @@ class DBusMultipleConnectionTest: public ::testing::Test {
}
virtual void TearDown() {
- runtime->unregisterService(domain, stub->getStubAdapter()->getInterface(), serviceAddress);
+ 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;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stub;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxy;
};
@@ -80,6 +93,7 @@ TEST_F(DBusMultipleConnectionTest, Broadcast) {
auto subscription = proxy->getTestPredefinedTypeBroadcastEvent().subscribe([&](
const uint32_t intVal, const std::string& strVal) {
+ (void)strVal;
v3 = intVal;
promise.set_value(true);
});
@@ -105,12 +119,18 @@ 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);
});
@@ -137,6 +157,7 @@ TEST_F(DBusMultipleConnectionTest, GetAttribute) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusObjectManagerStubTest.cpp b/src/test/DBusObjectManagerStubTest.cpp
deleted file mode 100644
index 694887a..0000000
--- a/src/test/DBusObjectManagerStubTest.cpp
+++ /dev/null
@@ -1,490 +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 <gtest/gtest.h>
-#include <algorithm>
-#include <array>
-#include <memory>
-
-static const std::string dbusServiceName = "CommonAPI.DBus.DBusObjectManagerStubTest";
-static const std::string& dbusObjectManagerStubPath = "/commonapi/dbus/test/DBusObjectManagerStub";
-static const std::string& managedDBusObjectPathPrefix = "/commonapi/dbus/test/DBusObjectManagerStub/ManagedObject";
-
-class TestDBusStubAdapter: public CommonAPI::DBus::DBusStubAdapter {
-public:
- TestDBusStubAdapter(const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const bool isManagingInterface) :
- DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusServiceName, dbusObjectPath, "commonapi.dbus.tests.TestDBusStubAdapter"),
- dbusConnection,
- isManagingInterface) {
- }
-
- void deactivateManagedInstances() {
-
- }
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const {
- return "";
- }
-
- virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return false;
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return false;
- }
-
-protected:
- TestDBusStubAdapter(const std::string& dbusObjectPath,
- const std::string& dbusInterfaceName,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection,
- const bool isManagingInterface) :
- DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusServiceName, dbusObjectPath, dbusInterfaceName),
- dbusConnection,
- isManagingInterface) {
- }
-
-};
-
-class ManagerTestDBusStubAdapter: public TestDBusStubAdapter {
-public:
- ManagerTestDBusStubAdapter(const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection) :
- TestDBusStubAdapter(
- dbusObjectPath,
- "commonapi.dbus.tests.ManagerTestDBusStubAdapter",
- dbusConnection,
- true) {
- }
-};
-
-struct TestDBusObjectManagerSignalHandler: public CommonAPI::DBus::DBusConnection::DBusSignalHandler {
- size_t totalAddedCount;
- size_t totalRemovedCount;
-
- std::string lastAddedDBusObjectPath;
- std::string lastRemovedDBusObjectPath;
-
- std::condition_variable signalReceived;
- std::mutex lock;
-
- ~TestDBusObjectManagerSignalHandler() {
- dbusConnection_->removeSignalMemberHandler(dbusSignalHandlerAddedToken_);
- dbusConnection_->removeSignalMemberHandler(dbusSignalHandlerRemovedToken_);
- }
-
- virtual CommonAPI::SubscriptionStatus onSignalDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- if (!dbusMessage.hasInterfaceName(CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName())) {
- return CommonAPI::SubscriptionStatus::CANCEL;
- }
-
- if (!dbusMessage.hasMemberName("InterfacesAdded") && !dbusMessage.hasMemberName("InterfacesRemoved")) {
- return CommonAPI::SubscriptionStatus::CANCEL;
- }
-
- CommonAPI::DBus::DBusInputStream dbusInputStream(dbusMessage);
- std::lock_guard<std::mutex> lockGuard(lock);
-
- if (dbusMessage.hasMemberName("InterfacesAdded")) {
- totalAddedCount++;
- dbusInputStream >> lastAddedDBusObjectPath;
- } else {
- totalRemovedCount++;
- dbusInputStream >> lastRemovedDBusObjectPath;
- }
-
- signalReceived.notify_all();
-
- return CommonAPI::SubscriptionStatus::RETAIN;
- }
-
- static inline std::shared_ptr<TestDBusObjectManagerSignalHandler> create(
- const std::string& dbusObjectPath,
- const std::shared_ptr<
- CommonAPI::DBus::DBusProxyConnection>& dbusConnection) {
- auto dbusSignalHandler = new TestDBusObjectManagerSignalHandler(dbusObjectPath, dbusConnection);
- dbusSignalHandler->init();
- return std::shared_ptr<TestDBusObjectManagerSignalHandler>(dbusSignalHandler);
- }
-
-private:
- TestDBusObjectManagerSignalHandler(const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection) :
- totalAddedCount(0),
- totalRemovedCount(0),
- dbusObjectPath_(dbusObjectPath),
- dbusConnection_(dbusConnection) {
- }
-
- void init() {
- dbusSignalHandlerAddedToken_ = dbusConnection_->addSignalMemberHandler(
- dbusObjectPath_,
- CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName(),
- "InterfacesAdded",
- "oa{sa{sv}}",
- this,
- false);
-
- dbusSignalHandlerRemovedToken_ = dbusConnection_->addSignalMemberHandler(
- dbusObjectPath_,
- CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName(),
- "InterfacesRemoved",
- "oas",
- this,
- false);
- }
-
- std::string dbusObjectPath_;
- std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> dbusConnection_;
- CommonAPI::DBus::DBusProxyConnection::DBusSignalHandlerToken dbusSignalHandlerAddedToken_;
- CommonAPI::DBus::DBusProxyConnection::DBusSignalHandlerToken dbusSignalHandlerRemovedToken_;
-};
-
-class DBusObjectManagerStubTest: public ::testing::Test {
-protected:
- virtual void SetUp() {
- runtime = CommonAPI::Runtime::get();
-
- proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
- ASSERT_TRUE(proxyDBusConnection_->connect());
-
- stubDBusConnection_ = serviceFactory->getDbusConnection();
- ASSERT_TRUE(stubDBusConnection_->connect());
- ASSERT_TRUE(bool(stubDBusConnection_->getDBusObjectManager()));
- ASSERT_TRUE(stubDBusConnection_->requestServiceNameAndBlock(dbusServiceName));
- }
-
- virtual void TearDown() {
- stubDBusConnection_->releaseServiceName(dbusServiceName);
-
- stubDBusConnection_->disconnect();
- stubDBusConnection_.reset();
-
- proxyDBusConnection_->disconnect();
- proxyDBusConnection_.reset();
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime;
-
- void getManagedObjects(const std::string& dbusObjectPath,
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict& dbusObjectPathAndInterfacesDict) {
- auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- dbusServiceName,
- dbusObjectPath,
- CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName(),
- "GetManagedObjects");
-
- CommonAPI::DBus::DBusError dbusError;
- auto dbusMessageReply = proxyDBusConnection_->sendDBusMessageWithReplyAndBlock(dbusMessageCall, dbusError);
-
- ASSERT_FALSE(dbusError)<< dbusError.getMessage();
- ASSERT_TRUE(dbusMessageReply.isMethodReturnType());
- ASSERT_TRUE(dbusMessageReply.hasSignature("a{oa{sa{sv}}}"));
-
- CommonAPI::DBus::DBusInputStream dbusInputStream(dbusMessageReply);
-
- dbusInputStream >> dbusObjectPathAndInterfacesDict;
- ASSERT_FALSE(dbusInputStream.hasError());
- }
-
- void getIntrospectionData(const std::string& dbusObjectPath, std::string& introspectionDataXml) {
- auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(
- dbusServiceName,
- dbusObjectPath,
- "org.freedesktop.DBus.Introspectable",
- "Introspect");
- CommonAPI::DBus::DBusError dbusError;
- auto dbusMessageReply = proxyDBusConnection_->sendDBusMessageWithReplyAndBlock(dbusMessageCall, dbusError);
-
- ASSERT_FALSE(dbusError)<< dbusError.getMessage();
- ASSERT_TRUE(dbusMessageReply.isMethodReturnType());
- ASSERT_TRUE(dbusMessageReply.hasSignature("s"));
-
- CommonAPI::DBus::DBusInputStream dbusInputStream(dbusMessageReply);
-
- dbusInputStream >> introspectionDataXml;
- ASSERT_FALSE(dbusInputStream.hasError());
- }
-
- void waitForInterfacesAdded(const std::shared_ptr<TestDBusObjectManagerSignalHandler>& dbusSignalHandler,
- const size_t& interfacesAddedCount,
- const size_t& interfacesRemovedExpectedCount) {
- const size_t waitMillisecondsPerInterface = 300;
-
- std::unique_lock<std::mutex> lock(dbusSignalHandler->lock);
- auto waitResult = dbusSignalHandler->signalReceived.wait_for(
- lock,
- std::chrono::milliseconds(interfacesAddedCount * waitMillisecondsPerInterface),
- [&]() {return dbusSignalHandler->totalAddedCount == interfacesAddedCount;});
- ASSERT_TRUE(waitResult);
- ASSERT_EQ(dbusSignalHandler->totalRemovedCount, interfacesRemovedExpectedCount);
-
- const std::string lastAddedDBusObjectPath = managedDBusObjectPathPrefix
- + std::to_string(interfacesAddedCount - 1);
- ASSERT_TRUE(dbusSignalHandler->lastAddedDBusObjectPath == lastAddedDBusObjectPath);
- }
-
- void waitForInterfacesRemoved(const std::shared_ptr<TestDBusObjectManagerSignalHandler>& dbusSignalHandler,
- const size_t& interfacesRemovedCount,
- const size_t& interfacesAddedExpectedCount) {
- const size_t waitMillisecondsPerInterface = 300;
-
- std::unique_lock<std::mutex> lock(dbusSignalHandler->lock);
- auto waitResult = dbusSignalHandler->signalReceived.wait_for(
- lock,
- std::chrono::milliseconds(interfacesRemovedCount * waitMillisecondsPerInterface),
- [&]() {return dbusSignalHandler->totalRemovedCount == interfacesRemovedCount;});
- ASSERT_TRUE(waitResult);
- ASSERT_EQ(dbusSignalHandler->totalAddedCount, interfacesAddedExpectedCount);
-
- const std::string lastRemovedDBusObjectPath = managedDBusObjectPathPrefix
- + std::to_string(interfacesRemovedCount - 1);
- ASSERT_TRUE(dbusSignalHandler->lastRemovedDBusObjectPath == lastRemovedDBusObjectPath);
- }
-
- template<typename _StubType, size_t _ArraySize>
- void createDBusStubAdapterArray(std::array<std::shared_ptr<_StubType>, _ArraySize>& dbusStubAdapter) {
- for (size_t i = 0; i < _ArraySize; i++) {
- dbusStubAdapter[i] = std::make_shared<_StubType>(serviceFactory,
- managedDBusObjectPathPrefix + std::to_string(i),
- stubDBusConnection_,
- false);
-
- ASSERT_TRUE(bool(dbusStubAdapter[i]));
-
- dbusStubAdapter[i]->init(dbusStubAdapter[i]);
- }
- }
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<CommonAPI::DBus::DBusConnection> stubDBusConnection_;
-};
-
-TEST_F(DBusObjectManagerStubTest, EmptyRootGetManagedObjectsWorks) {
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
-
- getManagedObjects("/", dbusObjectPathAndInterfacesDict);
-
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusObjectManagerStubTest, RootObjectManagerIntrospectionWorks) {
- std::string introspectionDataXml;
-
- getIntrospectionData("/", introspectionDataXml);
-
- ASSERT_FALSE(introspectionDataXml.empty());
- ASSERT_TRUE(introspectionDataXml.find("GetManagedObjects") != std::string::npos);
- ASSERT_TRUE(introspectionDataXml.find("InterfacesAdded") != std::string::npos);
- ASSERT_TRUE(introspectionDataXml.find("InterfacesRemoved") != std::string::npos);
-}
-
-TEST_F(DBusObjectManagerStubTest, RootRegisterStubAdapterWorks) {
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
- auto dbusSignalHandler = TestDBusObjectManagerSignalHandler::create("/", proxyDBusConnection_);
- std::array<std::shared_ptr<TestDBusStubAdapter>, 10> dbusStubAdapterArray;
-
- createDBusStubAdapterArray(dbusStubAdapterArray);
-
- const bool isServiceRegistrationSuccessful = std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceRegistrationSuccessful);
-
- waitForInterfacesAdded(dbusSignalHandler, dbusStubAdapterArray.size(), 0);
-
- getManagedObjects("/", dbusObjectPathAndInterfacesDict);
- ASSERT_EQ(dbusObjectPathAndInterfacesDict.size(), dbusStubAdapterArray.size());
-
- const bool isServiceDeregistrationSuccessful = std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- const auto& serviceAddress = dbusStubAdapter->getAddress();
- return CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(serviceAddress);
- });
- ASSERT_TRUE(isServiceDeregistrationSuccessful);
-
- waitForInterfacesRemoved(dbusSignalHandler, dbusStubAdapterArray.size(), dbusStubAdapterArray.size());
-
- dbusObjectPathAndInterfacesDict.clear();
- getManagedObjects("/", dbusObjectPathAndInterfacesDict);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-
-TEST_F(DBusObjectManagerStubTest, RegisterManagerStubAdapterWorks) {
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
- auto managerDBusStubAdapter = std::make_shared<ManagerTestDBusStubAdapter>(
- serviceFactory,
- dbusObjectManagerStubPath,
- stubDBusConnection_);
- managerDBusStubAdapter->init(managerDBusStubAdapter);
-
- ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter));
-
- getManagedObjects("/", dbusObjectPathAndInterfacesDict);
-
- ASSERT_FALSE(dbusObjectPathAndInterfacesDict.empty());
- ASSERT_EQ(dbusObjectPathAndInterfacesDict.size(), 1);
- ASSERT_EQ(dbusObjectPathAndInterfacesDict.count(dbusObjectManagerStubPath), 1);
-
- ASSERT_EQ(dbusObjectPathAndInterfacesDict[dbusObjectManagerStubPath].size(), 2);
- ASSERT_EQ(dbusObjectPathAndInterfacesDict[dbusObjectManagerStubPath].count(
- CommonAPI::DBus::DBusObjectManagerStub::getInterfaceName()),
- 1);
- ASSERT_EQ(dbusObjectPathAndInterfacesDict[dbusObjectManagerStubPath].count(
- managerDBusStubAdapter->getInterfaceName()),
- 1);
-
- ASSERT_TRUE(
- CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(
- managerDBusStubAdapter->getAddress()));
-
- dbusObjectPathAndInterfacesDict.clear();
- getManagedObjects("/", dbusObjectPathAndInterfacesDict);
- ASSERT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-}
-
-TEST_F(DBusObjectManagerStubTest, ManagerStubAdapterExportAndUnexportWorks) {
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
- auto dbusSignalHandler = TestDBusObjectManagerSignalHandler::create(
- dbusObjectManagerStubPath,
- proxyDBusConnection_);
- auto managerDBusStubAdapter = std::make_shared<ManagerTestDBusStubAdapter>(
- serviceFactory,
- dbusObjectManagerStubPath,
- stubDBusConnection_);
- managerDBusStubAdapter->init(managerDBusStubAdapter);
-
- ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter));
-
- std::array<std::shared_ptr<TestDBusStubAdapter>, 10> dbusStubAdapterArray;
- createDBusStubAdapterArray(dbusStubAdapterArray);
-
- const bool isServiceRegistrationSuccessful =
- std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceRegistrationSuccessful);
-
- const bool isServiceExportSuccessful =
- std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [&](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return stubDBusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(managerDBusStubAdapter->getObjectPath(), dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceExportSuccessful);
-
- waitForInterfacesAdded(dbusSignalHandler, dbusStubAdapterArray.size(), 0);
-
- getManagedObjects(dbusObjectManagerStubPath, dbusObjectPathAndInterfacesDict);
- EXPECT_EQ(dbusObjectPathAndInterfacesDict.size(), dbusStubAdapterArray.size());
-
- const bool isServiceUnexportSuccessful =
- std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [&](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return stubDBusConnection_->getDBusObjectManager()->unexportManagedDBusStubAdapter(managerDBusStubAdapter->getObjectPath(), dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceUnexportSuccessful);
-
- const bool isServiceDeregistrationSuccessful = std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(
- dbusStubAdapter->getAddress());
- });
- ASSERT_TRUE(isServiceDeregistrationSuccessful);
-
- waitForInterfacesRemoved(dbusSignalHandler, dbusStubAdapterArray.size(), dbusStubAdapterArray.size());
-
- dbusObjectPathAndInterfacesDict.clear();
- getManagedObjects(dbusObjectManagerStubPath, dbusObjectPathAndInterfacesDict);
- EXPECT_TRUE(dbusObjectPathAndInterfacesDict.empty());
-
- ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(managerDBusStubAdapter->getAddress()));
-}
-
-
-TEST_F(DBusObjectManagerStubTest, DestructorUnpublishingWorks) {
- CommonAPI::DBus::DBusObjectManagerStub::DBusObjectPathAndInterfacesDict dbusObjectPathAndInterfacesDict;
- auto dbusSignalHandler = TestDBusObjectManagerSignalHandler::create(
- dbusObjectManagerStubPath,
- proxyDBusConnection_);
- auto managerDBusStubAdapter = std::make_shared<ManagerTestDBusStubAdapter>(
- serviceFactory,
- dbusObjectManagerStubPath,
- stubDBusConnection_);
- managerDBusStubAdapter->init(managerDBusStubAdapter);
-
- EXPECT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->registerService(managerDBusStubAdapter));
-
- std::array<std::shared_ptr<TestDBusStubAdapter>, 10> dbusStubAdapterArray;
- createDBusStubAdapterArray(dbusStubAdapterArray);
-
- const bool isServiceRegistrationSuccessful =
- std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return CommonAPI::DBus::DBusServicePublisher::getInstance()->registerManagedService(dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceRegistrationSuccessful);
-
- const bool isServiceExportSuccessful =
- std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [&](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return stubDBusConnection_->getDBusObjectManager()->exportManagedDBusStubAdapter(managerDBusStubAdapter->getObjectPath(), dbusStubAdapter);
- });
- ASSERT_TRUE(isServiceExportSuccessful);
-
- waitForInterfacesAdded(dbusSignalHandler, dbusStubAdapterArray.size(), 0);
-
- ASSERT_TRUE(CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(managerDBusStubAdapter->getAddress()));
- managerDBusStubAdapter.reset();
-
- const bool wasServiceDeregistrationSuccessful = std::all_of(
- dbusStubAdapterArray.begin(),
- dbusStubAdapterArray.end(),
- [](const std::shared_ptr<TestDBusStubAdapter>& dbusStubAdapter) {
- return !CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterManagedService(
- dbusStubAdapter->getAddress());
- });
- ASSERT_TRUE(wasServiceDeregistrationSuccessful);
-}
-
-#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
index 98d8285..1e58699 100644
--- a/src/test/DBusOutputStreamTest.cpp
+++ b/src/test/DBusOutputStreamTest.cpp
@@ -74,11 +74,11 @@ TEST_F(OutputStreamTest, WritesBytes) {
}
TEST_F(OutputStreamTest, WritesBools) {
- const char signature[] = "bbbbbbbbbb";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 4);
bool val1 = TRUE;
bool val2 = FALSE;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -103,11 +103,11 @@ TEST_F(OutputStreamTest, WritesBools) {
}
TEST_F(OutputStreamTest, WritesUInt16) {
- const char signature[] = "qqqqqqqqqq";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 2);
uint16_t val1 = 0x0000;
uint16_t val2 = 0xffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -132,13 +132,13 @@ TEST_F(OutputStreamTest, WritesUInt16) {
}
TEST_F(OutputStreamTest, WritesInt16) {
- const char signature[] = "nnnnnnnnnn";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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 = 0x7fff;
- int16_t val2 = 0xffff;
+ //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;
@@ -161,11 +161,11 @@ TEST_F(OutputStreamTest, WritesInt16) {
}
TEST_F(OutputStreamTest, WritesUInt32) {
- const char signature[] = "uuuuuuuuuu";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 4);
uint32_t val1 = 0x00000000;
uint32_t val2 = 0xffffffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -190,11 +190,11 @@ TEST_F(OutputStreamTest, WritesUInt32) {
}
TEST_F(OutputStreamTest, WritesInt32) {
- const char signature[] = "iiiiiiiiii";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 4);
int32_t val1 = 0x7fffffff;
int32_t val2 = 0xffffffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -219,11 +219,11 @@ TEST_F(OutputStreamTest, WritesInt32) {
}
TEST_F(OutputStreamTest, WritesUInt64) {
- const char signature[] = "tttttttttt";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 8);
uint64_t val1 = 0x0000000000000000;
uint64_t val2 = 0xffffffffffffffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -248,11 +248,11 @@ TEST_F(OutputStreamTest, WritesUInt64) {
}
TEST_F(OutputStreamTest, WritesInt64) {
- const char signature[] = "xxxxxxxxxx";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 8);
int64_t val1 = 0x7fffffffffffffff;
int64_t val2 = 0xffffffffffffffff;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -277,11 +277,11 @@ TEST_F(OutputStreamTest, WritesInt64) {
}
TEST_F(OutputStreamTest, WritesDouble) {
- const char signature[] = "dddddddddd";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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);
+ //outStream.reserveMemory(numOfElements * 8);
double val1 = 13.37;
double val2 = 3.414;
for (unsigned int i = 0; i < numOfElements; i += 2) {
@@ -307,8 +307,8 @@ TEST_F(OutputStreamTest, WritesDouble) {
}
TEST_F(OutputStreamTest, WritesStrings) {
- const char signature[] = "sss";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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";
@@ -316,7 +316,7 @@ TEST_F(OutputStreamTest, WritesStrings) {
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.reserveMemory(val1.size() + val2.size() + val3.size() + 3 + 3 * 4);
outStream << val1 << val2 << val3;
outStream.flush();
@@ -345,39 +345,40 @@ 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) {
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- //typeOutputStream.writeType();
- }
+ 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() {
@@ -386,21 +387,21 @@ myStruct::~myStruct() {
} //namespace test
} //namespace bmw
-TEST_F(OutputStreamTest, DISABLED_WritesStructs) {
- const char signature[] = "(unbsd)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+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);
+ 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.reserveMemory(40);
outStream << testStruct;
outStream.flush();
@@ -410,16 +411,16 @@ TEST_F(OutputStreamTest, DISABLED_WritesStructs) {
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());
+ 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);
+ 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;
@@ -430,7 +431,7 @@ TEST_F(OutputStreamTest, WritesArrays) {
testVector.push_back(val2);
}
- //outStream.reserveMemory(numOfElements * 4 + 4);
+ //outStream.reserveMemory(numOfElements * 4 + 4);
outStream << testVector;
outStream.flush();
@@ -451,8 +452,8 @@ TEST_F(OutputStreamTest, WritesArrays) {
}
TEST_F(OutputStreamTest, WritesArraysOfStrings) {
- const char signature[] = "as";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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;
@@ -467,7 +468,7 @@ TEST_F(OutputStreamTest, WritesArraysOfStrings) {
// 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.reserveMemory(vectorLength);
outStream << testVector;
outStream.flush();
@@ -488,8 +489,8 @@ TEST_F(OutputStreamTest, WritesArraysOfStrings) {
}
TEST_F(OutputStreamTest, WritesArraysInArrays) {
- const char signature[] = "aai";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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;
@@ -504,7 +505,7 @@ TEST_F(OutputStreamTest, WritesArraysInArrays) {
testVector.push_back(inner);
}
- //outStream.reserveMemory(numOfElements * numOfElements * 4 + numOfElements * 4 + 4);
+ //outStream.reserveMemory(numOfElements * numOfElements * 4 + numOfElements * 4 + 4);
outStream << testVector;
outStream.flush();
@@ -529,10 +530,10 @@ TEST_F(OutputStreamTest, WritesArraysInArrays) {
typedef CommonAPI::Variant<int8_t, uint32_t, double, std::string> BasicTypeVariant;
-TEST_F(OutputStreamTest, DISABLED_WritesArraysOfVariants) {
+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);
+ 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;
@@ -556,15 +557,15 @@ TEST_F(OutputStreamTest, DISABLED_WritesArraysOfVariants) {
// + (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.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));
+ inStream.readValue(verifyVector, static_cast<CommonAPI::EmptyDeployment*>(nullptr));
BasicTypeVariant resultInt8Variant = verifyVector[0];
BasicTypeVariant resultUint32Variant = verifyVector[1];
@@ -586,45 +587,45 @@ struct TestStruct : CommonAPI::Struct<int32_t, double, double, std::string> {
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 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 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;
+ 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_) = "";
+ 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;
+ 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_);
+ 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_);
+ outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_);
}
} // namespace test
@@ -632,15 +633,15 @@ void TestStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DB
} // namespace com
TEST_F(OutputStreamTest, WritesTestStructs) {
- const char signature[] = "(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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.reserveMemory(expectedSize);
outStream << testStruct;
outStream.flush();
@@ -657,8 +658,8 @@ TEST_F(OutputStreamTest, WritesTestStructs) {
}
TEST_F(OutputStreamTest, WritesTestStructLists) {
- const char signature[] = "a(idds)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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;
@@ -668,8 +669,8 @@ TEST_F(OutputStreamTest, WritesTestStructLists) {
//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 = 8 + (numOfElements - 1) * (49 + 7) + 49;
- //outStream.reserveMemory(expectedSize);
+ uint32_t expectedSize = static_cast<uint32_t>(8 + (numOfElements - 1) * (49 + 7) + 49);
+ //outStream.reserveMemory(expectedSize);
outStream << testList;
outStream.flush();
@@ -695,26 +696,26 @@ struct ArrayStruct : CommonAPI::Struct<std::vector<int64_t>, std::vector<std::st
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;
+ 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;
@@ -726,23 +727,23 @@ 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;
+ 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_);
+ 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_);
+ outputMessageStream << std::get<0>(values_) << std::get<1>(values_) << std::get<2>(values_) << std::get<3>(values_) << std::get<4>(values_);
}
} // namespace test
@@ -750,17 +751,17 @@ void ArrayStruct::writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::D
} // namespace com
TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
- const char signature[] = "(axasadasaq)";
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ 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(i * 5);
+ arrayStruct.addToVal2("Hai");
+ arrayStruct.addToVal3(3.414);
+ arrayStruct.addToVal4("Ciao");
+ arrayStruct.addToVal5(uint16_t(i * 5));
}
uint16_t frontValue = 0;
@@ -771,7 +772,7 @@ TEST_F(OutputStreamTest, WritesStructsOfArraysWithSthBefore) {
// 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.reserveMemory(structLength);
outStream << frontValue << arrayStruct;
outStream.flush();
@@ -823,14 +824,14 @@ TEST_F(OutputStreamTest, WritesEnumKeyedMaps) {
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);
+ 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.reserveMemory(sizeOfBody);
outStream << testEnumMap;
outStream.flush();
diff --git a/src/test/DBusPolymorphicTest.cpp b/src/test/DBusPolymorphicTest.cpp
index be7082f..9c8fcfc 100644
--- a/src/test/DBusPolymorphicTest.cpp
+++ b/src/test/DBusPolymorphicTest.cpp
@@ -16,22 +16,36 @@
#define VERSION v1_0
#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-
-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";
+#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 Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
class PolymorphicTestStub : public VERSION::commonapi::tests::TestInterfaceStubDefault {
public:
- void TestArrayOfPolymorphicStructMethod(
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inArray) {
- numberOfContainedElements_ = inArray.size();
+
+ 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 =
@@ -48,12 +62,17 @@ public:
inArray[1]);
secondElementIsExtended_ = (extended != NULL);
}
+ _reply();
}
+
void TestMapOfPolymorphicStructMethod(
- const std::shared_ptr<CommonAPI::ClientId> clientId,
- std::unordered_map<uint8_t, std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct>> inMap) {
- numberOfContainedElements_ = inMap.size();
+ 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);
@@ -73,10 +92,16 @@ public:
iteratorSecond->second);
secondElementIsExtended_ = (extended != NULL);
}
+
+ _reply();
}
- void TestStructWithPolymorphicMemberMethod(const std::shared_ptr<CommonAPI::ClientId> clientId,
- ::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inStruct) {
+ 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;
@@ -86,6 +111,7 @@ public:
inStruct.getPolymorphicMember());
firstElementIsExtended_ = (extended != NULL);
}
+ _reply();
}
int numberOfContainedElements_;
@@ -101,7 +127,7 @@ protected:
proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
proxy_->init();
registerTestStub();
@@ -124,20 +150,20 @@ protected:
}
void registerTestStub() {
- stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
+ stubDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
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_);
+ 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);
+ 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());
+ const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(stubAdapter_->getAddress().getDomain(), stubAdapter_->getInterface(), stubAdapter_->getAddress().getInstance());
ASSERT_TRUE(isStubAdapterUnregistered);
stubAdapter_.reset();
@@ -148,10 +174,10 @@ protected:
}
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
+ 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<VERSION::commonapi::tests::TestInterfaceDBusStubAdapter> stubAdapter_;
std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> baseInstance1_;
std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestExtendedPolymorphicStruct> extendedInstance1_;
@@ -159,7 +185,7 @@ protected:
std::shared_ptr<PolymorphicTestStub> testStub;
};
-TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseType) {
+TEST_F(PolymorphicTest, SendVectorOfBaseType) {
CommonAPI::CallStatus stat;
std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(baseInstance1_);
@@ -171,7 +197,7 @@ TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseType) {
ASSERT_FALSE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, DISABLED_SendVectorOfExtendedType) {
+TEST_F(PolymorphicTest, SendVectorOfExtendedType) {
CommonAPI::CallStatus stat;
std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(extendedInstance1_);
@@ -183,7 +209,7 @@ TEST_F(PolymorphicTest, DISABLED_SendVectorOfExtendedType) {
ASSERT_TRUE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseAndExtendedType) {
+TEST_F(PolymorphicTest, SendVectorOfBaseAndExtendedType) {
CommonAPI::CallStatus stat;
std::vector<std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputArray;
inputArray.push_back(baseInstance1_);
@@ -197,7 +223,7 @@ TEST_F(PolymorphicTest, DISABLED_SendVectorOfBaseAndExtendedType) {
ASSERT_TRUE(testStub->secondElementIsExtended_);
}
-TEST_F(PolymorphicTest, DISABLED_SendMapOfBaseAndExtendedType) {
+TEST_F(PolymorphicTest, SendMapOfBaseAndExtendedType) {
CommonAPI::CallStatus stat;
std::unordered_map<uint8_t, std::shared_ptr<::commonapi::tests::DerivedTypeCollection::TestPolymorphicStruct> > inputMap;
inputMap.insert( {5, baseInstance1_});
@@ -211,7 +237,7 @@ TEST_F(PolymorphicTest, DISABLED_SendMapOfBaseAndExtendedType) {
ASSERT_TRUE(testStub->secondElementIsExtended_);
}
-TEST_F(PolymorphicTest, DISABLED_SendStructWithPolymorphicMember) {
+TEST_F(PolymorphicTest, SendStructWithPolymorphicMember) {
CommonAPI::CallStatus stat;
::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember inputStruct;
inputStruct.setPolymorphicMember(extendedInstance1_);
@@ -223,7 +249,7 @@ TEST_F(PolymorphicTest, DISABLED_SendStructWithPolymorphicMember) {
ASSERT_TRUE(testStub->firstElementIsExtended_);
}
-TEST_F(PolymorphicTest, DISABLED_SendStructWithMapWithEnumKeyMember) {
+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" } );
@@ -236,6 +262,7 @@ TEST_F(PolymorphicTest, DISABLED_SendStructWithMapWithEnumKeyMember) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusProxyTest.cpp b/src/test/DBusProxyTest.cpp
index 983879e..b124e45 100644
--- a/src/test/DBusProxyTest.cpp
+++ b/src/test/DBusProxyTest.cpp
@@ -20,14 +20,14 @@
#include <CommonAPI/DBus/DBusStubAdapter.hpp>
#include <CommonAPI/DBus/DBusFactory.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestInterfaceDBusProxy.hpp>
+#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceStubDefault.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"
@@ -44,14 +44,27 @@ 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.DBus.tests.DBusProxyTestInterface";
-static const std::string busName = "CommonAPI.DBus.tests.DBusProxyTestService";
+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 Environment: public ::testing::Environment {
+public:
+ virtual ~Environment() {
+ }
+
+ virtual void SetUp() {
+ CommonAPI::Runtime::setProperty("LibraryBase", "fakeGlueCode");
+ }
+
+ virtual void TearDown() {
+ }
+};
+
class ProxyTest: public ::testing::Test {
protected:
void SetUp() {
@@ -60,8 +73,8 @@ protected:
proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
- CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName),
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(
+ CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName),
proxyDBusConnection_);
proxy_->init();
}
@@ -73,17 +86,17 @@ protected:
}
void registerTestStub() {
- stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
- bool isTestStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_, "connection");
+ stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ bool isTestStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_, "connection");
ASSERT_TRUE(isTestStubAdapterRegistered_);
usleep(100000);
}
void registerExtendedStub() {
- stubExtended_ = std::make_shared<VERSION::commonapi::tests::ExtendedInterfaceStubDefault>();
+ stubExtended_ = std::make_shared<VERSION::commonapi::tests::ExtendedInterfaceStubDefault>();
- bool isExtendedStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::ExtendedInterfaceStub>(domain, commonApiAddressExtended, stubExtended_, "connection");
+ bool isExtendedStubAdapterRegistered_ = runtime_->registerService<VERSION::commonapi::tests::ExtendedInterfaceStub>(domain, commonApiAddressExtended, stubExtended_, "connection");
ASSERT_TRUE(isExtendedStubAdapterRegistered_);
usleep(100000);
@@ -91,7 +104,7 @@ protected:
void deregisterTestStub() {
const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(
- domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
+ domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
stubDefault_.reset();
isTestStubAdapterRegistered_ = false;
@@ -99,7 +112,7 @@ protected:
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);
+ 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;
@@ -133,14 +146,14 @@ protected:
bool isTestStubAdapterRegistered_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
- CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
+ CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
- std::shared_ptr<VERSION::commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
+ std::shared_ptr<VERSION::commonapi::tests::ExtendedInterfaceStubDefault> stubExtended_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
};
TEST_F(ProxyTest, HasCorrectConnectionName) {
@@ -149,12 +162,12 @@ TEST_F(ProxyTest, HasCorrectConnectionName) {
}
TEST_F(ProxyTest, HasCorrectObjectPath) {
- std::string actualPath = proxy_->getDBusAddress().getObjectPath();
+ std::string actualPath = proxy_->getDBusAddress().getObjectPath();
EXPECT_EQ(objectPath, actualPath);
}
TEST_F(ProxyTest, HasCorrectInterfaceName) {
- std::string actualName = proxy_->getDBusAddress().getInterface();
+ std::string actualName = proxy_->getDBusAddress().getInterface();
EXPECT_EQ(interfaceName, actualName);
}
@@ -167,12 +180,6 @@ TEST_F(ProxyTest, IsConnected) {
ASSERT_TRUE(proxy_->getDBusConnection()->isConnected());
}
-TEST_F(ProxyTest, AssociatedConnectionHasServiceRegistry) {
- std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> connection = proxy_->getDBusConnection();
- //auto registry = connection->getDBusServiceRegistry();
- //ASSERT_FALSE(!registry);
-}
-
TEST_F(ProxyTest, DBusProxyStatusEventBeforeServiceIsRegistered) {
proxyRegisterForAvailabilityStatus();
@@ -215,43 +222,6 @@ TEST_F(ProxyTest, DBusProxyStatusEventAfterServiceIsRegistered) {
}
#endif
-TEST_F(ProxyTest, ServiceStatus) {
- registerTestStub();
-
- std::vector<std::string> availableDBusServices;
- /*
- //Service actually IS available!
- for (int i = 0; i < 5; i++) {
- availableDBusServices = proxyDBusConnection_->getDBusServiceRegistry()->getAvailableServiceInstances(
- commonApiServiceName,
- "local");
-
- if (!availableDBusServices.empty()) {
- break;
- }
- }
-
- auto found = std::find(availableDBusServices.begin(), availableDBusServices.end(), commonApiAddress);
- */
- //EXPECT_TRUE(availableDBusServices.begin() != availableDBusServices.end());
- //EXPECT_TRUE(found != availableDBusServices.end());
- deregisterTestStub();
-}
-
-TEST_F(ProxyTest, isServiceInstanceAlive) {
- registerTestStub();
-
- //bool isInstanceAlive = proxyDBusConnection_->getDBusServiceRegistry()->isServiceInstanceAlive(interfaceName, busName, objectPath);
-
- //for (int i = 0; !isInstanceAlive && i < 10; i++) {
- // std::this_thread::sleep_for(std::chrono::milliseconds(200));
- //isInstanceAlive = proxyDBusConnection_->getDBusServiceRegistry()->isServiceInstanceAlive(interfaceName, busName, objectPath);
- //}
-
- //EXPECT_TRUE(isInstanceAlive);
-
- deregisterTestStub();
-}
TEST_F(ProxyTest, IsAvailableBlocking) {
registerTestStub();
@@ -282,6 +252,7 @@ TEST_F(ProxyTest, TestInterfaceVersionAttribute) {
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, [&] (
@@ -291,7 +262,7 @@ TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) {
ASSERT_EQ(callStatus, CommonAPI::CallStatus::NOT_AVAILABLE);
wasCalledPromise.set_value(true);
}
- );
+ , &info);
ASSERT_TRUE(wasCalledFuture.get());
}
@@ -299,7 +270,7 @@ TEST_F(ProxyTest, AsyncCallbacksAreCalledIfServiceNotAvailable) {
TEST_F(ProxyTest, CallMethodFromExtendedInterface) {
registerExtendedStub();
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
+ 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) {
@@ -325,13 +296,13 @@ TEST_F(ProxyTest, CallMethodFromExtendedInterface) {
TEST_F(ProxyTest, CallMethodFromParentInterface) {
registerExtendedStub();
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
- usleep(20 * 1000);
+ usleep(10 * 1000);
}
EXPECT_TRUE(extendedProxy->isAvailable());
-
+
bool wasCalled = false;
extendedProxy->testEmptyMethodAsync(
[&](const CommonAPI::CallStatus& callStatus) {
@@ -340,7 +311,7 @@ TEST_F(ProxyTest, CallMethodFromParentInterface) {
});
usleep(100000);
EXPECT_TRUE(wasCalled);
-
+
deregisterExtendedStub();
}
@@ -376,7 +347,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttribute) {
TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
registerExtendedStub();
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
usleep(20 * 1000);
@@ -386,8 +357,8 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
CommonAPI::CallStatus callStatus(CommonAPI::CallStatus::REMOTE_ERROR);
uint32_t value;
- usleep(200000000);
-
+ usleep(50000);
+
auto& testAttribute = extendedProxy->getTestPredefinedTypeAttributeAttribute();
testAttribute.getValue(callStatus, value);
@@ -400,7 +371,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
EXPECT_EQ(callStatus, CommonAPI::CallStatus::SUCCESS);
EXPECT_EQ(value, responseValue);
-
+
usleep(50000);
deregisterExtendedStub();
}
@@ -408,7 +379,7 @@ TEST_F(ProxyTest, CanHandleRemoteAttributeFromParentInterface) {
TEST_F(ProxyTest, ProxyCanFetchVersionAttributeFromInheritedInterfaceStub) {
registerExtendedStub();
- auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, commonApiAddressExtended);
+ auto extendedProxy = runtime_->buildProxy<VERSION::commonapi::tests::ExtendedInterfaceProxy>(domain, commonApiAddressExtended);
for (uint32_t i = 0; !extendedProxy->isAvailable() && i < 200; ++i) {
usleep(20 * 1000);
@@ -447,16 +418,16 @@ protected:
}
void registerTestStub(const std::string commonApiAddress) {
- stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
+ stubDefault_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
bool isTestStubAdapterRegistered_ = runtime_->registerService<
- VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_);
+ VERSION::commonapi::tests::TestInterfaceStub>(domain, commonApiAddress, stubDefault_);
ASSERT_TRUE(isTestStubAdapterRegistered_);
usleep(100000);
}
void deregisterTestStub(const std::string commonApiAddress) {
- const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
+ const bool isStubAdapterUnregistered = CommonAPI::Runtime::get()->unregisterService(domain, stubDefault_->getStubAdapter()->getInterface(), commonApiAddress);
ASSERT_TRUE(isStubAdapterUnregistered);
stubDefault_.reset();
isTestStubAdapterRegistered_ = false;
@@ -490,12 +461,12 @@ protected:
std::shared_ptr<CommonAPI::Runtime> runtime_;
std::shared_ptr<CommonAPI::DBus::DBusConnection> proxyDBusConnection_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceDBusProxy> proxy_;
CommonAPI::AvailabilityStatus proxyAvailabilityStatus_;
CommonAPI::ProxyStatusEvent::Subscription proxyStatusSubscription_;
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
+ std::shared_ptr<VERSION::commonapi::tests::TestInterfaceStubDefault> stubDefault_;
};
TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
@@ -504,7 +475,7 @@ TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
proxyDBusConnection_ = CommonAPI::DBus::DBusConnection::getBus(CommonAPI::DBus::DBusType_t::SESSION);
ASSERT_TRUE(proxyDBusConnection_->connect());
- proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
+ proxy_ = std::make_shared<VERSION::commonapi::tests::TestInterfaceDBusProxy>(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), proxyDBusConnection_);
proxy_->init();
proxyRegisterForAvailabilityStatus();
@@ -522,8 +493,8 @@ TEST_F(ProxyTest2, DBusProxyStatusEventAfterServiceIsRegistered) {
TEST_F(ProxyTest2, DBusProxyCanUseOrgFreedesktopAddress) {
registerTestStub(commonApiAddressFreedesktop);
- std::shared_ptr<VERSION::commonapi::tests::TestInterfaceProxy<>> proxy =
- runtime_->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(domain, 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())
@@ -552,6 +523,7 @@ TEST_F(ProxyTest2, DBusProxyCanUseOrgFreedesktopAddress) {
#ifndef __NO_MAIN__
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new Environment());
return RUN_ALL_TESTS();
}
#endif
diff --git a/src/test/DBusServicePublisherTest.cpp b/src/test/DBusServicePublisherTest.cpp
deleted file mode 100644
index c35fcf4..0000000
--- a/src/test/DBusServicePublisherTest.cpp
+++ /dev/null
@@ -1,105 +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_0/commonapi/tests/TestInterfaceProxy.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceStubDefault.hpp"
-#include "v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp"
-
-#include "v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp"
-
-#define VERSION v1_0
-
-class DBusServicePublisherTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime_);
- }
-
- virtual void TearDown() {
- usleep(30000);
- }
-
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-};
-
-/** TODO: CHECK IF STILL USEFUL **/
-
-/*
-TEST_F(DBusServicePublisherTest, HandlesManagementOfServices) {
- const std::string domain = "local";
- const std::string serviceAddress = "local:commonapi.tests.TestInterface:commonapi.tests.TestInterface";
- const std::string serviceAddress2 = "local:commonapi.tests.TestInterfaceTwo:commonapi.tests.TestInterface";
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- bool success = runtime_->registerService(domain, serviceAddress, myStub);
- EXPECT_TRUE(success);
-
- auto myStub2 = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
- success = runtime_->registerService(domain, serviceAddress2, myStub2);
- EXPECT_TRUE(success);
-
- usleep(10000);
-
- bool instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress);
- EXPECT_TRUE(instanceIsAvailable);
- instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress2);
- EXPECT_TRUE(instanceIsAvailable);
-
- success = runtime_->unregisterService("SomeOther:Unknown:Service");
- EXPECT_FALSE(success);
-
- success = runtime_->unregisterService(serviceAddress);
- EXPECT_TRUE(success);
-
- success = runtime_->unregisterService(serviceAddress2);
- EXPECT_TRUE(success);
-
- usleep(10000);
-
- instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress);
- EXPECT_FALSE(instanceIsAvailable);
- instanceIsAvailable = runtime_->isServiceInstanceAlive(serviceAddress2);
- EXPECT_FALSE(instanceIsAvailable);
-}
-*/
-
-TEST_F(DBusServicePublisherTest, GracefullyHandlesWrongAddresses) {
- auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- EXPECT_FALSE(runtime_->registerService("local", "", myStub, "connection"));
- EXPECT_FALSE(runtime_->registerService("local", "too:much:stuff:here", myStub, "connection"));
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusServiceRegistryTest.cpp b/src/test/DBusServiceRegistryTest.cpp
deleted file mode 100644
index 53620bd..0000000
--- a/src/test/DBusServiceRegistryTest.cpp
+++ /dev/null
@@ -1,639 +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 <fstream>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/Utils.hpp>
-
-#include <CommonAPI/DBus/DBusServiceRegistry.hpp>
-#include <CommonAPI/DBus/DBusConnection.hpp>
-#include <CommonAPI/DBus/DBusUtils.hpp>
-
-#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-
-#include <gtest/gtest.h>
-
-#include "DemoMainLoop.hpp"
-
-#include <fstream>
-#include <chrono>
-
-static const char DBUS_CONFIG_SUFFIX[] = "_dbus.conf";
-
-// all predefinedInstances will be added for this service
-static const std::string dbusServiceName = "DBusServiceRegistryTest.Predefined.Service";
-
-// dbusInterfaceName, dbusObjectPath -> commonApiAddress
-static const std::unordered_map<std::pair<std::string, std::string>, std::string> predefinedInstancesMap = {
- { { "tests.Interface1", "/tests/predefined/Object1" }, "local:Interface1:predefined.Instance1" },
- { { "tests.Interface1", "/tests/predefined/Object2" }, "local:Interface1:predefined.Instance2" },
- { { "tests.Interface2", "/tests/predefined/Object1" }, "local:Interface2:predefined.Instance" }
-};
-
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- configFileName_ = CommonAPI::getCurrentBinaryFileFQN();
- configFileName_ += DBUS_CONFIG_SUFFIX;
-
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
-
- for (auto& predefinedInstance : predefinedInstancesMap) {
- const std::string& dbusInterfaceName = predefinedInstance.first.first;
- const std::string& dbusObjectPath = predefinedInstance.first.second;
- const std::string& commonApiAddress = predefinedInstance.second;
-
- configFile << "[" << commonApiAddress << "]\n";
- configFile << "dbus_connection=" << dbusServiceName << std::endl;
- configFile << "dbus_object=" << dbusObjectPath << std::endl;
- configFile << "dbus_interface=" << dbusInterfaceName << std::endl;
- configFile << "dbus_predefined=true\n";
- configFile << std::endl;
- }
-
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
- }
-
- std::string configFileName_;
-};
-
-
-struct TestDBusServiceListener {
- CommonAPI::AvailabilityStatus lastAvailabilityStatus;
- size_t availabilityStatusCount;
-
- std::condition_variable statusChanged;
- std::mutex lock;
-
- TestDBusServiceListener(const std::string& commonApiAddress,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection):
- availabilityStatusCount(0),
- isSubscribed(false),
- commonApiAddress_(commonApiAddress) {
- }
-
- ~TestDBusServiceListener() {
- if (isSubscribed) {
- unsubscribe();
- }
- }
-
- void subscribe() {
- ASSERT_TRUE(!isSubscribed);
-
- dbusServiceSubscription_= dbusServiceRegistry_->subscribeAvailabilityListener(
- commonApiAddress_,
- [&](const CommonAPI::AvailabilityStatus& availabilityStatus) {
-
- std::lock_guard<std::mutex> lockGuard(lock);
-
- lastAvailabilityStatus = availabilityStatus;
- availabilityStatusCount++;
-
- statusChanged.notify_all();
-
- return CommonAPI::SubscriptionStatus::RETAIN;
- });
-
- isSubscribed = true;
- }
-
- void unsubscribe() {
- ASSERT_TRUE(isSubscribed);
-
- dbusServiceRegistry_->unsubscribeAvailabilityListener(
- commonApiAddress_,
- dbusServiceSubscription_);
- }
-
- private:
- bool isSubscribed;
- std::string commonApiAddress_;
- std::shared_ptr<CommonAPI::DBus::DBusServiceRegistry> dbusServiceRegistry_;
- CommonAPI::DBus::DBusServiceRegistry::DBusServiceSubscription dbusServiceSubscription_;
-};
-
-
-class DBusServiceRegistryTestDBusStubAdapter: public CommonAPI::DBus::DBusStubAdapter {
-public:
- DBusServiceRegistryTestDBusStubAdapter(const std::string& commonApiAddress,
- const std::string& dbusInterfaceName,
- const std::string& dbusBusName,
- const std::string& dbusObjectPath,
- const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection>& dbusConnection) :
- DBusStubAdapter(CommonAPI::DBus::DBusAddress(dbusBusName, dbusObjectPath, dbusInterfaceName),
- dbusConnection,
- false),
- introspectionCount(0) {
- }
-
- void deactivateManagedInstances() {
- }
-
- virtual const char* getMethodsDBusIntrospectionXmlData() const {
- introspectionCount++;
- return "";
- }
-
- virtual bool onInterfaceDBusMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return false;
- }
-
- virtual bool onInterfaceDBusFreedesktopPropertiesMessage(const CommonAPI::DBus::DBusMessage& dbusMessage) {
- return false;
- }
-
- mutable size_t introspectionCount;
-};
-
-class DBusServiceRegistryTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
-
- auto runtime = CommonAPI::Runtime::get();
-
- clientDBusConnection = clientFactory->getDbusConnection();
- clientConnectionRegistry = clientDBusConnection->getDBusServiceRegistry();
- serviceDBusConnection = serviceFactory->getDbusConnection();
- }
-
- virtual void TearDown() {
- if (clientDBusConnection && clientDBusConnection->isConnected()) {
- clientDBusConnection->disconnect();
- }
-
- if (serviceDBusConnection && serviceDBusConnection->isConnected()) {
- serviceDBusConnection->disconnect();
- }
- }
-
- bool waitForAvailabilityStatusChanged(TestDBusServiceListener& testDBusServiceListener,
- const CommonAPI::AvailabilityStatus& availabilityStatus) {
- std::unique_lock<std::mutex> lock(testDBusServiceListener.lock);
- auto waitResult =
- testDBusServiceListener.statusChanged.wait_for(
- lock,
- std::chrono::milliseconds(4000),
- [&]() {return testDBusServiceListener.lastAvailabilityStatus == availabilityStatus;});
- return waitResult;
- }
-
- std::shared_ptr<CommonAPI::DBus::DBusConnection> clientDBusConnection;
- std::shared_ptr<CommonAPI::DBus::DBusConnection> serviceDBusConnection;
-
- std::shared_ptr<CommonAPI::DBus::DBusServiceRegistry> clientConnectionRegistry;
- //std::shared_ptr<CommonAPI::DBus::DBusServiceRegistry> serviceConnectionRegistry;
-};
-
-
-TEST_F(DBusServiceRegistryTest, DBusConnectionHasRegistry) {
- clientDBusConnection->connect();
-
- auto dbusServiceRegistry = clientDBusConnection->getDBusServiceRegistry();
- EXPECT_FALSE(!dbusServiceRegistry);
-}
-
-TEST_F(DBusServiceRegistryTest, SubscribeBeforeConnectWorks) {
- TestDBusServiceListener testDBusServiceListener("local:Interface1:predefined.Instance1", clientDBusConnection);
- testDBusServiceListener.subscribe();
-
- ASSERT_TRUE(clientDBusConnection->connect());
-
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
- usleep(300 * 1000);
- EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 1);
-
- ASSERT_TRUE(serviceDBusConnection->connect());
- ASSERT_TRUE(serviceDBusConnection->requestServiceNameAndBlock(dbusServiceName));
- auto testDBusStubAdapter = std::make_shared<DBusServiceRegistryTestDBusStubAdapter>(
- "local:Interface1:predefined.Instance1",
- "tests.Interface1",
- dbusServiceName,
- "/tests/predefined/Object1",
- serviceDBusConnection);
- CommonAPI::Runtime::get()->registerService("local", "predefined.Instance1", testDBusStubAdapter);
-
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::AVAILABLE));
- usleep(5000000);
- EXPECT_LE(testDBusServiceListener.availabilityStatusCount, 3);
- EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
-
- //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
-
- //EXPECT_TRUE(waitForAvailabilityStatusChanged(
- // testDBusServiceListener,
- // CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
- //EXPECT_LE(testDBusServiceListener.availabilityStatusCount, 4);
-}
-
-TEST_F(DBusServiceRegistryTest, SubscribeBeforeConnectWithServiceWorks) {
- ASSERT_TRUE(serviceDBusConnection->connect());
- auto testDBusStubAdapter = std::make_shared<DBusServiceRegistryTestDBusStubAdapter>(
- "local:Interface1:predefined.Instance1",
- "tests.Interface1",
- dbusServiceName,
- "/tests/predefined/Object1",
- serviceDBusConnection);
- CommonAPI::Runtime::get()->registerService("local", "predefined.Instance1", testDBusStubAdapter);
-
- TestDBusServiceListener testDBusServiceListener("local:Interface1:predefined.Instance1", clientDBusConnection);
- testDBusServiceListener.subscribe();
- ASSERT_TRUE(clientDBusConnection->connect());
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::AVAILABLE));
- usleep(300 * 1000);
- EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 1);
- EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
-
- serviceDBusConnection->disconnect();
-
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
- usleep(300 * 1000);
- EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 2);
-
- //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
-}
-
-TEST_F(DBusServiceRegistryTest, SubscribeAfterConnectWithServiceWorks) {
- ASSERT_TRUE(serviceDBusConnection->connect());
- auto testDBusStubAdapter = std::make_shared<DBusServiceRegistryTestDBusStubAdapter>(
- "local:Interface1:predefined.Instance1",
- "tests.Interface1",
- dbusServiceName,
- "/tests/predefined/Object1",
- serviceDBusConnection);
- CommonAPI::Runtime::get()->registerService("local", "predefined.Interface1", testDBusStubAdapter);
-
- ASSERT_TRUE(clientDBusConnection->connect());
- TestDBusServiceListener testDBusServiceListener("local:Interface1:predefined.Instance1", clientDBusConnection);
- EXPECT_EQ(testDBusStubAdapter->introspectionCount, 0);
-
- testDBusServiceListener.subscribe();
-
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::AVAILABLE));
- EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 1);
- EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
-
- //CommonAPI::DBus::DBusServicePublisher::getInstance()->unregisterService(testDBusStubAdapter->getAddress());
-
- EXPECT_TRUE(waitForAvailabilityStatusChanged(
- testDBusServiceListener,
- CommonAPI::AvailabilityStatus::NOT_AVAILABLE));
- EXPECT_EQ(testDBusServiceListener.availabilityStatusCount, 2);
- EXPECT_EQ(testDBusStubAdapter->introspectionCount, 1);
-}
-
-TEST_F(DBusServiceRegistryTest, DBusAddressTranslatorPredefinedWorks) {
- std::vector<CommonAPI::DBus::DBusAddress> loadedPredefinedInstances;
-
- CommonAPI::DBus::DBusAddressTranslator::getInstance().getPredefinedInstances(dbusServiceName, loadedPredefinedInstances);
-
- EXPECT_EQ(loadedPredefinedInstances.size(), predefinedInstancesMap.size());
-
- for (auto& dbusServiceAddress : loadedPredefinedInstances) {
- const std::string& loadedDBusServiceName = std::get<0>(dbusServiceAddress);
- const std::string& loadedDBusObjectPath = std::get<1>(dbusServiceAddress);
- const std::string& loadedDBusInterfaceName = std::get<2>(dbusServiceAddress);
-
- EXPECT_EQ(loadedDBusServiceName, dbusServiceName);
-
- auto predefinedInstanceIterator = predefinedInstancesMap.find({ loadedDBusInterfaceName, loadedDBusObjectPath });
- const bool predefinedInstanceFound = (predefinedInstanceIterator != predefinedInstancesMap.end());
-
- EXPECT_TRUE(predefinedInstanceFound);
-
- const std::string& commonApiAddress = predefinedInstanceIterator->second;
- const std::string& predefinedDBusInterfaceName = predefinedInstanceIterator->first.first;
- const std::string& predefinedDBusObjectPath = predefinedInstanceIterator->first.second;
-
- EXPECT_EQ(loadedDBusInterfaceName, predefinedDBusInterfaceName);
- EXPECT_EQ(loadedDBusObjectPath, predefinedDBusObjectPath);
-
- std::string foundDBusInterfaceName;
- std::string foundDBusServiceName;
- std::string foundDBusObjectPath;
-
- CommonAPI::DBus::DBusAddressTranslator::getInstance().searchForDBusAddress(
- commonApiAddress,
- foundDBusInterfaceName,
- foundDBusServiceName,
- foundDBusObjectPath);
-
- EXPECT_EQ(foundDBusInterfaceName, predefinedDBusInterfaceName);
- EXPECT_EQ(foundDBusServiceName, dbusServiceName);
- EXPECT_EQ(foundDBusObjectPath, predefinedDBusObjectPath);
- }
-}
-
-
-CommonAPI::DBus::DBusMessage getNewFakeNameOwnerChangedMessage() {
- static const char* objectPath = "/";
- static const char* interfaceName = "org.freedesktop.DBus";
- static const char* signalName = "NameOwnerChanged";
- return CommonAPI::DBus::DBusMessage::createSignal(objectPath, interfaceName, signalName, "sss");
-}
-
-
-//XXX This test requires CommonAPI::DBus::DBusServiceRegistry::onDBusDaemonProxyNameOwnerChangedEvent to be public!
-
-//TEST_F(DBusServiceRegistryTest, RevertedNameOwnerChangedEventsWork) {
-// std::shared_ptr<CommonAPI::DBus::DBusConnection> registryConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
-// std::shared_ptr<CommonAPI::DBus::DBusServiceRegistry> registry = std::make_shared<CommonAPI::DBus::DBusServiceRegistry>(registryConnection);
-//
-// registry->init();
-//
-// CommonAPI::DBus::DBusMessage fakeNameOwnerChangedSignal1 = getNewFakeNameOwnerChangedMessage();
-// CommonAPI::DBus::DBusMessage fakeNameOwnerChangedSignal2 = getNewFakeNameOwnerChangedMessage();
-// CommonAPI::DBus::DBusMessage fakeNameOwnerChangedSignal3 = getNewFakeNameOwnerChangedMessage();
-//
-// CommonAPI::DBus::DBusOutputStream outStream1(fakeNameOwnerChangedSignal1);
-// CommonAPI::DBus::DBusOutputStream outStream2(fakeNameOwnerChangedSignal2);
-// CommonAPI::DBus::DBusOutputStream outStream3(fakeNameOwnerChangedSignal3);
-//
-// std::string serviceName = "my.fake.service";
-// std::string emptyOwner = "";
-// std::string newOwner1 = ":1:505";
-// std::string newOwner2 = ":1:506";
-//
-// outStream1 << serviceName << emptyOwner << newOwner1;
-// outStream1.flush();
-// outStream2 << serviceName << emptyOwner << newOwner2;
-// outStream2.flush();
-// outStream3 << serviceName << newOwner1 << emptyOwner;
-// outStream3.flush();
-//
-// registry->onDBusDaemonProxyNameOwnerChangedEvent(serviceName, emptyOwner, newOwner1);
-// registry->onDBusDaemonProxyNameOwnerChangedEvent(serviceName, emptyOwner, newOwner2);
-// registry->onDBusDaemonProxyNameOwnerChangedEvent(serviceName, newOwner1, emptyOwner);
-//}
-
-
-TEST_F(DBusServiceRegistryTest, DISABLED_PredefinedInstances) {
-// auto stubDBusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
-//
-// ASSERT_TRUE(stubDBusConnection->connect());
-// ASSERT_TRUE(stubDBusConnection->requestServiceNameAndBlock(dbusServiceName));
-//
-// auto proxyDBusConnection = CommonAPI::DBus::DBusConnection::getSessionBus();
-// auto dbusServiceRegistry = proxyDBusConnection->getDBusServiceRegistry();
-// std::unordered_map<std::string, std::promise<CommonAPI::AvailabilityStatus> > instanceStatusPromises;
-// std::unordered_map<std::string, CommonAPI::DBus::DBusServiceRegistry::Subscription> instanceSubscriptions;
-//
-// for (auto& predefinedInstance : predefinedInstancesMap) {
-// const std::string& commonApiAddress = predefinedInstance.second;
-//
-// instanceSubscriptions[commonApiAddress] = dbusServiceRegistry->subscribeAvailabilityListener(
-// commonApiAddress,
-// [&] (const CommonAPI::AvailabilityStatus& availabilityStatus) -> CommonAPI::SubscriptionStatus {
-// instanceStatusPromises[commonApiAddress].set_value(availabilityStatus);
-// return CommonAPI::SubscriptionStatus::RETAIN;
-// });
-// }
-//
-// ASSERT_TRUE(proxyDBusConnection->connect());
-//
-// for (auto& predefinedInstance : predefinedInstancesMap) {
-// const std::string& dbusInterfaceName = predefinedInstance.first.first;
-// const std::string& dbusObjectPath = predefinedInstance.first.second;
-// const std::string& commonApiAddress = predefinedInstance.second;
-//
-// auto instanceStatusFuture = instanceStatusPromises[commonApiAddress].get_future();
-// auto instanceStatusFutureStatus = instanceStatusFuture.wait_for(std::chrono::milliseconds(2000));
-// const bool instanceReady = CommonAPI::DBus::checkReady(instanceStatusFutureStatus);
-//
-// ASSERT_TRUE(instanceReady);
-//
-// std::promise<CommonAPI::AvailabilityStatus> postInstanceStatusPromise;
-// auto postInstanceSubscription = dbusServiceRegistry->subscribeAvailabilityListener(
-// commonApiAddress,
-// [&] (const CommonAPI::AvailabilityStatus& availabilityStatus) -> CommonAPI::SubscriptionStatus {
-// postInstanceStatusPromise.set_value(availabilityStatus);
-// return CommonAPI::SubscriptionStatus::RETAIN;
-// });
-//
-// auto postInstanceStatusFuture = postInstanceStatusPromise.get_future();
-// auto postInstanceStatusFutureStatus = postInstanceStatusFuture.wait_for(std::chrono::milliseconds(2000));
-// const bool postInstanceReady = CommonAPI::DBus::checkReady(postInstanceStatusFutureStatus);
-//
-// ASSERT_TRUE(postInstanceReady);
-//
-// dbusServiceRegistry->unsubscribeAvailabilityListener(commonApiAddress, postInstanceSubscription);
-// dbusServiceRegistry->unsubscribeAvailabilityListener(commonApiAddress, instanceSubscriptions[commonApiAddress]);
-//
-//
-// bool isInstanceAlive = dbusServiceRegistry->isServiceInstanceAlive(dbusInterfaceName, dbusServiceName, dbusObjectPath);
-// for (int i = 0; !isInstanceAlive && i < 100; i++) {
-// std::this_thread::sleep_for(std::chrono::milliseconds(10));
-// isInstanceAlive = dbusServiceRegistry->isServiceInstanceAlive(dbusInterfaceName, dbusServiceName, dbusObjectPath);
-// }
-//
-// ASSERT_TRUE(isInstanceAlive);
-//
-//
-// std::vector<std::string> availableDBusServiceInstances = dbusServiceRegistry->getAvailableServiceInstances(dbusInterfaceName);
-// bool availableInstanceFound = false;
-//
-// for (auto& availableInstance : availableDBusServiceInstances) {
-// if (availableInstance == commonApiAddress) {
-// availableInstanceFound = true;
-// break;
-// }
-// }
-//
-// ASSERT_TRUE(availableInstanceFound);
-// }
-}
-
-const char domain[] = "local";
-const char serviceAddress_[] = "local:test.service.name:test.instance.name";
-const char serviceName_[] = "test.service.name";
-const char nonexistingServiceAddress_[] = "local:nonexisting.service.name:nonexisting.instance.name";
-const char nonexistingServiceName_[] = "nonexisting.service.name";
-
-
-
-
-class DBusServiceDiscoveryTestWithPredefinedRemote: public ::testing::Test {
- protected:
- virtual void SetUp() {
- runtime_ = CommonAPI::Runtime::get();
- auto stub = std::make_shared<v1_0::commonapi::tests::TestInterfaceStubDefault>();
- runtime_->registerService(domain, serviceAddress_, stub);
- usleep(500 * 1000);
- }
-
- virtual void TearDown() {
- //runtime_->unregisterService(serviceAddress_);
- usleep(500 * 1000);
- }
-
- private:
- std::shared_ptr<CommonAPI::Runtime> runtime_;
-};
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, RecognizesInstanceOfExistingServiceAsAliveAsync) {
- //Wait for synchronous availability of the service, then verify the async version gets the same result
- ASSERT_TRUE(clientFactory_->isServiceInstanceAlive(serviceAddress_));
-
- std::promise<bool> promisedResult;
- std::future<bool> futureResult = promisedResult.get_future();
-
- clientFactory_->isServiceInstanceAliveAsync(
- [&] (bool isAlive) {
- promisedResult.set_value(isAlive);
- },
- serviceAddress_);
-
- EXPECT_TRUE(futureResult.get());
-}
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, RecognizesInstanceOfNonexistingServiceAsDeadAsync) {
- //Wait for synchronous availability of the service, then verify the async version gets the same result
- ASSERT_FALSE(clientFactory_->isServiceInstanceAlive(nonexistingServiceAddress_));
-
- std::promise<bool> promisedResult;
- std::future<bool> futureResult = promisedResult.get_future();
-
- clientFactory_->isServiceInstanceAliveAsync(
- [&] (bool isAlive) {
- promisedResult.set_value(isAlive);
- },
- nonexistingServiceAddress_);
-
- EXPECT_FALSE(futureResult.get());
-}
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, FindsInstancesOfExistingTestService) {
- EXPECT_EQ(1, clientFactory_->getAvailableServiceInstances(serviceName_).size());
-}
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, FindsInstancesOfExistingTestServiceAsync) {
- //Wait for synchronous availability of the service, then verify the async version gets the same result
- ASSERT_EQ(1, clientFactory_->getAvailableServiceInstances(serviceName_).size());
-
- std::promise<std::vector<std::string>> promisedResult;
- std::future<std::vector<std::string>> futureResult = promisedResult.get_future();
-
- clientFactory_->getAvailableServiceInstancesAsync(
- [&] (std::vector<std::string>& instances) {
- promisedResult.set_value(instances);
- },
- serviceName_);
-
-
- std::vector<std::string> result = futureResult.get();
-
- EXPECT_EQ(1, result.size());
-}
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, FindsNoInstancesOfNonexistingTestService) {
- std::vector<std::string> result = clientFactory_->getAvailableServiceInstances(nonexistingServiceName_);
- EXPECT_EQ(0, result.size());
-}
-
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, FindsNoInstancesOfNonexistingTestServiceAsync) {
- //Wait for synchronous availability of the service, then verify the async version gets the same result
- ASSERT_EQ(0, clientFactory_->getAvailableServiceInstances(nonexistingServiceName_).size());
-
- std::promise<std::vector<std::string>> promisedResult;
- std::future<std::vector<std::string>> futureResult = promisedResult.get_future();
-
- clientFactory_->getAvailableServiceInstancesAsync(
- [&] (std::vector<std::string>& instances) {
- promisedResult.set_value(instances);
- },
- nonexistingServiceName_);
-
- EXPECT_EQ(0, futureResult.get().size());
-}
-
-// disable that test, because vs2013's "high_resolution_clock" is not accurate enough to measure that
-// see the microsoft bug report there: https://connect.microsoft.com/VisualStudio/feedback/details/719443/
-#ifndef WIN32
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, ServiceRegistryUsesCacheForResolvingOneService) {
- std::chrono::system_clock::time_point startTimeWithColdCache = std::chrono::high_resolution_clock::now();
- ASSERT_TRUE(clientFactory_->isServiceInstanceAlive(serviceAddress_));
- std::chrono::system_clock::time_point endTimeWithColdCache = std::chrono::high_resolution_clock::now();
-
- unsigned long durationWithColdCache = std::chrono::duration_cast<std::chrono::nanoseconds>(
- endTimeWithColdCache - startTimeWithColdCache).count();
-
- std::chrono::system_clock::time_point startTimeWithHotCache = std::chrono::high_resolution_clock::now();
- ASSERT_TRUE(clientFactory_->isServiceInstanceAlive(serviceAddress_));
- std::chrono::system_clock::time_point endTimeWithHotCache = std::chrono::high_resolution_clock::now();
-
- unsigned long durationWithHotCache = std::chrono::duration_cast<std::chrono::nanoseconds>(
- endTimeWithHotCache - startTimeWithHotCache).count();
-
- ASSERT_GT(durationWithHotCache, 0);
-
- double speedRatio = durationWithColdCache / durationWithHotCache;
-
- EXPECT_GE(speedRatio, 100);
-}
-#endif
-
-TEST_F(DBusServiceDiscoveryTestWithPredefinedRemote, DISABLED_ServiceRegistryUsesCacheForResolvingWholeBus) {
- std::chrono::system_clock::time_point startTimeWithColdCache = std::chrono::system_clock::now();
- ASSERT_EQ(1, clientFactory_->getAvailableServiceInstances(serviceName_).size());
- std::chrono::system_clock::time_point endTimeWithColdCache = std::chrono::system_clock::now();
-
- long durationWithColdCache = std::chrono::duration_cast<std::chrono::microseconds>(endTimeWithColdCache - startTimeWithColdCache).count();
-
- std::chrono::system_clock::time_point startTimeWithHotCache = std::chrono::system_clock::now();
- ASSERT_EQ(1, clientFactory_->getAvailableServiceInstances(serviceName_).size());
- std::chrono::system_clock::time_point endTimeWithHotCache = std::chrono::system_clock::now();
-
- long durationWithHotCache = std::chrono::duration_cast<std::chrono::microseconds>(endTimeWithHotCache - startTimeWithHotCache).count();
-
- double speedRatio = durationWithColdCache / durationWithHotCache;
-
- EXPECT_GE(speedRatio, 100);
-}
-
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusStubAdapterTest.cpp b/src/test/DBusStubAdapterTest.cpp
index 85216d0..5c1d742 100644
--- a/src/test/DBusStubAdapterTest.cpp
+++ b/src/test/DBusStubAdapterTest.cpp
@@ -104,10 +104,10 @@ class TestDBusStubAdapter: public TestStubAdapter, public TestStubAdapterHelper
const std::shared_ptr<CommonAPI::DBus::DBusConnection>& dbusConnection,
const std::shared_ptr<TestStub>& testStub) :
TestStubAdapterHelper(
- CommonAPI::DBus::DBusAddress(dbusBusName, dbusObjectPath, "org.genivi.CommonAPI.DBus.TestInterface"),
+ CommonAPI::DBus::DBusAddress(dbusBusName, dbusObjectPath, "org.genivi.CommonAPI.DBus.TestInterface"),
dbusConnection,
testStub,
- false) {
+ false) {
}
virtual void fireTestAttributeChanged(const int32_t& testValue) {
@@ -202,7 +202,7 @@ int main(void) {
"/common/api/dbus/TestDBusInterfaceAdapter",
dbusConnection,
testStub);
- testStubAdapter->init(testStubAdapter);
+ testStubAdapter->init(testStubAdapter);
auto dbusMessageCall = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress("org.genivi.CommonAPI.DBus.TestDBusInterfaceAdapter", testStubAdapter->getDBusAddress().getObjectPath().c_str(), testStubAdapter->getDBusAddress().getService().c_str()), "GetEmptyResponse");
diff --git a/src/test/DBusTestUtils.hpp b/src/test/DBusTestUtils.hpp
index 5761ff3..2343ec1 100644
--- a/src/test/DBusTestUtils.hpp
+++ b/src/test/DBusTestUtils.hpp
@@ -82,6 +82,10 @@ inline std::string toString(CommonAPI::CallStatus state) {
return "REMOTE_ERROR";
case CommonAPI::CallStatus::SUCCESS:
return "SUCCESS";
+ case CommonAPI::CallStatus::UNKNOWN:
+ return "UNKNOWN";
+ default:
+ return "";
}
return "";
}
diff --git a/src/test/DBusTypeStreamTest.cpp b/src/test/DBusTypeStreamTest.cpp
deleted file mode 100644
index b7e5592..0000000
--- a/src/test/DBusTypeStreamTest.cpp
+++ /dev/null
@@ -1,335 +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 <unordered_map>
-#include <vector>
-
-#include <CommonAPI/Struct.hpp>
-#include <CommonAPI/Variant.hpp>
-#include <CommonAPI/Types.hpp>
-#include <CommonAPI/ByteBuffer.hpp>
-
-#include <CommonAPI/DBus/DBusInputStream.hpp>
-#include <CommonAPI/DBus/DBusOutputStream.hpp>
-
-#include "commonapi/tests/DerivedTypeCollection.hpp"
-
-#include <type_traits>
-
-
-struct TestStructWithVariant: public CommonAPI::Struct<uint16_t, std::string, CommonAPI::Variant<uint32_t, double, std::vector<std::string>>> {
- TestStructWithVariant(): uint16Val_(42), stringVal_("Hai!"), variantVal_(13.37) {
-
- }
-
- virtual ~TestStructWithVariant() {}
-
- virtual void readFromInputStream(CommonAPI::InputStream<CommonAPI::DBus::DBusInputStream>& inputStream) {
- }
-
- virtual void writeToOutputStream(CommonAPI::OutputStream<CommonAPI::DBus::DBusOutputStream>& outputStream) const {
- }
-
- static void writeToTypeOutputStream(CommonAPI::TypeOutputStream<CommonAPI::DBus::DBusTypeOutputStream>& typeOutputStream) {
- CommonAPI::TypeWriter<uint16_t>::writeType(typeOutputStream);
- CommonAPI::TypeWriter<std::string>::writeType(typeOutputStream);
- CommonAPI::TypeWriter<CommonAPI::Variant<uint32_t, double, std::vector<std::string>>>::writeType(typeOutputStream);
- }
-
- private:
- uint16_t uint16Val_;
- std::string stringVal_;
- CommonAPI::Variant<uint32_t, double, std::vector<std::string>> variantVal_;
-};
-
-
-typedef std::vector<::commonapi::tests::DerivedTypeCollection::TestEnum> TestEnumList;
-
-
-class TypeOutputStreamTest: public ::testing::Test {
- protected:
-
- void SetUp() {
- }
-
- void TearDown() {
- }
-
- CommonAPI::DBus::DBusTypeOutputStream typeStream_;
-};
-
-
-
-TEST_F(TypeOutputStreamTest, CreatesBasicTypeSignatures) {
- CommonAPI::TypeWriter<bool>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("b") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesInt8Signature) {
- CommonAPI::TypeWriter<int8_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("y") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesInt16Signature) {
- CommonAPI::TypeWriter<int16_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("n") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesInt32Signature) {
- CommonAPI::TypeWriter<int32_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("i") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesInt64Signature) {
- CommonAPI::TypeWriter<int64_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("x") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesUInt8Signature) {
- CommonAPI::TypeWriter<uint8_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("y") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesUInt16Signature) {
- CommonAPI::TypeWriter<uint16_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("q") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesUInt32Signature) {
- CommonAPI::TypeWriter<uint32_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("u") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesUInt64Signature) {
- CommonAPI::TypeWriter<uint64_t>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("t") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesFloatSignature) {
- CommonAPI::TypeWriter<float>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("d") == 0);
-}
-TEST_F(TypeOutputStreamTest, CreatesDoubleSignature) {
- CommonAPI::TypeWriter<double>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("d") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesStringSignature) {
- CommonAPI::TypeWriter<std::string>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("s") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesByteBufferSignature) {
- CommonAPI::TypeWriter<CommonAPI::ByteBuffer>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("ay") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVersionSignature) {
- CommonAPI::TypeWriter<CommonAPI::Version>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(uu)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesInt32EnumSignature) {
- CommonAPI::TypeWriter<::commonapi::tests::DerivedTypeCollection::TestEnum>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("i") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVariantWithBasicTypesSignature) {
- CommonAPI::TypeWriter<CommonAPI::Variant<int, double, std::string>>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(yv)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVariantWithVariantSignature) {
- CommonAPI::TypeWriter<CommonAPI::Variant<int, CommonAPI::Variant<int, double, std::string>, CommonAPI::Variant<int, CommonAPI::Variant<int, double, std::string>, std::string>, std::string>>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(yv)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfStringsSignature) {
- CommonAPI::TypeWriter<std::vector<std::string> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("as") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfInt32EnumsSignature) {
- CommonAPI::TypeWriter<TestEnumList>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("ai") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfVersionsSignature) {
- CommonAPI::TypeWriter<std::vector<CommonAPI::Version> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("a(uu)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfVariantsSignature) {
- CommonAPI::TypeWriter<std::vector<CommonAPI::Variant<int, double, std::string>> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("a(yv)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfVectorOfStringsSignature) {
- CommonAPI::TypeWriter<std::vector<std::vector<std::string>> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("aas") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfVectorOfVariantsSignature) {
- CommonAPI::TypeWriter<std::vector<std::vector<CommonAPI::Variant<int, double, std::string>>> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("aa(yv)") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesMapOfUInt16ToStringSignature) {
- CommonAPI::TypeWriter<std::unordered_map<uint16_t, std::string>>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("a{qs}") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, CreatesVectorOfMapsOfUInt16ToStringSignature) {
- CommonAPI::TypeWriter<std::vector<std::unordered_map<uint16_t, std::string>> >::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("aa{qs}") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfTestStructCorrectly) {
- CommonAPI::TypeWriter<TestStructWithVariant>::writeType(typeStream_);
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(qs(yv))") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfUInt32TypeVariantsCorrectly) {
- uint32_t fromUInt = 42;
- CommonAPI::Variant<uint32_t, double, uint16_t> myVariant(fromUInt);
-
- myVariant.writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("u") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfStringTypeVariantsCorrectly) {
- std::string fromString = "Hai!";
- CommonAPI::Variant<uint32_t, double, std::string> myVariant(fromString);
-
- myVariant.writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("s") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfVectorTypeVariantsCorrectly) {
- std::vector<std::string> fromStringVector;
- CommonAPI::Variant<uint32_t, double, std::vector<std::string>> myVariant(fromStringVector);
-
- myVariant.writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("as") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfTestStructTypeVariantsCorrectly) {
- TestStructWithVariant fromTestStruct;
- CommonAPI::Variant<uint32_t, double, TestStructWithVariant> myVariant(fromTestStruct);
-
- myVariant.writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(qs(yv))") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericUInt32TypeVariantsCorrectly) {
- uint32_t fromUInt = 42;
- CommonAPI::Variant<uint32_t, double, uint16_t> myVariant(fromUInt);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("u") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericInt32EnumTypeVariantsCorrectly) {
- ::commonapi::tests::DerivedTypeCollection::TestEnum fromInt32Enum = ::commonapi::tests::DerivedTypeCollection::TestEnum::E_OK;
- CommonAPI::Variant<uint32_t, double, ::commonapi::tests::DerivedTypeCollection::TestEnum> myVariant(fromInt32Enum);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("i") == 0);
-}
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericStringTypeVariantsCorrectly) {
- std::string fromString = "Hai!";
- CommonAPI::Variant<uint32_t, double, std::string> myVariant(fromString);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("s") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericVectorTypeVariantsCorrectly) {
- std::vector<std::string> fromStringVector;
- CommonAPI::Variant<uint32_t, double, std::vector<std::string>> myVariant(fromStringVector);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("as") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericVectorOfInt32EnumTypeVariantsCorrectly) {
- TestEnumList fromEnumVector;
- CommonAPI::Variant<uint32_t, double, TestEnumList> myVariant(fromEnumVector);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("ai") == 0);
-}
-
-
-TEST_F(TypeOutputStreamTest, ParsesSignatureOfGenericTestStructTypeVariantsCorrectly) {
- TestStructWithVariant fromTestStruct;
- CommonAPI::Variant<uint32_t, double, TestStructWithVariant> myVariant(fromTestStruct);
- CommonAPI::SerializableVariant* genericVariant = &myVariant;
-
- genericVariant->writeToTypeOutputStream(typeStream_);
-
- std::string signature = typeStream_.retrieveSignature();
- ASSERT_TRUE(signature.compare("(qs(yv))") == 0);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/DBusVariantOutputStreamTest.cpp b/src/test/DBusVariantOutputStreamTest.cpp
index 46267f8..b23e12f 100644
--- a/src/test/DBusVariantOutputStreamTest.cpp
+++ b/src/test/DBusVariantOutputStreamTest.cpp
@@ -44,17 +44,17 @@ typedef Variant<int,bool> InnerVar;
struct MyStruct: CommonAPI::Struct<uint32_t, InnerVar, bool, std::string, double> {
~MyStruct();
- virtual uint32_t getA() { return std::get<0>(values_); }
- virtual InnerVar 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 setA(uint32_t a) { std::get<0>(values_) = a; }
- virtual void setB(InnerVar 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 uint32_t getA() { return std::get<0>(values_); }
+ virtual InnerVar 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 setA(uint32_t a) { std::get<0>(values_) = a; }
+ virtual void setB(InnerVar 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; }
};
MyStruct::~MyStruct() {
@@ -64,11 +64,11 @@ bool operator==(const MyStruct& lhs, const MyStruct& 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_));
+ 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_));
;
}
@@ -78,19 +78,18 @@ TEST_F(VariantOutputStreamTest, CanBeCalled) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
int fromInt = 14132;
Variant<int, bool> inVariant(fromInt);
Variant<int, bool> outVariant;
-
- outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<int, bool>*>(nullptr));
+ outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
outputStream.flush();
DBus::DBusInputStream inputStream(message);
- inputStream.readValue(outVariant, static_cast<CommonAPI::DBus::VariantDeployment<int, bool>*>(nullptr));
+ inputStream.readValue(outVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::EmptyDeployment, CommonAPI::EmptyDeployment>*>(nullptr));
EXPECT_TRUE(outVariant.isType<int>());
EXPECT_EQ(inVariant.get<int>(), outVariant.get<int>());
@@ -98,7 +97,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
int fromInt = 14132;
@@ -108,12 +107,12 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
Variant<InnerVar, std::string, float> outVariant;
- outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::DBus::VariantDeployment<EmptyDeployment, EmptyDeployment>, EmptyDeployment, EmptyDeployment>*>(nullptr));
+ outputStream.writeValue(inVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::DBus::VariantDeployment<EmptyDeployment, EmptyDeployment>, EmptyDeployment, EmptyDeployment>*>(nullptr));
outputStream.flush();
DBus::DBusInputStream inputStream(message);
-
- inputStream.readValue(outVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::DBus::VariantDeployment<EmptyDeployment, EmptyDeployment>, EmptyDeployment, EmptyDeployment>*>(nullptr));
+
+ inputStream.readValue(outVariant, static_cast<CommonAPI::DBus::VariantDeployment<CommonAPI::DBus::VariantDeployment<EmptyDeployment, EmptyDeployment>, EmptyDeployment, EmptyDeployment>*>(nullptr));
EXPECT_TRUE(outVariant.isType<InnerVar>());
EXPECT_EQ(inVariant.get<InnerVar>(), outVariant.get<InnerVar>());
@@ -121,7 +120,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInStruct) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
int fromInt = 14132;
@@ -145,7 +144,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInStruct) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInArray) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
int fromInt = 14132;
@@ -170,7 +169,7 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInArray) {
}
TEST_F(VariantOutputStreamTest, CanWriteArrayInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
typedef std::vector<int> IntVector;
@@ -199,7 +198,7 @@ TEST_F(VariantOutputStreamTest, CanWriteArrayInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteStructInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
typedef Variant<MyStruct, std::string> StructVariant;
@@ -226,7 +225,7 @@ TEST_F(VariantOutputStreamTest, CanWriteStructInVariant) {
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInStructInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
typedef Variant<MyStruct, std::string> StructVariant;
@@ -247,13 +246,13 @@ TEST_F(VariantOutputStreamTest, CanWriteVariantInStructInVariant) {
EXPECT_TRUE(outVariant.isType<MyStruct>());
EXPECT_EQ(inVariant.get<MyStruct>(), outVariant.get<MyStruct>());
- EXPECT_TRUE(std::get<1>(inVariant.get<MyStruct>().values_) == std::get<1>(outVariant.get<MyStruct>().values_));
- EXPECT_TRUE(std::get<1>(inVariant.get<MyStruct>().values_).get<int>() == std::get<1>(outVariant.get<MyStruct>().values_).get<int>());
+ EXPECT_TRUE(std::get<1>(inVariant.get<MyStruct>().values_) == std::get<1>(outVariant.get<MyStruct>().values_));
+ EXPECT_TRUE(std::get<1>(inVariant.get<MyStruct>().values_).get<int>() == std::get<1>(outVariant.get<MyStruct>().values_).get<int>());
EXPECT_TRUE(inVariant == outVariant);
}
TEST_F(VariantOutputStreamTest, CanWriteVariantInArrayInVariant) {
- message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
+ message = CommonAPI::DBus::DBusMessage::createMethodCall(CommonAPI::DBus::DBusAddress(busName, objectPath, interfaceName), methodName, signature);
DBus::DBusOutputStream outputStream(message);
typedef std::vector<InnerVar> VarVector;
diff --git a/src/test/DemoMainLoop.hpp b/src/test/DemoMainLoop.hpp
index 0626d3c..52c2c5e 100644
--- a/src/test/DemoMainLoop.hpp
+++ b/src/test/DemoMainLoop.hpp
@@ -43,14 +43,14 @@ class MainLoop {
context_(context),
currentMinimalTimeoutInterval_(TIMEOUT_INFINITE),
breakLoop_(false),
- running_(false){
+ running_(false){
#ifdef WIN32
- WSAEVENT wsaEvent = WSACreateEvent();
+ WSAEVENT wsaEvent = WSACreateEvent();
- if (wsaEvent != WSA_INVALID_EVENT) {
- wakeFd_.fd = PtrToInt(wsaEvent);
- }
+ if (wsaEvent != WSA_INVALID_EVENT) {
+ wakeFd_.fd = PtrToInt(wsaEvent);
+ }
#else
wakeFd_.fd = eventfd(0, EFD_SEMAPHORE | EFD_NONBLOCK);
#endif
@@ -81,7 +81,7 @@ class MainLoop {
context_->unsubscribeForWakeupEvents(wakeupListenerSubscription_);
#ifdef WIN32
- WSACloseEvent(IntToPtr(wakeFd_.fd));
+ WSACloseEvent(IntToPtr(wakeFd_.fd));
#else
close(wakeFd_.fd);
@@ -172,15 +172,15 @@ class MainLoop {
}
#if WIN32
- INT currentMinimalTimeoutIntervalWin32_ = 1;
- size_t numReadyFileDescriptors = ::WSAPoll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutIntervalWin32_);
+ 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);
- }
+ if (numReadyFileDescriptors == SOCKET_ERROR) {
+ int iError = WSAGetLastError();
+ //printf("WSAPoll failed with error: %ld\n", iError);
+ }
#else
- size_t numReadyFileDescriptors = ::poll(&(managedFileDescriptors_[0]), managedFileDescriptors_.size(), currentMinimalTimeoutInterval_);
+ 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"
@@ -263,7 +263,9 @@ class MainLoop {
SetEvent(h);
#else
int64_t wake = 1;
- ::write(wakeFd_.fd, &wake, sizeof(int64_t));
+ if(::write(wakeFd_.fd, &wake, sizeof(int64_t)) == -1) {
+ std::perror("MainLoop::wakeup");
+ }
#endif
}
diff --git a/src/test/FakeGlueCode.cpp b/src/test/FakeGlueCode.cpp
new file mode 100644
index 0000000..8911bdd
--- /dev/null
+++ b/src/test/FakeGlueCode.cpp
@@ -0,0 +1,5 @@
+// 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/.
+
diff --git a/src/test/README.txt b/src/test/README.txt
index c318bde..5f5a0ea 100644
--- a/src/test/README.txt
+++ b/src/test/README.txt
@@ -1,12 +1,35 @@
-This readme contains information for executing the CommonAPI-D-Bus unit tests.
+This file contains information for executing the CommonAPI-D-Bus unit tests.
-Before executing the tests it has to be secured, that the LD_LIBRARY_PATH contains the folder containing the dbus libraries.
+Required environment variables:
+-------------------------------
-Information for DBusAddressTranslatorTest:
-The environment variable COMMONAPI_DBUS_DEFAULT_CONFIG must be set. The variable has to contain the absolute path to the commonapi-dbus.ini file contained in the folder src/test of the CommonAPI-D-Bus binding.
-e.g. export COMMONAPI_DBUS_DEFAULT_CONFIG=/home/<user>/git/ascgit017.CommonAPI-D-Bus/src/test/commonapi-dbus.ini
+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.
-Furthermore the environment variable TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER must be set. The variable has to contain the absolute path of the folder, containing the FakeLegacyService python files.
-e.g. export TEST_COMMONAPI_DBUS_ADDRESS_TRANSLATOR_FAKE_LEGACY_SERVICE_FOLDER=/home/<user>/git/ascgit017.CommonAPI-D-Bus/src/test/fakeLegacyService
+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
+
+Building and executing- the tests:
+----------------------------------
+
+If you have successfully built the CommonAPI-D-Bus library with its build system, you can now built and run the tests.
+Enter the build directory if the CommonAPI-D-Bus library and run
+
+make check
+
+This builds and runs the tests.
+
+To build and run individual tests, enter the src/test directory under the build directory.
+The individual test files are here, along with a Makefile that is able to build them.
diff --git a/src/test/commonapi-dbus.ini b/src/test/commonapi-dbus.ini
index 45df7e2..8b89b70 100644
--- a/src/test/commonapi-dbus.ini
+++ b/src/test/commonapi-dbus.ini
@@ -1,66 +1,8 @@
-[not#a$valid/address]
-[]
- 98t3hpgjvqpvnü0 t4b+qßk4 kv+üg4krgv+ß4krgv+ßkr
-[too.short:address]
-[incomplete:address:]
-[:address:incomplete]
-[]đwqervqerverver
-[too:long:address:here]
-jfgv2nqp3 riqpnvi39r[]
-[local:no.nothing.service:no.nothing.instance]
+[default]
+binding=dbus
-[local:service:instance]
-service=service.name_connection.name
-path=/path/to/object
-interface=service.name
+[logging]
+console = false
+level = warning
-[local:no.interface.service:no.interface.instance]
-service=no.interface.connection
-path=/no/interface/path
-[local:no.connection.service:no.connection.instance]
-path=/no/connection/path
-interface=no.connection.interface
-
-[local:no.object.service:no.object.instance]
-service=no.object.connection
-interface=no.object.interface
-
-[local:only.interface.service:only.interface.instance]
-interface=only.interface.interface
-
-[local:only.connection.service:only.connection.instance]
-service=only.connection.connection
-
-[local:only.object.service:only.object.instance]
-path=/only/object/path
-
-[local:fake.legacy.service.LegacyInterface:fake.legacy.service]
-service=fake.legacy.service.connection
-path=/some/legacy/path/6259504
-interface=fake.legacy.service.LegacyInterface
-
-[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceOne]
-service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceOne
-path=/commonapi/tests/managed/RootInterface
-interface=commonapi.tests.managed.RootInterface
-
-[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceTwo]
-service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceTwo
-path=/commonapi/tests/managed/RootInterface
-interface=commonapi.tests.managed.RootInterface
-
-[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceThree]
-service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceThree
-path=/commonapi/tests/managed/RootInterface
-interface=commonapi.tests.managed.RootInterface
-
-[local:commonapi.tests.managed.LeafInterface:commonapi.tests.managed.config.affects.LeafInterface.Unmanaged]
-service=commonapi.tests.managed.config.affects.interface.unmanaged
-path=/commonapi/tests/managed/RootInterface/LeafInterface/Unmanaged
-interface=commonapi.tests.managed.LeafInterface
-
-[local:commonapi.tests.managed.LeafInterface:commonapi.tests.managed.config.affects.LeafInterface.Managed]
-service=commonapi.tests.managed.config.affects.interface.managed
-path=/commonapi/tests/managed/RootInterface/LeafInterface/Managed
-interface=commonapi.tests.managed.LeafInterface
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
deleted file mode 100644
index ba9e0d4..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingBasicTest.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include <gtest/gtest.h>
-
-#include <fstream>
-
-#include "DBusDynamicLoadingDefinitions.h"
-
-#define VERSION v1_0
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- environmentIdentifier_ = COMMONAPI_ENVIRONMENT_BINDING_PATH + "=" ;
- environmentString_ = environmentIdentifier_ + currentWorkingDirectory;
- char* environment = (char*) (environmentString_.c_str());
- putenv(environment);
-
-#ifdef WIN32
- configFileName_ = _pgmptr;
-#else
- char cCurrentPath[FILENAME_MAX];
- getcwd(cCurrentPath, sizeof(cCurrentPath);
- configFileName_ = cCurrentPath;
-#endif
-
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << validForLocalDBusBinding;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
-
- char* environment = (char*) (environmentIdentifier_.c_str());
- putenv(environment);
- }
-
- std::string configFileName_;
- std::string environmentIdentifier_;
- std::string environmentString_;
-};
-
-
-class DBusDynamicLoadingBasicTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-TEST_F(DBusDynamicLoadingBasicTest, LoadsUnconfiguredDefaultDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- EXPECT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, LoadsSpecificDynamicallyLinkedDBusLibrary) {
- //DBus is defined as default binding in the configuration file
- std::shared_ptr<CommonAPI::Runtime> defaultRuntime = CommonAPI::Runtime::get();
-
- //The Fake binding has "DBus" defined as its alias, so this call will access the Fake binding!
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime = CommonAPI::Runtime::get();
-
- EXPECT_TRUE((bool)defaultRuntime);
- EXPECT_TRUE((bool)dbusRuntime);
-
- ASSERT_NE(dbusRuntime, defaultRuntime);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, LoadsAliasedDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- EXPECT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::get();
- EXPECT_TRUE((bool)runtime2);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- EXPECT_FALSE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, LoadsDBusLibraryAsSingleton) {
- //"DBus" is set as default. Due to the alias definition in the Fake binding, it would not
- //be accessible when passing this well known name as parameter, only the aliases still
- //point to the DBus binding.
- std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Runtime> runtime3 = CommonAPI::Runtime::get();
- std::shared_ptr<CommonAPI::Runtime> runtime4 = CommonAPI::Runtime::get();
-
- EXPECT_TRUE((bool)runtime1);
- EXPECT_TRUE((bool)runtime2);
- EXPECT_TRUE((bool)runtime3);
- EXPECT_TRUE((bool)runtime4);
-
- EXPECT_EQ(runtime1, runtime2);
- EXPECT_EQ(runtime1, runtime3);
- EXPECT_EQ(runtime2, runtime3);
- EXPECT_EQ(runtime1, runtime4);
- EXPECT_EQ(runtime2, runtime4);
- EXPECT_EQ(runtime3, runtime4);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, RuntimeLoadsFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, RuntimeLoadsServicePublisher) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, FactoryCanCreateProxies) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(testServiceAddressDomain, testServiceAddressInstance);
- ASSERT_TRUE((bool)defaultTestProxy);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, FakeFactoryCannotCreateProxies) {
- //Fake has the alias "DBus". Therefore, the actual DBus-binding is NOT accessible via
- //its well known name!
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(testServiceAddressDomain, testServiceAddressInstance);
- ASSERT_FALSE((bool)defaultTestProxy);
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, ServicePublisherCanRegisterStubs) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- EXPECT_TRUE(runtime->registerService(testServiceAddressDomain, testServiceAddressInstance, myStub));
- CommonAPI::Address address = myStub->getStubAdapter()->getAddress();
- EXPECT_TRUE(runtime->unregisterService(address.getDomain(), address.getInterface(), address.getInstance()));
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, FakeServicePublisherTellsUsItWontRegisterStubs) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- EXPECT_TRUE(runtime->registerService(testServiceAddressDomain, testServiceAddressInstance, myStub));
- CommonAPI::Address address = myStub->getStubAdapter()->getAddress();
- EXPECT_FALSE(runtime->unregisterService(address.getDomain(), address.getInterface(), address.getInstance()));
-}
-
-TEST_F(DBusDynamicLoadingBasicTest, CreatedProxiesAndServicesCanCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
- ASSERT_TRUE((bool)runtime);
-
- auto defaultTestProxy = runtime->buildProxy<VERSION::commonapi::tests::TestInterfaceProxy>(testServiceAddressDomain, testServiceAddressInstance);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- auto myStub = std::make_shared<VERSION::commonapi::tests::TestInterfaceStubDefault>();
-
- runtime->registerService(testServiceAddressDomain, testServiceAddressInstance, myStub);
-
- for (uint32_t i = 0; i < 300 && !defaultTestProxy->isAvailable(); ++i) {
- usleep(1000);
- }
- EXPECT_TRUE(defaultTestProxy->isAvailable());
-
- CommonAPI::CallStatus status;
- defaultTestProxy->testEmptyMethod(status);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
-
- CommonAPI::Address address = myStub->getStubAdapter()->getAddress();
- runtime->unregisterService(address.getDomain(), address.getInterface(), address.getInstance());
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif \ No newline at end of file
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h
deleted file mode 100644
index 0af6a04..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingDefinitions.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#ifndef DBUS_DYNAMIC_LOADING_DEFINITIONS_H_
-#define DBUS_DYNAMIC_LOADING_DEFINITIONS_H_
-
-#include <cstring>
-#include <string>
-
-#include <CommonAPI/CommonAPI.hpp>
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-
-#include <CommonAPI/utils.hpp>
-
-#include <v1_0/commonapi/tests/TestInterfaceProxy.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
-
-
-const char testServiceAddressDomain[] = "local";
-const char testServiceAddressInstance[] = "commonapi.tests.TestInterface";
-
-const std::string COMMONAPI_CONFIG_SUFFIX = ".conf";
-const std::string COMMONAPI_ENVIRONMENT_BINDING_PATH = "COMMONAPI_BINDING_PATH";
-
-#ifdef WIN32
-const std::string currentBinaryFileFQN = _pgmptr;
-#else
-char cCurrentPath[FILENAME_MAX];
-getcwd(cCurrentPath, sizeof(cCurrentPath);
-const std::string currentBinaryFileFQN = cCurrentPath;
-#endif
-
-const std::string currentWorkingDirectory = currentBinaryFileFQN.substr(0, currentBinaryFileFQN.find_last_of("/") + 1);
-
-const std::string firstAliasDefinition = "alias=MyFirstAlias\n";
-const std::string secondAliasDefinition = "alias=MySecondAlias\n";
-const std::string combinedAliasDefinition = "alias=MyFirstAlias:MySecondAlias\n";
-const std::string libraryDBusPathDefinition = "libpath=" + currentWorkingDirectory + "libCommonAPI-DBus.so\n";
-const std::string libraryFakePathDefinition = "libpath=" + currentWorkingDirectory + "libCommonAPI-Fake.so\n";
-const std::string generatedDBusPathDefinition = "genpath=" + currentWorkingDirectory + "libSomeOtherNameForGeneratedDBus.so\n";
-const std::string __garbageString =
- ""
- "{not#a$valid/binding+PATH}\n"
- "{}\n"
- " 98t3hpgjvqpvnü0 t4b+ qßk4 kv+üg4krgv+ß4krgv+ßkr \n"
- "{binding:blub}\n"
- "{}đwqervqerverver\n"
- "{too:much:binding}\n"
- "{binding:too:much}\n"
- "jfgv2nqp3 riqpnvi39r{}\n"
- "{hbi8uolnjk:}.-,0::9p:o:{}: bjk}{ {8h.ubpu:bzu}\n"
- "\n"
- "\n"
- "\n"
- "{noBinding:/useless/path}\n"
- "{:incomplete}\n";
-
-
-const std::string validForLocalDBusBinding =
- "{binding:DBus}\n" +
- combinedAliasDefinition +
- libraryDBusPathDefinition +
- "default\n" +
- "{binding:Fake}\n" +
- "alias=DBus\n";
-
-const std::string validForMultiplyDefinedDBusBinding =
- "{binding:DBus}\n" +
- libraryDBusPathDefinition +
- generatedDBusPathDefinition +
- firstAliasDefinition +
- "\n" +
- "{binding:DBus}\n" +
- secondAliasDefinition +
- "libpath=/useless/path";
-
-const std::string mixedValidityValuesAndBindings =
- "{binding: InvalidBinding}\n" +
- firstAliasDefinition +
- __garbageString +
- libraryDBusPathDefinition +
- "\n" +
- "{binding:BrokenPathBinding}\n" +
- "libpath=/some/path/to/nowhere\n" +
- "\n" +
- validForMultiplyDefinedDBusBinding +
- "\n"
- "{binding: }\n" +
- __garbageString +
- "alias=emptyBindingAlias\n"
- "libpath=/another/path/to/nowhere\n" +
- __garbageString;
-
-const std::string noValidityValuesAndBindings =
- __garbageString +
- "{binding: InvalidBinding}\n" +
- firstAliasDefinition +
- __garbageString +
- libraryDBusPathDefinition +
- "{binding: }\n" +
- __garbageString +
- "alias=emptyBindingAlias\n"
- "libpath=/some/path/to/nowhere\n" +
- "default\n" +
- __garbageString +
- "{binding:DBus}\n" +
- "genpath=" + currentWorkingDirectory + "libNonsense.so\n";
-
-
-#endif /* DBUS_DYNAMIC_LOADING_DEFINITIONS_H_ */
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
deleted file mode 100644
index 20becbf..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMixedValidityTest.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include <gtest/gtest.h>
-
-#include <stdexcept>
-#include <fstream>
-
-#include "DBusDynamicLoadingDefinitions.h"
-
-#ifndef COMMONAPI_INTERNAL_COMPILATION
-#define COMMONAPI_INTERNAL_COMPILATION
-#endif
-#include <CommonAPI/DBus/DBusRuntime.hpp>
-
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- environmentIdentifier_ = COMMONAPI_ENVIRONMENT_BINDING_PATH + "=" ;
- environmentString_ = environmentIdentifier_ + currentWorkingDirectory;
- char* environment = (char*) (environmentString_.c_str());
- putenv(environment);
-
-#ifdef WIN32
- configFileName_ = _pgmptr;
-#else
- char cCurrentPath[FILENAME_MAX];
- getcwd(cCurrentPath, sizeof(cCurrentPath);
- configFileName_ = cCurrentPath;
-#endif
-
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << mixedValidityValuesAndBindings;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
-
- char* environment = (char*) (environmentIdentifier_.c_str());
- putenv(environment);
- }
-
- std::string configFileName_;
- std::string environmentIdentifier_;
- std::string environmentString_;
-};
-
-
-class DBusDynamicLoadingPartiallyInvalidConfigTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, LoadsUnconfiguredDefaultDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- EXPECT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, LoadsSpecificDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> defaultRuntime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)defaultRuntime);
- EXPECT_TRUE((bool)fakeRuntime);
- //The DBus binding is alphabetically before the Fake binding, so the DBusRuntime will be loaded as default
- ASSERT_NE(fakeRuntime, defaultRuntime);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, LoadsAliasedDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("MyFirstAlias");
- //The first alias is claimed by another binding, which was defined earlier in the config
- EXPECT_FALSE((bool)runtime);
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MySecondAlias");
- EXPECT_TRUE((bool)runtime2);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("NonExisting");
- EXPECT_FALSE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, LoadsDBusLibraryAsSingleton) {
- std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::load("DBus");
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MyFirstAlias");
- std::shared_ptr<CommonAPI::Runtime> runtime3 = CommonAPI::Runtime::load("MySecondAlias");
- std::shared_ptr<CommonAPI::Runtime> runtime4 = CommonAPI::Runtime::load("DBus");
- EXPECT_TRUE((bool)runtime1);
- //The first alias is claimed by another binding, which was defined earlier in the config
- EXPECT_FALSE((bool)runtime2);
- EXPECT_TRUE((bool)runtime3);
- EXPECT_TRUE((bool)runtime4);
-
- EXPECT_NE(runtime1, runtime2);
- EXPECT_EQ(runtime1, runtime3);
- EXPECT_NE(runtime2, runtime3);
- EXPECT_EQ(runtime1, runtime4);
- EXPECT_NE(runtime2, runtime4);
- EXPECT_EQ(runtime3, runtime4);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, RuntimeLoadsFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, RuntimeLoadsServicePublisher) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, FactoryCanCreateProxies) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
- ASSERT_TRUE((bool)defaultTestProxy);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, ServicePublisherCanRegisterStubs) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- EXPECT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- servicePublisher->registerService(myStub, testServiceAddress, serviceFactory);
- servicePublisher->unregisterService(testServiceAddress);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, CreatedProxiesAndServicesCanCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- EXPECT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- servicePublisher->registerService(myStub, testServiceAddress, serviceFactory);
-
- for (uint32_t i = 0; i < 300 && !defaultTestProxy->isAvailable(); ++i) {
- usleep(1000);
- }
- EXPECT_TRUE(defaultTestProxy->isAvailable());
-
- CommonAPI::CallStatus status;
- defaultTestProxy->testEmptyMethod(status);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
-
- servicePublisher->unregisterService(testServiceAddress);
-}
-
-TEST_F(DBusDynamicLoadingPartiallyInvalidConfigTest, ErrorOnLoadingRuntimeForBrokenPath) {
- CommonAPI::Runtime::LoadState loadState;
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("BrokenPathBinding", loadState);
- ASSERT_EQ(CommonAPI::Runtime::LoadState::CONFIGURATION_ERROR, loadState);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp
deleted file mode 100644
index 9345286..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleBindingsTest.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include <gtest/gtest.h>
-
-#include "DBusDynamicLoadingDefinitions.h"
-
-
-class Environment: public ::testing::Environment {
- public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- environmentIdentifier_ = COMMONAPI_ENVIRONMENT_BINDING_PATH + "=" ;
- environmentString_ = environmentIdentifier_ + currentWorkingDirectory;
- char* environment = (char*) (environmentString_.c_str());
- putenv(environment);
- }
-
- virtual void TearDown() {
- char* environment = (char*) (environmentIdentifier_.c_str());
- putenv(environment);
- }
-
- private:
- std::string environmentIdentifier_;
- std::string environmentString_;
-};
-
-
-class DBusDynamicLoadingMultipleBindingsTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, LoadsUnconfiguredDefaultDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- EXPECT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, LoadsSpecificDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> defaultRuntime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)defaultRuntime);
- EXPECT_TRUE((bool)fakeRuntime);
- //The DBus binding is alphabetically before the Fake binding, so the DBusRuntime will be loaded as default
- ASSERT_NE(fakeRuntime, defaultRuntime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, LoadsSpecificDynamicallyLinkedFakeLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, LoadsBothDynamicallyLinkedLibrariesAtTheSameTime) {
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime = CommonAPI::Runtime::load("DBus");
- EXPECT_TRUE((bool)dbusRuntime);
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)fakeRuntime);
-
- ASSERT_NE(dbusRuntime, fakeRuntime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, LoadsBothLibrariesAsSingletons) {
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime1 = CommonAPI::Runtime::load("DBus");
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime2 = CommonAPI::Runtime::load("DBus");
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime3 = CommonAPI::Runtime::load("DBus");
- EXPECT_TRUE((bool)dbusRuntime1);
- EXPECT_TRUE((bool)dbusRuntime2);
- EXPECT_TRUE((bool)dbusRuntime3);
-
- EXPECT_EQ(dbusRuntime1, dbusRuntime2);
- EXPECT_EQ(dbusRuntime1, dbusRuntime3);
- EXPECT_EQ(dbusRuntime2, dbusRuntime3);
-
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime1 = CommonAPI::Runtime::load("Fake");
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime2 = CommonAPI::Runtime::load("Fake");
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime3 = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)fakeRuntime1);
- EXPECT_TRUE((bool)fakeRuntime2);
- EXPECT_TRUE((bool)fakeRuntime3);
-
- EXPECT_EQ(fakeRuntime1, fakeRuntime2);
- EXPECT_EQ(fakeRuntime1, fakeRuntime3);
- EXPECT_EQ(fakeRuntime2, fakeRuntime3);
-
- EXPECT_NE(fakeRuntime1, dbusRuntime1);
- EXPECT_NE(fakeRuntime1, dbusRuntime2);
- EXPECT_NE(fakeRuntime1, dbusRuntime3);
-
- EXPECT_NE(fakeRuntime2, dbusRuntime1);
- EXPECT_NE(fakeRuntime2, dbusRuntime2);
- EXPECT_NE(fakeRuntime2, dbusRuntime3);
-
- EXPECT_NE(fakeRuntime3, dbusRuntime1);
- EXPECT_NE(fakeRuntime3, dbusRuntime2);
- EXPECT_NE(fakeRuntime3, dbusRuntime3);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, RuntimesLoadBothFactories) {
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)dbusRuntime);
- std::shared_ptr<CommonAPI::Factory> dbusProxyFactory = dbusRuntime->createFactory();
- EXPECT_TRUE((bool)dbusProxyFactory);
-
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- ASSERT_TRUE((bool)fakeRuntime);
- std::shared_ptr<CommonAPI::Factory> fakeProxyFactory = dbusRuntime->createFactory();
- EXPECT_TRUE((bool)fakeProxyFactory);
-
- ASSERT_NE(dbusRuntime, fakeRuntime);
- EXPECT_NE(dbusProxyFactory, fakeProxyFactory);
-}
-
-TEST_F(DBusDynamicLoadingMultipleBindingsTest, RuntimesLoadBothServicePublishers) {
- std::shared_ptr<CommonAPI::Runtime> dbusRuntime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)dbusRuntime);
- std::shared_ptr<CommonAPI::ServicePublisher> dbusServicePublisher = dbusRuntime->getServicePublisher();
- EXPECT_TRUE((bool)dbusServicePublisher);
-
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- ASSERT_TRUE((bool)fakeRuntime);
- std::shared_ptr<CommonAPI::ServicePublisher> fakeServicePublisher = fakeRuntime->getServicePublisher();
- EXPECT_TRUE((bool)fakeServicePublisher);
-
- ASSERT_NE(dbusRuntime, fakeRuntime);
- EXPECT_NE(dbusServicePublisher, fakeServicePublisher);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif \ No newline at end of file
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp
deleted file mode 100644
index b19efbe..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingMultipleDefinitionTest.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include <gtest/gtest.h>
-
-#include <fstream>
-
-#include "DBusDynamicLoadingDefinitions.h"
-
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- environmentIdentifier_ = COMMONAPI_ENVIRONMENT_BINDING_PATH + "=" ;
- environmentString_ = environmentIdentifier_ + currentWorkingDirectory;
- char* environment = (char*) (environmentString_.c_str());
- putenv(environment);
-
-#ifdef WIN32
- configFileName_ = _pgmptr;
-#else
- char cCurrentPath[FILENAME_MAX];
- getcwd(cCurrentPath, sizeof(cCurrentPath);
- configFileName_ = cCurrentPath;
-#endif
-
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << validForMultiplyDefinedDBusBinding;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
-
- char* environment = (char*) (environmentIdentifier_.c_str());
- putenv(environment);
- }
-
- std::string configFileName_;
- std::string environmentIdentifier_;
- std::string environmentString_;
-};
-
-
-class DBusDynamicLoadingMultipleDefinitionTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, LoadsUnconfiguredDefaultDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
- EXPECT_TRUE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, LoadsSpecificDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> defaultRuntime = CommonAPI::Runtime::load();
- std::shared_ptr<CommonAPI::Runtime> fakeRuntime = CommonAPI::Runtime::load("Fake");
- EXPECT_TRUE((bool)defaultRuntime);
- EXPECT_TRUE((bool)fakeRuntime);
- //The DBus binding is alphabetically before the Fake binding, so the DBusRuntime will be loaded as default
- ASSERT_NE(fakeRuntime, defaultRuntime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, LoadsAliasedDynamicallyLinkedDBusLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("MyFirstAlias");
- EXPECT_TRUE((bool)runtime);
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MySecondAlias");
- EXPECT_TRUE((bool)runtime2);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, ReturnsEmptyPointerOnRequestForUnknownMiddleware) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("NonExisting");
- EXPECT_FALSE((bool)runtime);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, LoadsDBusLibraryAsSingleton) {
- std::shared_ptr<CommonAPI::Runtime> runtime1 = CommonAPI::Runtime::load("DBus");
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MyFirstAlias");
- std::shared_ptr<CommonAPI::Runtime> runtime3 = CommonAPI::Runtime::load("MySecondAlias");
- std::shared_ptr<CommonAPI::Runtime> runtime4 = CommonAPI::Runtime::load("DBus");
- EXPECT_TRUE((bool)runtime1);
- EXPECT_TRUE((bool)runtime2);
- EXPECT_TRUE((bool)runtime3);
- EXPECT_TRUE((bool)runtime4);
-
- EXPECT_EQ(runtime1, runtime2);
- EXPECT_EQ(runtime1, runtime3);
- EXPECT_EQ(runtime2, runtime3);
- EXPECT_EQ(runtime1, runtime4);
- EXPECT_EQ(runtime2, runtime4);
- EXPECT_EQ(runtime3, runtime4);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, RuntimeLoadsFactory) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, RuntimeLoadsServicePublisher) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, FactoryCanCreateProxies) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
- ASSERT_TRUE((bool)defaultTestProxy);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, ServicePublisherCanRegisterStubs) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- EXPECT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- servicePublisher->registerService(myStub, testServiceAddress, serviceFactory);
- servicePublisher->unregisterService(testServiceAddress);
-}
-
-TEST_F(DBusDynamicLoadingMultipleDefinitionTest, CreatedProxiesAndServicesCanCommunicate) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus");
- ASSERT_TRUE((bool)runtime);
-
- std::shared_ptr<CommonAPI::Factory> proxyFactory = runtime->createFactory();
- EXPECT_TRUE((bool)proxyFactory);
-
- auto defaultTestProxy = proxyFactory->buildProxy<commonapi::tests::TestInterfaceProxy>(testServiceAddress);
- ASSERT_TRUE((bool)defaultTestProxy);
-
- std::shared_ptr<CommonAPI::Factory> serviceFactory = runtime->createFactory();
- EXPECT_TRUE((bool)serviceFactory);
-
- std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
- EXPECT_TRUE((bool)servicePublisher);
-
- auto myStub = std::make_shared<commonapi::tests::TestInterfaceStubDefault>();
-
- servicePublisher->registerService(myStub, testServiceAddress, serviceFactory);
-
- for (uint32_t i = 0; i < 300 && !defaultTestProxy->isAvailable(); ++i) {
- usleep(1000);
- }
- EXPECT_TRUE(defaultTestProxy->isAvailable());
-
- CommonAPI::CallStatus status;
- defaultTestProxy->testEmptyMethod(status);
- ASSERT_EQ(CommonAPI::CallStatus::SUCCESS, status);
-
- servicePublisher->unregisterService(testServiceAddress);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif \ No newline at end of file
diff --git a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp b/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp
deleted file mode 100644
index 9ec6c64..0000000
--- a/src/test/dbusDynamicLoadingTests/DBusDynamicLoadingNoValidityTest.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include <gtest/gtest.h>
-
-#include <fstream>
-
-#include "DBusDynamicLoadingDefinitions.h"
-
-
-class Environment: public ::testing::Environment {
-public:
- virtual ~Environment() {
- }
-
- virtual void SetUp() {
- environmentIdentifier_ = COMMONAPI_ENVIRONMENT_BINDING_PATH + "=" ;
- environmentString_ = environmentIdentifier_ + currentWorkingDirectory;
- char* environment = (char*) (environmentString_.c_str());
- putenv(environment);
-
-#ifdef WIN32
- configFileName_ = _pgmptr;
-#else
- char cCurrentPath[FILENAME_MAX];
- getcwd(cCurrentPath, sizeof(cCurrentPath);
- configFileName_ = cCurrentPath;
-#endif
-
- configFileName_ += COMMONAPI_CONFIG_SUFFIX;
- std::ofstream configFile(configFileName_);
- ASSERT_TRUE(configFile.is_open());
- configFile << noValidityValuesAndBindings;
- configFile.close();
- }
-
- virtual void TearDown() {
- std::remove(configFileName_.c_str());
-
- char* environment = (char*) (environmentIdentifier_.c_str());
- putenv(environment);
- }
-
- std::string configFileName_;
- std::string environmentIdentifier_;
- std::string environmentString_;
-};
-
-
-class DBusDynamicLoadingFullyInvalidConfigTest: public ::testing::Test {
- protected:
- virtual void SetUp() {
- }
-
- virtual void TearDown() {
- }
-};
-
-
-TEST_F(DBusDynamicLoadingFullyInvalidConfigTest, ErrorOnLoadingWronglyConfiguredDefaultDynamicallyLinkedLibrary) {
- CommonAPI::Runtime::LoadState loadState;
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load(loadState);
- ASSERT_EQ(CommonAPI::Runtime::LoadState::CONFIGURATION_ERROR, loadState);
-}
-
-TEST_F(DBusDynamicLoadingFullyInvalidConfigTest, ErrorOnLoadingWronglyConfiguredGeneratedCodePath) {
- CommonAPI::Runtime::LoadState loadState;
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("DBus", loadState);
- ASSERT_EQ(CommonAPI::Runtime::LoadState::BINDING_ERROR, loadState);
-}
-
-TEST_F(DBusDynamicLoadingFullyInvalidConfigTest, LoadsNoAliasedDynamicallyLinkedLibrary) {
- std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load("MyFirstAlias");
- //The first alias is claimed by another binding, which was defined earlier in the config
- EXPECT_FALSE((bool)runtime);
- std::shared_ptr<CommonAPI::Runtime> runtime2 = CommonAPI::Runtime::load("MySecondAlias");
- EXPECT_FALSE((bool)runtime2);
-}
-
-#ifndef __NO_MAIN__
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- ::testing::AddGlobalTestEnvironment(new Environment());
- return RUN_ALL_TESTS();
-}
-#endif \ No newline at end of file
diff --git a/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp b/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp
deleted file mode 100644
index ba05a13..0000000
--- a/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#include "FakeBinding.h"
-
-
-const CommonAPI::MiddlewareInfo middlewareInfo("Fake", &CommonAPI::Fake::FakeRuntime::getInstance, {55, 4} );
-
-
-namespace CommonAPI {
-namespace Fake {
-
-const MiddlewareInfo FakeRuntime::middlewareInfo_ = middlewareInfo;
-
-__attribute__((constructor)) void registerFakeMiddleware(void) {
- Runtime::registerRuntimeLoader("Fake", &FakeRuntime::getInstance);
-}
-
-FakeFactory::FakeFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo, std::shared_ptr<MainLoopContext> mainLoopContext):
- CommonAPI::Factory(runtime, middlewareInfo) {}
-
-std::vector<std::string> FakeFactory::getAvailableServiceInstances(const std::string& serviceName, const std::string& serviceDomainName) {
- return std::vector<std::string>();
-}
-
-bool FakeFactory::isServiceInstanceAlive(const std::string& serviceAddress) {
- return false;
-}
-
-bool FakeFactory::isServiceInstanceAlive(const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName) {
- return false;
-}
-
-void FakeFactory::getAvailableServiceInstancesAsync(GetAvailableServiceInstancesCallback callback, const std::string& serviceName, const std::string& serviceDomainName) {}
-void FakeFactory::isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceAddress) {}
-void FakeFactory::isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName) {}
-
-std::shared_ptr<Proxy> FakeFactory::createProxy(const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain) {
- return std::shared_ptr<Proxy>(NULL);
-}
-
-bool FakeFactory::registerAdapter(std::shared_ptr<StubBase> stubBase, const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain) {
- return false;
-}
-
-bool FakeFactory::unregisterService(const std::string& participantId, const std::string& serviceName, const std::string& domain) {
- return false;
-}
-
-std::shared_ptr<FakeServicePublisher> FakeServicePublisher::getInstance() {
- static std::shared_ptr<FakeServicePublisher> instance;
- if(!instance) {
- instance = std::make_shared<FakeServicePublisher>();
- }
- return instance;
-}
-
-bool FakeServicePublisher::registerService(const std::string& serviceAddress, std::shared_ptr<FakeStubAdapter> adapter) {
- return false;
-}
-
-bool FakeServicePublisher::unregisterService(const std::string& serviceAddress) {
- return false;
-}
-
-std::shared_ptr<Runtime> FakeRuntime::getInstance() {
- static std::shared_ptr<Runtime> singleton_;
- if(!singleton_) {
- singleton_ = std::make_shared<FakeRuntime>();
- }
- return singleton_;
-}
-
-std::shared_ptr<Factory> FakeRuntime::doCreateFactory(std::shared_ptr<MainLoopContext> mainLoopContext,
- const std::string& factoryName,
- const bool nullOnInvalidName) {
- auto factory = std::make_shared<FakeFactory>(this->shared_from_this(), &middlewareInfo_, mainLoopContext);
- return factory;
-}
-
-std::shared_ptr<ServicePublisher> FakeRuntime::getServicePublisher() {
- return FakeServicePublisher::getInstance();
-}
-
-} // namespace Fake
-} // namespace CommonAPI
diff --git a/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h b/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
deleted file mode 100644
index 129be55..0000000
--- a/src/test/dbusDynamicLoadingTests/fakeTestBinding/FakeBinding.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* Copyright (C) 2013 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/. */
-#ifndef COMMONAPI_FAKE_FAKE_RUNTIME_H_
-#define COMMONAPI_FAKE_FAKE_RUNTIME_H_
-
-#include <CommonAPI/CommonAPI.hpp>
-
-
-namespace CommonAPI {
-namespace Fake {
-
-class FakeFactory: public Factory {
- public:
- FakeFactory(std::shared_ptr<Runtime> runtime, const MiddlewareInfo* middlewareInfo, std::shared_ptr<MainLoopContext> mainLoopContext);
- ~FakeFactory() {}
- std::vector<std::string> getAvailableServiceInstances(const std::string& serviceName, const std::string& serviceDomainName = "local");
- bool isServiceInstanceAlive(const std::string& serviceAddress);
- bool isServiceInstanceAlive(const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName = "local");
- void getAvailableServiceInstancesAsync(GetAvailableServiceInstancesCallback callback, const std::string& serviceName, const std::string& serviceDomainName = "local");
- void isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceAddress);
- void isServiceInstanceAliveAsync(IsServiceInstanceAliveCallback callback, const std::string& serviceInstanceID, const std::string& serviceName, const std::string& serviceDomainName = "local");
- bool unregisterService(const std::string& participantId, const std::string& serviceName, const std::string& domain);
-
- protected:
- std::shared_ptr<Proxy> createProxy(const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);
- bool registerAdapter(std::shared_ptr<StubBase> stubBase, const char* interfaceId, const std::string& participantId, const std::string& serviceName, const std::string& domain);
-};
-
-class FakeStubAdapter;
-
-class FakeServicePublisher: public ServicePublisher {
-public:
- FakeServicePublisher() {}
-
- static std::shared_ptr<FakeServicePublisher> getInstance();
-
- bool registerService(const std::string& serviceAddress, std::shared_ptr<FakeStubAdapter> adapter);
-
- bool unregisterService(const std::string& serviceAddress);
-};
-
-class FakeRuntime: public Runtime, public std::enable_shared_from_this<FakeRuntime> {
- public:
- static std::shared_ptr<Runtime> getInstance();
-
- std::shared_ptr<Factory> doCreateFactory(std::shared_ptr<MainLoopContext> mainLoopContext,
- const std::string& factoryName,
- const bool nullOnInvalidName);
-
- std::shared_ptr<ServicePublisher> getServicePublisher();
-
- static const MiddlewareInfo middlewareInfo_;
-};
-
-} // namespace Fake
-} // namespace CommonAPI
-
-
-extern "C" const CommonAPI::MiddlewareInfo middlewareInfo;
-
-#endif // COMMONAPI_FAKE_FAKE_RUNTIME_H_
diff --git a/src/test/fakeLegacyService/fakeLegacyService.py b/src/test/fakeLegacyService/fakeLegacyService.py
index cf5057e..54d6b24 100644
--- a/src/test/fakeLegacyService/fakeLegacyService.py
+++ b/src/test/fakeLegacyService/fakeLegacyService.py
@@ -18,8 +18,8 @@ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
class FakeLegacyService(dbus.service.Object):
def __init__(self, loop):
- busName = dbus.service.BusName('fake.legacy.service.LegacyInterface_fake.legacy.service', bus = dbus.SessionBus())
- dbus.service.Object.__init__(self, busName, '/fake/legacy/service')
+ busName = dbus.service.BusName('fake.legacy.service.connection', bus = dbus.SessionBus())
+ dbus.service.Object.__init__(self, busName, '/some/legacy/path/6259504')
#self.properties = {'RestartReason': 1, 'ShutdownReason': 2, 'WakeUpReason' :3, 'BootMode' :4}
self.ABus=""
self.APath=""
@@ -27,9 +27,9 @@ class FakeLegacyService(dbus.service.Object):
@dbus.service.method(dbus_interface='fake.legacy.service.Introspectable', out_signature = 's')
def Introspect(self):
- f = open('fake.legacy.service.xml', "r")
- text = f.read()
- return text
+ f = open('fake.legacy.service.xml', "r")
+ text = f.read()
+ return text
@dbus.service.method(dbus_interface='fake.legacy.service.LegacyInterface', in_signature = 'i', out_signature = 'ii')
def TestMethod(self, input):
@@ -44,9 +44,27 @@ class FakeLegacyService(dbus.service.Object):
return greeting, identifier
@dbus.service.method(dbus_interface='fake.legacy.service.LegacyInterface')
- def finish(self):
- self.loop.quit()
- return 0
+ def finish(self):
+ self.loop.quit()
+ return 0
+
+class ObjectManager(dbus.service.Object):
+ def __init__(self, loop):
+ busName = dbus.service.BusName('fake.legacy.service.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['fake.legacy.service.LegacyInterface'] = {}
+ idict['fake.legacy.service.Introspectable'] = {}
+ response['/some/legacy/path/6259504'] = idict
+ return response
nsm = FakeLegacyService(loop)
+ObjectManager(loop)
loop.run()
diff --git a/src/test/fakeLegacyService/sendToFakeLegacyService.py b/src/test/fakeLegacyService/sendToFakeLegacyService.py
index c098173..f2a09d5 100644
--- a/src/test/fakeLegacyService/sendToFakeLegacyService.py
+++ b/src/test/fakeLegacyService/sendToFakeLegacyService.py
@@ -11,23 +11,23 @@ import gobject
import math
import dbus
import dbus.service
-
+
def finish():
- try:
- bus = dbus.SessionBus()
- remote_object = bus.get_object('fake.legacy.service.LegacyInterface_fake.legacy.service','/fake/legacy/service')
- iface = dbus.Interface(remote_object, 'fake.legacy.service.LegacyInterface')
- iface.finish()
- return 0
- except:
- print "Service not existing, therefore could not be stopped"
- return 1
+ try:
+ bus = dbus.SessionBus()
+ remote_object = bus.get_object('fake.legacy.service.connection','/some/legacy/path/6259504')
+ iface = dbus.Interface(remote_object, 'fake.legacy.service.LegacyInterface')
+ iface.finish()
+ return 0
+ except:
+ print "Service not existing, therefore could not be stopped"
+ return 1
def main():
- command=sys.argv[1]
- if command=="finish":
- return finish()
-
- return 0
+ command=sys.argv[1]
+ if command=="finish":
+ return finish()
+
+ return 0
sys.exit(main())
diff --git a/src/test/root.fidl b/src/test/root.fidl
index 78bfe15..f669ed9 100644
--- a/src/test/root.fidl
+++ b/src/test/root.fidl
@@ -52,5 +52,5 @@ interface RootInterface manages LeafInterface, BranchInterface {
}
interface SecondRoot manages LeafInterface {
- version { major 1 minor 0 }
+ 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
index 46c9704..5d19435 100644
--- a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp
+++ b/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
diff --git a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp b/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
index 90589dc..201d486 100644
--- a/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
+++ b/src/test/src-gen/core/commonapi/tests/DerivedTypeCollection.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -58,11 +58,8 @@ struct DerivedTypeCollection {
}
};
- typedef std::vector<TestStruct> TestArrayTestStruct;
+ typedef std::vector<DerivedTypeCollection::TestStruct> TestArrayTestStruct;
typedef std::unordered_map<uint32_t, ::commonapi::tests::DerivedTypeCollection::TestArrayTestStruct> TestMap;
- /**
- * description: Common errors.
- */
struct TestEnum : CommonAPI::Enumeration<int32_t> {
enum Literal : int32_t {
@@ -72,9 +69,24 @@ struct DerivedTypeCollection {
E_NOT_USED = 3
};
- TestEnum() = default;
+ TestEnum()
+ : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E_UNKNOWN)) {}
TestEnum(const Literal &_value)
: CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
+ TestEnum(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+
+ 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_); }
@@ -96,14 +108,28 @@ struct DerivedTypeCollection {
E_NEW = 4
};
- TestEnumExtended() = default;
+ TestEnumExtended()
+ : TestEnum(static_cast<TestEnum::Literal>(Literal::E_NEW)) {}
TestEnumExtended(const Literal &_value)
- : TestEnum(static_cast<TestEnum::Literal>(_value)) {}
+ : TestEnum(static_cast<int32_t>(_value)) {}
+ TestEnumExtended(const int32_t &_value)
+ : TestEnum(_value) {}
+ TestEnumExtended(const TestEnum::Literal &_value)
+ : TestEnum(_value) {}
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_NEW):
+ return true;
+ default:
+ return TestEnum::validate();
+ }
+ }
+
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_); }
@@ -124,9 +150,16 @@ struct DerivedTypeCollection {
E_NEW2 = 5
};
- TestEnumExtended2() = default;
+ TestEnumExtended2()
+ : TestEnumExtended(static_cast<TestEnumExtended::Literal>(Literal::E_NEW2)) {}
TestEnumExtended2(const Literal &_value)
- : TestEnumExtended(static_cast<TestEnumExtended::Literal>(_value)) {}
+ : TestEnumExtended(static_cast<int32_t>(_value)) {}
+ TestEnumExtended2(const int32_t &_value)
+ : TestEnumExtended(_value) {}
+ TestEnumExtended2(const TestEnum::Literal &_value)
+ : TestEnumExtended(_value) {}
+ TestEnumExtended2(const TestEnumExtended::Literal &_value)
+ : TestEnumExtended(_value) {}
TestEnumExtended2 &operator=(const TestEnumExtended::Literal &_value) {
value_ = static_cast<int32_t>(_value);
return (*this);
@@ -136,6 +169,15 @@ struct DerivedTypeCollection {
return (*this);
}
+ inline bool validate() const {
+ switch (value_) {
+ case static_cast<int32_t>(Literal::E_NEW2):
+ return true;
+ default:
+ return TestEnumExtended::validate();
+ }
+ }
+
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_); }
@@ -187,9 +229,23 @@ struct DerivedTypeCollection {
E3 = 2
};
- TestEnumMissingValue() = default;
+ TestEnumMissingValue()
+ : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::E1)) {}
TestEnumMissingValue(const Literal &_value)
: CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
+ TestEnumMissingValue(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+
+ 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_); }
@@ -211,7 +267,7 @@ struct DerivedTypeCollection {
struct TestPolymorphicStruct : CommonAPI::PolymorphicStruct {
static std::shared_ptr<TestPolymorphicStruct> create(CommonAPI::Serial _serial);
- const CommonAPI::Serial getSerial() const { return TESTPOLYMORPHICSTRUCT_SERIAL; }
+ CommonAPI::Serial getSerial() const { return TESTPOLYMORPHICSTRUCT_SERIAL; }
TestPolymorphicStruct() {
}
@@ -245,14 +301,25 @@ struct DerivedTypeCollection {
break;
}
}
-
template<class _Output>
- void writeType(CommonAPI::TypeOutputStream<_Output> &_output) {
- _output.writeType(std::get<0>(values_));
- _output.writeType(std::get<1>(values_));
+ 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>(_output);
+ static_cast<TestExtendedPolymorphicStruct *>(this)->template writeType<_Output, _Deployment>(_output, _depl);
break;
default:
break;
@@ -274,8 +341,8 @@ struct DerivedTypeCollection {
template<class _Output, class _Deployment>
void writeValue(CommonAPI::OutputStream<_Output> &_output, const _Deployment *_depl) {
- _output.template writeValue<>(std::get<0>(values_), _depl, std::get<0>(_depl->values_));
- _output.template writeValue<>(std::get<1>(values_), _depl, std::get<1>(_depl->values_));
+ _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);
@@ -303,7 +370,7 @@ struct DerivedTypeCollection {
};
struct TestExtendedPolymorphicStruct : TestPolymorphicStruct {
- const CommonAPI::Serial getSerial() const { return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
+ CommonAPI::Serial getSerial() const { return TESTEXTENDEDPOLYMORPHICSTRUCT_SERIAL; }
TestExtendedPolymorphicStruct() {
}
@@ -314,6 +381,7 @@ struct DerivedTypeCollection {
}
template<class _Input>
void readValue(CommonAPI::InputStream<_Input> &_input, const CommonAPI::EmptyDeployment *_depl) {
+ (void) _depl;
_input.template readValue<CommonAPI::EmptyDeployment>(std::get<0>(values_));
}
@@ -321,20 +389,24 @@ struct DerivedTypeCollection {
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) {
- _output.writeType(std::get<0>(values_));
+ 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_), _depl, std::get<2>(_depl->values_));
+ _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; }
@@ -431,4 +503,6 @@ namespace std {
};
}
+
+
#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
index b9f894a..beb2ed8 100644
--- a/src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp
+++ b/src/test/src-gen/core/commonapi/tests/PredefinedTypeCollection.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -61,4 +61,6 @@ namespace CommonAPI {
namespace std {
}
+
+
#endif // COMMONAPI_TESTS_Predefined_Type_Collection_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp
index 219ef38..2c47dda 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -12,7 +12,7 @@
-#include <v1_0/commonapi/tests/TestInterface.hpp>
+#include <v1/commonapi/tests/TestInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -22,7 +22,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -46,9 +46,13 @@ CommonAPI::Version ExtendedInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_EXTENDED_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp
index 36d9fc0..daebf8c 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,9 +10,9 @@
#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
-#include "v1_0/commonapi/tests/TestInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestInterfaceProxy.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -21,7 +21,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -29,8 +29,8 @@ template <typename ... _AttributeExtensions>
class ExtendedInterfaceProxy
: virtual public ExtendedInterface,
virtual public ExtendedInterfaceProxyBase,
- virtual public TestInterfaceProxy<_AttributeExtensions...>,
- public _AttributeExtensions... {
+ public TestInterfaceProxy<_AttributeExtensions...>,
+ virtual public _AttributeExtensions... {
public:
ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~ExtendedInterfaceProxy();
@@ -62,7 +62,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> TestIntMethodExtendedAsync(const uint32_t &_inInt, TestIntMethodExtendedAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
@@ -104,7 +104,7 @@ typedef ExtendedInterfaceProxy<> ExtendedInterfaceProxyDefault;
//
template <typename ... _AttributeExtensions>
ExtendedInterfaceProxy<_AttributeExtensions...>::ExtendedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- TestInterfaceProxy<_AttributeExtensions...>(delegate),
+ ::v1::commonapi::tests::TestInterfaceProxy<_AttributeExtensions...>(delegate),
_AttributeExtensions(*(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)))...,
delegate_(std::dynamic_pointer_cast<ExtendedInterfaceProxyBase>(delegate)) {
}
@@ -151,7 +151,11 @@ CommonAPI::InterfaceVersionAttribute& ExtendedInterfaceProxy<_AttributeExtension
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp
index 852ff96..3dfb547 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/ExtendedInterface.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/ExtendedInterface.hpp>
+#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -40,11 +40,15 @@ public:
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, 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Extended_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp
index 551fc0f..7618ad1 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -14,9 +14,9 @@
-#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
+#include <v1/commonapi/tests/TestInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterface.hpp>
+#include <v1/commonapi/tests/ExtendedInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -28,7 +28,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -39,8 +39,8 @@ namespace tests {
* An application developer should not need to bother with this class.
*/
class ExtendedInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public ExtendedInterface,
+ : public virtual CommonAPI::StubAdapter,
+ public virtual ExtendedInterface,
public virtual TestInterfaceStubAdapter {
public:
@@ -103,6 +103,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Extended_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp
index 09d45b0..6f9de13 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -20,6 +20,7 @@ ExtendedInterfaceStubDefault::ExtendedInterfaceStubDefault():
}
const CommonAPI::Version& ExtendedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -31,6 +32,8 @@ ExtendedInterfaceStubRemoteEvent* ExtendedInterfaceStubDefault::initStubAdapter(
void ExtendedInterfaceStubDefault::TestIntMethodExtended(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _inInt, TestIntMethodExtendedReply_t _reply) {
+ (void)_client;
+ (void) _inInt;
_reply();
}
@@ -44,4 +47,4 @@ ExtendedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(ExtendedInt
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp
index 07f0218..3f36ee3 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/ExtendedInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/ExtendedInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,12 +10,12 @@
#ifndef COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
#define COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/TestInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceStub.hpp>
+#include <v1/commonapi/tests/ExtendedInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -62,6 +62,10 @@ private:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Extended_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp
index 9227a55..4383045 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -12,7 +12,7 @@
-#include <v1_0/commonapi/tests/TestFreedesktopInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -22,7 +22,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -46,9 +46,13 @@ CommonAPI::Version TestFreedesktopDerivedInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_TEST_FREEDESKTOP_DERIVED_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp
index 8ec26d8..de0af83 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,9 +10,9 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp>
-#include "v1_0/commonapi/tests/TestFreedesktopInterfaceProxy.hpp"
+#include "v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -23,7 +23,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -31,8 +31,8 @@ template <typename ... _AttributeExtensions>
class TestFreedesktopDerivedInterfaceProxy
: virtual public TestFreedesktopDerivedInterface,
virtual public TestFreedesktopDerivedInterfaceProxyBase,
- virtual public TestFreedesktopInterfaceProxy<_AttributeExtensions...>,
- public _AttributeExtensions... {
+ public TestFreedesktopInterfaceProxy<_AttributeExtensions...>,
+ virtual public _AttributeExtensions... {
public:
TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~TestFreedesktopDerivedInterfaceProxy();
@@ -116,7 +116,7 @@ namespace TestFreedesktopDerivedInterfaceExtensions {
//
template <typename ... _AttributeExtensions>
TestFreedesktopDerivedInterfaceProxy<_AttributeExtensions...>::TestFreedesktopDerivedInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate):
- TestFreedesktopInterfaceProxy<_AttributeExtensions...>(delegate),
+ ::v1::commonapi::tests::TestFreedesktopInterfaceProxy<_AttributeExtensions...>(delegate),
_AttributeExtensions(*(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)))...,
delegate_(std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceProxyBase>(delegate)) {
}
@@ -154,16 +154,20 @@ CommonAPI::InterfaceVersionAttribute& TestFreedesktopDerivedInterfaceProxy<_Attr
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1_0::commonapi::tests::TestFreedesktopDerivedInterfaceProxy,
+struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestFreedesktopDerivedInterfaceProxy,
_AttributeExtension> {
- typedef typename ::v1_0::commonapi::tests::TestFreedesktopDerivedInterfaceProxy<
- ::v1_0::commonapi::tests::TestFreedesktopDerivedInterfaceExtensions::TestAttributedFromDerivedInterfaceAttributeExtension<_AttributeExtension>
+ typedef typename ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceProxy<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceExtensions::TestAttributedFromDerivedInterfaceAttributeExtension<_AttributeExtension>
> class_t;
};
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp
index 6af057d..65f35f8 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
@@ -25,7 +25,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -42,6 +42,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp
index c37b764..54e7c1c 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -14,9 +14,9 @@
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -38,8 +38,8 @@ namespace tests {
* An application developer should not need to bother with this class.
*/
class TestFreedesktopDerivedInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public TestFreedesktopDerivedInterface,
+ : public virtual CommonAPI::StubAdapter,
+ public virtual TestFreedesktopDerivedInterface,
public virtual TestFreedesktopInterfaceStubAdapter {
public:
///Notifies all remote listeners about a change of value of the attribute TestAttributedFromDerivedInterface.
@@ -74,7 +74,7 @@ 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 TestAttributedFromDerivedInterface) = 0;
+ 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;
};
@@ -107,6 +107,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
index f9ea339..0e72205 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -20,6 +20,7 @@ TestFreedesktopDerivedInterfaceStubDefault::TestFreedesktopDerivedInterfaceStubD
}
const CommonAPI::Version& TestFreedesktopDerivedInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -34,14 +35,17 @@ const uint32_t& TestFreedesktopDerivedInterfaceStubDefault::getTestAttributedFro
}
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 && CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_->fireTestAttributedFromDerivedInterfaceAttributeChanged(testAttributedFromDerivedInterfaceAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestFreedesktopDerivedInterfaceStubAdapter, TestFreedesktopDerivedInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestAttributedFromDerivedInterfaceAttributeChanged(testAttributedFromDerivedInterfaceAttributeValue_);
+ }
}
bool TestFreedesktopDerivedInterfaceStubDefault::trySetTestAttributedFromDerivedInterfaceAttribute(uint32_t _value) {
@@ -54,10 +58,12 @@ bool TestFreedesktopDerivedInterfaceStubDefault::trySetTestAttributedFromDerived
}
bool TestFreedesktopDerivedInterfaceStubDefault::validateTestAttributedFromDerivedInterfaceAttributeRequestedValue(const uint32_t &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestFreedesktopDerivedInterfaceStubDefault::setTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
setTestAttributedFromDerivedInterfaceAttribute(_value);
}
@@ -76,6 +82,7 @@ bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSet
}
bool TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestAttributedFromDerivedInterfaceAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
return onRemoteSetTestAttributedFromDerivedInterfaceAttribute(_value);
}
@@ -90,4 +97,4 @@ TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler::RemoteEventHandl
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp
index 1eac976..02cacc6 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopDerivedInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,12 +10,12 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -66,13 +66,17 @@ protected:
private:
TestFreedesktopDerivedInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t testAttributedFromDerivedInterfaceAttributeValue_;
+ uint32_t testAttributedFromDerivedInterfaceAttributeValue_ {};
CommonAPI::Version interfaceVersion_;
};
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp
index 06a274f..9d726d3 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -21,7 +21,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -44,9 +44,13 @@ CommonAPI::Version TestFreedesktopInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_TEST_FREEDESKTOP_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp
index db831bd..08b45ac 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -22,7 +22,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -30,7 +30,7 @@ template <typename ... _AttributeExtensions>
class TestFreedesktopInterfaceProxy
: virtual public TestFreedesktopInterface,
virtual public TestFreedesktopInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
TestFreedesktopInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~TestFreedesktopInterfaceProxy();
@@ -232,19 +232,23 @@ CommonAPI::InterfaceVersionAttribute& TestFreedesktopInterfaceProxy<_AttributeEx
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1_0::commonapi::tests::TestFreedesktopInterfaceProxy,
+struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestFreedesktopInterfaceProxy,
_AttributeExtension> {
- typedef typename ::v1_0::commonapi::tests::TestFreedesktopInterfaceProxy<
- ::v1_0::commonapi::tests::TestFreedesktopInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- ::v1_0::commonapi::tests::TestFreedesktopInterfaceExtensions::TestReadonlyAttributeAttributeExtension<_AttributeExtension>,
- ::v1_0::commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- ::v1_0::commonapi::tests::TestFreedesktopInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_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 // COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp
index e78cfc2..a4efed7 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
#include <commonapi/tests/DerivedTypeCollection.hpp>
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -50,6 +50,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp
index 6bf5ad2..9af7df6 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -16,7 +16,7 @@
#include <commonapi/tests/DerivedTypeCollection.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -29,7 +29,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -40,8 +40,8 @@ namespace tests {
* An application developer should not need to bother with this class.
*/
class TestFreedesktopInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public TestFreedesktopInterface {
+ : 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;
@@ -80,15 +80,15 @@ 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 TestPredefinedTypeAttribute) = 0;
+ 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 TestDerivedStructAttribute) = 0;
+ 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 TestDerivedArrayAttribute) = 0;
+ 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;
};
@@ -126,6 +126,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
index ff96aed..e06ecaa 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -20,6 +20,7 @@ TestFreedesktopInterfaceStubDefault::TestFreedesktopInterfaceStubDefault():
}
const CommonAPI::Version& TestFreedesktopInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -33,14 +34,17 @@ const uint32_t& TestFreedesktopInterfaceStubDefault::getTestPredefinedTypeAttrib
}
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 && CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
+ }
}
bool TestFreedesktopInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
@@ -53,10 +57,12 @@ bool TestFreedesktopInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttri
}
bool TestFreedesktopInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestFreedesktopInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
setTestPredefinedTypeAttributeAttribute(_value);
}
@@ -75,6 +81,7 @@ bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPre
}
bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
return onRemoteSetTestPredefinedTypeAttributeAttribute(_value);
}
@@ -83,14 +90,17 @@ const uint32_t& TestFreedesktopInterfaceStubDefault::getTestReadonlyAttributeAtt
}
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 && CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_->fireTestReadonlyAttributeAttributeChanged(testReadonlyAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestReadonlyAttributeAttributeChanged(testReadonlyAttributeAttributeValue_);
+ }
}
bool TestFreedesktopInterfaceStubDefault::trySetTestReadonlyAttributeAttribute(uint32_t _value) {
@@ -103,7 +113,8 @@ bool TestFreedesktopInterfaceStubDefault::trySetTestReadonlyAttributeAttribute(u
}
bool TestFreedesktopInterfaceStubDefault::validateTestReadonlyAttributeAttributeRequestedValue(const uint32_t &_value) {
- return true;
+ (void)_value;
+ return true;
}
@@ -112,14 +123,17 @@ const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestFreedes
}
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 && CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
+ }
}
bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
@@ -132,10 +146,12 @@ bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedStructAttributeAttrib
}
bool TestFreedesktopInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestFreedesktopInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ (void)_client;
setTestDerivedStructAttributeAttribute(_value);
}
@@ -154,6 +170,7 @@ bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDer
}
bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ (void)_client;
return onRemoteSetTestDerivedStructAttributeAttribute(_value);
}
@@ -162,14 +179,17 @@ const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestFreedeskto
}
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 && CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestFreedesktopInterfaceStubAdapter, TestFreedesktopInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
+ }
}
bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
@@ -182,10 +202,12 @@ bool TestFreedesktopInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribu
}
bool TestFreedesktopInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestFreedesktopInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ (void)_client;
setTestDerivedArrayAttributeAttribute(_value);
}
@@ -204,6 +226,7 @@ bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDer
}
bool TestFreedesktopInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ (void)_client;
return onRemoteSetTestDerivedArrayAttributeAttribute(_value);
}
@@ -218,4 +241,4 @@ TestFreedesktopInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(Test
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp
index c473858..d81fb94 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestFreedesktopInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -92,16 +92,20 @@ protected:
private:
TestFreedesktopInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t testPredefinedTypeAttributeAttributeValue_;
- uint32_t testReadonlyAttributeAttributeValue_;
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
+ 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp
index c4de980..ab6a78b 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -21,7 +21,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -44,9 +44,13 @@ CommonAPI::Version TestInterface::getInterfaceVersion() {
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // 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
new file mode 100644
index 0000000..792309c
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManager.hpp
@@ -0,0 +1,57 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_TEST_INTERFACE_MANAGER_HPP_
+#define 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 // 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
new file mode 100644
index 0000000..d302418
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxy.hpp
@@ -0,0 +1,131 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_Test_Interface_Manager_PROXY_HPP_
+#define 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 // 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
new file mode 100644
index 0000000..29740a5
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerProxyBase.hpp
@@ -0,0 +1,50 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_Test_Interface_Manager_PROXY_BASE_HPP_
+#define 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 // 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
new file mode 100644
index 0000000..7b341f8
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStub.hpp
@@ -0,0 +1,111 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_Test_Interface_Manager_STUB_HPP_
+#define 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 // 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
new file mode 100644
index 0000000..57442e0
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.cpp
@@ -0,0 +1,83 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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
new file mode 100644
index 0000000..1dfb361
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceManagerStubDefault.hpp
@@ -0,0 +1,73 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_Test_Interface_Manager_STUB_DEFAULT_HPP_
+#define 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 // COMMONAPI_TESTS_Test_Interface_Manager_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp
index f284f07..f22aea7 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -22,7 +22,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -30,7 +30,7 @@ template <typename ... _AttributeExtensions>
class TestInterfaceProxy
: virtual public TestInterface,
virtual public TestInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
TestInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~TestInterfaceProxy();
@@ -94,7 +94,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls testVoidPredefinedTypeMethod with synchronous semantics.
*
@@ -114,7 +114,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -135,7 +135,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -155,7 +155,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -176,7 +176,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -196,7 +196,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -216,7 +216,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -236,7 +236,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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.
*
@@ -256,7 +256,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> TestStructWithEnumKeyMapMemberAsync(const ::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap &_inStruct, TestStructWithEnumKeyMapMemberAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
@@ -403,20 +403,42 @@ std::future<CommonAPI::CallStatus> TestInterfaceProxy<_AttributeExtensions...>::
}
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>
@@ -484,18 +506,22 @@ CommonAPI::InterfaceVersionAttribute& TestInterfaceProxy<_AttributeExtensions...
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
template<template<typename > class _AttributeExtension>
-struct DefaultAttributeProxyHelper<::v1_0::commonapi::tests::TestInterfaceProxy,
+struct DefaultAttributeProxyHelper<::v1::commonapi::tests::TestInterfaceProxy,
_AttributeExtension> {
- typedef typename ::v1_0::commonapi::tests::TestInterfaceProxy<
- ::v1_0::commonapi::tests::TestInterfaceExtensions::TestPredefinedTypeAttributeAttributeExtension<_AttributeExtension>,
- ::v1_0::commonapi::tests::TestInterfaceExtensions::TestDerivedStructAttributeAttributeExtension<_AttributeExtension>,
- ::v1_0::commonapi::tests::TestInterfaceExtensions::TestDerivedArrayAttributeAttributeExtension<_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 // COMMONAPI_TESTS_Test_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp
index 45f0d2c..f719377 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/TestInterface.hpp>
+#include <v1/commonapi/tests/TestInterface.hpp>
#include <commonapi/tests/DerivedTypeCollection.hpp>
@@ -37,7 +37,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -72,27 +72,31 @@ public:
virtual TestBroadcastWithOutArgsSelectiveEvent& getTestBroadcastWithOutArgsSelectiveEvent() = 0;
virtual void testEmptyMethod(CommonAPI::CallStatus &_internalCallStatus, const CommonAPI::CallInfo *_info = nullptr) = 0;
- virtual std::future<CommonAPI::CallStatus> testEmptyMethodAsync(TestEmptyMethodAsyncCallback _callback, 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, 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, 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, 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, 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, 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, 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, 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, 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp
index 2039044..0330129 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -17,7 +17,7 @@
#include <commonapi/tests/DerivedTypeCollection.hpp>
#include <commonapi/tests/PredefinedTypeCollection.hpp>
-#include <v1_0/commonapi/tests/TestInterface.hpp>
+#include <v1/commonapi/tests/TestInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -36,7 +36,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -47,8 +47,8 @@ namespace tests {
* An application developer should not need to bother with this class.
*/
class TestInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public TestInterface {
+ : 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;
@@ -110,15 +110,15 @@ 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 TestPredefinedTypeAttribute) = 0;
+ 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 TestDerivedStructAttribute) = 0;
+ 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 TestDerivedArrayAttribute) = 0;
+ 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;
};
@@ -207,6 +207,10 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp
index 90efb99..ebb5b5e 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/TestInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/TestInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -20,6 +20,7 @@ TestInterfaceStubDefault::TestInterfaceStubDefault():
}
const CommonAPI::Version& TestInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -33,14 +34,17 @@ const uint32_t& TestInterfaceStubDefault::getTestPredefinedTypeAttributeAttribut
}
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 && CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestPredefinedTypeAttributeAttributeChanged(testPredefinedTypeAttributeAttributeValue_);
+ }
}
bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32_t _value) {
@@ -53,10 +57,12 @@ bool TestInterfaceStubDefault::trySetTestPredefinedTypeAttributeAttribute(uint32
}
bool TestInterfaceStubDefault::validateTestPredefinedTypeAttributeAttributeRequestedValue(const uint32_t &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestInterfaceStubDefault::setTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
setTestPredefinedTypeAttributeAttribute(_value);
}
@@ -75,6 +81,7 @@ bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedType
}
bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestPredefinedTypeAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, uint32_t _value) {
+ (void)_client;
return onRemoteSetTestPredefinedTypeAttributeAttribute(_value);
}
@@ -83,14 +90,17 @@ const ::commonapi::tests::DerivedTypeCollection::TestStructExtended& TestInterfa
}
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 && CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestDerivedStructAttributeAttributeChanged(testDerivedStructAttributeAttributeValue_);
+ }
}
bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
@@ -103,10 +113,12 @@ bool TestInterfaceStubDefault::trySetTestDerivedStructAttributeAttribute(::commo
}
bool TestInterfaceStubDefault::validateTestDerivedStructAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestStructExtended &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestInterfaceStubDefault::setTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ (void)_client;
setTestDerivedStructAttributeAttribute(_value);
}
@@ -125,6 +137,7 @@ bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructA
}
bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedStructAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestStructExtended _value) {
+ (void)_client;
return onRemoteSetTestDerivedStructAttributeAttribute(_value);
}
@@ -133,14 +146,17 @@ const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64& TestInterfaceS
}
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 && CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_ != NULL) {
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
- }
+ if (valueChanged) {
+ auto stubAdapter = CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_.lock();
+ if (stubAdapter)
+ stubAdapter->fireTestDerivedArrayAttributeAttributeChanged(testDerivedArrayAttributeAttributeValue_);
+ }
}
bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
@@ -153,10 +169,12 @@ bool TestInterfaceStubDefault::trySetTestDerivedArrayAttributeAttribute(::common
}
bool TestInterfaceStubDefault::validateTestDerivedArrayAttributeAttributeRequestedValue(const ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 &_value) {
- return true;
+ (void)_value;
+ return true;
}
void TestInterfaceStubDefault::setTestDerivedArrayAttributeAttribute(const std::shared_ptr<CommonAPI::ClientId> _client, ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 _value) {
+ (void)_client;
setTestDerivedArrayAttributeAttribute(_value);
}
@@ -175,85 +193,130 @@ bool TestInterfaceStubDefault::RemoteEventHandler::onRemoteSetTestDerivedArrayAt
}
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) {
- uint32_t uint32OutValue = 0;
+ (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) {
- ::commonapi::tests::DerivedTypeCollection::TestEnumExtended2 testEnumExtended2OutValue;
+ (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_) !=NULL);
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->fireTestPredefinedTypeBroadcastEvent(_uint32Value, _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_) !=NULL);
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->sendTestSelectiveBroadcastSelective(_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_) !=NULL);
- return(CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->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_) !=NULL);
- CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->sendTestBroadcastWithOutArgsSelective(_uint32Value, _stringValue, _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_) !=NULL);
- return(CommonAPI::Stub<TestInterfaceStubAdapter, TestInterfaceStubRemoteEvent>::stubAdapter_->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;
}
@@ -265,4 +328,4 @@ TestInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(TestInterfaceSt
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp
index aec9e54..a5ddbb3 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/TestInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/TestInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
+#include <v1/commonapi/tests/TestInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -108,15 +108,19 @@ protected:
private:
TestInterfaceStubDefault::RemoteEventHandler remoteEventHandler_;
- uint32_t testPredefinedTypeAttributeAttributeValue_;
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_;
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_;
+ uint32_t testPredefinedTypeAttributeAttributeValue_ {};
+ ::commonapi::tests::DerivedTypeCollection::TestStructExtended testDerivedStructAttributeAttributeValue_ {};
+ ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64 testDerivedArrayAttributeAttributeValue_ {};
CommonAPI::Version interfaceVersion_;
};
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_Test_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.cpp
index f0c9365..46bfa98 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -9,7 +9,7 @@
*/
#include "BranchInterface.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -19,4 +19,4 @@ namespace managed {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp
index 2070910..4b95f46 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -23,7 +23,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -41,9 +41,22 @@ public:
NOTOK = 1
};
- testBranchMethodError() = default;
+ testBranchMethodError()
+ : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
testBranchMethodError(const Literal &_value)
: CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
+ testBranchMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+
+ 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_); }
@@ -73,9 +86,13 @@ CommonAPI::Version BranchInterface::getInterfaceVersion() {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_BRANCH_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp
index bff2547..a8a4f49 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,7 +20,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -29,7 +29,7 @@ template <typename ... _AttributeExtensions>
class BranchInterfaceProxy
: virtual public BranchInterface,
virtual public BranchInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
BranchInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~BranchInterfaceProxy();
@@ -59,7 +59,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> testBranchMethodAsync(const int32_t &_inInt, const std::string &_inString, TestBranchMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
@@ -148,7 +148,11 @@ CommonAPI::InterfaceVersionAttribute& BranchInterfaceProxy<_AttributeExtensions.
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
index 4296bca..de4d3ef 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/managed/BranchInterface.hpp>
+#include <v1/commonapi/tests/managed/BranchInterface.hpp>
@@ -26,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,12 +40,16 @@ public:
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, 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp
index 9b7a01d..b2cd06b 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -15,7 +15,7 @@
-#include <v1_0/commonapi/tests/managed/BranchInterface.hpp>
+#include <v1/commonapi/tests/managed/BranchInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -39,8 +39,8 @@ namespace managed {
* An application developer should not need to bother with this class.
*/
class BranchInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public BranchInterface {
+ : public virtual CommonAPI::StubAdapter,
+ public virtual BranchInterface {
public:
@@ -101,6 +101,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
index 10b02a7..d8e59bd 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -21,6 +21,7 @@ BranchInterfaceStubDefault::BranchInterfaceStubDefault():
}
const CommonAPI::Version& BranchInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -31,6 +32,9 @@ BranchInterfaceStubRemoteEvent* BranchInterfaceStubDefault::initStubAdapter(cons
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 = "";
@@ -48,4 +52,4 @@ BranchInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(BranchInterfa
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
index 3cdd147..5e494f0 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/BranchInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -62,6 +62,10 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.cpp
index e2f172b..285a8d6 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -9,7 +9,7 @@
*/
#include "LeafInterface.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -19,4 +19,4 @@ namespace managed {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp
index ac7e377..a8332b4 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -23,7 +23,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -41,9 +41,22 @@ public:
NOTOK = 1
};
- testLeafMethodError() = default;
+ testLeafMethodError()
+ : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
testLeafMethodError(const Literal &_value)
: CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
+ testLeafMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+
+ 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_); }
@@ -73,9 +86,13 @@ CommonAPI::Version LeafInterface::getInterfaceVersion() {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_LEAF_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp
index a0382f4..852a916 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,7 +20,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -29,7 +29,7 @@ template <typename ... _AttributeExtensions>
class LeafInterfaceProxy
: virtual public LeafInterface,
virtual public LeafInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
LeafInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~LeafInterfaceProxy();
@@ -59,7 +59,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> testLeafMethodAsync(const int32_t &_inInt, const std::string &_inString, TestLeafMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
@@ -148,7 +148,11 @@ CommonAPI::InterfaceVersionAttribute& LeafInterfaceProxy<_AttributeExtensions...
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
index f00bd30..bd4c9ff 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/managed/LeafInterface.hpp>
+#include <v1/commonapi/tests/managed/LeafInterface.hpp>
@@ -26,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,12 +40,16 @@ public:
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, 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp
index 62e2a0a..43b58f9 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -15,7 +15,7 @@
-#include <v1_0/commonapi/tests/managed/LeafInterface.hpp>
+#include <v1/commonapi/tests/managed/LeafInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -39,8 +39,8 @@ namespace managed {
* An application developer should not need to bother with this class.
*/
class LeafInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public LeafInterface {
+ : public virtual CommonAPI::StubAdapter,
+ public virtual LeafInterface {
public:
@@ -101,6 +101,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
index 89bad18..c30041d 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -21,6 +21,7 @@ LeafInterfaceStubDefault::LeafInterfaceStubDefault():
}
const CommonAPI::Version& LeafInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -31,6 +32,9 @@ LeafInterfaceStubRemoteEvent* LeafInterfaceStubDefault::initStubAdapter(const st
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 = "";
@@ -48,4 +52,4 @@ LeafInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LeafInterfaceSt
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
index 9d9dd2b..b66a486 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/LeafInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -62,6 +62,10 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.cpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.cpp
index 42e6cea..b1f04dc 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.cpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -9,7 +9,7 @@
*/
#include "RootInterface.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -19,4 +19,4 @@ namespace managed {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp
index 72ab4f2..c505b5c 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterface.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -24,7 +24,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -42,9 +42,22 @@ public:
NOTOK = 1
};
- testRootMethodError() = default;
+ testRootMethodError()
+ : CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(Literal::OK)) {}
testRootMethodError(const Literal &_value)
: CommonAPI::Enumeration<int32_t>(static_cast<int32_t>(_value)) {}
+ testRootMethodError(const int32_t &_value)
+ : CommonAPI::Enumeration<int32_t>(_value) {}
+
+ 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_); }
@@ -74,9 +87,13 @@ CommonAPI::Version RootInterface::getInterfaceVersion() {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_ROOT_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp
index 04e4002..c2b8aa2 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,7 +20,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -29,7 +29,7 @@ template <typename ... _AttributeExtensions>
class RootInterfaceProxy
: virtual public RootInterface,
virtual public RootInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
RootInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~RootInterfaceProxy();
@@ -59,7 +59,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ 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();
@@ -158,7 +158,11 @@ CommonAPI::ProxyManager& RootInterfaceProxy<_AttributeExtensions...>::getProxyMa
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp
index 60d512c..70f7c49 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,11 +10,11 @@
#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/managed/RootInterface.hpp>
+#include <v1/commonapi/tests/managed/RootInterface.hpp>
-#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -29,7 +29,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -43,7 +43,7 @@ public:
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, 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;
};
@@ -51,6 +51,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp
index f78527e..da4abbc 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -14,10 +14,10 @@
-#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/managed/RootInterface.hpp>
+#include <v1/commonapi/tests/managed/RootInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -29,7 +29,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -41,15 +41,15 @@ namespace managed {
* An application developer should not need to bother with this class.
*/
class RootInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public RootInterface {
+ : public virtual CommonAPI::StubAdapter,
+ public virtual RootInterface {
public:
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 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<BranchInterfaceStub>, const std::string&) = 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;
@@ -99,10 +99,10 @@ public:
/// 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<LeafInterfaceStub>, const std::string&) = 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<BranchInterfaceStub>, const std::string&) = 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;
@@ -115,6 +115,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // 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
new file mode 100644
index 0000000..9a06017
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.cpp
@@ -0,0 +1,134 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp
index ae51dab..c207d38 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/RootInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/managed/RootInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/RootInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -42,12 +42,12 @@ public:
virtual void testRootMethod(const std::shared_ptr<CommonAPI::ClientId> _client, int32_t _inInt, std::string _inString, testRootMethodReply_t _reply);
- bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>);
- bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
+ 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<BranchInterfaceStub>);
- bool registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub>, const std::string&);
+ 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();
@@ -71,6 +71,10 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRoot.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp
index 9a7a6b8..57c1225 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRoot.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRoot.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -22,7 +22,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -47,9 +47,13 @@ CommonAPI::Version SecondRoot::getInterfaceVersion() {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_SECOND_ROOT_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxy.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp
index 5c2a9e8..0aec7bb 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxy.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp>
+#include <v1/commonapi/tests/managed/SecondRootProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,7 +20,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -29,7 +29,7 @@ template <typename ... _AttributeExtensions>
class SecondRootProxy
: virtual public SecondRoot,
virtual public SecondRootProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
SecondRootProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~SecondRootProxy();
@@ -123,7 +123,11 @@ CommonAPI::ProxyManager& SecondRootProxy<_AttributeExtensions...>::getProxyManag
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp
index 9fc8c35..11dda50 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,10 +10,10 @@
#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
#define COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
-#include <v1_0/commonapi/tests/managed/SecondRoot.hpp>
+#include <v1/commonapi/tests/managed/SecondRoot.hpp>
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -25,7 +25,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -43,6 +43,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Second_Root_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStub.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp
index 01cb65d..16526e5 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStub.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -14,9 +14,9 @@
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/managed/SecondRoot.hpp>
+#include <v1/commonapi/tests/managed/SecondRoot.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -39,12 +39,12 @@ namespace managed {
* An application developer should not need to bother with this class.
*/
class SecondRootStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public SecondRoot {
+ : public virtual CommonAPI::StubAdapter,
+ public virtual SecondRoot {
public:
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 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;
@@ -91,7 +91,7 @@ public:
- virtual bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&) = 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;
@@ -104,6 +104,10 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // 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
new file mode 100644
index 0000000..8bd5886
--- /dev/null
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.cpp
@@ -0,0 +1,85 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
+* 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_0/commonapi/tests/managed/SecondRootStubDefault.hpp b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp
index c56d7ac..e1b9ba2 100644
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.hpp
+++ b/src/test/src-gen/core/v1/commonapi/tests/managed/SecondRootStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT_HPP_
-#include <v1_0/commonapi/tests/managed/SecondRootStub.hpp>
+#include <v1/commonapi/tests/managed/SecondRootStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -41,8 +41,8 @@ public:
- bool registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub>);
- bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
+ 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();
@@ -66,6 +66,10 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // COMMONAPI_TESTS_MANAGED_Second_Root_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterface.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp
index 5106b3e..8a09882 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterface.hpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterface.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -21,7 +21,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -46,9 +46,13 @@ CommonAPI::Version LegacyInterface::getInterfaceVersion() {
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
namespace CommonAPI {
}
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // FAKE_LEGACY_SERVICE_LEGACY_INTERFACE_HPP_
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp
index 94c54c1..d2173da 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxy.hpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
#define FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
-#include <v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
@@ -20,7 +20,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -29,7 +29,7 @@ template <typename ... _AttributeExtensions>
class LegacyInterfaceProxy
: virtual public LegacyInterface,
virtual public LegacyInterfaceProxyBase,
- public _AttributeExtensions... {
+ virtual public _AttributeExtensions... {
public:
LegacyInterfaceProxy(std::shared_ptr<CommonAPI::Proxy> delegate);
~LegacyInterfaceProxy();
@@ -59,7 +59,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> TestMethodAsync(const int32_t &_input, TestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls OtherTestMethod with synchronous semantics.
*
@@ -79,7 +79,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> OtherTestMethodAsync(OtherTestMethodAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
* Calls finish with synchronous semantics.
*
@@ -98,7 +98,7 @@ public:
* 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, const CommonAPI::CallInfo *_info = nullptr);
+ virtual std::future<CommonAPI::CallStatus> finishAsync(FinishAsyncCallback _callback = nullptr, const CommonAPI::CallInfo *_info = nullptr);
/**
@@ -205,7 +205,11 @@ CommonAPI::InterfaceVersionAttribute& LegacyInterfaceProxy<_AttributeExtensions.
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
+
+// Compatibility
+namespace v1_0 = v1;
+
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_HPP_
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp
index 86f4f54..dae25c5 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -10,7 +10,7 @@
#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
#define FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
-#include <v1_0/fake/legacy/service/LegacyInterface.hpp>
+#include <v1/fake/legacy/service/LegacyInterface.hpp>
@@ -26,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -42,16 +42,20 @@ public:
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, 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, 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, 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_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_PROXY_BASE_HPP_
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp
index e95255b..0824f31 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStub.hpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStub.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -15,7 +15,7 @@
-#include <v1_0/fake/legacy/service/LegacyInterface.hpp>
+#include <v1/fake/legacy/service/LegacyInterface.hpp>
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -27,7 +27,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -39,8 +39,8 @@ namespace service {
* An application developer should not need to bother with this class.
*/
class LegacyInterfaceStubAdapter
- : virtual public CommonAPI::StubAdapter,
- public LegacyInterface {
+ : public virtual CommonAPI::StubAdapter,
+ public virtual LegacyInterface {
public:
@@ -107,6 +107,10 @@ public:
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_HPP_
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp
index aebd241..6a8bae2 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.cpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp>
#include <assert.h>
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -21,6 +21,7 @@ LegacyInterfaceStubDefault::LegacyInterfaceStubDefault():
}
const CommonAPI::Version& LegacyInterfaceStubDefault::getInterfaceVersion(std::shared_ptr<CommonAPI::ClientId> _client) {
+ (void)_client;
return interfaceVersion_;
}
@@ -31,18 +32,22 @@ LegacyInterfaceStubRemoteEvent* LegacyInterfaceStubDefault::initStubAdapter(cons
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();
}
@@ -57,4 +62,4 @@ LegacyInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(LegacyInterfa
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp
index 50754c7..4f06bbd 100644
--- a/src/test/src-gen/core/v1_0/fake/legacy/service/LegacyInterfaceStubDefault.hpp
+++ b/src/test/src-gen/core/v1/fake/legacy/service/LegacyInterfaceStubDefault.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.core 3.1.4.v201511201311.
* 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.
@@ -11,10 +11,10 @@
#define FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT_HPP_
-#include <v1_0/fake/legacy/service/LegacyInterfaceStub.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceStub.hpp>
#include <sstream>
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -64,6 +64,10 @@ private:
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
+
+
+// Compatibility
+namespace v1_0 = v1;
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_STUB_DEFAULT
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp b/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp
deleted file mode 100644
index 9fc6c40..0000000
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/RootInterfaceStubDefault.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/managed/RootInterfaceStubDefault.hpp>
-#include <assert.h>
-
-namespace v1_0 {
-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) {
- 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) {
- RootInterface::testRootMethodError error;
- int32_t outInt = 0;
- std::string outString = "";
- _reply(error, outInt, outString);
-}
-
-
-
-bool RootInterfaceStubDefault::registerManagedStubLeafInterfaceAutoInstance(std::shared_ptr<LeafInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- ss << CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->registerManagedStubLeafInterface(_stub, instance);
-}
-bool RootInterfaceStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->registerManagedStubLeafInterface(_stub, _instance);
-}
-bool RootInterfaceStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->deregisterManagedStubLeafInterface(_instance);
-}
-std::set<std::string>& RootInterfaceStubDefault::getLeafInterfaceInstances() {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->getLeafInterfaceInstances();
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterfaceAutoInstance(std::shared_ptr<BranchInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- ss << CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->registerManagedStubBranchInterface(_stub, instance);
-}
-bool RootInterfaceStubDefault::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->registerManagedStubBranchInterface(_stub, _instance);
-}
-bool RootInterfaceStubDefault::deregisterManagedStubBranchInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->deregisterManagedStubBranchInterface(_instance);
-}
-std::set<std::string>& RootInterfaceStubDefault::getBranchInterfaceInstances() {
- assert((CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<RootInterfaceStubAdapter, RootInterfaceStubRemoteEvent>::stubAdapter_->getBranchInterfaceInstances();
-}
-
-RootInterfaceStubDefault::RemoteEventHandler::RemoteEventHandler(RootInterfaceStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1_0
diff --git a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp b/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp
deleted file mode 100644
index 452aadc..0000000
--- a/src/test/src-gen/core/v1_0/commonapi/tests/managed/SecondRootStubDefault.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/managed/SecondRootStubDefault.hpp>
-#include <assert.h>
-
-namespace v1_0 {
-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) {
- 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<LeafInterfaceStub> _stub) {
- autoInstanceCounter_++;
- std::stringstream ss;
- ss << CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_->getAddress().getInstance() << ".i" << autoInstanceCounter_;
- std::string instance = ss.str();
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_->registerManagedStubLeafInterface(_stub, instance);
-}
-bool SecondRootStubDefault::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_->registerManagedStubLeafInterface(_stub, _instance);
-}
-bool SecondRootStubDefault::deregisterManagedStubLeafInterface(const std::string &_instance) {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_->deregisterManagedStubLeafInterface(_instance);
-}
-std::set<std::string>& SecondRootStubDefault::getLeafInterfaceInstances() {
- assert((CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_) !=NULL);
- return CommonAPI::Stub<SecondRootStubAdapter, SecondRootStubRemoteEvent>::stubAdapter_->getLeafInterfaceInstances();
-}
-
-SecondRootStubDefault::RemoteEventHandler::RemoteEventHandler(SecondRootStubDefault *_defaultStub)
- :
- defaultStub_(_defaultStub) {
-}
-
-} // namespace managed
-} // namespace tests
-} // namespace commonapi
-} // namespace v1_0
diff --git a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp
index 102ab6f..34c8d55 100644
--- a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.cpp
@@ -1,13 +1,12 @@
-
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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/.
-*/
+ /*
+ * This file was generated by the CommonAPI Generators.
+ * Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+ * 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 {
diff --git a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp
index 289f537..b963cc7 100644
--- a/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -8,8 +8,8 @@
* http://mozilla.org/MPL/2.0/.
*/
-#ifndef COMMONAPI_DBUS_DERIVEDTYPECOLLECTION_DEPLOYMENT_HPP_
-#define COMMONAPI_DBUS_DERIVEDTYPECOLLECTION_DEPLOYMENT_HPP_
+#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
@@ -99,4 +99,4 @@ typedef CommonAPI::DBus::StructDeployment<
} // namespace tests
} // namespace commonapi
-#endif // COMMONAPI_DBUS_DERIVEDTYPECOLLECTION_DEPLOYMENT_HPP_
+#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
new file mode 100644
index 0000000..1e846e6
--- /dev/null
+++ b/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.cpp
@@ -0,0 +1,20 @@
+ /*
+ * This file was generated by the CommonAPI Generators.
+ * Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+ * 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
new file mode 100644
index 0000000..5d04aa4
--- /dev/null
+++ b/src/test/src-gen/dbus/commonapi/tests/PredefinedTypeCollectionDBusDeployment.hpp
@@ -0,0 +1,58 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp
index a267c64..5350a38 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "ExtendedInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace ExtendedInterface_ {
@@ -25,4 +25,4 @@ namespace ExtendedInterface_ {
} // namespace ExtendedInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp
index aa20be0..3cae58f 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace ExtendedInterface_ {
@@ -38,6 +38,6 @@ namespace ExtendedInterface_ {
} // namespace ExtendedInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_EXTENDEDINTERFACE_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
new file mode 100644
index 0000000..1dacb44
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
@@ -0,0 +1,83 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
index a3358bf..f4ba72f 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,9 @@
#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/ExtendedInterfaceProxyBase.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusProxy.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
@@ -20,12 +21,13 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -48,14 +50,14 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
};
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
index 40578de..cb579a5 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/ExtendedInterface.hpp>
-#include <v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/ExtendedInterface.hpp>
+#include <v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -47,62 +47,62 @@ const char* ExtendedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectio
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
CommonAPI::Version
> ExtendedInterfaceDBusStubAdapterInternal::getExtendedInterfaceInterfaceVersionStubDispatcher(&ExtendedInterfaceStub::getInterfaceVersion, "uu");
#ifdef WIN32
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
uint32_t
> ExtendedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute
, "u"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
uint32_t
> ExtendedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
,&ExtendedInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
,"u"
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute
, "(sqi)"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute,
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedStructAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
,&ExtendedInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
,"(sqi)"
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> ExtendedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute
, "at"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> ExtendedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute,
+ &::v1::commonapi::tests::ExtendedInterfaceStub::getTestDerivedArrayAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
&ExtendedInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
,&ExtendedInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
@@ -112,7 +112,7 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment>,
@@ -126,7 +126,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
#ifdef WIN32
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -138,7 +138,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -150,7 +150,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -162,7 +162,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>,
@@ -174,7 +174,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>,
@@ -186,7 +186,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>>,
@@ -198,7 +198,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
@@ -210,7 +210,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
@@ -222,7 +222,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
@@ -238,27 +238,27 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
#ifdef WIN32
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> ExtendedInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b");
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
> ExtendedInterfaceDBusStubAdapterInternal::unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::unsubscribeFromTestSelectiveBroadcastSelective, "");
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> ExtendedInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&ExtendedInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b");
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
@@ -330,10 +330,10 @@ ExtendedInterfaceDBusStubAdapterInternal::ExtendedInterfaceDBusStubAdapterIntern
#endif
}
-const bool ExtendedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool ExtendedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
index acbce43..26fc51b 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/ExtendedInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,14 +10,15 @@
#ifndef COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/ExtendedInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-#include "v1_0/commonapi/tests/ExtendedInterfaceDBusDeployment.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>
@@ -25,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -44,7 +45,11 @@ public:
~ExtendedInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return ExtendedInterface::getInterface();
+ }
@@ -75,37 +80,37 @@ public:
}
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
CommonAPI::Version
> getExtendedInterfaceInterfaceVersionStubDispatcher;
#ifdef WIN32
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
uint32_t
> getTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
uint32_t
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -113,7 +118,7 @@ static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment>,
@@ -124,7 +129,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
#ifdef WIN32
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -133,7 +138,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testEmptyMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -142,7 +147,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testVoidPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -151,7 +156,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>,
@@ -160,7 +165,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testVoidDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>,
@@ -169,7 +174,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::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>>,
@@ -178,7 +183,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testArrayOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
@@ -187,7 +192,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testMapOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
@@ -196,7 +201,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testStructWithPolymorphicMemberMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
@@ -208,27 +213,27 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
#ifdef WIN32
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> subscribeTestSelectiveBroadcastSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
> unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- ExtendedInterfaceStub,
+ ::v1::commonapi::tests::ExtendedInterfaceStub,
ExtendedInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
@@ -264,6 +269,6 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Extended_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp
index c96b62e..2d53d35 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "TestFreedesktopDerivedInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestFreedesktopDerivedInterface_ {
@@ -25,4 +25,4 @@ namespace TestFreedesktopDerivedInterface_ {
} // namespace TestFreedesktopDerivedInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp
index bdb1c56..6169af6 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestFreedesktopDerivedInterface_ {
@@ -38,6 +38,6 @@ namespace TestFreedesktopDerivedInterface_ {
} // namespace TestFreedesktopDerivedInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_TESTFREEDESKTOPDERIVEDINTERFACE_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
index d46a6cc..09aac22 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.cpp
@@ -1,15 +1,15 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -20,7 +20,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createTestFreedesktopDerivedInterfac
}
INITIALIZER(registerTestFreedesktopDerivedInterfaceDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
+ CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
TestFreedesktopDerivedInterface::getInterface(),
&createTestFreedesktopDerivedInterfaceDBusProxy);
}
@@ -30,22 +30,22 @@ TestFreedesktopDerivedInterfaceDBusProxy::TestFreedesktopDerivedInterfaceDBusPro
const std::shared_ptr<CommonAPI::DBus::DBusProxyConnection> &_connection)
: CommonAPI::DBus::DBusProxy(_address, _connection),
TestFreedesktopInterfaceDBusProxy(_address, _connection)
-, testAttributedFromDerivedInterface_(*this, "onTestAttributedFromDerivedInterfaceAttributeChanged", "setTestAttributedFromDerivedInterfaceAttribute", "u", "getTestAttributedFromDerivedInterfaceAttribute", static_cast<CommonAPI::EmptyDeployment*>(nullptr))
+, testAttributedFromDerivedInterface_(*this, getAddress().getInterface(), "TestAttributedFromDerivedInterface", static_cast<CommonAPI::EmptyDeployment*>(nullptr))
{
}
- TestFreedesktopDerivedInterfaceDBusProxy::TestAttributedFromDerivedInterfaceAttribute& TestFreedesktopDerivedInterfaceDBusProxy::getTestAttributedFromDerivedInterfaceAttribute() {
- return testAttributedFromDerivedInterface_;
- }
+ TestFreedesktopDerivedInterfaceDBusProxy::TestAttributedFromDerivedInterfaceAttribute& TestFreedesktopDerivedInterfaceDBusProxy::getTestAttributedFromDerivedInterfaceAttribute() {
+ return testAttributedFromDerivedInterface_;
+ }
+
+void TestFreedesktopDerivedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
+ ownVersionMajor = 1;
+ ownVersionMinor = 0;
+ }
- void TestFreedesktopDerivedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1_0
+ } // namespace tests
+ } // namespace commonapi
+ } // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
index 24cfb5c..e7bd68a 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,9 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceProxyBase.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.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
@@ -20,13 +21,15 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -48,15 +51,15 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestAttributedFromDerivedInterfaceAttribute>> testAttributedFromDerivedInterface_;
+
+ CommonAPI::DBus::DBusFreedesktopObservableAttribute<CommonAPI::DBus::DBusFreedesktopAttribute<TestAttributedFromDerivedInterfaceAttribute>> testAttributedFromDerivedInterface_;
};
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
index 75505eb..77577e1 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterface.hpp>
+#include <v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -38,106 +38,88 @@ void TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::deactivateManagedIn
const char* TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData() const {
static const std::string introspectionData =
std::string(TestFreedesktopInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlData()) +
- "<method name=\"getTestAttributedFromDerivedInterfaceAttribute\">\n"
- "<arg name=\"value\" type=\"u\" direction=\"out\" />"
- "</method>\n"
- "<method name=\"setTestAttributedFromDerivedInterfaceAttribute\">\n"
- "<arg name=\"requestedValue\" type=\"u\" direction=\"in\" />\n"
- "<arg name=\"setValue\" type=\"u\" direction=\"out\" />\n"
- "</method>\n"
- "<signal name=\"onTestAttributedFromDerivedInterfaceAttributeChanged\">\n"
- "<arg name=\"changedValue\" type=\"u\" />\n"
- "</signal>\n"
+ "<property name=\"TestAttributedFromDerivedInterface\" type=\"u\" access=\"readwrite\" />\n"
;
return introspectionData.c_str();
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
CommonAPI::Version
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher(&TestFreedesktopDerivedInterfaceStub::getInterfaceVersion, "uu");
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestAttributedFromDerivedInterfaceAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute
- , "u"
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute
);
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestAttributedFromDerivedInterfaceAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute,
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestAttributedFromDerivedInterfaceAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestAttributedFromDerivedInterfaceAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestAttributedFromDerivedInterfaceAttributeChanged
,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestAttributedFromDerivedInterfaceAttributeChanged
- ,"u"
);
#ifdef WIN32
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute
- , "u"
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute
);
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestPredefinedTypeAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- ,"u"
);
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestReadonlyAttributeAttribute
- , "u"
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestReadonlyAttributeAttribute
);
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute
- , "(sqi)"
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute
);
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute,
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedStructAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- ,"(sqi)"
);
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute
- , "at"
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute
);
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute,
+ &::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub::getTestDerivedArrayAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
&TestFreedesktopDerivedInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
,&TestFreedesktopDerivedInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- ,"at"
);
#endif
@@ -146,15 +128,14 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
#endif
void TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t
- >>
- ::sendSignal(
+ CommonAPI::DBus::DBusStubFreedesktopPropertiesSignalHelper<
+ uint32_t,
+ CommonAPI::EmptyDeployment
+ > ::sendPropertiesChangedSignal(
*this,
- "onTestAttributedFromDerivedInterfaceAttributeChanged",
- "u",
- value
-
+ "TestAttributedFromDerivedInterface",
+ value,
+ static_cast<CommonAPI::EmptyDeployment*>(nullptr)
);
}
@@ -178,20 +159,50 @@ TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::TestFreedesktopDerivedIn
TestFreedesktopDerivedInterfaceDBusStubAdapterHelper(_address, _connection, std::dynamic_pointer_cast<TestFreedesktopDerivedInterfaceStub>(_stub), false),
TestFreedesktopInterfaceDBusStubAdapterInternal(_address, _connection, _stub),
stubDispatcherTable_({
- { { "getTestAttributedFromDerivedInterfaceAttribute", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestAttributedFromDerivedInterfaceAttributeStubDispatcher }
- , { { "setTestAttributedFromDerivedInterfaceAttribute", "u" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestAttributedFromDerivedInterfaceAttributeStubDispatcher }
#ifdef WIN32
- ,
- { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher }
- , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher },
- { { "getTestReadonlyAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher },
- { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher }
- , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher },
- { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher }
- , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher }
#endif
}),
- stubAttributeTable_() {
+ 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 });
@@ -212,10 +223,10 @@ TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::TestFreedesktopDerivedIn
#endif
}
-const bool TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
+bool TestFreedesktopDerivedInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+ return true;
}
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
index 7b940ef..52f645e 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopDerivedInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,22 +10,24 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceStub.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp>
-#include "v1_0/commonapi/tests/TestFreedesktopDerivedInterfaceDBusDeployment.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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -44,7 +46,11 @@ public:
~TestFreedesktopDerivedInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return TestFreedesktopDerivedInterface::getInterface();
+ }
void fireTestAttributedFromDerivedInterfaceAttributeChanged(const uint32_t& value);
@@ -76,49 +82,49 @@ public:
}
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
CommonAPI::Version
> getTestFreedesktopDerivedInterfaceInterfaceVersionStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> getTestAttributedFromDerivedInterfaceAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> setTestAttributedFromDerivedInterfaceAttributeStubDispatcher;
#ifdef WIN32
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
uint32_t
> getTestReadonlyAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopDerivedInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopDerivedInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -161,6 +167,6 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Test_Freedesktop_Derived_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp
index f2f2a15..7c2dabd 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "TestFreedesktopInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestFreedesktopInterface_ {
@@ -25,4 +25,4 @@ namespace TestFreedesktopInterface_ {
} // namespace TestFreedesktopInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp
index c5df423..eb509d2 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -11,6 +11,7 @@
#ifndef COMMONAPI_DBUS_TESTFREEDESKTOPINTERFACE_DEPLOYMENT_HPP_
#define COMMONAPI_DBUS_TESTFREEDESKTOPINTERFACE_DEPLOYMENT_HPP_
+#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
@@ -20,7 +21,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestFreedesktopInterface_ {
@@ -39,6 +40,6 @@ namespace TestFreedesktopInterface_ {
} // namespace TestFreedesktopInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_TESTFREEDESKTOPINTERFACE_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
new file mode 100644
index 0000000..79f9fb1
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
@@ -0,0 +1,62 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
index d2a3aa2..be3c892 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
+#include <v1/commonapi/tests/TestFreedesktopInterfaceProxyBase.hpp>
+#include "v1/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -20,13 +20,15 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -51,18 +53,18 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusAttribute<TestPredefinedTypeAttributeAttribute>> testPredefinedTypeAttribute_;
- CommonAPI::DBus::DBusObservableAttribute<CommonAPI::DBus::DBusReadonlyAttribute<TestReadonlyAttributeAttribute>> testReadonlyAttribute_;
- 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::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_0
+} // namespace v1
#endif // 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
new file mode 100644
index 0000000..ed77a4e
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
@@ -0,0 +1,220 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
index 0705da8..dbbfa5a 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,21 +10,24 @@
#ifndef COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceStub.hpp>
-#include "v1_0/commonapi/tests/TestFreedesktopInterfaceDBusDeployment.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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -42,7 +45,11 @@ public:
~TestFreedesktopInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return TestFreedesktopInterface::getInterface();
+ }
void fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value);
void fireTestReadonlyAttributeAttributeChanged(const uint32_t& value);
@@ -58,39 +65,39 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
CommonAPI::Version
> getTestFreedesktopInterfaceInterfaceVersionStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
uint32_t
> getTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
uint32_t
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
uint32_t
> getTestReadonlyAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> getTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> setTestDerivedStructAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusGetFreedesktopAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> getTestDerivedArrayAttributeAttributeStubDispatcher;
-static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
+static CommonAPI::DBus::DBusSetFreedesktopObservableAttributeStubDispatcher<
+ ::v1::commonapi::tests::TestFreedesktopInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -129,6 +136,6 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Test_Freedesktop_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp
index e9d2049..76d5d69 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "TestInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestInterface_ {
@@ -25,4 +25,4 @@ namespace TestInterface_ {
} // namespace TestInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp
index a857619..38acd4c 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -11,6 +11,7 @@
#ifndef COMMONAPI_DBUS_TESTINTERFACE_DEPLOYMENT_HPP_
#define COMMONAPI_DBUS_TESTINTERFACE_DEPLOYMENT_HPP_
+#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
@@ -20,7 +21,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace TestInterface_ {
@@ -39,6 +40,6 @@ namespace TestInterface_ {
} // namespace TestInterface_
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_TESTINTERFACE_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
new file mode 100644
index 0000000..e4eeee7
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.cpp
@@ -0,0 +1,426 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/TestInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp
index 7ac21db..c7c1389 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/TestInterfaceProxyBase.hpp>
-#include <commonapi/tests/DerivedTypeCollectionDBusDeployment.hpp>
+#include <v1/commonapi/tests/TestInterfaceProxyBase.hpp>
+#include "v1/commonapi/tests/TestInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -20,6 +20,7 @@
#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>
@@ -29,7 +30,7 @@
#include <string>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -74,7 +75,7 @@ public:
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_;
@@ -87,7 +88,7 @@ private:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_Test_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
index 52eed4e..67a8b07 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/TestInterface.hpp>
-#include <v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/TestInterface.hpp>
+#include <v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -120,60 +120,60 @@ const char* TestInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
CommonAPI::Version
> TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher(&TestInterfaceStub::getInterfaceVersion, "uu");
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
uint32_t
> TestInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute
+ &::v1::commonapi::tests::TestInterfaceStub::getTestPredefinedTypeAttributeAttribute
, "u"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
uint32_t
> TestInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestPredefinedTypeAttributeAttribute,
+ &::v1::commonapi::tests::TestInterfaceStub::getTestPredefinedTypeAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
,&TestInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
,"u"
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> TestInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestDerivedStructAttributeAttribute
+ &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedStructAttributeAttribute
, "(sqi)"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> TestInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestDerivedStructAttributeAttribute,
+ &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedStructAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
,&TestInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
,"(sqi)"
);
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> TestInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestDerivedArrayAttributeAttribute
+ &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedArrayAttributeAttribute
, "at"
);
CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> TestInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestInterfaceStub::getTestDerivedArrayAttributeAttribute,
+ &::v1::commonapi::tests::TestInterfaceStub::getTestDerivedArrayAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
&TestInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
,&TestInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
@@ -183,7 +183,7 @@ CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -195,7 +195,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -207,7 +207,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -219,7 +219,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::DBus::StringDeployment*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>,
@@ -231,7 +231,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>,
@@ -243,7 +243,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>>,
@@ -255,7 +255,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
@@ -267,7 +267,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
@@ -279,7 +279,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple());
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
@@ -349,14 +349,14 @@ void TestInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeBroadcastEvent(
);
}
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> TestInterfaceDBusStubAdapterInternal::subscribeTestSelectiveBroadcastSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestSelectiveBroadcastSelective, "b");
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
@@ -410,14 +410,14 @@ std::shared_ptr<CommonAPI::ClientIdList> const TestInterfaceDBusStubAdapterInter
return subscribersForTestSelectiveBroadcastSelective_;
}
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> TestInterfaceDBusStubAdapterInternal::subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher(&TestInterfaceStubAdapter::subscribeForTestBroadcastWithOutArgsSelective, "b");
CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
@@ -522,10 +522,10 @@ TestInterfaceDBusStubAdapterInternal::TestInterfaceDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestInterfaceDBusStubAdapterInternal::getTestInterfaceInterfaceVersionStubDispatcher });
}
-const bool TestInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool TestInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
index 2a3ad56..e2a7787 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,13 +10,15 @@
#ifndef COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_Test_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/TestInterfaceStub.hpp>
-#include "v1_0/commonapi/tests/TestInterfaceDBusDeployment.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>
@@ -24,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
@@ -42,7 +44,11 @@ public:
~TestInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ 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);
@@ -68,35 +74,35 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
CommonAPI::Version
> getTestInterfaceInterfaceVersionStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
uint32_t
> getTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
uint32_t
> setTestPredefinedTypeAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> getTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestStructExtended,
::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
> setTestDerivedStructAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> getTestDerivedArrayAttributeAttributeStubDispatcher;
static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
> setTestDerivedArrayAttributeAttributeStubDispatcher;
@@ -104,7 +110,7 @@ static CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -113,7 +119,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testEmptyMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -122,7 +128,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testVoidPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<uint32_t, std::string>,
std::tuple<uint32_t, std::string>,
std::tuple<CommonAPI::EmptyDeployment, CommonAPI::DBus::StringDeployment>,
@@ -131,7 +137,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testPredefinedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>,
@@ -140,7 +146,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testVoidDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>,
@@ -149,7 +155,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testDerivedTypeMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::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>>,
@@ -158,7 +164,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testArrayOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::MapIntToPolymorphic>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::MapIntToPolymorphicDeployment_t>,
@@ -167,7 +173,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testMapOfPolymorphicStructMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithPolymorphicMember>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithPolymorphicMemberDeployment_t>,
@@ -176,7 +182,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testStructWithPolymorphicMemberMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
std::tuple<::commonapi::tests::DerivedTypeCollection::StructWithEnumKeyMap>,
std::tuple<>,
std::tuple<::commonapi::tests::DerivedTypeCollection_::StructWithEnumKeyMapDeployment_t>,
@@ -186,27 +192,27 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> subscribeTestSelectiveBroadcastSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
> unsubscribeTestSelectiveBroadcastSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<bool>
> subscribeTestBroadcastWithOutArgsSelectiveStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyAdapterDispatcher<
- TestInterfaceStub,
+ ::v1::commonapi::tests::TestInterfaceStub,
TestInterfaceStubAdapter,
std::tuple<>,
std::tuple<>
@@ -242,6 +248,6 @@ public:
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // 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
new file mode 100644
index 0000000..8cfbdf1
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.cpp
@@ -0,0 +1,28 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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
new file mode 100644
index 0000000..d1ea4b5
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusDeployment.hpp
@@ -0,0 +1,43 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_DBUS_TESTINTERFACEMANAGER_DEPLOYMENT_HPP_
+#define COMMONAPI_DBUS_TESTINTERFACEMANAGER_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 // COMMONAPI_DBUS_TESTINTERFACEMANAGER_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
new file mode 100644
index 0000000..594c9f3
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.cpp
@@ -0,0 +1,50 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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
new file mode 100644
index 0000000..ca52bac
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusProxy.hpp
@@ -0,0 +1,63 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_Test_Interface_Manager_DBUS_PROXY_HPP_
+#define 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 // 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
new file mode 100644
index 0000000..511b538
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.cpp
@@ -0,0 +1,149 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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
new file mode 100644
index 0000000..1d2fd09
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/TestInterfaceManagerDBusStubAdapter.hpp
@@ -0,0 +1,108 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_Test_Interface_Manager_DBUS_STUB_ADAPTER_HPP_
+#define 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 // COMMONAPI_TESTS_Test_Interface_Manager_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp
index f58b844..19e51f5 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "BranchInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -27,4 +27,4 @@ namespace BranchInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp
index f87fdb9..49bdd2c 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,6 +40,6 @@ namespace BranchInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_BRANCHINTERFACE_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
new file mode 100644
index 0000000..43872d8
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
@@ -0,0 +1,105 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
index 4f66233..36987e2 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,7 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceProxyBase.hpp>
+#include "v1/commonapi/tests/managed/BranchInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -19,12 +20,13 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -48,7 +50,7 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
};
@@ -56,7 +58,7 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
index ce8f413..7fb3e68 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/managed/BranchInterface.hpp>
-#include <v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/managed/BranchInterface.hpp>
+#include <v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -54,7 +54,7 @@ const char* BranchInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- BranchInterfaceStub,
+ ::v1::commonapi::tests::managed::BranchInterfaceStub,
CommonAPI::Version
> BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher(&BranchInterfaceStub::getInterfaceVersion, "uu");
@@ -62,7 +62,7 @@ CommonAPI::DBus::DBusGetAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- BranchInterfaceStub,
+ ::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>,
@@ -99,11 +99,11 @@ BranchInterfaceDBusStubAdapterInternal::BranchInterfaceDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::BranchInterfaceDBusStubAdapterInternal::getBranchInterfaceInterfaceVersionStubDispatcher });
}
-const bool BranchInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool BranchInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
index 1da6539..a66319e 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/BranchInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,13 +10,14 @@
#ifndef COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/managed/BranchInterfaceStub.hpp>
-#include "v1_0/commonapi/tests/managed/BranchInterfaceDBusDeployment.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>
@@ -24,7 +25,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -43,7 +44,11 @@ public:
~BranchInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return BranchInterface::getInterface();
+ }
@@ -55,7 +60,7 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- BranchInterfaceStub,
+ ::v1::commonapi::tests::managed::BranchInterfaceStub,
CommonAPI::Version
> getBranchInterfaceInterfaceVersionStubDispatcher;
@@ -63,7 +68,7 @@ static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- BranchInterfaceStub,
+ ::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>,
@@ -104,6 +109,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Branch_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp
index d28ab96..ad090e2 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "LeafInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -27,4 +27,4 @@ namespace LeafInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp
index 71e0f4c..2263af3 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,6 +40,6 @@ namespace LeafInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_LEAFINTERFACE_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
new file mode 100644
index 0000000..fd4df47
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
@@ -0,0 +1,105 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
index 8fec7ca..8eff349 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,7 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceProxyBase.hpp>
+#include "v1/commonapi/tests/managed/LeafInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -19,12 +20,13 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -48,7 +50,7 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
};
@@ -56,7 +58,7 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
index d622168..dbf3f36 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/managed/LeafInterface.hpp>
-#include <v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/managed/LeafInterface.hpp>
+#include <v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -54,7 +54,7 @@ const char* LeafInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- LeafInterfaceStub,
+ ::v1::commonapi::tests::managed::LeafInterfaceStub,
CommonAPI::Version
> LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher(&LeafInterfaceStub::getInterfaceVersion, "uu");
@@ -62,7 +62,7 @@ CommonAPI::DBus::DBusGetAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LeafInterfaceStub,
+ ::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>,
@@ -99,11 +99,11 @@ LeafInterfaceDBusStubAdapterInternal::LeafInterfaceDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::LeafInterfaceDBusStubAdapterInternal::getLeafInterfaceInterfaceVersionStubDispatcher });
}
-const bool LeafInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool LeafInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
index 853dbfb..ca99f2f 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/LeafInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,13 +10,14 @@
#ifndef COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/managed/LeafInterfaceStub.hpp>
-#include "v1_0/commonapi/tests/managed/LeafInterfaceDBusDeployment.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>
@@ -24,7 +25,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -43,7 +44,11 @@ public:
~LeafInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return LeafInterface::getInterface();
+ }
@@ -55,7 +60,7 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- LeafInterfaceStub,
+ ::v1::commonapi::tests::managed::LeafInterfaceStub,
CommonAPI::Version
> getLeafInterfaceInterfaceVersionStubDispatcher;
@@ -63,7 +68,7 @@ static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LeafInterfaceStub,
+ ::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>,
@@ -104,6 +109,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Leaf_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp
index c514b7e..7df2021 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "RootInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -27,4 +27,4 @@ namespace RootInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp
index 63a1fdf..1d3e157 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,6 +40,6 @@ namespace RootInterface_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_ROOTINTERFACE_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
new file mode 100644
index 0000000..8115315
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
@@ -0,0 +1,113 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
index a0c7443..f0a458f 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,7 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
+#include <v1/commonapi/tests/managed/RootInterfaceProxyBase.hpp>
+#include "v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -19,13 +20,14 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -51,7 +53,7 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
@@ -61,7 +63,7 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
index c414d4c..6466b61 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/managed/RootInterface.hpp>
-#include <v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/managed/RootInterface.hpp>
+#include <v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -78,7 +78,7 @@ const char* RootInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionXml
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- RootInterfaceStub,
+ ::v1::commonapi::tests::managed::RootInterfaceStub,
CommonAPI::Version
> RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher(&RootInterfaceStub::getInterfaceVersion, "uu");
@@ -86,7 +86,7 @@ CommonAPI::DBus::DBusGetAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- RootInterfaceStub,
+ ::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>,
@@ -108,7 +108,7 @@ const RootInterfaceDBusStubAdapterHelper::StubDispatcherTable& RootInterfaceDBus
const CommonAPI::DBus::StubAttributeTable& RootInterfaceDBusStubAdapterInternal::getStubAttributeTable() {
return stubAttributeTable_;
}
-bool RootInterfaceDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+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;
@@ -156,7 +156,7 @@ bool RootInterfaceDBusStubAdapterInternal::deregisterManagedStubLeafInterface(co
std::set<std::string>& RootInterfaceDBusStubAdapterInternal::getLeafInterfaceInstances() {
return registeredLeafInterfaceInstances;
}
-bool RootInterfaceDBusStubAdapterInternal::registerManagedStubBranchInterface(std::shared_ptr<BranchInterfaceStub> _stub, const std::string &_instance) {
+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;
@@ -219,11 +219,11 @@ RootInterfaceDBusStubAdapterInternal::RootInterfaceDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::RootInterfaceDBusStubAdapterInternal::getRootInterfaceInterfaceVersionStubDispatcher });
}
-const bool RootInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool RootInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
index d50ebe4..de6ffe9 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/RootInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/managed/RootInterfaceStub.hpp>
-#include "v1_0/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp"
+#include <v1/commonapi/tests/managed/RootInterfaceStub.hpp>
+#include "v1/commonapi/tests/managed/RootInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -26,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -45,14 +45,18 @@ public:
~RootInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return RootInterface::getInterface();
+ }
- bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
+ 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<BranchInterfaceStub>, const std::string&);
+ bool registerManagedStubBranchInterface(std::shared_ptr<::v1::commonapi::tests::managed::BranchInterfaceStub>, const std::string&);
bool deregisterManagedStubBranchInterface(const std::string&);
std::set<std::string>& getBranchInterfaceInstances();
@@ -63,7 +67,7 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- RootInterfaceStub,
+ ::v1::commonapi::tests::managed::RootInterfaceStub,
CommonAPI::Version
> getRootInterfaceInterfaceVersionStubDispatcher;
@@ -71,7 +75,7 @@ static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- RootInterfaceStub,
+ ::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>,
@@ -114,6 +118,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Root_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp
index 855d2af..596e267 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "SecondRootDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -27,4 +27,4 @@ namespace SecondRoot_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp
index d328176..423adf0 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -40,6 +40,6 @@ namespace SecondRoot_ {
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_SECONDROOT_DEPLOYMENT_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp
index 767912b..35fac99 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.cpp
@@ -1,15 +1,15 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/managed/SecondRootDBusProxy.hpp>
+#include <v1/commonapi/tests/managed/SecondRootDBusProxy.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -21,7 +21,7 @@ std::shared_ptr<CommonAPI::DBus::DBusProxy> createSecondRootDBusProxy(
}
INITIALIZER(registerSecondRootDBusProxy) {
- CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
+ CommonAPI::DBus::Factory::get()->registerProxyCreateMethod(
SecondRoot::getInterface(),
&createSecondRootDBusProxy);
}
@@ -35,18 +35,18 @@ SecondRootDBusProxy::SecondRootDBusProxy(
}
+
+CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() {
+return proxyManagerLeafInterface_;
+ }
- CommonAPI::ProxyManager& SecondRootDBusProxy::getProxyManagerLeafInterface() {
- return proxyManagerLeafInterface_;
- }
+void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
+ ownVersionMajor = 1;
+ ownVersionMinor = 0;
+ }
- void SecondRootDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace managed
- } // namespace tests
- } // namespace commonapi
- } // namespace v1_0
+ } // namespace managed
+ } // namespace tests
+ } // namespace commonapi
+ } // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp
index 82e6e06..ed2e0d3 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,7 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
-#include <v1_0/commonapi/tests/managed/SecondRootProxyBase.hpp>
+#include <v1/commonapi/tests/managed/SecondRootProxyBase.hpp>
+#include "v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -19,13 +20,14 @@
#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_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -48,7 +50,7 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
CommonAPI::DBus::DBusProxyManager proxyManagerLeafInterface_;
@@ -57,7 +59,7 @@ private:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
index 36b8c10..355c97c 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/commonapi/tests/managed/SecondRoot.hpp>
-#include <v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp>
+#include <v1/commonapi/tests/managed/SecondRoot.hpp>
+#include <v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -61,7 +61,7 @@ const char* SecondRootDBusStubAdapterInternal::getMethodsDBusIntrospectionXmlDat
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- SecondRootStub,
+ ::v1::commonapi::tests::managed::SecondRootStub,
CommonAPI::Version
> SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher(&SecondRootStub::getInterfaceVersion, "uu");
@@ -79,7 +79,7 @@ const SecondRootDBusStubAdapterHelper::StubDispatcherTable& SecondRootDBusStubAd
const CommonAPI::DBus::StubAttributeTable& SecondRootDBusStubAdapterInternal::getStubAttributeTable() {
return stubAttributeTable_;
}
-bool SecondRootDBusStubAdapterInternal::registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub> _stub, const std::string &_instance) {
+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;
@@ -141,11 +141,11 @@ SecondRootDBusStubAdapterInternal::SecondRootDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::managed::SecondRootDBusStubAdapterInternal::getSecondRootInterfaceVersionStubDispatcher });
}
-const bool SecondRootDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool SecondRootDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
index eaf9944..f68ffa7 100644
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/commonapi/tests/managed/SecondRootDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,8 +10,8 @@
#ifndef COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
#define COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/commonapi/tests/managed/SecondRootStub.hpp>
-#include "v1_0/commonapi/tests/managed/SecondRootDBusDeployment.hpp"
+#include <v1/commonapi/tests/managed/SecondRootStub.hpp>
+#include "v1/commonapi/tests/managed/SecondRootDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -26,7 +26,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace commonapi {
namespace tests {
namespace managed {
@@ -45,11 +45,15 @@ public:
~SecondRootDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return SecondRoot::getInterface();
+ }
- bool registerManagedStubLeafInterface(std::shared_ptr<LeafInterfaceStub>, const std::string&);
+ bool registerManagedStubLeafInterface(std::shared_ptr<::v1::commonapi::tests::managed::LeafInterfaceStub>, const std::string&);
bool deregisterManagedStubLeafInterface(const std::string&);
std::set<std::string>& getLeafInterfaceInstances();
@@ -60,7 +64,7 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- SecondRootStub,
+ ::v1::commonapi::tests::managed::SecondRootStub,
CommonAPI::Version
> getSecondRootInterfaceVersionStubDispatcher;
@@ -101,6 +105,6 @@ public:
} // namespace managed
} // namespace tests
} // namespace commonapi
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_TESTS_MANAGED_Second_Root_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp
index 19d9740..71bbbe1 100644
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.cpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -9,7 +9,7 @@
*/
#include "LegacyInterfaceDBusDeployment.hpp"
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -27,4 +27,4 @@ namespace LegacyInterface_ {
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp
index b06463d..5497d10 100644
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -19,7 +19,7 @@
#include <CommonAPI/DBus/DBusDeployment.hpp>
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -40,6 +40,6 @@ namespace LegacyInterface_ {
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
#endif // COMMONAPI_DBUS_LEGACYINTERFACE_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
new file mode 100644
index 0000000..d0c7aba
--- /dev/null
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
@@ -0,0 +1,166 @@
+/*
+* This file was generated by the CommonAPI Generators.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
+* 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_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
index dbebd0f..19b7d79 100644
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusProxy.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,7 +10,8 @@
#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
#define FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
-#include <v1_0/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceProxyBase.hpp>
+#include "v1/fake/legacy/service/LegacyInterfaceDBusDeployment.hpp"
#if !defined (COMMONAPI_INTERNAL_COMPILATION)
#define COMMONAPI_INTERNAL_COMPILATION
@@ -19,12 +20,13 @@
#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_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -52,7 +54,7 @@ public:
virtual void getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const;
private:
-
+
};
@@ -60,7 +62,7 @@ private:
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_PROXY_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
index 6cae1e8..9c145ea 100644
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.cpp
@@ -1,16 +1,16 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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_0/fake/legacy/service/LegacyInterface.hpp>
-#include <v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp>
+#include <v1/fake/legacy/service/LegacyInterface.hpp>
+#include <v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp>
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -58,7 +58,7 @@ const char* LegacyInterfaceDBusStubAdapterInternal::getMethodsDBusIntrospectionX
}
CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
CommonAPI::Version
> LegacyInterfaceDBusStubAdapterInternal::getLegacyInterfaceInterfaceVersionStubDispatcher(&LegacyInterfaceStub::getInterfaceVersion, "uu");
@@ -66,7 +66,7 @@ CommonAPI::DBus::DBusGetAttributeStubDispatcher<
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<int32_t>,
std::tuple<int32_t, int32_t>,
std::tuple<CommonAPI::EmptyDeployment>,
@@ -78,7 +78,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::EmptyDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<>,
std::tuple<std::string, int32_t>,
std::tuple<>,
@@ -90,7 +90,7 @@ CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
std::make_tuple(static_cast<CommonAPI::DBus::StringDeployment*>(nullptr), static_cast<CommonAPI::EmptyDeployment*>(nullptr)));
CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -129,11 +129,11 @@ LegacyInterfaceDBusStubAdapterInternal::LegacyInterfaceDBusStubAdapterInternal(
stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &fake::legacy::service::LegacyInterfaceDBusStubAdapterInternal::getLegacyInterfaceInterfaceVersionStubDispatcher });
}
-const bool LegacyInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
+bool LegacyInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
return false;
}
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
diff --git a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
index 8aec0a1..95b2423 100644
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
+++ b/src/test/src-gen/dbus/v1/fake/legacy/service/LegacyInterfaceDBusStubAdapter.hpp
@@ -1,6 +1,6 @@
/*
* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
+* Used org.genivi.commonapi.dbus 3.1.4.v201511201313.
* 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.
@@ -10,13 +10,14 @@
#ifndef FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
#define FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
-#include <v1_0/fake/legacy/service/LegacyInterfaceStub.hpp>
-#include "v1_0/fake/legacy/service/LegacyInterfaceDBusDeployment.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>
@@ -24,7 +25,7 @@
#undef COMMONAPI_INTERNAL_COMPILATION
-namespace v1_0 {
+namespace v1 {
namespace fake {
namespace legacy {
namespace service {
@@ -43,7 +44,11 @@ public:
~LegacyInterfaceDBusStubAdapterInternal();
- virtual const bool hasFreedesktopProperties();
+ virtual bool hasFreedesktopProperties();
+
+ inline static const char* getInterface() {
+ return LegacyInterface::getInterface();
+ }
@@ -55,7 +60,7 @@ public:
static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
CommonAPI::Version
> getLegacyInterfaceInterfaceVersionStubDispatcher;
@@ -63,7 +68,7 @@ static CommonAPI::DBus::DBusGetAttributeStubDispatcher<
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<int32_t>,
std::tuple<int32_t, int32_t>,
std::tuple<CommonAPI::EmptyDeployment>,
@@ -72,7 +77,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> testMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<>,
std::tuple<std::string, int32_t>,
std::tuple<>,
@@ -81,7 +86,7 @@ static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
> otherTestMethodStubDispatcher;
static CommonAPI::DBus::DBusMethodWithReplyStubDispatcher<
- LegacyInterfaceStub,
+ ::v1::fake::legacy::service::LegacyInterfaceStub,
std::tuple<>,
std::tuple<>,
std::tuple<>,
@@ -122,6 +127,6 @@ public:
} // namespace service
} // namespace legacy
} // namespace fake
-} // namespace v1_0
+} // namespace v1
#endif // FAKE_LEGACY_SERVICE_Legacy_Interface_DBUS_STUB_ADAPTER_HPP_
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
deleted file mode 100644
index 48758f3..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/ExtendedInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/ExtendedInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status) {
- _callback(_status);
- },
- std::make_tuple());
- }
-
-
- void ExtendedInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
deleted file mode 100644
index 82a772c..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/TestFreedesktopInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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, "onTestPredefinedTypeAttributeAttributeChanged", "setTestPredefinedTypeAttributeAttribute", "u", "getTestPredefinedTypeAttributeAttribute", static_cast<CommonAPI::EmptyDeployment*>(nullptr)),
- testReadonlyAttribute_(*this, "onTestReadonlyAttributeAttributeChanged", "u", "getTestReadonlyAttributeAttribute", 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))
-{
-}
-
- 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_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
deleted file mode 100644
index 11b53d4..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/TestFreedesktopInterface.hpp>
-#include <v1_0/commonapi/tests/TestFreedesktopInterfaceDBusStubAdapter.hpp>
-
-namespace v1_0 {
-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"
- "<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=\"getTestReadonlyAttributeAttribute\">\n"
- "<arg name=\"value\" type=\"u\" direction=\"out\" />"
- "</method>\n"
- "<signal name=\"onTestReadonlyAttributeAttributeChanged\">\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"
-
- ;
- return introspectionData.c_str();
-}
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- CommonAPI::Version
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestFreedesktopInterfaceInterfaceVersionStubDispatcher(&TestFreedesktopInterfaceStub::getInterfaceVersion, "uu");
-
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestPredefinedTypeAttributeAttribute
- , "u"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestPredefinedTypeAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestPredefinedTypeAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestPredefinedTypeAttributeAttributeChanged
- ,"u"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- uint32_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestReadonlyAttributeAttribute
- , "u"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute
- , "(sqi)"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestStructExtended,
- ::commonapi::tests::DerivedTypeCollection_::TestStructExtendedDeployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestDerivedStructAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedStructAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestDerivedStructAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestDerivedStructAttributeAttributeChanged
- ,"(sqi)"
- );
-CommonAPI::DBus::DBusGetAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute
- , "at"
- );
-CommonAPI::DBus::DBusSetObservableAttributeStubDispatcher<
- TestFreedesktopInterfaceStub,
- ::commonapi::tests::DerivedTypeCollection::TestArrayUInt64,
- ::commonapi::tests::DerivedTypeCollection_::TestArrayUInt64Deployment_t
- > TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher(
- &TestFreedesktopInterfaceStub::getTestDerivedArrayAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteSetTestDerivedArrayAttributeAttribute,
- &TestFreedesktopInterfaceStubRemoteEvent::onRemoteTestDerivedArrayAttributeAttributeChanged
- ,&TestFreedesktopInterfaceStubAdapter::fireTestDerivedArrayAttributeAttributeChanged
- ,"at"
- );
-
-
-
-
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestPredefinedTypeAttributeAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t
- >>
- ::sendSignal(
- *this,
- "onTestPredefinedTypeAttributeAttributeChanged",
- "u",
- value
-
- );
-}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::fireTestReadonlyAttributeAttributeChanged(const uint32_t& value) {
- CommonAPI::DBus::DBusStubSignalHelper<CommonAPI::DBus::DBusSerializableArguments<
- uint32_t
- >>
- ::sendSignal(
- *this,
- "onTestReadonlyAttributeAttributeChanged",
- "u",
- value
-
- );
-}
-void TestFreedesktopInterfaceDBusStubAdapterInternal::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 TestFreedesktopInterfaceDBusStubAdapterInternal::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
-
- );
-}
-
-
-
-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_({
- { { "getTestPredefinedTypeAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestPredefinedTypeAttributeAttributeStubDispatcher }
- , { { "setTestPredefinedTypeAttributeAttribute", "u" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestPredefinedTypeAttributeAttributeStubDispatcher },
- { { "getTestReadonlyAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestReadonlyAttributeAttributeStubDispatcher },
- { { "getTestDerivedStructAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedStructAttributeAttributeStubDispatcher }
- , { { "setTestDerivedStructAttributeAttribute", "(sqi)" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedStructAttributeAttributeStubDispatcher },
- { { "getTestDerivedArrayAttributeAttribute", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestDerivedArrayAttributeAttributeStubDispatcher }
- , { { "setTestDerivedArrayAttributeAttribute", "at" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::setTestDerivedArrayAttributeAttributeStubDispatcher }
- }),
- stubAttributeTable_() {
-
- stubDispatcherTable_.insert({ { "getInterfaceVersion", "" }, &commonapi::tests::TestFreedesktopInterfaceDBusStubAdapterInternal::getTestFreedesktopInterfaceInterfaceVersionStubDispatcher });
-}
-
-const bool TestFreedesktopInterfaceDBusStubAdapterInternal::hasFreedesktopProperties() {
- return false;
-}
-
-} // namespace tests
-} // namespace commonapi
-} // namespace v1_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp
deleted file mode 100644
index 94240f6..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/TestInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/TestInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status) {
- _callback(_status);
- },
- 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 _status) {
- _callback(_status);
- },
- 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 _status, CommonAPI::Deployable<uint32_t, CommonAPI::EmptyDeployment> _uint32OutValue, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _stringOutValue) {
- _callback(_status, _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 _status) {
- _callback(_status);
- },
- 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 _status, CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestEnumExtended2, CommonAPI::EmptyDeployment> _testEnumExtended2OutValue, CommonAPI::Deployable<::commonapi::tests::DerivedTypeCollection::TestMap, ::commonapi::tests::DerivedTypeCollection_::TestMapDeployment_t> _testMapOutValue) {
- _callback(_status, _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 _status) {
- _callback(_status);
- },
- 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 _status) {
- _callback(_status);
- },
- 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 _status) {
- _callback(_status);
- },
- 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 _status) {
- _callback(_status);
- },
- std::make_tuple());
- }
-
-
- void TestInterfaceDBusProxy::getOwnVersion(uint16_t& ownVersionMajor, uint16_t& ownVersionMinor) const {
- ownVersionMajor = 1;
- ownVersionMinor = 0;
- }
-
- } // namespace tests
- } // namespace commonapi
- } // namespace v1_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
deleted file mode 100644
index 0c7c6ce..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/BranchInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/managed/BranchInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status, CommonAPI::Deployable<BranchInterface::testBranchMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- _callback(_status, _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_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
deleted file mode 100644
index 6a26285..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/LeafInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/managed/LeafInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status, CommonAPI::Deployable<LeafInterface::testLeafMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- _callback(_status, _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_0
diff --git a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
deleted file mode 100644
index 4ad729e..0000000
--- a/src/test/src-gen/dbus/v1_0/commonapi/tests/managed/RootInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/commonapi/tests/managed/RootInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status, CommonAPI::Deployable<RootInterface::testRootMethodError, CommonAPI::EmptyDeployment> _deploy_error, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _outInt, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _outString) {
- _callback(_status, _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_0
diff --git a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp b/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
deleted file mode 100644
index 0a14ba3..0000000
--- a/src/test/src-gen/dbus/v1_0/fake/legacy/service/LegacyInterfaceDBusProxy.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-* This file was generated by the CommonAPI Generators.
-* Used org.genivi.commonapi.core 3.1.2.v201507021046.
-* 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_0/fake/legacy/service/LegacyInterfaceDBusProxy.hpp>
-
-namespace v1_0 {
-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 _status, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _val1, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _val2) {
- _callback(_status, _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 _status, CommonAPI::Deployable<std::string, CommonAPI::DBus::StringDeployment> _greeting, CommonAPI::Deployable<int32_t, CommonAPI::EmptyDeployment> _identifier) {
- _callback(_status, _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 _status) {
- _callback(_status);
- },
- 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_0
diff --git a/src/test/test-commonapi-dbus.ini b/src/test/test-commonapi-dbus.ini
new file mode 100644
index 0000000..45df7e2
--- /dev/null
+++ b/src/test/test-commonapi-dbus.ini
@@ -0,0 +1,66 @@
+[not#a$valid/address]
+[]
+ 98t3hpgjvqpvnü0 t4b+qßk4 kv+üg4krgv+ß4krgv+ßkr
+[too.short:address]
+[incomplete:address:]
+[:address:incomplete]
+[]đwqervqerverver
+[too:long:address:here]
+jfgv2nqp3 riqpnvi39r[]
+[local:no.nothing.service:no.nothing.instance]
+
+[local:service:instance]
+service=service.name_connection.name
+path=/path/to/object
+interface=service.name
+
+[local:no.interface.service:no.interface.instance]
+service=no.interface.connection
+path=/no/interface/path
+
+[local:no.connection.service:no.connection.instance]
+path=/no/connection/path
+interface=no.connection.interface
+
+[local:no.object.service:no.object.instance]
+service=no.object.connection
+interface=no.object.interface
+
+[local:only.interface.service:only.interface.instance]
+interface=only.interface.interface
+
+[local:only.connection.service:only.connection.instance]
+service=only.connection.connection
+
+[local:only.object.service:only.object.instance]
+path=/only/object/path
+
+[local:fake.legacy.service.LegacyInterface:fake.legacy.service]
+service=fake.legacy.service.connection
+path=/some/legacy/path/6259504
+interface=fake.legacy.service.LegacyInterface
+
+[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceOne]
+service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceOne
+path=/commonapi/tests/managed/RootInterface
+interface=commonapi.tests.managed.RootInterface
+
+[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceTwo]
+service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceTwo
+path=/commonapi/tests/managed/RootInterface
+interface=commonapi.tests.managed.RootInterface
+
+[local:commonapi.tests.managed.RootInterface:commonapi.tests.managed.RootInterfaceThree]
+service=commonapi.tests.managed.roots.on.same.object.path.RootInterfaceThree
+path=/commonapi/tests/managed/RootInterface
+interface=commonapi.tests.managed.RootInterface
+
+[local:commonapi.tests.managed.LeafInterface:commonapi.tests.managed.config.affects.LeafInterface.Unmanaged]
+service=commonapi.tests.managed.config.affects.interface.unmanaged
+path=/commonapi/tests/managed/RootInterface/LeafInterface/Unmanaged
+interface=commonapi.tests.managed.LeafInterface
+
+[local:commonapi.tests.managed.LeafInterface:commonapi.tests.managed.config.affects.LeafInterface.Managed]
+service=commonapi.tests.managed.config.affects.interface.managed
+path=/commonapi/tests/managed/RootInterface/LeafInterface/Managed
+interface=commonapi.tests.managed.LeafInterface
diff --git a/src/test/test-derived-types.fidl b/src/test/test-derived-types.fidl
index 5d72a09..9add653 100644
--- a/src/test/test-derived-types.fidl
+++ b/src/test/test-derived-types.fidl
@@ -9,78 +9,78 @@ import commonapi.tests.* from "test-predefined-types.fidl"
typeCollection DerivedTypeCollection {
- map TestMap { UInt32 to TestArrayTestStruct }
+ map TestMap { UInt32 to TestArrayTestStruct }
- struct TestStructExtended extends TestStruct {
- TestEnumExtended2 testEnumExtended2
- }
+ struct TestStructExtended extends TestStruct {
+ TestEnumExtended2 testEnumExtended2
+ }
- map TestEnumMap { TestEnum to String }
+ 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"
- }
+ <** @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
+ 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 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
- }
-
+ <** @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
index 067ccec..cd2479a 100644
--- a/src/test/test-freedesktop-interface.fdepl
+++ b/src/test/test-freedesktop-interface.fdepl
@@ -8,7 +8,7 @@ import "test-freedesktop-interface.fidl"
define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopInterface {
- DBusDefaultAttributeType = freedesktop
+ DBusDefaultAttributeType = freedesktop
}
define org.genivi.commonapi.dbus.deployment for interface commonapi.tests.TestFreedesktopDerivedInterface {
diff --git a/src/test/test-interface-proxy.fidl b/src/test/test-interface-proxy.fidl
index 0f4b33c..3f12dec 100644
--- a/src/test/test-interface-proxy.fidl
+++ b/src/test/test-interface-proxy.fidl
@@ -8,50 +8,50 @@ 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
- }
- }
+ 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 {
@@ -66,34 +66,34 @@ interface TestInterface {
}
method TestStructWithPolymorphicMemberMethod {
- in {
- DerivedTypeCollection.StructWithPolymorphicMember inStruct
- }
+ in {
+ DerivedTypeCollection.StructWithPolymorphicMember inStruct
+ }
}
method TestStructWithEnumKeyMapMember {
- in {
- DerivedTypeCollection.StructWithEnumKeyMap inStruct
- }
+ in {
+ DerivedTypeCollection.StructWithEnumKeyMap inStruct
+ }
}
- broadcast TestPredefinedTypeBroadcast {
- out {
- UInt32 uint32Value
- String stringValue
- }
- }
+ broadcast TestPredefinedTypeBroadcast {
+ out {
+ UInt32 uint32Value
+ String stringValue
+ }
+ }
- broadcast TestSelectiveBroadcast selective {
- }
-
- broadcast TestBroadcastWithOutArgs selective {
+ broadcast TestSelectiveBroadcast selective {
+ }
+
+ broadcast TestBroadcastWithOutArgs selective {
out {
UInt32 uint32Value
String stringValue
- }
- }
+ }
+ }
}
interface ExtendedInterface extends TestInterface {
@@ -104,4 +104,8 @@ interface ExtendedInterface extends TestInterface {
UInt32 inInt
}
}
-} \ No newline at end of file
+}
+
+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
index 96f8613..d7893d2 100644
--- a/src/test/test-predefined-types.fidl
+++ b/src/test/test-predefined-types.fidl
@@ -6,19 +6,19 @@
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
+ 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
}